Merge remote-tracking branch 'origin/main'

This commit is contained in:
Hosted Weblate 2022-11-19 20:32:09 +01:00
commit b601e4c466
No known key found for this signature in database
GPG Key ID: A3FAAA06E6569B4C

View File

@ -151,6 +151,15 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
spi_set_format(self->peripheral, bits, polarity, phase, SPI_MSB_FIRST);
// Workaround to start with clock line high if polarity=1. The hw SPI peripheral does not do this
// automatically. See https://github.com/raspberrypi/pico-sdk/issues/868 and
// https://forums.raspberrypi.com/viewtopic.php?t=336142
// TODO: scheduled to be be fixed in pico-sdk 1.5.0.
if (polarity) {
hw_clear_bits(&spi_get_hw(self->peripheral)->cr1, SPI_SSPCR1_SSE_BITS); // disable the SPI
hw_set_bits(&spi_get_hw(self->peripheral)->cr1, SPI_SSPCR1_SSE_BITS); // re-enable the SPI
}
self->polarity = polarity;
self->phase = phase;
self->bits = bits;