RTLib
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
core::stm32f1::GPIO Class Referencefinal

STM32F1xx-specific HAL implementation for GPIO pins. More...

#include <gpio.h>

Classes

struct  Config
 Configuration for GPIO. More...
 

Public Types

enum  Configuration : uint8_t {
  Configuration::kInputAnalog = 0x0, Configuration::kInputFloat, Configuration::kInputPullUpDown, Configuration::kOutputPushPull = 0x0,
  Configuration::kOutputOpenDrain, Configuration::kOutputAltFnPushPull, Configuration::kOutputAltFnOpenDrain
}
 Enumeration for different GPIO configurations. More...
 
enum  Mode : uint8_t { Mode::kInput, Mode::kOutput10MHz, Mode::kOutput2MHz, Mode::kOutput50MHz }
 Enumeration for different GPIO modes. More...
 
enum  JTAGDisables : uint32_t { JTAGDisables::kNoDisable = AFIO_MAPR_SWJ_CFG_FULL_SWJ, JTAGDisables::kNoJNTRST = AFIO_MAPR_SWJ_CFG_FULL_SWJ_NO_JNTRST, JTAGDisables::kDisableJTAG = AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON, JTAGDisables::kDisableJTAGSW = AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_OFF }
 Enumeration for different Serial Wire JTAG states. More...
 
enum  PriRemap : uint32_t {
  PriRemap::kADC2ExtTrigReg = AFIO_MAPR_ADC2_ETRGREG_REMAP, PriRemap::kADC2ExtTrigInj = AFIO_MAPR_ADC2_ETRGINJ_REMAP, PriRemap::kADC1ExtTrigReg = AFIO_MAPR_ADC1_ETRGREG_REMAP, PriRemap::kADC1ExtTrigInj = AFIO_MAPR_ADC1_ETRGINJ_REMAP,
  PriRemap::kTIM5Ch4 = AFIO_MAPR_TIM5CH4_IREMAP, PriRemap::kPD01 = AFIO_MAPR_PD01_REMAP, PriRemap::kTIM4 = AFIO_MAPR_TIM4_REMAP, PriRemap::kUSART2 = AFIO_MAPR_USART2_REMAP,
  PriRemap::kUSART1 = AFIO_MAPR_USART1_REMAP, PriRemap::kI2C1 = AFIO_MAPR_I2C1_REMAP, PriRemap::kSPI1 = AFIO_MAPR_SPI1_REMAP, PriRemap::kCAN1PA = AFIO_MAPR_CAN1_REMAP_PORTA,
  PriRemap::kCAN1PB = AFIO_MAPR_CAN1_REMAP_PORTB, PriRemap::kCAN1PD = AFIO_MAPR_CAN1_REMAP_PORTD, PriRemap::kTIM3NoRemap = AFIO_MAPR_TIM3_REMAP_NO_REMAP, PriRemap::kTIM3PartRemap = AFIO_MAPR_TIM3_REMAP_PARTIAL_REMAP,
  PriRemap::kTIM3FullRemap = AFIO_MAPR_TIM3_REMAP_FULL_REMAP, PriRemap::kTIM2NoRemap = AFIO_MAPR_TIM2_REMAP_NO_REMAP, PriRemap::kTIM2PartRemap1 = AFIO_MAPR_TIM2_REMAP_PARTIAL_REMAP1, PriRemap::kTIM2PartRemap2 = AFIO_MAPR_TIM2_REMAP_PARTIAL_REMAP2,
  PriRemap::kTIM2FullRemap = AFIO_MAPR_TIM2_REMAP_FULL_REMAP, PriRemap::kTIM1NoRemap = AFIO_MAPR_TIM1_REMAP_NO_REMAP, PriRemap::kTIM1PartRemap = AFIO_MAPR_TIM1_REMAP_PARTIAL_REMAP, PriRemap::kTIM1FullRemap = AFIO_MAPR_TIM1_REMAP_FULL_REMAP,
  PriRemap::kUSART3NoRemap = AFIO_MAPR_USART3_REMAP_NO_REMAP, PriRemap::kUSART3PartRemap = AFIO_MAPR_USART3_REMAP_PARTIAL_REMAP, PriRemap::kUSART3FullRemap = AFIO_MAPR_USART3_REMAP_FULL_REMAP, PriRemap::kPTPPPS = AFIO_MAPR_PTP_PPS_REMAP,
  PriRemap::kTIM2IntTrig1 = AFIO_MAPR_TIM2ITR1_IREMAP, PriRemap::kSPI3 = AFIO_MAPR_SPI3_REMAP, PriRemap::kMIIOrRMIISelect = AFIO_MAPR_MII_RMII_SEL, PriRemap::kCAN2 = AFIO_MAPR_CAN2_REMAP,
  PriRemap::kEthMAC = AFIO_MAPR_ETH_REMAP
}
 Enumeration for the primary set of different alternate function remaps. More...
 
