diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-06-07 13:45:27 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-06-07 13:45:27 +1000 |
| commit | 7e96482087632278c3d9e4a5db6bad25374ada8f (patch) | |
| tree | 07e16886c951b212bed84f2ab09c4a4543eb0395 /src/drivers/display.cpp | |
| parent | 1f903accd95361735c841c87fdc6494ad3331b40 (diff) | |
| download | tangara-fw-7e96482087632278c3d9e4a5db6bad25374ada8f.tar.gz | |
fix shared peripheral interrupts causing hangs
Diffstat (limited to 'src/drivers/display.cpp')
| -rw-r--r-- | src/drivers/display.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/drivers/display.cpp b/src/drivers/display.cpp index 3c0df978..94f27bb6 100644 --- a/src/drivers/display.cpp +++ b/src/drivers/display.cpp @@ -17,6 +17,7 @@ #include "esp_attr.h" #include "esp_err.h" #include "esp_heap_caps.h" +#include "esp_intr_alloc.h" #include "freertos/portable.h" #include "freertos/portmacro.h" #include "freertos/projdefs.h" @@ -126,7 +127,8 @@ auto Display::Create(GpioExpander* expander, ESP_ERROR_CHECK(ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, 0)); ESP_ERROR_CHECK(ledc_update_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0)); - // ledc_fade_func_install(0); + ledc_fade_func_install(ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_SHARED | + ESP_INTR_FLAG_IRAM); // Next, init the SPI device spi_device_interface_config_t spi_cfg = { @@ -194,9 +196,8 @@ auto Display::SetDisplayOn(bool enabled) -> void { display_on_ = enabled; int new_duty = display_on_ ? brightness_ : 0; - // ledc_set_fade_with_time(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, new_duty, - // 250); ledc_fade_start(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, - // LEDC_FADE_NO_WAIT); + ledc_set_fade_with_time(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, new_duty, 250); + ledc_fade_start(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, LEDC_FADE_NO_WAIT); } void Display::SendInitialisationSequence(const uint8_t* data) { |
