General Purpose Input/Output (GPIO) port and Alternate Function Input/Output (AFIO) support.
Warning
doxygenstruct: Cannot find struct “gpio_reg_map” in doxygen xml output for project “project0” from directory: /home/mbolivar/leaf/libmaple/doxygen/xml
GPIO device type.
Public Members
- gpio_reg_map * regs
Register map.
- rcc_clk_id clk_id
RCC clock information.
- exti_cfg exti_port
(Deprecated) External interrupt port.
Instead of dev->exti_port, use gpio_exti_port(dev).
GPIO pin modes.
These only allow for 50MHZ max output speeds; if you want slower, use direct register access.
Values:
Output push-pull.
Output open-drain.
Alternate function output push-pull.
Alternate function output open drain.
Analog input.
Input floating.
Input pull-down.
Input pull-up.
Warning
doxygenstruct: Cannot find struct “afio_reg_map” in doxygen xml output for project “project0” from directory: /home/mbolivar/leaf/libmaple/doxygen/xml
Warning
doxygenenum: Cannot find enum “afio_exti_port” in doxygen xml output for project “project0” from directory: /home/mbolivar/leaf/libmaple/doxygen/xml
Warning
doxygenenum: Cannot find enum “afio_exti_num” in doxygen xml output for project “project0” from directory: /home/mbolivar/leaf/libmaple/doxygen/xml
Available peripheral remaps.
See: | afio_remap() |
---|
Values:
ADC 2 external trigger regular conversion remapping.
ADC 2 external trigger injected conversion remapping.
ADC 1 external trigger regular conversion remapping.
ADC 1 external trigger injected conversion remapping.
Timer 5 channel 4 internal remapping.
Port D0/Port D1 mapping on OSC_IN/OSC_OUT.
CAN alternate function remapping 1 (RX on PB8, TX on PB9)
CAN alternate function remapping 2 (RX on PD0, TX on PD1)
Timer 4 remapping.
Timer 3 partial remapping.
Timer 3 full remapping.
Timer 2 partial remapping 1 (CH1 and ETR on PA15, CH2 on PB3, CH3 on PA2, CH4 on PA3)
Timer 2 partial remapping 2 (CH1 and ETR on PA0, CH2 on PA1, CH3 on PB10, CH4 on PB11)
Timer 2 full remapping.
USART 2 remapping.
USART 1 remapping.
I2C 1 remapping.
SPI 1 remapping.
NADV signal not connected.
Timer 14 remapping.
Timer 13 remapping.
Timer 11 remapping.
Timer 10 remapping.
Timer 9 remapping.
Debug port configuration.
Used to configure the behavior of JTAG and Serial Wire (SW) debug ports and their associated GPIO pins.
See: | afio_cfg_debug_ports() |
---|
Values:
Full Serial Wire and JTAG debug.
Full Serial Wire and JTAG, but no NJTRST.
Serial Wire debug only (JTAG-DP disabled, SW-DP enabled)
No debug; all JTAG and SW pins are free for use as GPIOs.
GPIO port A device.
GPIO port B device.
GPIO port C device.
GPIO port D device.
GPIO port E device.
GPIO port F device.
GPIO port G device.
Initialize a GPIO device.
Enables the clock for and resets the given device.
Parameters: |
|
---|
Initialize and reset all available GPIO devices.
Set the mode of a GPIO pin.
Calling this function is equivalent to calling gpio_set_modef(dev, pin, mode, GPIO_MODE_SPEED_HIGH). Note that this overrides the default speed.
Parameters: |
|
---|
Get a GPIO port’s corresponding EXTI port configuration.
Parameters: |
|
---|
Set or reset a GPIO pin.
Pin must have previously been configured to output mode.
Parameters: |
|
---|
Determine whether or not a GPIO pin is set.
Pin must have previously been configured to input mode.
Parameters: |
|
---|---|
Return: | True if the pin is set, false otherwise. |
Toggle a pin configured as output push-pull.
Parameters: |
|
---|
Initialize the AFIO clock, and reset the AFIO registers.
Deprecated.
Use exti_select(exti, port) instead.
Enable or disable the JTAG and SW debug ports.
Parameters: |
|
---|---|
See: | afio_debug_cfg |
GPIO port A register map base pointer.
GPIO port B register map base pointer.
GPIO port C register map base pointer.
GPIO port D register map base pointer.
GPIO port E register map base pointer.
GPIO port F register map base pointer.
GPIO port G register map base pointer.
AFIO register map base pointer.
These values apply to both the low and high configuration registers (ST RM0008: GPIOx_CRL and GPIOx_CRH). You can shift them right by the appropriate number of bits for the GPIO port bit you’re interested in to obtain a bit mask.
For example, to mask out just the value of GPIOA_CRH_CNF12, note that GPIO port bit 12’s configuration starts at bit 18 in the corresponding CRH. Thus, an appropriate mask is GPIOA_BASE->CRH & (GPIO_CR_CNF << 18).