summaryrefslogtreecommitdiff
path: root/ucoo/hal
diff options
context:
space:
mode:
authorNicolas Schodet2015-05-15 12:00:01 +0200
committerNicolas Schodet2019-10-07 00:44:50 +0200
commite43de81bf8c58029521fd8eaeaa9c2b7cd638244 (patch)
treebd44e8bae272d3e07578e6c67124e68f309be6d7 /ucoo/hal
parentab65b898b0ab531a71f1cd7afb0ddfdfb89f340a (diff)
ucoo/hal/spi: sample MISO before toggling clock
MISO is supposed to have been latched on opposed clock edge, but some devices do it on the same clock edge to increase maximum clock frequency.
Diffstat (limited to 'ucoo/hal')
-rw-r--r--ucoo/hal/spi/spi_soft.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/ucoo/hal/spi/spi_soft.cc b/ucoo/hal/spi/spi_soft.cc
index 3bcc0d5..93409a2 100644
--- a/ucoo/hal/spi/spi_soft.cc
+++ b/ucoo/hal/spi/spi_soft.cc
@@ -85,9 +85,9 @@ SpiSoftMaster::send_and_recv (char tx)
mosi_.set (tx & i);
delay_ns (half_period_ns_);
// Sample stage.
- sck_.toggle ();
if (miso_.get ())
rx |= i;
+ sck_.toggle ();
delay_ns (half_period_ns_);
// SCK toggle for next setup stage.
if (!cpha_)