kopia lustrzana https://github.com/micropython/micropython
stm32/qspi.c: Allow qspi_write_cmd_data to write cmd with 1 data byte.
The existing qspi for stm32 implementation can only send a spi command with exactly 0 or 2 data bytes. Certain spiflash chips (e.g. AT25SF321B) have commands that only take a single data byte, and will ignore the command if more than that is sent. This allows sending a command with a single data byte. Would be nicer to have a general function to send `n` bytes, but there probably aren't many commands that require this. Signed-off-by: Victor Rajewski <victor@allumeenergy.com.au>pull/11932/head
rodzic
813d559bc0
commit
62760e0dad
|
@ -232,8 +232,12 @@ STATIC int qspi_write_cmd_data(void *self_in, uint8_t cmd, size_t len, uint32_t
|
|||
while (!(QUADSPI->SR & QUADSPI_SR_FTF)) {
|
||||
}
|
||||
|
||||
// This assumes len==2
|
||||
*(uint16_t *)&QUADSPI->DR = data;
|
||||
if (len == 1) {
|
||||
*(uint8_t *)&QUADSPI->DR = data;
|
||||
} else {
|
||||
// This assumes len==2
|
||||
*(uint16_t *)&QUADSPI->DR = data;
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for write to finish
|
||||
|
|
Ładowanie…
Reference in New Issue