libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
GPIO Application Programming Interface. More...
Functions | |
void | gpio_mode_setup (uint32_t gpioport, gpio_mode_t mode, ccs_pull_updown_t pull_up_down, uint16_t gpios) |
Set the IO mode and pull-up/down configuration for the pins. More... | |
void | gpio_set_outmask (uint32_t gpioport, bool enable, uint16_t gpios) |
Set the output mask (disable changes) to the output pins specified. More... | |
void | gpio_set (uint32_t gpioport, uint16_t gpios) |
Set the port pins specified to the true state. More... | |
void | gpio_clear (uint32_t gpioport, uint16_t gpios) |
Clear the port pins specified to the false state. More... | |
uint16_t | gpio_get (uint32_t gpioport, uint16_t gpios) |
Return a masked bitfield of the port specified. More... | |
void | gpio_set_af (uint32_t gpioport, ccs_muxsel_func_t muxsel, uint16_t gpios) |
Set the function of the pin for this port. More... | |
void | gpio_set_output_options (uint32_t gpioport, ccs_drive_strength_t strength, uint16_t gpios) |
Set special output options for the gpio pin. More... | |
void | gpio_set_schmidt_trigger (uint32_t gpioport, bool enable, uint16_t gpios) |
Set input schmidt trigger for glitch rejection on the input pin. More... | |
GPIO Application Programming Interface.
void gpio_clear | ( | uint32_t | gpioport, |
uint16_t | gpios | ||
) |
Clear the port pins specified to the false state.
[in] | gpioport | Port to clear bits on. |
[in] | gpios | bitfield of pins to clear. |
Definition at line 97 of file gpio.c.
References GPIO_DOCLEARR.
uint16_t gpio_get | ( | uint32_t | gpioport, |
uint16_t | gpios | ||
) |
void gpio_mode_setup | ( | uint32_t | gpioport, |
gpio_mode_t | mode, | ||
ccs_pull_updown_t | pull_up_down, | ||
uint16_t | gpios | ||
) |
Set the IO mode and pull-up/down configuration for the pins.
[in] | gpioport | Port to configure the alternate function on. |
[in] | mode | IO Mode to configure (analog, input, output). |
[in] | pull_up_down | Pull configuration (up/down/none) to set for the pins.. |
[in] | gpios | Pins to set with the mode and pull config specified. |
Definition at line 50 of file gpio.c.
References CCS_IO_PULL_DOWN, CCS_IO_PULL_UP, CCS_PDENR, CCS_PUENR, get_ccs_port_base(), GPIO_MODER, and GPIO_MODER_MODE.
void gpio_set | ( | uint32_t | gpioport, |
uint16_t | gpios | ||
) |
Set the port pins specified to the true state.
[in] | gpioport | Port to set bits on. |
[in] | gpios | bitfield of pins to set. |
Definition at line 93 of file gpio.c.
References GPIO_DOSETR.
void gpio_set_af | ( | uint32_t | gpioport, |
ccs_muxsel_func_t | muxsel, | ||
uint16_t | gpios | ||
) |
Set the function of the pin for this port.
This will modify the pinmux,
[in] | gpioport | Port to configure the alternate function on. |
[in] | muxsel | Mux select mode to configure on the port and pins. |
[in] | gpios | Pins to set with the function specified. |
Definition at line 105 of file gpio.c.
References CCS_MUXSELR, CCS_MUXSELR_VAL, and get_ccs_port_base().
void gpio_set_outmask | ( | uint32_t | gpioport, |
bool | enable, | ||
uint16_t | gpios | ||
) |
Set the output mask (disable changes) to the output pins specified.
[in] | gpioport | Port to set output mask on. |
[in] | enable | Whether to enable or disable output masking. |
[in] | gpios | bitfield of pins to set. |
Definition at line 83 of file gpio.c.
References GPIO_OUTMASKR.
void gpio_set_output_options | ( | uint32_t | gpioport, |
ccs_drive_strength_t | strength, | ||
uint16_t | gpios | ||
) |
Set special output options for the gpio pin.
For this MCU, this is only the drive strength.
[in] | gpioport | Port to configure the alternate function on. |
[in] | strength | Drive strength (DS_XXMA from ccs.h). |
[in] | gpios | Pins to set with the drive strength specified. |
Definition at line 124 of file gpio.c.
References CCS_DSR, CCS_DSR_DS_VAL, and get_ccs_port_base().
void gpio_set_schmidt_trigger | ( | uint32_t | gpioport, |
bool | enable, | ||
uint16_t | gpios | ||
) |
Set input schmidt trigger for glitch rejection on the input pin.
[in] | gpioport | Port to configure the alternate function on. |
[in] | enable | True to enable, false to disable the schmidt trigger. |
[in] | gpios | Pins to set with the schmidt trigger setting specified. |
Definition at line 144 of file gpio.c.
References CCS_DSR, CCS_DSR_SCHMIDT_PIN, and get_ccs_port_base().