Hardware Reference
In-Depth Information
gpio_config()
This function call allows the caller to configure a pin as input or output:
typedef enum {
Input = 0, /
GPIO is an Input
/
∗
∗
Output /
GPIO is an Output
/
∗
∗
} direction_t;
void gpio_config(int gpio,direction_t output);
The arguments are as follows:
gpio
:
The GPIO pin to be configured
output
:
The value
Input
or
Output
gpio_write()
This function permits the caller to set the output GPIO pin to a 1 or a 0.
void gpio_write(int gpio,int bit);
The arguments are as follows:
gpio
: The GPIO pin to write to
bit
: The value of the output bit (1 or 0)
Only the least significant bit of argument
bit
is used.
gpio_read()
This function reads the requested GPIO pin and returns the bit (0 or 1).
int gpio_read(int gpio);
The single argument
gpio
is used to specify the GPIO pin to be read.