Skip to content

Commit a01d360

Browse files
committed
Espressif SPI: remove duplicate mutex create
1 parent 4f015ee commit a01d360

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

  • ports/espressif/common-hal/busio

ports/espressif/common-hal/busio/SPI.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
7272
mp_raise_ValueError(MP_ERROR_TEXT("All SPI peripherals are in use"));
7373
}
7474

75-
self->mutex = xSemaphoreCreateMutex();
76-
if (self->mutex == NULL) {
77-
mp_raise_RuntimeError(MP_ERROR_TEXT("Unable to create lock"));
78-
}
79-
8075
esp_err_t result = spi_bus_initialize(self->host_id, &bus_config, SPI_DMA_CH_AUTO);
8176
if (result == ESP_ERR_NO_MEM) {
8277
mp_raise_msg(&mp_type_MemoryError, MP_ERROR_TEXT("ESP-IDF memory allocation failed"));
@@ -166,7 +161,7 @@ bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) {
166161
if (common_hal_busio_spi_deinited(self)) {
167162
return false;
168163
}
169-
return xSemaphoreTake(self->mutex, 1) == pdTRUE;
164+
return xSemaphoreTake(self->mutex, 0) == pdTRUE;
170165
}
171166

172167
bool common_hal_busio_spi_has_lock(busio_spi_obj_t *self) {

0 commit comments

Comments
 (0)