aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/mspm0g3507/src/bin/mathacl_ops.rs13
1 files changed, 7 insertions, 6 deletions
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 @@
5#![no_std] 5#![no_std]
6#![no_main] 6#![no_main]
7 7
8use core::f32::consts::PI;
8use defmt::*; 9use defmt::*;
9use embassy_executor::Spawner; 10use embassy_executor::Spawner;
10use embassy_mspm0::mathacl::{Mathacl, Precision}; 11use embassy_mspm0::mathacl::{Mathacl, Precision};
@@ -19,15 +20,15 @@ async fn main(_spawner: Spawner) -> ! {
19 20
20 let mut macl = Mathacl::new(d.MATHACL); 21 let mut macl = Mathacl::new(d.MATHACL);
21 22
22 // in range [-1,1) 23 // value radians [-PI; PI]
23 let angle = 0.5; 24 let rads = PI * 0.5;
24 match macl.sin(angle, Precision::High) { 25 match macl.sin(rads, Precision::High) {
25 Ok(res) => info!("sin({}) = {}", angle * 180.0, res), 26 Ok(res) => info!("sin({}) = {}", rads, res),
26 Err(e) => error!("sin Error: {:?}", e), 27 Err(e) => error!("sin Error: {:?}", e),
27 } 28 }
28 29
29 match macl.cos(angle, Precision::Medium) { 30 match macl.cos(rads, Precision::Medium) {
30 Ok(res) => info!("cos({}) = {}", angle * 180.0, res), 31 Ok(res) => info!("cos({}) = {}", rads, res),
31 Err(e) => error!("cos Error: {:?}", e), 32 Err(e) => error!("cos Error: {:?}", e),
32 } 33 }
33 34