Update Display getters.
This commit is contained in:
		
							parent
							
								
									58a83590ca
								
							
						
					
					
						commit
						8aaed133e8
					
				@ -46,9 +46,14 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  ~Display() = default;
 | 
					  ~Display() = default;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  [[nodiscard]] const lv_display_t *get_display() const { return display_; }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  [[nodiscard]] lv_display_t *get_display() { return display_; }
 | 
					  [[nodiscard]] inline const lv_display_t *get() const { return display_; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  [[nodiscard]] inline lv_display_t *get() { return display_; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  [[nodiscard]] inline const lv_display_t *operator*() const { return get(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  [[nodiscard]] inline lv_display_t *operator*() { return get(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static bool lvgl_flush_ready(esp_lcd_panel_io_handle_t panel,
 | 
					  static bool lvgl_flush_ready(esp_lcd_panel_io_handle_t panel,
 | 
				
			||||||
                               esp_lcd_panel_io_event_data_t *data,
 | 
					                               esp_lcd_panel_io_event_data_t *data,
 | 
				
			||||||
 | 
				
			|||||||
@ -13,17 +13,15 @@ void setup()
 | 
				
			|||||||
    ScopedLock lock(Display::lvgl_api_lock_);
 | 
					    ScopedLock lock(Display::lvgl_api_lock_);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ESP_LOGI(TAG, "Display LVGL Scroll Text");
 | 
					    ESP_LOGI(TAG, "Display LVGL Scroll Text");
 | 
				
			||||||
    lv_obj_t *scr = lv_display_get_screen_active(d.get_display());
 | 
					    lv_obj_t *scr = lv_display_get_screen_active(d.get());
 | 
				
			||||||
    lv_obj_t *label = lv_label_create(scr);
 | 
					    lv_obj_t *label = lv_label_create(scr);
 | 
				
			||||||
    // Circular scroll
 | 
					    // Circular scroll
 | 
				
			||||||
    lv_label_set_long_mode(label,
 | 
					    lv_label_set_long_mode(label, LV_LABEL_LONG_SCROLL_CIRCULAR);
 | 
				
			||||||
                           LV_LABEL_LONG_SCROLL_CIRCULAR);
 | 
					    lv_label_set_text(label, "Hello hello hello hello hello hello hello.");
 | 
				
			||||||
    lv_label_set_text(label,
 | 
					
 | 
				
			||||||
                      "Hello hello hello hello hello hello hello hello.");
 | 
					 | 
				
			||||||
    // Size of the screen
 | 
					    // Size of the screen
 | 
				
			||||||
    // if you use rotation 90 or 270 use lv_display_get_vertical_resolution
 | 
					    // if you use rotation 90 or 270 use lv_display_get_vertical_resolution
 | 
				
			||||||
    lv_obj_set_width(label,
 | 
					    lv_obj_set_width(label, lv_display_get_horizontal_resolution(*d));
 | 
				
			||||||
                     lv_display_get_horizontal_resolution(d.get_display()));
 | 
					 | 
				
			||||||
    lv_obj_align(label, LV_ALIGN_TOP_MID, 0, 0);
 | 
					    lv_obj_align(label, LV_ALIGN_TOP_MID, 0, 0);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user