GPIO Driver for STM32F4 Devices.
More...
Go to the source code of this file.
|
| #define | GPIO_INIT_INPUT(gpio_bank, pin_num, input_pull_sel) |
| | Create GPIO Init struct to intilize a GPIO pin for input.
|
| |
| #define | GPIO_INIT_OUTPUT(gpio_bank, pin_num, ospeed_sel) |
| | Create GPIO Init struct to intilize a GPIO pin for output.
|
| |
| #define | GPIO_INIT_OUTPUT_OPEN_DRAIN(gpio_bank, pin_num, ospeed_sel) |
| |
| #define | GPIO_INIT_ANALOG(gpio_bank, pin_num) |
| | Create GPIO Init struct to intilize a GPIO pin for analog.
|
| |
| #define | GPIO_INIT_AF(gpio_bank, pin_num, alt_func_num, ospeed_sel, otype_sel, input_pull_sel) |
| | Create GPIO Init struct to intilize a GPIO pin for alternate function.
|
| |
| #define | GPIO_INIT_SDIO_CLK GPIO_INIT_AF(GPIOC, 12, 12, GPIO_OUTPUT_ULTRA_SPEED, GPIO_OUTPUT_PUSH_PULL, GPIO_INPUT_PULL_UP) |
| |
| #define | GPIO_INIT_SDIO_CMD GPIO_INIT_AF(GPIOD, 2, 12, GPIO_OUTPUT_ULTRA_SPEED, GPIO_OUTPUT_PUSH_PULL, GPIO_INPUT_PULL_UP) |
| |
| #define | GPIO_INIT_SDIO_DT0 GPIO_INIT_AF(GPIOC, 8, 12, GPIO_OUTPUT_ULTRA_SPEED, GPIO_OUTPUT_PUSH_PULL, GPIO_INPUT_PULL_UP) |
| |
| #define | GPIO_INIT_SDIO_DT1 GPIO_INIT_AF(GPIOC, 9, 12, GPIO_OUTPUT_ULTRA_SPEED, GPIO_OUTPUT_PUSH_PULL, GPIO_INPUT_PULL_UP) |
| |
| #define | GPIO_INIT_SDIO_DT2 GPIO_INIT_AF(GPIOC, 10, 12, GPIO_OUTPUT_ULTRA_SPEED, GPIO_OUTPUT_PUSH_PULL, GPIO_INPUT_PULL_UP) |
| |
| #define | GPIO_INIT_SDIO_DT3 GPIO_INIT_AF(GPIOC, 11, 12, GPIO_OUTPUT_ULTRA_SPEED, GPIO_OUTPUT_PUSH_PULL, GPIO_INPUT_PULL_UP) |
| |
| #define | GPIO_INIT_MCO1_PA8 GPIO_INIT_AF(GPIOA, 8, 0, GPIO_OUTPUT_ULTRA_SPEED, GPIO_OUTPUT_PUSH_PULL, GPIO_INPUT_OPEN_DRAIN) |
| |
|
| bool | PHAL_initGPIO (GPIOInitConfig_t config[], uint8_t config_len) |
| | Initilize the GPIO perpheral given a list of configuration fields for all of the GPIO pins. Will also enable the GPIO RCC clock.
|
| |
| static bool | PHAL_GPIO_read (GPIO_TypeDef *bank, uint8_t pin) |
| | Read the state of the input register for the specific GPIO pin.
|
| |
| static void | PHAL_GPIO_write (GPIO_TypeDef *bank, uint8_t pin, bool value) |
| | Write a logic value to an output pin.
|
| |
| static void | PHAL_GPIO_toggle (GPIO_TypeDef *bank, uint8_t pin) |
| |
GPIO Driver for STM32F4 Devices.
- Author
- Adam Busch (busch.nosp@m.8@pu.nosp@m.rdue..nosp@m.edu)
- Version
- 0.1
- Date
- 2021-09-20
- Copyright
- Copyright (c) 2021
◆ GPIO_INIT_AF
| #define GPIO_INIT_AF |
( |
| gpio_bank, |
|
|
| pin_num, |
|
|
| alt_func_num, |
|
|
| ospeed_sel, |
|
|
| otype_sel, |
|
|
| input_pull_sel ) |
Value: { \
.bank = gpio_bank, .pin = pin_num, .type =
GPIO_TYPE_AF, .config = {.af_num = alt_func_num, \
.ospeed = ospeed_sel, \
.otype = otype_sel, \
.pull = input_pull_sel } \
}
@ GPIO_TYPE_AF
Definition gpio.h:24
Create GPIO Init struct to intilize a GPIO pin for alternate function.
- Parameters
-
| gpio_bank | GPIO_TypeDef* reference to the GPIO bank for the pin |
| pin_num | Pin number from GPIO bank to configure |
| alt_func_num | Alternate function selection |
| ospeed_sel | Pin output speed selection |
| otype_sel | Pin output type selection |
| input_pull_sel | Input pullup/pulldown/high-z selection |
◆ GPIO_INIT_ANALOG
| #define GPIO_INIT_ANALOG |
( |
| gpio_bank, |
|
|
| pin_num ) |
Value: { \
.bank = gpio_bank, \
.pin = pin_num, \
@ GPIO_TYPE_ANALOG
Definition gpio.h:25
Create GPIO Init struct to intilize a GPIO pin for analog.
- Parameters
-
| gpio_bank | GPIO_TypeDef* reference to the GPIO bank for the pin |
| pin_num | Pin number from GPIO bank to configure |
◆ GPIO_INIT_INPUT
| #define GPIO_INIT_INPUT |
( |
| gpio_bank, |
|
|
| pin_num, |
|
|
| input_pull_sel ) |
Value: { \
.bank = gpio_bank, .pin = pin_num, .type =
GPIO_TYPE_INPUT, .config = {.pull = input_pull_sel } \
}
@ GPIO_TYPE_INPUT
Definition gpio.h:22
Create GPIO Init struct to intilize a GPIO pin for input.
- Parameters
-
| gpio_bank | GPIO_TypeDef* reference to the GPIO bank for the pin |
| pin_num | Pin number from GPIO bank to configure |
| input_pull_sel | Input pullup/pulldown/high-z selection |
◆ GPIO_INIT_MCO1_PA8
◆ GPIO_INIT_OUTPUT
| #define GPIO_INIT_OUTPUT |
( |
| gpio_bank, |
|
|
| pin_num, |
|
|
| ospeed_sel ) |
Value: { \
.bank = gpio_bank, .pin = pin_num, .type =
GPIO_TYPE_OUTPUT, .config = {.ospeed = ospeed_sel, \
}
@ GPIO_OUTPUT_PUSH_PULL
Definition gpio.h:42
@ GPIO_TYPE_OUTPUT
Definition gpio.h:23
Create GPIO Init struct to intilize a GPIO pin for output.
- Parameters
-
| gpio_bank | GPIO_TypeDef* reference to the GPIO bank for the pin |
| pin_num | Pin number from GPIO bank to configure |
| ospeed_sel | Pin output speed selection |
◆ GPIO_INIT_OUTPUT_OPEN_DRAIN
| #define GPIO_INIT_OUTPUT_OPEN_DRAIN |
( |
| gpio_bank, |
|
|
| pin_num, |
|
|
| ospeed_sel ) |
Value: { \
.bank = gpio_bank, .pin = pin_num, .type =
GPIO_TYPE_OUTPUT, .config = {.ospeed = ospeed_sel, \
}
@ GPIO_OUTPUT_OPEN_DRAIN
Definition gpio.h:43
◆ GPIO_INIT_SDIO_CLK
◆ GPIO_INIT_SDIO_CMD
◆ GPIO_INIT_SDIO_DT0
◆ GPIO_INIT_SDIO_DT1
◆ GPIO_INIT_SDIO_DT2
◆ GPIO_INIT_SDIO_DT3
◆ GPIOInputPull_t
Enable internal pullup/down resistors.
| Enumerator |
|---|
| GPIO_INPUT_OPEN_DRAIN | |
| GPIO_INPUT_PULL_UP | |
| GPIO_INPUT_PULL_DOWN | |
◆ GPIOOutputPull_t
Output drive mode selection.
| Enumerator |
|---|
| GPIO_OUTPUT_PUSH_PULL | |
| GPIO_OUTPUT_OPEN_DRAIN | |
◆ GPIOOutputSpeed_t
Slew rate control for output pins.
| Enumerator |
|---|
| GPIO_OUTPUT_LOW_SPEED | |
| GPIO_OUTPUT_MED_SPEED | |
| GPIO_OUTPUT_HIGH_SPEED | |
| GPIO_OUTPUT_ULTRA_SPEED | |
◆ GPIOPinType_t
Configuration type for GPIO Pin.
| Enumerator |
|---|
| GPIO_TYPE_INPUT | |
| GPIO_TYPE_OUTPUT | |
| GPIO_TYPE_AF | |
| GPIO_TYPE_ANALOG | |
◆ PHAL_GPIO_read()
| static bool PHAL_GPIO_read |
( |
GPIO_TypeDef * | bank, |
|
|
uint8_t | pin ) |
|
inlinestatic |
Read the state of the input register for the specific GPIO pin.
- Parameters
-
| bank | GPIO Bank of the pin |
| pin | GPIO pin number |
- Returns
- true GPIO Input true
-
false GPIO Input false
◆ PHAL_GPIO_toggle()
| static void PHAL_GPIO_toggle |
( |
GPIO_TypeDef * | bank, |
|
|
uint8_t | pin ) |
|
inlinestatic |
◆ PHAL_GPIO_write()
| static void PHAL_GPIO_write |
( |
GPIO_TypeDef * | bank, |
|
|
uint8_t | pin, |
|
|
bool | value ) |
|
inlinestatic |
Write a logic value to an output pin.
- Parameters
-
| bank | GPIO Bank of the pin |
| pin | GPIO pin number |
| value | Logical value to write |
◆ PHAL_initGPIO()
Initilize the GPIO perpheral given a list of configuration fields for all of the GPIO pins. Will also enable the GPIO RCC clock.
- Parameters
-
| config | A list of GPIOs to config |
| config_len | Number of GPIOs in the config list |
- Returns
- true All GPIOs were a valid configuration format
-
false Some of the GPIOs had an invalid configuration format