Skip to content

Commit

Permalink
Merge branch 'p8b-mirror' into p8b
Browse files Browse the repository at this point in the history
  • Loading branch information
StarGate01 committed Jun 27, 2022
2 parents bc7f1e9 + 9a2db73 commit 949a325
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,7 @@ elseif(TARGET_DEVICE STREQUAL "MOY-UNK") # P8b mirrored
add_definitions(-DCLOCK_CONFIG_LF_CAL_ENABLED=1)
add_definitions(-DDRIVER_TOUCH_REPORT)
add_definitions(-DDRIVER_ACC_SC7A20)
add_definitions(-DDRIVER_DISPLAY_MIRROR)
else()
message(FATAL_ERROR "Invalid TARGET_DEVICE")
endif()
Expand Down
8 changes: 8 additions & 0 deletions src/drivers/St7789.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ void St7789::Init() {
MemoryDataAccessControl();
ColumnAddressSet();
RowAddressSet();
// P8B Mirrored version does not need display inversion.
#ifndef DRIVER_DISPLAY_MIRROR
DisplayInversionOn();
#endif
NormalModeOn();
SetVdv();
DisplayOn();
Expand Down Expand Up @@ -62,7 +65,12 @@ void St7789::ColMod() {

void St7789::MemoryDataAccessControl() {
WriteCommand(static_cast<uint8_t>(Commands::MemoryDataAccessControl));
// P8B Mirrored version sets MX bit high in MADCTL register to flip about vertical axis.
#ifdef DRIVER_DISPLAY_MIRROR
WriteData(0x40); // MY(0) MX(1) MV(0) ML(0) RGB(0) 0 0 0
#else
WriteData(0x00);
#endif
}

void St7789::ColumnAddressSet() {
Expand Down

0 comments on commit 949a325

Please sign in to comment.