enum  SecRemap : uint32_t {
  SecRemap::kMisc = AFIO_MAPR2_MISC_REMAP, SecRemap::kTIM12 = AFIO_MAPR2_TIM12_REMAP, SecRemap::kTIM76DMA = AFIO_MAPR2_TIM76_DAC_DMA_REMAPE, SecRemap::kDisconnectNADV = AFIO_MAPR2_FSMC_NADV_DISCONNECT,
  SecRemap::kTIM14 = AFIO_MAPR2_TIM14_REMAP, SecRemap::kTIM13 = AFIO_MAPR2_TIM13_REMAP, SecRemap::kTIM11 = AFIO_MAPR2_TIM11_REMAP, SecRemap::kTIM10 = AFIO_MAPR2_TIM10_REMAP,
  SecRemap::kTIM9 = AFIO_MAPR2_TIM9_REMAP, SecRemap::kTIM1DMA = AFIO_MAPR2_TIM1_DMA_REMAP, SecRemap::kCEC = AFIO_MAPR2_CEC_REMAP, SecRemap::kTIM17 = AFIO_MAPR2_TIM17_REMAP,
  SecRemap::kTIM16 = AFIO_MAPR2_TIM16_REMAP, SecRemap::kTIM15 = AFIO_MAPR1_TIM16_REMAP
}
 Enumeration for the secondary set of different alternate function remaps. More...
 
using AltFnMaps = uint32_t
 Type definition for alternate function selection. More...
 

Public Member Functions

 GPIO (const Config &config)
 Conversion constructor. More...
 
 GPIO (Pinout pin, Configuration cnf, Mode mode)
 Constructor for internal API use. More...
 
 ~GPIO ()=default
 
 GPIO (GPIO &&other) noexcept=default
 Move constructor. More...
 
GPIOoperator= (GPIO &&other) noexcept=default
 Move assignment operator. More...
 
 GPIO (const GPIO &)=delete
 Copy constructor. More...
 
GPIOoperator= (const GPIO &)=delete
 Copy assignment operator. More...
 
bool Read () const
 Reads the current logic state of the managed GPIO. More...
 
void Set (bool state) const
 Sets new GPIO state. More...
 
void Toggle () const
 Toggles GPIO state. Logic High -> Logic Low and vice versa. More...
 
void Reset () const
 Resets the GPIO to its original configuration, i.e. when the RESET button is first pushed. More...
 

Static Public Member Functions

static void SetPriAltFn (JTAGDisables swj_state, AltFnMaps maps)
 Configures the primary remap functionality of all GPIOs. More...
 
static void SetSecAltFn (AltFnMaps maps)
 Configures the secondary remap functionality of all GPIOs. More...
 
static void SetPriAltFn (JTAGDisables swj_state, PriRemap map)
 Configures one primary remap functionality. More...
 
static void SetSecAltFn (SecRemap map)
 Configures one secondary remap functionality. More...
 

Detailed Description

STM32F1xx-specific HAL implementation for GPIO pins.

This abstraction layer provides simple Read/Write operations on GPIO pins. One GPIO object will correspond and manage one GPIO pinout from the MCU.

