├── .github └── FUNDING.yml ├── .gitignore ├── LVGL_Watchface_240 ├── LVGL_Watchface_240.ino ├── ui.c ├── ui.h ├── ui_helpers.c ├── ui_helpers.h ├── ui_img_armhour_png.c ├── ui_img_armminute_png.c ├── ui_img_armsecond_png.c └── ui_img_watchface240_png.c ├── LVGL_Watchface_240_GIF ├── GifClass.h ├── LVGL_Watchface_240_GIF.ino ├── data │ └── star_wars_stormtrooper_80.gif ├── ui.c ├── ui.h ├── ui_helpers.c ├── ui_helpers.h ├── ui_img_blaster_png.c ├── ui_img_dlt19x_png.c ├── ui_img_lightsaber_png.c └── ui_img_watchface240_png.c ├── LVGL_Watchface_240_RP2040 ├── LVGL_Watchface_240_RP2040.ino ├── ui.c ├── ui.h ├── ui_helpers.c ├── ui_helpers.h ├── ui_img_armhour_png.c ├── ui_img_armminute_png.c ├── ui_img_armsecond_png.c ├── ui_img_out1_png.c ├── ui_img_out2_png.c ├── ui_img_out3_png.c ├── ui_img_out4_png.c ├── ui_img_out5_png.c ├── ui_img_out6_png.c ├── ui_img_out7_png.c ├── ui_img_out8_png.c ├── ui_img_watchface240_png.c └── ui_img_watchface240waveshare_png.c ├── LVGL_Watchface_240_Stormtrooper ├── LVGL_Watchface_240_Stormtrooper.ino ├── star_wars_stormtrooper_48_gif.c ├── star_wars_stormtrooper_64_gif.c ├── star_wars_stormtrooper_72_gif.c ├── star_wars_stormtrooper_80_gif.c ├── ui.c ├── ui.h ├── ui_helpers.c ├── ui_helpers.h ├── ui_img_blaster_png.c ├── ui_img_dlt19x_png.c ├── ui_img_lightsaber_png.c └── ui_img_watchface240_png.c ├── LVGL_Watchface_240_T-Watch ├── LVGL_Watchface_240_T-Watch.ino ├── axp20x.cpp ├── axp20x.h ├── ui.c ├── ui.h ├── ui_helpers.c ├── ui_helpers.h ├── ui_img_armhour_png.c ├── ui_img_armminute_png.c ├── ui_img_armsecond_png.c ├── ui_img_out1_png.c ├── ui_img_out2_png.c ├── ui_img_out3_png.c ├── ui_img_out4_png.c ├── ui_img_out5_png.c ├── ui_img_out6_png.c ├── ui_img_out7_png.c ├── ui_img_out8_png.c └── ui_img_watchface240_png.c ├── LVGL_Watchface_240_T-Watch_2021 ├── LVGL_Watchface_240_T-Watch_2021.ino ├── axp20x.cpp ├── axp20x.h ├── ui.c ├── ui.h ├── ui_helpers.c ├── ui_helpers.h ├── ui_img_01_png.c ├── ui_img_03_png.c ├── ui_img_05_png.c ├── ui_img_07_png.c ├── ui_img_09_png.c ├── ui_img_11_png.c ├── ui_img_13_png.c ├── ui_img_15_png.c ├── ui_img_17_png.c ├── ui_img_19_png.c ├── ui_img_21_png.c ├── ui_img_23_png.c ├── ui_img_armhour_png.c ├── ui_img_armhourblue_png.c ├── ui_img_armminute_png.c ├── ui_img_armminuteblue_png.c ├── ui_img_armsecond_png.c ├── ui_img_armsecondblue_png.c └── ui_img_watchface240_png.c ├── LVGL_Watchface_240_T-Watch_2021_GIF ├── GifClass.h ├── LVGL_Watchface_240_T-Watch_2021_GIF.ino ├── axp20x.cpp ├── axp20x.h ├── data │ ├── 3QAe240.gif │ ├── IrF240.gif │ ├── WDrB240.gif │ ├── fxTQ240.gif │ └── fy5Z240.gif ├── data1 │ └── F4kC.gif ├── ui.c ├── ui.h ├── ui_helpers.c ├── ui_helpers.h ├── ui_img_armhourblue_png.c ├── ui_img_armminuteblue_png.c ├── ui_img_armsecondblue_png.c └── ui_img_watchface240_png.c ├── LVGL_Watchface_240_T-Watch_2021_GIF_simple ├── GifClass.h ├── LVGL_Watchface_240_T-Watch_2021_GIF_simple.ino ├── axp20x.cpp ├── axp20x.h ├── data │ └── 79K5240.gif ├── ui.c ├── ui.h ├── ui_helpers.c ├── ui_helpers.h ├── ui_img_armhour_png.c ├── ui_img_armminute_png.c └── ui_img_armsecond_png.c ├── LVGL_Watchface_240_T-Watch_2021_animation ├── LVGL_Watchface_240_T-Watch_2021_animation.ino ├── axp20x.cpp ├── axp20x.h ├── ui.c ├── ui.h ├── ui_helpers.c ├── ui_helpers.h ├── ui_img_01_png.c ├── ui_img_03_png.c ├── ui_img_05_png.c ├── ui_img_07_png.c ├── ui_img_09_png.c ├── ui_img_11_png.c ├── ui_img_13_png.c ├── ui_img_15_png.c ├── ui_img_17_png.c ├── ui_img_19_png.c ├── ui_img_21_png.c ├── ui_img_23_png.c ├── ui_img_armhour_png.c ├── ui_img_armminute_png.c ├── ui_img_armsecond_png.c └── ui_img_watchface240_png.c ├── LVGL_Watchface_240_XIAO ├── LVGL_Watchface_240_XIAO.ino ├── ui.c ├── ui.h ├── ui_events.h ├── ui_helpers.c ├── ui_helpers.h ├── ui_img_armhour_png.c ├── ui_img_armminute_png.c ├── ui_img_armsecond_png.c ├── ui_img_watchface240_png.c └── ui_img_watchface240seeedstudio_png.c ├── LVGL_Watchface_240_XIAO_date ├── LVGL_Watchface_240_XIAO_date.ino ├── ui.c ├── ui.h ├── ui_events.h ├── ui_helpers.c ├── ui_helpers.h ├── ui_img_armhour_png.c ├── ui_img_armminute_png.c ├── ui_img_armsecond_png.c ├── ui_img_out1_png.c ├── ui_img_out2_png.c ├── ui_img_out3_png.c ├── ui_img_out4_png.c ├── ui_img_out5_png.c ├── ui_img_out6_png.c ├── ui_img_out7_png.c ├── ui_img_out8_png.c ├── ui_img_watchface240_png.c └── ui_img_watchface240seeedstudio_png.c ├── LVGL_Watchface_480 ├── LVGL_Watchface_480.ino ├── ui.c ├── ui.h ├── ui_font_SansDate.c ├── ui_helpers.c ├── ui_helpers.h ├── ui_img_arm_hour_png.c ├── ui_img_arm_minute_png.c ├── ui_img_arm_second_png.c ├── ui_img_out01_png.c ├── ui_img_out02_png.c ├── ui_img_out03_png.c ├── ui_img_out04_png.c ├── ui_img_out05_png.c ├── ui_img_out06_png.c ├── ui_img_out07_png.c ├── ui_img_out08_png.c ├── ui_img_out09_png.c ├── ui_img_out10_png.c └── ui_img_watchface_png.c ├── README.md ├── SquareLine_240 ├── SquareLine_Project.sll ├── SquareLine_Project.spj └── assets │ ├── armHour.png │ ├── armMinute.png │ ├── armSecond.png │ ├── watchface240.png │ └── watchface240Seeedstudio.png ├── SquareLine_240_RP2040 ├── SquareLine_Project.sll ├── SquareLine_Project.spj └── assets │ ├── armHour.png │ ├── armMinute.png │ ├── armSecond.png │ ├── out1.png │ ├── out2.png │ ├── out3.png │ ├── out4.png │ ├── out5.png │ ├── out6.png │ ├── out7.png │ ├── out8.png │ ├── watchface240.png │ └── watchface240Waveshare.png ├── SquareLine_240_Stormtrooper ├── SquareLine_Project.sll ├── SquareLine_Project.spj └── assets │ ├── blaster.png │ ├── dlt19x.png │ ├── lightsaber.png │ ├── star_wars_ stormtrooper_80.gif │ └── watchface240.png ├── SquareLine_240_aniback ├── SquareLine_Project.sll ├── SquareLine_Project.spj └── assets │ ├── 01.png │ ├── 02.png │ ├── 03.png │ ├── 04.png │ ├── 05.png │ ├── 06.png │ ├── 07.png │ ├── 08.png │ ├── 09.png │ ├── 10.png │ ├── 11.png │ ├── 12.png │ ├── 13.png │ ├── 14.png │ ├── 15.png │ ├── 16.png │ ├── 17.png │ ├── 18.png │ ├── 19.png │ ├── 20.png │ ├── 21.png │ ├── 22.png │ ├── 23.png │ ├── 24.png │ ├── armHour.png │ ├── armHourBlue.png │ ├── armMinute.png │ ├── armMinuteBlue.png │ ├── armSecond.png │ ├── armSecondBlue.png │ └── watchface240.png ├── SquareLine_240_date ├── SquareLine_Project.sll ├── SquareLine_Project.spj └── assets │ ├── armHour.png │ ├── armMinute.png │ ├── armSecond.png │ ├── out1.png │ ├── out2.png │ ├── out3.png │ ├── out4.png │ ├── out5.png │ ├── out6.png │ ├── out7.png │ ├── out8.png │ ├── watchface240.png │ └── watchface240Seeedstudio.png ├── SquareLine_480 ├── SquareLine_Project.sll ├── SquareLine_Project.spj └── assets │ ├── arm_hour.png │ ├── arm_minute.png │ ├── arm_second.png │ ├── out01.png │ ├── out02.png │ ├── out03.png │ ├── out04.png │ ├── out05.png │ ├── out06.png │ ├── out07.png │ ├── out08.png │ ├── out09.png │ ├── out10.png │ ├── ui_font_SansDate.c │ ├── ui_font_SansDate.fcfg │ └── watchface.png ├── watchface240.svg └── watchface480.svg /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: moononournation -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .* 2 | *.bin 3 | *.cfg 4 | *.json 5 | *.otf 6 | *.svd 7 | backup 8 | cache 9 | -------------------------------------------------------------------------------- /LVGL_Watchface_240/LVGL_Watchface_240.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * LVGL Watchface 3 | * 4 | * Image by macrovector on Freepik: 5 | * https://www.freepik.com/free-vector/watch-set-expensive-classic-clock-with-leather-metal-straps-illustration_13031503.htm 6 | * 7 | * Dependent libraries: 8 | * LVGL: https://github.com/lvgl/lvgl.git 9 | * 10 | * LVGL Configuration file: 11 | * Copy your_arduino_path/libraries/lvgl/lv_conf_template.h 12 | * to your_arduino_path/libraries/lv_conf.h 13 | * 14 | * In lv_conf.h around line 15, enable config file: 15 | * #if 1 // Set it to "1" to enable content 16 | * 17 | * Then find and set: 18 | * #define LV_COLOR_DEPTH 16 19 | * #define LV_TICK_CUSTOM 1 20 | * 21 | * For SPI/parallel 8 display set color swap can be faster, parallel 16/RGB screen don't swap! 22 | * #define LV_COLOR_16_SWAP 1 // for SPI and parallel 8 23 | * #define LV_COLOR_16_SWAP 0 // for parallel 16 and RGB 24 | ******************************************************************************/ 25 | #include 26 | #include "ui.h" 27 | 28 | /******************************************************************************* 29 | * Start of Arduino_GFX setting 30 | ******************************************************************************/ 31 | #include 32 | #define GFX_BL 25 33 | /* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */ 34 | Arduino_DataBus *bus = new Arduino_RPiPicoSPI(8 /* DC */, 9 /* CS */, 10 /* SCK */, 11 /* MOSI */, 12 /* MISO */, spi1 /* spi */); 35 | /* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */ 36 | Arduino_GFX *gfx = new Arduino_GC9A01(bus, 12, 0 /* rotation */, true /* IPS */); 37 | /******************************************************************************* 38 | * End of Arduino_GFX setting 39 | ******************************************************************************/ 40 | 41 | // use compile time for demo only 42 | #define ONE_MINUTE_MS (60 * 1000) 43 | #define ONE_HOUR_MS (60 * 60 * 1000) 44 | #define TWELVE_HOUR_MS (12 * 60 * 60 * 1000) 45 | static uint8_t conv2d(const char *p) 46 | { 47 | uint8_t v = 0; 48 | return (10 * (*p - '0')) + (*++p - '0'); 49 | } 50 | static unsigned long ms_offset; 51 | 52 | static uint32_t screenWidth; 53 | static uint32_t screenHeight; 54 | static lv_disp_draw_buf_t draw_buf; 55 | static lv_color_t *disp_draw_buf; 56 | static lv_disp_drv_t disp_drv; 57 | 58 | /* Display flushing */ 59 | void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) 60 | { 61 | uint32_t w = (area->x2 - area->x1 + 1); 62 | uint32_t h = (area->y2 - area->y1 + 1); 63 | 64 | #if (LV_COLOR_16_SWAP != 0) 65 | gfx->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h); 66 | #else 67 | gfx->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h); 68 | #endif 69 | 70 | lv_disp_flush_ready(disp); 71 | } 72 | 73 | void my_log_cb(const char *buf) 74 | { 75 | Serial.println(buf); 76 | } 77 | 78 | void setup() 79 | { 80 | // use compile time for demo only 81 | uint8_t hh = conv2d(__TIME__); 82 | uint8_t mm = conv2d(__TIME__ + 3); 83 | uint8_t ss = conv2d(__TIME__ + 6); 84 | ms_offset = ((60 * 60 * hh) + (60 * mm) + ss) * 1000; 85 | 86 | Serial.begin(115200); 87 | // Serial.setDebugOutput(true); 88 | // while(!Serial); 89 | Serial.println("LVGL Watchface"); 90 | 91 | #ifdef GFX_EXTRA_PRE_INIT 92 | GFX_EXTRA_PRE_INIT(); 93 | #endif 94 | 95 | // Init Display 96 | gfx->begin(); 97 | gfx->fillScreen(BLACK); 98 | 99 | #ifdef GFX_BL 100 | pinMode(GFX_BL, OUTPUT); 101 | digitalWrite(GFX_BL, HIGH); 102 | #endif 103 | 104 | #if LV_USE_LOG 105 | lv_log_register_print_cb(my_log_cb); 106 | #endif 107 | 108 | lv_init(); 109 | 110 | screenWidth = gfx->width(); 111 | screenHeight = gfx->height(); 112 | #ifdef ESP32 113 | disp_draw_buf = (lv_color_t *)heap_caps_malloc(sizeof(lv_color_t) * screenWidth * 32, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); 114 | #else 115 | disp_draw_buf = (lv_color_t *)malloc(sizeof(lv_color_t) * screenWidth * 32); 116 | #endif 117 | if (!disp_draw_buf) 118 | { 119 | Serial.println("LVGL disp_draw_buf allocate failed!"); 120 | } 121 | else 122 | { 123 | lv_disp_draw_buf_init(&draw_buf, disp_draw_buf, NULL, screenWidth * 32); 124 | 125 | /* Initialize the display */ 126 | lv_disp_drv_init(&disp_drv); 127 | /* Change the following line to your display resolution */ 128 | disp_drv.hor_res = screenWidth; 129 | disp_drv.ver_res = screenHeight; 130 | disp_drv.flush_cb = my_disp_flush; 131 | disp_drv.draw_buf = &draw_buf; 132 | lv_disp_drv_register(&disp_drv); 133 | 134 | /* Initialize the (dummy) input device driver */ 135 | static lv_indev_drv_t indev_drv; 136 | lv_indev_drv_init(&indev_drv); 137 | indev_drv.type = LV_INDEV_TYPE_POINTER; 138 | lv_indev_drv_register(&indev_drv); 139 | 140 | /* Init SquareLine prepared UI */ 141 | ui_init(); 142 | 143 | Serial.println("Setup done"); 144 | } 145 | } 146 | 147 | void loop() 148 | { 149 | lv_timer_handler(); /* let the GUI do its work */ 150 | 151 | unsigned long ms = millis(); 152 | 153 | // set watch arms' angle 154 | unsigned long clock_ms = (ms_offset + ms) % TWELVE_HOUR_MS; 155 | uint8_t hour = clock_ms / ONE_HOUR_MS; 156 | uint8_t minute = (clock_ms % ONE_HOUR_MS) / ONE_MINUTE_MS; 157 | int16_t angle = (clock_ms % ONE_MINUTE_MS) * 3600 / ONE_MINUTE_MS; 158 | lv_img_set_angle(ui_ImageArmSecond, angle); 159 | angle = (angle + (minute * 3600)) / 60; 160 | lv_img_set_angle(ui_ImageArmMinute, angle); 161 | angle = (angle + (hour * 3600)) / 12; 162 | lv_img_set_angle(ui_ImageArmHour, angle); 163 | } 164 | -------------------------------------------------------------------------------- /LVGL_Watchface_240/ui.c: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #include "ui.h" 7 | #include "ui_helpers.h" 8 | 9 | ///////////////////// VARIABLES //////////////////// 10 | lv_obj_t *ui_Screen1; 11 | lv_obj_t *ui_ImageWatchface; 12 | lv_obj_t *ui_ImageArmHour; 13 | lv_obj_t *ui_ImageArmMinute; 14 | lv_obj_t *ui_ImageArmSecond; 15 | 16 | ///////////////////// TEST LVGL SETTINGS //////////////////// 17 | #if LV_COLOR_DEPTH != 16 18 | #error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings" 19 | #endif 20 | #if LV_COLOR_16_SWAP !=1 21 | #error "LV_COLOR_16_SWAP should be 1 to match SquareLine Studio's settings" 22 | #endif 23 | 24 | ///////////////////// ANIMATIONS //////////////////// 25 | 26 | ///////////////////// FUNCTIONS //////////////////// 27 | 28 | ///////////////////// SCREENS //////////////////// 29 | void ui_Screen1_screen_init(void) 30 | { 31 | ui_Screen1 = lv_obj_create(NULL); 32 | lv_obj_clear_flag( ui_Screen1, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 33 | 34 | ui_ImageWatchface = lv_img_create(ui_Screen1); 35 | lv_img_set_src(ui_ImageWatchface, &ui_img_watchface240_png); 36 | lv_obj_set_width( ui_ImageWatchface, LV_SIZE_CONTENT); /// 1 37 | lv_obj_set_height( ui_ImageWatchface, LV_SIZE_CONTENT); /// 1 38 | lv_obj_set_align( ui_ImageWatchface, LV_ALIGN_CENTER ); 39 | lv_obj_add_flag( ui_ImageWatchface, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 40 | lv_obj_clear_flag( ui_ImageWatchface, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 41 | 42 | ui_ImageArmHour = lv_img_create(ui_Screen1); 43 | lv_img_set_src(ui_ImageArmHour, &ui_img_armhour_png); 44 | lv_obj_set_width( ui_ImageArmHour, LV_SIZE_CONTENT); /// 1 45 | lv_obj_set_height( ui_ImageArmHour, LV_SIZE_CONTENT); /// 1 46 | lv_obj_set_x( ui_ImageArmHour, 0 ); 47 | lv_obj_set_y( ui_ImageArmHour, -35 ); 48 | lv_obj_set_align( ui_ImageArmHour, LV_ALIGN_CENTER ); 49 | lv_obj_add_flag( ui_ImageArmHour, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 50 | lv_obj_clear_flag( ui_ImageArmHour, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 51 | lv_img_set_pivot(ui_ImageArmHour,9,77); 52 | lv_img_set_angle(ui_ImageArmHour,450); 53 | 54 | ui_ImageArmMinute = lv_img_create(ui_Screen1); 55 | lv_img_set_src(ui_ImageArmMinute, &ui_img_armminute_png); 56 | lv_obj_set_width( ui_ImageArmMinute, LV_SIZE_CONTENT); /// 1 57 | lv_obj_set_height( ui_ImageArmMinute, LV_SIZE_CONTENT); /// 1 58 | lv_obj_set_x( ui_ImageArmMinute, 0 ); 59 | lv_obj_set_y( ui_ImageArmMinute, -49 ); 60 | lv_obj_set_align( ui_ImageArmMinute, LV_ALIGN_CENTER ); 61 | lv_obj_add_flag( ui_ImageArmMinute, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 62 | lv_obj_clear_flag( ui_ImageArmMinute, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 63 | lv_img_set_pivot(ui_ImageArmMinute,9,105); 64 | lv_img_set_angle(ui_ImageArmMinute,1800); 65 | 66 | ui_ImageArmSecond = lv_img_create(ui_Screen1); 67 | lv_img_set_src(ui_ImageArmSecond, &ui_img_armsecond_png); 68 | lv_obj_set_width( ui_ImageArmSecond, LV_SIZE_CONTENT); /// 1 69 | lv_obj_set_height( ui_ImageArmSecond, LV_SIZE_CONTENT); /// 1 70 | lv_obj_set_x( ui_ImageArmSecond, 0 ); 71 | lv_obj_set_y( ui_ImageArmSecond, -47 ); 72 | lv_obj_set_align( ui_ImageArmSecond, LV_ALIGN_CENTER ); 73 | lv_obj_add_flag( ui_ImageArmSecond, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 74 | lv_obj_clear_flag( ui_ImageArmSecond, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 75 | lv_img_set_pivot(ui_ImageArmSecond,5,115); 76 | lv_img_set_angle(ui_ImageArmSecond,3150); 77 | 78 | } 79 | 80 | void ui_init( void ) 81 | { 82 | lv_disp_t *dispp = lv_disp_get_default(); 83 | lv_theme_t *theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), true, LV_FONT_DEFAULT); 84 | lv_disp_set_theme(dispp, theme); 85 | ui_Screen1_screen_init(); 86 | lv_disp_load_scr( ui_Screen1); 87 | } 88 | -------------------------------------------------------------------------------- /LVGL_Watchface_240/ui.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_H 7 | #define _SQUARELINE_PROJECT_UI_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #if defined __has_include 14 | #if __has_include("lvgl.h") 15 | #include "lvgl.h" 16 | #elif __has_include("lvgl/lvgl.h") 17 | #include "lvgl/lvgl.h" 18 | #else 19 | #include "lvgl.h" 20 | #endif 21 | #else 22 | #include "lvgl.h" 23 | #endif 24 | 25 | extern lv_obj_t *ui_Screen1; 26 | extern lv_obj_t *ui_ImageWatchface; 27 | extern lv_obj_t *ui_ImageArmHour; 28 | extern lv_obj_t *ui_ImageArmMinute; 29 | extern lv_obj_t *ui_ImageArmSecond; 30 | 31 | 32 | LV_IMG_DECLARE( ui_img_watchface240_png); // assets/watchface240.png 33 | LV_IMG_DECLARE( ui_img_armhour_png); // assets/armHour.png 34 | LV_IMG_DECLARE( ui_img_armminute_png); // assets/armMinute.png 35 | LV_IMG_DECLARE( ui_img_armsecond_png); // assets/armSecond.png 36 | 37 | 38 | 39 | 40 | void ui_init(void); 41 | 42 | #ifdef __cplusplus 43 | } /*extern "C"*/ 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /LVGL_Watchface_240/ui_helpers.c: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #include "ui_helpers.h" 7 | 8 | void _ui_bar_set_property( lv_obj_t *target, int id, int val) 9 | { 10 | if (id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON); 11 | if (id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF); 12 | } 13 | 14 | void _ui_basic_set_property( lv_obj_t *target, int id, int val) 15 | { 16 | if (id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val); 17 | if (id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val); 18 | if (id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val); 19 | if (id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val); 20 | } 21 | 22 | 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val) 24 | { 25 | if (id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val); 26 | } 27 | 28 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val) 29 | { 30 | if (id == _UI_IMAGE_PROPERTY_IMAGE) lv_img_set_src(target, val); 31 | } 32 | 33 | void _ui_label_set_property( lv_obj_t *target, int id, char *val) 34 | { 35 | if (id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val); 36 | } 37 | 38 | 39 | void _ui_roller_set_property( lv_obj_t *target, int id, int val) 40 | { 41 | if (id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON); 42 | if (id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF); 43 | } 44 | 45 | void _ui_slider_set_property( lv_obj_t *target, int id, int val) 46 | { 47 | if (id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON); 48 | if (id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF); 49 | } 50 | 51 | 52 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay) 53 | { 54 | lv_scr_load_anim(target, fademode, spd, delay, false); 55 | } 56 | 57 | void _ui_arc_increment( lv_obj_t *target, int val) 58 | { 59 | int old = lv_arc_get_value(target); 60 | lv_arc_set_value(target, old+val); 61 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 62 | } 63 | 64 | void _ui_bar_increment( lv_obj_t *target, int val, int anm) 65 | { 66 | int old = lv_bar_get_value(target); 67 | lv_bar_set_value(target, old+val, anm); 68 | } 69 | 70 | void _ui_slider_increment( lv_obj_t *target, int val, int anm) 71 | { 72 | int old = lv_slider_get_value(target); 73 | lv_slider_set_value(target, old+val, anm); 74 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 75 | } 76 | 77 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea) 78 | { 79 | lv_keyboard_set_textarea(keyboard, textarea); 80 | } 81 | 82 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value) 83 | { 84 | if (value==_UI_MODIFY_FLAG_TOGGLE) 85 | { 86 | if ( lv_obj_has_flag(target,flag) ) lv_obj_clear_flag(target,flag); 87 | else lv_obj_add_flag(target,flag); 88 | } 89 | else if (value==_UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target,flag); 90 | else lv_obj_clear_flag(target,flag); 91 | } 92 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value) 93 | { 94 | if (value==_UI_MODIFY_STATE_TOGGLE) 95 | { 96 | if ( lv_obj_has_state(target,state) ) lv_obj_clear_state(target,state); 97 | else lv_obj_add_state(target,state); 98 | } 99 | else if (value==_UI_MODIFY_STATE_ADD) lv_obj_add_state(target,state); 100 | else lv_obj_clear_state(target,state); 101 | } 102 | 103 | void _ui_opacity_set( lv_obj_t *target, int val) 104 | { 105 | lv_obj_set_style_opa(target, val, 0); 106 | } 107 | 108 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v) 109 | { 110 | lv_obj_set_x((lv_obj_t *)a->user_data, v); 111 | } 112 | 113 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v) 114 | { 115 | lv_obj_set_y((lv_obj_t *)a->user_data, v); 116 | } 117 | 118 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v) 119 | { 120 | lv_obj_set_width((lv_obj_t *)a->user_data, v); 121 | } 122 | 123 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v) 124 | { 125 | lv_obj_set_height((lv_obj_t *)a->user_data, v); 126 | } 127 | 128 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v) 129 | { 130 | lv_obj_set_style_opa((lv_obj_t *)a->user_data, v, 0); 131 | } 132 | 133 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v) 134 | { 135 | lv_img_set_zoom((lv_obj_t *)a->user_data, v); 136 | } 137 | 138 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v) 139 | { 140 | lv_img_set_angle((lv_obj_t *)a->user_data, v); 141 | } 142 | 143 | 144 | int32_t _ui_anim_callback_get_x(lv_anim_t* a) 145 | { 146 | return lv_obj_get_x_aligned((lv_obj_t *)a->user_data); 147 | } 148 | 149 | int32_t _ui_anim_callback_get_y(lv_anim_t* a) 150 | { 151 | return lv_obj_get_y_aligned((lv_obj_t *)a->user_data); 152 | } 153 | 154 | int32_t _ui_anim_callback_get_width(lv_anim_t* a) 155 | { 156 | return lv_obj_get_width((lv_obj_t *)a->user_data); 157 | } 158 | 159 | int32_t _ui_anim_callback_get_height(lv_anim_t* a) 160 | { 161 | return lv_obj_get_height((lv_obj_t *)a->user_data); 162 | } 163 | 164 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a) 165 | { 166 | return lv_obj_get_style_opa((lv_obj_t *)a->user_data, 0); 167 | } 168 | 169 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a) 170 | { 171 | return lv_img_get_zoom((lv_obj_t *)a->user_data); 172 | } 173 | 174 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a) 175 | { 176 | return lv_img_get_angle((lv_obj_t *)a->user_data); 177 | } 178 | 179 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 180 | { 181 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 182 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix); 183 | lv_label_set_text(trg, buf); 184 | } 185 | 186 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 187 | { 188 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 189 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix); 190 | lv_label_set_text(trg, buf); 191 | } 192 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off) 193 | { 194 | if (lv_obj_has_state(src,LV_STATE_CHECKED)) lv_label_set_text(trg,txt_on); 195 | else lv_label_set_text(trg,txt_off); 196 | } 197 | 198 | 199 | -------------------------------------------------------------------------------- /LVGL_Watchface_240/ui_helpers.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_HELPERS_H 7 | #define _SQUARELINE_PROJECT_UI_HELPERS_H 8 | 9 | #include "ui.h" 10 | 11 | #define _UI_TEMPORARY_STRING_BUFFER_SIZE 32 12 | #define _UI_BAR_PROPERTY_VALUE 0 13 | #define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1 14 | void _ui_bar_set_property( lv_obj_t *target, int id, int val); 15 | 16 | #define _UI_BASIC_PROPERTY_POSITION_X 0 17 | #define _UI_BASIC_PROPERTY_POSITION_Y 1 18 | #define _UI_BASIC_PROPERTY_WIDTH 2 19 | #define _UI_BASIC_PROPERTY_HEIGHT 3 20 | void _ui_basic_set_property( lv_obj_t *target, int id, int val); 21 | 22 | #define _UI_DROPDOWN_PROPERTY_SELECTED 0 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val); 24 | 25 | #define _UI_IMAGE_PROPERTY_IMAGE 0 26 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val); 27 | 28 | #define _UI_LABEL_PROPERTY_TEXT 0 29 | void _ui_label_set_property( lv_obj_t *target, int id, char *val); 30 | 31 | #define _UI_ROLLER_PROPERTY_SELECTED 0 32 | #define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1 33 | void _ui_roller_set_property( lv_obj_t *target, int id, int val); 34 | 35 | #define _UI_SLIDER_PROPERTY_VALUE 0 36 | #define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1 37 | void _ui_slider_set_property( lv_obj_t *target, int id, int val); 38 | 39 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay); 40 | 41 | void _ui_arc_increment( lv_obj_t *target, int val); 42 | 43 | void _ui_bar_increment( lv_obj_t *target, int val, int anm); 44 | 45 | void _ui_slider_increment( lv_obj_t *target, int val, int anm); 46 | 47 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea); 48 | 49 | #define _UI_MODIFY_FLAG_ADD 0 50 | #define _UI_MODIFY_FLAG_REMOVE 1 51 | #define _UI_MODIFY_FLAG_TOGGLE 2 52 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value); 53 | 54 | #define _UI_MODIFY_STATE_ADD 0 55 | #define _UI_MODIFY_STATE_REMOVE 1 56 | #define _UI_MODIFY_STATE_TOGGLE 2 57 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value); 58 | 59 | void _ui_opacity_set( lv_obj_t *target, int val); 60 | 61 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v); 62 | 63 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v); 64 | 65 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v); 66 | 67 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v); 68 | 69 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v); 70 | 71 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v); 72 | 73 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v); 74 | 75 | int32_t _ui_anim_callback_get_x(lv_anim_t* a); 76 | 77 | int32_t _ui_anim_callback_get_y(lv_anim_t* a); 78 | 79 | int32_t _ui_anim_callback_get_width(lv_anim_t* a); 80 | 81 | int32_t _ui_anim_callback_get_height(lv_anim_t* a); 82 | 83 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a); 84 | 85 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a); 86 | 87 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a); 88 | 89 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 90 | 91 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 92 | 93 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off); 94 | 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_GIF/data/star_wars_stormtrooper_80.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/LVGL_Watchface_240_GIF/data/star_wars_stormtrooper_80.gif -------------------------------------------------------------------------------- /LVGL_Watchface_240_GIF/ui.c: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #include "ui.h" 7 | #include "ui_helpers.h" 8 | 9 | ///////////////////// VARIABLES //////////////////// 10 | lv_obj_t *ui_Screen1; 11 | lv_obj_t *ui_ImageWatchface; 12 | lv_obj_t *ui_Image1; 13 | lv_obj_t *ui_ImageArmHour; 14 | lv_obj_t *ui_ImageArmMinute; 15 | lv_obj_t *ui_ImageArmSecond; 16 | 17 | ///////////////////// TEST LVGL SETTINGS //////////////////// 18 | #if LV_COLOR_DEPTH != 16 19 | #error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings" 20 | #endif 21 | #if LV_COLOR_16_SWAP !=1 22 | #error "LV_COLOR_16_SWAP should be 1 to match SquareLine Studio's settings" 23 | #endif 24 | 25 | ///////////////////// ANIMATIONS //////////////////// 26 | 27 | ///////////////////// FUNCTIONS //////////////////// 28 | 29 | ///////////////////// SCREENS //////////////////// 30 | void ui_Screen1_screen_init(void) 31 | { 32 | ui_Screen1 = lv_obj_create(NULL); 33 | lv_obj_clear_flag( ui_Screen1, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 34 | 35 | ui_ImageWatchface = lv_img_create(ui_Screen1); 36 | lv_img_set_src(ui_ImageWatchface, &ui_img_watchface240_png); 37 | lv_obj_set_width( ui_ImageWatchface, LV_SIZE_CONTENT); /// 1 38 | lv_obj_set_height( ui_ImageWatchface, LV_SIZE_CONTENT); /// 1 39 | lv_obj_set_align( ui_ImageWatchface, LV_ALIGN_CENTER ); 40 | lv_obj_add_flag( ui_ImageWatchface, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 41 | lv_obj_clear_flag( ui_ImageWatchface, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 42 | 43 | ui_Image1 = lv_canvas_create(ui_Screen1); 44 | lv_obj_set_width( ui_Image1, LV_SIZE_CONTENT); /// 1 45 | lv_obj_set_height( ui_Image1, LV_SIZE_CONTENT); /// 1 46 | lv_obj_set_x( ui_Image1, 0 ); 47 | lv_obj_set_y( ui_Image1, 50 ); 48 | lv_obj_set_align( ui_Image1, LV_ALIGN_CENTER ); 49 | lv_obj_add_flag( ui_Image1, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 50 | lv_obj_clear_flag( ui_Image1, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 51 | 52 | ui_ImageArmHour = lv_img_create(ui_Screen1); 53 | lv_img_set_src(ui_ImageArmHour, &ui_img_blaster_png); 54 | lv_obj_set_width( ui_ImageArmHour, LV_SIZE_CONTENT); /// 1 55 | lv_obj_set_height( ui_ImageArmHour, LV_SIZE_CONTENT); /// 1 56 | lv_obj_set_x( ui_ImageArmHour, -4 ); 57 | lv_obj_set_y( ui_ImageArmHour, -26 ); 58 | lv_obj_set_align( ui_ImageArmHour, LV_ALIGN_CENTER ); 59 | lv_obj_add_flag( ui_ImageArmHour, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 60 | lv_obj_clear_flag( ui_ImageArmHour, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 61 | lv_img_set_pivot(ui_ImageArmHour,17,56); 62 | lv_img_set_angle(ui_ImageArmHour,750); 63 | 64 | ui_ImageArmMinute = lv_img_create(ui_Screen1); 65 | lv_img_set_src(ui_ImageArmMinute, &ui_img_dlt19x_png); 66 | lv_obj_set_width( ui_ImageArmMinute, LV_SIZE_CONTENT); /// 1 67 | lv_obj_set_height( ui_ImageArmMinute, LV_SIZE_CONTENT); /// 1 68 | lv_obj_set_x( ui_ImageArmMinute, 1 ); 69 | lv_obj_set_y( ui_ImageArmMinute, -45 ); 70 | lv_obj_set_align( ui_ImageArmMinute, LV_ALIGN_CENTER ); 71 | lv_obj_add_flag( ui_ImageArmMinute, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 72 | lv_obj_clear_flag( ui_ImageArmMinute, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 73 | lv_img_set_pivot(ui_ImageArmMinute,11,105); 74 | lv_img_set_angle(ui_ImageArmMinute,1800); 75 | 76 | ui_ImageArmSecond = lv_img_create(ui_Screen1); 77 | lv_img_set_src(ui_ImageArmSecond, &ui_img_lightsaber_png); 78 | lv_obj_set_width( ui_ImageArmSecond, LV_SIZE_CONTENT); /// 1 79 | lv_obj_set_height( ui_ImageArmSecond, LV_SIZE_CONTENT); /// 1 80 | lv_obj_set_x( ui_ImageArmSecond, -1 ); 81 | lv_obj_set_y( ui_ImageArmSecond, -50 ); 82 | lv_obj_set_align( ui_ImageArmSecond, LV_ALIGN_CENTER ); 83 | lv_obj_add_flag( ui_ImageArmSecond, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 84 | lv_obj_clear_flag( ui_ImageArmSecond, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 85 | lv_img_set_pivot(ui_ImageArmSecond,8,117); 86 | lv_img_set_angle(ui_ImageArmSecond,3150); 87 | 88 | } 89 | 90 | void ui_init( void ) 91 | { 92 | lv_disp_t *dispp = lv_disp_get_default(); 93 | lv_theme_t *theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), true, LV_FONT_DEFAULT); 94 | lv_disp_set_theme(dispp, theme); 95 | ui_Screen1_screen_init(); 96 | lv_disp_load_scr( ui_Screen1); 97 | } 98 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_GIF/ui.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_H 7 | #define _SQUARELINE_PROJECT_UI_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #if defined __has_include 14 | #if __has_include("lvgl.h") 15 | #include "lvgl.h" 16 | #elif __has_include("lvgl/lvgl.h") 17 | #include "lvgl/lvgl.h" 18 | #else 19 | #include "lvgl.h" 20 | #endif 21 | #else 22 | #include "lvgl.h" 23 | #endif 24 | 25 | extern lv_obj_t *ui_Screen1; 26 | extern lv_obj_t *ui_ImageWatchface; 27 | extern lv_obj_t *ui_Image1; 28 | extern lv_obj_t *ui_ImageArmHour; 29 | extern lv_obj_t *ui_ImageArmMinute; 30 | extern lv_obj_t *ui_ImageArmSecond; 31 | 32 | 33 | LV_IMG_DECLARE( ui_img_watchface240_png); // assets/watchface240.png 34 | LV_IMG_DECLARE( ui_img_blaster_png); // assets/blaster.png 35 | LV_IMG_DECLARE( ui_img_dlt19x_png); // assets/dlt19x.png 36 | LV_IMG_DECLARE( ui_img_lightsaber_png); // assets/lightsaber.png 37 | 38 | 39 | 40 | 41 | void ui_init(void); 42 | 43 | #ifdef __cplusplus 44 | } /*extern "C"*/ 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_GIF/ui_helpers.c: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #include "ui_helpers.h" 7 | 8 | void _ui_bar_set_property( lv_obj_t *target, int id, int val) 9 | { 10 | if (id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON); 11 | if (id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF); 12 | } 13 | 14 | void _ui_basic_set_property( lv_obj_t *target, int id, int val) 15 | { 16 | if (id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val); 17 | if (id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val); 18 | if (id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val); 19 | if (id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val); 20 | } 21 | 22 | 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val) 24 | { 25 | if (id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val); 26 | } 27 | 28 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val) 29 | { 30 | if (id == _UI_IMAGE_PROPERTY_IMAGE) lv_img_set_src(target, val); 31 | } 32 | 33 | void _ui_label_set_property( lv_obj_t *target, int id, char *val) 34 | { 35 | if (id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val); 36 | } 37 | 38 | 39 | void _ui_roller_set_property( lv_obj_t *target, int id, int val) 40 | { 41 | if (id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON); 42 | if (id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF); 43 | } 44 | 45 | void _ui_slider_set_property( lv_obj_t *target, int id, int val) 46 | { 47 | if (id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON); 48 | if (id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF); 49 | } 50 | 51 | 52 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay) 53 | { 54 | lv_scr_load_anim(target, fademode, spd, delay, false); 55 | } 56 | 57 | void _ui_arc_increment( lv_obj_t *target, int val) 58 | { 59 | int old = lv_arc_get_value(target); 60 | lv_arc_set_value(target, old+val); 61 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 62 | } 63 | 64 | void _ui_bar_increment( lv_obj_t *target, int val, int anm) 65 | { 66 | int old = lv_bar_get_value(target); 67 | lv_bar_set_value(target, old+val, anm); 68 | } 69 | 70 | void _ui_slider_increment( lv_obj_t *target, int val, int anm) 71 | { 72 | int old = lv_slider_get_value(target); 73 | lv_slider_set_value(target, old+val, anm); 74 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 75 | } 76 | 77 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea) 78 | { 79 | lv_keyboard_set_textarea(keyboard, textarea); 80 | } 81 | 82 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value) 83 | { 84 | if (value==_UI_MODIFY_FLAG_TOGGLE) 85 | { 86 | if ( lv_obj_has_flag(target,flag) ) lv_obj_clear_flag(target,flag); 87 | else lv_obj_add_flag(target,flag); 88 | } 89 | else if (value==_UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target,flag); 90 | else lv_obj_clear_flag(target,flag); 91 | } 92 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value) 93 | { 94 | if (value==_UI_MODIFY_STATE_TOGGLE) 95 | { 96 | if ( lv_obj_has_state(target,state) ) lv_obj_clear_state(target,state); 97 | else lv_obj_add_state(target,state); 98 | } 99 | else if (value==_UI_MODIFY_STATE_ADD) lv_obj_add_state(target,state); 100 | else lv_obj_clear_state(target,state); 101 | } 102 | 103 | void _ui_opacity_set( lv_obj_t *target, int val) 104 | { 105 | lv_obj_set_style_opa(target, val, 0); 106 | } 107 | 108 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v) 109 | { 110 | lv_obj_set_x((lv_obj_t *)a->user_data, v); 111 | } 112 | 113 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v) 114 | { 115 | lv_obj_set_y((lv_obj_t *)a->user_data, v); 116 | } 117 | 118 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v) 119 | { 120 | lv_obj_set_width((lv_obj_t *)a->user_data, v); 121 | } 122 | 123 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v) 124 | { 125 | lv_obj_set_height((lv_obj_t *)a->user_data, v); 126 | } 127 | 128 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v) 129 | { 130 | lv_obj_set_style_opa((lv_obj_t *)a->user_data, v, 0); 131 | } 132 | 133 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v) 134 | { 135 | lv_img_set_zoom((lv_obj_t *)a->user_data, v); 136 | } 137 | 138 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v) 139 | { 140 | lv_img_set_angle((lv_obj_t *)a->user_data, v); 141 | } 142 | 143 | 144 | int32_t _ui_anim_callback_get_x(lv_anim_t* a) 145 | { 146 | return lv_obj_get_x_aligned((lv_obj_t *)a->user_data); 147 | } 148 | 149 | int32_t _ui_anim_callback_get_y(lv_anim_t* a) 150 | { 151 | return lv_obj_get_y_aligned((lv_obj_t *)a->user_data); 152 | } 153 | 154 | int32_t _ui_anim_callback_get_width(lv_anim_t* a) 155 | { 156 | return lv_obj_get_width((lv_obj_t *)a->user_data); 157 | } 158 | 159 | int32_t _ui_anim_callback_get_height(lv_anim_t* a) 160 | { 161 | return lv_obj_get_height((lv_obj_t *)a->user_data); 162 | } 163 | 164 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a) 165 | { 166 | return lv_obj_get_style_opa((lv_obj_t *)a->user_data, 0); 167 | } 168 | 169 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a) 170 | { 171 | return lv_img_get_zoom((lv_obj_t *)a->user_data); 172 | } 173 | 174 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a) 175 | { 176 | return lv_img_get_angle((lv_obj_t *)a->user_data); 177 | } 178 | 179 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 180 | { 181 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 182 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix); 183 | lv_label_set_text(trg, buf); 184 | } 185 | 186 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 187 | { 188 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 189 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix); 190 | lv_label_set_text(trg, buf); 191 | } 192 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off) 193 | { 194 | if (lv_obj_has_state(src,LV_STATE_CHECKED)) lv_label_set_text(trg,txt_on); 195 | else lv_label_set_text(trg,txt_off); 196 | } 197 | 198 | 199 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_GIF/ui_helpers.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_HELPERS_H 7 | #define _SQUARELINE_PROJECT_UI_HELPERS_H 8 | 9 | #include "ui.h" 10 | 11 | #define _UI_TEMPORARY_STRING_BUFFER_SIZE 32 12 | #define _UI_BAR_PROPERTY_VALUE 0 13 | #define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1 14 | void _ui_bar_set_property( lv_obj_t *target, int id, int val); 15 | 16 | #define _UI_BASIC_PROPERTY_POSITION_X 0 17 | #define _UI_BASIC_PROPERTY_POSITION_Y 1 18 | #define _UI_BASIC_PROPERTY_WIDTH 2 19 | #define _UI_BASIC_PROPERTY_HEIGHT 3 20 | void _ui_basic_set_property( lv_obj_t *target, int id, int val); 21 | 22 | #define _UI_DROPDOWN_PROPERTY_SELECTED 0 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val); 24 | 25 | #define _UI_IMAGE_PROPERTY_IMAGE 0 26 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val); 27 | 28 | #define _UI_LABEL_PROPERTY_TEXT 0 29 | void _ui_label_set_property( lv_obj_t *target, int id, char *val); 30 | 31 | #define _UI_ROLLER_PROPERTY_SELECTED 0 32 | #define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1 33 | void _ui_roller_set_property( lv_obj_t *target, int id, int val); 34 | 35 | #define _UI_SLIDER_PROPERTY_VALUE 0 36 | #define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1 37 | void _ui_slider_set_property( lv_obj_t *target, int id, int val); 38 | 39 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay); 40 | 41 | void _ui_arc_increment( lv_obj_t *target, int val); 42 | 43 | void _ui_bar_increment( lv_obj_t *target, int val, int anm); 44 | 45 | void _ui_slider_increment( lv_obj_t *target, int val, int anm); 46 | 47 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea); 48 | 49 | #define _UI_MODIFY_FLAG_ADD 0 50 | #define _UI_MODIFY_FLAG_REMOVE 1 51 | #define _UI_MODIFY_FLAG_TOGGLE 2 52 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value); 53 | 54 | #define _UI_MODIFY_STATE_ADD 0 55 | #define _UI_MODIFY_STATE_REMOVE 1 56 | #define _UI_MODIFY_STATE_TOGGLE 2 57 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value); 58 | 59 | void _ui_opacity_set( lv_obj_t *target, int val); 60 | 61 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v); 62 | 63 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v); 64 | 65 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v); 66 | 67 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v); 68 | 69 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v); 70 | 71 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v); 72 | 73 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v); 74 | 75 | int32_t _ui_anim_callback_get_x(lv_anim_t* a); 76 | 77 | int32_t _ui_anim_callback_get_y(lv_anim_t* a); 78 | 79 | int32_t _ui_anim_callback_get_width(lv_anim_t* a); 80 | 81 | int32_t _ui_anim_callback_get_height(lv_anim_t* a); 82 | 83 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a); 84 | 85 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a); 86 | 87 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a); 88 | 89 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 90 | 91 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 92 | 93 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off); 94 | 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_RP2040/LVGL_Watchface_240_RP2040.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * LVGL Watchface 3 | * 4 | * Anchor escapement video source: 5 | * https://www.youtube.com/watch?v=d_pV8TGKfMc 6 | * 7 | * Image by macrovector on Freepik: 8 | * https://www.freepik.com/free-vector/watch-set-expensive-classic-clock-with-leather-metal-straps-illustration_13031503.htm 9 | * 10 | * Dependent libraries: 11 | * LVGL: https://github.com/lvgl/lvgl.git 12 | * 13 | * LVGL Configuration file: 14 | * Copy your_arduino_path/libraries/lvgl/lv_conf_template.h 15 | * to your_arduino_path/libraries/lv_conf.h 16 | * 17 | * In lv_conf.h around line 15, enable config file: 18 | * #if 1 // Set it to "1" to enable content 19 | * 20 | * Then find and set: 21 | * #define LV_COLOR_DEPTH 16 22 | * #define LV_TICK_CUSTOM 1 23 | * 24 | * For SPI/parallel 8 display set color swap can be faster, parallel 16/RGB screen don't swap! 25 | * #define LV_COLOR_16_SWAP 1 // for SPI and parallel 8 26 | * #define LV_COLOR_16_SWAP 0 // for parallel 16 and RGB 27 | ******************************************************************************/ 28 | #include 29 | #include "ui.h" 30 | 31 | /******************************************************************************* 32 | * Start of Arduino_GFX setting 33 | ******************************************************************************/ 34 | #include 35 | #define GFX_BL 25 36 | /* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */ 37 | Arduino_DataBus *bus = new Arduino_RPiPicoSPI(8 /* DC */, 9 /* CS */, 10 /* SCK */, 11 /* MOSI */, 12 /* MISO */, spi1 /* spi */); 38 | /* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */ 39 | Arduino_GFX *gfx = new Arduino_GC9A01(bus, 12, 0 /* rotation */, true /* IPS */); 40 | /******************************************************************************* 41 | * End of Arduino_GFX setting 42 | ******************************************************************************/ 43 | 44 | // use compile time for demo only 45 | #define ONE_MINUTE_MS (60 * 1000) 46 | #define ONE_HOUR_MS (60 * 60 * 1000) 47 | #define TWELVE_HOUR_MS (12 * 60 * 60 * 1000) 48 | static uint8_t conv2d(const char *p) 49 | { 50 | uint8_t v = 0; 51 | return (10 * (*p - '0')) + (*++p - '0'); 52 | } 53 | static unsigned long ms_offset; 54 | 55 | static uint32_t screenWidth; 56 | static uint32_t screenHeight; 57 | static lv_disp_draw_buf_t draw_buf; 58 | static lv_color_t *disp_draw_buf; 59 | static lv_disp_drv_t disp_drv; 60 | 61 | static uint8_t curr_anchor_idx = 0; 62 | static int16_t curr_anchor_angle = 0; 63 | static lv_obj_t *anchors[8]; 64 | static unsigned long anchor_next_frame_ms; 65 | #define ANCHOR_FPS 25 66 | 67 | /* Display flushing */ 68 | void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) 69 | { 70 | uint32_t w = (area->x2 - area->x1 + 1); 71 | uint32_t h = (area->y2 - area->y1 + 1); 72 | 73 | #if (LV_COLOR_16_SWAP != 0) 74 | gfx->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h); 75 | #else 76 | gfx->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h); 77 | #endif 78 | 79 | lv_disp_flush_ready(disp); 80 | } 81 | 82 | void my_log_cb(const char *buf) 83 | { 84 | Serial.println(buf); 85 | } 86 | 87 | void setup() 88 | { 89 | // use compile time for demo only 90 | uint8_t hh = conv2d(__TIME__); 91 | uint8_t mm = conv2d(__TIME__ + 3); 92 | uint8_t ss = conv2d(__TIME__ + 6); 93 | ms_offset = ((60 * 60 * hh) + (60 * mm) + ss) * 1000; 94 | 95 | Serial.begin(115200); 96 | // Serial.setDebugOutput(true); 97 | // while(!Serial); 98 | Serial.println("LVGL Watchface"); 99 | 100 | #ifdef GFX_EXTRA_PRE_INIT 101 | GFX_EXTRA_PRE_INIT(); 102 | #endif 103 | 104 | // Init Display 105 | gfx->begin(); 106 | gfx->fillScreen(BLACK); 107 | 108 | #ifdef GFX_BL 109 | pinMode(GFX_BL, OUTPUT); 110 | // digitalWrite(GFX_BL, HIGH); 111 | analogWrite(GFX_BL, 127); 112 | #endif 113 | 114 | #if LV_USE_LOG 115 | lv_log_register_print_cb(my_log_cb); 116 | #endif 117 | 118 | lv_init(); 119 | 120 | screenWidth = gfx->width(); 121 | screenHeight = gfx->height(); 122 | #ifdef ESP32 123 | disp_draw_buf = (lv_color_t *)heap_caps_malloc(sizeof(lv_color_t) * screenWidth * 32, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); 124 | #else 125 | disp_draw_buf = (lv_color_t *)malloc(sizeof(lv_color_t) * screenWidth * 32); 126 | #endif 127 | if (!disp_draw_buf) 128 | { 129 | Serial.println("LVGL disp_draw_buf allocate failed!"); 130 | } 131 | else 132 | { 133 | lv_disp_draw_buf_init(&draw_buf, disp_draw_buf, NULL, screenWidth * 32); 134 | 135 | /* Initialize the display */ 136 | lv_disp_drv_init(&disp_drv); 137 | /* Change the following line to your display resolution */ 138 | disp_drv.hor_res = screenWidth; 139 | disp_drv.ver_res = screenHeight; 140 | disp_drv.flush_cb = my_disp_flush; 141 | disp_drv.draw_buf = &draw_buf; 142 | lv_disp_drv_register(&disp_drv); 143 | 144 | /* Initialize the (dummy) input device driver */ 145 | static lv_indev_drv_t indev_drv; 146 | lv_indev_drv_init(&indev_drv); 147 | indev_drv.type = LV_INDEV_TYPE_POINTER; 148 | lv_indev_drv_register(&indev_drv); 149 | 150 | /* Init SquareLine prepared UI */ 151 | ui_init(); 152 | 153 | /* assign images to array after ui_init() */ 154 | anchors[0] = ui_Image1; 155 | anchors[1] = ui_Image2; 156 | anchors[2] = ui_Image3; 157 | anchors[3] = ui_Image4; 158 | anchors[4] = ui_Image5; 159 | anchors[5] = ui_Image6; 160 | anchors[6] = ui_Image7; 161 | anchors[7] = ui_Image8; 162 | 163 | Serial.println("Setup done"); 164 | } 165 | } 166 | 167 | void loop() 168 | { 169 | lv_timer_handler(); /* let the GUI do its work */ 170 | 171 | unsigned long ms = millis(); 172 | 173 | // handle anchor escapement movement 174 | if (ms >= anchor_next_frame_ms) 175 | { 176 | uint8_t next_anchor_idx = curr_anchor_idx + 1; 177 | if (next_anchor_idx > 7) 178 | { 179 | next_anchor_idx = 0; 180 | } 181 | 182 | // show next image then hide current image 183 | lv_obj_clear_flag(anchors[next_anchor_idx], LV_OBJ_FLAG_HIDDEN); 184 | lv_obj_add_flag(anchors[curr_anchor_idx], LV_OBJ_FLAG_HIDDEN); 185 | 186 | curr_anchor_idx = next_anchor_idx; 187 | anchor_next_frame_ms += (1000 / ANCHOR_FPS); 188 | } 189 | 190 | // set watch arms' angle 191 | unsigned long clock_ms = (ms_offset + ms) % TWELVE_HOUR_MS; 192 | uint8_t hour = clock_ms / ONE_HOUR_MS; 193 | uint8_t minute = (clock_ms % ONE_HOUR_MS) / ONE_MINUTE_MS; 194 | int16_t angle = (clock_ms % ONE_MINUTE_MS) * 3600 / ONE_MINUTE_MS; 195 | lv_img_set_angle(ui_ImageArmSecond, angle); 196 | angle = (angle + (minute * 3600)) / 60; 197 | lv_img_set_angle(ui_ImageArmMinute, angle); 198 | angle = (angle + (hour * 3600)) / 12; 199 | lv_img_set_angle(ui_ImageArmHour, angle); 200 | } 201 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_RP2040/ui.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_H 7 | #define _SQUARELINE_PROJECT_UI_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #if defined __has_include 14 | #if __has_include("lvgl.h") 15 | #include "lvgl.h" 16 | #elif __has_include("lvgl/lvgl.h") 17 | #include "lvgl/lvgl.h" 18 | #else 19 | #include "lvgl.h" 20 | #endif 21 | #else 22 | #include "lvgl.h" 23 | #endif 24 | 25 | extern lv_obj_t *ui_Screen1; 26 | extern lv_obj_t *ui_ImageWatchface; 27 | extern lv_obj_t *ui_Image1; 28 | extern lv_obj_t *ui_Image2; 29 | extern lv_obj_t *ui_Image3; 30 | extern lv_obj_t *ui_Image4; 31 | extern lv_obj_t *ui_Image5; 32 | extern lv_obj_t *ui_Image6; 33 | extern lv_obj_t *ui_Image7; 34 | extern lv_obj_t *ui_Image8; 35 | extern lv_obj_t *ui_ImageArmHour; 36 | extern lv_obj_t *ui_ImageArmMinute; 37 | extern lv_obj_t *ui_ImageArmSecond; 38 | 39 | 40 | LV_IMG_DECLARE( ui_img_watchface240_png); // assets/watchface240.png 41 | LV_IMG_DECLARE( ui_img_out1_png); // assets/out1.png 42 | LV_IMG_DECLARE( ui_img_out2_png); // assets/out2.png 43 | LV_IMG_DECLARE( ui_img_out3_png); // assets/out3.png 44 | LV_IMG_DECLARE( ui_img_out4_png); // assets/out4.png 45 | LV_IMG_DECLARE( ui_img_out5_png); // assets/out5.png 46 | LV_IMG_DECLARE( ui_img_out6_png); // assets/out6.png 47 | LV_IMG_DECLARE( ui_img_out7_png); // assets/out7.png 48 | LV_IMG_DECLARE( ui_img_out8_png); // assets/out8.png 49 | LV_IMG_DECLARE( ui_img_armhour_png); // assets/armHour.png 50 | LV_IMG_DECLARE( ui_img_armminute_png); // assets/armMinute.png 51 | LV_IMG_DECLARE( ui_img_armsecond_png); // assets/armSecond.png 52 | 53 | 54 | 55 | 56 | void ui_init(void); 57 | 58 | #ifdef __cplusplus 59 | } /*extern "C"*/ 60 | #endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_RP2040/ui_helpers.c: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #include "ui_helpers.h" 7 | 8 | void _ui_bar_set_property( lv_obj_t *target, int id, int val) 9 | { 10 | if (id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON); 11 | if (id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF); 12 | } 13 | 14 | void _ui_basic_set_property( lv_obj_t *target, int id, int val) 15 | { 16 | if (id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val); 17 | if (id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val); 18 | if (id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val); 19 | if (id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val); 20 | } 21 | 22 | 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val) 24 | { 25 | if (id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val); 26 | } 27 | 28 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val) 29 | { 30 | if (id == _UI_IMAGE_PROPERTY_IMAGE) lv_img_set_src(target, val); 31 | } 32 | 33 | void _ui_label_set_property( lv_obj_t *target, int id, char *val) 34 | { 35 | if (id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val); 36 | } 37 | 38 | 39 | void _ui_roller_set_property( lv_obj_t *target, int id, int val) 40 | { 41 | if (id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON); 42 | if (id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF); 43 | } 44 | 45 | void _ui_slider_set_property( lv_obj_t *target, int id, int val) 46 | { 47 | if (id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON); 48 | if (id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF); 49 | } 50 | 51 | 52 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay) 53 | { 54 | lv_scr_load_anim(target, fademode, spd, delay, false); 55 | } 56 | 57 | void _ui_arc_increment( lv_obj_t *target, int val) 58 | { 59 | int old = lv_arc_get_value(target); 60 | lv_arc_set_value(target, old+val); 61 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 62 | } 63 | 64 | void _ui_bar_increment( lv_obj_t *target, int val, int anm) 65 | { 66 | int old = lv_bar_get_value(target); 67 | lv_bar_set_value(target, old+val, anm); 68 | } 69 | 70 | void _ui_slider_increment( lv_obj_t *target, int val, int anm) 71 | { 72 | int old = lv_slider_get_value(target); 73 | lv_slider_set_value(target, old+val, anm); 74 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 75 | } 76 | 77 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea) 78 | { 79 | lv_keyboard_set_textarea(keyboard, textarea); 80 | } 81 | 82 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value) 83 | { 84 | if (value==_UI_MODIFY_FLAG_TOGGLE) 85 | { 86 | if ( lv_obj_has_flag(target,flag) ) lv_obj_clear_flag(target,flag); 87 | else lv_obj_add_flag(target,flag); 88 | } 89 | else if (value==_UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target,flag); 90 | else lv_obj_clear_flag(target,flag); 91 | } 92 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value) 93 | { 94 | if (value==_UI_MODIFY_STATE_TOGGLE) 95 | { 96 | if ( lv_obj_has_state(target,state) ) lv_obj_clear_state(target,state); 97 | else lv_obj_add_state(target,state); 98 | } 99 | else if (value==_UI_MODIFY_STATE_ADD) lv_obj_add_state(target,state); 100 | else lv_obj_clear_state(target,state); 101 | } 102 | 103 | void _ui_opacity_set( lv_obj_t *target, int val) 104 | { 105 | lv_obj_set_style_opa(target, val, 0); 106 | } 107 | 108 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v) 109 | { 110 | lv_obj_set_x((lv_obj_t *)a->user_data, v); 111 | } 112 | 113 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v) 114 | { 115 | lv_obj_set_y((lv_obj_t *)a->user_data, v); 116 | } 117 | 118 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v) 119 | { 120 | lv_obj_set_width((lv_obj_t *)a->user_data, v); 121 | } 122 | 123 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v) 124 | { 125 | lv_obj_set_height((lv_obj_t *)a->user_data, v); 126 | } 127 | 128 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v) 129 | { 130 | lv_obj_set_style_opa((lv_obj_t *)a->user_data, v, 0); 131 | } 132 | 133 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v) 134 | { 135 | lv_img_set_zoom((lv_obj_t *)a->user_data, v); 136 | } 137 | 138 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v) 139 | { 140 | lv_img_set_angle((lv_obj_t *)a->user_data, v); 141 | } 142 | 143 | 144 | int32_t _ui_anim_callback_get_x(lv_anim_t* a) 145 | { 146 | return lv_obj_get_x_aligned((lv_obj_t *)a->user_data); 147 | } 148 | 149 | int32_t _ui_anim_callback_get_y(lv_anim_t* a) 150 | { 151 | return lv_obj_get_y_aligned((lv_obj_t *)a->user_data); 152 | } 153 | 154 | int32_t _ui_anim_callback_get_width(lv_anim_t* a) 155 | { 156 | return lv_obj_get_width((lv_obj_t *)a->user_data); 157 | } 158 | 159 | int32_t _ui_anim_callback_get_height(lv_anim_t* a) 160 | { 161 | return lv_obj_get_height((lv_obj_t *)a->user_data); 162 | } 163 | 164 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a) 165 | { 166 | return lv_obj_get_style_opa((lv_obj_t *)a->user_data, 0); 167 | } 168 | 169 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a) 170 | { 171 | return lv_img_get_zoom((lv_obj_t *)a->user_data); 172 | } 173 | 174 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a) 175 | { 176 | return lv_img_get_angle((lv_obj_t *)a->user_data); 177 | } 178 | 179 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 180 | { 181 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 182 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix); 183 | lv_label_set_text(trg, buf); 184 | } 185 | 186 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 187 | { 188 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 189 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix); 190 | lv_label_set_text(trg, buf); 191 | } 192 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off) 193 | { 194 | if (lv_obj_has_state(src,LV_STATE_CHECKED)) lv_label_set_text(trg,txt_on); 195 | else lv_label_set_text(trg,txt_off); 196 | } 197 | 198 | 199 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_RP2040/ui_helpers.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_HELPERS_H 7 | #define _SQUARELINE_PROJECT_UI_HELPERS_H 8 | 9 | #include "ui.h" 10 | 11 | #define _UI_TEMPORARY_STRING_BUFFER_SIZE 32 12 | #define _UI_BAR_PROPERTY_VALUE 0 13 | #define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1 14 | void _ui_bar_set_property( lv_obj_t *target, int id, int val); 15 | 16 | #define _UI_BASIC_PROPERTY_POSITION_X 0 17 | #define _UI_BASIC_PROPERTY_POSITION_Y 1 18 | #define _UI_BASIC_PROPERTY_WIDTH 2 19 | #define _UI_BASIC_PROPERTY_HEIGHT 3 20 | void _ui_basic_set_property( lv_obj_t *target, int id, int val); 21 | 22 | #define _UI_DROPDOWN_PROPERTY_SELECTED 0 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val); 24 | 25 | #define _UI_IMAGE_PROPERTY_IMAGE 0 26 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val); 27 | 28 | #define _UI_LABEL_PROPERTY_TEXT 0 29 | void _ui_label_set_property( lv_obj_t *target, int id, char *val); 30 | 31 | #define _UI_ROLLER_PROPERTY_SELECTED 0 32 | #define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1 33 | void _ui_roller_set_property( lv_obj_t *target, int id, int val); 34 | 35 | #define _UI_SLIDER_PROPERTY_VALUE 0 36 | #define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1 37 | void _ui_slider_set_property( lv_obj_t *target, int id, int val); 38 | 39 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay); 40 | 41 | void _ui_arc_increment( lv_obj_t *target, int val); 42 | 43 | void _ui_bar_increment( lv_obj_t *target, int val, int anm); 44 | 45 | void _ui_slider_increment( lv_obj_t *target, int val, int anm); 46 | 47 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea); 48 | 49 | #define _UI_MODIFY_FLAG_ADD 0 50 | #define _UI_MODIFY_FLAG_REMOVE 1 51 | #define _UI_MODIFY_FLAG_TOGGLE 2 52 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value); 53 | 54 | #define _UI_MODIFY_STATE_ADD 0 55 | #define _UI_MODIFY_STATE_REMOVE 1 56 | #define _UI_MODIFY_STATE_TOGGLE 2 57 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value); 58 | 59 | void _ui_opacity_set( lv_obj_t *target, int val); 60 | 61 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v); 62 | 63 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v); 64 | 65 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v); 66 | 67 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v); 68 | 69 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v); 70 | 71 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v); 72 | 73 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v); 74 | 75 | int32_t _ui_anim_callback_get_x(lv_anim_t* a); 76 | 77 | int32_t _ui_anim_callback_get_y(lv_anim_t* a); 78 | 79 | int32_t _ui_anim_callback_get_width(lv_anim_t* a); 80 | 81 | int32_t _ui_anim_callback_get_height(lv_anim_t* a); 82 | 83 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a); 84 | 85 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a); 86 | 87 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a); 88 | 89 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 90 | 91 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 92 | 93 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off); 94 | 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_Stormtrooper/LVGL_Watchface_240_Stormtrooper.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * LVGL Watchface 3 | * 4 | * GIF animation from: 5 | * https://giphy.com/gifs/illustration-vector-xTiTnJK44NXT46iKYM 6 | * 7 | * Image from: 8 | * https://en.m.wikipedia.org/wiki/File:Dueling_lightsabers.svg 9 | * https://battlefront.fandom.com/wiki/DLT-19X 10 | * https://www.onlinewebfonts.com/icon/555311 11 | * 12 | * Dependent libraries: 13 | * LVGL: https://github.com/lvgl/lvgl.git 14 | * 15 | * LVGL Configuration file: 16 | * Copy your_arduino_path/libraries/lvgl/lv_conf_template.h 17 | * to your_arduino_path/libraries/lv_conf.h 18 | * 19 | * In lv_conf.h around line 15, enable config file: 20 | * #if 1 // Set it to "1" to enable content 21 | * 22 | * Then find and set: 23 | * #define LV_COLOR_DEPTH 16 24 | * #define LV_TICK_CUSTOM 1 25 | * 26 | * For SPI/parallel 8 display set color swap can be faster, parallel 16/RGB screen don't swap! 27 | * #define LV_COLOR_16_SWAP 1 // for SPI and parallel 8 28 | * #define LV_COLOR_16_SWAP 0 // for parallel 16 and RGB 29 | * 30 | * Enable GIF decoder library 31 | * #define LV_USE_GIF 1 32 | ******************************************************************************/ 33 | #include 34 | #include "ui.h" 35 | 36 | /******************************************************************************* 37 | * Start of Arduino_GFX setting 38 | ******************************************************************************/ 39 | #include 40 | #define GFX_BL 25 41 | /* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */ 42 | Arduino_DataBus *bus = new Arduino_RPiPicoSPI(8 /* DC */, 9 /* CS */, 10 /* SCK */, 11 /* MOSI */, 12 /* MISO */, spi1 /* spi */); 43 | /* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */ 44 | Arduino_GFX *gfx = new Arduino_GC9A01(bus, 12, 0 /* rotation */, true /* IPS */); 45 | /******************************************************************************* 46 | * End of Arduino_GFX setting 47 | ******************************************************************************/ 48 | 49 | // use compile time for demo only 50 | #define ONE_MINUTE_MS (60 * 1000) 51 | #define ONE_HOUR_MS (60 * 60 * 1000) 52 | #define TWELVE_HOUR_MS (12 * 60 * 60 * 1000) 53 | static uint8_t conv2d(const char *p) 54 | { 55 | uint8_t v = 0; 56 | return (10 * (*p - '0')) + (*++p - '0'); 57 | } 58 | static unsigned long ms_offset; 59 | 60 | static uint32_t screenWidth; 61 | static uint32_t screenHeight; 62 | static lv_disp_draw_buf_t draw_buf; 63 | static lv_color_t *disp_draw_buf; 64 | static lv_disp_drv_t disp_drv; 65 | 66 | /* Display flushing */ 67 | void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) 68 | { 69 | uint32_t w = (area->x2 - area->x1 + 1); 70 | uint32_t h = (area->y2 - area->y1 + 1); 71 | 72 | #if (LV_COLOR_16_SWAP != 0) 73 | gfx->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h); 74 | #else 75 | gfx->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h); 76 | #endif 77 | 78 | lv_disp_flush_ready(disp); 79 | } 80 | 81 | void my_log_cb(const char *buf) 82 | { 83 | Serial.println(buf); 84 | } 85 | 86 | void setup() 87 | { 88 | // use compile time for demo only 89 | uint8_t hh = conv2d(__TIME__); 90 | uint8_t mm = conv2d(__TIME__ + 3); 91 | uint8_t ss = conv2d(__TIME__ + 6); 92 | ms_offset = ((60 * 60 * hh) + (60 * mm) + ss) * 1000; 93 | 94 | Serial.begin(115200); 95 | // Serial.setDebugOutput(true); 96 | // while(!Serial); 97 | Serial.println("LVGL Watchface"); 98 | 99 | #ifdef GFX_EXTRA_PRE_INIT 100 | GFX_EXTRA_PRE_INIT(); 101 | #endif 102 | 103 | // Init Display 104 | gfx->begin(); 105 | gfx->fillScreen(BLACK); 106 | 107 | #ifdef GFX_BL 108 | pinMode(GFX_BL, OUTPUT); 109 | digitalWrite(GFX_BL, HIGH); 110 | #endif 111 | 112 | #if LV_USE_LOG 113 | lv_log_register_print_cb(my_log_cb); 114 | #endif 115 | 116 | lv_init(); 117 | 118 | screenWidth = gfx->width(); 119 | screenHeight = gfx->height(); 120 | #ifdef ESP32 121 | disp_draw_buf = (lv_color_t *)heap_caps_malloc(sizeof(lv_color_t) * screenWidth * 32, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); 122 | #else 123 | disp_draw_buf = (lv_color_t *)malloc(sizeof(lv_color_t) * screenWidth * 32); 124 | #endif 125 | if (!disp_draw_buf) 126 | { 127 | Serial.println("LVGL disp_draw_buf allocate failed!"); 128 | } 129 | else 130 | { 131 | lv_disp_draw_buf_init(&draw_buf, disp_draw_buf, NULL, screenWidth * 32); 132 | 133 | /* Initialize the display */ 134 | lv_disp_drv_init(&disp_drv); 135 | /* Change the following line to your display resolution */ 136 | disp_drv.hor_res = screenWidth; 137 | disp_drv.ver_res = screenHeight; 138 | disp_drv.flush_cb = my_disp_flush; 139 | disp_drv.draw_buf = &draw_buf; 140 | lv_disp_drv_register(&disp_drv); 141 | 142 | /* Initialize the (dummy) input device driver */ 143 | static lv_indev_drv_t indev_drv; 144 | lv_indev_drv_init(&indev_drv); 145 | indev_drv.type = LV_INDEV_TYPE_POINTER; 146 | lv_indev_drv_register(&indev_drv); 147 | 148 | /* Init SquareLine prepared UI */ 149 | ui_init(); 150 | 151 | // In ui.c, replace "ui_Image1 = lv_img_create(ui_Screen1);" to "ui_Image1 = lv_gif_create(ui_Screen1);" 152 | LV_IMG_DECLARE(star_wars_stormtrooper_48_gif); 153 | lv_gif_set_src(ui_Image1, &star_wars_stormtrooper_48_gif); 154 | 155 | Serial.println("Setup done"); 156 | } 157 | } 158 | 159 | void loop() 160 | { 161 | lv_timer_handler(); /* let the GUI do its work */ 162 | 163 | unsigned long ms = millis(); 164 | 165 | // set watch arms' angle 166 | unsigned long clock_ms = (ms_offset + ms) % TWELVE_HOUR_MS; 167 | uint8_t hour = clock_ms / ONE_HOUR_MS; 168 | uint8_t minute = (clock_ms % ONE_HOUR_MS) / ONE_MINUTE_MS; 169 | int16_t angle = (clock_ms % ONE_MINUTE_MS) * 3600 / ONE_MINUTE_MS; 170 | lv_img_set_angle(ui_ImageArmSecond, angle); 171 | angle = (angle + (minute * 3600)) / 60; 172 | lv_img_set_angle(ui_ImageArmMinute, angle); 173 | angle = (angle + (hour * 3600)) / 12; 174 | lv_img_set_angle(ui_ImageArmHour, angle); 175 | } 176 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_Stormtrooper/ui.c: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #include "ui.h" 7 | #include "ui_helpers.h" 8 | 9 | ///////////////////// VARIABLES //////////////////// 10 | lv_obj_t *ui_Screen1; 11 | lv_obj_t *ui_ImageWatchface; 12 | lv_obj_t *ui_Image1; 13 | lv_obj_t *ui_ImageArmHour; 14 | lv_obj_t *ui_ImageArmMinute; 15 | lv_obj_t *ui_ImageArmSecond; 16 | 17 | ///////////////////// TEST LVGL SETTINGS //////////////////// 18 | #if LV_COLOR_DEPTH != 16 19 | #error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings" 20 | #endif 21 | #if LV_COLOR_16_SWAP !=1 22 | #error "LV_COLOR_16_SWAP should be 1 to match SquareLine Studio's settings" 23 | #endif 24 | 25 | ///////////////////// ANIMATIONS //////////////////// 26 | 27 | ///////////////////// FUNCTIONS //////////////////// 28 | 29 | ///////////////////// SCREENS //////////////////// 30 | void ui_Screen1_screen_init(void) 31 | { 32 | ui_Screen1 = lv_obj_create(NULL); 33 | lv_obj_clear_flag( ui_Screen1, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 34 | 35 | ui_ImageWatchface = lv_img_create(ui_Screen1); 36 | lv_img_set_src(ui_ImageWatchface, &ui_img_watchface240_png); 37 | lv_obj_set_width( ui_ImageWatchface, LV_SIZE_CONTENT); /// 1 38 | lv_obj_set_height( ui_ImageWatchface, LV_SIZE_CONTENT); /// 1 39 | lv_obj_set_align( ui_ImageWatchface, LV_ALIGN_CENTER ); 40 | lv_obj_add_flag( ui_ImageWatchface, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 41 | lv_obj_clear_flag( ui_ImageWatchface, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 42 | 43 | ui_Image1 = lv_gif_create(ui_Screen1); 44 | lv_obj_set_width( ui_Image1, LV_SIZE_CONTENT); /// 1 45 | lv_obj_set_height( ui_Image1, LV_SIZE_CONTENT); /// 1 46 | lv_obj_set_x( ui_Image1, 0 ); 47 | lv_obj_set_y( ui_Image1, 56 ); 48 | lv_obj_set_align( ui_Image1, LV_ALIGN_CENTER ); 49 | lv_obj_add_flag( ui_Image1, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 50 | lv_obj_clear_flag( ui_Image1, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 51 | 52 | ui_ImageArmHour = lv_img_create(ui_Screen1); 53 | lv_img_set_src(ui_ImageArmHour, &ui_img_blaster_png); 54 | lv_obj_set_width( ui_ImageArmHour, LV_SIZE_CONTENT); /// 1 55 | lv_obj_set_height( ui_ImageArmHour, LV_SIZE_CONTENT); /// 1 56 | lv_obj_set_x( ui_ImageArmHour, -4 ); 57 | lv_obj_set_y( ui_ImageArmHour, -26 ); 58 | lv_obj_set_align( ui_ImageArmHour, LV_ALIGN_CENTER ); 59 | lv_obj_add_flag( ui_ImageArmHour, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 60 | lv_obj_clear_flag( ui_ImageArmHour, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 61 | lv_img_set_pivot(ui_ImageArmHour,17,56); 62 | lv_img_set_angle(ui_ImageArmHour,750); 63 | 64 | ui_ImageArmMinute = lv_img_create(ui_Screen1); 65 | lv_img_set_src(ui_ImageArmMinute, &ui_img_dlt19x_png); 66 | lv_obj_set_width( ui_ImageArmMinute, LV_SIZE_CONTENT); /// 1 67 | lv_obj_set_height( ui_ImageArmMinute, LV_SIZE_CONTENT); /// 1 68 | lv_obj_set_x( ui_ImageArmMinute, 1 ); 69 | lv_obj_set_y( ui_ImageArmMinute, -45 ); 70 | lv_obj_set_align( ui_ImageArmMinute, LV_ALIGN_CENTER ); 71 | lv_obj_add_flag( ui_ImageArmMinute, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 72 | lv_obj_clear_flag( ui_ImageArmMinute, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 73 | lv_img_set_pivot(ui_ImageArmMinute,11,105); 74 | lv_img_set_angle(ui_ImageArmMinute,1800); 75 | 76 | ui_ImageArmSecond = lv_img_create(ui_Screen1); 77 | lv_img_set_src(ui_ImageArmSecond, &ui_img_lightsaber_png); 78 | lv_obj_set_width( ui_ImageArmSecond, LV_SIZE_CONTENT); /// 1 79 | lv_obj_set_height( ui_ImageArmSecond, LV_SIZE_CONTENT); /// 1 80 | lv_obj_set_x( ui_ImageArmSecond, -1 ); 81 | lv_obj_set_y( ui_ImageArmSecond, -50 ); 82 | lv_obj_set_align( ui_ImageArmSecond, LV_ALIGN_CENTER ); 83 | lv_obj_add_flag( ui_ImageArmSecond, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 84 | lv_obj_clear_flag( ui_ImageArmSecond, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 85 | lv_img_set_pivot(ui_ImageArmSecond,8,117); 86 | lv_img_set_angle(ui_ImageArmSecond,3150); 87 | 88 | } 89 | 90 | void ui_init( void ) 91 | { 92 | lv_disp_t *dispp = lv_disp_get_default(); 93 | lv_theme_t *theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), true, LV_FONT_DEFAULT); 94 | lv_disp_set_theme(dispp, theme); 95 | ui_Screen1_screen_init(); 96 | lv_disp_load_scr( ui_Screen1); 97 | } 98 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_Stormtrooper/ui.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_H 7 | #define _SQUARELINE_PROJECT_UI_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #if defined __has_include 14 | #if __has_include("lvgl.h") 15 | #include "lvgl.h" 16 | #elif __has_include("lvgl/lvgl.h") 17 | #include "lvgl/lvgl.h" 18 | #else 19 | #include "lvgl.h" 20 | #endif 21 | #else 22 | #include "lvgl.h" 23 | #endif 24 | 25 | extern lv_obj_t *ui_Screen1; 26 | extern lv_obj_t *ui_ImageWatchface; 27 | extern lv_obj_t *ui_Image1; 28 | extern lv_obj_t *ui_ImageArmHour; 29 | extern lv_obj_t *ui_ImageArmMinute; 30 | extern lv_obj_t *ui_ImageArmSecond; 31 | 32 | 33 | LV_IMG_DECLARE( ui_img_watchface240_png); // assets/watchface240.png 34 | LV_IMG_DECLARE( ui_img_blaster_png); // assets/blaster.png 35 | LV_IMG_DECLARE( ui_img_dlt19x_png); // assets/dlt19x.png 36 | LV_IMG_DECLARE( ui_img_lightsaber_png); // assets/lightsaber.png 37 | 38 | 39 | 40 | 41 | void ui_init(void); 42 | 43 | #ifdef __cplusplus 44 | } /*extern "C"*/ 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_Stormtrooper/ui_helpers.c: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #include "ui_helpers.h" 7 | 8 | void _ui_bar_set_property( lv_obj_t *target, int id, int val) 9 | { 10 | if (id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON); 11 | if (id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF); 12 | } 13 | 14 | void _ui_basic_set_property( lv_obj_t *target, int id, int val) 15 | { 16 | if (id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val); 17 | if (id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val); 18 | if (id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val); 19 | if (id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val); 20 | } 21 | 22 | 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val) 24 | { 25 | if (id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val); 26 | } 27 | 28 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val) 29 | { 30 | if (id == _UI_IMAGE_PROPERTY_IMAGE) lv_img_set_src(target, val); 31 | } 32 | 33 | void _ui_label_set_property( lv_obj_t *target, int id, char *val) 34 | { 35 | if (id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val); 36 | } 37 | 38 | 39 | void _ui_roller_set_property( lv_obj_t *target, int id, int val) 40 | { 41 | if (id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON); 42 | if (id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF); 43 | } 44 | 45 | void _ui_slider_set_property( lv_obj_t *target, int id, int val) 46 | { 47 | if (id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON); 48 | if (id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF); 49 | } 50 | 51 | 52 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay) 53 | { 54 | lv_scr_load_anim(target, fademode, spd, delay, false); 55 | } 56 | 57 | void _ui_arc_increment( lv_obj_t *target, int val) 58 | { 59 | int old = lv_arc_get_value(target); 60 | lv_arc_set_value(target, old+val); 61 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 62 | } 63 | 64 | void _ui_bar_increment( lv_obj_t *target, int val, int anm) 65 | { 66 | int old = lv_bar_get_value(target); 67 | lv_bar_set_value(target, old+val, anm); 68 | } 69 | 70 | void _ui_slider_increment( lv_obj_t *target, int val, int anm) 71 | { 72 | int old = lv_slider_get_value(target); 73 | lv_slider_set_value(target, old+val, anm); 74 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 75 | } 76 | 77 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea) 78 | { 79 | lv_keyboard_set_textarea(keyboard, textarea); 80 | } 81 | 82 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value) 83 | { 84 | if (value==_UI_MODIFY_FLAG_TOGGLE) 85 | { 86 | if ( lv_obj_has_flag(target,flag) ) lv_obj_clear_flag(target,flag); 87 | else lv_obj_add_flag(target,flag); 88 | } 89 | else if (value==_UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target,flag); 90 | else lv_obj_clear_flag(target,flag); 91 | } 92 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value) 93 | { 94 | if (value==_UI_MODIFY_STATE_TOGGLE) 95 | { 96 | if ( lv_obj_has_state(target,state) ) lv_obj_clear_state(target,state); 97 | else lv_obj_add_state(target,state); 98 | } 99 | else if (value==_UI_MODIFY_STATE_ADD) lv_obj_add_state(target,state); 100 | else lv_obj_clear_state(target,state); 101 | } 102 | 103 | void _ui_opacity_set( lv_obj_t *target, int val) 104 | { 105 | lv_obj_set_style_opa(target, val, 0); 106 | } 107 | 108 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v) 109 | { 110 | lv_obj_set_x((lv_obj_t *)a->user_data, v); 111 | } 112 | 113 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v) 114 | { 115 | lv_obj_set_y((lv_obj_t *)a->user_data, v); 116 | } 117 | 118 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v) 119 | { 120 | lv_obj_set_width((lv_obj_t *)a->user_data, v); 121 | } 122 | 123 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v) 124 | { 125 | lv_obj_set_height((lv_obj_t *)a->user_data, v); 126 | } 127 | 128 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v) 129 | { 130 | lv_obj_set_style_opa((lv_obj_t *)a->user_data, v, 0); 131 | } 132 | 133 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v) 134 | { 135 | lv_img_set_zoom((lv_obj_t *)a->user_data, v); 136 | } 137 | 138 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v) 139 | { 140 | lv_img_set_angle((lv_obj_t *)a->user_data, v); 141 | } 142 | 143 | 144 | int32_t _ui_anim_callback_get_x(lv_anim_t* a) 145 | { 146 | return lv_obj_get_x_aligned((lv_obj_t *)a->user_data); 147 | } 148 | 149 | int32_t _ui_anim_callback_get_y(lv_anim_t* a) 150 | { 151 | return lv_obj_get_y_aligned((lv_obj_t *)a->user_data); 152 | } 153 | 154 | int32_t _ui_anim_callback_get_width(lv_anim_t* a) 155 | { 156 | return lv_obj_get_width((lv_obj_t *)a->user_data); 157 | } 158 | 159 | int32_t _ui_anim_callback_get_height(lv_anim_t* a) 160 | { 161 | return lv_obj_get_height((lv_obj_t *)a->user_data); 162 | } 163 | 164 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a) 165 | { 166 | return lv_obj_get_style_opa((lv_obj_t *)a->user_data, 0); 167 | } 168 | 169 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a) 170 | { 171 | return lv_img_get_zoom((lv_obj_t *)a->user_data); 172 | } 173 | 174 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a) 175 | { 176 | return lv_img_get_angle((lv_obj_t *)a->user_data); 177 | } 178 | 179 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 180 | { 181 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 182 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix); 183 | lv_label_set_text(trg, buf); 184 | } 185 | 186 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 187 | { 188 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 189 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix); 190 | lv_label_set_text(trg, buf); 191 | } 192 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off) 193 | { 194 | if (lv_obj_has_state(src,LV_STATE_CHECKED)) lv_label_set_text(trg,txt_on); 195 | else lv_label_set_text(trg,txt_off); 196 | } 197 | 198 | 199 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_Stormtrooper/ui_helpers.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_HELPERS_H 7 | #define _SQUARELINE_PROJECT_UI_HELPERS_H 8 | 9 | #include "ui.h" 10 | 11 | #define _UI_TEMPORARY_STRING_BUFFER_SIZE 32 12 | #define _UI_BAR_PROPERTY_VALUE 0 13 | #define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1 14 | void _ui_bar_set_property( lv_obj_t *target, int id, int val); 15 | 16 | #define _UI_BASIC_PROPERTY_POSITION_X 0 17 | #define _UI_BASIC_PROPERTY_POSITION_Y 1 18 | #define _UI_BASIC_PROPERTY_WIDTH 2 19 | #define _UI_BASIC_PROPERTY_HEIGHT 3 20 | void _ui_basic_set_property( lv_obj_t *target, int id, int val); 21 | 22 | #define _UI_DROPDOWN_PROPERTY_SELECTED 0 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val); 24 | 25 | #define _UI_IMAGE_PROPERTY_IMAGE 0 26 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val); 27 | 28 | #define _UI_LABEL_PROPERTY_TEXT 0 29 | void _ui_label_set_property( lv_obj_t *target, int id, char *val); 30 | 31 | #define _UI_ROLLER_PROPERTY_SELECTED 0 32 | #define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1 33 | void _ui_roller_set_property( lv_obj_t *target, int id, int val); 34 | 35 | #define _UI_SLIDER_PROPERTY_VALUE 0 36 | #define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1 37 | void _ui_slider_set_property( lv_obj_t *target, int id, int val); 38 | 39 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay); 40 | 41 | void _ui_arc_increment( lv_obj_t *target, int val); 42 | 43 | void _ui_bar_increment( lv_obj_t *target, int val, int anm); 44 | 45 | void _ui_slider_increment( lv_obj_t *target, int val, int anm); 46 | 47 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea); 48 | 49 | #define _UI_MODIFY_FLAG_ADD 0 50 | #define _UI_MODIFY_FLAG_REMOVE 1 51 | #define _UI_MODIFY_FLAG_TOGGLE 2 52 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value); 53 | 54 | #define _UI_MODIFY_STATE_ADD 0 55 | #define _UI_MODIFY_STATE_REMOVE 1 56 | #define _UI_MODIFY_STATE_TOGGLE 2 57 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value); 58 | 59 | void _ui_opacity_set( lv_obj_t *target, int val); 60 | 61 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v); 62 | 63 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v); 64 | 65 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v); 66 | 67 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v); 68 | 69 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v); 70 | 71 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v); 72 | 73 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v); 74 | 75 | int32_t _ui_anim_callback_get_x(lv_anim_t* a); 76 | 77 | int32_t _ui_anim_callback_get_y(lv_anim_t* a); 78 | 79 | int32_t _ui_anim_callback_get_width(lv_anim_t* a); 80 | 81 | int32_t _ui_anim_callback_get_height(lv_anim_t* a); 82 | 83 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a); 84 | 85 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a); 86 | 87 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a); 88 | 89 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 90 | 91 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 92 | 93 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off); 94 | 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch/ui.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_H 7 | #define _SQUARELINE_PROJECT_UI_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #if defined __has_include 14 | #if __has_include("lvgl.h") 15 | #include "lvgl.h" 16 | #elif __has_include("lvgl/lvgl.h") 17 | #include "lvgl/lvgl.h" 18 | #else 19 | #include "lvgl.h" 20 | #endif 21 | #else 22 | #include "lvgl.h" 23 | #endif 24 | 25 | extern lv_obj_t *ui_Screen1; 26 | extern lv_obj_t *ui_ImageWatchface; 27 | extern lv_obj_t *ui_Image1; 28 | extern lv_obj_t *ui_Image2; 29 | extern lv_obj_t *ui_Image3; 30 | extern lv_obj_t *ui_Image4; 31 | extern lv_obj_t *ui_Image5; 32 | extern lv_obj_t *ui_Image6; 33 | extern lv_obj_t *ui_Image7; 34 | extern lv_obj_t *ui_Image8; 35 | extern lv_obj_t *ui_ImageArmHour; 36 | extern lv_obj_t *ui_ImageArmMinute; 37 | extern lv_obj_t *ui_ImageArmSecond; 38 | extern lv_obj_t *ui_LabelDate; 39 | 40 | 41 | LV_IMG_DECLARE( ui_img_watchface240_png); // assets/watchface240.png 42 | LV_IMG_DECLARE( ui_img_out1_png); // assets/out1.png 43 | LV_IMG_DECLARE( ui_img_out2_png); // assets/out2.png 44 | LV_IMG_DECLARE( ui_img_out3_png); // assets/out3.png 45 | LV_IMG_DECLARE( ui_img_out4_png); // assets/out4.png 46 | LV_IMG_DECLARE( ui_img_out5_png); // assets/out5.png 47 | LV_IMG_DECLARE( ui_img_out6_png); // assets/out6.png 48 | LV_IMG_DECLARE( ui_img_out7_png); // assets/out7.png 49 | LV_IMG_DECLARE( ui_img_out8_png); // assets/out8.png 50 | LV_IMG_DECLARE( ui_img_armhour_png); // assets/armHour.png 51 | LV_IMG_DECLARE( ui_img_armminute_png); // assets/armMinute.png 52 | LV_IMG_DECLARE( ui_img_armsecond_png); // assets/armSecond.png 53 | 54 | 55 | 56 | 57 | void ui_init(void); 58 | 59 | #ifdef __cplusplus 60 | } /*extern "C"*/ 61 | #endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch/ui_helpers.c: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #include "ui_helpers.h" 7 | 8 | void _ui_bar_set_property( lv_obj_t *target, int id, int val) 9 | { 10 | if (id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON); 11 | if (id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF); 12 | } 13 | 14 | void _ui_basic_set_property( lv_obj_t *target, int id, int val) 15 | { 16 | if (id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val); 17 | if (id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val); 18 | if (id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val); 19 | if (id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val); 20 | } 21 | 22 | 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val) 24 | { 25 | if (id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val); 26 | } 27 | 28 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val) 29 | { 30 | if (id == _UI_IMAGE_PROPERTY_IMAGE) lv_img_set_src(target, val); 31 | } 32 | 33 | void _ui_label_set_property( lv_obj_t *target, int id, char *val) 34 | { 35 | if (id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val); 36 | } 37 | 38 | 39 | void _ui_roller_set_property( lv_obj_t *target, int id, int val) 40 | { 41 | if (id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON); 42 | if (id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF); 43 | } 44 | 45 | void _ui_slider_set_property( lv_obj_t *target, int id, int val) 46 | { 47 | if (id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON); 48 | if (id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF); 49 | } 50 | 51 | 52 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay) 53 | { 54 | lv_scr_load_anim(target, fademode, spd, delay, false); 55 | } 56 | 57 | void _ui_arc_increment( lv_obj_t *target, int val) 58 | { 59 | int old = lv_arc_get_value(target); 60 | lv_arc_set_value(target, old+val); 61 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 62 | } 63 | 64 | void _ui_bar_increment( lv_obj_t *target, int val, int anm) 65 | { 66 | int old = lv_bar_get_value(target); 67 | lv_bar_set_value(target, old+val, anm); 68 | } 69 | 70 | void _ui_slider_increment( lv_obj_t *target, int val, int anm) 71 | { 72 | int old = lv_slider_get_value(target); 73 | lv_slider_set_value(target, old+val, anm); 74 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 75 | } 76 | 77 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea) 78 | { 79 | lv_keyboard_set_textarea(keyboard, textarea); 80 | } 81 | 82 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value) 83 | { 84 | if (value==_UI_MODIFY_FLAG_TOGGLE) 85 | { 86 | if ( lv_obj_has_flag(target,flag) ) lv_obj_clear_flag(target,flag); 87 | else lv_obj_add_flag(target,flag); 88 | } 89 | else if (value==_UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target,flag); 90 | else lv_obj_clear_flag(target,flag); 91 | } 92 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value) 93 | { 94 | if (value==_UI_MODIFY_STATE_TOGGLE) 95 | { 96 | if ( lv_obj_has_state(target,state) ) lv_obj_clear_state(target,state); 97 | else lv_obj_add_state(target,state); 98 | } 99 | else if (value==_UI_MODIFY_STATE_ADD) lv_obj_add_state(target,state); 100 | else lv_obj_clear_state(target,state); 101 | } 102 | 103 | void _ui_opacity_set( lv_obj_t *target, int val) 104 | { 105 | lv_obj_set_style_opa(target, val, 0); 106 | } 107 | 108 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v) 109 | { 110 | lv_obj_set_x((lv_obj_t *)a->user_data, v); 111 | } 112 | 113 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v) 114 | { 115 | lv_obj_set_y((lv_obj_t *)a->user_data, v); 116 | } 117 | 118 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v) 119 | { 120 | lv_obj_set_width((lv_obj_t *)a->user_data, v); 121 | } 122 | 123 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v) 124 | { 125 | lv_obj_set_height((lv_obj_t *)a->user_data, v); 126 | } 127 | 128 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v) 129 | { 130 | lv_obj_set_style_opa((lv_obj_t *)a->user_data, v, 0); 131 | } 132 | 133 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v) 134 | { 135 | lv_img_set_zoom((lv_obj_t *)a->user_data, v); 136 | } 137 | 138 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v) 139 | { 140 | lv_img_set_angle((lv_obj_t *)a->user_data, v); 141 | } 142 | 143 | 144 | int32_t _ui_anim_callback_get_x(lv_anim_t* a) 145 | { 146 | return lv_obj_get_x_aligned((lv_obj_t *)a->user_data); 147 | } 148 | 149 | int32_t _ui_anim_callback_get_y(lv_anim_t* a) 150 | { 151 | return lv_obj_get_y_aligned((lv_obj_t *)a->user_data); 152 | } 153 | 154 | int32_t _ui_anim_callback_get_width(lv_anim_t* a) 155 | { 156 | return lv_obj_get_width((lv_obj_t *)a->user_data); 157 | } 158 | 159 | int32_t _ui_anim_callback_get_height(lv_anim_t* a) 160 | { 161 | return lv_obj_get_height((lv_obj_t *)a->user_data); 162 | } 163 | 164 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a) 165 | { 166 | return lv_obj_get_style_opa((lv_obj_t *)a->user_data, 0); 167 | } 168 | 169 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a) 170 | { 171 | return lv_img_get_zoom((lv_obj_t *)a->user_data); 172 | } 173 | 174 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a) 175 | { 176 | return lv_img_get_angle((lv_obj_t *)a->user_data); 177 | } 178 | 179 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 180 | { 181 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 182 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix); 183 | lv_label_set_text(trg, buf); 184 | } 185 | 186 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 187 | { 188 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 189 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix); 190 | lv_label_set_text(trg, buf); 191 | } 192 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off) 193 | { 194 | if (lv_obj_has_state(src,LV_STATE_CHECKED)) lv_label_set_text(trg,txt_on); 195 | else lv_label_set_text(trg,txt_off); 196 | } 197 | 198 | 199 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch/ui_helpers.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_HELPERS_H 7 | #define _SQUARELINE_PROJECT_UI_HELPERS_H 8 | 9 | #include "ui.h" 10 | 11 | #define _UI_TEMPORARY_STRING_BUFFER_SIZE 32 12 | #define _UI_BAR_PROPERTY_VALUE 0 13 | #define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1 14 | void _ui_bar_set_property( lv_obj_t *target, int id, int val); 15 | 16 | #define _UI_BASIC_PROPERTY_POSITION_X 0 17 | #define _UI_BASIC_PROPERTY_POSITION_Y 1 18 | #define _UI_BASIC_PROPERTY_WIDTH 2 19 | #define _UI_BASIC_PROPERTY_HEIGHT 3 20 | void _ui_basic_set_property( lv_obj_t *target, int id, int val); 21 | 22 | #define _UI_DROPDOWN_PROPERTY_SELECTED 0 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val); 24 | 25 | #define _UI_IMAGE_PROPERTY_IMAGE 0 26 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val); 27 | 28 | #define _UI_LABEL_PROPERTY_TEXT 0 29 | void _ui_label_set_property( lv_obj_t *target, int id, char *val); 30 | 31 | #define _UI_ROLLER_PROPERTY_SELECTED 0 32 | #define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1 33 | void _ui_roller_set_property( lv_obj_t *target, int id, int val); 34 | 35 | #define _UI_SLIDER_PROPERTY_VALUE 0 36 | #define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1 37 | void _ui_slider_set_property( lv_obj_t *target, int id, int val); 38 | 39 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay); 40 | 41 | void _ui_arc_increment( lv_obj_t *target, int val); 42 | 43 | void _ui_bar_increment( lv_obj_t *target, int val, int anm); 44 | 45 | void _ui_slider_increment( lv_obj_t *target, int val, int anm); 46 | 47 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea); 48 | 49 | #define _UI_MODIFY_FLAG_ADD 0 50 | #define _UI_MODIFY_FLAG_REMOVE 1 51 | #define _UI_MODIFY_FLAG_TOGGLE 2 52 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value); 53 | 54 | #define _UI_MODIFY_STATE_ADD 0 55 | #define _UI_MODIFY_STATE_REMOVE 1 56 | #define _UI_MODIFY_STATE_TOGGLE 2 57 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value); 58 | 59 | void _ui_opacity_set( lv_obj_t *target, int val); 60 | 61 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v); 62 | 63 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v); 64 | 65 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v); 66 | 67 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v); 68 | 69 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v); 70 | 71 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v); 72 | 73 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v); 74 | 75 | int32_t _ui_anim_callback_get_x(lv_anim_t* a); 76 | 77 | int32_t _ui_anim_callback_get_y(lv_anim_t* a); 78 | 79 | int32_t _ui_anim_callback_get_width(lv_anim_t* a); 80 | 81 | int32_t _ui_anim_callback_get_height(lv_anim_t* a); 82 | 83 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a); 84 | 85 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a); 86 | 87 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a); 88 | 89 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 90 | 91 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 92 | 93 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off); 94 | 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021/ui.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_H 7 | #define _SQUARELINE_PROJECT_UI_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #if defined __has_include 14 | #if __has_include("lvgl.h") 15 | #include "lvgl.h" 16 | #elif __has_include("lvgl/lvgl.h") 17 | #include "lvgl/lvgl.h" 18 | #else 19 | #include "lvgl.h" 20 | #endif 21 | #else 22 | #include "lvgl.h" 23 | #endif 24 | 25 | extern lv_obj_t *ui_Screen1; 26 | extern lv_obj_t *ui_Image1; 27 | extern lv_obj_t *ui_Image2; 28 | extern lv_obj_t *ui_Image3; 29 | extern lv_obj_t *ui_Image4; 30 | extern lv_obj_t *ui_Image5; 31 | extern lv_obj_t *ui_Image6; 32 | extern lv_obj_t *ui_Image7; 33 | extern lv_obj_t *ui_Image8; 34 | extern lv_obj_t *ui_Image9; 35 | extern lv_obj_t *ui_Image10; 36 | extern lv_obj_t *ui_Image11; 37 | extern lv_obj_t *ui_Image12; 38 | extern lv_obj_t *ui_ImageWatchface; 39 | extern lv_obj_t *ui_ImageArmHour; 40 | extern lv_obj_t *ui_ImageArmMinute; 41 | extern lv_obj_t *ui_ImageArmSecond; 42 | extern lv_obj_t *ui_LabelDate; 43 | 44 | 45 | LV_IMG_DECLARE( ui_img_01_png); // assets/01.png 46 | LV_IMG_DECLARE( ui_img_03_png); // assets/03.png 47 | LV_IMG_DECLARE( ui_img_05_png); // assets/05.png 48 | LV_IMG_DECLARE( ui_img_07_png); // assets/07.png 49 | LV_IMG_DECLARE( ui_img_09_png); // assets/09.png 50 | LV_IMG_DECLARE( ui_img_11_png); // assets/11.png 51 | LV_IMG_DECLARE( ui_img_13_png); // assets/13.png 52 | LV_IMG_DECLARE( ui_img_15_png); // assets/15.png 53 | LV_IMG_DECLARE( ui_img_17_png); // assets/17.png 54 | LV_IMG_DECLARE( ui_img_19_png); // assets/19.png 55 | LV_IMG_DECLARE( ui_img_21_png); // assets/21.png 56 | LV_IMG_DECLARE( ui_img_23_png); // assets/23.png 57 | LV_IMG_DECLARE( ui_img_watchface240_png); // assets/watchface240.png 58 | LV_IMG_DECLARE( ui_img_armhourblue_png); // assets/armHourBlue.png 59 | LV_IMG_DECLARE( ui_img_armminuteblue_png); // assets/armMinuteBlue.png 60 | LV_IMG_DECLARE( ui_img_armsecondblue_png); // assets/armSecondBlue.png 61 | 62 | 63 | 64 | 65 | void ui_init(void); 66 | 67 | #ifdef __cplusplus 68 | } /*extern "C"*/ 69 | #endif 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021/ui_helpers.c: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #include "ui_helpers.h" 7 | 8 | void _ui_bar_set_property( lv_obj_t *target, int id, int val) 9 | { 10 | if (id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON); 11 | if (id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF); 12 | } 13 | 14 | void _ui_basic_set_property( lv_obj_t *target, int id, int val) 15 | { 16 | if (id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val); 17 | if (id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val); 18 | if (id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val); 19 | if (id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val); 20 | } 21 | 22 | 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val) 24 | { 25 | if (id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val); 26 | } 27 | 28 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val) 29 | { 30 | if (id == _UI_IMAGE_PROPERTY_IMAGE) lv_img_set_src(target, val); 31 | } 32 | 33 | void _ui_label_set_property( lv_obj_t *target, int id, char *val) 34 | { 35 | if (id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val); 36 | } 37 | 38 | 39 | void _ui_roller_set_property( lv_obj_t *target, int id, int val) 40 | { 41 | if (id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON); 42 | if (id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF); 43 | } 44 | 45 | void _ui_slider_set_property( lv_obj_t *target, int id, int val) 46 | { 47 | if (id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON); 48 | if (id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF); 49 | } 50 | 51 | 52 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay) 53 | { 54 | lv_scr_load_anim(target, fademode, spd, delay, false); 55 | } 56 | 57 | void _ui_arc_increment( lv_obj_t *target, int val) 58 | { 59 | int old = lv_arc_get_value(target); 60 | lv_arc_set_value(target, old+val); 61 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 62 | } 63 | 64 | void _ui_bar_increment( lv_obj_t *target, int val, int anm) 65 | { 66 | int old = lv_bar_get_value(target); 67 | lv_bar_set_value(target, old+val, anm); 68 | } 69 | 70 | void _ui_slider_increment( lv_obj_t *target, int val, int anm) 71 | { 72 | int old = lv_slider_get_value(target); 73 | lv_slider_set_value(target, old+val, anm); 74 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 75 | } 76 | 77 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea) 78 | { 79 | lv_keyboard_set_textarea(keyboard, textarea); 80 | } 81 | 82 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value) 83 | { 84 | if (value==_UI_MODIFY_FLAG_TOGGLE) 85 | { 86 | if ( lv_obj_has_flag(target,flag) ) lv_obj_clear_flag(target,flag); 87 | else lv_obj_add_flag(target,flag); 88 | } 89 | else if (value==_UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target,flag); 90 | else lv_obj_clear_flag(target,flag); 91 | } 92 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value) 93 | { 94 | if (value==_UI_MODIFY_STATE_TOGGLE) 95 | { 96 | if ( lv_obj_has_state(target,state) ) lv_obj_clear_state(target,state); 97 | else lv_obj_add_state(target,state); 98 | } 99 | else if (value==_UI_MODIFY_STATE_ADD) lv_obj_add_state(target,state); 100 | else lv_obj_clear_state(target,state); 101 | } 102 | 103 | void _ui_opacity_set( lv_obj_t *target, int val) 104 | { 105 | lv_obj_set_style_opa(target, val, 0); 106 | } 107 | 108 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v) 109 | { 110 | lv_obj_set_x((lv_obj_t *)a->user_data, v); 111 | } 112 | 113 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v) 114 | { 115 | lv_obj_set_y((lv_obj_t *)a->user_data, v); 116 | } 117 | 118 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v) 119 | { 120 | lv_obj_set_width((lv_obj_t *)a->user_data, v); 121 | } 122 | 123 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v) 124 | { 125 | lv_obj_set_height((lv_obj_t *)a->user_data, v); 126 | } 127 | 128 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v) 129 | { 130 | lv_obj_set_style_opa((lv_obj_t *)a->user_data, v, 0); 131 | } 132 | 133 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v) 134 | { 135 | lv_img_set_zoom((lv_obj_t *)a->user_data, v); 136 | } 137 | 138 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v) 139 | { 140 | lv_img_set_angle((lv_obj_t *)a->user_data, v); 141 | } 142 | 143 | 144 | int32_t _ui_anim_callback_get_x(lv_anim_t* a) 145 | { 146 | return lv_obj_get_x_aligned((lv_obj_t *)a->user_data); 147 | } 148 | 149 | int32_t _ui_anim_callback_get_y(lv_anim_t* a) 150 | { 151 | return lv_obj_get_y_aligned((lv_obj_t *)a->user_data); 152 | } 153 | 154 | int32_t _ui_anim_callback_get_width(lv_anim_t* a) 155 | { 156 | return lv_obj_get_width((lv_obj_t *)a->user_data); 157 | } 158 | 159 | int32_t _ui_anim_callback_get_height(lv_anim_t* a) 160 | { 161 | return lv_obj_get_height((lv_obj_t *)a->user_data); 162 | } 163 | 164 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a) 165 | { 166 | return lv_obj_get_style_opa((lv_obj_t *)a->user_data, 0); 167 | } 168 | 169 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a) 170 | { 171 | return lv_img_get_zoom((lv_obj_t *)a->user_data); 172 | } 173 | 174 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a) 175 | { 176 | return lv_img_get_angle((lv_obj_t *)a->user_data); 177 | } 178 | 179 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 180 | { 181 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 182 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix); 183 | lv_label_set_text(trg, buf); 184 | } 185 | 186 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 187 | { 188 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 189 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix); 190 | lv_label_set_text(trg, buf); 191 | } 192 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off) 193 | { 194 | if (lv_obj_has_state(src,LV_STATE_CHECKED)) lv_label_set_text(trg,txt_on); 195 | else lv_label_set_text(trg,txt_off); 196 | } 197 | 198 | 199 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021/ui_helpers.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_HELPERS_H 7 | #define _SQUARELINE_PROJECT_UI_HELPERS_H 8 | 9 | #include "ui.h" 10 | 11 | #define _UI_TEMPORARY_STRING_BUFFER_SIZE 32 12 | #define _UI_BAR_PROPERTY_VALUE 0 13 | #define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1 14 | void _ui_bar_set_property( lv_obj_t *target, int id, int val); 15 | 16 | #define _UI_BASIC_PROPERTY_POSITION_X 0 17 | #define _UI_BASIC_PROPERTY_POSITION_Y 1 18 | #define _UI_BASIC_PROPERTY_WIDTH 2 19 | #define _UI_BASIC_PROPERTY_HEIGHT 3 20 | void _ui_basic_set_property( lv_obj_t *target, int id, int val); 21 | 22 | #define _UI_DROPDOWN_PROPERTY_SELECTED 0 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val); 24 | 25 | #define _UI_IMAGE_PROPERTY_IMAGE 0 26 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val); 27 | 28 | #define _UI_LABEL_PROPERTY_TEXT 0 29 | void _ui_label_set_property( lv_obj_t *target, int id, char *val); 30 | 31 | #define _UI_ROLLER_PROPERTY_SELECTED 0 32 | #define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1 33 | void _ui_roller_set_property( lv_obj_t *target, int id, int val); 34 | 35 | #define _UI_SLIDER_PROPERTY_VALUE 0 36 | #define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1 37 | void _ui_slider_set_property( lv_obj_t *target, int id, int val); 38 | 39 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay); 40 | 41 | void _ui_arc_increment( lv_obj_t *target, int val); 42 | 43 | void _ui_bar_increment( lv_obj_t *target, int val, int anm); 44 | 45 | void _ui_slider_increment( lv_obj_t *target, int val, int anm); 46 | 47 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea); 48 | 49 | #define _UI_MODIFY_FLAG_ADD 0 50 | #define _UI_MODIFY_FLAG_REMOVE 1 51 | #define _UI_MODIFY_FLAG_TOGGLE 2 52 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value); 53 | 54 | #define _UI_MODIFY_STATE_ADD 0 55 | #define _UI_MODIFY_STATE_REMOVE 1 56 | #define _UI_MODIFY_STATE_TOGGLE 2 57 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value); 58 | 59 | void _ui_opacity_set( lv_obj_t *target, int val); 60 | 61 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v); 62 | 63 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v); 64 | 65 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v); 66 | 67 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v); 68 | 69 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v); 70 | 71 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v); 72 | 73 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v); 74 | 75 | int32_t _ui_anim_callback_get_x(lv_anim_t* a); 76 | 77 | int32_t _ui_anim_callback_get_y(lv_anim_t* a); 78 | 79 | int32_t _ui_anim_callback_get_width(lv_anim_t* a); 80 | 81 | int32_t _ui_anim_callback_get_height(lv_anim_t* a); 82 | 83 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a); 84 | 85 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a); 86 | 87 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a); 88 | 89 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 90 | 91 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 92 | 93 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off); 94 | 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_GIF/data/3QAe240.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/LVGL_Watchface_240_T-Watch_2021_GIF/data/3QAe240.gif -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_GIF/data/IrF240.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/LVGL_Watchface_240_T-Watch_2021_GIF/data/IrF240.gif -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_GIF/data/WDrB240.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/LVGL_Watchface_240_T-Watch_2021_GIF/data/WDrB240.gif -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_GIF/data/fxTQ240.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/LVGL_Watchface_240_T-Watch_2021_GIF/data/fxTQ240.gif -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_GIF/data/fy5Z240.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/LVGL_Watchface_240_T-Watch_2021_GIF/data/fy5Z240.gif -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_GIF/data1/F4kC.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/LVGL_Watchface_240_T-Watch_2021_GIF/data1/F4kC.gif -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_GIF/ui.c: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #include "ui.h" 7 | #include "ui_helpers.h" 8 | 9 | ///////////////////// VARIABLES //////////////////// 10 | lv_obj_t *ui_Screen1; 11 | lv_obj_t *ui_Image1; 12 | lv_obj_t *ui_ImageWatchface; 13 | lv_obj_t *ui_ImageArmHour; 14 | lv_obj_t *ui_ImageArmMinute; 15 | lv_obj_t *ui_ImageArmSecond; 16 | lv_obj_t *ui_LabelDate; 17 | 18 | ///////////////////// TEST LVGL SETTINGS //////////////////// 19 | #if LV_COLOR_DEPTH != 16 20 | #error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings" 21 | #endif 22 | #if LV_COLOR_16_SWAP !=0 23 | #error "LV_COLOR_16_SWAP should be 0 to match SquareLine Studio's settings" 24 | #endif 25 | 26 | ///////////////////// ANIMATIONS //////////////////// 27 | 28 | ///////////////////// FUNCTIONS //////////////////// 29 | 30 | ///////////////////// SCREENS //////////////////// 31 | void ui_Screen1_screen_init(void) 32 | { 33 | ui_Screen1 = lv_obj_create(NULL); 34 | lv_obj_clear_flag( ui_Screen1, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 35 | 36 | ui_Image1 = lv_canvas_create(ui_Screen1); 37 | lv_obj_set_width( ui_Image1, LV_SIZE_CONTENT); /// 1 38 | lv_obj_set_height( ui_Image1, LV_SIZE_CONTENT); /// 1 39 | lv_obj_set_align( ui_Image1, LV_ALIGN_CENTER ); 40 | lv_obj_add_flag( ui_Image1, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 41 | lv_obj_clear_flag( ui_Image1, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 42 | 43 | ui_ImageWatchface = lv_img_create(ui_Screen1); 44 | lv_img_set_src(ui_ImageWatchface, &ui_img_watchface240_png); 45 | lv_obj_set_width( ui_ImageWatchface, LV_SIZE_CONTENT); /// 1 46 | lv_obj_set_height( ui_ImageWatchface, LV_SIZE_CONTENT); /// 1 47 | lv_obj_set_align( ui_ImageWatchface, LV_ALIGN_CENTER ); 48 | lv_obj_add_flag( ui_ImageWatchface, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 49 | lv_obj_clear_flag( ui_ImageWatchface, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 50 | 51 | ui_ImageArmHour = lv_img_create(ui_Screen1); 52 | lv_img_set_src(ui_ImageArmHour, &ui_img_armhourblue_png); 53 | lv_obj_set_width( ui_ImageArmHour, LV_SIZE_CONTENT); /// 1 54 | lv_obj_set_height( ui_ImageArmHour, LV_SIZE_CONTENT); /// 1 55 | lv_obj_set_x( ui_ImageArmHour, 0 ); 56 | lv_obj_set_y( ui_ImageArmHour, -35 ); 57 | lv_obj_set_align( ui_ImageArmHour, LV_ALIGN_CENTER ); 58 | lv_obj_add_flag( ui_ImageArmHour, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 59 | lv_obj_clear_flag( ui_ImageArmHour, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 60 | lv_img_set_pivot(ui_ImageArmHour,9,77); 61 | lv_img_set_angle(ui_ImageArmHour,750); 62 | 63 | ui_ImageArmMinute = lv_img_create(ui_Screen1); 64 | lv_img_set_src(ui_ImageArmMinute, &ui_img_armminuteblue_png); 65 | lv_obj_set_width( ui_ImageArmMinute, LV_SIZE_CONTENT); /// 1 66 | lv_obj_set_height( ui_ImageArmMinute, LV_SIZE_CONTENT); /// 1 67 | lv_obj_set_x( ui_ImageArmMinute, 0 ); 68 | lv_obj_set_y( ui_ImageArmMinute, -49 ); 69 | lv_obj_set_align( ui_ImageArmMinute, LV_ALIGN_CENTER ); 70 | lv_obj_add_flag( ui_ImageArmMinute, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 71 | lv_obj_clear_flag( ui_ImageArmMinute, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 72 | lv_img_set_pivot(ui_ImageArmMinute,9,105); 73 | lv_img_set_angle(ui_ImageArmMinute,1800); 74 | 75 | ui_ImageArmSecond = lv_img_create(ui_Screen1); 76 | lv_img_set_src(ui_ImageArmSecond, &ui_img_armsecondblue_png); 77 | lv_obj_set_width( ui_ImageArmSecond, LV_SIZE_CONTENT); /// 1 78 | lv_obj_set_height( ui_ImageArmSecond, LV_SIZE_CONTENT); /// 1 79 | lv_obj_set_x( ui_ImageArmSecond, 0 ); 80 | lv_obj_set_y( ui_ImageArmSecond, -47 ); 81 | lv_obj_set_align( ui_ImageArmSecond, LV_ALIGN_CENTER ); 82 | lv_obj_add_flag( ui_ImageArmSecond, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 83 | lv_obj_clear_flag( ui_ImageArmSecond, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 84 | lv_img_set_pivot(ui_ImageArmSecond,5,115); 85 | lv_img_set_angle(ui_ImageArmSecond,3150); 86 | 87 | ui_LabelDate = lv_label_create(ui_Screen1); 88 | lv_obj_set_width( ui_LabelDate, LV_SIZE_CONTENT); /// 1 89 | lv_obj_set_height( ui_LabelDate, LV_SIZE_CONTENT); /// 1 90 | lv_obj_set_x( ui_LabelDate, 72 ); 91 | lv_obj_set_y( ui_LabelDate, 0 ); 92 | lv_obj_set_align( ui_LabelDate, LV_ALIGN_CENTER ); 93 | lv_label_set_text(ui_LabelDate,"dow dd"); 94 | lv_obj_set_style_text_color(ui_LabelDate, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT ); 95 | lv_obj_set_style_text_opa(ui_LabelDate, 255, LV_PART_MAIN| LV_STATE_DEFAULT); 96 | lv_obj_set_style_text_font(ui_LabelDate, &lv_font_montserrat_14, LV_PART_MAIN| LV_STATE_DEFAULT); 97 | 98 | } 99 | 100 | void ui_init( void ) 101 | { 102 | lv_disp_t *dispp = lv_disp_get_default(); 103 | lv_theme_t *theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), true, LV_FONT_DEFAULT); 104 | lv_disp_set_theme(dispp, theme); 105 | ui_Screen1_screen_init(); 106 | lv_disp_load_scr( ui_Screen1); 107 | } 108 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_GIF/ui.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_H 7 | #define _SQUARELINE_PROJECT_UI_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #if defined __has_include 14 | #if __has_include("lvgl.h") 15 | #include "lvgl.h" 16 | #elif __has_include("lvgl/lvgl.h") 17 | #include "lvgl/lvgl.h" 18 | #else 19 | #include "lvgl.h" 20 | #endif 21 | #else 22 | #include "lvgl.h" 23 | #endif 24 | 25 | extern lv_obj_t *ui_Screen1; 26 | extern lv_obj_t *ui_Image1; 27 | extern lv_obj_t *ui_ImageWatchface; 28 | extern lv_obj_t *ui_ImageArmHour; 29 | extern lv_obj_t *ui_ImageArmMinute; 30 | extern lv_obj_t *ui_ImageArmSecond; 31 | extern lv_obj_t *ui_LabelDate; 32 | 33 | 34 | LV_IMG_DECLARE( ui_img_01_png); // assets/01.png 35 | LV_IMG_DECLARE( ui_img_watchface240_png); // assets/watchface240.png 36 | LV_IMG_DECLARE( ui_img_armhourblue_png); // assets/armHourBlue.png 37 | LV_IMG_DECLARE( ui_img_armminuteblue_png); // assets/armMinuteBlue.png 38 | LV_IMG_DECLARE( ui_img_armsecondblue_png); // assets/armSecondBlue.png 39 | 40 | 41 | 42 | 43 | void ui_init(void); 44 | 45 | #ifdef __cplusplus 46 | } /*extern "C"*/ 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_GIF/ui_helpers.c: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #include "ui_helpers.h" 7 | 8 | void _ui_bar_set_property( lv_obj_t *target, int id, int val) 9 | { 10 | if (id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON); 11 | if (id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF); 12 | } 13 | 14 | void _ui_basic_set_property( lv_obj_t *target, int id, int val) 15 | { 16 | if (id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val); 17 | if (id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val); 18 | if (id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val); 19 | if (id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val); 20 | } 21 | 22 | 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val) 24 | { 25 | if (id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val); 26 | } 27 | 28 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val) 29 | { 30 | if (id == _UI_IMAGE_PROPERTY_IMAGE) lv_img_set_src(target, val); 31 | } 32 | 33 | void _ui_label_set_property( lv_obj_t *target, int id, char *val) 34 | { 35 | if (id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val); 36 | } 37 | 38 | 39 | void _ui_roller_set_property( lv_obj_t *target, int id, int val) 40 | { 41 | if (id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON); 42 | if (id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF); 43 | } 44 | 45 | void _ui_slider_set_property( lv_obj_t *target, int id, int val) 46 | { 47 | if (id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON); 48 | if (id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF); 49 | } 50 | 51 | 52 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay) 53 | { 54 | lv_scr_load_anim(target, fademode, spd, delay, false); 55 | } 56 | 57 | void _ui_arc_increment( lv_obj_t *target, int val) 58 | { 59 | int old = lv_arc_get_value(target); 60 | lv_arc_set_value(target, old+val); 61 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 62 | } 63 | 64 | void _ui_bar_increment( lv_obj_t *target, int val, int anm) 65 | { 66 | int old = lv_bar_get_value(target); 67 | lv_bar_set_value(target, old+val, anm); 68 | } 69 | 70 | void _ui_slider_increment( lv_obj_t *target, int val, int anm) 71 | { 72 | int old = lv_slider_get_value(target); 73 | lv_slider_set_value(target, old+val, anm); 74 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 75 | } 76 | 77 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea) 78 | { 79 | lv_keyboard_set_textarea(keyboard, textarea); 80 | } 81 | 82 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value) 83 | { 84 | if (value==_UI_MODIFY_FLAG_TOGGLE) 85 | { 86 | if ( lv_obj_has_flag(target,flag) ) lv_obj_clear_flag(target,flag); 87 | else lv_obj_add_flag(target,flag); 88 | } 89 | else if (value==_UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target,flag); 90 | else lv_obj_clear_flag(target,flag); 91 | } 92 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value) 93 | { 94 | if (value==_UI_MODIFY_STATE_TOGGLE) 95 | { 96 | if ( lv_obj_has_state(target,state) ) lv_obj_clear_state(target,state); 97 | else lv_obj_add_state(target,state); 98 | } 99 | else if (value==_UI_MODIFY_STATE_ADD) lv_obj_add_state(target,state); 100 | else lv_obj_clear_state(target,state); 101 | } 102 | 103 | void _ui_opacity_set( lv_obj_t *target, int val) 104 | { 105 | lv_obj_set_style_opa(target, val, 0); 106 | } 107 | 108 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v) 109 | { 110 | lv_obj_set_x((lv_obj_t *)a->user_data, v); 111 | } 112 | 113 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v) 114 | { 115 | lv_obj_set_y((lv_obj_t *)a->user_data, v); 116 | } 117 | 118 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v) 119 | { 120 | lv_obj_set_width((lv_obj_t *)a->user_data, v); 121 | } 122 | 123 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v) 124 | { 125 | lv_obj_set_height((lv_obj_t *)a->user_data, v); 126 | } 127 | 128 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v) 129 | { 130 | lv_obj_set_style_opa((lv_obj_t *)a->user_data, v, 0); 131 | } 132 | 133 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v) 134 | { 135 | lv_img_set_zoom((lv_obj_t *)a->user_data, v); 136 | } 137 | 138 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v) 139 | { 140 | lv_img_set_angle((lv_obj_t *)a->user_data, v); 141 | } 142 | 143 | 144 | int32_t _ui_anim_callback_get_x(lv_anim_t* a) 145 | { 146 | return lv_obj_get_x_aligned((lv_obj_t *)a->user_data); 147 | } 148 | 149 | int32_t _ui_anim_callback_get_y(lv_anim_t* a) 150 | { 151 | return lv_obj_get_y_aligned((lv_obj_t *)a->user_data); 152 | } 153 | 154 | int32_t _ui_anim_callback_get_width(lv_anim_t* a) 155 | { 156 | return lv_obj_get_width((lv_obj_t *)a->user_data); 157 | } 158 | 159 | int32_t _ui_anim_callback_get_height(lv_anim_t* a) 160 | { 161 | return lv_obj_get_height((lv_obj_t *)a->user_data); 162 | } 163 | 164 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a) 165 | { 166 | return lv_obj_get_style_opa((lv_obj_t *)a->user_data, 0); 167 | } 168 | 169 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a) 170 | { 171 | return lv_img_get_zoom((lv_obj_t *)a->user_data); 172 | } 173 | 174 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a) 175 | { 176 | return lv_img_get_angle((lv_obj_t *)a->user_data); 177 | } 178 | 179 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 180 | { 181 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 182 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix); 183 | lv_label_set_text(trg, buf); 184 | } 185 | 186 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 187 | { 188 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 189 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix); 190 | lv_label_set_text(trg, buf); 191 | } 192 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off) 193 | { 194 | if (lv_obj_has_state(src,LV_STATE_CHECKED)) lv_label_set_text(trg,txt_on); 195 | else lv_label_set_text(trg,txt_off); 196 | } 197 | 198 | 199 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_GIF/ui_helpers.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_HELPERS_H 7 | #define _SQUARELINE_PROJECT_UI_HELPERS_H 8 | 9 | #include "ui.h" 10 | 11 | #define _UI_TEMPORARY_STRING_BUFFER_SIZE 32 12 | #define _UI_BAR_PROPERTY_VALUE 0 13 | #define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1 14 | void _ui_bar_set_property( lv_obj_t *target, int id, int val); 15 | 16 | #define _UI_BASIC_PROPERTY_POSITION_X 0 17 | #define _UI_BASIC_PROPERTY_POSITION_Y 1 18 | #define _UI_BASIC_PROPERTY_WIDTH 2 19 | #define _UI_BASIC_PROPERTY_HEIGHT 3 20 | void _ui_basic_set_property( lv_obj_t *target, int id, int val); 21 | 22 | #define _UI_DROPDOWN_PROPERTY_SELECTED 0 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val); 24 | 25 | #define _UI_IMAGE_PROPERTY_IMAGE 0 26 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val); 27 | 28 | #define _UI_LABEL_PROPERTY_TEXT 0 29 | void _ui_label_set_property( lv_obj_t *target, int id, char *val); 30 | 31 | #define _UI_ROLLER_PROPERTY_SELECTED 0 32 | #define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1 33 | void _ui_roller_set_property( lv_obj_t *target, int id, int val); 34 | 35 | #define _UI_SLIDER_PROPERTY_VALUE 0 36 | #define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1 37 | void _ui_slider_set_property( lv_obj_t *target, int id, int val); 38 | 39 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay); 40 | 41 | void _ui_arc_increment( lv_obj_t *target, int val); 42 | 43 | void _ui_bar_increment( lv_obj_t *target, int val, int anm); 44 | 45 | void _ui_slider_increment( lv_obj_t *target, int val, int anm); 46 | 47 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea); 48 | 49 | #define _UI_MODIFY_FLAG_ADD 0 50 | #define _UI_MODIFY_FLAG_REMOVE 1 51 | #define _UI_MODIFY_FLAG_TOGGLE 2 52 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value); 53 | 54 | #define _UI_MODIFY_STATE_ADD 0 55 | #define _UI_MODIFY_STATE_REMOVE 1 56 | #define _UI_MODIFY_STATE_TOGGLE 2 57 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value); 58 | 59 | void _ui_opacity_set( lv_obj_t *target, int val); 60 | 61 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v); 62 | 63 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v); 64 | 65 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v); 66 | 67 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v); 68 | 69 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v); 70 | 71 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v); 72 | 73 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v); 74 | 75 | int32_t _ui_anim_callback_get_x(lv_anim_t* a); 76 | 77 | int32_t _ui_anim_callback_get_y(lv_anim_t* a); 78 | 79 | int32_t _ui_anim_callback_get_width(lv_anim_t* a); 80 | 81 | int32_t _ui_anim_callback_get_height(lv_anim_t* a); 82 | 83 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a); 84 | 85 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a); 86 | 87 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a); 88 | 89 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 90 | 91 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 92 | 93 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off); 94 | 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_GIF_simple/data/79K5240.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/LVGL_Watchface_240_T-Watch_2021_GIF_simple/data/79K5240.gif -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_GIF_simple/ui.c: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #include "ui.h" 7 | #include "ui_helpers.h" 8 | 9 | ///////////////////// VARIABLES //////////////////// 10 | lv_obj_t *ui_Screen1; 11 | lv_obj_t *ui_Image1; 12 | lv_obj_t *ui_ImageArmHour; 13 | lv_obj_t *ui_ImageArmMinute; 14 | lv_obj_t *ui_ImageArmSecond; 15 | 16 | ///////////////////// TEST LVGL SETTINGS //////////////////// 17 | #if LV_COLOR_DEPTH != 16 18 | #error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings" 19 | #endif 20 | #if LV_COLOR_16_SWAP !=0 21 | #error "LV_COLOR_16_SWAP should be 0 to match SquareLine Studio's settings" 22 | #endif 23 | 24 | ///////////////////// ANIMATIONS //////////////////// 25 | 26 | ///////////////////// FUNCTIONS //////////////////// 27 | 28 | ///////////////////// SCREENS //////////////////// 29 | void ui_Screen1_screen_init(void) 30 | { 31 | ui_Screen1 = lv_obj_create(NULL); 32 | lv_obj_clear_flag( ui_Screen1, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 33 | 34 | ui_Image1 = lv_canvas_create(ui_Screen1); 35 | lv_obj_set_width( ui_Image1, LV_SIZE_CONTENT); /// 1 36 | lv_obj_set_height( ui_Image1, LV_SIZE_CONTENT); /// 1 37 | lv_obj_set_align( ui_Image1, LV_ALIGN_CENTER ); 38 | lv_obj_add_flag( ui_Image1, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 39 | lv_obj_clear_flag( ui_Image1, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 40 | 41 | ui_ImageArmHour = lv_img_create(ui_Screen1); 42 | lv_img_set_src(ui_ImageArmHour, &ui_img_armhour_png); 43 | lv_obj_set_width( ui_ImageArmHour, LV_SIZE_CONTENT); /// 1 44 | lv_obj_set_height( ui_ImageArmHour, LV_SIZE_CONTENT); /// 1 45 | lv_obj_set_x( ui_ImageArmHour, 0 ); 46 | lv_obj_set_y( ui_ImageArmHour, -35 ); 47 | lv_obj_set_align( ui_ImageArmHour, LV_ALIGN_CENTER ); 48 | lv_obj_add_flag( ui_ImageArmHour, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 49 | lv_obj_clear_flag( ui_ImageArmHour, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 50 | lv_img_set_pivot(ui_ImageArmHour,9,77); 51 | lv_img_set_angle(ui_ImageArmHour,750); 52 | 53 | ui_ImageArmMinute = lv_img_create(ui_Screen1); 54 | lv_img_set_src(ui_ImageArmMinute, &ui_img_armminute_png); 55 | lv_obj_set_width( ui_ImageArmMinute, LV_SIZE_CONTENT); /// 1 56 | lv_obj_set_height( ui_ImageArmMinute, LV_SIZE_CONTENT); /// 1 57 | lv_obj_set_x( ui_ImageArmMinute, 0 ); 58 | lv_obj_set_y( ui_ImageArmMinute, -49 ); 59 | lv_obj_set_align( ui_ImageArmMinute, LV_ALIGN_CENTER ); 60 | lv_obj_add_flag( ui_ImageArmMinute, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 61 | lv_obj_clear_flag( ui_ImageArmMinute, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 62 | lv_img_set_pivot(ui_ImageArmMinute,9,105); 63 | lv_img_set_angle(ui_ImageArmMinute,1800); 64 | 65 | ui_ImageArmSecond = lv_img_create(ui_Screen1); 66 | lv_img_set_src(ui_ImageArmSecond, &ui_img_armsecond_png); 67 | lv_obj_set_width( ui_ImageArmSecond, LV_SIZE_CONTENT); /// 1 68 | lv_obj_set_height( ui_ImageArmSecond, LV_SIZE_CONTENT); /// 1 69 | lv_obj_set_x( ui_ImageArmSecond, 0 ); 70 | lv_obj_set_y( ui_ImageArmSecond, -47 ); 71 | lv_obj_set_align( ui_ImageArmSecond, LV_ALIGN_CENTER ); 72 | lv_obj_add_flag( ui_ImageArmSecond, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 73 | lv_obj_clear_flag( ui_ImageArmSecond, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 74 | lv_img_set_pivot(ui_ImageArmSecond,5,115); 75 | lv_img_set_angle(ui_ImageArmSecond,3150); 76 | 77 | } 78 | 79 | void ui_init( void ) 80 | { 81 | lv_disp_t *dispp = lv_disp_get_default(); 82 | lv_theme_t *theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), true, LV_FONT_DEFAULT); 83 | lv_disp_set_theme(dispp, theme); 84 | ui_Screen1_screen_init(); 85 | lv_disp_load_scr( ui_Screen1); 86 | } 87 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_GIF_simple/ui.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_H 7 | #define _SQUARELINE_PROJECT_UI_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #if defined __has_include 14 | #if __has_include("lvgl.h") 15 | #include "lvgl.h" 16 | #elif __has_include("lvgl/lvgl.h") 17 | #include "lvgl/lvgl.h" 18 | #else 19 | #include "lvgl.h" 20 | #endif 21 | #else 22 | #include "lvgl.h" 23 | #endif 24 | 25 | extern lv_obj_t *ui_Screen1; 26 | extern lv_obj_t *ui_Image1; 27 | extern lv_obj_t *ui_ImageArmHour; 28 | extern lv_obj_t *ui_ImageArmMinute; 29 | extern lv_obj_t *ui_ImageArmSecond; 30 | 31 | 32 | LV_IMG_DECLARE( ui_img_armhour_png); // assets/armHour.png 33 | LV_IMG_DECLARE( ui_img_armminute_png); // assets/armMinute.png 34 | LV_IMG_DECLARE( ui_img_armsecond_png); // assets/armSecond.png 35 | 36 | 37 | 38 | 39 | void ui_init(void); 40 | 41 | #ifdef __cplusplus 42 | } /*extern "C"*/ 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_GIF_simple/ui_helpers.c: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #include "ui_helpers.h" 7 | 8 | void _ui_bar_set_property( lv_obj_t *target, int id, int val) 9 | { 10 | if (id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON); 11 | if (id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF); 12 | } 13 | 14 | void _ui_basic_set_property( lv_obj_t *target, int id, int val) 15 | { 16 | if (id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val); 17 | if (id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val); 18 | if (id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val); 19 | if (id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val); 20 | } 21 | 22 | 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val) 24 | { 25 | if (id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val); 26 | } 27 | 28 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val) 29 | { 30 | if (id == _UI_IMAGE_PROPERTY_IMAGE) lv_img_set_src(target, val); 31 | } 32 | 33 | void _ui_label_set_property( lv_obj_t *target, int id, char *val) 34 | { 35 | if (id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val); 36 | } 37 | 38 | 39 | void _ui_roller_set_property( lv_obj_t *target, int id, int val) 40 | { 41 | if (id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON); 42 | if (id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF); 43 | } 44 | 45 | void _ui_slider_set_property( lv_obj_t *target, int id, int val) 46 | { 47 | if (id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON); 48 | if (id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF); 49 | } 50 | 51 | 52 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay) 53 | { 54 | lv_scr_load_anim(target, fademode, spd, delay, false); 55 | } 56 | 57 | void _ui_arc_increment( lv_obj_t *target, int val) 58 | { 59 | int old = lv_arc_get_value(target); 60 | lv_arc_set_value(target, old+val); 61 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 62 | } 63 | 64 | void _ui_bar_increment( lv_obj_t *target, int val, int anm) 65 | { 66 | int old = lv_bar_get_value(target); 67 | lv_bar_set_value(target, old+val, anm); 68 | } 69 | 70 | void _ui_slider_increment( lv_obj_t *target, int val, int anm) 71 | { 72 | int old = lv_slider_get_value(target); 73 | lv_slider_set_value(target, old+val, anm); 74 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 75 | } 76 | 77 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea) 78 | { 79 | lv_keyboard_set_textarea(keyboard, textarea); 80 | } 81 | 82 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value) 83 | { 84 | if (value==_UI_MODIFY_FLAG_TOGGLE) 85 | { 86 | if ( lv_obj_has_flag(target,flag) ) lv_obj_clear_flag(target,flag); 87 | else lv_obj_add_flag(target,flag); 88 | } 89 | else if (value==_UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target,flag); 90 | else lv_obj_clear_flag(target,flag); 91 | } 92 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value) 93 | { 94 | if (value==_UI_MODIFY_STATE_TOGGLE) 95 | { 96 | if ( lv_obj_has_state(target,state) ) lv_obj_clear_state(target,state); 97 | else lv_obj_add_state(target,state); 98 | } 99 | else if (value==_UI_MODIFY_STATE_ADD) lv_obj_add_state(target,state); 100 | else lv_obj_clear_state(target,state); 101 | } 102 | 103 | void _ui_opacity_set( lv_obj_t *target, int val) 104 | { 105 | lv_obj_set_style_opa(target, val, 0); 106 | } 107 | 108 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v) 109 | { 110 | lv_obj_set_x((lv_obj_t *)a->user_data, v); 111 | } 112 | 113 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v) 114 | { 115 | lv_obj_set_y((lv_obj_t *)a->user_data, v); 116 | } 117 | 118 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v) 119 | { 120 | lv_obj_set_width((lv_obj_t *)a->user_data, v); 121 | } 122 | 123 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v) 124 | { 125 | lv_obj_set_height((lv_obj_t *)a->user_data, v); 126 | } 127 | 128 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v) 129 | { 130 | lv_obj_set_style_opa((lv_obj_t *)a->user_data, v, 0); 131 | } 132 | 133 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v) 134 | { 135 | lv_img_set_zoom((lv_obj_t *)a->user_data, v); 136 | } 137 | 138 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v) 139 | { 140 | lv_img_set_angle((lv_obj_t *)a->user_data, v); 141 | } 142 | 143 | 144 | int32_t _ui_anim_callback_get_x(lv_anim_t* a) 145 | { 146 | return lv_obj_get_x_aligned((lv_obj_t *)a->user_data); 147 | } 148 | 149 | int32_t _ui_anim_callback_get_y(lv_anim_t* a) 150 | { 151 | return lv_obj_get_y_aligned((lv_obj_t *)a->user_data); 152 | } 153 | 154 | int32_t _ui_anim_callback_get_width(lv_anim_t* a) 155 | { 156 | return lv_obj_get_width((lv_obj_t *)a->user_data); 157 | } 158 | 159 | int32_t _ui_anim_callback_get_height(lv_anim_t* a) 160 | { 161 | return lv_obj_get_height((lv_obj_t *)a->user_data); 162 | } 163 | 164 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a) 165 | { 166 | return lv_obj_get_style_opa((lv_obj_t *)a->user_data, 0); 167 | } 168 | 169 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a) 170 | { 171 | return lv_img_get_zoom((lv_obj_t *)a->user_data); 172 | } 173 | 174 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a) 175 | { 176 | return lv_img_get_angle((lv_obj_t *)a->user_data); 177 | } 178 | 179 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 180 | { 181 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 182 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix); 183 | lv_label_set_text(trg, buf); 184 | } 185 | 186 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 187 | { 188 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 189 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix); 190 | lv_label_set_text(trg, buf); 191 | } 192 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off) 193 | { 194 | if (lv_obj_has_state(src,LV_STATE_CHECKED)) lv_label_set_text(trg,txt_on); 195 | else lv_label_set_text(trg,txt_off); 196 | } 197 | 198 | 199 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_GIF_simple/ui_helpers.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_HELPERS_H 7 | #define _SQUARELINE_PROJECT_UI_HELPERS_H 8 | 9 | #include "ui.h" 10 | 11 | #define _UI_TEMPORARY_STRING_BUFFER_SIZE 32 12 | #define _UI_BAR_PROPERTY_VALUE 0 13 | #define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1 14 | void _ui_bar_set_property( lv_obj_t *target, int id, int val); 15 | 16 | #define _UI_BASIC_PROPERTY_POSITION_X 0 17 | #define _UI_BASIC_PROPERTY_POSITION_Y 1 18 | #define _UI_BASIC_PROPERTY_WIDTH 2 19 | #define _UI_BASIC_PROPERTY_HEIGHT 3 20 | void _ui_basic_set_property( lv_obj_t *target, int id, int val); 21 | 22 | #define _UI_DROPDOWN_PROPERTY_SELECTED 0 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val); 24 | 25 | #define _UI_IMAGE_PROPERTY_IMAGE 0 26 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val); 27 | 28 | #define _UI_LABEL_PROPERTY_TEXT 0 29 | void _ui_label_set_property( lv_obj_t *target, int id, char *val); 30 | 31 | #define _UI_ROLLER_PROPERTY_SELECTED 0 32 | #define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1 33 | void _ui_roller_set_property( lv_obj_t *target, int id, int val); 34 | 35 | #define _UI_SLIDER_PROPERTY_VALUE 0 36 | #define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1 37 | void _ui_slider_set_property( lv_obj_t *target, int id, int val); 38 | 39 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay); 40 | 41 | void _ui_arc_increment( lv_obj_t *target, int val); 42 | 43 | void _ui_bar_increment( lv_obj_t *target, int val, int anm); 44 | 45 | void _ui_slider_increment( lv_obj_t *target, int val, int anm); 46 | 47 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea); 48 | 49 | #define _UI_MODIFY_FLAG_ADD 0 50 | #define _UI_MODIFY_FLAG_REMOVE 1 51 | #define _UI_MODIFY_FLAG_TOGGLE 2 52 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value); 53 | 54 | #define _UI_MODIFY_STATE_ADD 0 55 | #define _UI_MODIFY_STATE_REMOVE 1 56 | #define _UI_MODIFY_STATE_TOGGLE 2 57 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value); 58 | 59 | void _ui_opacity_set( lv_obj_t *target, int val); 60 | 61 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v); 62 | 63 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v); 64 | 65 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v); 66 | 67 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v); 68 | 69 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v); 70 | 71 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v); 72 | 73 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v); 74 | 75 | int32_t _ui_anim_callback_get_x(lv_anim_t* a); 76 | 77 | int32_t _ui_anim_callback_get_y(lv_anim_t* a); 78 | 79 | int32_t _ui_anim_callback_get_width(lv_anim_t* a); 80 | 81 | int32_t _ui_anim_callback_get_height(lv_anim_t* a); 82 | 83 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a); 84 | 85 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a); 86 | 87 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a); 88 | 89 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 90 | 91 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 92 | 93 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off); 94 | 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_animation/ui.c: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #include "ui.h" 7 | #include "ui_helpers.h" 8 | 9 | ///////////////////// VARIABLES //////////////////// 10 | lv_obj_t *ui_Screen1; 11 | lv_obj_t *ui_Image1; 12 | lv_obj_t *ui_ImageWatchface; 13 | lv_obj_t *ui_ImageArmHour; 14 | lv_obj_t *ui_ImageArmMinute; 15 | lv_obj_t *ui_ImageArmSecond; 16 | lv_obj_t *ui_LabelDate; 17 | 18 | ///////////////////// TEST LVGL SETTINGS //////////////////// 19 | #if LV_COLOR_DEPTH != 16 20 | #error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings" 21 | #endif 22 | #if LV_COLOR_16_SWAP !=1 23 | #error "LV_COLOR_16_SWAP should be 1 to match SquareLine Studio's settings" 24 | #endif 25 | 26 | ///////////////////// ANIMATIONS //////////////////// 27 | 28 | ///////////////////// FUNCTIONS //////////////////// 29 | 30 | ///////////////////// SCREENS //////////////////// 31 | void ui_Screen1_screen_init(void) 32 | { 33 | ui_Screen1 = lv_obj_create(NULL); 34 | lv_obj_clear_flag( ui_Screen1, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 35 | 36 | ui_Image1 = lv_animimg_create(ui_Screen1); 37 | lv_img_set_src(ui_Image1, &ui_img_01_png); 38 | lv_obj_set_width( ui_Image1, LV_SIZE_CONTENT); /// 1 39 | lv_obj_set_height( ui_Image1, LV_SIZE_CONTENT); /// 1 40 | lv_obj_set_align( ui_Image1, LV_ALIGN_CENTER ); 41 | lv_obj_add_flag( ui_Image1, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 42 | lv_obj_clear_flag( ui_Image1, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 43 | 44 | ui_ImageWatchface = lv_img_create(ui_Screen1); 45 | lv_img_set_src(ui_ImageWatchface, &ui_img_watchface240_png); 46 | lv_obj_set_width( ui_ImageWatchface, LV_SIZE_CONTENT); /// 1 47 | lv_obj_set_height( ui_ImageWatchface, LV_SIZE_CONTENT); /// 1 48 | lv_obj_set_align( ui_ImageWatchface, LV_ALIGN_CENTER ); 49 | lv_obj_add_flag( ui_ImageWatchface, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 50 | lv_obj_clear_flag( ui_ImageWatchface, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 51 | 52 | ui_ImageArmHour = lv_img_create(ui_Screen1); 53 | lv_img_set_src(ui_ImageArmHour, &ui_img_armhour_png); 54 | lv_obj_set_width( ui_ImageArmHour, LV_SIZE_CONTENT); /// 1 55 | lv_obj_set_height( ui_ImageArmHour, LV_SIZE_CONTENT); /// 1 56 | lv_obj_set_x( ui_ImageArmHour, 0 ); 57 | lv_obj_set_y( ui_ImageArmHour, -35 ); 58 | lv_obj_set_align( ui_ImageArmHour, LV_ALIGN_CENTER ); 59 | lv_obj_add_flag( ui_ImageArmHour, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 60 | lv_obj_clear_flag( ui_ImageArmHour, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 61 | lv_img_set_pivot(ui_ImageArmHour,9,77); 62 | lv_img_set_angle(ui_ImageArmHour,750); 63 | 64 | ui_ImageArmMinute = lv_img_create(ui_Screen1); 65 | lv_img_set_src(ui_ImageArmMinute, &ui_img_armminute_png); 66 | lv_obj_set_width( ui_ImageArmMinute, LV_SIZE_CONTENT); /// 1 67 | lv_obj_set_height( ui_ImageArmMinute, LV_SIZE_CONTENT); /// 1 68 | lv_obj_set_x( ui_ImageArmMinute, 0 ); 69 | lv_obj_set_y( ui_ImageArmMinute, -49 ); 70 | lv_obj_set_align( ui_ImageArmMinute, LV_ALIGN_CENTER ); 71 | lv_obj_add_flag( ui_ImageArmMinute, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 72 | lv_obj_clear_flag( ui_ImageArmMinute, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 73 | lv_img_set_pivot(ui_ImageArmMinute,9,105); 74 | lv_img_set_angle(ui_ImageArmMinute,1800); 75 | 76 | ui_ImageArmSecond = lv_img_create(ui_Screen1); 77 | lv_img_set_src(ui_ImageArmSecond, &ui_img_armsecond_png); 78 | lv_obj_set_width( ui_ImageArmSecond, LV_SIZE_CONTENT); /// 1 79 | lv_obj_set_height( ui_ImageArmSecond, LV_SIZE_CONTENT); /// 1 80 | lv_obj_set_x( ui_ImageArmSecond, 0 ); 81 | lv_obj_set_y( ui_ImageArmSecond, -47 ); 82 | lv_obj_set_align( ui_ImageArmSecond, LV_ALIGN_CENTER ); 83 | lv_obj_add_flag( ui_ImageArmSecond, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 84 | lv_obj_clear_flag( ui_ImageArmSecond, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 85 | lv_img_set_pivot(ui_ImageArmSecond,5,115); 86 | lv_img_set_angle(ui_ImageArmSecond,3150); 87 | 88 | ui_LabelDate = lv_label_create(ui_Screen1); 89 | lv_obj_set_width( ui_LabelDate, LV_SIZE_CONTENT); /// 1 90 | lv_obj_set_height( ui_LabelDate, LV_SIZE_CONTENT); /// 1 91 | lv_obj_set_x( ui_LabelDate, 72 ); 92 | lv_obj_set_y( ui_LabelDate, 0 ); 93 | lv_obj_set_align( ui_LabelDate, LV_ALIGN_CENTER ); 94 | lv_label_set_text(ui_LabelDate,"dow dd"); 95 | lv_obj_set_style_text_color(ui_LabelDate, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT ); 96 | lv_obj_set_style_text_opa(ui_LabelDate, 255, LV_PART_MAIN| LV_STATE_DEFAULT); 97 | lv_obj_set_style_text_font(ui_LabelDate, &lv_font_montserrat_14, LV_PART_MAIN| LV_STATE_DEFAULT); 98 | 99 | } 100 | 101 | void ui_init( void ) 102 | { 103 | lv_disp_t *dispp = lv_disp_get_default(); 104 | lv_theme_t *theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), true, LV_FONT_DEFAULT); 105 | lv_disp_set_theme(dispp, theme); 106 | ui_Screen1_screen_init(); 107 | lv_disp_load_scr( ui_Screen1); 108 | } 109 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_animation/ui.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_H 7 | #define _SQUARELINE_PROJECT_UI_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #if defined __has_include 14 | #if __has_include("lvgl.h") 15 | #include "lvgl.h" 16 | #elif __has_include("lvgl/lvgl.h") 17 | #include "lvgl/lvgl.h" 18 | #else 19 | #include "lvgl.h" 20 | #endif 21 | #else 22 | #include "lvgl.h" 23 | #endif 24 | 25 | extern lv_obj_t *ui_Screen1; 26 | extern lv_obj_t *ui_Image1; 27 | extern lv_obj_t *ui_ImageWatchface; 28 | extern lv_obj_t *ui_ImageArmHour; 29 | extern lv_obj_t *ui_ImageArmMinute; 30 | extern lv_obj_t *ui_ImageArmSecond; 31 | extern lv_obj_t *ui_LabelDate; 32 | 33 | 34 | LV_IMG_DECLARE( ui_img_01_png); // assets/01.png 35 | LV_IMG_DECLARE( ui_img_watchface240_png); // assets/watchface240.png 36 | LV_IMG_DECLARE( ui_img_armhour_png); // assets/armHour.png 37 | LV_IMG_DECLARE( ui_img_armminute_png); // assets/armMinute.png 38 | LV_IMG_DECLARE( ui_img_armsecond_png); // assets/armSecond.png 39 | 40 | 41 | 42 | 43 | void ui_init(void); 44 | 45 | #ifdef __cplusplus 46 | } /*extern "C"*/ 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_animation/ui_helpers.c: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #include "ui_helpers.h" 7 | 8 | void _ui_bar_set_property( lv_obj_t *target, int id, int val) 9 | { 10 | if (id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON); 11 | if (id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF); 12 | } 13 | 14 | void _ui_basic_set_property( lv_obj_t *target, int id, int val) 15 | { 16 | if (id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val); 17 | if (id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val); 18 | if (id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val); 19 | if (id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val); 20 | } 21 | 22 | 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val) 24 | { 25 | if (id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val); 26 | } 27 | 28 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val) 29 | { 30 | if (id == _UI_IMAGE_PROPERTY_IMAGE) lv_img_set_src(target, val); 31 | } 32 | 33 | void _ui_label_set_property( lv_obj_t *target, int id, char *val) 34 | { 35 | if (id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val); 36 | } 37 | 38 | 39 | void _ui_roller_set_property( lv_obj_t *target, int id, int val) 40 | { 41 | if (id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON); 42 | if (id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF); 43 | } 44 | 45 | void _ui_slider_set_property( lv_obj_t *target, int id, int val) 46 | { 47 | if (id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON); 48 | if (id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF); 49 | } 50 | 51 | 52 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay) 53 | { 54 | lv_scr_load_anim(target, fademode, spd, delay, false); 55 | } 56 | 57 | void _ui_arc_increment( lv_obj_t *target, int val) 58 | { 59 | int old = lv_arc_get_value(target); 60 | lv_arc_set_value(target, old+val); 61 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 62 | } 63 | 64 | void _ui_bar_increment( lv_obj_t *target, int val, int anm) 65 | { 66 | int old = lv_bar_get_value(target); 67 | lv_bar_set_value(target, old+val, anm); 68 | } 69 | 70 | void _ui_slider_increment( lv_obj_t *target, int val, int anm) 71 | { 72 | int old = lv_slider_get_value(target); 73 | lv_slider_set_value(target, old+val, anm); 74 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 75 | } 76 | 77 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea) 78 | { 79 | lv_keyboard_set_textarea(keyboard, textarea); 80 | } 81 | 82 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value) 83 | { 84 | if (value==_UI_MODIFY_FLAG_TOGGLE) 85 | { 86 | if ( lv_obj_has_flag(target,flag) ) lv_obj_clear_flag(target,flag); 87 | else lv_obj_add_flag(target,flag); 88 | } 89 | else if (value==_UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target,flag); 90 | else lv_obj_clear_flag(target,flag); 91 | } 92 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value) 93 | { 94 | if (value==_UI_MODIFY_STATE_TOGGLE) 95 | { 96 | if ( lv_obj_has_state(target,state) ) lv_obj_clear_state(target,state); 97 | else lv_obj_add_state(target,state); 98 | } 99 | else if (value==_UI_MODIFY_STATE_ADD) lv_obj_add_state(target,state); 100 | else lv_obj_clear_state(target,state); 101 | } 102 | 103 | void _ui_opacity_set( lv_obj_t *target, int val) 104 | { 105 | lv_obj_set_style_opa(target, val, 0); 106 | } 107 | 108 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v) 109 | { 110 | lv_obj_set_x((lv_obj_t *)a->user_data, v); 111 | } 112 | 113 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v) 114 | { 115 | lv_obj_set_y((lv_obj_t *)a->user_data, v); 116 | } 117 | 118 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v) 119 | { 120 | lv_obj_set_width((lv_obj_t *)a->user_data, v); 121 | } 122 | 123 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v) 124 | { 125 | lv_obj_set_height((lv_obj_t *)a->user_data, v); 126 | } 127 | 128 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v) 129 | { 130 | lv_obj_set_style_opa((lv_obj_t *)a->user_data, v, 0); 131 | } 132 | 133 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v) 134 | { 135 | lv_img_set_zoom((lv_obj_t *)a->user_data, v); 136 | } 137 | 138 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v) 139 | { 140 | lv_img_set_angle((lv_obj_t *)a->user_data, v); 141 | } 142 | 143 | 144 | int32_t _ui_anim_callback_get_x(lv_anim_t* a) 145 | { 146 | return lv_obj_get_x_aligned((lv_obj_t *)a->user_data); 147 | } 148 | 149 | int32_t _ui_anim_callback_get_y(lv_anim_t* a) 150 | { 151 | return lv_obj_get_y_aligned((lv_obj_t *)a->user_data); 152 | } 153 | 154 | int32_t _ui_anim_callback_get_width(lv_anim_t* a) 155 | { 156 | return lv_obj_get_width((lv_obj_t *)a->user_data); 157 | } 158 | 159 | int32_t _ui_anim_callback_get_height(lv_anim_t* a) 160 | { 161 | return lv_obj_get_height((lv_obj_t *)a->user_data); 162 | } 163 | 164 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a) 165 | { 166 | return lv_obj_get_style_opa((lv_obj_t *)a->user_data, 0); 167 | } 168 | 169 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a) 170 | { 171 | return lv_img_get_zoom((lv_obj_t *)a->user_data); 172 | } 173 | 174 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a) 175 | { 176 | return lv_img_get_angle((lv_obj_t *)a->user_data); 177 | } 178 | 179 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 180 | { 181 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 182 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix); 183 | lv_label_set_text(trg, buf); 184 | } 185 | 186 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 187 | { 188 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 189 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix); 190 | lv_label_set_text(trg, buf); 191 | } 192 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off) 193 | { 194 | if (lv_obj_has_state(src,LV_STATE_CHECKED)) lv_label_set_text(trg,txt_on); 195 | else lv_label_set_text(trg,txt_off); 196 | } 197 | 198 | 199 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_T-Watch_2021_animation/ui_helpers.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_HELPERS_H 7 | #define _SQUARELINE_PROJECT_UI_HELPERS_H 8 | 9 | #include "ui.h" 10 | 11 | #define _UI_TEMPORARY_STRING_BUFFER_SIZE 32 12 | #define _UI_BAR_PROPERTY_VALUE 0 13 | #define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1 14 | void _ui_bar_set_property( lv_obj_t *target, int id, int val); 15 | 16 | #define _UI_BASIC_PROPERTY_POSITION_X 0 17 | #define _UI_BASIC_PROPERTY_POSITION_Y 1 18 | #define _UI_BASIC_PROPERTY_WIDTH 2 19 | #define _UI_BASIC_PROPERTY_HEIGHT 3 20 | void _ui_basic_set_property( lv_obj_t *target, int id, int val); 21 | 22 | #define _UI_DROPDOWN_PROPERTY_SELECTED 0 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val); 24 | 25 | #define _UI_IMAGE_PROPERTY_IMAGE 0 26 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val); 27 | 28 | #define _UI_LABEL_PROPERTY_TEXT 0 29 | void _ui_label_set_property( lv_obj_t *target, int id, char *val); 30 | 31 | #define _UI_ROLLER_PROPERTY_SELECTED 0 32 | #define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1 33 | void _ui_roller_set_property( lv_obj_t *target, int id, int val); 34 | 35 | #define _UI_SLIDER_PROPERTY_VALUE 0 36 | #define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1 37 | void _ui_slider_set_property( lv_obj_t *target, int id, int val); 38 | 39 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay); 40 | 41 | void _ui_arc_increment( lv_obj_t *target, int val); 42 | 43 | void _ui_bar_increment( lv_obj_t *target, int val, int anm); 44 | 45 | void _ui_slider_increment( lv_obj_t *target, int val, int anm); 46 | 47 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea); 48 | 49 | #define _UI_MODIFY_FLAG_ADD 0 50 | #define _UI_MODIFY_FLAG_REMOVE 1 51 | #define _UI_MODIFY_FLAG_TOGGLE 2 52 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value); 53 | 54 | #define _UI_MODIFY_STATE_ADD 0 55 | #define _UI_MODIFY_STATE_REMOVE 1 56 | #define _UI_MODIFY_STATE_TOGGLE 2 57 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value); 58 | 59 | void _ui_opacity_set( lv_obj_t *target, int val); 60 | 61 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v); 62 | 63 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v); 64 | 65 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v); 66 | 67 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v); 68 | 69 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v); 70 | 71 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v); 72 | 73 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v); 74 | 75 | int32_t _ui_anim_callback_get_x(lv_anim_t* a); 76 | 77 | int32_t _ui_anim_callback_get_y(lv_anim_t* a); 78 | 79 | int32_t _ui_anim_callback_get_width(lv_anim_t* a); 80 | 81 | int32_t _ui_anim_callback_get_height(lv_anim_t* a); 82 | 83 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a); 84 | 85 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a); 86 | 87 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a); 88 | 89 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 90 | 91 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 92 | 93 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off); 94 | 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_XIAO/LVGL_Watchface_240_XIAO.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * LVGL Watchface 3 | * 4 | * Image by macrovector on Freepik: 5 | * https://www.freepik.com/free-vector/watch-set-expensive-classic-clock-with-leather-metal-straps-illustration_13031503.htm 6 | * 7 | * Dependent libraries: 8 | * LVGL: https://github.com/lvgl/lvgl.git 9 | * 10 | * LVGL Configuration file: 11 | * Copy your_arduino_path/libraries/lvgl/lv_conf_template.h 12 | * to your_arduino_path/libraries/lv_conf.h 13 | * 14 | * In lv_conf.h around line 15, enable config file: 15 | * #if 1 // Set it to "1" to enable content 16 | * 17 | * Then find and set: 18 | * #define LV_COLOR_DEPTH 16 19 | * #define LV_TICK_CUSTOM 1 20 | * 21 | * For SPI/parallel 8 display set color swap can be faster, parallel 16/RGB screen don't swap! 22 | * #define LV_COLOR_16_SWAP 1 // for SPI and parallel 8 23 | * #define LV_COLOR_16_SWAP 0 // for parallel 16 and RGB 24 | ******************************************************************************/ 25 | #include 26 | #include "ui.h" 27 | 28 | /******************************************************************************* 29 | * Start of Arduino_GFX setting 30 | ******************************************************************************/ 31 | #include 32 | Arduino_DataBus *bus = new Arduino_ESP32SPI(5 /* DC */, 3 /* CS */, 8 /* SCK */, 10 /* MOSI */, 9 /* MISO */); 33 | Arduino_GFX *gfx = new Arduino_GC9A01(bus, GFX_NOT_DEFINED /* RST */, 3 /* rotation */, true /* IPS */); 34 | /******************************************************************************* 35 | * End of Arduino_GFX setting 36 | ******************************************************************************/ 37 | 38 | // use compile time for demo only 39 | #define ONE_MINUTE_MS (60 * 1000) 40 | #define ONE_HOUR_MS (60 * 60 * 1000) 41 | #define TWELVE_HOUR_MS (12 * 60 * 60 * 1000) 42 | static uint8_t conv2d(const char *p) 43 | { 44 | uint8_t v = 0; 45 | return (10 * (*p - '0')) + (*++p - '0'); 46 | } 47 | static unsigned long ms_offset; 48 | 49 | static uint32_t screenWidth; 50 | static uint32_t screenHeight; 51 | static lv_disp_draw_buf_t draw_buf; 52 | static lv_color_t *disp_draw_buf; 53 | static lv_disp_drv_t disp_drv; 54 | 55 | /* Display flushing */ 56 | void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) 57 | { 58 | uint32_t w = (area->x2 - area->x1 + 1); 59 | uint32_t h = (area->y2 - area->y1 + 1); 60 | 61 | #if (LV_COLOR_16_SWAP != 0) 62 | gfx->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h); 63 | #else 64 | gfx->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h); 65 | #endif 66 | 67 | lv_disp_flush_ready(disp); 68 | } 69 | 70 | void my_log_cb(const char *buf) 71 | { 72 | Serial.println(buf); 73 | } 74 | 75 | void setup() 76 | { 77 | // use compile time for demo only 78 | uint8_t hh = conv2d(__TIME__); 79 | uint8_t mm = conv2d(__TIME__ + 3); 80 | uint8_t ss = conv2d(__TIME__ + 6); 81 | ms_offset = ((60 * 60 * hh) + (60 * mm) + ss) * 1000; 82 | 83 | Serial.begin(115200); 84 | // Serial.setDebugOutput(true); 85 | // while(!Serial); 86 | Serial.println("LVGL Watchface"); 87 | 88 | #ifdef GFX_EXTRA_PRE_INIT 89 | GFX_EXTRA_PRE_INIT(); 90 | #endif 91 | 92 | // Init Display 93 | gfx->begin(); 94 | gfx->fillScreen(BLACK); 95 | 96 | #ifdef GFX_BL 97 | pinMode(GFX_BL, OUTPUT); 98 | digitalWrite(GFX_BL, HIGH); 99 | #endif 100 | 101 | #if LV_USE_LOG 102 | lv_log_register_print_cb(my_log_cb); 103 | #endif 104 | 105 | lv_init(); 106 | 107 | screenWidth = gfx->width(); 108 | screenHeight = gfx->height(); 109 | #ifdef ESP32 110 | disp_draw_buf = (lv_color_t *)heap_caps_malloc(sizeof(lv_color_t) * screenWidth * 32, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); 111 | #else 112 | disp_draw_buf = (lv_color_t *)malloc(sizeof(lv_color_t) * screenWidth * 32); 113 | #endif 114 | if (!disp_draw_buf) 115 | { 116 | Serial.println("LVGL disp_draw_buf allocate failed!"); 117 | } 118 | else 119 | { 120 | lv_disp_draw_buf_init(&draw_buf, disp_draw_buf, NULL, screenWidth * 32); 121 | 122 | /* Initialize the display */ 123 | lv_disp_drv_init(&disp_drv); 124 | /* Change the following line to your display resolution */ 125 | disp_drv.hor_res = screenWidth; 126 | disp_drv.ver_res = screenHeight; 127 | disp_drv.flush_cb = my_disp_flush; 128 | disp_drv.draw_buf = &draw_buf; 129 | lv_disp_drv_register(&disp_drv); 130 | 131 | /* Initialize the (dummy) input device driver */ 132 | static lv_indev_drv_t indev_drv; 133 | lv_indev_drv_init(&indev_drv); 134 | indev_drv.type = LV_INDEV_TYPE_POINTER; 135 | lv_indev_drv_register(&indev_drv); 136 | 137 | /* Init SquareLine prepared UI */ 138 | ui_init(); 139 | 140 | Serial.println("Setup done"); 141 | } 142 | } 143 | 144 | void loop() 145 | { 146 | lv_timer_handler(); /* let the GUI do its work */ 147 | 148 | unsigned long ms = millis(); 149 | 150 | // set watch arms' angle 151 | unsigned long clock_ms = (ms_offset + ms) % TWELVE_HOUR_MS; 152 | uint8_t hour = clock_ms / ONE_HOUR_MS; 153 | uint8_t minute = (clock_ms % ONE_HOUR_MS) / ONE_MINUTE_MS; 154 | int16_t angle = (clock_ms % ONE_MINUTE_MS) * 3600 / ONE_MINUTE_MS; 155 | lv_img_set_angle(ui_ImageArmSecond, angle); 156 | angle = (angle + (minute * 3600)) / 60; 157 | lv_img_set_angle(ui_ImageArmMinute, angle); 158 | angle = (angle + (hour * 3600)) / 12; 159 | lv_img_set_angle(ui_ImageArmHour, angle); 160 | } 161 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_XIAO/ui.c: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.2.3 3 | // LVGL version: 8.2.0 4 | // Project name: SquareLine_Project 5 | 6 | #include "ui.h" 7 | #include "ui_helpers.h" 8 | 9 | ///////////////////// VARIABLES //////////////////// 10 | lv_obj_t *ui_Screen1; 11 | lv_obj_t *ui_ImageWatchface; 12 | lv_obj_t *ui_ImageArmHour; 13 | lv_obj_t *ui_ImageArmMinute; 14 | lv_obj_t *ui_ImageArmSecond; 15 | lv_obj_t *ui____initial_actions0; 16 | const lv_img_dsc_t *ui_imgset_watchface[1] = {&ui_img_watchface240_png}; 17 | 18 | ///////////////////// TEST LVGL SETTINGS //////////////////// 19 | #if LV_COLOR_DEPTH != 16 20 | #error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings" 21 | #endif 22 | #if LV_COLOR_16_SWAP !=1 23 | #error "LV_COLOR_16_SWAP should be 1 to match SquareLine Studio's settings" 24 | #endif 25 | 26 | ///////////////////// ANIMATIONS //////////////////// 27 | 28 | ///////////////////// FUNCTIONS //////////////////// 29 | 30 | ///////////////////// SCREENS //////////////////// 31 | void ui_Screen1_screen_init(void) 32 | { 33 | ui_Screen1 = lv_obj_create(NULL); 34 | lv_obj_clear_flag( ui_Screen1, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 35 | 36 | ui_ImageWatchface = lv_img_create(ui_Screen1); 37 | lv_img_set_src(ui_ImageWatchface, &ui_img_watchface240seeedstudio_png); 38 | lv_obj_set_width( ui_ImageWatchface, LV_SIZE_CONTENT); /// 1 39 | lv_obj_set_height( ui_ImageWatchface, LV_SIZE_CONTENT); /// 1 40 | lv_obj_set_align( ui_ImageWatchface, LV_ALIGN_CENTER ); 41 | lv_obj_add_flag( ui_ImageWatchface, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 42 | lv_obj_clear_flag( ui_ImageWatchface, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 43 | 44 | ui_ImageArmHour = lv_img_create(ui_Screen1); 45 | lv_img_set_src(ui_ImageArmHour, &ui_img_armhour_png); 46 | lv_obj_set_width( ui_ImageArmHour, LV_SIZE_CONTENT); /// 1 47 | lv_obj_set_height( ui_ImageArmHour, LV_SIZE_CONTENT); /// 1 48 | lv_obj_set_x( ui_ImageArmHour, 0 ); 49 | lv_obj_set_y( ui_ImageArmHour, -35 ); 50 | lv_obj_set_align( ui_ImageArmHour, LV_ALIGN_CENTER ); 51 | lv_obj_add_flag( ui_ImageArmHour, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 52 | lv_obj_clear_flag( ui_ImageArmHour, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 53 | lv_img_set_pivot(ui_ImageArmHour,9,77); 54 | lv_img_set_angle(ui_ImageArmHour,450); 55 | 56 | ui_ImageArmMinute = lv_img_create(ui_Screen1); 57 | lv_img_set_src(ui_ImageArmMinute, &ui_img_armminute_png); 58 | lv_obj_set_width( ui_ImageArmMinute, LV_SIZE_CONTENT); /// 1 59 | lv_obj_set_height( ui_ImageArmMinute, LV_SIZE_CONTENT); /// 1 60 | lv_obj_set_x( ui_ImageArmMinute, 0 ); 61 | lv_obj_set_y( ui_ImageArmMinute, -49 ); 62 | lv_obj_set_align( ui_ImageArmMinute, LV_ALIGN_CENTER ); 63 | lv_obj_add_flag( ui_ImageArmMinute, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 64 | lv_obj_clear_flag( ui_ImageArmMinute, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 65 | lv_img_set_pivot(ui_ImageArmMinute,9,105); 66 | lv_img_set_angle(ui_ImageArmMinute,1800); 67 | 68 | ui_ImageArmSecond = lv_img_create(ui_Screen1); 69 | lv_img_set_src(ui_ImageArmSecond, &ui_img_armsecond_png); 70 | lv_obj_set_width( ui_ImageArmSecond, LV_SIZE_CONTENT); /// 1 71 | lv_obj_set_height( ui_ImageArmSecond, LV_SIZE_CONTENT); /// 1 72 | lv_obj_set_x( ui_ImageArmSecond, 0 ); 73 | lv_obj_set_y( ui_ImageArmSecond, -47 ); 74 | lv_obj_set_align( ui_ImageArmSecond, LV_ALIGN_CENTER ); 75 | lv_obj_add_flag( ui_ImageArmSecond, LV_OBJ_FLAG_ADV_HITTEST ); /// Flags 76 | lv_obj_clear_flag( ui_ImageArmSecond, LV_OBJ_FLAG_SCROLLABLE ); /// Flags 77 | lv_img_set_pivot(ui_ImageArmSecond,5,115); 78 | lv_img_set_angle(ui_ImageArmSecond,3150); 79 | 80 | } 81 | 82 | void ui_init( void ) 83 | { 84 | lv_disp_t *dispp = lv_disp_get_default(); 85 | lv_theme_t *theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), true, LV_FONT_DEFAULT); 86 | lv_disp_set_theme(dispp, theme); 87 | ui_Screen1_screen_init(); 88 | ui____initial_actions0 = lv_obj_create(NULL); 89 | lv_disp_load_scr( ui_Screen1); 90 | } 91 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_XIAO/ui.h: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.2.3 3 | // LVGL version: 8.2.0 4 | // Project name: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_H 7 | #define _SQUARELINE_PROJECT_UI_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #if defined __has_include 14 | #if __has_include("lvgl.h") 15 | #include "lvgl.h" 16 | #elif __has_include("lvgl/lvgl.h") 17 | #include "lvgl/lvgl.h" 18 | #else 19 | #include "lvgl.h" 20 | #endif 21 | #else 22 | #include "lvgl.h" 23 | #endif 24 | 25 | #include "ui_events.h" 26 | extern lv_obj_t *ui_Screen1; 27 | extern lv_obj_t *ui_ImageWatchface; 28 | extern lv_obj_t *ui_ImageArmHour; 29 | extern lv_obj_t *ui_ImageArmMinute; 30 | extern lv_obj_t *ui_ImageArmSecond; 31 | extern lv_obj_t *ui____initial_actions0; 32 | 33 | 34 | LV_IMG_DECLARE( ui_img_watchface240seeedstudio_png); // assets/watchface240Seeedstudio.png 35 | LV_IMG_DECLARE( ui_img_armhour_png); // assets/armHour.png 36 | LV_IMG_DECLARE( ui_img_armminute_png); // assets/armMinute.png 37 | LV_IMG_DECLARE( ui_img_armsecond_png); // assets/armSecond.png 38 | LV_IMG_DECLARE( ui_img_watchface240_png); // assets/watchface240.png 39 | 40 | 41 | 42 | 43 | void ui_init(void); 44 | 45 | #ifdef __cplusplus 46 | } /*extern "C"*/ 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_XIAO/ui_events.h: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.2.3 3 | // LVGL version: 8.2.0 4 | // Project name: SquareLine_Project 5 | 6 | #ifndef _UI_EVENTS_H 7 | #define _UI_EVENTS_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | 14 | #ifdef __cplusplus 15 | } /*extern "C"*/ 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_XIAO/ui_helpers.h: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.2.3 3 | // LVGL version: 8.2.0 4 | // Project name: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_HELPERS_H 7 | #define _SQUARELINE_PROJECT_UI_HELPERS_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #include "ui.h" 14 | 15 | #define _UI_TEMPORARY_STRING_BUFFER_SIZE 32 16 | #define _UI_BAR_PROPERTY_VALUE 0 17 | #define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1 18 | void _ui_bar_set_property( lv_obj_t *target, int id, int val); 19 | 20 | #define _UI_BASIC_PROPERTY_POSITION_X 0 21 | #define _UI_BASIC_PROPERTY_POSITION_Y 1 22 | #define _UI_BASIC_PROPERTY_WIDTH 2 23 | #define _UI_BASIC_PROPERTY_HEIGHT 3 24 | void _ui_basic_set_property( lv_obj_t *target, int id, int val); 25 | 26 | #define _UI_DROPDOWN_PROPERTY_SELECTED 0 27 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val); 28 | 29 | #define _UI_IMAGE_PROPERTY_IMAGE 0 30 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val); 31 | 32 | #define _UI_LABEL_PROPERTY_TEXT 0 33 | void _ui_label_set_property( lv_obj_t *target, int id, char *val); 34 | 35 | #define _UI_ROLLER_PROPERTY_SELECTED 0 36 | #define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1 37 | void _ui_roller_set_property( lv_obj_t *target, int id, int val); 38 | 39 | #define _UI_SLIDER_PROPERTY_VALUE 0 40 | #define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1 41 | void _ui_slider_set_property( lv_obj_t *target, int id, int val); 42 | 43 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay); 44 | 45 | void _ui_arc_increment( lv_obj_t *target, int val); 46 | 47 | void _ui_bar_increment( lv_obj_t *target, int val, int anm); 48 | 49 | void _ui_slider_increment( lv_obj_t *target, int val, int anm); 50 | 51 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea); 52 | 53 | #define _UI_MODIFY_FLAG_ADD 0 54 | #define _UI_MODIFY_FLAG_REMOVE 1 55 | #define _UI_MODIFY_FLAG_TOGGLE 2 56 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value); 57 | 58 | #define _UI_MODIFY_STATE_ADD 0 59 | #define _UI_MODIFY_STATE_REMOVE 1 60 | #define _UI_MODIFY_STATE_TOGGLE 2 61 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value); 62 | 63 | void _ui_opacity_set( lv_obj_t *target, int val); 64 | 65 | /** Describes an animation*/ 66 | typedef struct _ui_anim_user_data_t { 67 | lv_obj_t *target; 68 | lv_img_dsc_t **imgset; 69 | int32_t imgset_size; 70 | int32_t val; 71 | } ui_anim_user_data_t; 72 | void _ui_anim_callback_free_user_data(lv_anim_t *a); 73 | 74 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v); 75 | 76 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v); 77 | 78 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v); 79 | 80 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v); 81 | 82 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v); 83 | 84 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v); 85 | 86 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v); 87 | 88 | void _ui_anim_callback_set_image_frame(lv_anim_t* a, int32_t v); 89 | 90 | int32_t _ui_anim_callback_get_x(lv_anim_t* a); 91 | 92 | int32_t _ui_anim_callback_get_y(lv_anim_t* a); 93 | 94 | int32_t _ui_anim_callback_get_width(lv_anim_t* a); 95 | 96 | int32_t _ui_anim_callback_get_height(lv_anim_t* a); 97 | 98 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a); 99 | 100 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a); 101 | 102 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a); 103 | 104 | int32_t _ui_anim_callback_get_image_frame(lv_anim_t* a); 105 | 106 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 107 | 108 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 109 | 110 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off); 111 | 112 | 113 | #ifdef __cplusplus 114 | } /*extern "C"*/ 115 | #endif 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_XIAO_date/LVGL_Watchface_240_XIAO_date.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * LVGL Watchface 3 | * 4 | * Anchor escapement video source: 5 | * https://www.youtube.com/watch?v=d_pV8TGKfMc 6 | * 7 | * Image by macrovector on Freepik: 8 | * https://www.freepik.com/free-vector/watch-set-expensive-classic-clock-with-leather-metal-straps-illustration_13031503.htm 9 | * 10 | * Dependent libraries: 11 | * PCF8563_Class: https://github.com/lewisxhe/PCF8563_Library.git 12 | * LVGL: https://github.com/lvgl/lvgl.git 13 | * 14 | * LVGL Configuration file: 15 | * Copy your_arduino_path/libraries/lvgl/lv_conf_template.h 16 | * to your_arduino_path/libraries/lv_conf.h 17 | * 18 | * In lv_conf.h around line 15, enable config file: 19 | * #if 1 // Set it to "1" to enable content 20 | * 21 | * Then find and set: 22 | * #define LV_COLOR_DEPTH 16 23 | * #define LV_TICK_CUSTOM 1 24 | * 25 | * For SPI/parallel 8 display set color swap can be faster, parallel 16/RGB screen don't swap! 26 | * #define LV_COLOR_16_SWAP 1 // for SPI and parallel 8 27 | * #define LV_COLOR_16_SWAP 0 // for parallel 16 and RGB 28 | ******************************************************************************/ 29 | #include 30 | #include "ui.h" 31 | 32 | /******************************************************************************* 33 | * Start of Arduino_GFX setting 34 | ******************************************************************************/ 35 | #include 36 | Arduino_DataBus *bus = new Arduino_ESP32SPI(5 /* DC */, 3 /* CS */, 8 /* SCK */, 10 /* MOSI */, 9 /* MISO */); 37 | Arduino_GFX *gfx = new Arduino_GC9A01(bus, GFX_NOT_DEFINED /* RST */, 3 /* rotation */, true /* IPS */); 38 | /******************************************************************************* 39 | * End of Arduino_GFX setting 40 | ******************************************************************************/ 41 | 42 | const char *weekday_str[] = { 43 | "Sun", 44 | "Mon", 45 | "Tue", 46 | "Wed", 47 | "Thu", 48 | "Fri", 49 | "Sat"}; 50 | 51 | #include "pcf8563.h" 52 | PCF8563_Class rtc; 53 | 54 | static uint32_t screenWidth; 55 | static uint32_t screenHeight; 56 | static lv_disp_draw_buf_t draw_buf; 57 | static lv_color_t *disp_draw_buf; 58 | static lv_disp_drv_t disp_drv; 59 | static char str_buf[8]; // sprintf string buffer 60 | 61 | static uint8_t curr_anchor_idx = 0; 62 | static int16_t curr_anchor_angle = 0; 63 | static lv_obj_t *anchors[8]; 64 | static unsigned long anchor_next_frame_ms; 65 | #define ANCHOR_FPS 25 66 | 67 | static RTC_Date rtcTime; 68 | static unsigned long next_get_timeinfo; 69 | 70 | /* Display flushing */ 71 | void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) 72 | { 73 | uint32_t w = (area->x2 - area->x1 + 1); 74 | uint32_t h = (area->y2 - area->y1 + 1); 75 | 76 | #if (LV_COLOR_16_SWAP != 0) 77 | gfx->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h); 78 | #else 79 | gfx->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h); 80 | #endif 81 | 82 | lv_disp_flush_ready(disp); 83 | } 84 | 85 | void my_log_cb(const char *buf) 86 | { 87 | Serial.println(buf); 88 | } 89 | 90 | void calculate_next_get_timeinfo() 91 | { 92 | rtcTime = rtc.getDateTime(); 93 | next_get_timeinfo = ((millis() / 1000) + 1 + (60 - rtcTime.second)) * 1000; 94 | 95 | // Serial.printf("next_get_timeinfo: %d\n", next_get_timeinfo); 96 | } 97 | 98 | void setup() 99 | { 100 | Serial.begin(115200); 101 | // Serial.setDebugOutput(true); 102 | // while(!Serial); 103 | Serial.println("LVGL Watchface"); 104 | 105 | #ifdef GFX_EXTRA_PRE_INIT 106 | GFX_EXTRA_PRE_INIT(); 107 | #endif 108 | 109 | // Init Display 110 | gfx->begin(80000000); 111 | gfx->fillScreen(BLACK); 112 | 113 | #ifdef GFX_BL 114 | // pinMode(GFX_BL, OUTPUT); 115 | // digitalWrite(GFX_BL, HIGH); 116 | ledcSetup(0 /* LEDChannel */, 12000 /* freq */, 8 /* resolution */); 117 | ledcAttachPin(GFX_BL, 0 /* LEDChannel */); 118 | ledcWrite(0 /* LEDChannel */, 240); /* 0-255 */ 119 | #endif 120 | 121 | // Init RTC 122 | Wire.begin(6,7); 123 | rtc.begin(); 124 | 125 | #if LV_USE_LOG 126 | lv_log_register_print_cb(my_log_cb); 127 | #endif 128 | 129 | lv_init(); 130 | 131 | screenWidth = gfx->width(); 132 | screenHeight = gfx->height(); 133 | #ifdef ESP32 134 | disp_draw_buf = (lv_color_t *)heap_caps_malloc(sizeof(lv_color_t) * screenWidth * 32, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); 135 | #else 136 | disp_draw_buf = (lv_color_t *)malloc(sizeof(lv_color_t) * screenWidth * 32); 137 | #endif 138 | if (!disp_draw_buf) 139 | { 140 | Serial.println("LVGL disp_draw_buf allocate failed!"); 141 | } 142 | else 143 | { 144 | lv_disp_draw_buf_init(&draw_buf, disp_draw_buf, NULL, screenWidth * 32); 145 | 146 | /* Initialize the display */ 147 | lv_disp_drv_init(&disp_drv); 148 | /* Change the following line to your display resolution */ 149 | disp_drv.hor_res = screenWidth; 150 | disp_drv.ver_res = screenHeight; 151 | disp_drv.flush_cb = my_disp_flush; 152 | disp_drv.draw_buf = &draw_buf; 153 | lv_disp_drv_register(&disp_drv); 154 | 155 | /* Initialize the (dummy) input device driver */ 156 | static lv_indev_drv_t indev_drv; 157 | lv_indev_drv_init(&indev_drv); 158 | indev_drv.type = LV_INDEV_TYPE_POINTER; 159 | lv_indev_drv_register(&indev_drv); 160 | 161 | /* Init SquareLine prepared UI */ 162 | ui_init(); 163 | 164 | /* assign images to array after ui_init() */ 165 | anchors[0] = ui_Image1; 166 | anchors[1] = ui_Image2; 167 | anchors[2] = ui_Image3; 168 | anchors[3] = ui_Image4; 169 | anchors[4] = ui_Image5; 170 | anchors[5] = ui_Image6; 171 | anchors[6] = ui_Image7; 172 | anchors[7] = ui_Image8; 173 | 174 | Serial.println("Setup done"); 175 | anchor_next_frame_ms = millis() + (1000 / ANCHOR_FPS); 176 | } 177 | } 178 | 179 | void loop() 180 | { 181 | lv_timer_handler(); /* let the GUI do its work */ 182 | 183 | unsigned long ms = millis(); 184 | 185 | // handle ms overflow, over 49.71 days 186 | if (ms < 200) 187 | { 188 | anchor_next_frame_ms = ms; 189 | calculate_next_get_timeinfo(); 190 | } 191 | 192 | // handle anchor escapement movement 193 | if (ms >= anchor_next_frame_ms) 194 | { 195 | uint8_t next_anchor_idx = curr_anchor_idx + 1; 196 | if (next_anchor_idx > 7) 197 | { 198 | next_anchor_idx = 0; 199 | } 200 | 201 | // show next image then hide current image 202 | lv_obj_clear_flag(anchors[next_anchor_idx], LV_OBJ_FLAG_HIDDEN); 203 | lv_obj_add_flag(anchors[curr_anchor_idx], LV_OBJ_FLAG_HIDDEN); 204 | 205 | curr_anchor_idx = next_anchor_idx; 206 | anchor_next_frame_ms += (1000 / ANCHOR_FPS); 207 | } 208 | 209 | // call getLocalTime() every minute 210 | if (ms >= next_get_timeinfo) 211 | { 212 | rtcTime = rtc.getDateTime(); 213 | 214 | // detect time drifted 215 | if (rtcTime.second > 1) 216 | { 217 | calculate_next_get_timeinfo(); 218 | } 219 | else 220 | { 221 | next_get_timeinfo += 60000; 222 | 223 | // Serial.printf("next_get_timeinfo: %d\n", next_get_timeinfo); 224 | } 225 | 226 | // set labels' text 227 | sprintf(str_buf, "%s %d", weekday_str[rtc.getDayOfWeek(rtcTime.day, rtcTime.month, rtcTime.year)], rtcTime.day); 228 | lv_label_set_text(ui_LabelDate, str_buf); 229 | } 230 | 231 | // set watch arms' angle 232 | int16_t angle = (millis() + 60000 - next_get_timeinfo) * 3600 / 60000; 233 | lv_img_set_angle(ui_ImageArmSecond, angle); 234 | angle = (angle + (rtcTime.minute * 3600)) / 60; 235 | lv_img_set_angle(ui_ImageArmMinute, angle); 236 | angle = (angle + (rtcTime.hour * 3600)) / 12; 237 | lv_img_set_angle(ui_ImageArmHour, angle); 238 | } 239 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_XIAO_date/ui.h: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.2.3 3 | // LVGL version: 8.2.0 4 | // Project name: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_H 7 | #define _SQUARELINE_PROJECT_UI_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #if defined __has_include 14 | #if __has_include("lvgl.h") 15 | #include "lvgl.h" 16 | #elif __has_include("lvgl/lvgl.h") 17 | #include "lvgl/lvgl.h" 18 | #else 19 | #include "lvgl.h" 20 | #endif 21 | #else 22 | #include "lvgl.h" 23 | #endif 24 | 25 | #include "ui_events.h" 26 | extern lv_obj_t *ui_Screen1; 27 | extern lv_obj_t *ui_ImageWatchface; 28 | extern lv_obj_t *ui_Image1; 29 | extern lv_obj_t *ui_Image2; 30 | extern lv_obj_t *ui_Image3; 31 | extern lv_obj_t *ui_Image4; 32 | extern lv_obj_t *ui_Image5; 33 | extern lv_obj_t *ui_Image6; 34 | extern lv_obj_t *ui_Image7; 35 | extern lv_obj_t *ui_Image8; 36 | extern lv_obj_t *ui_ImageArmHour; 37 | extern lv_obj_t *ui_ImageArmMinute; 38 | extern lv_obj_t *ui_ImageArmSecond; 39 | extern lv_obj_t *ui_LabelDate; 40 | extern lv_obj_t *ui____initial_actions0; 41 | 42 | 43 | LV_IMG_DECLARE( ui_img_watchface240seeedstudio_png); // assets/watchface240Seeedstudio.png 44 | LV_IMG_DECLARE( ui_img_out1_png); // assets/out1.png 45 | LV_IMG_DECLARE( ui_img_out2_png); // assets/out2.png 46 | LV_IMG_DECLARE( ui_img_out3_png); // assets/out3.png 47 | LV_IMG_DECLARE( ui_img_out4_png); // assets/out4.png 48 | LV_IMG_DECLARE( ui_img_out5_png); // assets/out5.png 49 | LV_IMG_DECLARE( ui_img_out6_png); // assets/out6.png 50 | LV_IMG_DECLARE( ui_img_out7_png); // assets/out7.png 51 | LV_IMG_DECLARE( ui_img_out8_png); // assets/out8.png 52 | LV_IMG_DECLARE( ui_img_armhour_png); // assets/armHour.png 53 | LV_IMG_DECLARE( ui_img_armminute_png); // assets/armMinute.png 54 | LV_IMG_DECLARE( ui_img_armsecond_png); // assets/armSecond.png 55 | LV_IMG_DECLARE( ui_img_watchface240_png); // assets/watchface240.png 56 | 57 | 58 | 59 | 60 | void ui_init(void); 61 | 62 | #ifdef __cplusplus 63 | } /*extern "C"*/ 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_XIAO_date/ui_events.h: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.2.3 3 | // LVGL version: 8.2.0 4 | // Project name: SquareLine_Project 5 | 6 | #ifndef _UI_EVENTS_H 7 | #define _UI_EVENTS_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | 14 | #ifdef __cplusplus 15 | } /*extern "C"*/ 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /LVGL_Watchface_240_XIAO_date/ui_helpers.h: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.2.3 3 | // LVGL version: 8.2.0 4 | // Project name: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_HELPERS_H 7 | #define _SQUARELINE_PROJECT_UI_HELPERS_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #include "ui.h" 14 | 15 | #define _UI_TEMPORARY_STRING_BUFFER_SIZE 32 16 | #define _UI_BAR_PROPERTY_VALUE 0 17 | #define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1 18 | void _ui_bar_set_property( lv_obj_t *target, int id, int val); 19 | 20 | #define _UI_BASIC_PROPERTY_POSITION_X 0 21 | #define _UI_BASIC_PROPERTY_POSITION_Y 1 22 | #define _UI_BASIC_PROPERTY_WIDTH 2 23 | #define _UI_BASIC_PROPERTY_HEIGHT 3 24 | void _ui_basic_set_property( lv_obj_t *target, int id, int val); 25 | 26 | #define _UI_DROPDOWN_PROPERTY_SELECTED 0 27 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val); 28 | 29 | #define _UI_IMAGE_PROPERTY_IMAGE 0 30 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val); 31 | 32 | #define _UI_LABEL_PROPERTY_TEXT 0 33 | void _ui_label_set_property( lv_obj_t *target, int id, char *val); 34 | 35 | #define _UI_ROLLER_PROPERTY_SELECTED 0 36 | #define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1 37 | void _ui_roller_set_property( lv_obj_t *target, int id, int val); 38 | 39 | #define _UI_SLIDER_PROPERTY_VALUE 0 40 | #define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1 41 | void _ui_slider_set_property( lv_obj_t *target, int id, int val); 42 | 43 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay); 44 | 45 | void _ui_arc_increment( lv_obj_t *target, int val); 46 | 47 | void _ui_bar_increment( lv_obj_t *target, int val, int anm); 48 | 49 | void _ui_slider_increment( lv_obj_t *target, int val, int anm); 50 | 51 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea); 52 | 53 | #define _UI_MODIFY_FLAG_ADD 0 54 | #define _UI_MODIFY_FLAG_REMOVE 1 55 | #define _UI_MODIFY_FLAG_TOGGLE 2 56 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value); 57 | 58 | #define _UI_MODIFY_STATE_ADD 0 59 | #define _UI_MODIFY_STATE_REMOVE 1 60 | #define _UI_MODIFY_STATE_TOGGLE 2 61 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value); 62 | 63 | void _ui_opacity_set( lv_obj_t *target, int val); 64 | 65 | /** Describes an animation*/ 66 | typedef struct _ui_anim_user_data_t { 67 | lv_obj_t *target; 68 | lv_img_dsc_t **imgset; 69 | int32_t imgset_size; 70 | int32_t val; 71 | } ui_anim_user_data_t; 72 | void _ui_anim_callback_free_user_data(lv_anim_t *a); 73 | 74 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v); 75 | 76 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v); 77 | 78 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v); 79 | 80 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v); 81 | 82 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v); 83 | 84 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v); 85 | 86 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v); 87 | 88 | void _ui_anim_callback_set_image_frame(lv_anim_t* a, int32_t v); 89 | 90 | int32_t _ui_anim_callback_get_x(lv_anim_t* a); 91 | 92 | int32_t _ui_anim_callback_get_y(lv_anim_t* a); 93 | 94 | int32_t _ui_anim_callback_get_width(lv_anim_t* a); 95 | 96 | int32_t _ui_anim_callback_get_height(lv_anim_t* a); 97 | 98 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a); 99 | 100 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a); 101 | 102 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a); 103 | 104 | int32_t _ui_anim_callback_get_image_frame(lv_anim_t* a); 105 | 106 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 107 | 108 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 109 | 110 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off); 111 | 112 | 113 | #ifdef __cplusplus 114 | } /*extern "C"*/ 115 | #endif 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /LVGL_Watchface_480/ui.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_H 7 | #define _SQUARELINE_PROJECT_UI_H 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #if defined __has_include 14 | #if __has_include("lvgl.h") 15 | #include "lvgl.h" 16 | #elif __has_include("lvgl/lvgl.h") 17 | #include "lvgl/lvgl.h" 18 | #else 19 | #include "lvgl.h" 20 | #endif 21 | #else 22 | #include "lvgl.h" 23 | #endif 24 | 25 | extern lv_obj_t *ui_Screen1; 26 | extern lv_obj_t *ui_Watchface; 27 | extern lv_obj_t *ui_Anchor0; 28 | extern lv_obj_t *ui_Anchor1; 29 | extern lv_obj_t *ui_Anchor2; 30 | extern lv_obj_t *ui_Anchor3; 31 | extern lv_obj_t *ui_Anchor4; 32 | extern lv_obj_t *ui_Anchor5; 33 | extern lv_obj_t *ui_Anchor6; 34 | extern lv_obj_t *ui_Anchor7; 35 | extern lv_obj_t *ui_Anchor8; 36 | extern lv_obj_t *ui_Anchor9; 37 | extern lv_obj_t *ui_LabelWeekday; 38 | extern lv_obj_t *ui_LabelDate; 39 | extern lv_obj_t *ui_ImageArmHour; 40 | extern lv_obj_t *ui_ImageArmMinute; 41 | extern lv_obj_t *ui_ImageArmSecond; 42 | extern lv_obj_t *ui_LabelLongDate; 43 | 44 | 45 | LV_IMG_DECLARE( ui_img_watchface_png); // assets/watchface.png 46 | LV_IMG_DECLARE( ui_img_out01_png); // assets/out01.png 47 | LV_IMG_DECLARE( ui_img_out02_png); // assets/out02.png 48 | LV_IMG_DECLARE( ui_img_out03_png); // assets/out03.png 49 | LV_IMG_DECLARE( ui_img_out04_png); // assets/out04.png 50 | LV_IMG_DECLARE( ui_img_out05_png); // assets/out05.png 51 | LV_IMG_DECLARE( ui_img_out06_png); // assets/out06.png 52 | LV_IMG_DECLARE( ui_img_out07_png); // assets/out07.png 53 | LV_IMG_DECLARE( ui_img_out08_png); // assets/out08.png 54 | LV_IMG_DECLARE( ui_img_out09_png); // assets/out09.png 55 | LV_IMG_DECLARE( ui_img_out10_png); // assets/out10.png 56 | LV_IMG_DECLARE( ui_img_arm_hour_png); // assets/arm_hour.png 57 | LV_IMG_DECLARE( ui_img_arm_minute_png); // assets/arm_minute.png 58 | LV_IMG_DECLARE( ui_img_arm_second_png); // assets/arm_second.png 59 | 60 | 61 | LV_FONT_DECLARE( ui_font_SansDate); 62 | 63 | 64 | void ui_init(void); 65 | 66 | #ifdef __cplusplus 67 | } /*extern "C"*/ 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /LVGL_Watchface_480/ui_helpers.c: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #include "ui_helpers.h" 7 | 8 | void _ui_bar_set_property( lv_obj_t *target, int id, int val) 9 | { 10 | if (id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON); 11 | if (id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF); 12 | } 13 | 14 | void _ui_basic_set_property( lv_obj_t *target, int id, int val) 15 | { 16 | if (id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val); 17 | if (id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val); 18 | if (id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val); 19 | if (id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val); 20 | } 21 | 22 | 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val) 24 | { 25 | if (id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val); 26 | } 27 | 28 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val) 29 | { 30 | if (id == _UI_IMAGE_PROPERTY_IMAGE) lv_img_set_src(target, val); 31 | } 32 | 33 | void _ui_label_set_property( lv_obj_t *target, int id, char *val) 34 | { 35 | if (id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val); 36 | } 37 | 38 | 39 | void _ui_roller_set_property( lv_obj_t *target, int id, int val) 40 | { 41 | if (id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON); 42 | if (id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF); 43 | } 44 | 45 | void _ui_slider_set_property( lv_obj_t *target, int id, int val) 46 | { 47 | if (id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON); 48 | if (id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF); 49 | } 50 | 51 | 52 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay) 53 | { 54 | lv_scr_load_anim(target, fademode, spd, delay, false); 55 | } 56 | 57 | void _ui_arc_increment( lv_obj_t *target, int val) 58 | { 59 | int old = lv_arc_get_value(target); 60 | lv_arc_set_value(target, old+val); 61 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 62 | } 63 | 64 | void _ui_bar_increment( lv_obj_t *target, int val, int anm) 65 | { 66 | int old = lv_bar_get_value(target); 67 | lv_bar_set_value(target, old+val, anm); 68 | } 69 | 70 | void _ui_slider_increment( lv_obj_t *target, int val, int anm) 71 | { 72 | int old = lv_slider_get_value(target); 73 | lv_slider_set_value(target, old+val, anm); 74 | lv_event_send(target,LV_EVENT_VALUE_CHANGED, 0); 75 | } 76 | 77 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea) 78 | { 79 | lv_keyboard_set_textarea(keyboard, textarea); 80 | } 81 | 82 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value) 83 | { 84 | if (value==_UI_MODIFY_FLAG_TOGGLE) 85 | { 86 | if ( lv_obj_has_flag(target,flag) ) lv_obj_clear_flag(target,flag); 87 | else lv_obj_add_flag(target,flag); 88 | } 89 | else if (value==_UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target,flag); 90 | else lv_obj_clear_flag(target,flag); 91 | } 92 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value) 93 | { 94 | if (value==_UI_MODIFY_STATE_TOGGLE) 95 | { 96 | if ( lv_obj_has_state(target,state) ) lv_obj_clear_state(target,state); 97 | else lv_obj_add_state(target,state); 98 | } 99 | else if (value==_UI_MODIFY_STATE_ADD) lv_obj_add_state(target,state); 100 | else lv_obj_clear_state(target,state); 101 | } 102 | 103 | void _ui_opacity_set( lv_obj_t *target, int val) 104 | { 105 | lv_obj_set_style_opa(target, val, 0); 106 | } 107 | 108 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v) 109 | { 110 | lv_obj_set_x((lv_obj_t *)a->user_data, v); 111 | } 112 | 113 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v) 114 | { 115 | lv_obj_set_y((lv_obj_t *)a->user_data, v); 116 | } 117 | 118 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v) 119 | { 120 | lv_obj_set_width((lv_obj_t *)a->user_data, v); 121 | } 122 | 123 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v) 124 | { 125 | lv_obj_set_height((lv_obj_t *)a->user_data, v); 126 | } 127 | 128 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v) 129 | { 130 | lv_obj_set_style_opa((lv_obj_t *)a->user_data, v, 0); 131 | } 132 | 133 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v) 134 | { 135 | lv_img_set_zoom((lv_obj_t *)a->user_data, v); 136 | } 137 | 138 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v) 139 | { 140 | lv_img_set_angle((lv_obj_t *)a->user_data, v); 141 | } 142 | 143 | 144 | int32_t _ui_anim_callback_get_x(lv_anim_t* a) 145 | { 146 | return lv_obj_get_x_aligned((lv_obj_t *)a->user_data); 147 | } 148 | 149 | int32_t _ui_anim_callback_get_y(lv_anim_t* a) 150 | { 151 | return lv_obj_get_y_aligned((lv_obj_t *)a->user_data); 152 | } 153 | 154 | int32_t _ui_anim_callback_get_width(lv_anim_t* a) 155 | { 156 | return lv_obj_get_width((lv_obj_t *)a->user_data); 157 | } 158 | 159 | int32_t _ui_anim_callback_get_height(lv_anim_t* a) 160 | { 161 | return lv_obj_get_height((lv_obj_t *)a->user_data); 162 | } 163 | 164 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a) 165 | { 166 | return lv_obj_get_style_opa((lv_obj_t *)a->user_data, 0); 167 | } 168 | 169 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a) 170 | { 171 | return lv_img_get_zoom((lv_obj_t *)a->user_data); 172 | } 173 | 174 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a) 175 | { 176 | return lv_img_get_angle((lv_obj_t *)a->user_data); 177 | } 178 | 179 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 180 | { 181 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 182 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix); 183 | lv_label_set_text(trg, buf); 184 | } 185 | 186 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix) 187 | { 188 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 189 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix); 190 | lv_label_set_text(trg, buf); 191 | } 192 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off) 193 | { 194 | if (lv_obj_has_state(src,LV_STATE_CHECKED)) lv_label_set_text(trg,txt_on); 195 | else lv_label_set_text(trg,txt_off); 196 | } 197 | 198 | 199 | -------------------------------------------------------------------------------- /LVGL_Watchface_480/ui_helpers.h: -------------------------------------------------------------------------------- 1 | // SquareLine LVGL GENERATED FILE 2 | // EDITOR VERSION: SquareLine Studio 1.2.0 3 | // LVGL VERSION: 8.2.0 4 | // PROJECT: SquareLine_Project 5 | 6 | #ifndef _SQUARELINE_PROJECT_UI_HELPERS_H 7 | #define _SQUARELINE_PROJECT_UI_HELPERS_H 8 | 9 | #include "ui.h" 10 | 11 | #define _UI_TEMPORARY_STRING_BUFFER_SIZE 32 12 | #define _UI_BAR_PROPERTY_VALUE 0 13 | #define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1 14 | void _ui_bar_set_property( lv_obj_t *target, int id, int val); 15 | 16 | #define _UI_BASIC_PROPERTY_POSITION_X 0 17 | #define _UI_BASIC_PROPERTY_POSITION_Y 1 18 | #define _UI_BASIC_PROPERTY_WIDTH 2 19 | #define _UI_BASIC_PROPERTY_HEIGHT 3 20 | void _ui_basic_set_property( lv_obj_t *target, int id, int val); 21 | 22 | #define _UI_DROPDOWN_PROPERTY_SELECTED 0 23 | void _ui_dropdown_set_property( lv_obj_t *target, int id, int val); 24 | 25 | #define _UI_IMAGE_PROPERTY_IMAGE 0 26 | void _ui_image_set_property( lv_obj_t *target, int id, uint8_t *val); 27 | 28 | #define _UI_LABEL_PROPERTY_TEXT 0 29 | void _ui_label_set_property( lv_obj_t *target, int id, char *val); 30 | 31 | #define _UI_ROLLER_PROPERTY_SELECTED 0 32 | #define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1 33 | void _ui_roller_set_property( lv_obj_t *target, int id, int val); 34 | 35 | #define _UI_SLIDER_PROPERTY_VALUE 0 36 | #define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1 37 | void _ui_slider_set_property( lv_obj_t *target, int id, int val); 38 | 39 | void _ui_screen_change( lv_obj_t *target, lv_scr_load_anim_t fademode, int spd, int delay); 40 | 41 | void _ui_arc_increment( lv_obj_t *target, int val); 42 | 43 | void _ui_bar_increment( lv_obj_t *target, int val, int anm); 44 | 45 | void _ui_slider_increment( lv_obj_t *target, int val, int anm); 46 | 47 | void _ui_keyboard_set_target( lv_obj_t *keyboard, lv_obj_t *textarea); 48 | 49 | #define _UI_MODIFY_FLAG_ADD 0 50 | #define _UI_MODIFY_FLAG_REMOVE 1 51 | #define _UI_MODIFY_FLAG_TOGGLE 2 52 | void _ui_flag_modify( lv_obj_t *target, int32_t flag, int value); 53 | 54 | #define _UI_MODIFY_STATE_ADD 0 55 | #define _UI_MODIFY_STATE_REMOVE 1 56 | #define _UI_MODIFY_STATE_TOGGLE 2 57 | void _ui_state_modify( lv_obj_t *target, int32_t state, int value); 58 | 59 | void _ui_opacity_set( lv_obj_t *target, int val); 60 | 61 | void _ui_anim_callback_set_x(lv_anim_t* a, int32_t v); 62 | 63 | void _ui_anim_callback_set_y(lv_anim_t* a, int32_t v); 64 | 65 | void _ui_anim_callback_set_width(lv_anim_t* a, int32_t v); 66 | 67 | void _ui_anim_callback_set_height(lv_anim_t* a, int32_t v); 68 | 69 | void _ui_anim_callback_set_opacity(lv_anim_t* a, int32_t v); 70 | 71 | void _ui_anim_callback_set_image_zoom(lv_anim_t* a, int32_t v); 72 | 73 | void _ui_anim_callback_set_image_angle(lv_anim_t* a, int32_t v); 74 | 75 | int32_t _ui_anim_callback_get_x(lv_anim_t* a); 76 | 77 | int32_t _ui_anim_callback_get_y(lv_anim_t* a); 78 | 79 | int32_t _ui_anim_callback_get_width(lv_anim_t* a); 80 | 81 | int32_t _ui_anim_callback_get_height(lv_anim_t* a); 82 | 83 | int32_t _ui_anim_callback_get_opacity(lv_anim_t* a); 84 | 85 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t* a); 86 | 87 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t* a); 88 | 89 | void _ui_arc_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 90 | 91 | void _ui_slider_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *prefix, char *postfix); 92 | 93 | void _ui_checked_set_text_value( lv_obj_t *trg, lv_obj_t *src, char *txt_on, char *txt_off); 94 | 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LVGL Watchface 2 | 3 | ## Watchface Clipart 4 | 5 | * [Image by macrovector](https://www.freepik.com/free-vector/different-types-watches-flat-icons-collection_4017194.htm) on Freepik 6 | * [Image by macrovector](https://www.freepik.com/free-vector/watch-set-expensive-classic-clock-with-leather-metal-straps-illustration_13031503.htm) on Freepik 7 | * 8 | * 9 | * 10 | 11 | ## GIF Source 12 | 13 | * 14 | * 15 | * 16 | * 17 | * 18 | * 19 | * 20 | * 21 | 22 | ## Anchor Escapement Video Source 23 | 24 | * [Ulysse Nardin In-House Made & Designed Silicon Anchor Escapement | aBlogtoWatch](https://youtu.be/Nu5Xe51Q_oE) 25 | * [How a Mechanical Watch Works | Explained in 5 Minutes 26 | ](https://youtu.be/d_pV8TGKfMc) 27 | * [Ulysse Nardin Ulysse Anchor Tourbillon](https://youtu.be/jrP4_Kq6SjI) 28 | 29 | ## Video to Image File Conversion 30 | 31 | ```console 32 | ffmpeg -y -i watch.mp4 -ss 1:30.4 -t 0.37 -vf "crop=320:320:173:17" out.mp4 33 | ffmpeg -y -i out.mp4 -vf "scale=160:160:flags=lanczos" 'out%02d.png' 34 | ``` 35 | 36 | ```console 37 | ffmpeg -y -i watch.mp4 -ss 4:09.0 -t 0.32 -vf "crop=400:400:408:147" out.mp4 38 | ffmpeg -y -i out.mp4 -vf "transpose=2,scale=76:76:flags=lanczos" 'out%1d.png' 39 | ``` 40 | 41 | ```console 42 | ffmpeg -y -i watch.mp4 -ss 4:09.0 -t 0.32 -vf "crop=280:280:468:207" out.mp4 43 | ffmpeg -y -i out.mp4 -vf "scale=64:64:flags=lanczos" 'out%d.png' 44 | ``` 45 | 46 | ```console 47 | ffmpeg -y -i watch.mp4 -ss 0:12.6 -t 0.4 -vf "crop=680:680:303:31" out.mp4 48 | ffmpeg -y -i out.mp4 -vf "scale=160:160:flags=lanczos" 'out%2d.png' 49 | ``` 50 | -------------------------------------------------------------------------------- /SquareLine_240/assets/armHour.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240/assets/armHour.png -------------------------------------------------------------------------------- /SquareLine_240/assets/armMinute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240/assets/armMinute.png -------------------------------------------------------------------------------- /SquareLine_240/assets/armSecond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240/assets/armSecond.png -------------------------------------------------------------------------------- /SquareLine_240/assets/watchface240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240/assets/watchface240.png -------------------------------------------------------------------------------- /SquareLine_240/assets/watchface240Seeedstudio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240/assets/watchface240Seeedstudio.png -------------------------------------------------------------------------------- /SquareLine_240_RP2040/assets/armHour.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_RP2040/assets/armHour.png -------------------------------------------------------------------------------- /SquareLine_240_RP2040/assets/armMinute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_RP2040/assets/armMinute.png -------------------------------------------------------------------------------- /SquareLine_240_RP2040/assets/armSecond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_RP2040/assets/armSecond.png -------------------------------------------------------------------------------- /SquareLine_240_RP2040/assets/out1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_RP2040/assets/out1.png -------------------------------------------------------------------------------- /SquareLine_240_RP2040/assets/out2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_RP2040/assets/out2.png -------------------------------------------------------------------------------- /SquareLine_240_RP2040/assets/out3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_RP2040/assets/out3.png -------------------------------------------------------------------------------- /SquareLine_240_RP2040/assets/out4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_RP2040/assets/out4.png -------------------------------------------------------------------------------- /SquareLine_240_RP2040/assets/out5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_RP2040/assets/out5.png -------------------------------------------------------------------------------- /SquareLine_240_RP2040/assets/out6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_RP2040/assets/out6.png -------------------------------------------------------------------------------- /SquareLine_240_RP2040/assets/out7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_RP2040/assets/out7.png -------------------------------------------------------------------------------- /SquareLine_240_RP2040/assets/out8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_RP2040/assets/out8.png -------------------------------------------------------------------------------- /SquareLine_240_RP2040/assets/watchface240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_RP2040/assets/watchface240.png -------------------------------------------------------------------------------- /SquareLine_240_RP2040/assets/watchface240Waveshare.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_RP2040/assets/watchface240Waveshare.png -------------------------------------------------------------------------------- /SquareLine_240_Stormtrooper/assets/blaster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_Stormtrooper/assets/blaster.png -------------------------------------------------------------------------------- /SquareLine_240_Stormtrooper/assets/dlt19x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_Stormtrooper/assets/dlt19x.png -------------------------------------------------------------------------------- /SquareLine_240_Stormtrooper/assets/lightsaber.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_Stormtrooper/assets/lightsaber.png -------------------------------------------------------------------------------- /SquareLine_240_Stormtrooper/assets/star_wars_ stormtrooper_80.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_Stormtrooper/assets/star_wars_ stormtrooper_80.gif -------------------------------------------------------------------------------- /SquareLine_240_Stormtrooper/assets/watchface240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_Stormtrooper/assets/watchface240.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/01.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/02.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/03.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/04.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/05.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/06.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/07.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/08.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/09.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/10.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/11.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/12.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/13.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/14.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/15.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/16.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/17.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/18.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/19.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/20.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/21.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/22.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/23.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/24.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/armHour.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/armHour.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/armHourBlue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/armHourBlue.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/armMinute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/armMinute.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/armMinuteBlue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/armMinuteBlue.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/armSecond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/armSecond.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/armSecondBlue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/armSecondBlue.png -------------------------------------------------------------------------------- /SquareLine_240_aniback/assets/watchface240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_aniback/assets/watchface240.png -------------------------------------------------------------------------------- /SquareLine_240_date/assets/armHour.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_date/assets/armHour.png -------------------------------------------------------------------------------- /SquareLine_240_date/assets/armMinute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_date/assets/armMinute.png -------------------------------------------------------------------------------- /SquareLine_240_date/assets/armSecond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_date/assets/armSecond.png -------------------------------------------------------------------------------- /SquareLine_240_date/assets/out1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_date/assets/out1.png -------------------------------------------------------------------------------- /SquareLine_240_date/assets/out2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_date/assets/out2.png -------------------------------------------------------------------------------- /SquareLine_240_date/assets/out3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_date/assets/out3.png -------------------------------------------------------------------------------- /SquareLine_240_date/assets/out4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_date/assets/out4.png -------------------------------------------------------------------------------- /SquareLine_240_date/assets/out5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_date/assets/out5.png -------------------------------------------------------------------------------- /SquareLine_240_date/assets/out6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_date/assets/out6.png -------------------------------------------------------------------------------- /SquareLine_240_date/assets/out7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_date/assets/out7.png -------------------------------------------------------------------------------- /SquareLine_240_date/assets/out8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_date/assets/out8.png -------------------------------------------------------------------------------- /SquareLine_240_date/assets/watchface240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_date/assets/watchface240.png -------------------------------------------------------------------------------- /SquareLine_240_date/assets/watchface240Seeedstudio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_240_date/assets/watchface240Seeedstudio.png -------------------------------------------------------------------------------- /SquareLine_480/assets/arm_hour.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_480/assets/arm_hour.png -------------------------------------------------------------------------------- /SquareLine_480/assets/arm_minute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_480/assets/arm_minute.png -------------------------------------------------------------------------------- /SquareLine_480/assets/arm_second.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_480/assets/arm_second.png -------------------------------------------------------------------------------- /SquareLine_480/assets/out01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_480/assets/out01.png -------------------------------------------------------------------------------- /SquareLine_480/assets/out02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_480/assets/out02.png -------------------------------------------------------------------------------- /SquareLine_480/assets/out03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_480/assets/out03.png -------------------------------------------------------------------------------- /SquareLine_480/assets/out04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_480/assets/out04.png -------------------------------------------------------------------------------- /SquareLine_480/assets/out05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_480/assets/out05.png -------------------------------------------------------------------------------- /SquareLine_480/assets/out06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_480/assets/out06.png -------------------------------------------------------------------------------- /SquareLine_480/assets/out07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_480/assets/out07.png -------------------------------------------------------------------------------- /SquareLine_480/assets/out08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_480/assets/out08.png -------------------------------------------------------------------------------- /SquareLine_480/assets/out09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_480/assets/out09.png -------------------------------------------------------------------------------- /SquareLine_480/assets/out10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_480/assets/out10.png -------------------------------------------------------------------------------- /SquareLine_480/assets/ui_font_SansDate.fcfg: -------------------------------------------------------------------------------- 1 | { 2 | "codename": "SansDate", 3 | "ttf_path": "/assets/NotoSansCJKhk-Medium.otf", 4 | "bin_path": "/assets/ui_font_SansDate.bin", 5 | "c_path": "/assets/ui_font_SansDate.c", 6 | "cfg_path": "/assets/ui_font_SansDate.fcfg", 7 | "size": 28, 8 | "bpp": 8, 9 | "letters": 0, 10 | "ranges": [], 11 | "symbols": "0123456789星期日一二三四五六", 12 | "customparams": "--no-prefilter", 13 | "uploaded": false 14 | } -------------------------------------------------------------------------------- /SquareLine_480/assets/watchface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moononournation/LVGL_Watchface/ec922f30212206a6b636ee85e16344d6661774c0/SquareLine_480/assets/watchface.png --------------------------------------------------------------------------------