| 1674 | static void analogWriteDummy (UNU struct wiringPiNodeStruct *node, UNU int pin, UNU int value) { return ; } |
| 1675 | |
| 1676 | struct 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 |
no test coverage detected