Member Typedef Documentation

Type definition for alternate function selection.

Member Enumeration Documentation

enum core::stm32f1::GPIO::Configuration : uint8_t
strong

Enumeration for different GPIO configurations.

This enum is intended to replace equivalent macros used in libopencm3.

See http://libopencm3.org/docs/latest/stm32f1/html/group__gpio__cnf.html.

Enumerator
kInputAnalog 

Use this GPIO as analog input.

Equivalent to libopencm3 macro GPIO_CNF_INPUT_ANALOG.

kInputFloat 

Use this GPIO as floating input.

Equivalent to libopencm3 macro GPIO_CNF_INPUT_FLOAT.

kInputPullUpDown 

Use this GPIO as pull-up/pull-down input.

Equivalent to libopencm3 macro GPIO_CNF_INPUT_PULL_UPDOWN.

kOutputPushPull 

Use this GPIO as digital push-pull output.

Equivalent to libopencm3 macro GPIO_CNF_OUTPUT_PUSHPULL

kOutputOpenDrain 

Use this GPIO as digital open-drain output.

Equivalent to libopencm3 macro GPIO_CNF_OUTPUT_OPENDRAIN.

kOutputAltFnPushPull 

Use this GPIO as alternate function push-pull output.

Equivalent to libopencm3 macro GPIO_CNF_ALTFN_PUSHPULL.

kOutputAltFnOpenDrain 

Use this GPIO as alternate function open-drain output.

Equivalent to libopencm3 macro GPIO_CNF_ALTFN_OPENDRAIN.

enum core::stm32f1::GPIO::JTAGDisables : uint32_t
strong

Enumeration for different Serial Wire JTAG states.

This enum is intended to replace equivalent macros used in libopencm3.

See http://libopencm3.org/docs/latest/stm32f1/html/group__afio__swj__disable.html.

Enumerator
kNoDisable 

Use full JTAG capability.

Equivalent to libopencm3 macro AFIO_MAPR_SWJ_CFG_FULL_SWJ.

kNoJNTRST 

Use full JTAG capability with JNTRST.

Equivalent to libopencm3 macro AFIO_MAPR_SWJ_CFG_FULL_SWJ_NO_JNTRST.

kDisableJTAG 

Disable JTAG but enable SWD.

Equivalent to libopencm3 macro AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON.

kDisableJTAGSW 

Disable both JTAG and SWD.

Equivalent to libopencm3 macro AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_OFF.

enum core::stm32f1::GPIO::Mode : uint8_t
strong

Enumeration for different GPIO modes.

This enum is intended to replace equivalent macros used in libopencm3.

See http://libopencm3.org/docs/latest/stm32f1/html/group__gpio__mode.html.

Enumerator
kInput 

Input Mode.

Equivalent to libopencm3 macro GPIO_MODE_INPUT.

kOutput10MHz 

Output Mode at 10MHz max.

Equivalent to libopencm3 macro GPIO_MODE_OUTPUT_10MHZ.

kOutput2MHz 

Output Mode at 2MHz max.

Equivalent to libopencm3 macro GPIO_MODE_OUTPUT_2MHZ.

kOutput50MHz 

Output Mode at 50MHz max.

Equivalent to libopencm3 macro GPIO_MODE_OUTPUT_50MHZ.

enum core::stm32f1::GPIO::PriRemap : uint32_t
strong

Enumeration for the primary set of different alternate function remaps.

This enum is intended to provide a type-safe container for the full list of remaps.

See the libopencm3 documentation for the full list of remaps:

Enumerator
kADC2ExtTrigReg 

ADC2 External Trigger Regulator Conversion Remapping.

By default, this is connected to EXTI11. Enabling this remap will connect ADC2 External Event Regular Conversion to TIM8_TRGO.

Note
This remap is only available for STM32F101/102/103 devices.

Equivalent to libopencm3 macro AFIO_MAPR_ADC2_ETRGREG_REMAP.

kADC2ExtTrigInj 

