diff options
| author | Ulf Lilleengen <[email protected]> | 2021-06-11 09:19:02 +0200 |
|---|---|---|
| committer | Ulf Lilleengen <[email protected]> | 2021-06-14 11:33:11 +0200 |
| commit | 952f525af5bfbb800ab4593b77e69b8b13f95b16 (patch) | |
| tree | ea871dd6729a3cf365d8331a60d46a87a3e32aa4 /embassy-macros/src | |
| parent | 85f172dd93227e637724d37e76bbcd7d886678f9 (diff) | |
Provide a way for a peripheral to query its clock frequency
Currently this looks up the frequency in the global singleton that must
be initialized by the per-chip RCC implementation. At present, this is
only done for the L0 family of chips.
Diffstat (limited to 'embassy-macros/src')
| -rw-r--r-- | embassy-macros/src/chip/stm32.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/embassy-macros/src/chip/stm32.rs b/embassy-macros/src/chip/stm32.rs index 0a3a5abb9..9cd0111c9 100644 --- a/embassy-macros/src/chip/stm32.rs +++ b/embassy-macros/src/chip/stm32.rs | |||
| @@ -17,9 +17,7 @@ pub fn generate(embassy_prefix: &ModulePrefix, config: syn::Expr) -> TokenStream | |||
| 17 | ); | 17 | ); |
| 18 | let clock = unsafe { make_static(&mut c) }; | 18 | let clock = unsafe { make_static(&mut c) }; |
| 19 | 19 | ||
| 20 | // TODO: Is TIM2 always APB1? | 20 | clock.start(); |
| 21 | let timer_freq = unsafe { #embassy_stm32_path::rcc::get_freqs().apb1_clk }; | ||
| 22 | clock.start(timer_freq); | ||
| 23 | 21 | ||
| 24 | let mut alarm = clock.alarm1(); | 22 | let mut alarm = clock.alarm1(); |
| 25 | unsafe { #embassy_path::time::set_clock(clock) }; | 23 | unsafe { #embassy_path::time::set_clock(clock) }; |
