From d34dd3006dbcaff198c4e72469b5598dc3a8faa0 Mon Sep 17 00:00:00 2001 From: Siarhei B Date: Sun, 16 Nov 2025 11:59:57 +0100 Subject: mspm0-mathacl: switch to radians as input param for sincos operations --- examples/mspm0g3507/src/bin/mathacl_ops.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/mspm0g3507/src/bin/mathacl_ops.rs b/examples/mspm0g3507/src/bin/mathacl_ops.rs index 06265ae18..aeca96d2b 100644 --- a/examples/mspm0g3507/src/bin/mathacl_ops.rs +++ b/examples/mspm0g3507/src/bin/mathacl_ops.rs @@ -5,6 +5,7 @@ #![no_std] #![no_main] +use core::f32::consts::PI; use defmt::*; use embassy_executor::Spawner; use embassy_mspm0::mathacl::{Mathacl, Precision}; @@ -19,15 +20,15 @@ async fn main(_spawner: Spawner) -> ! { let mut macl = Mathacl::new(d.MATHACL); - // in range [-1,1) - let angle = 0.5; - match macl.sin(angle, Precision::High) { - Ok(res) => info!("sin({}) = {}", angle * 180.0, res), + // value radians [-PI; PI] + let rads = PI * 0.5; + match macl.sin(rads, Precision::High) { + Ok(res) => info!("sin({}) = {}", rads, res), Err(e) => error!("sin Error: {:?}", e), } - match macl.cos(angle, Precision::Medium) { - Ok(res) => info!("cos({}) = {}", angle * 180.0, res), + match macl.cos(rads, Precision::Medium) { + Ok(res) => info!("cos({}) = {}", rads, res), Err(e) => error!("cos Error: {:?}", e), } -- cgit