26#ifndef GPIO_PINS_PER_PORT
28#define GPIO_PINS_PER_PORT 16U
31#ifndef GPIO_ADDRESS_OFFSET
33#define GPIO_ADDRESS_OFFSET 0x400U
107#define GPIO_TOTAL_PINS ((GPIO_PINS_PER_PORT) * (NUM_GPIO_PORTS))
StatusCode gpio_init(void)
Initializes GPIO globally by disabling JTAG and enabling all GPIO clocks.
Definition: gpio.c:29
GpioMode
Available modes for the GPIO pins.
Definition: gpio.h:44
GpioState
High or low GPIO state.
Definition: gpio.h:37
StatusCode gpio_init_pin(const GpioAddress *address, const GpioMode pin_mode, GpioState init_state)
Initializes a GPIO pin by address.
Definition: gpio.c:56
StatusCode gpio_toggle_state(const GpioAddress *address)
Toggles the GPIO.
Definition: gpio.c:170
GpioPort
Available GPIO ports.
Definition: gpio.h:97
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.
Definition: gpio.c:92
GpioAlternateFunctions
Alternate function mapping. Read STM32L433 datasheet page 75.
Definition: gpio.h:57
StatusCode gpio_set_state(const GpioAddress *address, GpioState state)
Sets the GPIO pin to a valid state.
Definition: gpio.c:154
GpioState gpio_get_state(const GpioAddress *address)
Gets the GPIO state.
Definition: gpio.c:182
@ GPIO_INPUT_PULL_UP
Definition: gpio.h:48
@ GPIO_OUTPUT_OPEN_DRAIN
Definition: gpio.h:49
@ GPIO_ALTFN_OPEN_DRAIN
Definition: gpio.h:51
@ GPIO_OUTPUT_PUSH_PULL
Definition: gpio.h:50
@ GPIO_ALTFN_PUSH_PULL
Definition: gpio.h:52
@ NUM_GPIO_MODES
Definition: gpio.h:53
@ GPIO_INPUT_FLOATING
Definition: gpio.h:46
@ GPIO_INPUT_PULL_DOWN
Definition: gpio.h:47
@ GPIO_ANALOG
Definition: gpio.h:45
@ GPIO_STATE_HIGH
Definition: gpio.h:39
@ NUM_GPIO_STATES
Definition: gpio.h:40
@ GPIO_STATE_LOW
Definition: gpio.h:38
@ GPIO_PORT_H
Definition: gpio.h:103
@ GPIO_PORT_D
Definition: gpio.h:101
@ GPIO_PORT_A
Definition: gpio.h:98
@ GPIO_PORT_E
Definition: gpio.h:102
@ GPIO_PORT_C
Definition: gpio.h:100
@ NUM_GPIO_PORTS
Definition: gpio.h:104
@ GPIO_PORT_B
Definition: gpio.h:99
@ GPIO_ALT1_TIM1
Definition: gpio.h:66
@ GPIO_ALT1_TIM2
Definition: gpio.h:67
@ GPIO_ALT0_SWDIO
Definition: gpio.h:62
@ GPIO_ALT7_USART3
Definition: gpio.h:84
@ GPIO_ALT5_SPI1
Definition: gpio.h:75
@ GPIO_ALT4_I2C1
Definition: gpio.h:70
@ GPIO_ALT_NONE
Definition: gpio.h:59
@ GPIO_ALT0_SWCLK
Definition: gpio.h:63
@ GPIO_ALT9_CAN1
Definition: gpio.h:87
@ GPIO_ALT4_I2C2
Definition: gpio.h:71
@ GPIO_ALT14_TIM16
Definition: gpio.h:91
@ GPIO_ALT5_SPI2
Definition: gpio.h:76
@ GPIO_ALT6_SPI3
Definition: gpio.h:79
@ GPIO_ALT14_TIM15
Definition: gpio.h:90
@ GPIO_ALT4_I2C3
Definition: gpio.h:72
@ GPIO_ALT7_USART1
Definition: gpio.h:82
@ GPIO_ALT7_USART2
Definition: gpio.h:83
StatusCode
StatusCodes for various errors.
Definition: status.h:27
Port and pin data.
Definition: gpio.h:112
GpioPort port
Definition: gpio.h:113
uint8_t pin
Definition: gpio.h:114