Description
Using lv_img_dsc_t JPEG .c file is not working for displaying the image using jpeg decoder
What MCU/Processor/Board and compiler are you using?
RP2040
What LVGL version are you using?
8.3.6
What do you want to achieve?
My main goal is to use a jpeg in uint8_t format to create a lv_img_dsc_t, then display it using LVGL.
What have you tried so far?
I’ve tried manually create the image using a jpeg in uint8_t format, and tried to use a C array file in CF_RAW of the jpeg, but it only shows NO DATA
Code to reproduce
#include "../ui.h"
// Define a global label object for updating the text
lv_obj_t *ui_label;
lv_obj_t *img;
lv_img_dsc_t my_img_dsc;
// Callback function to update label text with Bluetooth data
void callback_to_ui_screen(const char *data)
{
// Update the label text with the received Bluetooth data
// lv_obj_t *ui_label1;
lv_label_set_text(ui_label, data);
}
//Callback function to update image displayed with Bluetooth data
void processReceivedImage(const uint8_t *decodedImageData) {
// Create an image descriptor
lv_img_dsc_t my_img_dsc = {
.header.always_zero = 0,
.header.reserved = 0,
.header.w = 240,
.header.h = 240,
.data_size = 11416, // Value extracted from the file i am testing, i will turn it dynamic after
.header.cf = LV_IMG_CF_RAW_CHROMA_KEYED, // Tried to use LV_IMG_CF_RAW, didn't work either
.data = decodedImageData,
};
lv_img_set_src(ui_Image2, &testjpg);
}
void ui_Screen1_screen_init(void)
{
ui_Screen1 = lv_obj_create(NULL);
lv_obj_clear_flag(ui_Screen1, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_t *img;
ui_Image2 = lv_img_create(ui_Screen1);
lv_img_set_src(ui_Image2, &egi);
lv_obj_set_width(ui_Image2, LV_SIZE_CONTENT);
lv_obj_set_height(ui_Image2, LV_SIZE_CONTENT);
lv_obj_set_align(ui_Image2, LV_ALIGN_CENTER);
}
I’m forgetting to include something to make it work?