Add support for hardware assisted vertical scrolling.
This commit is contained in:
parent
e737fb0499
commit
f30573a9b0
|
@ -30,7 +30,7 @@ void Gfx::ClearScreen() {
|
||||||
void Gfx::FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint16_t color) {
|
void Gfx::FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint16_t color) {
|
||||||
SetBackgroundColor(color);
|
SetBackgroundColor(color);
|
||||||
|
|
||||||
state.remainingIterations = 240 + 1;
|
state.remainingIterations = h;
|
||||||
state.currentIteration = 0;
|
state.currentIteration = 0;
|
||||||
state.busy = true;
|
state.busy = true;
|
||||||
state.action = Action::FillRectangle;
|
state.action = Action::FillRectangle;
|
||||||
|
@ -183,4 +183,11 @@ void Gfx::WaitTransfertFinished() const {
|
||||||
ulTaskNotifyTake(pdTRUE, 500);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,9 @@ namespace Pinetime {
|
||||||
void DrawString(uint8_t x, uint8_t y, uint16_t color, const char* text, const FONT_INFO *p_font, bool wrap);
|
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 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 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 Sleep();
|
||||||
void Wakeup();
|
void Wakeup();
|
||||||
|
|
|
@ -120,6 +120,23 @@ void St7789::DisplayOff() {
|
||||||
nrf_delay_ms(500);
|
nrf_delay_ms(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void St7789::VerticalScrollDefinition(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines) {
|
||||||
|
WriteCommand(static_cast<uint8_t>(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<uint8_t>(Commands::VerticalScrollStartAddress));
|
||||||
|
WriteData(line >> 8u);
|
||||||
|
WriteData(line & 0x00ffu);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void St7789::Uninit() {
|
void St7789::Uninit() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,10 @@ namespace Pinetime {
|
||||||
void Uninit();
|
void Uninit();
|
||||||
void DrawPixel(uint16_t x, uint16_t y, uint32_t color);
|
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 BeginDrawBuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height);
|
||||||
void NextDrawBuffer(const uint8_t* data, size_t size);
|
void NextDrawBuffer(const uint8_t* data, size_t size);
|
||||||
|
|
||||||
|
@ -48,6 +52,8 @@ namespace Pinetime {
|
||||||
RowAddressSet = 0x2b,
|
RowAddressSet = 0x2b,
|
||||||
WriteToRam = 0x2c,
|
WriteToRam = 0x2c,
|
||||||
MemoryDataAccessControl = 036,
|
MemoryDataAccessControl = 036,
|
||||||
|
VerticalScrollDefinition = 0x33,
|
||||||
|
VerticalScrollStartAddress = 0x37,
|
||||||
ColMod = 0x3a,
|
ColMod = 0x3a,
|
||||||
};
|
};
|
||||||
void WriteData(uint8_t data);
|
void WriteData(uint8_t data);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user