![]() |
Midnight Sun Firmware
|
GPIO library. More...

Classes | |
| struct | GpioAddress |
| Port and pin data. More... | |
| struct | GpioInterrupt |
| Storage class for GPIO interrupts. More... | |
Macros | |
| #define | GPIO_PINS_PER_PORT 16U |
| 16 Pins per port | |
| #define | GPIO_ADDRESS_OFFSET 0x400U |
| Each GPIO Port is seperated in the MMIO by 1024 bytes. | |
| #define | GPIO_TOTAL_PINS ((GPIO_PINS_PER_PORT) * (NUM_GPIO_PORTS)) |
Typedefs | |
| typedef struct GpioAddress | GpioAddress |
| Port and pin data. | |
| typedef struct GpioInterrupt | GpioInterrupt |
| Storage class for GPIO interrupts. | |
Functions | |
| StatusCode | gpio_init (void) |
| Initializes GPIO globally by disabling JTAG and enabling all GPIO clocks. More... | |
| StatusCode | gpio_init_pin (const GpioAddress *address, const GpioMode pin_mode, GpioState init_state) |
| Initializes a GPIO pin by address. More... | |
| StatusCode | gpio_init_pin_af (const GpioAddress *address, const GpioMode pin_mode, GpioAlternateFunctions alt_func) |
| Initializes an alternate function for a GPIO pin by address. More... | |
| StatusCode | gpio_set_state (const GpioAddress *address, GpioState state) |
| Sets the GPIO pin to a valid state. More... | |
| StatusCode | gpio_toggle_state (const GpioAddress *address) |
| Toggles the GPIO. More... | |
| GpioState | gpio_get_state (const GpioAddress *address) |
| Gets the GPIO state. More... | |
| StatusCode | gpio_register_interrupt (const GpioAddress *address, const InterruptSettings *settings, const Event event, const Task *task) |
| Register a GPIO interrupt by passing in the pin address and task to notify. More... | |
| InterruptEdge | gpio_it_get_edge (const GpioAddress *address) |
| Gets the GPIO interrupt edge. More... | |
| InterruptPriority | gpio_it_get_priority (const GpioAddress *address) |
| Gets the GPIO interrupt priority. More... | |
| InterruptType | gpio_it_get_type (const GpioAddress *address) |
| Gets the GPIO interrupt type. More... | |
| Task * | gpio_it_get_target_task (const GpioAddress *address) |
| Gets the GPIO interrupt task. More... | |
| StatusCode | gpio_it_mask_interrupt (const GpioAddress *address, bool masked) |
| Masks the GPIO interrupt. More... | |
| StatusCode | gpio_trigger_interrupt (const GpioAddress *address) |
| Software generated GPIO interrupt. More... | |
GPIO library.
Alternate function mapping. Read STM32L433 datasheet page 75.
| enum GpioMode |
Available modes for the GPIO pins.
| enum GpioPort |
| enum GpioState |
| GpioState gpio_get_state | ( | const GpioAddress * | address | ) |
Gets the GPIO state.
| address | Pointer to the GPIO address |
| StatusCode gpio_init | ( | void | ) |
Initializes GPIO globally by disabling JTAG and enabling all GPIO clocks.
ONLY CALL ONCE or it will deinit all current settings. Change pin setting by calling gpio_init_pin
| StatusCode gpio_init_pin | ( | const GpioAddress * | address, |
| const GpioMode | pin_mode, | ||
| GpioState | init_state | ||
| ) |
Initializes a GPIO pin by address.
GPIOs are configured to a specified mode, at the max refresh speed
| address | Pointer to the GPIO address |
| pin_mode | Pin configuration mode |
| init_state | Initial GPIO state for output pins |
| StatusCode gpio_init_pin_af | ( | const GpioAddress * | address, |
| const GpioMode | pin_mode, | ||
| GpioAlternateFunctions | alt_func | ||
| ) |
Initializes an alternate function for a GPIO pin by address.
This initialization should be used I2C, SPI, UART and timers
| address | Pointer to the GPIO address |
| pin_mode | Pin configuration mode |
| alt_func | Alternate function of the GPIO |
| InterruptEdge gpio_it_get_edge | ( | const GpioAddress * | address | ) |
Gets the GPIO interrupt edge.
| address | Pointer to the GPIO address |
| InterruptPriority gpio_it_get_priority | ( | const GpioAddress * | address | ) |
Gets the GPIO interrupt priority.
| address | Pointer to the GPIO address |
| Task * gpio_it_get_target_task | ( | const GpioAddress * | address | ) |
Gets the GPIO interrupt task.
| address | Pointer to the GPIO address |
| InterruptType gpio_it_get_type | ( | const GpioAddress * | address | ) |
Gets the GPIO interrupt type.
| address | Pointer to the GPIO address |
| StatusCode gpio_it_mask_interrupt | ( | const GpioAddress * | address, |
| bool | masked | ||
| ) |
Masks the GPIO interrupt.
| address | Pointer to the GPIO address |
| masked | 0: Enables the GPIO interrupt 1: Mask the GPIO interrupt |
| StatusCode gpio_register_interrupt | ( | const GpioAddress * | address, |
| const InterruptSettings * | settings, | ||
| const Event | event, | ||
| const Task * | task | ||
| ) |
Register a GPIO interrupt by passing in the pin address and task to notify.
| address | Pointer to the GPIO address |
| settings | Pointer to the interrupt settings |
| event | Event notification |
| task | Task to notify when interrupt fires |
| StatusCode gpio_set_state | ( | const GpioAddress * | address, |
| GpioState | state | ||
| ) |
Sets the GPIO pin to a valid state.
| address | Pointer to the GPIO address |
| state | GPIO state can either be HIGH/LOW |
| StatusCode gpio_toggle_state | ( | const GpioAddress * | address | ) |
Toggles the GPIO.
| address | Pointer to the GPIO address |
| StatusCode gpio_trigger_interrupt | ( | const GpioAddress * | address | ) |
Software generated GPIO interrupt.
| address | Pointer to the GPIO address |