diff options
| author | Siarhei B <[email protected]> | 2025-11-16 12:53:36 +0100 |
|---|---|---|
| committer | Siarhei B <[email protected]> | 2025-11-16 12:53:36 +0100 |
| commit | a3fdfb6db4f9ae79e34875a06325cf9776ce3f8c (patch) | |
| tree | 0627ed7312c7945818d33089da95b01c20cb6b81 /embassy-mspm0/src | |
| parent | d34dd3006dbcaff198c4e72469b5598dc3a8faa0 (diff) | |
mspm0-mathacl: add phantomdata for module
Diffstat (limited to 'embassy-mspm0/src')
| -rw-r--r-- | embassy-mspm0/src/mathacl.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/embassy-mspm0/src/mathacl.rs b/embassy-mspm0/src/mathacl.rs index 60e8cc5ed..a28c621c2 100644 --- a/embassy-mspm0/src/mathacl.rs +++ b/embassy-mspm0/src/mathacl.rs | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #![macro_use] | 5 | #![macro_use] |
| 6 | 6 | ||
| 7 | use core::f32::consts::PI; | 7 | use core::f32::consts::PI; |
| 8 | use core::marker::PhantomData; | ||
| 8 | use embassy_hal_internal::PeripheralType; | 9 | use embassy_hal_internal::PeripheralType; |
| 9 | use micromath::F32Ext; | 10 | use micromath::F32Ext; |
| 10 | 11 | ||
| @@ -26,14 +27,15 @@ pub enum Error { | |||
| 26 | NBitsTooBig, | 27 | NBitsTooBig, |
| 27 | } | 28 | } |
| 28 | 29 | ||
| 29 | #[derive(Copy, Clone)] | 30 | pub struct Mathacl<'d, T: Instance> { |
| 30 | pub struct Mathacl { | 31 | _peri: Peri<'d, T>, |
| 31 | regs: &'static Regs, | 32 | regs: &'static Regs, |
| 33 | _phantom: PhantomData<T>, | ||
| 32 | } | 34 | } |
| 33 | 35 | ||
| 34 | impl Mathacl { | 36 | impl<'d, T: Instance> Mathacl<'d, T> { |
| 35 | /// Mathacl initialization. | 37 | /// Mathacl initialization. |
| 36 | pub fn new<T: Instance>(_instance: Peri<T>) -> Self { | 38 | pub fn new(instance: Peri<'d, T>) -> Self { |
| 37 | // Init power | 39 | // Init power |
| 38 | T::regs().gprcm(0).rstctl().write(|w| { | 40 | T::regs().gprcm(0).rstctl().write(|w| { |
| 39 | w.set_resetstkyclr(vals::Resetstkyclr::CLR); | 41 | w.set_resetstkyclr(vals::Resetstkyclr::CLR); |
| @@ -50,7 +52,11 @@ impl Mathacl { | |||
| 50 | // init delay, 16 cycles | 52 | // init delay, 16 cycles |
| 51 | cortex_m::asm::delay(16); | 53 | cortex_m::asm::delay(16); |
| 52 | 54 | ||
| 53 | Self { regs: T::regs() } | 55 | Self { |
| 56 | _peri: instance, | ||
| 57 | regs: T::regs(), | ||
| 58 | _phantom: PhantomData, | ||
| 59 | } | ||
| 54 | } | 60 | } |
| 55 | 61 | ||
| 56 | /// Internal helper SINCOS function. | 62 | /// Internal helper SINCOS function. |
