File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -804,6 +804,7 @@ elseif(TARGET_DEVICE STREQUAL "MOY-UNK") # P8b mirrored
804804 add_definitions (-DCLOCK_CONFIG_LF_SRC=0) # RC
805805 add_definitions (-DMYNEWT_VAL_BLE_LL_SCA=500)
806806 add_definitions (-DCLOCK_CONFIG_LF_CAL_ENABLED=1)
807+ add_definitions (-DDRIVER_DISPLAY_MIRROR)
807808else ()
808809 message (FATAL_ERROR "Invalid TARGET_DEVICE" )
809810endif ()
Original file line number Diff line number Diff line change @@ -21,7 +21,10 @@ void St7789::Init() {
2121 MemoryDataAccessControl ();
2222 ColumnAddressSet ();
2323 RowAddressSet ();
24+ // P8B Mirrored version does not need display inversion.
25+ #ifndef DRIVER_DISPLAY_MIRROR
2426 DisplayInversionOn ();
27+ #endif
2528 NormalModeOn ();
2629 SetVdv ();
2730 DisplayOn ();
@@ -62,7 +65,19 @@ void St7789::ColMod() {
6265
6366void St7789::MemoryDataAccessControl () {
6467 WriteCommand (static_cast <uint8_t >(Commands::MemoryDataAccessControl));
68+ // P8B Mirrored version sets MX bit high in MADCTL register to flip about vertical axis.
69+ #ifdef DRIVER_DISPLAY_MIRROR
70+ // [0 .. 1] = Unused
71+ // [2] = MH = Display Data Latch Order, 0 = LCD refresh from left to right, 1 = Right to left
72+ // [3] = RGB = RGB/BGR Order, 0 = RGB, 1 = BGR
73+ // [4] = ML = Line Address Order, 0 = LCD refresh from top to bottom, 1 = Bottom to top
74+ // [5] = MV = Page/Column Order, 0 = Normal mode, 1 = Reverse mode
75+ // [6] = MX = Column Address Order, 0 = Left to right, 1 = Right to left
76+ // [7] = MY = Page Address Order, 0 = Top to bottom, 1 = Bottom to top
77+ WriteData (0b01000000 );
78+ #else
6579 WriteData (0x00 );
80+ #endif
6681}
6782
6883void St7789::ColumnAddressSet () {
You can’t perform that action at this time.
0 commit comments