| 87 | */ |
| 88 | |
| 89 | int piFaceSetup (const int pinBase) |
| 90 | { |
| 91 | int i ; |
| 92 | struct wiringPiNodeStruct *node ; |
| 93 | |
| 94 | // Create an mcp23s17 instance: |
| 95 | |
| 96 | mcp23s17Setup (pinBase + 16, 0, 0) ; |
| 97 | |
| 98 | // Set the direction bits |
| 99 | |
| 100 | for (i = 0 ; i < 8 ; ++i) |
| 101 | { |
| 102 | pinMode (pinBase + 16 + i, OUTPUT) ; // Port A is the outputs |
| 103 | pinMode (pinBase + 16 + 8 + i, INPUT) ; // Port B inputs. |
| 104 | } |
| 105 | |
| 106 | node = wiringPiNewNode (pinBase, 16) ; |
| 107 | node->digitalRead = myDigitalRead ; |
| 108 | node->digitalWrite = myDigitalWrite ; |
| 109 | node->pullUpDnControl = myPullUpDnControl ; |
| 110 | |
| 111 | return 0 ; |
| 112 | } |