Adafruit lvgl Glue Library
Adafruit_LvGL_Glue.h
1 #ifndef _ADAFRUIT_LVGL_GLUE_H_
2 #define _ADAFRUIT_LVGL_GLUE_H_
3 
4 #include <Adafruit_SPITFT.h> // GFX lib for SPI and parallel displays
5 #include <Adafruit_STMPE610.h> // SPI Touchscreen lib
6 #include <TouchScreen.h> // ADC touchscreen lib
7 #include <lvgl.h> // LittlevGL core lib
8 #if defined(ARDUINO_ARCH_SAMD)
9 #include <Adafruit_ZeroTimer.h> // SAMD-specific timer lib
10 #elif defined(ESP32)
11 #include <Ticker.h> // ESP32-specific timer lib
12 #endif
13 
14 typedef enum {
15  LVGL_OK,
16  LVGL_ERR_ALLOC,
17  LVGL_ERR_TIMER,
18 } LvGLStatus;
19 
26 public:
27  Adafruit_LvGL_Glue(void);
28  ~Adafruit_LvGL_Glue(void);
29  // Different begin() funcs for STMPE610, ADC or no touch
30  LvGLStatus begin(Adafruit_SPITFT *tft, Adafruit_STMPE610 *touch,
31  bool debug = false);
32  LvGLStatus begin(Adafruit_SPITFT *tft, TouchScreen *touch,
33  bool debug = false);
34  LvGLStatus begin(Adafruit_SPITFT *tft, bool debug = false);
35  // These items need to be public for some internal callbacks,
36  // but should be avoided by user code please!
37  Adafruit_SPITFT *display;
38  void *touchscreen;
39  bool is_adc_touch;
40  bool first_frame;
41 
43 private:
44  LvGLStatus begin(Adafruit_SPITFT *tft, void *touch, bool debug);
45  static lv_disp_drv_t lv_disp_drv;
46  static lv_disp_draw_buf_t lv_disp_draw_buf;
47  static lv_color_t *lv_pixel_buf;
48  static lv_indev_drv_t lv_indev_drv;
49  lv_indev_t *lv_input_dev_ptr;
50 #if defined(ARDUINO_ARCH_SAMD)
51  Adafruit_ZeroTimer *zerotimer;
52 #elif defined(ESP32)
53  Ticker tick;
54 #elif defined(NRF52_SERIES)
55 #endif
56 };
57 
58 #endif // _ADAFRUIT_LVGL_GLUE_H_
bool first_frame
Definition: Adafruit_LvGL_Glue.h:40
void * touchscreen
Pointer to the touchscreen object to use.
Definition: Adafruit_LvGL_Glue.h:38
Class to act as a "glue" layer between the LvGL graphics library and most of Adafruit&#39;s TFT displays...
Definition: Adafruit_LvGL_Glue.h:25
Adafruit_SPITFT * display
Pointer to the SPITFT display instance.
Definition: Adafruit_LvGL_Glue.h:37
bool is_adc_touch
determines if the touchscreen controlelr is ADC based
Definition: Adafruit_LvGL_Glue.h:39
LvGLStatus begin(Adafruit_SPITFT *tft, Adafruit_STMPE610 *touch, bool debug=false)
Configure the glue layer and the underlying LvGL code to use the given TFT display driver instance an...
Definition: Adafruit_LvGL_Glue.cpp:267
Adafruit_LvGL_Glue(void)
Construct a new Adafruit_LvGL_Glue::Adafruit_LvGL_Glue object, initializing minimal variables...
Definition: Adafruit_LvGL_Glue.cpp:224
~Adafruit_LvGL_Glue(void)
Destroy the Adafruit_LvGL_Glue::Adafruit_LvGL_Glue object, freeing any memory previously allocated wi...
Definition: Adafruit_LvGL_Glue.cpp:236