summaryrefslogtreecommitdiff
path: root/drivers/bus/spi.h
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2023-05-15 11:17:27 +0200
committerDamien George <damien@micropython.org>2024-07-12 22:59:31 +1000
commitee1036023ef199636d96e70c6c7ed587ccaab92e (patch)
tree9c795168696d3a3eede51981c59b9a1f9237fcb6 /drivers/bus/spi.h
parent20b00ca501f5e7ff096ae3e31c3e7e7d99963d23 (diff)
extmod/machine_spi: Support firstbit=LSB for machine.SoftSPI.
Being able to send data out in LSB format can be useful, and having support in the low-level driver is much better than requiring Python code to reorder the bits before sending them / after receiving them. In particular if the hardware does not support the LSB format (eg RP2040) then one needs to use the SoftSPI in LSB mode. For this change a default definition of `MICROPY_PY_MACHINE_SPI_MSB/_LSB` was added to `py/mpconfig.h`, making them available to all ports. The identical defines in `esp32/mpconfigport.h` were deleted. Resolves issues #5340, #11404. Signed-off-by: robert-hh <robert@hammelrath.com>
Diffstat (limited to 'drivers/bus/spi.h')
-rw-r--r--drivers/bus/spi.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/bus/spi.h b/drivers/bus/spi.h
index 6d1b9c2f8..df7f790df 100644
--- a/drivers/bus/spi.h
+++ b/drivers/bus/spi.h
@@ -42,6 +42,7 @@ typedef struct _mp_soft_spi_obj_t {
uint32_t delay_half; // microsecond delay for half SCK period
uint8_t polarity;
uint8_t phase;
+ uint8_t firstbit;
mp_hal_pin_obj_t sck;
mp_hal_pin_obj_t mosi;
mp_hal_pin_obj_t miso;