Driver for initialising and interacting with individual GPIO pins. More...
Data Structures | |
struct | GPIO_Config |
Struct definition for GPIO configuration. More... | |
struct | GPIOpin_t |
Struct definition for a GPIO pin. More... | |
Enumerations | |
enum | GPIO_Pin { GPIO_PIN0 , GPIO_PIN1 , GPIO_PIN2 , GPIO_PIN3 , GPIO_PIN4 , GPIO_PIN5 , GPIO_PIN6 , GPIO_PIN7 , GPIO_PIN8 , GPIO_PIN9 , GPIO_PIN10 , GPIO_PIN11 , GPIO_PIN12 , GPIO_PIN13 , GPIO_PIN14 , GPIO_PIN15 } |
GPIO pin enum. More... | |
enum | GPIO_AF { GPIO_AF0 , GPIO_AF1 , GPIO_AF2 , GPIO_AF3 , GPIO_AF4 , GPIO_AF5 , GPIO_AF6 , GPIO_AF7 , GPIO_AF8 , GPIO_AF9 , GPIO_AF10 , GPIO_AF11 , GPIO_AF12 , GPIO_AF13 , GPIO_AF14 , GPIO_AF15 } |
GPIO alternate function enum. More... | |
enum | GPIO_Mode { GPIO_MODE_INPUT , GPIO_MODE_OUTPUT , GPIO_MODE_AF , GPIO_MODE_ANALOG } |
GPIO mode enum. More... | |
enum | GPIO_Type { GPIO_TYPE_PUSHPULL , GPIO_TYPE_OPENDRAIN } |
GPIO type enum. More... | |
enum | GPIO_Speed { GPIO_SPEED_LOW , GPIO_SPEED_MEDIUM , GPIO_SPEED_HIGH , GPIO_SPEED_VERYHIGH } |
GPIO speed enum. More... | |
enum | GPIO_PUPD { GPIO_PUPD_NONE , GPIO_PUPD_PULLUP , GPIO_PUPD_PULLDOWN } |
GPIO pull-up/pull-down enum. More... | |
Functions | |
GPIOpin_t | GPIOpin_init (GPIO_TypeDef *, GPIO_Pin, GPIO_Config *) |
Initialiser for a GPIO peripheral pin interface. | |
void | GPIOpin_set (GPIOpin_t *) |
Set the selected GPIO pin. | |
void | GPIOpin_reset (GPIOpin_t *) |
Clear the selected GPIO pin. | |
void | GPIOpin_toggle (GPIOpin_t *) |
Toggle the selected GPIO pin. | |
void | GPIOpin_updateConfig (GPIOpin_t *, GPIO_Config *) |
Update GPIO pin configuration. | |
Driver for initialising and interacting with individual GPIO pins.
struct GPIO_Config |
Struct definition for GPIO configuration.
Describes the configuration parameters of a GPIO pin/port.
If GPIOpin_init is passed a null pointer configuration, these parameters will contain their default values.
Data Fields | ||
---|---|---|
GPIO_Mode | mode | Pin I/O direction | (default GPIO_MODE_OUTPUT) |
GPIO_Type | type | Pin output type | (default GPIO_TYPE_PUSHPULL) |
GPIO_Speed | speed | Pin output speed | (default GPIO_SPEED_HIGH) |
GPIO_PUPD | pupd | Pin pull-up/pull-down | (default GPIO_PUPD_NONE) |
GPIO_AF | afr | Pin alternate function | (default GPIO_AF0) |
struct GPIOpin_t |
Struct definition for a GPIO pin.
Provides the interface for peripheral drivers and application code to configure and interact with an individual GPIO pin.
Data Fields | ||
---|---|---|
GPIO_TypeDef * | port | GPIO port in which the pin is located. |
GPIO_Pin | pin | Actual location of the pin within GPIO port. |
GPIO_Config | config | Configuration parameters for the pin. |
void(*)(struct GPIOpin *) | set |
|
void(*)(struct GPIOpin *) | reset |
|
void(*)(struct GPIOpin *) | toggle |
|
void(*)(struct GPIOpin *, GPIO_Config *) | updateConfig |
|
enum GPIO_Pin |
GPIO pin enum.
Describes the position of the pin within its GPIO port.
enum GPIO_AF |
GPIO alternate function enum.
Describes the alternate function mapping of the pin.
enum GPIO_Mode |
enum GPIO_Type |
enum GPIO_Speed |
enum GPIO_PUPD |
GPIOpin_t GPIOpin_init | ( | GPIO_TypeDef * | port, |
GPIO_Pin | pin, | ||
GPIO_Config * | config ) |
Initialiser for a GPIO peripheral pin interface.
port | Pointer to the GPIO_TypeDef struct representing the pin's port. |
pin | Enum quantified value of the pin's position in its port. |
config | Pointer to GPIO_Config struct for initial configuration. This may be passed as NULL to initialise a default configuration. |
void GPIOpin_set | ( | GPIOpin_t * | gpio | ) |
void GPIOpin_reset | ( | GPIOpin_t * | gpio | ) |
void GPIOpin_toggle | ( | GPIOpin_t * | gpio | ) |
void GPIOpin_updateConfig | ( | GPIOpin_t * | gpio, |
GPIO_Config * | config ) |