diff options
author | robert-hh <robert@hammelrath.com> | 2023-05-15 11:17:27 +0200 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-07-12 22:59:31 +1000 |
commit | ee1036023ef199636d96e70c6c7ed587ccaab92e (patch) | |
tree | 9c795168696d3a3eede51981c59b9a1f9237fcb6 /py | |
parent | 20b00ca501f5e7ff096ae3e31c3e7e7d99963d23 (diff) | |
download | micropython-ee1036023ef199636d96e70c6c7ed587ccaab92e.tar.gz micropython-ee1036023ef199636d96e70c6c7ed587ccaab92e.zip |
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 'py')
-rw-r--r-- | py/mpconfig.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h index 346d0c21e1..98893ceb6d 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1784,6 +1784,12 @@ typedef double mp_float_t; #define MICROPY_PY_MACHINE_SOFTSPI (0) #endif +// Values of SPI.MSB and SPI.LSB constants +#ifndef MICROPY_PY_MACHINE_SPI_MSB +#define MICROPY_PY_MACHINE_SPI_MSB (0) +#define MICROPY_PY_MACHINE_SPI_LSB (1) +#endif + // Whether to provide the "machine.Timer" class #ifndef MICROPY_PY_MACHINE_TIMER #define MICROPY_PY_MACHINE_TIMER (0) |