8000 Fix initial SPI startup (#1970) · BritvaBo/arduino-pico@c64a4a5 · GitHub
[go: up one dir, main page]

Skip to content

Commit c64a4a5

Browse files
Fix initial SPI startup (earlephilhower#1970)
Clocks were not being set at all after earlephilhower#1934. Ensure they are by initting to an impossible 0hz clock on creation and ::end Fixes earlephilhower#1969
1 parent 02c272b commit c64a4a5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libraries/SPI/src/SPI.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ SPIClassRP2040::SPIClassRP2040(spi_inst_t *spi, pin_size_t rx, pin_size_t cs, pi
3737
_spi = spi;
3838
_running = false;
3939
_initted = false;
40-
_spis = SPISettings();
40+
_spis = SPISettings(0, LSBFIRST, SPI_MODE0); // Ensure spi_init called by setting current freq to 0
4141
_RX = rx;
4242
_TX = tx;
4343
_SCK = sck;
@@ -341,6 +341,7 @@ void SPIClassRP2040::end() {
341341
}
342342
gpio_set_function(_SCK, GPIO_FUNC_SIO);
343343
gpio_set_function(_TX, GPIO_FUNC_SIO);
344+
_spis = SPISettings(0, LSBFIRST, SPI_MODE0);
344345
}
345346

346347
void SPIClassRP2040::setBitOrder(BitOrder order) {

0 commit comments

Comments
 (0)
0