8000 mods/machspi.c: Fix the bug in pybspi_transfer() (#9) · pycom/pycom-micropython-sigfox@38428ff · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 38428ff

Browse files
husigezaIslam Wahdan
authored and
Islam Wahdan
committed
mods/machspi.c: Fix the bug in pybspi_transfer() (#9)
The parameter write=.. in spi.read() was ignored. Instead always 0x55 was sent.
1 parent 4a859e2 commit 38428ff

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

esp32/mods/machspi.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ STATIC void pybspi_transfer (mach_spi_obj_t *self, const char *txdata, char *rxd
198198
if (txdata) {
199199
memcpy(&_txdata, &txdata[i], self->wlen);
200200
} else {
201-
_txdata = 0x55555555;
201+
if (txchar) {
202+
_txdata = *txchar;
203+
} else {
204+
_txdata = 0x55555555;
205+
}
202206
}
203207
spi_data_t spidata = {.cmd = 0, .cmdLen = 0, .addr = NULL, .addrLen = 0,
204208
.txData = &_txdata, .txDataLen = self->wlen,

0 commit comments

Comments
 (0)
0