ADC2 External Trigger Injected Conversion Remapping.

By default, this is connected to EXTI15. Enabling this remap will connect ADC2 External Event Injected Conversion to TIM8_Channel4.

Note
This remap is only available for STM32F101/102/103 devices.

Equivalent to libopencm3 macro AFIO_MAPR_ADC2_ETRGINJ_REMAP.

kADC1ExtTrigReg 

ADC1 External Trigger Regulator Conversion Remapping.

By default, this is connected to EXTI11. Enabling this remap will connect ADC1 External Event Regular Conversion to TIM8_TRGO.

Note
This remap is only available for STM32F101/102/103 devices.

Equivalent to libopencm3 macro AFIO_MAPR_ADC1_ETRGREG_REMAP.

kADC1ExtTrigInj 

ADC1 External Trigger Injected Conversion Remapping.

By default, this is connected to EXTI15. Enabling this remap will connect ADC2 External Event Injected Conversion to TIM8_Channel4.

Note
This remap is only available for STM32F101/102/103 devices.

Equivalent to libopencm3 macro AFIO_MAPR_ADC1_ETRGINJ_REMAP.

kTIM5Ch4 

TIM5 Channel 4 Internal Remapping.

By default, TIM5_CH4 is connected to PA3. Enabling this remap will connect the LSI internal clock to TIM5_CH4 for calibration.

Note
This remap is only available for High Density STM32F100 devices.

Equivalent to libopencm3 macro AFIO_MAPR_TIM5CH4_IREMAP.

kPD01 

Port D0/D1 Remapping.

By default, PD0 and PD1 are allocated for GPIO. Enabling this remap will connect PD0 and PD1 to OSC_IN and OSC_OUT respectively.

Note
This remap is only useful for 36-pin, 48-pin and 64-pin packages.

Equivalent to libopecm3 macro AFIO_MAPR_PD01_REMAP.

kTIM4 

TIM4 CH1/CH2/CH3/CH4 Remapping.

By default, TIM4 channels are connected to PB6-PB9. Enabling this remap will connect the channels to PD12-PD15.

Note
TIM4_ETR (PE0) will not be remapped.

Equivalent to libopencm3 macro AFIO_MAPR_TIM4_REMAP.

kUSART2 

USART2 CTS/RTS/TX/RX/CK Remapping.

By default, USART2 pins are connected to PA0-PA4. Enabling this remap will connect the pins to PD3-PD7.

Equivalent to libopencm3 macro AFIO_MAPR_USART2_REMAP.

kUSART1 

USART1 TX/RX Remapping.

By default, USART1 pins are connected to PA9-PA10. Enabling this remap will connect the pins to PB6-PB7.

Equivalent to libopencm3 macro AFIO_MAPR_USART1_REMAP.

kI2C1 

I2C1 SCL/SDA Remapping.

By default, I2C1 pins are connected to PB6-PB7. Enabling this remap will connect the pins to PB8-PB9.

Equivalent to libopencm3 macro AFIO_MAPR_I2C1_REMAP.

kSPI1 

SPI1 NSS/SCK/MISO/MOSI Remapping.

By default, SPI1 pins are connected to PA4-PA7. Enabling this remap will connect the pins to PA15/PB3-5.

Equivalent to libopencm3 macro AFIO_MAPR_SPI1_REMAP.

kCAN1PA 

CAN1 RX/TX Port A Remapping.

Enabling this remap will connect CAN1 pins to PA11-PA12.

Note
This remap is only available for STM32F101/102/103/105/107 devices.

Equivalent to libopencm3 macro AFIO_MAPR_CAN1_REMAP_PORTA.

kCAN1PB 

CAN1 RX/TX Port B Remapping.

Enabling this remap will connect CAN1 pins to PB8-PB9.

Note
This remap is only available for STM32F101/102/103/105/107 devices.
This remap is not available on 36-pin packages.

Equivalent to libopencm3 macro AFIO_MAPR_CAN1_REMAP_PORTB.

