diff options
Diffstat (limited to 'src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c')
-rw-r--r-- | src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c b/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c index d97f4588..97c6a034 100644 --- a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c +++ b/src/c/hardware/rasberrypi/gpio/u8RPIDigitalOuts.c @@ -10,30 +10,17 @@ Email: toolbox@scilab.in */ -/* Function to change the output state of the gpio pin - - Calling Sequence - u8RPI_DigitalOuts(pin,state) - - Parameters - pin : pin of RPi to be used - state : desired output state for pin (0 -> LOW, 1 -> HIGH) - - Description - There are few pins available on RPi as Gpio or digital i/o. These pins can be used as digital output or input. 'Pin' name must be provided from list provided. Please refer '' for complete list of pins. 'state' can be 0 or 1 depending upon desired output (Low/High). RPI_DigitalSetup with appropriate arguments must be called before using this function. - Examples - u8RPI_DigitalOuts(RPI_GPIO_P1_03,1) //Sets pin 3 of header P1 as 'high' output -*/ +/* Function to change the output state of the gpio pin */ #include "types.h" #include "RPIPeripheralDigital.h" - +/*pin is reduced by one as arrayiindex starts from 0 and pin no starts from 1*/ uint8 u8RPIDigitalOuts(uint8 pin, uint8 state) { if (state == 0) //low output - bcm2835_gpio_clr(pin); + bcm2835_gpio_clr(phy_pin[pin-1]); if (state == 1) //high output - bcm2835_gpio_set(pin); + bcm2835_gpio_set(phy_pin[pin-1]); } |