From a3fdfb6db4f9ae79e34875a06325cf9776ce3f8c Mon Sep 17 00:00:00 2001 From: Siarhei B Date: Sun, 16 Nov 2025 12:53:36 +0100 Subject: mspm0-mathacl: add phantomdata for module --- embassy-mspm0/src/mathacl.rs | 16 +++++++++++----- 1 file 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 @@ #![macro_use] use core::f32::consts::PI; +use core::marker::PhantomData; use embassy_hal_internal::PeripheralType; use micromath::F32Ext; @@ -26,14 +27,15 @@ pub enum Error { NBitsTooBig, } -#[derive(Copy, Clone)] -pub struct Mathacl { +pub struct Mathacl<'d, T: Instance> { + _peri: Peri<'d, T>, regs: &'static Regs, + _phantom: PhantomData, } -impl Mathacl { +impl<'d, T: Instance> Mathacl<'d, T> { /// Mathacl initialization. - pub fn new(_instance: Peri) -> Self { + pub fn new(instance: Peri<'d, T>) -> Self { // Init power T::regs().gprcm(0).rstctl().write(|w| { w.set_resetstkyclr(vals::Resetstkyclr::CLR); @@ -50,7 +52,11 @@ impl Mathacl { // init delay, 16 cycles cortex_m::asm::delay(16); - Self { regs: T::regs() } + Self { + _peri: instance, + regs: T::regs(), + _phantom: PhantomData, + } } /// Internal helper SINCOS function. -- cgit