aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32-wpan
diff options
context:
space:
mode:
authorgoueslati <[email protected]>2023-07-13 16:29:29 +0100
committergoueslati <[email protected]>2023-07-13 16:29:29 +0100
commitf90b170dad91848d5a0ff746d873bd8a4ce7e91f (patch)
treedcad430269b866f795376cb7f9859ac160e57fe9 /embassy-stm32-wpan
parent68792bb9188b69c1e7629425a0d39110c602b9b2 (diff)
cleanup
Diffstat (limited to 'embassy-stm32-wpan')
-rw-r--r--embassy-stm32-wpan/Cargo.toml2
-rw-r--r--embassy-stm32-wpan/src/sub/mac/mod.rs2
-rw-r--r--embassy-stm32-wpan/src/sub/mac/responses.rs2
-rw-r--r--embassy-stm32-wpan/src/sub/sys.rs8
4 files changed, 5 insertions, 9 deletions
diff --git a/embassy-stm32-wpan/Cargo.toml b/embassy-stm32-wpan/Cargo.toml
index 1325faed9..91540321f 100644
--- a/embassy-stm32-wpan/Cargo.toml
+++ b/embassy-stm32-wpan/Cargo.toml
@@ -29,7 +29,7 @@ stm32wb-hci = { version = "0.1.2", features = ["version-5-0"], optional = true }
29bitflags = { version = "2.3.3", optional = true } 29bitflags = { version = "2.3.3", optional = true }
30 30
31[features] 31[features]
32default = ["stm32wb55rg", "mac", "ble", "defmt"] 32default = []
33defmt = ["dep:defmt", "embassy-sync/defmt", "embassy-embedded-hal/defmt", "embassy-hal-common/defmt"] 33defmt = ["dep:defmt", "embassy-sync/defmt", "embassy-embedded-hal/defmt", "embassy-hal-common/defmt"]
34 34
35ble = ["dep:stm32wb-hci"] 35ble = ["dep:stm32wb-hci"]
diff --git a/embassy-stm32-wpan/src/sub/mac/mod.rs b/embassy-stm32-wpan/src/sub/mac/mod.rs
index 26358bf81..ab39f89c2 100644
--- a/embassy-stm32-wpan/src/sub/mac/mod.rs
+++ b/embassy-stm32-wpan/src/sub/mac/mod.rs
@@ -98,8 +98,6 @@ impl Mac {
98 let mut payload = [0u8; MAX_PACKET_SIZE]; 98 let mut payload = [0u8; MAX_PACKET_SIZE];
99 cmd.copy_into_slice(&mut payload); 99 cmd.copy_into_slice(&mut payload);
100 100
101 debug!("sending {}", &payload[..T::SIZE]);
102
103 let response = self 101 let response = self
104 .tl_write_and_get_response(T::OPCODE as u16, &payload[..T::SIZE]) 102 .tl_write_and_get_response(T::OPCODE as u16, &payload[..T::SIZE])
105 .await; 103 .await;
diff --git a/embassy-stm32-wpan/src/sub/mac/responses.rs b/embassy-stm32-wpan/src/sub/mac/responses.rs
index 0d3c09869..2f6f5bf58 100644
--- a/embassy-stm32-wpan/src/sub/mac/responses.rs
+++ b/embassy-stm32-wpan/src/sub/mac/responses.rs
@@ -28,8 +28,6 @@ impl ParseableMacEvent for AssociateConfirm {
28 const SIZE: usize = 16; 28 const SIZE: usize = 16;
29 29
30 fn try_parse(buf: &[u8]) -> Result<Self, ()> { 30 fn try_parse(buf: &[u8]) -> Result<Self, ()> {
31 debug!("{}", buf);
32
33 Self::validate(buf)?; 31 Self::validate(buf)?;
34 32
35 Ok(Self { 33 Ok(Self {
diff --git a/embassy-stm32-wpan/src/sub/sys.rs b/embassy-stm32-wpan/src/sub/sys.rs
index caa4845f2..c17fd531d 100644
--- a/embassy-stm32-wpan/src/sub/sys.rs
+++ b/embassy-stm32-wpan/src/sub/sys.rs
@@ -50,7 +50,7 @@ impl Sys {
50 } 50 }
51 51
52 /// `HW_IPCC_SYS_CmdEvtNot` 52 /// `HW_IPCC_SYS_CmdEvtNot`
53 pub async fn write_and_get_response(&self, opcode: ShciOpcode, payload: &[u8]) -> SchiCommandStatus { 53 pub async fn write_and_get_response(&self, opcode: ShciOpcode, payload: &[u8]) -> Result<SchiCommandStatus, ()> {
54 self.write(opcode, payload).await; 54 self.write(opcode, payload).await;
55 Ipcc::flush(channels::cpu1::IPCC_SYSTEM_CMD_RSP_CHANNEL).await; 55 Ipcc::flush(channels::cpu1::IPCC_SYSTEM_CMD_RSP_CHANNEL).await;
56 56
@@ -59,12 +59,12 @@ impl Sys {
59 let p_command_event = &((*p_event_packet).evt_serial.evt.payload) as *const _ as *const CcEvt; 59 let p_command_event = &((*p_event_packet).evt_serial.evt.payload) as *const _ as *const CcEvt;
60 let p_payload = &((*p_command_event).payload) as *const u8; 60 let p_payload = &((*p_command_event).payload) as *const u8;
61 61
62 ptr::read_volatile(p_payload).try_into().unwrap() 62 ptr::read_volatile(p_payload).try_into()
63 } 63 }
64 } 64 }
65 65
66 #[cfg(feature = "mac")] 66 #[cfg(feature = "mac")]
67 pub async fn shci_c2_mac_802_15_4_init(&self) -> SchiCommandStatus { 67 pub async fn shci_c2_mac_802_15_4_init(&self) -> Result<SchiCommandStatus, ()> {
68 use crate::tables::{ 68 use crate::tables::{
69 Mac802_15_4Table, TracesTable, MAC_802_15_4_CMD_BUFFER, MAC_802_15_4_NOTIF_RSP_EVT_BUFFER, 69 Mac802_15_4Table, TracesTable, MAC_802_15_4_CMD_BUFFER, MAC_802_15_4_NOTIF_RSP_EVT_BUFFER,
70 TL_MAC_802_15_4_TABLE, TL_TRACES_TABLE, TRACES_EVT_QUEUE, 70 TL_MAC_802_15_4_TABLE, TL_TRACES_TABLE, TRACES_EVT_QUEUE,
@@ -88,7 +88,7 @@ impl Sys {
88 } 88 }
89 89
90 #[cfg(feature = "ble")] 90 #[cfg(feature = "ble")]
91 pub async fn shci_c2_ble_init(&self, param: ShciBleInitCmdParam) -> SchiCommandStatus { 91 pub async fn shci_c2_ble_init(&self, param: ShciBleInitCmdParam) -> Result<SchiCommandStatus, ()> {
92 self.write_and_get_response(ShciOpcode::BleInit, param.payload()).await 92 self.write_and_get_response(ShciOpcode::BleInit, param.payload()).await
93 } 93 }
94 94