diff options
author | Jonathan Hogg <me@jonathanhogg.com> | 2021-08-15 17:13:16 +0100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2021-08-16 15:21:10 +1000 |
commit | 5b655665ab068c4ee7de7891ae2d3cb7ed630512 (patch) | |
tree | 696bac335e1ea2a58c8e6dccc9a6a33a06049846 | |
parent | a1dc7277d950ddc493ee81a6c3ef736446b70352 (diff) |
esp32/machine_hw_spi: Release GIL during transfers.
Release the GIL while waiting for SPI transfers to complete to allow other
threads to make progress.
Fixes #7662.
-rw-r--r-- | ports/esp32/machine_hw_spi.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ports/esp32/machine_hw_spi.c b/ports/esp32/machine_hw_spi.c index 76b1896bb..ca530ba94 100644 --- a/ports/esp32/machine_hw_spi.c +++ b/ports/esp32/machine_hw_spi.c @@ -346,7 +346,9 @@ STATIC void machine_hw_spi_transfer(mp_obj_base_t *self_in, size_t len, const ui if (offset > 0) { // wait for previously queued transaction + MP_THREAD_GIL_EXIT(); spi_device_get_trans_result(self->spi, &result, portMAX_DELAY); + MP_THREAD_GIL_ENTER(); } // doesn't need ceil(); loop ends when bits_remaining is 0 @@ -354,7 +356,9 @@ STATIC void machine_hw_spi_transfer(mp_obj_base_t *self_in, size_t len, const ui } // wait for last transaction + MP_THREAD_GIL_EXIT(); spi_device_get_trans_result(self->spi, &result, portMAX_DELAY); + MP_THREAD_GIL_ENTER(); spi_device_release_bus(self->spi); } } |