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>
This commit is contained in:
parent
f1982edcd5
commit
5e433fff06
|
@ -89,8 +89,12 @@ void
|
||||||
spi_prepare(struct spi_config config)
|
spi_prepare(struct spi_config config)
|
||||||
{
|
{
|
||||||
spi_hw_t *spi = config.spi;
|
spi_hw_t *spi = config.spi;
|
||||||
|
if (spi->cr0 == config.cr0 && spi->cpsr == config.cpsr)
|
||||||
|
return;
|
||||||
|
spi->cr1 = 0;
|
||||||
spi->cr0 = config.cr0;
|
spi->cr0 = config.cr0;
|
||||||
spi->cpsr = config.cpsr;
|
spi->cpsr = config.cpsr;
|
||||||
|
spi->cr1 = SPI_SSPCR1_SSE_BITS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue