diff options
Diffstat (limited to 'src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c')
-rw-r--r-- | src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c b/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c new file mode 100644 index 0000000..277c620 --- /dev/null +++ b/src/c/hardware/rasberrypi/gpio/u8RPIDigitalSetups.c @@ -0,0 +1,38 @@ +// Function to setup digital pins. +// +// Calling Sequence +// u8RPI_DigitalSetup(pin,direction) +// +// Parameters +// pin : pin of RPi to be used +// direction : direction to be set for pin (0 -> INPUT, 1 -> OUTPUT) +// +// Description +// There are few pins available on RPi as Gpio or digital io. 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. Direction can be 0 or 1 depending upon desired function (Input/output) +// Examples +// RPI_DigitalSetup(RPI_GPIO_P1_03,0) //Sets pin 3 of header P1 as input +// +// See also +// RPI_DigitalIn RPI_DigitalOut +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for RPi. +#include "types.h" +#include "RPIPeripheralDigital.h" + +uint8 u8RPIDigitalSetups(uint8 pin, uint8 direction) +{ + if(direction == 1) //Pin to be used as output + { + bcm2835_gpio_fsel(pin, BCM2835_GPIO_FSEL_OUTP); + } + else + { + bcm2835_gpio_fsel(pin, BCM2835_GPIO_FSEL_INPT); + } +} |