Use FreeRTOS delay instead of spinning the CPU

This commit is contained in:
mark9064 2023-10-27 00:26:57 +01:00 committed by JF
parent 7a9211587a
commit 7e460d3c80

View file

@ -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);
}