aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorCorey Schuhen <[email protected]>2024-02-18 13:09:37 +1000
committerCorey Schuhen <[email protected]>2024-02-18 13:09:37 +1000
commiteafa90cd0707298f354d5d1e496f8364117bd781 (patch)
tree0295b2a971bbe17b92465f3638e710544de987d2 /examples
parent5ad291b708528b5772d6ebcc9309fbd3f8a002c8 (diff)
Remove the OperatingMode typestates
Instead have two explcit types(without the mode generic arg)types: - One for config - One for all operating modes
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32g4/src/bin/can.rs9
-rw-r--r--examples/stm32h5/src/bin/can.rs3
-rw-r--r--examples/stm32h7/src/bin/can.rs3
3 files changed, 7 insertions, 8 deletions
diff --git a/examples/stm32g4/src/bin/can.rs b/examples/stm32g4/src/bin/can.rs
index 043ca7144..affa97039 100644
--- a/examples/stm32g4/src/bin/can.rs
+++ b/examples/stm32g4/src/bin/can.rs
@@ -19,7 +19,7 @@ async fn main(_spawner: Spawner) {
19 19
20 let peripherals = embassy_stm32::init(config); 20 let peripherals = embassy_stm32::init(config);
21 21
22 let mut can = can::Fdcan::new(peripherals.FDCAN1, peripherals.PA11, peripherals.PA12, Irqs); 22 let mut can = can::FdcanConfigurator::new(peripherals.FDCAN1, peripherals.PA11, peripherals.PA12, Irqs);
23 23
24 can.set_extended_filter( 24 can.set_extended_filter(
25 can::fd::filter::ExtendedFilterSlot::_0, 25 can::fd::filter::ExtendedFilterSlot::_0,
@@ -38,8 +38,10 @@ async fn main(_spawner: Spawner) {
38 38
39 info!("Configured"); 39 info!("Configured");
40 40
41 let mut can = can.into_normal_mode(); 41 let mut can = can.start(match use_fd {
42 //let mut can = can.into_internal_loopback_mode(); 42 true => can::FdcanOperatingMode::InternalLoopbackMode,
43 false => can::FdcanOperatingMode::NormalOperationMode,
44 });
43 45
44 let mut i = 0; 46 let mut i = 0;
45 let mut last_read_ts = embassy_time::Instant::now(); 47 let mut last_read_ts = embassy_time::Instant::now();
@@ -106,7 +108,6 @@ async fn main(_spawner: Spawner) {
106 break; 108 break;
107 } 109 }
108 } 110 }
109
110 i = 0; 111 i = 0;
111 let (mut tx, mut rx) = can.split(); 112 let (mut tx, mut rx) = can.split();
112 // With split 113 // With split
diff --git a/examples/stm32h5/src/bin/can.rs b/examples/stm32h5/src/bin/can.rs
index 4b29a0d21..e5ccfe4f7 100644
--- a/examples/stm32h5/src/bin/can.rs
+++ b/examples/stm32h5/src/bin/can.rs
@@ -24,8 +24,7 @@ async fn main(_spawner: Spawner) {
24 24
25 let peripherals = embassy_stm32::init(config); 25 let peripherals = embassy_stm32::init(config);
26 26
27 //let mut can = can::Fdcan::new(peripherals.FDCAN1, peripherals.PB8, peripherals.PB9, Irqs); 27 let mut can = can::FdcanConfigurator::new(peripherals.FDCAN1, peripherals.PA11, peripherals.PA12, Irqs);
28 let mut can = can::Fdcan::new(peripherals.FDCAN1, peripherals.PA11, peripherals.PA12, Irqs);
29 28
30 // 250k bps 29 // 250k bps
31 can.set_bitrate(250_000); 30 can.set_bitrate(250_000);
diff --git a/examples/stm32h7/src/bin/can.rs b/examples/stm32h7/src/bin/can.rs
index 4b29a0d21..e5ccfe4f7 100644
--- a/examples/stm32h7/src/bin/can.rs
+++ b/examples/stm32h7/src/bin/can.rs
@@ -24,8 +24,7 @@ async fn main(_spawner: Spawner) {
24 24
25 let peripherals = embassy_stm32::init(config); 25 let peripherals = embassy_stm32::init(config);
26 26
27 //let mut can = can::Fdcan::new(peripherals.FDCAN1, peripherals.PB8, peripherals.PB9, Irqs); 27 let mut can = can::FdcanConfigurator::new(peripherals.FDCAN1, peripherals.PA11, peripherals.PA12, Irqs);
28 let mut can = can::Fdcan::new(peripherals.FDCAN1, peripherals.PA11, peripherals.PA12, Irqs);
29 28
30 // 250k bps 29 // 250k bps
31 can.set_bitrate(250_000); 30 can.set_bitrate(250_000);