libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
Defined Constants and Types for the STM32F1xx General Purpose I/O More...
Functions | |
void | gpio_set_mode (uint32_t gpioport, uint8_t mode, uint8_t cnf, uint16_t gpios) |
Set GPIO Pin Mode. More... | |
void | gpio_set_eventout (uint8_t evoutport, uint8_t evoutpin) |
Map the EVENTOUT signal. More... | |
void | gpio_primary_remap (uint32_t swjenable, uint32_t maps) |
Map Alternate Function Port Bits (Main Set) More... | |
void | gpio_secondary_remap (uint32_t maps) |
Map Alternate Function Port Bits (Secondary Set) 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 STM32F1xx General Purpose I/O
LGPL License Terms libopencm3 License
#define AFIO_EXTICR1 AFIO_EXTICR(0) |
#define AFIO_EXTICR2 AFIO_EXTICR(1) |
#define AFIO_EXTICR3 AFIO_EXTICR(2) |
#define AFIO_EXTICR4 AFIO_EXTICR(3) |
#define AFIO_EXTICR_FIELDSIZE 4 |
#define GPIO_BANK_CAN1_PB_RX GPIO_BANK_CAN_PB_RX /* Alias */ |
#define GPIO_BANK_CAN1_PB_TX GPIO_BANK_CAN_PB_TX /* Alias */ |
#define GPIO_BANK_CAN1_PD_RX GPIO_BANK_CAN_PD_RX /* Alias */ |
#define GPIO_BANK_CAN1_PD_TX GPIO_BANK_CAN_PD_TX /* Alias */ |
#define GPIO_BANK_CAN_RX GPIO_BANK_CAN1_RX /* Alias */ |
#define GPIO_BANK_CAN_TX GPIO_BANK_CAN1_TX /* Alias */ |
#define GPIO_CAN1_PB_RX GPIO_CAN_PB_RX /* Alias */ |
#define GPIO_CAN1_PB_TX GPIO_CAN_PB_TX /* Alias */ |
#define GPIO_CAN1_PD_RX GPIO_CAN_PD_RX /* Alias */ |
#define GPIO_CAN1_PD_TX GPIO_CAN_PD_TX /* Alias */ |
#define GPIO_CAN_RX GPIO_CAN1_RX /* Alias */ |
#define GPIO_CAN_TX GPIO_CAN1_TX /* Alias */ |
#define GPIO_LCKK (1 << 16) |
Definition at line 45 of file gpio_common_all.h.
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_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_primary_remap | ( | uint32_t | swjdisable, |
uint32_t | maps | ||
) |
Map Alternate Function Port Bits (Main Set)
A number of alternate function ports can be remapped to defined alternative port bits to avoid clashes in cases where multiple alternate functions are present. Refer to the datasheets for the particular mapping desired. This provides the main set of remap functionality. See gpio_secondary_remap for a number of lesser used remaps.
The AFIO remapping feature is used only with the STM32F10x series.
[in] | swjdisable | Disable parts of the SWJ capability Serial Wire JTAG disables. |
[in] | maps | Bitwise OR of map enable controls you wish to enable from Alternate Function Remap Controls, Alternate Function Remap Controls for CAN 1, Alternate Function Remap Controls for Timer 3, Alternate Function Remap Controls for Timer 2, Alternate Function Remap Controls for Timer 1, Alternate Function Remap Controls for USART 3. For connectivity line devices only Alternate Function Remap Controls for Connectivity are also available. |
Definition at line 167 of file gpio.c.
References AFIO_MAPR.
void gpio_secondary_remap | ( | uint32_t | maps | ) |
Map Alternate Function Port Bits (Secondary Set)
A number of alternate function ports can be remapped to defined alternative port bits to avoid clashes in cases where multiple alternate functions are present. Refer to the datasheets for the particular mapping desired. This provides the second smaller and less used set of remap functionality. See gpio_primary_remap for the main set of remaps.
The AFIO remapping feature is used only with the STM32F10x series.
[in] | maps | Unsigned int32. Bitwise OR of map enable controls from Alternate Function Remap Controls Secondary Set |
Definition at line 192 of file gpio.c.
References AFIO_MAPR2.
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_eventout | ( | uint8_t | evoutport, |
uint8_t | evoutpin | ||
) |
Map the EVENTOUT signal.
Enable the EVENTOUT signal and select the port and pin to be used.
[in] | evoutport | Unsigned int8. Port for EVENTOUT signal EVENTOUT Port selection |
[in] | evoutpin | Unsigned int8. Pin for EVENTOUT signal EVENTOUT Pin selection |
Definition at line 139 of file gpio.c.
References AFIO_EVCR, and AFIO_EVCR_EVOE.
void gpio_set_mode | ( | uint32_t | gpioport, |
uint8_t | mode, | ||
uint8_t | cnf, | ||
uint16_t | gpios | ||
) |
Set GPIO Pin Mode.
Sets the mode (input/output) and configuration (analog/digitial and open drain/push pull), 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 Mode |
[in] | cnf | Unsigned int8. Pin configuration GPIO Pin Configuration |
[in] | gpios | Unsigned int16. Pin identifiers GPIO Pin Identifiers If multiple pins are to be set, use bitwise OR '|' to separate them. |
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.