kCAN1PD 

CAN1 RX/TX Port D Remapping.

Enabling this remap will connect CAN1 pins to PD0-PD1.

Note
This remap is only available for STM32F101/102/103/105/107 devices.

Equivalent to libopencm3 macro AFIO_MAPR_CAN1_REMAP_PORTD.

kTIM3NoRemap 

TIM3 No Remapping. (Default)

Enabling this will disable remaps and connect the channels to PA6-PA7/PB0-PB1.

Equivalent to libopencm3 macro AFIO_MAPR_TIM3_REMAP_NO_REMAP.

kTIM3PartRemap 

TIM3 CH1-CH2 Partial Remapping.

Enabling this will connect TIM3 CH1-CH2 to PB4-PB5.

Note
TIM3_ETR (PE0) will not be remapped.

Equivalent to libopencm3 macro AFIO_MAPR_TIM3_REMAP_PARTIAL_REMAP.

kTIM3FullRemap 

TIM3 CH1-CH4 Full Remapping.

Enabling this will connect TIM3 channels to PC6-PC9.

Note
TIM3_ETR (PE0) will not be remapped.

Equivalent to libopencm3 macro AFIO_MAPR_TIM3_REMAP_FULL_REMAP.

kTIM2NoRemap 

TIM2 No Remapping. (Default)

Enabling this will disable remaps and connect the channels to PA0-PA3.

Equivalent to libopencm3 macro AFIO_MAPR_TIM2_REMAP_NO_REMAP.

kTIM2PartRemap1 

TIM2 ETR/CH1-CH2 Partial Remapping (1).

Enabling this will connect TIM2 CH1-CH2 to PA15/PB3.

Equivalent to libopencm3 macro AFIO_MAPR_TIM2_REMAP_PARTIAL_REMAP1.

kTIM2PartRemap2 

TIM2 ETR/CH1-CH4 Partial Remapping (2).

Enabling this will connect TIM2 CH3-CH4 to PB10-PB11.

Equivalent to libopencm3 macro AFIO_MAPR_TIM2_REMAP_PARTIAL_REMAP2.

kTIM2FullRemap 

TIM2 ETR/CH1-CH4 Full Remapping.

Enabling this will connect TIM2 channels to PA15/PB3/PB10-11.

Equivalent to libopencm3 macro AFIO_MAPR_TIM2_REMAP_PARTIAL_REMAP1.

kTIM1NoRemap 

TIM1 No Remapping. (Default)

Enabling this will disable remaps and connect the channels to PA12/PA8-PA11/PB12-PB15.

Equivalent to libopencm3 macro AFIO_MAPR_TIM1_REMAP_NO_REMAP.

kTIM1PartRemap 

TIM1 BKIN/CH1N-CH3N Partial Remapping.

Enabling this will connect TIM1 BKIN/CH1N-CH3N to PA6-PA7/PB0-PB1.

Equivalent to libopencm3 macro AFIO_MAPR_TIM1_REMAP_PARTIAL_REMAP.

kTIM1FullRemap 

TIM1 ETR/CH1-CH4/BKIN/CH1N-CH3N Full Remapping.

Enabling this will connect TIM1 channels to PE7/PE9/PE11/PE13-15/PE8/PE10/PE12.

Equivalent to libopencm3 macro AFIO_MAPR_TIM1_REMAP_FULL_REMAP.

kUSART3NoRemap 

USART3 No Remapping. (Default)

Enabling this will disable remaps and connect USART3 channels to PB10-PB14.

Equivalent to libopencm3 macro AFIO_MAPR_USART3_REMAP_NO_REMAP.

kUSART3PartRemap 

USART3 TX/RX/CK Partial Remapping.

Enabling this will connect USART3 TX/RX/CK to PC10-PC12.

Equivalent to libopencm3 macro AFIO_MAPR_USART3_REMAP_PARTIAL_REMAP.

kUSART3FullRemap 

USART3 TX/RX/CK/CTS/RTS Full Remapping.

Enabling this will connect USART3 pins to PD8-PD12.

