From 3669eba561aa25c492e446c72899452e61e5a921 Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Thu, 27 May 2021 10:01:40 +0200 Subject: [PATCH] Use builder --- embassy-stm32/src/lib.rs | 5 ++-- embassy-stm32/src/rcc/l0/mod.rs | 43 --------------------------------- 2 files changed, 3 insertions(+), 45 deletions(-) diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs index 49ead850..34f06516 100644 --- a/embassy-stm32/src/lib.rs +++ b/embassy-stm32/src/lib.rs @@ -46,8 +46,9 @@ pub struct Config { } impl Config { - pub fn new(rcc: rcc::Config) -> Self { - Self { rcc } + pub fn rcc(mut self, rcc: rcc::Config) -> Self { + self.rcc = rcc; + self } } diff --git a/embassy-stm32/src/rcc/l0/mod.rs b/embassy-stm32/src/rcc/l0/mod.rs index 99055d90..0cf3c2cb 100644 --- a/embassy-stm32/src/rcc/l0/mod.rs +++ b/embassy-stm32/src/rcc/l0/mod.rs @@ -224,49 +224,6 @@ impl Config { self.apb2_pre = pre; self } - - #[inline] - pub fn hsi16() -> Config { - Config { - mux: ClockSrc::HSI16, - ahb_pre: AHBPrescaler::NotDivided, - apb1_pre: APBPrescaler::NotDivided, - apb2_pre: APBPrescaler::NotDivided, - } - } - - #[inline] - pub fn msi(range: MSIRange) -> Config { - Config { - mux: ClockSrc::MSI(range), - ahb_pre: AHBPrescaler::NotDivided, - apb1_pre: APBPrescaler::NotDivided, - apb2_pre: APBPrescaler::NotDivided, - } - } - - #[inline] - pub fn pll(pll_src: PLLSource, pll_mul: PLLMul, pll_div: PLLDiv) -> Config { - Config { - mux: ClockSrc::PLL(pll_src, pll_mul, pll_div), - ahb_pre: AHBPrescaler::NotDivided, - apb1_pre: APBPrescaler::NotDivided, - apb2_pre: APBPrescaler::NotDivided, - } - } - - #[inline] - pub fn hse(freq: T) -> Config - where - T: Into, - { - Config { - mux: ClockSrc::HSE(freq.into()), - ahb_pre: AHBPrescaler::NotDivided, - apb1_pre: APBPrescaler::NotDivided, - apb2_pre: APBPrescaler::NotDivided, - } - } } /// RCC peripheral