|
modm API documentation
|
#include <modm/platform/clock/rcc.hpp>
Classes | |
| struct | Pll23Config |
| struct | PllConfig |
Public Types | |
| enum | PllMultiplier : uint8_t { Mul4 = 2, Mul5 = 3, Mul6 = 4, Mul6_5 = 13, Mul7 = 5, Mul8 = 6, Mul9 = 7 } |
| enum | PllSource : uint32_t { HsiDiv2 = 0, Hse = RCC_CFGR_PLLSRC, HseDiv2 = RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE, Pll2 = RCC_CFGR_PLLSRC | 1 } |
| enum | UsbPrescaler : uint8_t { Div3, Div2 } |
| enum | Pll23Multiplier : uint8_t { Disabled = 0, Mul8 = 6, Mul9 = 7, Mul10 = 8, Mul11 = 9, Mul12 = 10, Mul13 = 11, Mul14 = 12, Mul16 = 14, Mul20 = 15 } |
| 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, Pll = 0b10 } |
| enum | RealTimeClockSource : uint8_t { Disabled = 0, Lse = 0b01, Lsi = 0b10, Hse = 0b11 } |
| enum | AdcPrescaler : uint8_t { Div2 = 0b00, Div4 = 0b01, Div6 = 0b10, Div8 = 0b11 } |
| enum | I2s2ClockSource : uint8_t { I2s2ClockSource::SysClk, I2s2ClockSource::Pll3 } |
| enum | I2s3ClockSource : uint8_t { I2s3ClockSource::SysClk, I2s3ClockSource::Pll3 } |
| enum | McoClockSource : uint8_t { Disabled = 0b000, SysClk = 0b100, Hsi = 0b101, Hse = 0b110, PllDiv2 = 0b111 } |
Static Public Member Functions | |
| 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) |
| Configure and enable the PLL. | |
| static bool | disablePll (uint32_t waitLoops=0x10000) |
| Disable PLL. | |
| static constexpr uint8_t | value (Pll23Multiplier mul) |
| static bool | enablePll23 (const Pll23Config &cfg, uint32_t waitLoops=0x10000) |
| Configure and enable PLL2 and PLL3. | |
| static bool | disablePll2 (uint32_t waitLoops=0x10000) |
| static bool | disablePll3 (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) |
| static void | setAdcPrescaler (AdcPrescaler prescaler) |
| static void | setI2s2ClockSource (I2s2ClockSource src) |
| static void | setI2s3ClockSource (I2s3ClockSource src) |
| static void | setMcoClockSource (McoClockSource src) |
Reset and Clock Control for STM32F1 devices.
This class abstracts access to clock settings on the STM32. 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.
|
strong |
|
strong |
|
static |
Set flash latency for CPU frequency and voltage. Does nothing if CPU frequency is too high for the available voltage.
| <=CPU_Frequency | flash latency has been set correctly. |
| >CPU_Frequency | requested frequency too high for voltage. |