Equivalent to libopencm3 macro AFIO_MAPR_USART3_REMAP_FULL_REMAP.

kPTPPPS 

Ethernet PTP PPS Remapping.

By default, Ethernet MAC PTP_PPS will not be output. Enabling this remap will connect PTP_PPS to PB5.

Note
This remap is only available for STM32F105/107 devices.

Equivalent to libopencm3 macro AFIO_MAPR_PTP_PPS_REMAP.

kTIM2IntTrig1 

TIM2 Internal Trigger 1 Remapping.

By default, TIM2_ITR1 is connected internally to the Ethernet PTP output. Enabling this remap will connect USB OTG Start-of-Frame output to TIM2_ITR1.

Note
This remap is only available for STM32F105/107 devices.

Equivalent to libopencm3 macro AFIO_MAPR_TIM2ITR1_IREMAP.

kSPI3 

SPI3 NSS/SCK/MISO/MOSI and I2S3 WS/CK/SD Remapping.

By default, SPI3/I2S3 are connected to PA15/PB3-PB5. Enabling this remap will connect the pins to PA4/PC10-PC12.

Note
This remap is only available for STM32F105/107 devices.

Equivalent to libopencm3 macro AFIO_MAPR_SPI3_REMAP.

kMIIOrRMIISelect 

MII/RMII Selection.

By default, the Ethernet MAC is configured for connecting with a MII PHY. Enabling this remap will configure the the MAC for connecting with a RMII PHY.

Note
This remap is only available for STM32F105/107 devices.

Equivalent to libopencm3 macro AFIO_MAPR_MII_RMII_SEL.

kCAN2 

CAN2 RX/TX Remapping.

By default, CAN2 pins are connected to PB12-PB13. Enabling this remap will connect the pins to PB5-PB6.

Note
This remap is only available for STM32F105/107 devices.

Equivalent to libopencm3 macro AFIO_MAPR_CAN2_REMAP.

kEthMAC 

Ethernet MAC DV/RXD0-RXD3 Remapping.

By default, Ethernet MAC pins are connected to PA7/PC4-PC5/PB0-PB1. Enabling this remap will connect the pins to PD8-PD12.

Note
This remap is only available for STM32F105/107 devices.

Equivalent to libopencm3 macro AFIO_MAPR_ETH_REMAP.

enum core::stm32f1::GPIO::SecRemap : uint32_t
strong

Enumeration for the secondary set of different alternate function remaps.

This enum is intended to provide a type-safe container for the full list of remaps.

See http://libopencm3.org/docs/latest/stm32f1/html/group__afio__remap2.html.

Enumerator
kMisc 

Miscellaneous Features Remapping.

By default, DMA2 CH5 is mapped in the vector table at position 59 (with DMA CH4), TIM5 TRGO event is selected as DAC Trigger 3, and TIM5 triggers TIM1/3. Enabling this remap will map DMA2 CH5 to position 60 of the vector table, TIM15 TRGO event is selected as DAC Trigger 3, and TIM15 triggers TIM1/3.

Note
This remap is only available for High Density STM32F100 devices.

Equivalent to libopencm3 macro AFIO_MAPR2_MISC_REMAP.

kTIM12 

TIM12 CH1-CH2 Remapping.

By default, TIM12 channels are connected to PC4-PC5. Enabling this remap will connect the channels to PB12-PB13.

Note
This remap is only available for High Density STM32F100 devices.

Equivalent to libopencm3 macro AFIO_MAPR2_TIM12_REMAP.

kTIM76DMA 

TIM6-TIM7 DAC to DMA Remapping.

By default, TIM6_DAC1/TIM7_DAC2 requests are mapped onto DMA2_CH3/DMA2_CH4. Enabling this remap will map the requests to DMA1_CH3/DMA1_CH4.

Note
This remap is only available for STM32F100 devices.

Equivalent to libopencm3 macro AFIO_MAPR2_TIM76_DAC_DMA_REMAPE.

kDisconnectNADV 

