General Purpose IO.
More...
|
int | qm_gpio_set_config (const qm_gpio_t gpio, const qm_gpio_port_config_t *const cfg) |
| Set GPIO port configuration. More...
|
|
int | qm_gpio_read_pin (const qm_gpio_t gpio, const uint8_t pin, qm_gpio_state_t *const state) |
| Read the current state of a single pin on a given GPIO port. More...
|
|
int | qm_gpio_set_pin (const qm_gpio_t gpio, const uint8_t pin) |
| Set a single pin on a given GPIO port. More...
|
|
int | qm_gpio_clear_pin (const qm_gpio_t gpio, const uint8_t pin) |
| Clear a single pin on a given GPIO port. More...
|
|
int | qm_gpio_set_pin_state (const qm_gpio_t gpio, const uint8_t pin, const qm_gpio_state_t state) |
| Set or clear a single GPIO pin using a state variable. More...
|
|
int | qm_gpio_read_port (const qm_gpio_t gpio, uint32_t *const port) |
| Read the value of every pin on a GPIO port. More...
|
|
int | qm_gpio_write_port (const qm_gpio_t gpio, const uint32_t val) |
| Write a value to every pin on a GPIO port. More...
|
|
int | qm_gpio_save_context (const qm_gpio_t gpio, qm_gpio_context_t *const ctx) |
| Save GPIO context. More...
|
|
int | qm_gpio_restore_context (const qm_gpio_t gpio, const qm_gpio_context_t *const ctx) |
| Restore GPIO context. More...
|
|
General Purpose IO.
GPIO pin states.
Enumerator |
---|
QM_GPIO_LOW |
GPIO low state.
|
QM_GPIO_HIGH |
GPIO high state.
|
QM_GPIO_STATE_NUM |
Number of GPIO states.
|
Definition at line 21 of file qm_gpio.h.
int qm_gpio_clear_pin |
( |
const qm_gpio_t |
gpio, |
|
|
const uint8_t |
pin |
|
) |
| |
Clear a single pin on a given GPIO port.
- Parameters
-
[in] | gpio | GPIO port index. |
[in] | pin | Pin of GPIO port to clear. |
- Returns
- int 0 on success, error code otherwise.
- Return values
-
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 107 of file qm_gpio.c.
Read the current state of a single pin on a given GPIO port.
- Parameters
-
[in] | gpio | GPIO port index. |
[in] | pin | Pin of GPIO port to read. |
[out] | state | Current state of the pin. This must not be NULL. |
- Returns
- Standard errno return type for QMSI.
- Return values
-
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 85 of file qm_gpio.c.
int qm_gpio_read_port |
( |
const qm_gpio_t |
gpio, |
|
|
uint32_t *const |
port |
|
) |
| |
Read the value of every pin on a GPIO port.
Each bit of the val parameter is set to the current value of each pin on the port. Maximum 32 pins per port.
- Parameters
-
[in] | gpio | GPIO port index. |
[out] | port | State of every pin in a GPIO port. This must not be NULL. |
- Returns
- Standard errno return type for QMSI.
- Return values
-
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 131 of file qm_gpio.c.
Restore GPIO context.
Restore the configuration of the specified GPIO peripheral after exiting sleep.
- Parameters
-
[in] | gpio | GPIO port index. |
[in] | ctx | GPIO context structure. This must not be NULL. |
- Returns
- Standard errno return type for QMSI.
- Return values
-
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 174 of file qm_gpio.c.
References qm_gpio_reg_t::gpio_debounce, qm_gpio_context_t::gpio_debounce, qm_gpio_reg_t::gpio_int_bothedge, qm_gpio_context_t::gpio_int_bothedge, qm_gpio_reg_t::gpio_int_polarity, qm_gpio_context_t::gpio_int_polarity, qm_gpio_reg_t::gpio_inten, qm_gpio_context_t::gpio_inten, qm_gpio_reg_t::gpio_intmask, qm_gpio_context_t::gpio_intmask, qm_gpio_reg_t::gpio_inttype_level, qm_gpio_context_t::gpio_inttype_level, qm_gpio_reg_t::gpio_ls_sync, qm_gpio_context_t::gpio_ls_sync, qm_gpio_reg_t::gpio_swporta_ctl, qm_gpio_context_t::gpio_swporta_ctl, qm_gpio_reg_t::gpio_swporta_ddr, qm_gpio_context_t::gpio_swporta_ddr, qm_gpio_reg_t::gpio_swporta_dr, and qm_gpio_context_t::gpio_swporta_dr.
Save GPIO context.
Save the configuration of the specified GPIO peripheral before entering sleep.
- Parameters
-
[in] | gpio | GPIO port index. |
[out] | ctx | GPIO context structure. This must not be NULL. |
- Returns
- Standard errno return type for QMSI.
- Return values
-
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 151 of file qm_gpio.c.
References qm_gpio_reg_t::gpio_debounce, qm_gpio_context_t::gpio_debounce, qm_gpio_reg_t::gpio_int_bothedge, qm_gpio_context_t::gpio_int_bothedge, qm_gpio_reg_t::gpio_int_polarity, qm_gpio_context_t::gpio_int_polarity, qm_gpio_reg_t::gpio_inten, qm_gpio_context_t::gpio_inten, qm_gpio_reg_t::gpio_intmask, qm_gpio_context_t::gpio_intmask, qm_gpio_reg_t::gpio_inttype_level, qm_gpio_context_t::gpio_inttype_level, qm_gpio_reg_t::gpio_ls_sync, qm_gpio_context_t::gpio_ls_sync, qm_gpio_reg_t::gpio_swporta_ctl, qm_gpio_context_t::gpio_swporta_ctl, qm_gpio_reg_t::gpio_swporta_ddr, qm_gpio_context_t::gpio_swporta_ddr, qm_gpio_reg_t::gpio_swporta_dr, and qm_gpio_context_t::gpio_swporta_dr.
Set GPIO port configuration.
This includes if interrupts are enabled or not, the level on which an interrupt is generated, the polarity of interrupts and if GPIO-debounce is enabled or not. If interrupts are enabled it also registers the user defined callback function.
- Parameters
-
[in] | gpio | GPIO port index to configure. |
[in] | cfg | New configuration for GPIO port. This must not be NULL. |
- Returns
- Standard errno return type for QMSI.
- Return values
-
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 59 of file qm_gpio.c.
References qm_gpio_port_config_t::callback, qm_gpio_port_config_t::callback_data, qm_gpio_port_config_t::direction, qm_gpio_reg_t::gpio_debounce, qm_gpio_reg_t::gpio_int_bothedge, qm_gpio_reg_t::gpio_int_polarity, qm_gpio_reg_t::gpio_inten, qm_gpio_reg_t::gpio_intmask, qm_gpio_reg_t::gpio_inttype_level, qm_gpio_reg_t::gpio_ls_sync, qm_gpio_reg_t::gpio_swporta_ddr, qm_gpio_port_config_t::int_bothedge, qm_gpio_port_config_t::int_debounce, qm_gpio_port_config_t::int_en, qm_gpio_port_config_t::int_polarity, and qm_gpio_port_config_t::int_type.
int qm_gpio_set_pin |
( |
const qm_gpio_t |
gpio, |
|
|
const uint8_t |
pin |
|
) |
| |
Set a single pin on a given GPIO port.
- Parameters
-
[in] | gpio | GPIO port index. |
[in] | pin | Pin of GPIO port to set. |
- Returns
- Standard errno return type for QMSI.
- Return values
-
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 97 of file qm_gpio.c.
Set or clear a single GPIO pin using a state variable.
- Parameters
-
[in] | gpio | GPIO port index. |
[in] | pin | Pin of GPIO port to update. |
[in] | state | QM_GPIO_LOW for low or QM_GPIO_HIGH for high. |
- Returns
- Standard errno return type for QMSI.
- Return values
-
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 117 of file qm_gpio.c.
References QM_GPIO_STATE_NUM.
int qm_gpio_write_port |
( |
const qm_gpio_t |
gpio, |
|
|
const uint32_t |
val |
|
) |
| |
Write a value to every pin on a GPIO port.
Each pin on the GPIO port is set to the corresponding value set in the val parameter. Maximum 32 pins per port.
- Parameters
-
[in] | gpio | GPIO port index. |
[in] | val | Value of all pins on GPIO port. |
- Returns
- Standard errno return type for QMSI.
- Return values
-
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 141 of file qm_gpio.c.