We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fbd0e8f commit c854a4bCopy full SHA for c854a4b
src/spi.rs
@@ -221,8 +221,19 @@ mod embedded_hal_impl {
221
transfers.push(SpidevTransfer::read_write(tx, buf));
222
}
223
SpiOperation::DelayNs(ns) => {
224
- let ns = (*ns).try_into().unwrap_or(u16::MAX);
225
- transfers.push(SpidevTransfer::delay(ns));
+ let us = {
+ if *ns == 0 {
226
+ 0
227
+ } else {
228
+ let us = *ns / 1000;
229
+ if us == 0 {
230
+ 1
231
232
+ (us).try_into().unwrap_or(u16::MAX)
233
+ }
234
235
+ };
236
+ transfers.push(SpidevTransfer::delay(us));
237
238
239
0 commit comments