stm32/rcc: rename HSE32 to HSE
This commit is contained in:
parent
9be61a2967
commit
d0d0ceec6a
@ -28,7 +28,7 @@ pub enum PllSrc {
|
|||||||
impl Into<Pllsrc> for PllSrc {
|
impl Into<Pllsrc> for PllSrc {
|
||||||
fn into(self) -> Pllsrc {
|
fn into(self) -> Pllsrc {
|
||||||
match self {
|
match self {
|
||||||
PllSrc::HSE(..) => Pllsrc::HSE32,
|
PllSrc::HSE(..) => Pllsrc::HSE,
|
||||||
PllSrc::HSI16 => Pllsrc::HSI16,
|
PllSrc::HSI16 => Pllsrc::HSI16,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ impl Into<Pllsrc> for PllSrc {
|
|||||||
impl Into<Sw> for ClockSrc {
|
impl Into<Sw> for ClockSrc {
|
||||||
fn into(self) -> Sw {
|
fn into(self) -> Sw {
|
||||||
match self {
|
match self {
|
||||||
ClockSrc::HSE(..) => Sw::HSE32,
|
ClockSrc::HSE(..) => Sw::HSE,
|
||||||
ClockSrc::HSI16 => Sw::HSI16,
|
ClockSrc::HSI16 => Sw::HSI16,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,14 @@ pub const HSI_FREQ: Hertz = Hertz(16_000_000);
|
|||||||
/// LSI speed
|
/// LSI speed
|
||||||
pub const LSI_FREQ: Hertz = Hertz(32_000);
|
pub const LSI_FREQ: Hertz = Hertz(32_000);
|
||||||
|
|
||||||
/// HSE32 speed
|
/// HSE speed
|
||||||
pub const HSE32_FREQ: Hertz = Hertz(32_000_000);
|
pub const HSE_FREQ: Hertz = Hertz(32_000_000);
|
||||||
|
|
||||||
/// System clock mux source
|
/// System clock mux source
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub enum ClockSrc {
|
pub enum ClockSrc {
|
||||||
MSI(MSIRange),
|
MSI(MSIRange),
|
||||||
HSE32,
|
HSE,
|
||||||
HSI16,
|
HSI16,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ impl Default for Config {
|
|||||||
pub(crate) unsafe fn init(config: Config) {
|
pub(crate) unsafe fn init(config: Config) {
|
||||||
let (sys_clk, sw, vos) = match config.mux {
|
let (sys_clk, sw, vos) = match config.mux {
|
||||||
ClockSrc::HSI16 => (HSI_FREQ, Sw::HSI16, VoltageScale::RANGE2),
|
ClockSrc::HSI16 => (HSI_FREQ, Sw::HSI16, VoltageScale::RANGE2),
|
||||||
ClockSrc::HSE32 => (HSE32_FREQ, Sw::HSE32, VoltageScale::RANGE1),
|
ClockSrc::HSE => (HSE_FREQ, Sw::HSE, VoltageScale::RANGE1),
|
||||||
ClockSrc::MSI(range) => (msirange_to_hertz(range), Sw::MSI, msirange_to_vos(range)),
|
ClockSrc::MSI(range) => (msirange_to_hertz(range), Sw::MSI, msirange_to_vos(range)),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -113,8 +113,8 @@ pub(crate) unsafe fn init(config: Config) {
|
|||||||
RCC.cr().write(|w| w.set_hsion(true));
|
RCC.cr().write(|w| w.set_hsion(true));
|
||||||
while !RCC.cr().read().hsirdy() {}
|
while !RCC.cr().read().hsirdy() {}
|
||||||
}
|
}
|
||||||
ClockSrc::HSE32 => {
|
ClockSrc::HSE => {
|
||||||
// Enable HSE32
|
// Enable HSE
|
||||||
RCC.cr().write(|w| {
|
RCC.cr().write(|w| {
|
||||||
w.set_hsebyppwr(true);
|
w.set_hsebyppwr(true);
|
||||||
w.set_hseon(true);
|
w.set_hseon(true);
|
||||||
|
@ -33,7 +33,7 @@ bind_interrupts!(struct Irqs{
|
|||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let mut config = embassy_stm32::Config::default();
|
let mut config = embassy_stm32::Config::default();
|
||||||
config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSE32;
|
config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSE;
|
||||||
config.rcc.rtc_mux = embassy_stm32::rcc::RtcClockSource::LSI;
|
config.rcc.rtc_mux = embassy_stm32::rcc::RtcClockSource::LSI;
|
||||||
let p = embassy_stm32::init(config);
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ bind_interrupts!(struct Irqs{
|
|||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let mut config = embassy_stm32::Config::default();
|
let mut config = embassy_stm32::Config::default();
|
||||||
config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSE32;
|
config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSE;
|
||||||
let p = embassy_stm32::init(config);
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
let spi = Spi::new_subghz(p.SUBGHZSPI, p.DMA1_CH1, p.DMA1_CH2);
|
let spi = Spi::new_subghz(p.SUBGHZSPI, p.DMA1_CH1, p.DMA1_CH2);
|
||||||
|
@ -26,7 +26,7 @@ bind_interrupts!(struct Irqs{
|
|||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let mut config = embassy_stm32::Config::default();
|
let mut config = embassy_stm32::Config::default();
|
||||||
config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSE32;
|
config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSE;
|
||||||
let p = embassy_stm32::init(config);
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
let spi = Spi::new_subghz(p.SUBGHZSPI, p.DMA1_CH1, p.DMA1_CH2);
|
let spi = Spi::new_subghz(p.SUBGHZSPI, p.DMA1_CH1, p.DMA1_CH2);
|
||||||
|
@ -15,7 +15,7 @@ bind_interrupts!(struct Irqs{
|
|||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let mut config = embassy_stm32::Config::default();
|
let mut config = embassy_stm32::Config::default();
|
||||||
config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSE32;
|
config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSE;
|
||||||
config.rcc.rtc_mux = embassy_stm32::rcc::RtcClockSource::LSI;
|
config.rcc.rtc_mux = embassy_stm32::rcc::RtcClockSource::LSI;
|
||||||
|
|
||||||
let p = embassy_stm32::init(config);
|
let p = embassy_stm32::init(config);
|
||||||
|
@ -16,7 +16,7 @@ use {defmt_rtt as _, panic_probe as _};
|
|||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let p = {
|
let p = {
|
||||||
let mut config = Config::default();
|
let mut config = Config::default();
|
||||||
config.rcc.mux = ClockSrc::HSE32;
|
config.rcc.mux = ClockSrc::HSE;
|
||||||
config.rcc.lse = Some(Hertz(32_768));
|
config.rcc.lse = Some(Hertz(32_768));
|
||||||
config.rcc.rtc_mux = RtcClockSource::LSE;
|
config.rcc.rtc_mux = RtcClockSource::LSE;
|
||||||
embassy_stm32::init(config)
|
embassy_stm32::init(config)
|
||||||
|
@ -21,7 +21,7 @@ but can be surely changed for your needs.
|
|||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let mut config = embassy_stm32::Config::default();
|
let mut config = embassy_stm32::Config::default();
|
||||||
config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSE32;
|
config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSE;
|
||||||
let p = embassy_stm32::init(config);
|
let p = embassy_stm32::init(config);
|
||||||
|
|
||||||
defmt::info!("Starting system");
|
defmt::info!("Starting system");
|
||||||
|
Loading…
Reference in New Issue
Block a user