aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortrsaunders <trsaunders@gmail.com>2012-06-27 16:40:23 +0100
committertrsaunders <trsaunders@gmail.com>2012-06-27 16:40:23 +0100
commit351c50cc48eb5468254a4fa4401e2de9536378a5 (patch)
treec73962a293cac89c4f6fb8ed20ae67a5fb5c304e
parentc10f54e5aff2c465adcb486c1cb7b66ea3c21567 (diff)
downloaduGFX-351c50cc48eb5468254a4fa4401e2de9536378a5.tar.gz
uGFX-351c50cc48eb5468254a4fa4401e2de9536378a5.tar.bz2
uGFX-351c50cc48eb5468254a4fa4401e2de9536378a5.zip
tidy up
-rw-r--r--drivers/lcd/s6d1121_lld.c40
-rw-r--r--glcd.c3
2 files changed, 36 insertions, 7 deletions
diff --git a/drivers/lcd/s6d1121_lld.c b/drivers/lcd/s6d1121_lld.c
index 7f842e33..da8878e2 100644
--- a/drivers/lcd/s6d1121_lld.c
+++ b/drivers/lcd/s6d1121_lld.c
@@ -238,6 +238,18 @@ __inline void lld_lcdWriteStream(uint16_t *buffer, uint16_t size) {
}
}
+__inline void lld_lcdReadStreamStart(void) {
+ /* TODO */
+}
+
+__inline void lld_lcdReadStreamStop(void) {
+ /* TODO */
+}
+
+__inline void lld_lcdReadStream(uint16_t *buffer, size_t size) {
+ /* TODO */
+}
+
void lld_lcdFillArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color) {
uint32_t index = 0, area;
@@ -350,13 +362,33 @@ uint16_t lld_lcdGetWidth(void) {
return lcd_width;
}
+/* a positive lines value shifts the screen up, negative down */
+/* TODO: test this */
void lld_lcdVerticalScroll(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, int16_t lines) {
+ uint16_t row0, row1;
+ uint16_t i;
lld_lcdSetWindow(x0, y0, x1, y1);
- /* if negative shift, then subtract from the height of the area */
- lines = (lines < 0) ? ((y1-y0) + lines) : lines;
-
- /* TODO: implement */
+ for(i = 0; i < ((y1-y0) - abs(lines)); i++) {
+ if(lines > 0) {
+ row0 = y0 + i + lines;
+ row1 = y0 + i;
+ } else {
+ row0 = (y1 - i - 1) + lines;
+ row1 = (y1 - i - 1);
+ }
+
+ /* read row0 into the buffer and then write at row1*/
+ lld_lcdSetWindow(x0, row0, x1, row0);
+ lld_lcdReadStreamStart();
+ lld_lcdReadStream(buf, x1-x0);
+ lld_lcdReadStreamStop();
+
+ lld_lcdSetWindow(x0, row1, x1, row1);
+ lld_lcdWriteStreamStart();
+ lld_lcdWriteStream(buf, x1-x0);
+ lld_lcdWriteStreamStop();
+ }
}
diff --git a/glcd.c b/glcd.c
index e6a5cbb5..980dfa04 100644
--- a/glcd.c
+++ b/glcd.c
@@ -317,6 +317,3 @@ void lcdDrawCircle(uint16_t x, uint16_t y, uint16_t radius, uint8_t filled, uint
void lcdVerticalScroll(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, int16_t lines) {
lld_lcdVerticalScroll(x0,y0,x1,y1,lines);
}
-
-
-