diff options
| author | xoviat <[email protected]> | 2023-07-20 19:52:36 -0500 |
|---|---|---|
| committer | xoviat <[email protected]> | 2023-07-20 19:52:36 -0500 |
| commit | c80c232a72a561c3d89c8292437996bc07bfb689 (patch) | |
| tree | 74c53451e9420813bc79c3d9f33cadc83acb94dc | |
| parent | 83ff626c4745d73def4e0cf88ea64c21a19d6d1f (diff) | |
wpan: impl. debug for structs
| -rw-r--r-- | embassy-stm32-wpan/src/mac/event.rs | 1 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/mac/indications.rs | 10 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/mac/responses.rs | 15 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/mac/typedefs.rs | 32 |
4 files changed, 50 insertions, 8 deletions
diff --git a/embassy-stm32-wpan/src/mac/event.rs b/embassy-stm32-wpan/src/mac/event.rs index b6f57fdae..8415bc119 100644 --- a/embassy-stm32-wpan/src/mac/event.rs +++ b/embassy-stm32-wpan/src/mac/event.rs | |||
| @@ -23,6 +23,7 @@ pub(crate) trait ParseableMacEvent: Sized { | |||
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 25 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 26 | #[derive(Debug)] | ||
| 26 | pub enum MacEvent<'a> { | 27 | pub enum MacEvent<'a> { |
| 27 | MlmeAssociateCnf(&'a AssociateConfirm), | 28 | MlmeAssociateCnf(&'a AssociateConfirm), |
| 28 | MlmeDisassociateCnf(&'a DisassociateConfirm), | 29 | MlmeDisassociateCnf(&'a DisassociateConfirm), |
diff --git a/embassy-stm32-wpan/src/mac/indications.rs b/embassy-stm32-wpan/src/mac/indications.rs index 4349af9c3..c0b86d745 100644 --- a/embassy-stm32-wpan/src/mac/indications.rs +++ b/embassy-stm32-wpan/src/mac/indications.rs | |||
| @@ -10,6 +10,7 @@ use super::typedefs::{ | |||
| 10 | /// MLME ASSOCIATE Indication which will be used by the MAC | 10 | /// MLME ASSOCIATE Indication which will be used by the MAC |
| 11 | /// to indicate the reception of an association request command | 11 | /// to indicate the reception of an association request command |
| 12 | #[repr(C)] | 12 | #[repr(C)] |
| 13 | #[derive(Debug)] | ||
| 13 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 14 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 14 | pub struct AssociateIndication { | 15 | pub struct AssociateIndication { |
| 15 | /// Extended address of the device requesting association | 16 | /// Extended address of the device requesting association |
| @@ -31,6 +32,7 @@ impl ParseableMacEvent for AssociateIndication {} | |||
| 31 | /// MLME DISASSOCIATE indication which will be used to send | 32 | /// MLME DISASSOCIATE indication which will be used to send |
| 32 | /// disassociation indication to the application. | 33 | /// disassociation indication to the application. |
| 33 | #[repr(C)] | 34 | #[repr(C)] |
| 35 | #[derive(Debug)] | ||
| 34 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 36 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 35 | pub struct DisassociateIndication { | 37 | pub struct DisassociateIndication { |
| 36 | /// Extended address of the device requesting association | 38 | /// Extended address of the device requesting association |
| @@ -52,6 +54,7 @@ impl ParseableMacEvent for DisassociateIndication {} | |||
| 52 | /// MLME BEACON NOTIIFY Indication which is used to send parameters contained | 54 | /// MLME BEACON NOTIIFY Indication which is used to send parameters contained |
| 53 | /// within a beacon frame received by the MAC to the application | 55 | /// within a beacon frame received by the MAC to the application |
| 54 | #[repr(C)] | 56 | #[repr(C)] |
| 57 | #[derive(Debug)] | ||
| 55 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 58 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 56 | pub struct BeaconNotifyIndication { | 59 | pub struct BeaconNotifyIndication { |
| 57 | /// he set of octets comprising the beacon payload to be transferred | 60 | /// he set of octets comprising the beacon payload to be transferred |
| @@ -73,6 +76,7 @@ impl ParseableMacEvent for BeaconNotifyIndication {} | |||
| 73 | 76 | ||
| 74 | /// MLME COMM STATUS Indication which is used by the MAC to indicate a communications status | 77 | /// MLME COMM STATUS Indication which is used by the MAC to indicate a communications status |
| 75 | #[repr(C)] | 78 | #[repr(C)] |
| 79 | #[derive(Debug)] | ||
| 76 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 80 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 77 | pub struct CommStatusIndication { | 81 | pub struct CommStatusIndication { |
| 78 | /// The 16-bit PAN identifier of the device from which the frame | 82 | /// The 16-bit PAN identifier of the device from which the frame |
| @@ -103,6 +107,7 @@ impl ParseableMacEvent for CommStatusIndication {} | |||
| 103 | /// MLME GTS Indication indicates that a GTS has been allocated or that a | 107 | /// MLME GTS Indication indicates that a GTS has been allocated or that a |
| 104 | /// previously allocated GTS has been deallocated | 108 | /// previously allocated GTS has been deallocated |
| 105 | #[repr(C)] | 109 | #[repr(C)] |
| 110 | #[derive(Debug)] | ||
| 106 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 111 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 107 | pub struct GtsIndication { | 112 | pub struct GtsIndication { |
| 108 | /// The short address of the device that has been allocated or deallocated a GTS | 113 | /// The short address of the device that has been allocated or deallocated a GTS |
| @@ -126,6 +131,7 @@ impl ParseableMacEvent for GtsIndication {} | |||
| 126 | /// MLME ORPHAN Indication which is used by the coordinator to notify the | 131 | /// MLME ORPHAN Indication which is used by the coordinator to notify the |
| 127 | /// application of the presence of an orphaned device | 132 | /// application of the presence of an orphaned device |
| 128 | #[repr(C)] | 133 | #[repr(C)] |
| 134 | #[derive(Debug)] | ||
| 129 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 135 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 130 | pub struct OrphanIndication { | 136 | pub struct OrphanIndication { |
| 131 | /// Extended address of the orphaned device | 137 | /// Extended address of the orphaned device |
| @@ -147,6 +153,7 @@ impl ParseableMacEvent for OrphanIndication {} | |||
| 147 | /// MLME SYNC LOSS Indication which is used by the MAC to indicate the loss | 153 | /// MLME SYNC LOSS Indication which is used by the MAC to indicate the loss |
| 148 | /// of synchronization with the coordinator | 154 | /// of synchronization with the coordinator |
| 149 | #[repr(C)] | 155 | #[repr(C)] |
| 156 | #[derive(Debug)] | ||
| 150 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 157 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 151 | pub struct SyncLossIndication { | 158 | pub struct SyncLossIndication { |
| 152 | /// The PAN identifier with which the device lost synchronization or to which it was realigned | 159 | /// The PAN identifier with which the device lost synchronization or to which it was realigned |
| @@ -172,6 +179,7 @@ impl ParseableMacEvent for SyncLossIndication {} | |||
| 172 | /// MLME DPS Indication which indicates the expiration of the DPSIndexDuration | 179 | /// MLME DPS Indication which indicates the expiration of the DPSIndexDuration |
| 173 | /// and the resetting of the DPS values in the PHY | 180 | /// and the resetting of the DPS values in the PHY |
| 174 | #[repr(C)] | 181 | #[repr(C)] |
| 182 | #[derive(Debug)] | ||
| 175 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 183 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 176 | pub struct DpsIndication { | 184 | pub struct DpsIndication { |
| 177 | /// byte stuffing to keep 32 bit alignment | 185 | /// byte stuffing to keep 32 bit alignment |
| @@ -181,6 +189,7 @@ pub struct DpsIndication { | |||
| 181 | impl ParseableMacEvent for DpsIndication {} | 189 | impl ParseableMacEvent for DpsIndication {} |
| 182 | 190 | ||
| 183 | #[repr(C)] | 191 | #[repr(C)] |
| 192 | #[derive(Debug)] | ||
| 184 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 193 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 185 | pub struct DataIndication { | 194 | pub struct DataIndication { |
| 186 | /// Pointer to the set of octets forming the MSDU being indicated | 195 | /// Pointer to the set of octets forming the MSDU being indicated |
| @@ -244,6 +253,7 @@ impl DataIndication { | |||
| 244 | /// MLME POLL Indication which will be used for indicating the Data Request | 253 | /// MLME POLL Indication which will be used for indicating the Data Request |
| 245 | /// reception to upper layer as defined in Zigbee r22 - D.8.2 | 254 | /// reception to upper layer as defined in Zigbee r22 - D.8.2 |
| 246 | #[repr(C)] | 255 | #[repr(C)] |
| 256 | #[derive(Debug)] | ||
| 247 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 257 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 248 | pub struct PollIndication { | 258 | pub struct PollIndication { |
| 249 | /// addressing mode used | 259 | /// addressing mode used |
diff --git a/embassy-stm32-wpan/src/mac/responses.rs b/embassy-stm32-wpan/src/mac/responses.rs index 5d203084c..9c407a369 100644 --- a/embassy-stm32-wpan/src/mac/responses.rs +++ b/embassy-stm32-wpan/src/mac/responses.rs | |||
| @@ -8,6 +8,7 @@ use super::typedefs::{ | |||
| 8 | /// MLME ASSOCIATE Confirm used to inform of the initiating device whether | 8 | /// MLME ASSOCIATE Confirm used to inform of the initiating device whether |
| 9 | /// its request to associate was successful or unsuccessful | 9 | /// its request to associate was successful or unsuccessful |
| 10 | #[repr(C)] | 10 | #[repr(C)] |
| 11 | #[derive(Debug)] | ||
| 11 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 12 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 12 | pub struct AssociateConfirm { | 13 | pub struct AssociateConfirm { |
| 13 | /// short address allocated by the coordinator on successful association | 14 | /// short address allocated by the coordinator on successful association |
| @@ -30,6 +31,7 @@ impl ParseableMacEvent for AssociateConfirm {} | |||
| 30 | 31 | ||
| 31 | /// MLME DISASSOCIATE Confirm used to send disassociation Confirmation to the application. | 32 | /// MLME DISASSOCIATE Confirm used to send disassociation Confirmation to the application. |
| 32 | #[repr(C)] | 33 | #[repr(C)] |
| 34 | #[derive(Debug)] | ||
| 33 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 35 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 34 | pub struct DisassociateConfirm { | 36 | pub struct DisassociateConfirm { |
| 35 | /// status of the disassociation attempt | 37 | /// status of the disassociation attempt |
| @@ -46,6 +48,7 @@ impl ParseableMacEvent for DisassociateConfirm {} | |||
| 46 | 48 | ||
| 47 | /// MLME GET Confirm which requests information about a given PIB attribute | 49 | /// MLME GET Confirm which requests information about a given PIB attribute |
| 48 | #[repr(C)] | 50 | #[repr(C)] |
| 51 | #[derive(Debug)] | ||
| 49 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 52 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 50 | pub struct GetConfirm { | 53 | pub struct GetConfirm { |
| 51 | /// The pointer to the value of the PIB attribute attempted to read | 54 | /// The pointer to the value of the PIB attribute attempted to read |
| @@ -65,6 +68,7 @@ impl ParseableMacEvent for GetConfirm {} | |||
| 65 | /// MLME GTS Confirm which eports the results of a request to allocate a new GTS | 68 | /// MLME GTS Confirm which eports the results of a request to allocate a new GTS |
| 66 | /// or to deallocate an existing GTS | 69 | /// or to deallocate an existing GTS |
| 67 | #[repr(C)] | 70 | #[repr(C)] |
| 71 | #[derive(Debug)] | ||
| 68 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 72 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 69 | pub struct GtsConfirm { | 73 | pub struct GtsConfirm { |
| 70 | /// The characteristics of the GTS | 74 | /// The characteristics of the GTS |
| @@ -79,6 +83,7 @@ impl ParseableMacEvent for GtsConfirm {} | |||
| 79 | 83 | ||
| 80 | /// MLME RESET Confirm which is used to report the results of the reset operation | 84 | /// MLME RESET Confirm which is used to report the results of the reset operation |
| 81 | #[repr(C)] | 85 | #[repr(C)] |
| 86 | #[derive(Debug)] | ||
| 82 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 87 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 83 | pub struct ResetConfirm { | 88 | pub struct ResetConfirm { |
| 84 | /// The result of the reset operation | 89 | /// The result of the reset operation |
| @@ -92,6 +97,7 @@ impl ParseableMacEvent for ResetConfirm {} | |||
| 92 | /// MLME RX ENABLE Confirm which is used to report the results of the attempt | 97 | /// MLME RX ENABLE Confirm which is used to report the results of the attempt |
| 93 | /// to enable or disable the receiver | 98 | /// to enable or disable the receiver |
| 94 | #[repr(C)] | 99 | #[repr(C)] |
| 100 | #[derive(Debug)] | ||
| 95 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 101 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 96 | pub struct RxEnableConfirm { | 102 | pub struct RxEnableConfirm { |
| 97 | /// Result of the request to enable or disable the receiver | 103 | /// Result of the request to enable or disable the receiver |
| @@ -104,6 +110,7 @@ impl ParseableMacEvent for RxEnableConfirm {} | |||
| 104 | 110 | ||
| 105 | /// MLME SCAN Confirm which is used to report the result of the channel scan request | 111 | /// MLME SCAN Confirm which is used to report the result of the channel scan request |
| 106 | #[repr(C)] | 112 | #[repr(C)] |
| 113 | #[derive(Debug)] | ||
| 107 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 114 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 108 | pub struct ScanConfirm { | 115 | pub struct ScanConfirm { |
| 109 | /// Status of the scan request | 116 | /// Status of the scan request |
| @@ -130,6 +137,7 @@ impl ParseableMacEvent for ScanConfirm {} | |||
| 130 | 137 | ||
| 131 | /// MLME SET Confirm which reports the result of an attempt to write a value to a PIB attribute | 138 | /// MLME SET Confirm which reports the result of an attempt to write a value to a PIB attribute |
| 132 | #[repr(C)] | 139 | #[repr(C)] |
| 140 | #[derive(Debug)] | ||
| 133 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 141 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 134 | pub struct SetConfirm { | 142 | pub struct SetConfirm { |
| 135 | /// The result of the set operation | 143 | /// The result of the set operation |
| @@ -145,6 +153,7 @@ impl ParseableMacEvent for SetConfirm {} | |||
| 145 | /// MLME START Confirm which is used to report the results of the attempt to | 153 | /// MLME START Confirm which is used to report the results of the attempt to |
| 146 | /// start using a new superframe configuration | 154 | /// start using a new superframe configuration |
| 147 | #[repr(C)] | 155 | #[repr(C)] |
| 156 | #[derive(Debug)] | ||
| 148 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 157 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 149 | pub struct StartConfirm { | 158 | pub struct StartConfirm { |
| 150 | /// Result of the attempt to start using an updated superframe configuration | 159 | /// Result of the attempt to start using an updated superframe configuration |
| @@ -157,6 +166,7 @@ impl ParseableMacEvent for StartConfirm {} | |||
| 157 | 166 | ||
| 158 | /// MLME POLL Confirm which is used to report the result of a request to poll the coordinator for data | 167 | /// MLME POLL Confirm which is used to report the result of a request to poll the coordinator for data |
| 159 | #[repr(C)] | 168 | #[repr(C)] |
| 169 | #[derive(Debug)] | ||
| 160 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 170 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 161 | pub struct PollConfirm { | 171 | pub struct PollConfirm { |
| 162 | /// The status of the data request | 172 | /// The status of the data request |
| @@ -169,6 +179,7 @@ impl ParseableMacEvent for PollConfirm {} | |||
| 169 | 179 | ||
| 170 | /// MLME DPS Confirm which reports the results of the attempt to enable or disable the DPS | 180 | /// MLME DPS Confirm which reports the results of the attempt to enable or disable the DPS |
| 171 | #[repr(C)] | 181 | #[repr(C)] |
| 182 | #[derive(Debug)] | ||
| 172 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 183 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 173 | pub struct DpsConfirm { | 184 | pub struct DpsConfirm { |
| 174 | /// The status of the DPS request | 185 | /// The status of the DPS request |
| @@ -182,6 +193,7 @@ impl ParseableMacEvent for DpsConfirm {} | |||
| 182 | /// MLME SOUNDING Confirm which reports the result of a request to the PHY to provide | 193 | /// MLME SOUNDING Confirm which reports the result of a request to the PHY to provide |
| 183 | /// channel sounding information | 194 | /// channel sounding information |
| 184 | #[repr(C)] | 195 | #[repr(C)] |
| 196 | #[derive(Debug)] | ||
| 185 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 197 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 186 | pub struct SoundingConfirm { | 198 | pub struct SoundingConfirm { |
| 187 | /// Results of the sounding measurement | 199 | /// Results of the sounding measurement |
| @@ -195,6 +207,7 @@ impl ParseableMacEvent for SoundingConfirm {} | |||
| 195 | /// MLME CALIBRATE Confirm which reports the result of a request to the PHY | 207 | /// MLME CALIBRATE Confirm which reports the result of a request to the PHY |
| 196 | /// to provide internal propagation path information | 208 | /// to provide internal propagation path information |
| 197 | #[repr(C)] | 209 | #[repr(C)] |
| 210 | #[derive(Debug)] | ||
| 198 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 211 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 199 | pub struct CalibrateConfirm { | 212 | pub struct CalibrateConfirm { |
| 200 | /// The status of the attempt to return sounding data | 213 | /// The status of the attempt to return sounding data |
| @@ -214,6 +227,7 @@ impl ParseableMacEvent for CalibrateConfirm {} | |||
| 214 | /// MCPS DATA Confirm which will be used for reporting the results of | 227 | /// MCPS DATA Confirm which will be used for reporting the results of |
| 215 | /// MAC data related requests from the application | 228 | /// MAC data related requests from the application |
| 216 | #[repr(C)] | 229 | #[repr(C)] |
| 230 | #[derive(Debug)] | ||
| 217 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 231 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 218 | pub struct DataConfirm { | 232 | pub struct DataConfirm { |
| 219 | /// The handle associated with the MSDU being confirmed | 233 | /// The handle associated with the MSDU being confirmed |
| @@ -245,6 +259,7 @@ impl ParseableMacEvent for DataConfirm {} | |||
| 245 | /// MCPS PURGE Confirm which will be used by the MAC to notify the application of | 259 | /// MCPS PURGE Confirm which will be used by the MAC to notify the application of |
| 246 | /// the status of its request to purge an MSDU from the transaction queue | 260 | /// the status of its request to purge an MSDU from the transaction queue |
| 247 | #[repr(C)] | 261 | #[repr(C)] |
| 262 | #[derive(Debug)] | ||
| 248 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 263 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 249 | pub struct PurgeConfirm { | 264 | pub struct PurgeConfirm { |
| 250 | /// Handle associated with the MSDU requested to be purged from the transaction queue | 265 | /// Handle associated with the MSDU requested to be purged from the transaction queue |
diff --git a/embassy-stm32-wpan/src/mac/typedefs.rs b/embassy-stm32-wpan/src/mac/typedefs.rs index 98c67c86b..0552b8ea1 100644 --- a/embassy-stm32-wpan/src/mac/typedefs.rs +++ b/embassy-stm32-wpan/src/mac/typedefs.rs | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | use core::fmt::Debug; | ||
| 2 | |||
| 1 | use crate::numeric_enum; | 3 | use crate::numeric_enum; |
| 2 | 4 | ||
| 3 | #[derive(Debug)] | 5 | #[derive(Debug)] |
| @@ -37,7 +39,7 @@ numeric_enum! { | |||
| 37 | numeric_enum! { | 39 | numeric_enum! { |
| 38 | #[repr(u8)] | 40 | #[repr(u8)] |
| 39 | /// this enum contains all the MAC PIB Ids | 41 | /// this enum contains all the MAC PIB Ids |
| 40 | #[derive(Default)] | 42 | #[derive(Default, Debug)] |
| 41 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 43 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 42 | pub enum PibId { | 44 | pub enum PibId { |
| 43 | // PHY | 45 | // PHY |
| @@ -96,7 +98,7 @@ numeric_enum! { | |||
| 96 | 98 | ||
| 97 | numeric_enum! { | 99 | numeric_enum! { |
| 98 | #[repr(u8)] | 100 | #[repr(u8)] |
| 99 | #[derive(Default, Clone, Copy)] | 101 | #[derive(Default, Clone, Copy, Debug)] |
| 100 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 102 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 101 | pub enum AddressMode { | 103 | pub enum AddressMode { |
| 102 | #[default] | 104 | #[default] |
| @@ -113,6 +115,18 @@ pub union MacAddress { | |||
| 113 | pub extended: [u8; 8], | 115 | pub extended: [u8; 8], |
| 114 | } | 116 | } |
| 115 | 117 | ||
| 118 | impl Debug for MacAddress { | ||
| 119 | fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { | ||
| 120 | unsafe { | ||
| 121 | write!( | ||
| 122 | fmt, | ||
| 123 | "MacAddress {{ short: {:?}, extended: {:?} }}", | ||
| 124 | self.short, self.extended | ||
| 125 | ) | ||
| 126 | } | ||
| 127 | } | ||
| 128 | } | ||
| 129 | |||
| 116 | #[cfg(feature = "defmt")] | 130 | #[cfg(feature = "defmt")] |
| 117 | impl defmt::Format for MacAddress { | 131 | impl defmt::Format for MacAddress { |
| 118 | fn format(&self, fmt: defmt::Formatter) { | 132 | fn format(&self, fmt: defmt::Formatter) { |
| @@ -159,7 +173,7 @@ pub struct GtsCharacteristics { | |||
| 159 | 173 | ||
| 160 | /// MAC PAN Descriptor which contains the network details of the device from | 174 | /// MAC PAN Descriptor which contains the network details of the device from |
| 161 | /// which the beacon is received | 175 | /// which the beacon is received |
| 162 | #[derive(Default, Clone, Copy)] | 176 | #[derive(Default, Clone, Copy, Debug)] |
| 163 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 177 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 164 | pub struct PanDescriptor { | 178 | pub struct PanDescriptor { |
| 165 | /// PAN identifier of the coordinator | 179 | /// PAN identifier of the coordinator |
| @@ -223,7 +237,7 @@ impl TryFrom<&[u8]> for PanDescriptor { | |||
| 223 | 237 | ||
| 224 | numeric_enum! { | 238 | numeric_enum! { |
| 225 | #[repr(u8)] | 239 | #[repr(u8)] |
| 226 | #[derive(Default, Clone, Copy)] | 240 | #[derive(Default, Clone, Copy, Debug)] |
| 227 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 241 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 228 | /// Building wireless applications with STM32WB series MCUs - Application note 13.10.3 | 242 | /// Building wireless applications with STM32WB series MCUs - Application note 13.10.3 |
| 229 | pub enum MacChannel { | 243 | pub enum MacChannel { |
| @@ -289,7 +303,7 @@ defmt::bitflags! { | |||
| 289 | 303 | ||
| 290 | numeric_enum! { | 304 | numeric_enum! { |
| 291 | #[repr(u8)] | 305 | #[repr(u8)] |
| 292 | #[derive(Default, Clone, Copy)] | 306 | #[derive(Default, Clone, Copy, Debug)] |
| 293 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 307 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 294 | pub enum KeyIdMode { | 308 | pub enum KeyIdMode { |
| 295 | #[default] | 309 | #[default] |
| @@ -306,6 +320,7 @@ numeric_enum! { | |||
| 306 | 320 | ||
| 307 | numeric_enum! { | 321 | numeric_enum! { |
| 308 | #[repr(u8)] | 322 | #[repr(u8)] |
| 323 | #[derive(Debug)] | ||
| 309 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 324 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 310 | pub enum AssociationStatus { | 325 | pub enum AssociationStatus { |
| 311 | /// Association successful | 326 | /// Association successful |
| @@ -319,7 +334,7 @@ numeric_enum! { | |||
| 319 | 334 | ||
| 320 | numeric_enum! { | 335 | numeric_enum! { |
| 321 | #[repr(u8)] | 336 | #[repr(u8)] |
| 322 | #[derive(Clone, Copy)] | 337 | #[derive(Clone, Copy, Debug)] |
| 323 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 338 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 324 | pub enum DisassociationReason { | 339 | pub enum DisassociationReason { |
| 325 | /// The coordinator wishes the device to leave the PAN. | 340 | /// The coordinator wishes the device to leave the PAN. |
| @@ -331,7 +346,7 @@ numeric_enum! { | |||
| 331 | 346 | ||
| 332 | numeric_enum! { | 347 | numeric_enum! { |
| 333 | #[repr(u8)] | 348 | #[repr(u8)] |
| 334 | #[derive(Default, Clone, Copy)] | 349 | #[derive(Default, Clone, Copy, Debug)] |
| 335 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 350 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 336 | pub enum SecurityLevel { | 351 | pub enum SecurityLevel { |
| 337 | /// MAC Unsecured Mode Security | 352 | /// MAC Unsecured Mode Security |
| @@ -346,6 +361,7 @@ numeric_enum! { | |||
| 346 | 361 | ||
| 347 | numeric_enum! { | 362 | numeric_enum! { |
| 348 | #[repr(u8)] | 363 | #[repr(u8)] |
| 364 | #[derive(Debug)] | ||
| 349 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 365 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 350 | pub enum ScanType { | 366 | pub enum ScanType { |
| 351 | EdScan = 0x00, | 367 | EdScan = 0x00, |
| @@ -356,7 +372,7 @@ numeric_enum! { | |||
| 356 | } | 372 | } |
| 357 | 373 | ||
| 358 | /// newtype for Pan Id | 374 | /// newtype for Pan Id |
| 359 | #[derive(Default, Clone, Copy)] | 375 | #[derive(Default, Clone, Copy, Debug)] |
| 360 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | 376 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] |
| 361 | pub struct PanId(pub [u8; 2]); | 377 | pub struct PanId(pub [u8; 2]); |
| 362 | 378 | ||
