libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
SWM050 GPIO API. More...
Functions | |
void | gpio_set (uint16_t gpios) |
Set a Group of Pins. More... | |
void | gpio_clear (uint16_t gpios) |
Clear a Group of Pins. More... | |
uint16_t | gpio_get (uint16_t gpios) |
Read a Group of Pins. More... | |
void | gpio_toggle (uint16_t gpios) |
Toggle a Group of Pins. More... | |
void | gpio_input (uint16_t gpios) |
Set the direction of a Group of Pins to Input. More... | |
void | gpio_output (uint16_t gpios) |
Set the direction of a Group of Pins to Output. More... | |
void | gpio_int_enable (uint16_t gpios, bool en) |
Sets the pins as external interrupts, rather than normal GPIO. More... | |
void | gpio_int_mask (uint16_t gpios, enum gpio_int_masked masked) |
Sets bits in the interrupt mask. More... | |
void | gpio_int_type (uint16_t gpios, enum gpio_trig_type type) |
Sets whether the pins are edge triggered or level triggered. More... | |
void | gpio_int_pol (uint16_t gpios, enum gpio_pol pol) |
Sets the interrupt trigger polarity. More... | |
uint16_t | gpio_int_status (void) |
Gets the masked interrupt status. More... | |
uint16_t | gpio_int_raw_status (void) |
Gets the raw unmasked interrupt status. More... | |
void | gpio_int_clear (uint16_t gpios) |
Clear the specified pin interrupts. More... | |
SWM050 GPIO API.
LGPL License Terms libopencm3 License
void gpio_clear | ( | uint16_t | gpios | ) |
Clear a Group of Pins.
Set one or more pins of GPIO to 0. Please note that this chip doesn't support atomic pin setting.
[in] | gpios | Pin identifiers GPIO Pin Identifiers If multiple pins are to be changed, use bitwise OR '|' to separate them. |
Definition at line 57 of file gpio.c.
References GPIO_ADATA.
uint16_t gpio_get | ( | uint16_t | gpios | ) |
Read a Group of Pins.
[in] | gpios | Pin identifiers GPIO Pin Identifiers If multiple pins are to be read, use bitwise OR '|' to separate them. |
Definition at line 71 of file gpio.c.
References GPIO_AEXT.
void gpio_input | ( | uint16_t | gpios | ) |
Set the direction of a Group of Pins to Input.
Set the direction of one or more pins of GPIO to input.
[in] | gpios | Pin identifiers GPIO Pin Identifiers If multiple pins are to be changed, use bitwise OR '|' to separate them. |
Definition at line 100 of file gpio.c.
References GPIO_ADIR.
void gpio_int_clear | ( | uint16_t | gpios | ) |
Clear the specified pin interrupts.
Clears the specified pin interrupts. Edge-triggered interrupts must be cleared by software.
[in] | gpios | Pin identifiers GPIO Pin Identifiers If multiple pins are to be changed, use bitwise OR '|' to separate them. |
Definition at line 249 of file gpio.c.
References GPIO_INTEOI_A.
void gpio_int_enable | ( | uint16_t | gpios, |
bool | en | ||
) |
Sets the pins as external interrupts, rather than normal GPIO.
Enable interrupts on the selected pins. If you want to quickly switch on and off interrupts, use gpio_int_mask() after calling this.
[in] | gpios | Pin identifiers GPIO Pin Identifiers If multiple pins are to be changed, use bitwise OR '|' to separate them. |
[in] | en | True to enable, false to disable. |
Definition at line 132 of file gpio.c.
References GPIO_INTEN_A.
void gpio_int_mask | ( | uint16_t | gpios, |
enum gpio_int_masked | masked | ||
) |
Sets bits in the interrupt mask.
When interrupts are masked, it prevents them from being received, which is a quicker way to turn on and off GPIO interrupts (after calling gpio_int_en()).
[in] | gpios | Pin identifiers GPIO Pin Identifiers If multiple pins are to be changed, use bitwise OR '|' to separate them. |
[in] | masked | Pin mask selection GPIO Interrupt Mask Whether to mask or unmask pins. |
Definition at line 155 of file gpio.c.
References GPIO_INTMASK_A.
void gpio_int_pol | ( | uint16_t | gpios, |
enum gpio_pol | pol | ||
) |
Sets the interrupt trigger polarity.
Sets whether the interrupt is triggered by a high or low level/edge.
[in] | gpios | Pin identifiers GPIO Pin Identifiers If multiple pins are to be changed, use bitwise OR '|' to separate them. |
[in] | pol | Polarity GPIO Polarity High or low level/edge |
Definition at line 200 of file gpio.c.
References GPIO_INTPOLARITY_A.
uint16_t gpio_int_raw_status | ( | void | ) |
Gets the raw unmasked interrupt status.
Returns the raw unmasked interrupt status.
Definition at line 233 of file gpio.c.
References GPIO_RAWINTSTAT_A.
uint16_t gpio_int_status | ( | void | ) |
Gets the masked interrupt status.
Returns the pin interrupt status masked with the mask set in gpio_int_mask().
Definition at line 219 of file gpio.c.
References GPIO_INTSTAT_A.
void gpio_int_type | ( | uint16_t | gpios, |
enum gpio_trig_type | type | ||
) |
Sets whether the pins are edge triggered or level triggered.
Sets whether the pins are edge triggered or level triggered. Edge-triggered interrupt bits must be cleared by software.
[in] | gpios | Pin identifiers GPIO Pin Identifiers If multiple pins are to be changed, use bitwise OR '|' to separate them. |
[in] | type | Trigger Type GPIO Interrupt Trigger Type Level or edge triggered |
Definition at line 178 of file gpio.c.
References GPIO_INTLEVEL_A.
void gpio_output | ( | uint16_t | gpios | ) |
Set the direction of a Group of Pins to Output.
Set the direction of one or more pins of GPIO to output.
[in] | gpios | Pin identifiers GPIO Pin Identifiers If multiple pins are to be changed, use bitwise OR '|' to separate them. |
Definition at line 114 of file gpio.c.
References GPIO_ADIR.
void gpio_set | ( | uint16_t | gpios | ) |
Set a Group of Pins.
Set one or more pins of GPIO to 1. Please note that this chip doesn't support atomic pin setting.
[in] | gpios | Pin identifiers GPIO Pin Identifiers If multiple pins are to be changed, use bitwise OR '|' to separate them. |
Definition at line 42 of file gpio.c.
References GPIO_ADATA.
void gpio_toggle | ( | uint16_t | gpios | ) |
Toggle a Group of Pins.
Toggle one or more pins of GPIO. The non-toggled pins are not affected.
[in] | gpios | Pin identifiers GPIO Pin Identifiers If multiple pins are to be changed, use bitwise OR '|' to separate them. |
Definition at line 85 of file gpio.c.
References GPIO_ADATA.