Skip to content

Commit

Permalink
Update example to set background color to black and add CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
atanisoft committed Nov 11, 2022
1 parent e12b792 commit 12dbcf8
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 7 deletions.
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Change log for esp_lcd_ili9488

## v1.0.3 - Bug Fixes and LVGL example update

This release removes (and desupports) a dependency on 32-bit color depth when
using LVGL, the color conversion code has only ever supported 16-bit color data
but was incorrectly casting the source color data to `uint32_t` instead of
`uint16_t`.

As a result of the above bug fix the `esp_lcd_panel_dev_config_t` field
`bits_per_pixel` will be ignored by `esp_lcd_new_panel_ili9488` and the ILI9488
will always use the 18-bit color mode.

The LVGL example has been updated as below:

* Remove unused `lvgl_port_update_callback` since the example does not include
touch support or any screen rotation API calls.
* Add option for enabling / disabling double buffering with LVGL, default is to
use a single buffer.
* Added missing Kconfig.projbuild entry for `TFT_RESET_PIN`, added new entry
`DISPLAY_COLOR_MODE` which can be used to toggle between BGR and RGB color mode
on the ILI9488 display.
* Enhanced example to switch from only using `lv_spinner_create` to instead use
`lv_meter_create` and `lv_anim_t` to display an animated gauge.
* Reduced default backlight brightness to 75%.
* Switched from using `esp_register_freertos_tick_hook` to `esp_timer_create`
for the tick update handler.
* Add code to set the background color of the display to black.

## v1.0.2 - Bug Fix Release

This release contains a bug fix related to a compilation failure with ESP-IDF
v5.0.1 replacing `esp_lcd_color_space_t` with `lcd_color_rgb_endian_t` but
retaining the original name in `esp_lcd_panel_dev_config_t` for the value. At
this time the library supports both ESP-IDF v4.4.x and v5.x but the new values
in `lcd_color_rgb_endian_t` are not being used as they are compatible with the
existing values defined in `esp_lcd_color_space_t`, once ESP-IDF v5.1.x has
become stable and legacy enums are removed this library will be updated accordingly.

Fixed: https://github.com/atanisoft/esp_lcd_ili9488/issues/1

## v1.0.1 - No changes

## v1.0.0 - Initial release

This release is the first revision of this component and includes basic support
for ILI9488 displays including the 18-bit color depth conversion which is
required for SPI interface displays.
22 changes: 15 additions & 7 deletions examples/lvgl/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static lv_disp_t *lv_display = NULL;
static lv_color_t *lv_buf_1 = NULL;
static lv_color_t *lv_buf_2 = NULL;
static lv_obj_t *meter = NULL;
static lv_style_t style_screen;

static void update_meter_value(void *indic, int32_t v)
{
Expand Down Expand Up @@ -242,41 +243,48 @@ void initialize_lvgl()
void create_demo_ui()
{
lv_obj_t *scr = lv_disp_get_scr_act(NULL);

// Set the background color of the display to black.
lv_style_init(&style_screen);
lv_style_set_bg_color(&style_screen, lv_color_black());
lv_obj_add_style(lv_scr_act(), &style_screen, LV_STATE_DEFAULT);

// Create a meter which can be animated.
meter = lv_meter_create(scr);
lv_obj_center(meter);
lv_obj_set_size(meter, 200, 200);

/* Add a scale first */
// Add a scale first
lv_meter_scale_t *scale = lv_meter_add_scale(meter);
lv_meter_set_scale_ticks(meter, scale, 41, 2, 10, lv_palette_main(LV_PALETTE_GREY));
lv_meter_set_scale_major_ticks(meter, scale, 8, 4, 15, lv_color_black(), 10);

lv_meter_indicator_t *indic;

/* Add a blue arc to the start */
// Add a blue arc to the start
indic = lv_meter_add_arc(meter, scale, 3, lv_palette_main(LV_PALETTE_BLUE), 0);
lv_meter_set_indicator_start_value(meter, indic, 0);
lv_meter_set_indicator_end_value(meter, indic, 20);

/* Make the tick lines blue at the start of the scale */
// Make the tick lines blue at the start of the scale
indic = lv_meter_add_scale_lines(meter, scale, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_BLUE), false, 0);
lv_meter_set_indicator_start_value(meter, indic, 0);
lv_meter_set_indicator_end_value(meter, indic, 20);

/* Add a red arc to the end */
// Add a red arc to the end
indic = lv_meter_add_arc(meter, scale, 3, lv_palette_main(LV_PALETTE_RED), 0);
lv_meter_set_indicator_start_value(meter, indic, 80);
lv_meter_set_indicator_end_value(meter, indic, 100);

/* Make the tick lines red at the end of the scale */
// Make the tick lines red at the end of the scale
indic = lv_meter_add_scale_lines(meter, scale, lv_palette_main(LV_PALETTE_RED), lv_palette_main(LV_PALETTE_RED), false, 0);
lv_meter_set_indicator_start_value(meter, indic, 80);
lv_meter_set_indicator_end_value(meter, indic, 100);

/* Add a needle line indicator */
// Add a needle line indicator
indic = lv_meter_add_needle_line(meter, scale, 4, lv_palette_main(LV_PALETTE_GREY), -10);

/* Create an animation to set the value */
// Create an animation to set the value
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_exec_cb(&a, update_meter_value);
Expand Down

0 comments on commit 12dbcf8

Please sign in to comment.