|
PER Firmware
|
G4 GPIO public API implementation. More...
Functions | |
| bool | PHAL_GPIO_init (PHAL_GPIO_InitConfig_t config[], size_t config_len) |
| Initialize a set of GPIO pins from a configuration table. | |
| bool | PHAL_GPIO_read (const GPIO_TypeDef *bank, uint8_t pin) |
| Read the current input state of a pin. | |
| void | PHAL_GPIO_write (GPIO_TypeDef *bank, uint8_t pin, bool value) |
| Drive an output pin high or low. | |
| void | PHAL_GPIO_toggle (GPIO_TypeDef *bank, uint8_t pin) |
| Flip an output pin's current state. | |
G4 GPIO public API implementation.
| bool PHAL_GPIO_init | ( | PHAL_GPIO_InitConfig_t | config[], |
| size_t | config_len ) |
Initialize a set of GPIO pins from a configuration table.
Enables each pin's port clock, then configures mode, speed, drive type, pull, and alternate function per entry as applicable to that entry's PHAL_GPIO_PinType_t
Register fields that don't apply to a given type (ex: pull for an output pin) are left untouched.
When encountering an unknown bank, pin outside 0-15, or unrecognized type, stops and returns false. Already configured pins remain configured.
| config | Array of pin configurations |
| config_len | Number of entries in config |
| bool PHAL_GPIO_read | ( | const GPIO_TypeDef * | bank, |
| uint8_t | pin ) |
Read the current input state of a pin.
| bank | GPIO port |
| pin | Pin number, 0-15 |
| void PHAL_GPIO_toggle | ( | GPIO_TypeDef * | bank, |
| uint8_t | pin ) |
Flip an output pin's current state.
| bank | GPIO port |
| pin | Pin number, 0-15 |
| void PHAL_GPIO_write | ( | GPIO_TypeDef * | bank, |
| uint8_t | pin, | ||
| bool | value ) |
Drive an output pin high or low.
Safe to call from an ISR concurrently with other threads/etc touching other pins on the same port
| bank | GPIO port |
| pin | Pin number, 0-15 |
| value | true to drive high, false to drive low |