NADV Connection Selection.

By default, FSMC_NADV is connected to the output. Enabling this remap will disable this, allowing the pin to be used by another peripheral.

Note
This remap is only available for STM32F101/102/103/105/107 and High Density STM32F100 devices.

Equivalent to libopencm3 macro AFIO_MAPR2_FSMC_NADV_DISCONNECT.

kTIM14 

TIM14 CH1 Remapping.

For STM32F100 devices: By default, TIM14_CH1 is connected to PC9. Enabling this remap will connect the channel to PB1.

For other STM32F10x devices: By default, TIM14_CH1 is connected to PA7. Enabling this remap will connect the channel to PF9.

Equivalent to libopencm3 macro AFIO_MAPR2_TIM14_REMAP.

kTIM13 

TIM13 CH1 Remapping.

For STM32F100 devices: By default, TIM13_CH1 is connected to PC8. Enabling this remap will connect the channel to PB0.

For other STM32F10x devices: By default, TIM13_CH1 is connected to PA6. Enabling this remap will connect the channel to PF8.

Equivalent to libopencm3 macro AFIO_MAPR2_TIM13_REMAP.

kTIM11 

TIM11 CH1 Remapping.

By default, TIM11_CH1 is connected to PB9. Enabling this remap will connect the channel to PF7.

Note
This remap is only available for STM32F101/102/103/105/107 devices.

Equivalent to libopencm3 macro AFIO_MAPR2_TIM11_REMAP.

kTIM10 

TIM10 CH1 Remapping.

By default, TIM10_CH1 is connected to PB8. Enabling this remap will connect the channel to PF6.

Note
This remap is only available for STM32F101/102/103/105/107 devices.

Equivalent to libopencm3 macro AFIO_MAPR2_TIM10_REMAP.

kTIM9 

TIM9 CH1-CH2 Remapping.

By default, TIM9 channels are connected to PA2-PA3. Enabling this remap will connect the channels to PE5-PE6.

Note
This remap is only available for STM32F101/102/103/105/107 devices.

Equivalent to libopencm3 macro AFIO_MAPR2_TIM9_REMAP.

kTIM1DMA 

TIM1 DMA Remapping.

By default, TIM1_CH1/TIM1_CH2 DMA requests are mapped onto DMA1_CH2/DMA1_CH3. Enabling this remap will map the requests to DMA1_CH6.

Note
This remap is only available for STM32F100 devices.

Equivalent to libopencm3 macro AFIO_MAPR2_TIM1_DMA_REMAP.

kCEC 

CEC Remapping.

By default, the CEC line is connected to PB8. Enabling this remap will connect the line to PB10.

Note
This remap is only available for STM32F100 devices.

Equivalent to libopencm3 macro AFIO_MAPR2_CEC_REMAP.

kTIM17 

TIM17 CH1 Remapping.

By default, TIM17_CH1 is connected to PB9. Enabling this remap will connect the channel to PA7.

Note
This remap is only available for STM32F100 devices.

Equivalent to libopencm3 macro AFIO_MAPR2_TIM17_REMAP.

kTIM16 

TIM16 CH1 Remapping.

By default, TIM16_CH1 is connected to PB8. Enabling this remap will connect the channel to PA6.

Note
This remap is only available for STM32F100 devices.

Equivalent to libopencm3 macro AFIO_MAPR2_TIM16_REMAP.

kTIM15 

TIM15 CH1-CH2 Remapping.

By default, TIM15 channels are connected to PA2-PA3. Enabling this remap will connect the channels to PB14-PB15.

Note
This remap is only available for STM32F100 devices.

Equivalent to libopencm3 macro AFIO_MAPR2_TIM16_REMAP.

Constructor & Destructor Documentation

core::stm32f1::GPIO::GPIO ( const Config config)
explicit

Conversion constructor.

Parameters
configConfiguration for the GPIO. See GPIO::Config.
core::stm32f1::GPIO::GPIO ( Pinout  pin,
Configuration  cnf,
Mode  mode 
)

