Skip to content

Commit 37fbb64

Browse files
committed
added part from SD fat lib which enables SPI 2 device write access
taken from SdSpiSTM32F1.cpp - Victor's lib, and adapted to support device selection. To be checked with other libs which are using the SPI lib.
1 parent 536cec8 commit 37fbb64

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

STM32F1/libraries/SPI/src/SPI.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,11 @@ void SPIClass::write(uint16 data) {
322322

323323
spi_tx_reg(_currentSetting->spi_d, data); // "2. Write the first data item to be transmitted into the SPI_DR register (this clears the TXE flag)."
324324
while (spi_is_tx_empty(_currentSetting->spi_d) == 0); // "5. Wait until TXE=1 ..."
325-
while (spi_is_busy(_currentSetting->spi_d) != 0); // "... and then wait until BSY=0 before disabling the SPI."
325+
while (spi_is_busy(_currentSetting->spi_d) != 0); // "... and then wait until BSY=0 before disabling the SPI."
326+
// taken from SdSpiSTM32F1.cpp - Victor's lib, and adapted to support device selection
327+
if (spi_is_rx_nonempty(_currentSetting->spi_d)) {
328+
uint8_t b = spi_rx_reg(_currentSetting->spi_d);
329+
}
326330
}
327331

328332
//void SPIClass::write(uint8 byte) {

0 commit comments

Comments
 (0)