summaryrefslogtreecommitdiff
path: root/src/displayapp/LittleVgl.cpp
diff options
context:
space:
mode:
authorJF002 <JF002@users.noreply.github.com>2021-04-09 20:43:39 +0200
committerGitHub <noreply@github.com>2021-04-09 20:43:39 +0200
commit17a37acaa81278cc8c782d84d994d4ca938ef006 (patch)
tree3c15890315a420417cd96b82103da80c84ed562d /src/displayapp/LittleVgl.cpp
parent04fc33e2d479161ec261f932b908dffbd73e227f (diff)
parent3685095da0d01f137692f80df2c267a8b90da715 (diff)
Merge pull request #258 from joaquimorg/BigRewrite
New settings menu and more...
Diffstat (limited to 'src/displayapp/LittleVgl.cpp')
-rw-r--r--src/displayapp/LittleVgl.cpp36
1 files changed, 29 insertions, 7 deletions
diff --git a/src/displayapp/LittleVgl.cpp b/src/displayapp/LittleVgl.cpp
index 238164a8..500fd752 100644
--- a/src/displayapp/LittleVgl.cpp
+++ b/src/displayapp/LittleVgl.cpp
@@ -61,18 +61,27 @@ void LittleVgl::InitTouchpad() {
void LittleVgl::SetFullRefresh(FullRefreshDirections direction) {
if(scrollDirection == FullRefreshDirections::None) {
scrollDirection = direction;
- if (scrollDirection == FullRefreshDirections::Down)
+ if (scrollDirection == FullRefreshDirections::Down) {
lv_disp_set_direction(lv_disp_get_default(), 1);
+ } else if (scrollDirection == FullRefreshDirections::Right) {
+ lv_disp_set_direction(lv_disp_get_default(), 2);
+ } else if (scrollDirection == FullRefreshDirections::Left) {
+ lv_disp_set_direction(lv_disp_get_default(), 3);
+ } else if (scrollDirection == FullRefreshDirections::RightAnim) {
+ lv_disp_set_direction(lv_disp_get_default(), 5);
+ } else if (scrollDirection == FullRefreshDirections::LeftAnim) {
+ lv_disp_set_direction(lv_disp_get_default(), 4);
+ }
}
}
void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) {
uint16_t y1, y2, width, height = 0;
- ulTaskNotifyTake(pdTRUE, 500);
- // Notification is still needed (even if there is a mutex on SPI) because of the DataCommand pin
- // which cannot be set/clear during a transfer.
-
+ ulTaskNotifyTake(pdTRUE, 200);
+ // NOtification is still needed (even if there is a mutex on SPI) because of the DataCommand pin
+ // which cannot be set/clear during a transfert.
+
if( (scrollDirection == LittleVgl::FullRefreshDirections::Down) && (area->y2 == visibleNbLines - 1)) {
writeOffset = ((writeOffset + totalNbLines) - visibleNbLines) % totalNbLines;
} else if( (scrollDirection == FullRefreshDirections::Up) && (area->y1 == 0) ) {
@@ -86,6 +95,7 @@ void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) {
height = (area->y2 - area->y1) + 1;
if(scrollDirection == LittleVgl::FullRefreshDirections::Down) {
+
if(area->y2 < visibleNbLines - 1) {
uint16_t toScroll = 0;
if(area->y1 == 0) {
@@ -95,6 +105,7 @@ void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) {
} else {
toScroll = height;
}
+
if(scrollOffset >= toScroll)
scrollOffset -= toScroll;
else {
@@ -117,6 +128,16 @@ void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) {
scrollOffset = scrollOffset % totalNbLines;
lcd.VerticalScrollStartAddress(scrollOffset);
}
+ } else if(scrollDirection == FullRefreshDirections::Left or scrollDirection == FullRefreshDirections::LeftAnim) {
+ if(area->x2 == visibleNbLines - 1) {
+ scrollDirection = FullRefreshDirections::None;
+ lv_disp_set_direction(lv_disp_get_default(), 0);
+ }
+ } else if(scrollDirection == FullRefreshDirections::Right or scrollDirection == FullRefreshDirections::RightAnim) {
+ if(area->x1 == 0) {
+ scrollDirection = FullRefreshDirections::None;
+ lv_disp_set_direction(lv_disp_get_default(), 0);
+ }
}
if (y2 < y1) {
@@ -124,13 +145,14 @@ void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) {
if ( height > 0 ) {
lcd.DrawBuffer(area->x1, y1, width, height, reinterpret_cast<const uint8_t *>(color_p), width * height * 2);
- ulTaskNotifyTake(pdTRUE, 320);
+ ulTaskNotifyTake(pdTRUE, 100);
}
+
uint16_t pixOffset = width * height;
height = y2 + 1;
lcd.DrawBuffer(area->x1, 0, width, height, reinterpret_cast<const uint8_t *>(color_p + pixOffset), width * height * 2);
- } else {
+ } else {
lcd.DrawBuffer(area->x1, y1, width, height, reinterpret_cast<const uint8_t *>(color_p), width * height * 2);
}