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

Commit

Permalink
Merge pull request #12 from Pablo2048/feature/lvglv6.0
Browse files Browse the repository at this point in the history
Feature/lvglv6.0
  • Loading branch information
Pablo2048 authored Jul 7, 2019
2 parents 4ca926a + fccda6b commit ac94d7c
Show file tree
Hide file tree
Showing 275 changed files with 50,242 additions and 178,547 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# LittlevGL Arduino library

This library allows to use LittlevGL as an Arduino library. Library can be installed via Arduino IDE Library Manager or as an .ZIP library.
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.

## Example

Expand All @@ -15,9 +15,9 @@ Example result should look like this:
Tested with:

* My own ESP32 board, module ESP32 Wroom
* PC OS: Linux, Ubuntu 16.04 LTS
* IDE: Arduino IDE 1.8.8
* ESP32 Core: 1.0.1
* PC OS: Linux, Ubuntu 18.04 LTS
* IDE: Arduino IDE 1.8.9
* ESP32 Core: 1.0.2

## Debugging

Expand Down
28 changes: 18 additions & 10 deletions examples/ESP32_TFT_eSPI/ESP32_TFT_eSPI.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

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

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

/* Display flushing */
void disp_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t *color_p) {
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
{
uint16_t c;

tft.startWrite(); /* Start new TFT transaction */
tft.setAddrWindow(x1, y1, (x2 - x1 + 1), (y2 - y1 + 1)); /* set the working window */
for (int y = y1; y <= y2; y++) {
for (int x = x1; x <= x2; x++) {
tft.setAddrWindow(area->x1, area->y1, (area->x2 - area->x1 + 1), (area->y2 - area->y1 + 1)); /* set the working window */
for (int y = area->y1; y <= area->y2; y++) {
for (int x = area->x1; x <= area->x2; x++) {
c = color_p->full;
tft.writeColor(c, 1);
color_p++;
}
}
tft.endWrite(); /* terminate TFT transaction */
lv_flush_ready(); /* tell lvgl that flushing is done */
lv_disp_flush_ready(disp); /* tell lvgl that flushing is done */
}

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

/* Reading input device (simulated encoder here) */
bool read_encoder(lv_indev_data_t * data)
bool read_encoder(lv_indev_drv_t * indev, lv_indev_data_t * data)
{
static int32_t last_diff = 0;

int32_t diff = 0; /* Dummy - no movement */
int btn_state = LV_INDEV_STATE_REL; /* Dummy - no press */

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

lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10);

/*Initialize the display*/
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.disp_flush = disp_flush;
disp_drv.hor_res = 320;
disp_drv.ver_res = 240;
disp_drv.flush_cb = my_disp_flush;
disp_drv.buffer = &disp_buf;
lv_disp_drv_register(&disp_drv);


/*Initialize the touch pad*/
lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_ENCODER;
indev_drv.read = read_encoder;
indev_drv.read_cb = read_encoder;
lv_indev_drv_register(&indev_drv);

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

/* Create simple label */
lv_obj_t *label = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(label, "Hello Arduino!");
lv_label_set_text(label, "Hello Arduino! (V6.0)");
lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
}

Expand Down
Binary file modified extras/img/lvglarduino.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"type": "git",
"url": "https://github.com/littlevgl/arduino"
},
"version": "1.0.0",
"version": "2.0.0",
"license": "MIT",
"frameworks": "arduino",
"build": {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=LittlevGL
version=1.0.0
version=2.0.0
author=Gabor Kiss-Vamosi
maintainer=Pavel Brychta <[email protected]>
sentence=Full-featured Graphics Library for embedded systems
Expand Down
Loading

0 comments on commit ac94d7c

Please sign in to comment.