mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-25 08:12:30 +00:00
Add check for the flipside of the coin too
This commit is contained in:
parent
9fdfe5e99b
commit
a3bbb3b43a
@ -202,16 +202,19 @@ impl<'d, T: Instance, M: PeriMode> Qspi<'d, T, M> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn setup_transaction(&mut self, fmode: QspiMode, transaction: &TransferConfig, data_len: Option<usize>) {
|
fn setup_transaction(&mut self, fmode: QspiMode, transaction: &TransferConfig, data_len: Option<usize>) {
|
||||||
if let (Some(_), QspiWidth::NONE) = (transaction.address, transaction.awidth) {
|
match (transaction.address, transaction.awidth) {
|
||||||
panic!("QSPI address can't be sent with an address width of NONE");
|
(Some(_), QspiWidth::NONE) => panic!("QSPI address can't be sent with an address width of NONE"),
|
||||||
|
(Some(_), _) => {}
|
||||||
|
(None, QspiWidth::NONE) => {}
|
||||||
|
(None, _) => panic!("QSPI address is not set, so the address width should be NONE"),
|
||||||
}
|
}
|
||||||
|
|
||||||
if let (Some(_), QspiWidth::NONE) = (data_len, transaction.dwidth) {
|
match (data_len, transaction.dwidth) {
|
||||||
panic!("QSPI data can't be sent with a data width of NONE");
|
(Some(0), _) => panic!("QSPI data must be at least one byte"),
|
||||||
}
|
(Some(_), QspiWidth::NONE) => panic!("QSPI data can't be sent with a data width of NONE"),
|
||||||
|
(Some(_), _) => {}
|
||||||
if let Some(0) = data_len {
|
(None, QspiWidth::NONE) => {}
|
||||||
panic!("QSPI data must be at least one byte");
|
(None, _) => panic!("QSPI data is empty, so the data width should be NONE"),
|
||||||
}
|
}
|
||||||
|
|
||||||
T::REGS.fcr().modify(|v| {
|
T::REGS.fcr().modify(|v| {
|
||||||
|
Loading…
Reference in New Issue
Block a user