aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32
diff options
context:
space:
mode:
authorDion Dokter <[email protected]>2024-10-29 23:35:28 +0100
committerDion Dokter <[email protected]>2024-10-29 23:35:28 +0100
commita3bbb3b43abd61ce86d6cd7b949a115f243e5dba (patch)
tree7ee5a4e1214aefcc4826e3c1b5f4bff9f627db5c /embassy-stm32
parent9fdfe5e99bfd28c18af287e6351d556ff5458025 (diff)
Add check for the flipside of the coin too
Diffstat (limited to 'embassy-stm32')
-rw-r--r--embassy-stm32/src/qspi/mod.rs19
1 files changed, 11 insertions, 8 deletions
diff --git a/embassy-stm32/src/qspi/mod.rs b/embassy-stm32/src/qspi/mod.rs
index 40c064d57..10b1cbc70 100644
--- a/embassy-stm32/src/qspi/mod.rs
+++ b/embassy-stm32/src/qspi/mod.rs
@@ -202,16 +202,19 @@ impl<'d, T: Instance, M: PeriMode> Qspi<'d, T, M> {
202 } 202 }
203 203
204 fn setup_transaction(&mut self, fmode: QspiMode, transaction: &TransferConfig, data_len: Option<usize>) { 204 fn setup_transaction(&mut self, fmode: QspiMode, transaction: &TransferConfig, data_len: Option<usize>) {
205 if let (Some(_), QspiWidth::NONE) = (transaction.address, transaction.awidth) { 205 match (transaction.address, transaction.awidth) {
206 panic!("QSPI address can't be sent with an address width of NONE"); 206 (Some(_), QspiWidth::NONE) => panic!("QSPI address can't be sent with an address width of NONE"),
207 (Some(_), _) => {}
208 (None, QspiWidth::NONE) => {}
209 (None, _) => panic!("QSPI address is not set, so the address width should be NONE"),
207 } 210 }
208 211
209 if let (Some(_), QspiWidth::NONE) = (data_len, transaction.dwidth) { 212 match (data_len, transaction.dwidth) {
210 panic!("QSPI data can't be sent with a data width of NONE"); 213 (Some(0), _) => panic!("QSPI data must be at least one byte"),
211 } 214 (Some(_), QspiWidth::NONE) => panic!("QSPI data can't be sent with a data width of NONE"),
212 215 (Some(_), _) => {}
213 if let Some(0) = data_len { 216 (None, QspiWidth::NONE) => {}
214 panic!("QSPI data must be at least one byte"); 217 (None, _) => panic!("QSPI data is empty, so the data width should be NONE"),
215 } 218 }
216 219
217 T::REGS.fcr().modify(|v| { 220 T::REGS.fcr().modify(|v| {