diff options
author | siddhu8990 | 2016-07-25 15:59:40 +0530 |
---|---|---|
committer | siddhu8990 | 2016-07-25 15:59:40 +0530 |
commit | 21ab4886b202a52189b398bd9d3137e2a567d62a (patch) | |
tree | 90519f93c0a0c0ec22ce296372b811a7af2ed399 /2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c | |
parent | d7d53dc95a7cb9878a4e49bdd06e626e981b0eb2 (diff) | |
download | Scilab2C-21ab4886b202a52189b398bd9d3137e2a567d62a.tar.gz Scilab2C-21ab4886b202a52189b398bd9d3137e2a567d62a.tar.bz2 Scilab2C-21ab4886b202a52189b398bd9d3137e2a567d62a.zip |
WiringPi used for RaspberryPi (Gpio, serial, Threads, ISRs)
Diffstat (limited to '2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c')
-rw-r--r-- | 2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c index 79668b16..163f0c87 100644 --- a/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c +++ b/2.3-1/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c @@ -12,28 +12,29 @@ /* Function to setup digital pins direction = 1 -> output + direction = 0 -> input */ #include "types.h" #include "RPIPeripheralDigital.h" -/*This array maps pin numbers on RPi board, with actual physical pin numbers -on processor, required by BCM2835 library*/ -int phy_pin[] = {0, 0, 2, 0, 3, 0, 4, 14, 0, 15, /*Pin 1 to 10*/ - 17, 18, 27, 0, 22, 23, 0, 24, 10, 0, /*Pin 11 to 20*/ - 9, 25, 11, 8, 0, 7 }; /*Pin 21 to 26*/ +/*This array maps pin numbers on RPi board, with pin numbers corrsponding +to WiringPi library*/ +int phy_pin[] = {17, 17, 8, 17, 9, 17, 7, 15, 17, 16, /*Pin 1 to 10*/ + 0, 1, 2, 17, 3, 4, 17, 5, 12, 17, /*Pin 11 to 20*/ + 13, 6, 14, 10, 17, 11 }; /*Pin 21 to 26*/ /*pin is reduced by one as arrayiindex starts from 0 and pin no starts from 1*/ uint8 u8RPIDigitalSetups(uint8 pin, uint8 direction) { if(direction == 1) //Pin to be used as output { - bcm2835_gpio_fsel(phy_pin[pin-1], BCM2835_GPIO_FSEL_OUTP); + pinMode(phy_pin[pin-1], OUTPUT); } else { - bcm2835_gpio_fsel(phy_pin[pin-1], BCM2835_GPIO_FSEL_INPT); + pinMode(phy_pin[pin-1], INPUT); } return 0; |