diff --git a/src/drivers/St7789.cpp b/src/drivers/St7789.cpp index b68f9e3025..ddd576bac6 100644 --- a/src/drivers/St7789.cpp +++ b/src/drivers/St7789.cpp @@ -15,6 +15,7 @@ void St7789::Init() { nrf_gpio_pin_set(pinReset); HardwareReset(); SoftwareReset(); + Command2Enable(); SleepOut(); ColMod(); MemoryDataAccessControl(); @@ -26,6 +27,7 @@ void St7789::Init() { #endif NormalModeOn(); SetVdv(); + PowerControl(); DisplayOn(); } @@ -48,6 +50,14 @@ void St7789::SoftwareReset() { nrf_delay_ms(150); } +void St7789::Command2Enable() { + WriteCommand(static_cast(Commands::Command2Enable)); + WriteData(0x5a); + WriteData(0x69); + WriteData(0x02); + WriteData(0x01); +} + void St7789::SleepOut() { WriteCommand(static_cast(Commands::SleepOut)); } @@ -119,7 +129,7 @@ void St7789::FrameRateLow() { WriteData(0x13); WriteData(0x1f); WriteData(0x1f); - nrf_delay_ms(250); + nrf_delay_ms(300); } void St7789::FrameRateNormal() { @@ -127,13 +137,22 @@ void St7789::FrameRateNormal() { WriteData(0x00); WriteData(0x0f); WriteData(0x0f); - nrf_delay_ms(250); + nrf_delay_ms(300); } void St7789::DisplayOn() { WriteCommand(static_cast(Commands::DisplayOn)); } +void St7789::PowerControl() { + WriteCommand(static_cast(Commands::PowerControl1)); + WriteData(0xa4); + WriteData(0x30); + + WriteCommand(static_cast(Commands::PowerControl2)); + WriteData(0xb3); +} + void St7789::SetAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) { WriteCommand(static_cast(Commands::ColumnAddressSet)); WriteData(x0 >> 8); diff --git a/src/drivers/St7789.h b/src/drivers/St7789.h index 605c4d3dba..690ba830ef 100644 --- a/src/drivers/St7789.h +++ b/src/drivers/St7789.h @@ -36,6 +36,7 @@ namespace Pinetime { void HardwareReset(); void SoftwareReset(); + void Command2Enable(); void SleepOut(); void SleepIn(); void ColMod(); @@ -49,6 +50,7 @@ namespace Pinetime { void WriteToRam(); void DisplayOn(); void DisplayOff(); + void PowerControl(); void SetAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); void SetVdv(); @@ -74,6 +76,9 @@ namespace Pinetime { ColMod = 0x3a, FrameRate = 0xb3, VdvSet = 0xc4, + PowerControl1 = 0xd0, + Command2Enable = 0xdf, + PowerControl2 = 0xe8, }; void WriteData(uint8_t data); void ColumnAddressSet();