From 8b0559c4812d74b6307757135622975523c5a88d Mon Sep 17 00:00:00 2001 From: Christoph Honal Date: Tue, 10 May 2022 21:46:36 +0200 Subject: Add basic hardware configuration options for P8 This enables the configuration of the LFCLK source, as well as the target hardware board pin configuration. --- src/drivers/PinMap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/drivers') diff --git a/src/drivers/PinMap.h b/src/drivers/PinMap.h index 833c6477..a70cfc41 100644 --- a/src/drivers/PinMap.h +++ b/src/drivers/PinMap.h @@ -4,8 +4,8 @@ namespace Pinetime { namespace PinMap { -#ifdef WATCH_P8 - // COLMI P8 +#if defined(DRIVER_PINMAP_P8) + // COLMI P8 and variants static constexpr uint8_t Charging = 19; static constexpr uint8_t Cst816sReset = 13; static constexpr uint8_t Button = 17; -- cgit v1.2.3-70-g09d2 From d6aa767bdac84ac7ed8469288ae3400b5c0b5698 Mon Sep 17 00:00:00 2001 From: izzeho Date: Sat, 25 Jun 2022 08:32:23 +1000 Subject: Add P8B mirrored version definition. --- src/CMakeLists.txt | 1 + src/drivers/St7789.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+) (limited to 'src/drivers') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e6971a56..cfab2f54 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -810,6 +810,7 @@ elseif(TARGET_DEVICE STREQUAL "MOY-UNK") # P8b mirrored add_definitions(-DCLOCK_CONFIG_LF_SRC=0) # RC add_definitions(-DMYNEWT_VAL_BLE_LL_SCA=500) add_definitions(-DCLOCK_CONFIG_LF_CAL_ENABLED=1) + add_definitions(-DDRIVER_DISPLAY_MIRROR) else() message(FATAL_ERROR "Invalid TARGET_DEVICE") endif() diff --git a/src/drivers/St7789.cpp b/src/drivers/St7789.cpp index 3ed1beb4..cfd5bd2c 100644 --- a/src/drivers/St7789.cpp +++ b/src/drivers/St7789.cpp @@ -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(); @@ -62,7 +65,18 @@ void St7789::ColMod() { void St7789::MemoryDataAccessControl() { WriteCommand(static_cast(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); +#endif } void St7789::ColumnAddressSet() { -- cgit v1.2.3-70-g09d2