From ede4fba9973a09553e54a1423e5d891bdf9981d2 Mon Sep 17 00:00:00 2001 From: lumapu Date: Wed, 17 Apr 2024 21:45:33 +0200 Subject: [PATCH] try to solve issue without success --- src/hm/nrfHal.h | 2 ++ src/hms/cmtHal.h | 2 ++ src/plugins/Display/epdHal.h | 8 ++++---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/hm/nrfHal.h b/src/hm/nrfHal.h index e1f25439..4bd14763 100644 --- a/src/hm/nrfHal.h +++ b/src/hm/nrfHal.h @@ -55,6 +55,7 @@ class nrfHal: public RF24_hal, public SpiPatcherHandle { gpio_set_level(mPinClk, 0); gpio_reset_pin(mPinCs); + request_spi(); spi_device_interface_config_t devcfg = { .command_bits = 0, .address_bits = 0, @@ -72,6 +73,7 @@ class nrfHal: public RF24_hal, public SpiPatcherHandle { .post_cb = nullptr }; ESP_ERROR_CHECK(spi_bus_add_device(mHostDevice, &devcfg, &spi)); + release_spi(); gpio_reset_pin(mPinEn); gpio_set_direction(mPinEn, GPIO_MODE_OUTPUT); diff --git a/src/hms/cmtHal.h b/src/hms/cmtHal.h index a4bec587..676b0b71 100644 --- a/src/hms/cmtHal.h +++ b/src/hms/cmtHal.h @@ -50,6 +50,7 @@ class cmtHal : public SpiPatcherHandle { gpio_set_level(mPinClk, 0); gpio_reset_pin(mPinCs); + request_spi(); spi_device_interface_config_t devcfg_reg = { .command_bits = 1, .address_bits = 7, @@ -67,6 +68,7 @@ class cmtHal : public SpiPatcherHandle { .post_cb = nullptr }; ESP_ERROR_CHECK(spi_bus_add_device(mHostDevice, &devcfg_reg, &spi_reg)); + release_spi(); gpio_reset_pin(mPinFcs); spi_device_interface_config_t devcfg_fifo = { diff --git a/src/plugins/Display/epdHal.h b/src/plugins/Display/epdHal.h index 29948059..1219f107 100644 --- a/src/plugins/Display/epdHal.h +++ b/src/plugins/Display/epdHal.h @@ -51,6 +51,7 @@ class epdHal: public GxEPD2_HalInterface, public SpiPatcherHandle { gpio_set_level(mPinClk, 0); gpio_reset_pin(mPinCs); + request_spi(); spi_device_interface_config_t devcfg = { .command_bits = 0, .address_bits = 0, @@ -68,6 +69,7 @@ class epdHal: public GxEPD2_HalInterface, public SpiPatcherHandle { .post_cb = nullptr }; ESP_ERROR_CHECK(spi_bus_add_device(mHostDevice, &devcfg, &spi)); + release_spi(); if(GPIO_NUM_NC != mPinRst) { gpio_reset_pin(mPinRst); @@ -152,14 +154,12 @@ class epdHal: public GxEPD2_HalInterface, public SpiPatcherHandle { } request_spi(); - - size_t spiLen = static_cast(n + fill_with_zeroes) << 3; spi_transaction_t t = { .flags = SPI_TRANS_CS_KEEP_ACTIVE, .cmd = 0, .addr = 0, - .length = spiLen, - .rxlength = spiLen, + .length = 1u, + .rxlength = 1u, .user = NULL, .tx_buffer = data, .rx_buffer = data