Skip to content
This repository was archived by the owner on Dec 4, 2020. It is now read-only.

Commit ac94d7c

Browse files
authored
Merge pull request #12 from Pablo2048/feature/lvglv6.0
Feature/lvglv6.0
2 parents 4ca926a + fccda6b commit ac94d7c

File tree

275 files changed

+50242
-178547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

275 files changed

+50242
-178547
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# LittlevGL Arduino library
22

3-
This library allows to use LittlevGL as an Arduino library. Library can be installed via Arduino IDE Library Manager or as an .ZIP library.
3+
This library allows to use LittlevGL (v6.x) as an Arduino library. Library can be installed via Arduino IDE Library Manager or as an .ZIP library.
44

55
## Example
66

@@ -15,9 +15,9 @@ Example result should look like this:
1515
Tested with:
1616

1717
* My own ESP32 board, module ESP32 Wroom
18-
* PC OS: Linux, Ubuntu 16.04 LTS
19-
* IDE: Arduino IDE 1.8.8
20-
* ESP32 Core: 1.0.1
18+
* PC OS: Linux, Ubuntu 18.04 LTS
19+
* IDE: Arduino IDE 1.8.9
20+
* ESP32 Core: 1.0.2
2121

2222
## Debugging
2323

examples/ESP32_TFT_eSPI/ESP32_TFT_eSPI.ino

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
Ticker tick; /* timer for interrupt handler */
88
TFT_eSPI tft = TFT_eSPI(); /* TFT instance */
9+
static lv_disp_buf_t disp_buf;
10+
static lv_color_t buf[LV_HOR_RES_MAX * 10];
911

1012
#if USE_LV_LOG != 0
1113
/* Serial debugging */
@@ -18,19 +20,21 @@ void my_print(lv_log_level_t level, const char * file, uint32_t line, const char
1820
#endif
1921

2022
/* Display flushing */
21-
void disp_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t *color_p) {
23+
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
24+
{
2225
uint16_t c;
26+
2327
tft.startWrite(); /* Start new TFT transaction */
24-
tft.setAddrWindow(x1, y1, (x2 - x1 + 1), (y2 - y1 + 1)); /* set the working window */
25-
for (int y = y1; y <= y2; y++) {
26-
for (int x = x1; x <= x2; x++) {
28+
tft.setAddrWindow(area->x1, area->y1, (area->x2 - area->x1 + 1), (area->y2 - area->y1 + 1)); /* set the working window */
29+
for (int y = area->y1; y <= area->y2; y++) {
30+
for (int x = area->x1; x <= area->x2; x++) {
2731
c = color_p->full;
2832
tft.writeColor(c, 1);
2933
color_p++;
3034
}
3135
}
3236
tft.endWrite(); /* terminate TFT transaction */
33-
lv_flush_ready(); /* tell lvgl that flushing is done */
37+
lv_disp_flush_ready(disp); /* tell lvgl that flushing is done */
3438
}
3539

3640
/* Interrupt driven periodic handler */
@@ -41,10 +45,9 @@ static void lv_tick_handler(void)
4145
}
4246

4347
/* Reading input device (simulated encoder here) */
44-
bool read_encoder(lv_indev_data_t * data)
48+
bool read_encoder(lv_indev_drv_t * indev, lv_indev_data_t * data)
4549
{
4650
static int32_t last_diff = 0;
47-
4851
int32_t diff = 0; /* Dummy - no movement */
4952
int btn_state = LV_INDEV_STATE_REL; /* Dummy - no press */
5053

@@ -69,26 +72,31 @@ void setup() {
6972
tft.begin(); /* TFT init */
7073
tft.setRotation(1); /* Landscape orientation */
7174

75+
lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10);
76+
7277
/*Initialize the display*/
7378
lv_disp_drv_t disp_drv;
7479
lv_disp_drv_init(&disp_drv);
75-
disp_drv.disp_flush = disp_flush;
80+
disp_drv.hor_res = 320;
81+
disp_drv.ver_res = 240;
82+
disp_drv.flush_cb = my_disp_flush;
83+
disp_drv.buffer = &disp_buf;
7684
lv_disp_drv_register(&disp_drv);
7785

7886

7987
/*Initialize the touch pad*/
8088
lv_indev_drv_t indev_drv;
8189
lv_indev_drv_init(&indev_drv);
8290
indev_drv.type = LV_INDEV_TYPE_ENCODER;
83-
indev_drv.read = read_encoder;
91+
indev_drv.read_cb = read_encoder;
8492
lv_indev_drv_register(&indev_drv);
8593

8694
/*Initialize the graphics library's tick*/
8795
tick.attach_ms(LVGL_TICK_PERIOD, lv_tick_handler);
8896

8997
/* Create simple label */
9098
lv_obj_t *label = lv_label_create(lv_scr_act(), NULL);
91-
lv_label_set_text(label, "Hello Arduino!");
99+
lv_label_set_text(label, "Hello Arduino! (V6.0)");
92100
lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
93101
}
94102

extras/img/lvglarduino.jpg

8.03 KB
Loading

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"type": "git",
1313
"url": "https://github.com/littlevgl/arduino"
1414
},
15-
"version": "1.0.0",
15+
"version": "2.0.0",
1616
"license": "MIT",
1717
"frameworks": "arduino",
1818
"build": {

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=LittlevGL
2-
version=1.0.0
2+
version=2.0.0
33
author=Gabor Kiss-Vamosi
44
maintainer=Pavel Brychta <[email protected]>
55
sentence=Full-featured Graphics Library for embedded systems

0 commit comments

Comments
 (0)