diff options
| author | mark9064 <30447455+mark9064@users.noreply.github.com> | 2023-10-27 00:26:57 +0100 |
|---|---|---|
| committer | JF <JF002@users.noreply.github.com> | 2024-05-01 16:17:59 +0200 |
| commit | 7e460d3c8072cbddf98172be9e94ede8e6613de5 (patch) | |
| tree | f4d38e6c0e821ba72086f3d3e7f5c17a74cbaba1 /src/drivers | |
| parent | 7a9211587aa17b23b9ff5121abc4f4eca63996d8 (diff) | |
Use FreeRTOS delay instead of spinning the CPU
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/St7789.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/drivers/St7789.cpp b/src/drivers/St7789.cpp index d1747c23..82cefc43 100644 --- a/src/drivers/St7789.cpp +++ b/src/drivers/St7789.cpp @@ -1,6 +1,5 @@ #include "drivers/St7789.h" #include <hal/nrf_gpio.h> -#include <libraries/delay/nrf_delay.h> #include <nrfx_log.h> #include "drivers/Spi.h" @@ -55,7 +54,7 @@ void St7789::WriteSpi(const uint8_t* data, size_t size, const std::function<void void St7789::SoftwareReset() { WriteCommand(static_cast<uint8_t>(Commands::SoftwareReset)); - nrf_delay_ms(150); + vTaskDelay(pdMS_TO_TICKS(150)); } void St7789::SleepOut() { @@ -69,7 +68,7 @@ void St7789::SleepIn() { void St7789::ColMod() { WriteCommand(static_cast<uint8_t>(Commands::ColMod)); WriteData(0x55); - nrf_delay_ms(10); + vTaskDelay(pdMS_TO_TICKS(10)); } void St7789::MemoryDataAccessControl() { @@ -106,12 +105,12 @@ void St7789::RowAddressSet() { void St7789::DisplayInversionOn() { WriteCommand(static_cast<uint8_t>(Commands::DisplayInversionOn)); - nrf_delay_ms(10); + vTaskDelay(pdMS_TO_TICKS(10)); } void St7789::NormalModeOn() { WriteCommand(static_cast<uint8_t>(Commands::NormalModeOn)); - nrf_delay_ms(10); + vTaskDelay(pdMS_TO_TICKS(10)); } void St7789::DisplayOn() { @@ -146,7 +145,7 @@ void St7789::SetVdv() { void St7789::DisplayOff() { WriteCommand(static_cast<uint8_t>(Commands::DisplayOff)); - nrf_delay_ms(500); + vTaskDelay(pdMS_TO_TICKS(500)); } void St7789::VerticalScrollStartAddress(uint16_t line) { @@ -166,7 +165,7 @@ void St7789::DrawBuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height, void St7789::HardwareReset() { nrf_gpio_pin_clear(pinReset); - nrf_delay_ms(10); + vTaskDelay(pdMS_TO_TICKS(10)); nrf_gpio_pin_set(pinReset); } |
