diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2024-01-22 12:55:22 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2024-01-25 12:06:02 -0500 |
commit | 5e433fff06148fde3f0046ad7f1121e9af2181d9 (patch) | |
tree | 0ed4e58e0c2c72376247788d5a595db6fa1f3cb0 /src/rp2040 | |
parent | f1982edcd5e68328a824ae9998e63778b08581e7 (diff) | |
download | kutter-5e433fff06148fde3f0046ad7f1121e9af2181d9.tar.gz kutter-5e433fff06148fde3f0046ad7f1121e9af2181d9.tar.xz kutter-5e433fff06148fde3f0046ad7f1121e9af2181d9.zip |
rp2040: Only change SPI settings while peripheral is disabled
Make sure to disable/enable the peripheral to ensure the clock
polarity is properly set prior to a change in CS.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/rp2040')
-rw-r--r-- | src/rp2040/spi.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/rp2040/spi.c b/src/rp2040/spi.c index e6aafa00..758d5730 100644 --- a/src/rp2040/spi.c +++ b/src/rp2040/spi.c @@ -89,8 +89,12 @@ void spi_prepare(struct spi_config config) { spi_hw_t *spi = config.spi; + if (spi->cr0 == config.cr0 && spi->cpsr == config.cpsr) + return; + spi->cr1 = 0; spi->cr0 = config.cr0; spi->cpsr = config.cpsr; + spi->cr1 = SPI_SSPCR1_SSE_BITS; } void |