Use FreeRTOS delay instead of spinning the CPU
This commit is contained in:
parent
7a9211587a
commit
7e460d3c80
|
@ -1,6 +1,5 @@
|
||||||
#include "drivers/St7789.h"
|
#include "drivers/St7789.h"
|
||||||
#include <hal/nrf_gpio.h>
|
#include <hal/nrf_gpio.h>
|
||||||
#include <libraries/delay/nrf_delay.h>
|
|
||||||
#include <nrfx_log.h>
|
#include <nrfx_log.h>
|
||||||
#include "drivers/Spi.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() {
|
void St7789::SoftwareReset() {
|
||||||
WriteCommand(static_cast<uint8_t>(Commands::SoftwareReset));
|
WriteCommand(static_cast<uint8_t>(Commands::SoftwareReset));
|
||||||
nrf_delay_ms(150);
|
vTaskDelay(pdMS_TO_TICKS(150));
|
||||||
}
|
}
|
||||||
|
|
||||||
void St7789::SleepOut() {
|
void St7789::SleepOut() {
|
||||||
|
@ -69,7 +68,7 @@ void St7789::SleepIn() {
|
||||||
void St7789::ColMod() {
|
void St7789::ColMod() {
|
||||||
WriteCommand(static_cast<uint8_t>(Commands::ColMod));
|
WriteCommand(static_cast<uint8_t>(Commands::ColMod));
|
||||||
WriteData(0x55);
|
WriteData(0x55);
|
||||||
nrf_delay_ms(10);
|
vTaskDelay(pdMS_TO_TICKS(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
void St7789::MemoryDataAccessControl() {
|
void St7789::MemoryDataAccessControl() {
|
||||||
|
@ -106,12 +105,12 @@ void St7789::RowAddressSet() {
|
||||||
|
|
||||||
void St7789::DisplayInversionOn() {
|
void St7789::DisplayInversionOn() {
|
||||||
WriteCommand(static_cast<uint8_t>(Commands::DisplayInversionOn));
|
WriteCommand(static_cast<uint8_t>(Commands::DisplayInversionOn));
|
||||||
nrf_delay_ms(10);
|
vTaskDelay(pdMS_TO_TICKS(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
void St7789::NormalModeOn() {
|
void St7789::NormalModeOn() {
|
||||||
WriteCommand(static_cast<uint8_t>(Commands::NormalModeOn));
|
WriteCommand(static_cast<uint8_t>(Commands::NormalModeOn));
|
||||||
nrf_delay_ms(10);
|
vTaskDelay(pdMS_TO_TICKS(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
void St7789::DisplayOn() {
|
void St7789::DisplayOn() {
|
||||||
|
@ -146,7 +145,7 @@ void St7789::SetVdv() {
|
||||||
|
|
||||||
void St7789::DisplayOff() {
|
void St7789::DisplayOff() {
|
||||||
WriteCommand(static_cast<uint8_t>(Commands::DisplayOff));
|
WriteCommand(static_cast<uint8_t>(Commands::DisplayOff));
|
||||||
nrf_delay_ms(500);
|
vTaskDelay(pdMS_TO_TICKS(500));
|
||||||
}
|
}
|
||||||
|
|
||||||
void St7789::VerticalScrollStartAddress(uint16_t line) {
|
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() {
|
void St7789::HardwareReset() {
|
||||||
nrf_gpio_pin_clear(pinReset);
|
nrf_gpio_pin_clear(pinReset);
|
||||||
nrf_delay_ms(10);
|
vTaskDelay(pdMS_TO_TICKS(10));
|
||||||
nrf_gpio_pin_set(pinReset);
|
nrf_gpio_pin_set(pinReset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue