stm32/rcc: remove builders on Config.
This makes API consistent with other Config structs in Embassy, where the convention is to not use builders.
This commit is contained in:
@ -102,10 +102,10 @@ impl Into<u8> for AHBPrescaler {
|
||||
|
||||
/// Clocks configutation
|
||||
pub struct Config {
|
||||
mux: ClockSrc,
|
||||
ahb_pre: AHBPrescaler,
|
||||
apb_pre: APBPrescaler,
|
||||
low_power_run: bool,
|
||||
pub mux: ClockSrc,
|
||||
pub ahb_pre: AHBPrescaler,
|
||||
pub apb_pre: APBPrescaler,
|
||||
pub low_power_run: bool,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
@ -120,32 +120,6 @@ impl Default for Config {
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
#[inline]
|
||||
pub fn clock_src(mut self, mux: ClockSrc) -> Self {
|
||||
self.mux = mux;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn ahb_pre(mut self, pre: AHBPrescaler) -> Self {
|
||||
self.ahb_pre = pre;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn apb_pre(mut self, pre: APBPrescaler) -> Self {
|
||||
self.apb_pre = pre;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn low_power_run(mut self, on: bool) -> Self {
|
||||
self.low_power_run = on;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// RCC peripheral
|
||||
pub struct Rcc<'d> {
|
||||
_rb: peripherals::RCC,
|
||||
|
@ -74,11 +74,11 @@ impl Into<u8> for AHBPrescaler {
|
||||
|
||||
/// Clocks configutation
|
||||
pub struct Config {
|
||||
mux: ClockSrc,
|
||||
ahb_pre: AHBPrescaler,
|
||||
apb1_pre: APBPrescaler,
|
||||
apb2_pre: APBPrescaler,
|
||||
low_power_run: bool,
|
||||
pub mux: ClockSrc,
|
||||
pub ahb_pre: AHBPrescaler,
|
||||
pub apb1_pre: APBPrescaler,
|
||||
pub apb2_pre: APBPrescaler,
|
||||
pub low_power_run: bool,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
@ -94,38 +94,6 @@ impl Default for Config {
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
#[inline]
|
||||
pub fn clock_src(mut self, mux: ClockSrc) -> Self {
|
||||
self.mux = mux;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn ahb_pre(mut self, pre: AHBPrescaler) -> Self {
|
||||
self.ahb_pre = pre;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn apb1_pre(mut self, pre: APBPrescaler) -> Self {
|
||||
self.apb1_pre = pre;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn apb2_pre(mut self, pre: APBPrescaler) -> Self {
|
||||
self.apb2_pre = pre;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn low_power_run(mut self, on: bool) -> Self {
|
||||
self.low_power_run = on;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// RCC peripheral
|
||||
pub struct Rcc<'d> {
|
||||
_rb: peripherals::RCC,
|
||||
|
@ -183,10 +183,10 @@ impl Into<Msirange> for MSIRange {
|
||||
|
||||
/// Clocks configutation
|
||||
pub struct Config {
|
||||
mux: ClockSrc,
|
||||
ahb_pre: AHBPrescaler,
|
||||
apb1_pre: APBPrescaler,
|
||||
apb2_pre: APBPrescaler,
|
||||
pub mux: ClockSrc,
|
||||
pub ahb_pre: AHBPrescaler,
|
||||
pub apb1_pre: APBPrescaler,
|
||||
pub apb2_pre: APBPrescaler,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
@ -201,32 +201,6 @@ impl Default for Config {
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
#[inline]
|
||||
pub fn clock_src(mut self, mux: ClockSrc) -> Self {
|
||||
self.mux = mux;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn ahb_pre(mut self, pre: AHBPrescaler) -> Self {
|
||||
self.ahb_pre = pre;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn apb1_pre(mut self, pre: APBPrescaler) -> Self {
|
||||
self.apb1_pre = pre;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn apb2_pre(mut self, pre: APBPrescaler) -> Self {
|
||||
self.apb2_pre = pre;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// RCC peripheral
|
||||
pub struct Rcc<'d> {
|
||||
_rb: peripherals::RCC,
|
||||
|
@ -118,10 +118,10 @@ impl Into<u8> for MSIRange {
|
||||
|
||||
/// Clocks configutation
|
||||
pub struct Config {
|
||||
mux: ClockSrc,
|
||||
ahb_pre: AHBPrescaler,
|
||||
apb1_pre: APBPrescaler,
|
||||
apb2_pre: APBPrescaler,
|
||||
pub mux: ClockSrc,
|
||||
pub ahb_pre: AHBPrescaler,
|
||||
pub apb1_pre: APBPrescaler,
|
||||
pub apb2_pre: APBPrescaler,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
@ -136,32 +136,6 @@ impl Default for Config {
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
#[inline]
|
||||
pub fn clock_src(mut self, mux: ClockSrc) -> Self {
|
||||
self.mux = mux;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn ahb_pre(mut self, pre: AHBPrescaler) -> Self {
|
||||
self.ahb_pre = pre;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn apb1_pre(mut self, pre: APBPrescaler) -> Self {
|
||||
self.apb1_pre = pre;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn apb2_pre(mut self, pre: APBPrescaler) -> Self {
|
||||
self.apb2_pre = pre;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// RCC peripheral
|
||||
pub struct Rcc<'d> {
|
||||
_rb: peripherals::RCC,
|
||||
|
@ -269,10 +269,10 @@ impl Into<u8> for AHBPrescaler {
|
||||
|
||||
/// Clocks configutation
|
||||
pub struct Config {
|
||||
mux: ClockSrc,
|
||||
ahb_pre: AHBPrescaler,
|
||||
apb1_pre: APBPrescaler,
|
||||
apb2_pre: APBPrescaler,
|
||||
pub mux: ClockSrc,
|
||||
pub ahb_pre: AHBPrescaler,
|
||||
pub apb1_pre: APBPrescaler,
|
||||
pub apb2_pre: APBPrescaler,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
@ -287,32 +287,6 @@ impl Default for Config {
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
#[inline]
|
||||
pub fn clock_src(mut self, mux: ClockSrc) -> Self {
|
||||
self.mux = mux;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn ahb_pre(mut self, pre: AHBPrescaler) -> Self {
|
||||
self.ahb_pre = pre;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn apb1_pre(mut self, pre: APBPrescaler) -> Self {
|
||||
self.apb1_pre = pre;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn apb2_pre(mut self, pre: APBPrescaler) -> Self {
|
||||
self.apb2_pre = pre;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// RCC peripheral
|
||||
pub struct Rcc<'d> {
|
||||
_rb: peripherals::RCC,
|
||||
|
@ -274,16 +274,16 @@ impl Default for MSIRange {
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Config {
|
||||
mux: ClockSrc,
|
||||
ahb_pre: AHBPrescaler,
|
||||
apb1_pre: APBPrescaler,
|
||||
apb2_pre: APBPrescaler,
|
||||
apb3_pre: APBPrescaler,
|
||||
pub mux: ClockSrc,
|
||||
pub ahb_pre: AHBPrescaler,
|
||||
pub apb1_pre: APBPrescaler,
|
||||
pub apb2_pre: APBPrescaler,
|
||||
pub apb3_pre: APBPrescaler,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn new() -> Self {
|
||||
Config {
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
mux: ClockSrc::MSI(MSIRange::default()),
|
||||
ahb_pre: Default::default(),
|
||||
apb1_pre: Default::default(),
|
||||
@ -293,12 +293,6 @@ impl Config {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Config::new()
|
||||
}
|
||||
}
|
||||
|
||||
/// Extension trait that freezes the `RCC` peripheral with provided clocks configuration
|
||||
pub trait RccExt {
|
||||
fn freeze(self, config: Config, power: &Power) -> Clocks;
|
||||
|
@ -86,10 +86,10 @@ impl Into<u8> for AHBPrescaler {
|
||||
|
||||
/// Clocks configutation
|
||||
pub struct Config {
|
||||
mux: ClockSrc,
|
||||
ahb_pre: AHBPrescaler,
|
||||
apb1_pre: APBPrescaler,
|
||||
apb2_pre: APBPrescaler,
|
||||
pub mux: ClockSrc,
|
||||
pub ahb_pre: AHBPrescaler,
|
||||
pub apb1_pre: APBPrescaler,
|
||||
pub apb2_pre: APBPrescaler,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
@ -104,32 +104,6 @@ impl Default for Config {
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
#[inline]
|
||||
pub fn clock_src(mut self, mux: ClockSrc) -> Self {
|
||||
self.mux = mux;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn ahb_pre(mut self, pre: AHBPrescaler) -> Self {
|
||||
self.ahb_pre = pre;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn apb1_pre(mut self, pre: APBPrescaler) -> Self {
|
||||
self.apb1_pre = pre;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn apb2_pre(mut self, pre: APBPrescaler) -> Self {
|
||||
self.apb2_pre = pre;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// RCC peripheral
|
||||
pub struct Rcc<'d> {
|
||||
_rb: peripherals::RCC,
|
||||
|
@ -87,10 +87,10 @@ impl Into<u8> for AHBPrescaler {
|
||||
|
||||
/// Clocks configutation
|
||||
pub struct Config {
|
||||
mux: ClockSrc,
|
||||
ahb_pre: AHBPrescaler,
|
||||
apb1_pre: APBPrescaler,
|
||||
apb2_pre: APBPrescaler,
|
||||
pub mux: ClockSrc,
|
||||
pub ahb_pre: AHBPrescaler,
|
||||
pub apb1_pre: APBPrescaler,
|
||||
pub apb2_pre: APBPrescaler,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
@ -105,32 +105,6 @@ impl Default for Config {
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
#[inline]
|
||||
pub fn clock_src(mut self, mux: ClockSrc) -> Self {
|
||||
self.mux = mux;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn ahb_pre(mut self, pre: AHBPrescaler) -> Self {
|
||||
self.ahb_pre = pre;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn apb1_pre(mut self, pre: APBPrescaler) -> Self {
|
||||
self.apb1_pre = pre;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn apb2_pre(mut self, pre: APBPrescaler) -> Self {
|
||||
self.apb2_pre = pre;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
/// RCC peripheral
|
||||
pub struct Rcc<'d> {
|
||||
_rb: peripherals::RCC,
|
||||
|
Reference in New Issue
Block a user