mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 19:17:47 +00:00
stm32f4: refactor GPIO, in prep for adding SPI, I2C, PWM etc
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
// Hand created file. DO NOT DELETE.
|
||||
// STM32FXXX (except stm32f1xx) bitfield definitions that are not
|
||||
// auto-generated by gen-device-svd.go
|
||||
|
||||
// These apply to the stm32 families that use the MODER, OTYPE amd PUPDR
|
||||
// registers for managing GPIO functionality.
|
||||
|
||||
// Add in other families that use the same settings, e.g. stm32f0xx, etc
|
||||
|
||||
// +build stm32,!stm32f103xx
|
||||
|
||||
package stm32
|
||||
|
||||
// AltFunc represents the alternate function peripherals that can be mapped to
|
||||
// the GPIO ports. Since these differ by what is supported on the stm32 family
|
||||
// they are defined in the more specific files
|
||||
type AltFunc uint8
|
||||
|
||||
// Family-wide common post-reset AltFunc. This represents
|
||||
// normal GPIO operation of the pins
|
||||
const AF0_SYSTEM AltFunc = 0
|
||||
|
||||
const (
|
||||
// Register values for the chip
|
||||
// GPIOx_MODER
|
||||
GPIOModeInput = 0
|
||||
GPIOModeOutputGeneral = 1
|
||||
GPIOModeOutputAltFunc = 2
|
||||
GPIOModeAnalog = 3
|
||||
|
||||
// GPIOx_OTYPER
|
||||
GPIOOutputTypePushPull = 0
|
||||
GPIOOutputTypeOpenDrain = 1
|
||||
|
||||
// GPIOx_OSPEEDR
|
||||
GPIOSpeedLow = 0
|
||||
GPIOSpeedMid = 1
|
||||
GPIOSpeedHigh = 2 // Note: this is also low speed on stm32f0, see RM0091
|
||||
GPIOSpeedVeryHigh = 3
|
||||
|
||||
// GPIOx_PUPDR
|
||||
GPIOPUPDRFloating = 0
|
||||
GPIOPUPDRPullUp = 1
|
||||
GPIOPUPDRPullDown = 2
|
||||
)
|
||||
@@ -0,0 +1,26 @@
|
||||
// These are the supported alternate function numberings on the stm32f407
|
||||
// +build stm32,stm32f407
|
||||
|
||||
// Alternate function settings on the stm32f4xx series
|
||||
|
||||
package stm32
|
||||
|
||||
const (
|
||||
// Alternative peripheral pin functions
|
||||
// AF0_SYSTEM is defined im the common bitfields package
|
||||
AF1_TIM1_2 AltFunc = 1
|
||||
AF2_TIM3_4_5 = 2
|
||||
AF3_TIM8_9_10_11 = 3
|
||||
AF4_I2C1_2_3 = 4
|
||||
AF5_SPI1_SPI2 = 5
|
||||
AF6_SPI3 = 6
|
||||
AF7_USART1_2_3 = 7
|
||||
AF8_USART4_5_6 = 8
|
||||
AF9_CAN1_CAN2_TIM12_13_14 = 9
|
||||
AF10_OTG_FS_OTG_HS = 10
|
||||
AF11_ETH = 11
|
||||
AF12_FSMC_SDIO_OTG_HS_1 = 12
|
||||
AF13_DCMI = 13
|
||||
AF14 = 14
|
||||
AF15_EVENTOUT = 15
|
||||
)
|
||||
Reference in New Issue
Block a user