38 lines
1.5 KiB
C
38 lines
1.5 KiB
C
#include <stdint.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
|
|
#include "lvgl.h"
|
|
|
|
#include "user_tasks.h"
|
|
|
|
osThreadId_t g_user_hello_task_handle;
|
|
osThreadAttr_t g_user_hello_task_attributes = {
|
|
.name = "HELO",
|
|
.stack_size = 192 * 4,
|
|
.priority = (osPriority_t) osPriorityNormal,
|
|
};
|
|
|
|
void user_hello_task(void *argument) {
|
|
LV_LOG_INFO("Hello task started.");
|
|
if(osMutexAcquire(g_user_lvgl_mutex_handle, osWaitForever) == osOK) {
|
|
lv_obj_t * label1 = lv_label_create(lv_scr_act(), NULL);
|
|
lv_label_set_long_mode(label1, LV_LABEL_LONG_BREAK); /*Break the long lines*/
|
|
lv_label_set_recolor(label1, true); /*Enable re-coloring by commands in the text*/
|
|
lv_label_set_align(label1, LV_LABEL_ALIGN_CENTER); /*Center aligned lines*/
|
|
lv_label_set_text(label1, "#0000ff Re-color# #ff00ff words# #ff0000 of a# label "
|
|
"and wrap long text automatically.");
|
|
lv_obj_set_width(label1, 200);
|
|
lv_obj_align(label1, NULL, LV_ALIGN_CENTER, 0, -30);
|
|
|
|
lv_obj_t * label2 = lv_label_create(lv_scr_act(), NULL);
|
|
lv_label_set_long_mode(label2, LV_LABEL_LONG_SROLL_CIRC); /*Circular scroll*/
|
|
lv_obj_set_width(label2, 200);
|
|
lv_label_set_text(label2, "It is a circularly scrolling text. ");
|
|
lv_obj_align(label2, NULL, LV_ALIGN_CENTER, 0, 40);
|
|
osMutexRelease(g_user_lvgl_mutex_handle);
|
|
}
|
|
for(;;) {
|
|
osDelay(1000);
|
|
}
|
|
} |