Comments, formating and better name for Errortype
@@ -187,7 +187,7 @@ impl<T> Spim<T> where T: SpimExt {
// Check If buffer is in data RAM, compiler sometimes put static data
// in flash this area is not accessable by EasyDMA
if (tx_data_ptr as usize) < SRAM_LOWER || tx_data_ptr as usize >= SRAM_UPPER {
- return Err(Error::DMABufferInUnaccessableMemory)
+ return Err(Error::DMABufferNotInDataMemory)
}
// Conservative compiler fence to prevent optimizations that do not
// take in to account actions by DMA. The fence has been placed here,
@@ -316,6 +316,7 @@ impl<T> Spim<T> where T: SpimExt {
// rx_len:
rx_buffer.len() as _,
+ // chip select callback
|cs|{if cs {chip_select.set_low()} else {chip_select.set_high()} }
)
}
@@ -353,11 +354,9 @@ impl<T> Spim<T> where T: SpimExt {
// The MAXCNT field is 8 bits wide and accepts the full range of
// values.
tx_buffer.len() as _,
-
// Tell the RXD channel it doesn't need to read anything
0 , 0,
|cs|{if cs {chip_select.set_low()} else {chip_select.set_high()} }
-
)
}
@@ -386,7 +385,8 @@ pub struct Pins {
pub enum Error {
TxBufferTooLong,
RxBufferTooLong,
- DMABufferInUnaccessableMemory,
+ /// EasyDMA can only read from data memory, read only buffers in flash will fail
+ DMABufferNotInDataMemory,
Transmit,
Receive,
}
