libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
Defined Constants and Types for the STM32L1xx General Purpose I/O More...
Modules | |
GPIO Port IDs | |
GPIO Pin Direction and Analog/Digital Mode | |
GPIO Output Pin Driver Type | |
GPIO Output Pin Speed | |
GPIO Output Pin Pullup | |
Alternate Function Pin Selection | |
GPIO Pin Identifiers | |
Functions | |
void | gpio_mode_setup (uint32_t gpioport, uint8_t mode, uint8_t pull_up_down, uint16_t gpios) |
Set GPIO Pin Mode. More... | |
void | gpio_set_output_options (uint32_t gpioport, uint8_t otype, uint8_t speed, uint16_t gpios) |
Set GPIO Output Options. More... | |
void | gpio_set_af (uint32_t gpioport, uint8_t alt_func_num, uint16_t gpios) |
Set GPIO Alternate Function Selection. More... | |
void | gpio_set (uint32_t gpioport, uint16_t gpios) |
Set a Group of Pins Atomic. More... | |
void | gpio_clear (uint32_t gpioport, uint16_t gpios) |
Clear a Group of Pins Atomic. More... | |
uint16_t | gpio_get (uint32_t gpioport, uint16_t gpios) |
Read a Group of Pins. More... | |
void | gpio_toggle (uint32_t gpioport, uint16_t gpios) |
Toggle a Group of Pins. More... | |
uint16_t | gpio_port_read (uint32_t gpioport) |
Read from a Port. More... | |
void | gpio_port_write (uint32_t gpioport, uint16_t data) |
Write to a Port. More... | |
void | gpio_port_config_lock (uint32_t gpioport, uint16_t gpios) |
Lock the Configuration of a Group of Pins. More... | |
Defined Constants and Types for the STM32L1xx General Purpose I/O
LGPL License Terms libopencm3 License
#define GPIO_LCKK (1 << 16) |
Definition at line 45 of file gpio_common_all.h.
#define GPIOA_MODER GPIO_MODER(GPIOA) |
#define GPIOA_OSPEEDR GPIO_OSPEEDR(GPIOA) |
#define GPIOA_OTYPER GPIO_OTYPER(GPIOA) |
#define GPIOA_PUPDR GPIO_PUPDR(GPIOA) |
#define GPIOB_MODER GPIO_MODER(GPIOB) |
#define GPIOB_OSPEEDR GPIO_OSPEEDR(GPIOB) |
#define GPIOB_OTYPER GPIO_OTYPER(GPIOB) |
#define GPIOB_PUPDR GPIO_PUPDR(GPIOB) |
#define GPIOC_MODER GPIO_MODER(GPIOC) |
#define GPIOC_OSPEEDR GPIO_OSPEEDR(GPIOC) |
#define GPIOC_OTYPER GPIO_OTYPER(GPIOC) |
#define GPIOC_PUPDR GPIO_PUPDR(GPIOC) |
#define GPIOD_MODER GPIO_MODER(GPIOD) |
#define GPIOD_OSPEEDR GPIO_OSPEEDR(GPIOD) |
#define GPIOD_OTYPER GPIO_OTYPER(GPIOD) |
#define GPIOD_PUPDR GPIO_PUPDR(GPIOD) |
#define GPIOE_MODER GPIO_MODER(GPIOE) |
#define GPIOE_OSPEEDR GPIO_OSPEEDR(GPIOE) |
#define GPIOE_OTYPER GPIO_OTYPER(GPIOE) |
#define GPIOE_PUPDR GPIO_PUPDR(GPIOE) |
#define GPIOH_MODER GPIO_MODER(GPIOH) |
#define GPIOH_OSPEEDR GPIO_OSPEEDR(GPIOH) |
#define GPIOH_OTYPER GPIO_OTYPER(GPIOH) |
#define GPIOH_PUPDR GPIO_PUPDR(GPIOH) |
void gpio_clear | ( | uint32_t | gpioport, |
uint16_t | gpios | ||
) |
Clear a Group of Pins Atomic.
Clear one or more pins of the given GPIO port to 0 in an atomic operation.
[in] | gpioport | Unsigned int32. Port identifier GPIO Port IDs |
[in] | gpios | Unsigned int16. Pin identifiers GPIO Pin Identifiers If multiple pins are to be changed, use bitwise OR '|' to separate them. |
Definition at line 56 of file gpio_common_all.c.
References GPIO_BSRR.
uint16_t gpio_get | ( | uint32_t | gpioport, |
uint16_t | gpios | ||
) |
Read a Group of Pins.
[in] | gpioport | Unsigned int32. Port identifier GPIO Port IDs |
[in] | gpios | Unsigned int16. 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_common_all.c.
References gpio_port_read().
void gpio_mode_setup | ( | uint32_t | gpioport, |
uint8_t | mode, | ||
uint8_t | pull_up_down, | ||
uint16_t | gpios | ||
) |
Set GPIO Pin Mode.
Sets the Pin Direction and Analog/Digital Mode, and Output Pin Pullup, for a set of GPIO pins on a given GPIO port.
[in] | gpioport | Unsigned int32. Port identifier GPIO Port IDs |
[in] | mode | Unsigned int8. Pin mode GPIO Pin Direction and Analog/Digital Mode |
[in] | pull_up_down | Unsigned int8. Pin pullup/pulldown configuration GPIO Output Pin Pullup |
[in] | gpios | Unsigned int16. Pin identifiers GPIO Pin Identifiers If multiple pins are to be set, use bitwise OR '|' to separate them. |
Definition at line 89 of file gpio_common_f0234.c.
References GPIO_MODE, GPIO_MODER, GPIO_PUPD, and GPIO_PUPDR.
void gpio_port_config_lock | ( | uint32_t | gpioport, |
uint16_t | gpios | ||
) |
Lock the Configuration of a Group of Pins.
The configuration of one or more pins of the given GPIO port is locked. There is no mechanism to unlock these via software. Unlocking occurs at the next reset.
[in] | gpioport | Unsigned int32. Port identifier GPIO Port IDs |
[in] | gpios | Unsigned int16. Pin identifiers GPIO Pin Identifiers If multiple pins are to be locked, use bitwise OR '|' to separate them. |
Definition at line 132 of file gpio_common_all.c.
uint16_t gpio_port_read | ( | uint32_t | gpioport | ) |
Read from a Port.
Read the current value of the given GPIO port. Only the lower 16 bits contain valid pin data.
[in] | gpioport | Unsigned int32. Port identifier GPIO Port IDs |
Definition at line 102 of file gpio_common_all.c.
References GPIO_IDR.
Referenced by gpio_get().
void gpio_port_write | ( | uint32_t | gpioport, |
uint16_t | data | ||
) |
Write to a Port.
Write a value to the given GPIO port.
[in] | gpioport | Unsigned int32. Port identifier GPIO Port IDs |
[in] | data | Unsigned int16. The value to be written to the GPIO port. |
Definition at line 115 of file gpio_common_all.c.
References GPIO_ODR.
void gpio_set | ( | uint32_t | gpioport, |
uint16_t | gpios | ||
) |
Set a Group of Pins Atomic.
Set one or more pins of the given GPIO port to 1 in an atomic operation.
[in] | gpioport | Unsigned int32. Port identifier GPIO Port IDs |
[in] | gpios | Unsigned int16. Pin identifiers GPIO Pin Identifiers If multiple pins are to be changed, use bitwise OR '|' to separate them. |
Definition at line 41 of file gpio_common_all.c.
References GPIO_BSRR.
void gpio_set_af | ( | uint32_t | gpioport, |
uint8_t | alt_func_num, | ||
uint16_t | gpios | ||
) |
Set GPIO Alternate Function Selection.
Set the alternate function mapping number for each pin. Most pins have alternate functions associated with them. When set to AF mode, a pin may be used for one of its allocated alternate functions selected by the number given here. To determine the number to be used for the desired function refer to the individual datasheet for the particular device. A table is given under the Pin Selection chapter.
Note that a number of pins may be set but only with a single AF number. In practice this would rarely be useful as each pin is likely to require a different number.
[in] | gpioport | Unsigned int32. Port identifier GPIO Port IDs |
[in] | alt_func_num | Unsigned int8. Pin alternate function number Alternate Function Pin Selection |
[in] | gpios | Unsigned int16. Pin identifiers GPIO Pin Identifiers If multiple pins are to be set, use bitwise OR '|' to separate them. |
Definition at line 178 of file gpio_common_f0234.c.
void gpio_set_output_options | ( | uint32_t | gpioport, |
uint8_t | otype, | ||
uint8_t | speed, | ||
uint16_t | gpios | ||
) |
Set GPIO Output Options.
When the pin is set to output mode, this sets the configuration (analog/digital and open drain/push pull) and speed, for a set of GPIO pins on a given GPIO port.
[in] | gpioport | Unsigned int32. Port identifier GPIO Port IDs |
[in] | otype | Unsigned int8. Pin output type GPIO Output Pin Driver Type |
[in] | speed | Unsigned int8. Pin speed GPIO Output Pin Speed |
[in] | gpios | Unsigned int16. Pin identifiers GPIO Pin Identifiers If multiple pins are to be set, use bitwise OR '|' to separate them. |
Definition at line 132 of file gpio_common_f0234.c.
References GPIO_OSPEED, GPIO_OSPEEDR, and GPIO_OTYPER.
void gpio_toggle | ( | uint32_t | gpioport, |
uint16_t | gpios | ||
) |
Toggle a Group of Pins.
Toggle one or more pins of the given GPIO port. The toggling is not atomic, but the non-toggled pins are not affected.
[in] | gpioport | Unsigned int32. Port identifier GPIO Port IDs |
[in] | gpios | Unsigned int16. Pin identifiers GPIO Pin Identifiers If multiple pins are to be changed, use bitwise OR '|' to separate them. |
Definition at line 87 of file gpio_common_all.c.