InES Hardware Abstraction Layer
|
Interface of module hal_gpio. More...
Go to the source code of this file.
Data Structures | |
struct | hal_gpio_input_t |
Initialisation structure for gpio input mode. More... | |
struct | hal_gpio_output_t |
Initialisation structure for gpio output and af mode. More... | |
Enumerations | |
enum | hal_gpio_mode_t { HAL_GPIO_MODE_IN = 0x00, HAL_GPIO_MODE_OUT = 0x01, HAL_GPIO_MODE_AF = 0x02, HAL_GPIO_MODE_AN = 0x03 } |
Mode of GPIO port. More... | |
enum | hal_gpio_out_speed_t { HAL_GPIO_OUT_SPEED_2MHZ = 0x00, HAL_GPIO_OUT_SPEED_10MHZ = 0x01, HAL_GPIO_OUT_SPEED_50MHZ = 0x02, HAL_GPIO_OUT_SPEED_100MHZ = 0x03 } |
Available GPIO output speed. More... | |
enum | hal_gpio_out_type_t { HAL_GPIO_OUT_TYPE_PP = 0x00, HAL_GPIO_OUT_TYPE_OD = 0x01 } |
Output mode. More... | |
enum | hal_gpio_pupd_t { HAL_GPIO_PUPD_NOPULL = 0x00, HAL_GPIO_PUPD_UP = 0x01, HAL_GPIO_PUPD_DOWN = 0x02 } |
Available pull-up/down modes. More... | |
enum | hal_gpio_af_t { HAL_GPIO_AF_RTC50HZ = 0x00, HAL_GPIO_AF_MCO = 0x00, HAL_GPIO_AF_TAMPER = 0x00, HAL_GPIO_AF_SWJ = 0x00, HAL_GPIO_AF_TRACE = 0x00, HAL_GPIO_AF_TIM1 = 0x01, HAL_GPIO_AF_TIM2 = 0x01, HAL_GPIO_AF_TIM3 = 0x02, HAL_GPIO_AF_TIM4 = 0x02, HAL_GPIO_AF_TIM5 = 0x02, HAL_GPIO_AF_TIM8 = 0x03, HAL_GPIO_AF_TIM9 = 0x03, HAL_GPIO_AF_TIM10 = 0x03, HAL_GPIO_AF_TIM11 = 0x03, HAL_GPIO_AF_I2C1 = 0x04, HAL_GPIO_AF_I2C2 = 0x04, HAL_GPIO_AF_I2C3 = 0x04, HAL_GPIO_AF_SPI1 = 0x05, HAL_GPIO_AF_SPI2 = 0x05, HAL_GPIO_AF_SPI4 = 0x05, HAL_GPIO_AF_SPI5 = 0x05, HAL_GPIO_AF_SPI6 = 0x05, HAL_GPIO_AF_SPI3 = 0x06, HAL_GPIO_AF_SAI1 = 0x06, HAL_GPIO_AF_USART1 = 0x07, HAL_GPIO_AF_USART2 = 0x07, HAL_GPIO_AF_USART3 = 0x07, HAL_GPIO_AF_I2S3ext = 0x07, HAL_GPIO_AF_UART4 = 0x08, HAL_GPIO_AF_UART5 = 0x08, HAL_GPIO_AF_USART6 = 0x08, HAL_GPIO_AF_UART7 = 0x08, HAL_GPIO_AF_UART8 = 0x08, HAL_GPIO_AF_CAN1 = 0x09, HAL_GPIO_AF_CAN2 = 0x09, HAL_GPIO_AF_TIM12 = 0x09, HAL_GPIO_AF_TIM13 = 0x09, HAL_GPIO_AF_TIM14 = 0x09, HAL_GPIO_AF_OTG_FS = 0x0a, HAL_GPIO_AF_OTG_HS = 0x0a, HAL_GPIO_AF_ETH = 0x0b, HAL_GPIO_AF_FMC = 0x0c, HAL_GPIO_AF_OTG_HS_FS = 0x0c, HAL_GPIO_AF_SDIO = 0x0c, HAL_GPIO_AF_DCMI = 0x0d, HAL_GPIO_AF_LTDC = 0x0e, HAL_GPIO_AF_EVENTOUT = 0x0f } |
Defines the available alternate function modes. | |
enum | hal_gpio_pin_t { HAL_GPIO_PIN_0 = 0x0001, HAL_GPIO_PIN_1 = 0x0002, HAL_GPIO_PIN_2 = 0x0004, HAL_GPIO_PIN_3 = 0x0008, HAL_GPIO_PIN_4 = 0x0010, HAL_GPIO_PIN_5 = 0x0020, HAL_GPIO_PIN_6 = 0x0040, HAL_GPIO_PIN_7 = 0x0080, HAL_GPIO_PIN_8 = 0x0100, HAL_GPIO_PIN_9 = 0x0200, HAL_GPIO_PIN_10 = 0x0400, HAL_GPIO_PIN_11 = 0x0800, HAL_GPIO_PIN_12 = 0x1000, HAL_GPIO_PIN_13 = 0x2000, HAL_GPIO_PIN_14 = 0x4000, HAL_GPIO_PIN_15 = 0x8000, HAL_GPIO_PIN_All = 0xffff } |
Defines the available pins of a GPIO port. | |
enum | hal_gpio_trg_t { HAL_GPIO_TRG_POS = 0x1, HAL_GPIO_TRG_NEG = 0x2, HAL_GPIO_TRG_BOTH = 0x3 } |
Defines the polarity on wich the interrupt should be triggered. More... | |
Functions | |
void | hal_gpio_reset (reg_gpio_t *port) __attribute__((deprecated("Please use GPIOx_RESET()."))) |
Resets gpio port to default values. More... | |
void | hal_gpio_init_input (reg_gpio_t *port, hal_gpio_input_t init) |
Initializes a port as input. More... | |
void | hal_gpio_init_analog (reg_gpio_t *port, hal_gpio_input_t init) |
Initializes a port as analog input. More... | |
void | hal_gpio_init_output (reg_gpio_t *port, hal_gpio_output_t init) |
Initializes a port as output. More... | |
void | hal_gpio_init_alternate (reg_gpio_t *port, hal_gpio_af_t af_mode, hal_gpio_output_t init) |
Initializes a port in alternate function mode. More... | |
uint16_t | hal_gpio_input_read (reg_gpio_t *port) |
Reads the specified GPIO input data port. More... | |
uint16_t | hal_gpio_output_read (reg_gpio_t *port) |
Reads the specified GPIO output data port. More... | |
void | hal_gpio_output_write (reg_gpio_t *port, uint16_t value) |
Writes to the specified GPIO output port. More... | |
void | hal_gpio_bit_set (reg_gpio_t *port, uint16_t pins) |
Sets the specified pins of the output port. More... | |
void | hal_gpio_bit_reset (reg_gpio_t *port, uint16_t pins) |
Resets the specified pins of the output port. More... | |
void | hal_gpio_bit_toggle (reg_gpio_t *port, uint16_t pins) |
Toggles the specified pins of the output port. More... | |
void | hal_gpio_irq_set (reg_gpio_t *port, uint16_t pins, hal_gpio_trg_t edge, hal_bool_t status) |
Enables interrupt on specified GPIO pins. More... | |
hal_bool_t | hal_gpio_irq_status (uint16_t pin) |
Return status if specified GPIO interrupt. More... | |
void | hal_gpio_irq_clear (uint16_t pin) |
Clear specified GPIO interrupt. More... | |
Interface of module hal_gpio.
The hardware abstraction layer for the GPIO periphery.
enum hal_gpio_mode_t |
enum hal_gpio_out_speed_t |
enum hal_gpio_out_type_t |
enum hal_gpio_pupd_t |
enum hal_gpio_trg_t |
void hal_gpio_bit_reset | ( | reg_gpio_t * | port, |
uint16_t | pins | ||
) |
Resets the specified pins of the output port.
port | : Defines port to interact. |
pins | : Mask of the pins that should be reset. |
void hal_gpio_bit_set | ( | reg_gpio_t * | port, |
uint16_t | pins | ||
) |
Sets the specified pins of the output port.
port | : Defines port to interact. |
pins | : Mask of the pins that should be set. |
void hal_gpio_bit_toggle | ( | reg_gpio_t * | port, |
uint16_t | pins | ||
) |
Toggles the specified pins of the output port.
port | : Defines port to interact. |
pins | : Mask of the pins that should be toggled. |
void hal_gpio_init_alternate | ( | reg_gpio_t * | port, |
hal_gpio_af_t | af_mode, | ||
hal_gpio_output_t | init | ||
) |
Initializes a port in alternate function mode.
port | : Defines port to initialize. |
af_mode | : Defines the alternate function mode. |
init | : Structure with mode definitions. |
void hal_gpio_init_analog | ( | reg_gpio_t * | port, |
hal_gpio_input_t | init | ||
) |
Initializes a port as analog input.
port | : Defines port to initialize. |
init | : Structure with mode definitions. |
void hal_gpio_init_input | ( | reg_gpio_t * | port, |
hal_gpio_input_t | init | ||
) |
Initializes a port as input.
port | : Defines port to initialize. |
init | : Structure with mode definitions. |
void hal_gpio_init_output | ( | reg_gpio_t * | port, |
hal_gpio_output_t | init | ||
) |
Initializes a port as output.
port | : Defines port to initialize. |
init | : Structure with mode definitions. |
uint16_t hal_gpio_input_read | ( | reg_gpio_t * | port | ) |
Reads the specified GPIO input data port.
port | : Defines port to interact. |
void hal_gpio_irq_clear | ( | uint16_t | pin | ) |
Clear specified GPIO interrupt.
pin | : Pin / EXTI line interrupt to clear. |
void hal_gpio_irq_set | ( | reg_gpio_t * | port, |
uint16_t | pins, | ||
hal_gpio_trg_t | edge, | ||
hal_bool_t | status | ||
) |
Enables interrupt on specified GPIO pins.
port | : Defines port to interact. |
pins | : Mask of the pins that should be enabled. |
edge | : Edge on which the interrupt should fire. |
status | : ENABLE/DISABLE specified interrupt. |
hal_bool_t hal_gpio_irq_status | ( | uint16_t | pin | ) |
Return status if specified GPIO interrupt.
pin | : Pin / EXTI line to check. |
uint16_t hal_gpio_output_read | ( | reg_gpio_t * | port | ) |
Reads the specified GPIO output data port.
port | : Defines port to interact. |
void hal_gpio_output_write | ( | reg_gpio_t * | port, |
uint16_t | value | ||
) |
Writes to the specified GPIO output port.
port | : Defines port to interact. |
value | : The new value of the output port. |
void hal_gpio_reset | ( | reg_gpio_t * | port | ) |
Resets gpio port to default values.
port | : Defines port to reset. |