Unverified Commit c64a4a58 authored by Earle F. Philhower, III's avatar Earle F. Philhower, III Committed by GitHub

Fix initial SPI startup (#1970)

Clocks were not being set at all after #1934.  Ensure they are by initting
to an impossible 0hz clock on creation and ::end

Fixes #1969
parent 02c272b0
...@@ -37,7 +37,7 @@ SPIClassRP2040::SPIClassRP2040(spi_inst_t *spi, pin_size_t rx, pin_size_t cs, pi ...@@ -37,7 +37,7 @@ SPIClassRP2040::SPIClassRP2040(spi_inst_t *spi, pin_size_t rx, pin_size_t cs, pi
_spi = spi; _spi = spi;
_running = false; _running = false;
_initted = false; _initted = false;
_spis = SPISettings(); _spis = SPISettings(0, LSBFIRST, SPI_MODE0); // Ensure spi_init called by setting current freq to 0
_RX = rx; _RX = rx;
_TX = tx; _TX = tx;
_SCK = sck; _SCK = sck;
...@@ -341,6 +341,7 @@ void SPIClassRP2040::end() { ...@@ -341,6 +341,7 @@ void SPIClassRP2040::end() {
} }
gpio_set_function(_SCK, GPIO_FUNC_SIO); gpio_set_function(_SCK, GPIO_FUNC_SIO);
gpio_set_function(_TX, GPIO_FUNC_SIO); gpio_set_function(_TX, GPIO_FUNC_SIO);
_spis = SPISettings(0, LSBFIRST, SPI_MODE0);
} }
void SPIClassRP2040::setBitOrder(BitOrder order) { void SPIClassRP2040::setBitOrder(BitOrder order) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment