Add P8B mirrored version definition.

This commit is contained in:
izzeho 2022-06-25 08:32:23 +10:00 committed by JF
parent eb487c71be
commit d6aa767bda
2 changed files with 15 additions and 0 deletions

View File

@ -810,6 +810,7 @@ elseif(TARGET_DEVICE STREQUAL "MOY-UNK") # P8b mirrored
add_definitions(-DCLOCK_CONFIG_LF_SRC=0) # RC add_definitions(-DCLOCK_CONFIG_LF_SRC=0) # RC
add_definitions(-DMYNEWT_VAL_BLE_LL_SCA=500) add_definitions(-DMYNEWT_VAL_BLE_LL_SCA=500)
add_definitions(-DCLOCK_CONFIG_LF_CAL_ENABLED=1) add_definitions(-DCLOCK_CONFIG_LF_CAL_ENABLED=1)
add_definitions(-DDRIVER_DISPLAY_MIRROR)
else() else()
message(FATAL_ERROR "Invalid TARGET_DEVICE") message(FATAL_ERROR "Invalid TARGET_DEVICE")
endif() endif()

View File

@ -21,7 +21,10 @@ void St7789::Init() {
MemoryDataAccessControl(); MemoryDataAccessControl();
ColumnAddressSet(); ColumnAddressSet();
RowAddressSet(); RowAddressSet();
// P8B Mirrored version does not need display inversion.
#ifndef DRIVER_DISPLAY_MIRROR
DisplayInversionOn(); DisplayInversionOn();
#endif
NormalModeOn(); NormalModeOn();
SetVdv(); SetVdv();
DisplayOn(); DisplayOn();
@ -62,7 +65,18 @@ void St7789::ColMod() {
void St7789::MemoryDataAccessControl() { void St7789::MemoryDataAccessControl() {
WriteCommand(static_cast<uint8_t>(Commands::MemoryDataAccessControl)); WriteCommand(static_cast<uint8_t>(Commands::MemoryDataAccessControl));
#ifdef DRIVER_DISPLAY_MIRROR
// [7] = MY = Page Address Order, 0 = Top to bottom, 1 = Bottom to top
// [6] = MX = Column Address Order, 0 = Left to right, 1 = Right to left
// [5] = MV = Page/Column Order, 0 = Normal mode, 1 = Reverse mode
// [4] = ML = Line Address Order, 0 = LCD refresh from top to bottom, 1 = Bottom to top
// [3] = RGB = RGB/BGR Order, 0 = RGB, 1 = BGR
// [2] = MH = Display Data Latch Order, 0 = LCD refresh from left to right, 1 = Right to left
// [0 .. 1] = Unused
WriteData(0b01000000);
#else
WriteData(0x00); WriteData(0x00);
#endif
} }
void St7789::ColumnAddressSet() { void St7789::ColumnAddressSet() {