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

Function wiringPiNewNode

wiringPi/wiringPi.c:1676–1709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1674static void analogWriteDummy (UNU struct wiringPiNodeStruct *node, UNU int pin, UNU int value) { return ; }
1675
1676struct wiringPiNodeStruct *wiringPiNewNode (int pinBase, int numPins)
1677{
1678 int pin ;
1679 struct wiringPiNodeStruct *node ;
1680
1681// Minimum pin base is 64
1682
1683 if (pinBase < 64)
1684 (void)wiringPiFailure (WPI_FATAL, "wiringPiNewNode: pinBase of %d is < 64\n", pinBase) ;
1685
1686// Check all pins in-case there is overlap:
1687
1688 for (pin = pinBase ; pin < (pinBase + numPins) ; ++pin)
1689 if (wiringPiFindNode (pin) != NULL)
1690 (void)wiringPiFailure (WPI_FATAL, "wiringPiNewNode: Pin %d overlaps with existing definition\n", pin) ;
1691
1692 node = (struct wiringPiNodeStruct *)calloc(1, sizeof (struct wiringPiNodeStruct)); // calloc zeros
1693 if (node == NULL)
1694 (void)wiringPiFailure (WPI_FATAL, "wiringPiNewNode: Unable to allocate memory: %s\n", strerror (errno)) ;
1695
1696 node->pinBase = pinBase ;
1697 node->pinMax = pinBase + numPins - 1 ;
1698 node->pinMode = pinModeDummy ;
1699 node->pullUpDnControl = pullUpDnControlDummy ;
1700 node->digitalRead = digitalReadDummy ;
1701 node->digitalWrite = digitalWriteDummy ;
1702 node->pwmWrite = pwmWriteDummy ;
1703 node->analogRead = analogReadDummy ;
1704 node->analogWrite = analogWriteDummy ;
1705 node->next = wiringPiNodes ;
1706 wiringPiNodes = node ;
1707
1708 return node ;
1709}
1710
1711
1712#ifdef notYetReady

Callers 15

gertboardAnalogSetupFunction · 0.85
piFaceSetupFunction · 0.85
piFaceSetupFunction · 0.85
mcp23s08SetupFunction · 0.85
pcf8591SetupFunction · 0.85
mcp3422SetupFunction · 0.85
sr595SetupFunction · 0.85
pseudoPinsSetupFunction · 0.85
drcSetupSerialFunction · 0.85
drcSetupNetFunction · 0.85
max5322SetupFunction · 0.85
mcp23008SetupFunction · 0.85

Calls 2

wiringPiFailureFunction · 0.85
wiringPiFindNodeFunction · 0.85

Tested by

no test coverage detected