Skip to content

Commit

Permalink
aod: lower voltage going to the display
Browse files Browse the repository at this point in the history
  • Loading branch information
KaffeinatedKat committed Oct 17, 2023
1 parent b2c61d8 commit 97a181d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/drivers/St7789.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ void St7789::Init() {
nrf_gpio_pin_set(pinReset);
HardwareReset();
SoftwareReset();
Command2Enable();
SleepOut();
ColMod();
MemoryDataAccessControl();
Expand All @@ -26,6 +27,7 @@ void St7789::Init() {
#endif
NormalModeOn();
SetVdv();
PowerControl();
DisplayOn();
}

Expand All @@ -48,6 +50,14 @@ void St7789::SoftwareReset() {
nrf_delay_ms(150);
}

void St7789::Command2Enable() {
WriteCommand(static_cast<uint8_t>(Commands::Command2Enable));
WriteData(0x5a);
WriteData(0x69);
WriteData(0x02);
WriteData(0x01);
}

void St7789::SleepOut() {
WriteCommand(static_cast<uint8_t>(Commands::SleepOut));
}
Expand Down Expand Up @@ -119,21 +129,30 @@ void St7789::FrameRateLow() {
WriteData(0x13);
WriteData(0x1f);
WriteData(0x1f);
nrf_delay_ms(250);
nrf_delay_ms(300);
}

void St7789::FrameRateNormal() {
WriteCommand(static_cast<uint8_t>(Commands::FrameRate));
WriteData(0x00);
WriteData(0x0f);
WriteData(0x0f);
nrf_delay_ms(250);
nrf_delay_ms(300);
}

void St7789::DisplayOn() {
WriteCommand(static_cast<uint8_t>(Commands::DisplayOn));
}

void St7789::PowerControl() {
WriteCommand(static_cast<uint8_t>(Commands::PowerControl1));
WriteData(0xa4);
WriteData(0x30);

WriteCommand(static_cast<uint8_t>(Commands::PowerControl2));
WriteData(0xb3);
}

void St7789::SetAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) {
WriteCommand(static_cast<uint8_t>(Commands::ColumnAddressSet));
WriteData(x0 >> 8);
Expand Down
5 changes: 5 additions & 0 deletions src/drivers/St7789.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace Pinetime {

void HardwareReset();
void SoftwareReset();
void Command2Enable();
void SleepOut();
void SleepIn();
void ColMod();
Expand All @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 97a181d

Please sign in to comment.