summaryrefslogtreecommitdiff
path: root/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c
diff options
context:
space:
mode:
authorsiddhu89902016-07-25 15:59:40 +0530
committersiddhu89902016-07-25 15:59:40 +0530
commit24fbba33153e7758df4a990cb4c21ae8e53e6f3e (patch)
treeb12075cf236142e6e0b9c024a37a2fc4ee5e6761 /src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c
parent169db0082ebd07baea82d00213db6ffd4dee7cf6 (diff)
downloadscilab2c-24fbba33153e7758df4a990cb4c21ae8e53e6f3e.tar.gz
scilab2c-24fbba33153e7758df4a990cb4c21ae8e53e6f3e.tar.bz2
scilab2c-24fbba33153e7758df4a990cb4c21ae8e53e6f3e.zip
WiringPi used for RaspberryPi (Gpio, serial, Threads, ISRs)
Diffstat (limited to 'src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c')
-rw-r--r--src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c b/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c
index 79668b16..163f0c87 100644
--- a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c
+++ b/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;