diff --git a/src/Components/Gfx/Gfx.cpp b/src/Components/Gfx/Gfx.cpp index 0dcb98a6..bcab9617 100644 --- a/src/Components/Gfx/Gfx.cpp +++ b/src/Components/Gfx/Gfx.cpp @@ -183,4 +183,12 @@ void Gfx::WaitTransfertFinished() const { ulTaskNotifyTake(pdTRUE, 500); } +void Gfx::SetScrollArea(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines) { + lcd.VerticalScrollDefinition(topFixedLines, scrollLines, bottomFixedLines); +} + +void Gfx::SetScrollStartLine(uint16_t line) { + lcd.VerticalScrollStartAddress(line); +} + diff --git a/src/Components/Gfx/Gfx.h b/src/Components/Gfx/Gfx.h index f31b13c0..9d825ab1 100644 --- a/src/Components/Gfx/Gfx.h +++ b/src/Components/Gfx/Gfx.h @@ -19,6 +19,8 @@ namespace Pinetime { void DrawString(uint8_t x, uint8_t y, uint16_t color, const char* text, const FONT_INFO *p_font, bool wrap); void DrawChar(const FONT_INFO *font, uint8_t c, uint8_t *x, uint8_t y, uint16_t color); void FillRectangle(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint16_t color); + void SetScrollArea(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines); + void SetScrollStartLine(uint16_t line); void Sleep(); void Wakeup(); diff --git a/src/DisplayApp/DisplayApp.cpp b/src/DisplayApp/DisplayApp.cpp index ca139423..f12b5948 100644 --- a/src/DisplayApp/DisplayApp.cpp +++ b/src/DisplayApp/DisplayApp.cpp @@ -68,7 +68,7 @@ void DisplayApp::Refresh() { break; case States::Running: RunningState(); - queueTimeout = 1000; + queueTimeout = 1; break; } diff --git a/src/DisplayApp/Screens/Clock.cpp b/src/DisplayApp/Screens/Clock.cpp index 155cb581..ae6904aa 100644 --- a/src/DisplayApp/Screens/Clock.cpp +++ b/src/DisplayApp/Screens/Clock.cpp @@ -5,7 +5,7 @@ #include "Clock.h" using namespace Pinetime::Applications::Screens; - +uint16_t line = 0; void Clock::Refresh(bool fullRefresh) { if(fullRefresh) { gfx.FillRectangle(0,0,240,240,0x0000); @@ -14,8 +14,14 @@ void Clock::Refresh(bool fullRefresh) { currentChar[2] = 3; currentChar[3] = 4; auto dummy = currentDateTime.Get(); + + gfx.SetScrollArea(74, 78, 320-(78+74)); + line = 74; } + gfx.SetScrollStartLine(line); + line++; + if(line == 78+74) line = 74; if (fullRefresh || batteryPercentRemaining.IsUpdated()) { char batteryChar[11]; auto newBatteryValue = batteryPercentRemaining.Get(); diff --git a/src/drivers/St7789.cpp b/src/drivers/St7789.cpp index 39595dc9..9125e453 100644 --- a/src/drivers/St7789.cpp +++ b/src/drivers/St7789.cpp @@ -120,6 +120,22 @@ void St7789::DisplayOff() { nrf_delay_ms(500); } +void St7789::VerticalScrollDefinition(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines) { + WriteCommand(static_cast(Commands::VerticalScrollDefinition)); + WriteData(topFixedLines >> 8u); + WriteData(topFixedLines & 0x00ffu); + WriteData(scrollLines >> 8u); + WriteData(scrollLines & 0x00ffu); + WriteData(bottomFixedLines >> 8u); + WriteData(bottomFixedLines & 0x00ffu); +} + +void St7789::VerticalScrollStartAddress(uint16_t line) { + WriteCommand(static_cast(Commands::VerticalScrollStartAddress)); + WriteData(line >> 8u); + WriteData(line & 0x00ffu); +} + void St7789::Uninit() { } diff --git a/src/drivers/St7789.h b/src/drivers/St7789.h index 9ecf9f27..86c8111e 100644 --- a/src/drivers/St7789.h +++ b/src/drivers/St7789.h @@ -11,6 +11,10 @@ namespace Pinetime { void Uninit(); void DrawPixel(uint16_t x, uint16_t y, uint32_t color); + void VerticalScrollDefinition(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines); + void VerticalScrollStartAddress(uint16_t line); + + void BeginDrawBuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height); void NextDrawBuffer(const uint8_t* data, size_t size); @@ -47,7 +51,9 @@ namespace Pinetime { ColumnAddressSet = 0x2a, RowAddressSet = 0x2b, WriteToRam = 0x2c, - MemoryDataAccessControl = 036, + MemoryDataAccessControl = 0x36, + VerticalScrollDefinition = 0x33, + VerticalScrollStartAddress = 0x37, ColMod = 0x3a, }; void WriteData(uint8_t data);