aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Schuhen <[email protected]>2024-03-05 20:27:52 +1000
committerCorey Schuhen <[email protected]>2024-03-07 17:45:01 +1000
commita9ff38003bebbb87aea2405437155d5312326803 (patch)
tree70c149313d83c50d968dd80feff7d3442db6eda9
parent455cc40261884b0a358e775fd4f411fa77ce27c9 (diff)
Documentation.
.
-rw-r--r--embassy-stm32/src/can/bx/filter.rs4
-rw-r--r--embassy-stm32/src/can/bx/mod.rs4
-rw-r--r--examples/stm32f1/src/bin/can.rs6
3 files changed, 10 insertions, 4 deletions
diff --git a/embassy-stm32/src/can/bx/filter.rs b/embassy-stm32/src/can/bx/filter.rs
index 64f020fc7..51766aa31 100644
--- a/embassy-stm32/src/can/bx/filter.rs
+++ b/embassy-stm32/src/can/bx/filter.rs
@@ -171,9 +171,13 @@ impl Mask32 {
171#[derive(Debug, Copy, Clone)] 171#[derive(Debug, Copy, Clone)]
172#[cfg_attr(feature = "defmt", derive(defmt::Format))] 172#[cfg_attr(feature = "defmt", derive(defmt::Format))]
173pub enum BankConfig { 173pub enum BankConfig {
174 /// Specify up to 4 exact standard CAN ID's.
174 List16([ListEntry16; 4]), 175 List16([ListEntry16; 4]),
176 /// Specify up to 2 exact standard or extended CAN ID's.
175 List32([ListEntry32; 2]), 177 List32([ListEntry32; 2]),
178 /// Specify up to 2 standard ID's with masks.
176 Mask16([Mask16; 2]), 179 Mask16([Mask16; 2]),
180 /// Specify a single extended ID with mask.
177 Mask32(Mask32), 181 Mask32(Mask32),
178} 182}
179 183
diff --git a/embassy-stm32/src/can/bx/mod.rs b/embassy-stm32/src/can/bx/mod.rs
index eee8a33a6..375bc27f7 100644
--- a/embassy-stm32/src/can/bx/mod.rs
+++ b/embassy-stm32/src/can/bx/mod.rs
@@ -621,7 +621,7 @@ where
621 unsafe { Rx1::conjure(self.canregs) } 621 unsafe { Rx1::conjure(self.canregs) }
622 } 622 }
623 623
624 pub fn split_by_ref(&mut self) -> (Tx<I>, Rx0<I>, Rx1<I>) { 624 pub(crate) fn split_by_ref(&mut self) -> (Tx<I>, Rx0<I>, Rx1<I>) {
625 // Safety: We take `&mut self` and the return value lifetimes are tied to `self`'s lifetime. 625 // Safety: We take `&mut self` and the return value lifetimes are tied to `self`'s lifetime.
626 let tx = unsafe { Tx::conjure(self.canregs) }; 626 let tx = unsafe { Tx::conjure(self.canregs) };
627 let rx0 = unsafe { Rx0::conjure(self.canregs) }; 627 let rx0 = unsafe { Rx0::conjure(self.canregs) };
@@ -924,7 +924,9 @@ fn receive_fifo(canregs: crate::pac::can::Can, fifo_nr: usize) -> nb::Result<Fra
924#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] 924#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
925#[cfg_attr(feature = "defmt", derive(defmt::Format))] 925#[cfg_attr(feature = "defmt", derive(defmt::Format))]
926pub enum Fifo { 926pub enum Fifo {
927 /// First receive FIFO
927 Fifo0 = 0, 928 Fifo0 = 0,
929 /// Second receive FIFO
928 Fifo1 = 1, 930 Fifo1 = 1,
929} 931}
930 932
diff --git a/examples/stm32f1/src/bin/can.rs b/examples/stm32f1/src/bin/can.rs
index 176fc888f..130b3905a 100644
--- a/examples/stm32f1/src/bin/can.rs
+++ b/examples/stm32f1/src/bin/can.rs
@@ -45,16 +45,16 @@ async fn main(_spawner: Spawner) {
45 45
46 let mut i: u8 = 0; 46 let mut i: u8 = 0;
47 loop { 47 loop {
48 let tx_frame = Frame::new_data(unwrap!(StandardId::new(i as _)), [i]); 48 let tx_frame = Frame::new_data(unwrap!(StandardId::new(i as _)), [i, 0, 1, 2, 3, 4, 5, 6]);
49 can.write(&tx_frame).await; 49 can.write(&tx_frame).await;
50 50
51 match can.read().await { 51 match can.read().await {
52 Ok(env) => match env.frame.id() { 52 Ok(env) => match env.frame.id() {
53 Id::Extended(id) => { 53 Id::Extended(id) => {
54 defmt::println!("Extended Frame id={:x}", id.as_raw()); 54 defmt::println!("Extended Frame id={:x} {:02x}", id.as_raw(), env.frame.data().unwrap());
55 } 55 }
56 Id::Standard(id) => { 56 Id::Standard(id) => {
57 defmt::println!("Standard Frame id={:x}", id.as_raw()); 57 defmt::println!("Standard Frame id={:x} {:02x}", id.as_raw(), env.frame.data().unwrap());
58 } 58 }
59 }, 59 },
60 Err(err) => { 60 Err(err) => {