aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/rcc
diff options
context:
space:
mode:
authorDaniel Nilsson <[email protected]>2025-09-17 20:52:40 +0200
committerDario Nieuwenhuis <[email protected]>2025-10-01 21:24:51 +0200
commit02b08a5a43427de77c194849674d0da0de84e07d (patch)
tree18c0f690568ca2c27c2a2f0ff764e8a25f2ebd32 /embassy-stm32/src/rcc
parent5ad71050cb5cfc57fe87d51b39476e6f49a1016f (diff)
stm32: add config to MCO to control the drive strength.
Diffstat (limited to 'embassy-stm32/src/rcc')
-rw-r--r--embassy-stm32/src/rcc/mco.rs23
1 files changed, 20 insertions, 3 deletions
diff --git a/embassy-stm32/src/rcc/mco.rs b/embassy-stm32/src/rcc/mco.rs
index 59ccc8cb5..fa4b45a20 100644
--- a/embassy-stm32/src/rcc/mco.rs
+++ b/embassy-stm32/src/rcc/mco.rs
@@ -91,12 +91,29 @@ pub struct Mco<'d, T: McoInstance> {
91 91
92impl<'d, T: McoInstance> Mco<'d, T> { 92impl<'d, T: McoInstance> Mco<'d, T> {
93 /// Create a new MCO instance. 93 /// Create a new MCO instance.
94 pub fn new(_peri: Peri<'d, T>, pin: Peri<'d, impl McoPin<T>>, source: T::Source, prescaler: McoPrescaler) -> Self { 94 pub fn new(_peri: Peri<'d, T>, pin: Peri<'d, impl McoPin<T>>, source: T::Source, config: McoConfig) -> Self {
95 critical_section::with(|_| unsafe { 95 critical_section::with(|_| unsafe {
96 T::_apply_clock_settings(source, prescaler); 96 T::_apply_clock_settings(source, config.prescaler);
97 set_as_af!(pin, AfType::output(OutputType::PushPull, Speed::VeryHigh)); 97 set_as_af!(pin, AfType::output(OutputType::PushPull, config.speed));
98 }); 98 });
99 99
100 Self { phantom: PhantomData } 100 Self { phantom: PhantomData }
101 } 101 }
102} 102}
103
104#[non_exhaustive]
105pub struct McoConfig {
106 /// Master Clock Out prescaler
107 pub prescaler: McoPrescaler,
108 /// IO Drive Strength
109 pub speed: Speed,
110}
111
112impl Default for McoConfig {
113 fn default() -> Self {
114 Self {
115 prescaler: McoPrescaler::DIV1,
116 speed: Speed::VeryHigh,
117 }
118 }
119}