MCPcopy Create free account
hub / github.com/WiringPi/WiringPi / myAnalogRead

Function myAnalogRead

wiringPi/pcf8591.c:58–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56 */
57
58static int myAnalogRead (struct wiringPiNodeStruct *node, int pin)
59{
60 int x ;
61
62 wiringPiI2CWrite (node->fd, 0x40 | ((pin - node->pinBase) & 3)) ;
63
64 x = wiringPiI2CRead (node->fd) ; // Throw away the first read
65 x = wiringPiI2CRead (node->fd) ;
66
67 return x ;
68}
69
70
71/*

Callers

nothing calls this directly

Calls 2

wiringPiI2CWriteFunction · 0.85
wiringPiI2CReadFunction · 0.85

Tested by

no test coverage detected