@@ -25,6 +25,7 @@ BraccioClass::BraccioClass()
2525, _motors_connected_mtx{}
2626, _motors_connected_thd{}
2727, _customMenu{nullptr }
28+ , _gfx{}
2829{
2930
3031}
@@ -120,10 +121,10 @@ bool BraccioClass::begin(voidFuncPtr customMenu)
120121
121122 lv_style_init (&_lv_style);
122123
123- gfx .init ();
124- gfx .setRotation (4 );
125- gfx .fillScreen (TFT_WHITE);
126- gfx .setAddrWindow (0 , 0 , 240 , 240 );
124+ _gfx .init ();
125+ _gfx .setRotation (4 );
126+ _gfx .fillScreen (TFT_WHITE);
127+ _gfx .setAddrWindow (0 , 0 , 240 , 240 );
127128
128129 p_objGroup = lv_group_create ();
129130 lv_group_set_default (p_objGroup);
@@ -232,6 +233,19 @@ void BraccioClass::connectJoystickTo(lv_obj_t* obj) {
232233 lv_indev_set_group (kb_indev, p_objGroup);
233234}
234235
236+ void BraccioClass::lvgl_disp_flush (lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
237+ {
238+ uint32_t w = (area->x2 - area->x1 + 1 );
239+ uint32_t h = (area->y2 - area->y1 + 1 );
240+
241+ _gfx.startWrite ();
242+ _gfx.setAddrWindow (area->x1 , area->y1 , w, h);
243+ _gfx.pushColors (&color_p->full , w * h, true );
244+ _gfx.endWrite ();
245+
246+ lv_disp_flush_ready (disp);
247+ }
248+
235249void BraccioClass::pd_thread () {
236250 start_pd_burst = millis ();
237251 size_t last_time_ask_pps = 0 ;
@@ -374,15 +388,7 @@ int BraccioClass::getKey() {
374388/* Display flushing */
375389extern " C" void braccio_disp_flush (lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
376390{
377- uint32_t w = (area->x2 - area->x1 + 1 );
378- uint32_t h = (area->y2 - area->y1 + 1 );
379-
380- Braccio.gfx .startWrite ();
381- Braccio.gfx .setAddrWindow (area->x1 , area->y1 , w, h);
382- Braccio.gfx .pushColors (&color_p->full , w * h, true );
383- Braccio.gfx .endWrite ();
384-
385- lv_disp_flush_ready (disp);
391+ Braccio.lvgl_disp_flush (disp, area, color_p);
386392}
387393
388394/* Reading input device (simulated encoder here) */
0 commit comments