Constructor for internal API use.

This constructor is equivalent to

GPIO::GPIO(const Config&)

. However, it is suggested to use that constructor instead for code readability.

Parameters
pinMCU pinout
cnfGPIO Configuration
modeGPIO Mode
core::stm32f1::GPIO::~GPIO ( )
default

Default trivial destructor.

core::stm32f1::GPIO::GPIO ( GPIO &&  other)
defaultnoexcept

Move constructor.

Parameters
otherGPIO object to move from
core::stm32f1::GPIO::GPIO ( const GPIO )
delete

Copy constructor.

This constructor is deleted because there should only be one object managing each GPIO pin, similar to std::unique_ptr.

Member Function Documentation

GPIO& core::stm32f1::GPIO::operator= ( GPIO &&  other)
defaultnoexcept

Move assignment operator.

Parameters
otherGPIO object to move from
Returns
Reference to the moved GPIO.
GPIO& core::stm32f1::GPIO::operator= ( const GPIO )
delete

Copy assignment operator.

This constructor is deleted because there should only be one object managing each GPIO pin, similar to std::unique_ptr.

bool core::stm32f1::GPIO::Read ( ) const

Reads the current logic state of the managed GPIO.

Returns
true if high value, otherwise false
void core::stm32f1::GPIO::Reset ( ) const

Resets the GPIO to its original configuration, i.e. when the RESET button is first pushed.

void core::stm32f1::GPIO::Set ( bool  state) const

Sets new GPIO state.

Parameters
stateNew state of GPIO, where true represents a high value, and false represents a low value.
void core::stm32f1::GPIO::SetPriAltFn ( JTAGDisables  swj_state,
AltFnMaps  maps 
)
static

Configures the primary remap functionality of all GPIOs.

Most pins have alternate functions associated with them. This function allows the primary set of these functions to be enabled, along with the option to disable JTAG controls for GPIOs.

By default, all alternate functions are disabled.

See the gpio_primary_remap() section of http://libopencm3.org/docs/latest/stm32f1/html/group__gpio__file.html.

Parameters
swj_stateWhether to disable JTAG capability
mapsThe alternate functions to enable. Use bitwise OR on all libopencm3 constants to enable the remaps with one function call.
static void core::stm32f1::GPIO::SetPriAltFn ( JTAGDisables  swj_state,
PriRemap  map 
)
inlinestatic

Configures one primary remap functionality.

As opposed to SetPriAltFn(JTAGDisables,AltFnMaps), this function only enables one alternate function from the primary set.

Parameters
swj_stateWhether to disable JTAG capability
mapThe alternate function to enable. See GPIO::PriRemap for a comprehensive list of primary alternate functions.

Here is the call graph for this function:

Here is the caller graph for this function:

void core::stm32f1::GPIO::SetSecAltFn ( AltFnMaps  maps)
static

Configures the secondary remap functionality of all GPIOs.

Most pins have alternate functions associated with them. This function allows the primary set of these functions to be enabled, along with the option to disable JTAG controls for GPIOs.

See the libopencm3 documentation for the full list of remaps: http://libopencm3.org/docs/latest/stm32f1/html/group__afio__remap2.html

See the gpio_secondary_remap() section of http://libopencm3.org/docs/latest/stm32f1/html/group__gpio__file.html.

Parameters
mapsThe alternate functions to enable. Use bitwise OR on all libopencm3 constants to enable the remaps with one function call.
static void core::stm32f1::GPIO::SetSecAltFn ( SecRemap  map)
inlinestatic

Configures one secondary remap functionality.

As opposed to SetSecAltFn(AltFnMaps), this function only enables one alternate function from the secondary set.

Parameters
mapThe alternate function to enable. See GPIO::SecRemap for a comprehensive list of secondary alternate functions.

Here is the call graph for this function:

Here is the caller graph for this function:

void core::stm32f1::GPIO::Toggle ( ) const

Toggles GPIO state. Logic High -> Logic Low and vice versa.


The documentation for this class was generated from the following files: