diff options
Diffstat (limited to 'src/c/hardware/rasberrypi/gpio')
-rw-r--r-- | src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c | 6 | ||||
-rw-r--r-- | src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c | 11 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c b/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c index d40263f..a5f80e5 100644 --- a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c +++ b/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c @@ -19,8 +19,10 @@ /*pin is reduced by one as array index starts from 0 and pin no starts from 1*/ uint8 u8RPIDigitalOuts(uint8 pin, uint8 state) { - if (state == 0) //low output + if (state == 0) /*low output*/ digitalWrite(phy_pin[pin-1], LOW); - if (state == 1) //high output + if (state == 1) /*high output*/ digitalWrite(phy_pin[pin-1], HIGH); + + return 0; } diff --git a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c b/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c index 163f0c8..37cfc03 100644 --- a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c +++ b/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c @@ -28,14 +28,13 @@ int phy_pin[] = {17, 17, 8, 17, 9, 17, 7, 15, 17, 16, /*Pin 1 to 10*/ /*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 - { - pinMode(phy_pin[pin-1], OUTPUT); - } + if(direction == 1) /*Pin to be used as output*/ + pinMode(phy_pin[pin-1], OUTPUT); + else if(direction == 2) + pinMode(phy_pin[pin-1], PWM_OUTPUT); else - { pinMode(phy_pin[pin-1], INPUT); - } + return 0; } |