|
| enum | PllSource : uint32_t { Hsi = 0,
Hse = 1
} |
| |
| enum | AhbPrescaler : uint8_t {
Div1 = 0b0000,
Div2 = 0b1000,
Div4 = 0b1001,
Div8 = 0b1010,
Div16 = 0b1011,
Div64 = 0b1100,
Div128 = 0b1101,
Div256 = 0b1110,
Div512 = 0b1111
} |
| |
| enum | ApbPrescaler : uint8_t {
Div1 = 0b000,
Div2 = 0b100,
Div4 = 0b101,
Div8 = 0b110,
Div16 = 0b111
} |
| |
| enum | SystemClockSource : uint32_t { Hsi = 0b00,
Hse = 0b01,
PllP = 0b10,
PllR = 0b11
} |
| |
| enum | RealTimeClockSource : uint32_t { Disabled = 0,
Lse = 0b01 << RCC_BDCR_RTCSEL_Pos,
Lsi = 0b10 << RCC_BDCR_RTCSEL_Pos,
Hse = 0b11 << RCC_BDCR_RTCSEL_Pos
} |
| |
| enum | AdcPrescaler : uint8_t { Div2 = 0b00,
Div4 = 0b01,
Div6 = 0b10,
Div8 = 0b11
} |
| |
| enum | I2sClockSource { PllI2s,
External
} |
| |
| enum | TimerClockPrescaler : uint32_t { TwicePclk = 0u,
HighSpeed = RCC_DCKCFGR_TIMPRE
} |
| |
| enum | PllSaiRDivider : uint32_t { Div2 = 0u,
Div4 = RCC_DCKCFGR_PLLSAIDIVR_0,
Div8 = RCC_DCKCFGR_PLLSAIDIVR_1,
Div16 = RCC_DCKCFGR_PLLSAIDIVR
} |
| |
| enum | Sai1BlockAClockSource : uint32_t { PllSai = 0u,
PllI2s = RCC_DCKCFGR_SAI1ASRC_0,
External = RCC_DCKCFGR_SAI1ASRC_1
} |
| |
| enum | Sai1BlockBClockSource : uint32_t { PllSai = 0u,
PllI2s = RCC_DCKCFGR_SAI1BSRC_0,
External = RCC_DCKCFGR_SAI1BSRC_1
} |
| |
| enum | McoPrescaler : uint32_t {
Div1 = 0b000,
Div2 = 0b100,
Div3 = 0b101,
Div4 = 0b110,
Div5 = 0b111
} |
| |
| enum | Mco1ClockSource : uint32_t { Hsi = 0b00,
Lse = 0b01,
Hse = 0b10,
Pll = 0b11
} |
| |
| enum | Mco2ClockSource : uint32_t { SysClk = 0b00,
PllI2s = 0b01,
Hse = 0b10,
Pll = 0b11
} |
| |
|
|
template<class... Signals> |
| static void | connect () |
| | Connect GPIO signals like MCO to the clock tree.
|
| |
|
template<Peripheral peripheral> |
| static void | enable () |
| | Enable the clock for a peripheral.
|
| |
|
template<Peripheral peripheral> |
| static bool | isEnabled () |
| | Check if a peripheral clock is enabled.
|
| |
|
template<Peripheral peripheral> |
| static void | disable () |
| | Disable the clock for a peripheral.
|
| |
| template<uint32_t Core_Hz, uint16_t Core_mV = 3300> |
| static uint32_t | setFlashLatency () |
| |
|
template<uint32_t Core_Hz> |
| static void | updateCoreFrequency () |
| | Update the SystemCoreClock and delay variables.
|
| |
|
static bool | enableHsiClock (uint32_t waitLoops=0x10000) |
| |
|
static bool | enableHseClock (uint32_t waitLoops=0x10000) |
| |
|
static bool | enableHseCrystal (uint32_t waitLoops=0x10000) |
| |
|
static bool | enableLsiClock (uint32_t waitLoops=0x10000) |
| |
|
static bool | enableLseClock (uint32_t waitLoops=0x10000) |
| |
|
static bool | enableLseCrystal (uint32_t waitLoops=0x10000) |
| |
|
static bool | enablePll (PllSource src, const PllConfig &cfg, uint32_t waitLoops=0x10000) |
| | VCO output must be in the range 100 MHz to 432 MHz,.
|
| |
|
static bool | disablePll (uint32_t waitLoops=0x10000) |
| |
|
static bool | enablePllI2s (const PllI2sConfig &cfg, uint32_t waitLoops=0x10000) |
| |
|
static bool | disablePllI2s (uint32_t waitLoops=0x10000) |
| |
|
static bool | enablePllSai (const PllSaiConfig &cfg, uint32_t waitLoops=0x10000) |
| |
|
static bool | disablePllSai (uint32_t waitLoops=0x10000) |
| |
|
static void | setAhbPrescaler (AhbPrescaler prescaler) |
| |
|
static void | setApb1Prescaler (ApbPrescaler prescaler) |
| |
|
static void | setApb2Prescaler (ApbPrescaler prescaler) |
| |
|
static bool | enableSystemClock (SystemClockSource src, uint32_t waitLoops=0x10000) |
| |
|
static void | setRealTimeClockSource (RealTimeClockSource src, uint8_t hseDivider=2) |
| |
|
static void | setAdcPrescaler (AdcPrescaler prescaler) |
| |
|
static void | setI2sClockSource (I2sClockSource src) |
| |
|
static void | setTimerClockPrescaler (TimerClockPrescaler prescaler) |
| |
|
static void | setPllI2sDivQ (uint8_t divider) |
| | Allowed values are 1-32.
|
| |
|
static void | setPllSaiDivQ (uint8_t divider) |
| | Allowed values are 1-32.
|
| |
|
static void | setPllSaiDivR (PllSaiRDivider divider) |
| |
|
static void | setSai1BlockAClockSource (Sai1BlockAClockSource src) |
| |
|
static void | setSai1BlockBClockSource (Sai1BlockBClockSource src) |
| |
|
static void | setMco1ClockSource (Mco1ClockSource src, McoPrescaler prescaler=McoPrescaler::Div1) |
| |
|
static void | setMco2ClockSource (Mco2ClockSource src, McoPrescaler prescaler=McoPrescaler::Div1) |
| |
|
static bool | enableOverdriveMode (uint32_t waitLoops=2048) |
| |
Reset and Clock Control for STM32F4 devices.
This class abstracts access to clock settings on the STM32F4 family. You need to use this class to enable internal and external clock sources & outputs, set PLL parameters and AHB & APB prescalers. Don't forget to set the flash latencies.
- Author
- Niklas Hauser