└── waveClock ├── assets ├── logo.png ├── set.png ├── bright.png ├── bahnschrift.ttf ├── ui_font_date.bin ├── ui_font_day.bin ├── ui_font_secs.bin ├── G7_Segment_7a.ttf ├── ui_font_digits.bin ├── ui_font_day.fcfg ├── ui_font_date.fcfg ├── ui_font_secs.fcfg └── ui_font_digits.fcfg ├── cache └── thumb_896301023logo.png ├── backup ├── SquareLine_Project_backup00.zip ├── SquareLine_Project_backup01.zip ├── SquareLine_Project_backup02.zip ├── SquareLine_Project_backup03.zip ├── SquareLine_Project_backup04.zip ├── SquareLine_Project_backup05.zip ├── SquareLine_Project_backup06.zip ├── SquareLine_Project_backup07.zip ├── SquareLine_Project_backup08.zip └── SquareLine_Project_backup09.zip ├── autosave ├── SquareLine_Project_autosave00.zip ├── SquareLine_Project_autosave01.zip ├── SquareLine_Project_autosave02.zip ├── SquareLine_Project_autosave03.zip ├── SquareLine_Project_autosave04.zip ├── SquareLine_Project_autosave05.zip ├── SquareLine_Project_autosave06.zip ├── SquareLine_Project_autosave07.zip ├── SquareLine_Project_autosave08.zip └── SquareLine_Project_autosave09.zip ├── ui_comp_hook.c ├── UI ├── ui_comp_hook.c ├── filelist.txt ├── CMakeLists.txt ├── ui_events.h ├── ui_helpers.h ├── ui_setMenu.c ├── ui.h ├── ui_helpers.c ├── ui_setTime.c ├── ui.c └── ui_setDate.c ├── SquareLine_Project_events.py ├── filelist.txt ├── CMakeLists.txt ├── I2C_Driver.h ├── ui_events.h ├── LVGL_Driver.h ├── I2C_Driver.cpp ├── Display_SPD2010.h ├── Touch_SPD2010.h ├── TCA9554PWR.h ├── RTC_PCF85063.h ├── LVGL_Driver.cpp ├── ui_helpers.h ├── ui_setMenu.c ├── TCA9554PWR.cpp ├── esp_lcd_spd2010.h ├── ui.h ├── Display_SPD2010.cpp ├── waveClock.ino ├── RTC_PCF85063.cpp ├── ui_helpers.c ├── ui_setTime.c ├── ui.c ├── Touch_SPD2010.cpp └── ui_setDate.c /waveClock/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/assets/logo.png -------------------------------------------------------------------------------- /waveClock/assets/set.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/assets/set.png -------------------------------------------------------------------------------- /waveClock/assets/bright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/assets/bright.png -------------------------------------------------------------------------------- /waveClock/assets/bahnschrift.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/assets/bahnschrift.ttf -------------------------------------------------------------------------------- /waveClock/assets/ui_font_date.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/assets/ui_font_date.bin -------------------------------------------------------------------------------- /waveClock/assets/ui_font_day.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/assets/ui_font_day.bin -------------------------------------------------------------------------------- /waveClock/assets/ui_font_secs.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/assets/ui_font_secs.bin -------------------------------------------------------------------------------- /waveClock/assets/G7_Segment_7a.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/assets/G7_Segment_7a.ttf -------------------------------------------------------------------------------- /waveClock/assets/ui_font_digits.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/assets/ui_font_digits.bin -------------------------------------------------------------------------------- /waveClock/cache/thumb_896301023logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/cache/thumb_896301023logo.png -------------------------------------------------------------------------------- /waveClock/backup/SquareLine_Project_backup00.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/backup/SquareLine_Project_backup00.zip -------------------------------------------------------------------------------- /waveClock/backup/SquareLine_Project_backup01.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/backup/SquareLine_Project_backup01.zip -------------------------------------------------------------------------------- /waveClock/backup/SquareLine_Project_backup02.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/backup/SquareLine_Project_backup02.zip -------------------------------------------------------------------------------- /waveClock/backup/SquareLine_Project_backup03.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/backup/SquareLine_Project_backup03.zip -------------------------------------------------------------------------------- /waveClock/backup/SquareLine_Project_backup04.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/backup/SquareLine_Project_backup04.zip -------------------------------------------------------------------------------- /waveClock/backup/SquareLine_Project_backup05.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/backup/SquareLine_Project_backup05.zip -------------------------------------------------------------------------------- /waveClock/backup/SquareLine_Project_backup06.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/backup/SquareLine_Project_backup06.zip -------------------------------------------------------------------------------- /waveClock/backup/SquareLine_Project_backup07.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/backup/SquareLine_Project_backup07.zip -------------------------------------------------------------------------------- /waveClock/backup/SquareLine_Project_backup08.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/backup/SquareLine_Project_backup08.zip -------------------------------------------------------------------------------- /waveClock/backup/SquareLine_Project_backup09.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/backup/SquareLine_Project_backup09.zip -------------------------------------------------------------------------------- /waveClock/autosave/SquareLine_Project_autosave00.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/autosave/SquareLine_Project_autosave00.zip -------------------------------------------------------------------------------- /waveClock/autosave/SquareLine_Project_autosave01.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/autosave/SquareLine_Project_autosave01.zip -------------------------------------------------------------------------------- /waveClock/autosave/SquareLine_Project_autosave02.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/autosave/SquareLine_Project_autosave02.zip -------------------------------------------------------------------------------- /waveClock/autosave/SquareLine_Project_autosave03.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/autosave/SquareLine_Project_autosave03.zip -------------------------------------------------------------------------------- /waveClock/autosave/SquareLine_Project_autosave04.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/autosave/SquareLine_Project_autosave04.zip -------------------------------------------------------------------------------- /waveClock/autosave/SquareLine_Project_autosave05.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/autosave/SquareLine_Project_autosave05.zip -------------------------------------------------------------------------------- /waveClock/autosave/SquareLine_Project_autosave06.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/autosave/SquareLine_Project_autosave06.zip -------------------------------------------------------------------------------- /waveClock/autosave/SquareLine_Project_autosave07.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/autosave/SquareLine_Project_autosave07.zip -------------------------------------------------------------------------------- /waveClock/autosave/SquareLine_Project_autosave08.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/autosave/SquareLine_Project_autosave08.zip -------------------------------------------------------------------------------- /waveClock/autosave/SquareLine_Project_autosave09.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VolosR/waveClock/HEAD/waveClock/autosave/SquareLine_Project_autosave09.zip -------------------------------------------------------------------------------- /waveClock/ui_comp_hook.c: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.3.4 3 | // LVGL version: 8.3.6 4 | // Project name: SquareLine_Project 5 | 6 | -------------------------------------------------------------------------------- /waveClock/UI/ui_comp_hook.c: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.3.4 3 | // LVGL version: 8.3.6 4 | // Project name: SquareLine_Project 5 | 6 | -------------------------------------------------------------------------------- /waveClock/SquareLine_Project_events.py: -------------------------------------------------------------------------------- 1 | 2 | def choseTime(event_struct): 3 | return 4 | 5 | 6 | def prepareTime(event_struct): 7 | return 8 | 9 | 10 | def cngBright(event_struct): 11 | return 12 | 13 | -------------------------------------------------------------------------------- /waveClock/UI/filelist.txt: -------------------------------------------------------------------------------- 1 | ui_Screen1.c 2 | ui_setMenu.c 3 | ui_setTime.c 4 | ui_setDate.c 5 | ui.c 6 | ui_comp_hook.c 7 | ui_helpers.c 8 | ui_events.c 9 | ui_img_logo_png.c 10 | ui_img_set_png.c 11 | ui_img_bright_png.c 12 | fonts/ui_font_date.c 13 | fonts/ui_font_day.c 14 | fonts/ui_font_digits.c 15 | fonts/ui_font_secs.c 16 | -------------------------------------------------------------------------------- /waveClock/filelist.txt: -------------------------------------------------------------------------------- 1 | ui_Screen1.c 2 | ui_setMenu.c 3 | ui_setTime.c 4 | ui_setDate.c 5 | ui.c 6 | ui_comp_hook.c 7 | ui_helpers.c 8 | ui_events.c 9 | ui_img_logo_png.c 10 | ui_img_set_png.c 11 | ui_img_bright_png.c 12 | fonts/ui_font_date.c 13 | fonts/ui_font_day.c 14 | fonts/ui_font_digits.c 15 | fonts/ui_font_secs.c 16 | -------------------------------------------------------------------------------- /waveClock/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(SOURCES ui_Screen1.c 2 | ui_setMenu.c 3 | ui_setTime.c 4 | ui_setDate.c 5 | ui.c 6 | ui_comp_hook.c 7 | ui_helpers.c 8 | ui_events.c 9 | ui_img_logo_png.c 10 | ui_img_set_png.c 11 | ui_img_bright_png.c 12 | fonts/ui_font_date.c 13 | fonts/ui_font_day.c 14 | fonts/ui_font_digits.c 15 | fonts/ui_font_secs.c) 16 | 17 | add_library(ui ${SOURCES}) 18 | -------------------------------------------------------------------------------- /waveClock/UI/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(SOURCES ui_Screen1.c 2 | ui_setMenu.c 3 | ui_setTime.c 4 | ui_setDate.c 5 | ui.c 6 | ui_comp_hook.c 7 | ui_helpers.c 8 | ui_events.c 9 | ui_img_logo_png.c 10 | ui_img_set_png.c 11 | ui_img_bright_png.c 12 | fonts/ui_font_date.c 13 | fonts/ui_font_day.c 14 | fonts/ui_font_digits.c 15 | fonts/ui_font_secs.c) 16 | 17 | add_library(ui ${SOURCES}) 18 | -------------------------------------------------------------------------------- /waveClock/assets/ui_font_day.fcfg: -------------------------------------------------------------------------------- 1 | { 2 | "codename": "day", 3 | "ttf_path": "\\assets\\bahnschrift.ttf", 4 | "bin_path": "\\assets\\ui_font_day.bin", 5 | "c_path": "\\assets\\ui_font_day.c", 6 | "cfg_path": "\\assets\\ui_font_day.fcfg", 7 | "size": 24, 8 | "bpp": 1, 9 | "letters": 0, 10 | "ranges": [ 11 | "0x20-0x7f" 12 | ], 13 | "symbols": "", 14 | "customparams": "--no-compress --no-prefilter", 15 | "uploaded": false 16 | } -------------------------------------------------------------------------------- /waveClock/assets/ui_font_date.fcfg: -------------------------------------------------------------------------------- 1 | { 2 | "codename": "date", 3 | "ttf_path": "\\assets\\G7_Segment_7a.ttf", 4 | "bin_path": "\\assets\\ui_font_date.bin", 5 | "c_path": "\\assets\\ui_font_date.c", 6 | "cfg_path": "\\assets\\ui_font_date.fcfg", 7 | "size": 40, 8 | "bpp": 1, 9 | "letters": 0, 10 | "ranges": [ 11 | "0x20-0x7f" 12 | ], 13 | "symbols": "", 14 | "customparams": "--no-compress --no-prefilter", 15 | "uploaded": false 16 | } -------------------------------------------------------------------------------- /waveClock/assets/ui_font_secs.fcfg: -------------------------------------------------------------------------------- 1 | { 2 | "codename": "secs", 3 | "ttf_path": "\\assets\\G7_Segment_7a.ttf", 4 | "bin_path": "\\assets\\ui_font_secs.bin", 5 | "c_path": "\\assets\\ui_font_secs.c", 6 | "cfg_path": "\\assets\\ui_font_secs.fcfg", 7 | "size": 46, 8 | "bpp": 1, 9 | "letters": 0, 10 | "ranges": [ 11 | "0x20-0x7f" 12 | ], 13 | "symbols": "", 14 | "customparams": "--no-compress --no-prefilter", 15 | "uploaded": false 16 | } -------------------------------------------------------------------------------- /waveClock/I2C_Driver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #define I2C_MASTER_FREQ_HZ (400000) /*!< I2C master clock frequency */ 5 | #define I2C_SCL_PIN 10 6 | #define I2C_SDA_PIN 11 7 | 8 | 9 | void I2C_Init(void); 10 | 11 | bool I2C_Read(uint8_t Driver_addr, uint8_t Reg_addr, uint8_t *Reg_data, uint32_t Length); 12 | bool I2C_Write(uint8_t Driver_addr, uint8_t Reg_addr, const uint8_t *Reg_data, uint32_t Length); -------------------------------------------------------------------------------- /waveClock/assets/ui_font_digits.fcfg: -------------------------------------------------------------------------------- 1 | { 2 | "codename": "digits", 3 | "ttf_path": "\\assets\\G7_Segment_7a.ttf", 4 | "bin_path": "\\assets\\ui_font_digits.bin", 5 | "c_path": "\\assets\\ui_font_digits.c", 6 | "cfg_path": "\\assets\\ui_font_digits.fcfg", 7 | "size": 94, 8 | "bpp": 1, 9 | "letters": 0, 10 | "ranges": [ 11 | "0x20-0x7f" 12 | ], 13 | "symbols": "", 14 | "customparams": "--no-compress --no-prefilter", 15 | "uploaded": false 16 | } -------------------------------------------------------------------------------- /waveClock/ui_events.h: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.3.4 3 | // LVGL version: 8.3.6 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 | void cngBright(lv_event_t * e); 14 | void prepareTime(lv_event_t * e); 15 | void choseTime(lv_event_t * e); 16 | 17 | #ifdef __cplusplus 18 | } /*extern "C"*/ 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /waveClock/UI/ui_events.h: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.3.4 3 | // LVGL version: 8.3.6 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 | void cngBright(lv_event_t * e); 14 | void prepareTime(lv_event_t * e); 15 | void choseTime(lv_event_t * e); 16 | 17 | #ifdef __cplusplus 18 | } /*extern "C"*/ 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /waveClock/LVGL_Driver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "lv_conf.h" 5 | #include 6 | #include 7 | #include "Display_SPD2010.h" 8 | #include "Touch_SPD2010.h" 9 | 10 | #define LCD_WIDTH EXAMPLE_LCD_WIDTH 11 | #define LCD_HEIGHT EXAMPLE_LCD_HEIGHT 12 | #define LVGL_BUF_LEN (LCD_WIDTH * LCD_HEIGHT / 10) 13 | 14 | #define EXAMPLE_LVGL_TICK_PERIOD_MS 2 15 | 16 | 17 | void Lvgl_print(const char * buf); 18 | void Lvgl_Display_LCD( lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p ); // Displays LVGL content on the LCD. This function implements associating LVGL data to the LCD screen 19 | void Lvgl_Touchpad_Read( lv_indev_drv_t * indev_drv, lv_indev_data_t * data ); // Read the touchpad 20 | void example_increase_lvgl_tick(void *arg); 21 | 22 | void Lvgl_Init(void); 23 | void Lvgl_Loop(void); 24 | -------------------------------------------------------------------------------- /waveClock/I2C_Driver.cpp: -------------------------------------------------------------------------------- 1 | #include "I2C_Driver.h" 2 | 3 | 4 | void I2C_Init(void) { 5 | Wire.begin(I2C_SDA_PIN, I2C_SCL_PIN); 6 | } 7 | 8 | bool I2C_Read(uint8_t Driver_addr, uint8_t Reg_addr, uint8_t *Reg_data, uint32_t Length) 9 | { 10 | Wire.beginTransmission(Driver_addr); 11 | Wire.write(Reg_addr); 12 | if ( Wire.endTransmission(true)){ 13 | printf("The I2C transmission fails. - I2C Read\r\n"); 14 | return -1; 15 | } 16 | Wire.requestFrom(Driver_addr, Length); 17 | for (int i = 0; i < Length; i++) { 18 | *Reg_data++ = Wire.read(); 19 | } 20 | return 0; 21 | } 22 | bool I2C_Write(uint8_t Driver_addr, uint8_t Reg_addr, const uint8_t *Reg_data, uint32_t Length) 23 | { 24 | Wire.beginTransmission(Driver_addr); 25 | Wire.write(Reg_addr); 26 | for (int i = 0; i < Length; i++) { 27 | Wire.write(*Reg_data++); 28 | } 29 | if ( Wire.endTransmission(true)) 30 | { 31 | printf("The I2C transmission fails. - I2C Write\r\n"); 32 | return -1; 33 | } 34 | return 0; 35 | } -------------------------------------------------------------------------------- /waveClock/Display_SPD2010.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "TCA9554PWR.h" 3 | #include "Touch_SPD2010.h" 4 | #define LCD_Backlight_PIN 5 5 | // Backlight 6 | #define PWM_Channel 1 // PWM Channel 7 | #define Frequency 20000 // PWM frequencyconst 8 | #define Resolution 10 // PWM resolution ratio MAX:13 9 | #define Dutyfactor 500 // PWM Dutyfactor 10 | #define Backlight_MAX 100 11 | 12 | #define EXAMPLE_LCD_WIDTH (412) 13 | #define EXAMPLE_LCD_HEIGHT (412) 14 | #define EXAMPLE_LCD_COLOR_BITS (16) 15 | 16 | #define ESP_PANEL_HOST_SPI_ID_DEFAULT (SPI2_HOST) 17 | #define ESP_PANEL_LCD_SPI_MODE (3) // 0/1/2/3, typically set to 0 18 | #define ESP_PANEL_LCD_SPI_CLK_HZ (40 * 1000 * 1000) // Should be an integer divisor of 80M, typically set to 40M 19 | #define ESP_PANEL_LCD_SPI_TRANS_QUEUE_SZ (10) // Typically set to 10 20 | #define ESP_PANEL_LCD_SPI_CMD_BITS (32) // Typically set to 32 21 | #define ESP_PANEL_LCD_SPI_PARAM_BITS (8) // Typically set to 8 22 | 23 | #define ESP_PANEL_LCD_SPI_IO_TE (18) 24 | #define ESP_PANEL_LCD_SPI_IO_SCK (40) 25 | #define ESP_PANEL_LCD_SPI_IO_DATA0 (46) 26 | #define ESP_PANEL_LCD_SPI_IO_DATA1 (45) 27 | #define ESP_PANEL_LCD_SPI_IO_DATA2 (42) 28 | #define ESP_PANEL_LCD_SPI_IO_DATA3 (41) 29 | #define ESP_PANEL_LCD_SPI_IO_CS (21) 30 | #define EXAMPLE_LCD_PIN_NUM_RST (-1) 31 | #define EXAMPLE_LCD_PIN_NUM_BK_LIGHT (-1) 32 | 33 | #define EXAMPLE_LCD_BK_LIGHT_ON_LEVEL (1) 34 | #define EXAMPLE_LCD_BK_LIGHT_OFF_LEVEL !EXAMPLE_LCD_BK_LIGHT_ON_LEVEL 35 | 36 | #define ESP_PANEL_HOST_SPI_MAX_TRANSFER_SIZE (2048) 37 | 38 | 39 | extern uint8_t LCD_Backlight; 40 | 41 | bool SPD2010_Init(); 42 | 43 | void LCD_Init(); 44 | void LCD_addWindow(uint16_t Xstart, uint16_t Ystart, uint16_t Xend, uint16_t Yend,uint16_t* color); 45 | 46 | // backlight 47 | void Backlight_Init(); 48 | void Set_Backlight(uint8_t Light); -------------------------------------------------------------------------------- /waveClock/Touch_SPD2010.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "I2C_Driver.h" 5 | #include "TCA9554PWR.h" 6 | 7 | #define SPD2010_ADDR (0x53) 8 | #define EXAMPLE_PIN_NUM_TOUCH_INT (4) 9 | #define EXAMPLE_PIN_NUM_TOUCH_RST (-1) 10 | 11 | 12 | #define CONFIG_ESP_LCD_TOUCH_MAX_POINTS (5) 13 | /****************HYN_REG_MUT_DEBUG_INFO_MODE address start***********/ 14 | #define SPD2010_REG_Status (NULL) 15 | 16 | extern struct SPD2010_Touch touch_data; 17 | typedef struct { 18 | uint8_t id; 19 | uint16_t x; 20 | uint16_t y; 21 | uint8_t weight; 22 | } tp_report_t; 23 | struct SPD2010_Touch{ 24 | tp_report_t rpt[10]; 25 | uint8_t touch_num; // Number of touch points 26 | uint8_t pack_code; 27 | uint8_t down; 28 | uint8_t up; 29 | uint8_t gesture; 30 | uint16_t down_x; 31 | uint16_t down_y; 32 | uint16_t up_x; 33 | uint16_t up_y; 34 | }; 35 | 36 | typedef struct { 37 | uint8_t none0; 38 | uint8_t none1; 39 | uint8_t none2; 40 | uint8_t cpu_run; 41 | uint8_t tint_low; 42 | uint8_t tic_in_cpu; 43 | uint8_t tic_in_bios; 44 | uint8_t tic_busy; 45 | } tp_status_high_t; 46 | 47 | typedef struct { 48 | uint8_t pt_exist; 49 | uint8_t gesture; 50 | uint8_t key; 51 | uint8_t aux; 52 | uint8_t keep; 53 | uint8_t raw_or_pt; 54 | uint8_t none6; 55 | uint8_t none7; 56 | } tp_status_low_t; 57 | 58 | typedef struct { 59 | tp_status_low_t status_low; 60 | tp_status_high_t status_high; 61 | uint16_t read_len; 62 | } tp_status_t; 63 | typedef struct { 64 | uint8_t status; 65 | uint16_t next_packet_len; 66 | } tp_hdp_status_t; 67 | 68 | 69 | bool I2C_Read_Touch(uint8_t Driver_addr, uint16_t Reg_addr, uint8_t *Reg_data, uint32_t Length); 70 | bool I2C_Write_Touch(uint8_t Driver_addr, uint16_t Reg_addr, const uint8_t *Reg_data, uint32_t Length); 71 | 72 | uint8_t Touch_Init(); 73 | void Touch_Loop(void); 74 | uint8_t SPD2010_Touch_Reset(void); 75 | uint16_t SPD2010_Read_cfg(void); 76 | void Touch_Read_Data(void); 77 | bool Touch_Get_xy(uint16_t *x, uint16_t *y, uint16_t *strength, uint8_t *point_num, uint8_t max_point_num); 78 | void example_touchpad_read(void); 79 | // 80 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 81 | // SPD2010 函数 82 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 83 | esp_err_t write_tp_point_mode_cmd(); 84 | esp_err_t write_tp_start_cmd(); 85 | esp_err_t write_tp_cpu_start_cmd(); 86 | esp_err_t write_tp_clear_int_cmd(); 87 | esp_err_t read_tp_status_length(tp_status_t *tp_status); 88 | esp_err_t read_tp_hdp(tp_status_t *tp_status, SPD2010_Touch *touch); 89 | esp_err_t read_tp_hdp_status(tp_hdp_status_t *tp_hdp_status); 90 | esp_err_t Read_HDP_REMAIN_DATA(tp_hdp_status_t *tp_hdp_status); 91 | esp_err_t read_fw_version(); 92 | esp_err_t tp_read_data(SPD2010_Touch *touch); 93 | 94 | -------------------------------------------------------------------------------- /waveClock/TCA9554PWR.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "I2C_Driver.h" 5 | 6 | /****************************************************** The macro defines the TCA9554PWR information ******************************************************/ 7 | 8 | #define TCA9554_ADDRESS 0x20 // TCA9554PWR I2C address 9 | 10 | #define TCA9554_INPUT_REG 0x00 // Input register,input level 11 | #define TCA9554_OUTPUT_REG 0x01 // Output register, high and low level output 12 | #define TCA9554_Polarity_REG 0x02 // The Polarity Inversion register (register 2) allows polarity inversion of pins defined as inputs by the Configuration register. 13 | #define TCA9554_CONFIG_REG 0x03 // Configuration register, mode configuration 14 | 15 | 16 | #define Low 0 17 | #define High 1 18 | #define EXIO_PIN1 1 19 | #define EXIO_PIN2 2 20 | #define EXIO_PIN3 3 21 | #define EXIO_PIN4 4 22 | #define EXIO_PIN5 5 23 | #define EXIO_PIN6 6 24 | #define EXIO_PIN7 7 25 | #define EXIO_PIN8 8 26 | 27 | /***************************************************** Operation register REG ****************************************************/ 28 | uint8_t I2C_Read_EXIO(uint8_t REG); // Read the value of the TCA9554PWR register REG 29 | uint8_t I2C_Write_EXIO(uint8_t REG,uint8_t Data); // Write Data to the REG register of the TCA9554PWR 30 | /********************************************************** Set EXIO mode **********************************************************/ 31 | void Mode_EXIO(uint8_t Pin,uint8_t State); // Set the mode of the TCA9554PWR Pin. The default is Output mode (output mode or input mode). State: 0= Output mode 1= input mode 32 | void Mode_EXIOS(uint8_t PinState); // Set the mode of the 7 pins from the TCA9554PWR with PinState 33 | /********************************************************** Read EXIO status **********************************************************/ 34 | uint8_t Read_EXIO(uint8_t Pin); // Read the level of the TCA9554PWR Pin 35 | uint8_t Read_EXIOS(uint8_t REG); // Read the level of all pins of TCA9554PWR, the default read input level state, want to get the current IO output state, pass the parameter TCA9554_OUTPUT_REG, such as Read_EXIOS(TCA9554_OUTPUT_REG); 36 | /********************************************************** Set the EXIO output status **********************************************************/ 37 | void Set_EXIO(uint8_t Pin,uint8_t State); // Sets the level state of the Pin without affecting the other pins 38 | void Set_EXIOS(uint8_t PinState); // Set 7 pins to the PinState state such as :PinState=0x23, 0010 0011 state (the highest bit is not used) 39 | /********************************************************** Flip EXIO state **********************************************************/ 40 | void Set_Toggle(uint8_t Pin); // Flip the level of the TCA9554PWR Pin 41 | /********************************************************* TCA9554PWR Initializes the device ***********************************************************/ 42 | void TCA9554PWR_Init(uint8_t PinState = 0x00); // Set the seven pins to PinState state, for example :PinState=0x23, 0010 0011 State (the highest bit is not used) (Output mode or input mode) 0= Output mode 1= Input mode. The default value is output mode 43 | -------------------------------------------------------------------------------- /waveClock/RTC_PCF85063.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "I2C_Driver.h" 4 | 5 | 6 | //PCF85063_ADDRESS 7 | #define PCF85063_ADDRESS (0x51) 8 | // 9 | #define YEAR_OFFSET (1970) 10 | // registar overview - crtl & status reg 11 | #define RTC_CTRL_1_ADDR (0x00) 12 | #define RTC_CTRL_2_ADDR (0x01) 13 | #define RTC_OFFSET_ADDR (0x02) 14 | #define RTC_RAM_by_ADDR (0x03) 15 | // registar overview - time & data reg 16 | #define RTC_SECOND_ADDR (0x04) 17 | #define RTC_MINUTE_ADDR (0x05) 18 | #define RTC_HOUR_ADDR (0x06) 19 | #define RTC_DAY_ADDR (0x07) 20 | #define RTC_WDAY_ADDR (0x08) 21 | #define RTC_MONTH_ADDR (0x09) 22 | #define RTC_YEAR_ADDR (0x0A) // years 0-99; calculate real year = 1970 + RCC reg year 23 | // registar overview - alarm reg 24 | #define RTC_SECOND_ALARM (0x0B) 25 | #define RTC_MINUTE_ALARM (0x0C) 26 | #define RTC_HOUR_ALARM (0x0D) 27 | #define RTC_DAY_ALARM (0x0E) 28 | #define RTC_WDAY_ALARM (0x0F) 29 | // registar overview - timer reg 30 | #define RTC_TIMER_VAL (0x10) 31 | #define RTC_TIMER_MODE (0x11) 32 | 33 | //RTC_CTRL_1 registar 34 | #define RTC_CTRL_1_EXT_TEST (0x80) 35 | #define RTC_CTRL_1_STOP (0x20) //0-RTC clock runs 1- RTC clock is stopped 36 | #define RTC_CTRL_1_SR (0X10) //0-no software reset 1-initiate software rese 37 | #define RTC_CTRL_1_CIE (0X04) //0-no correction interrupt generated 1-interrupt pulses are generated at every correction cycle 38 | #define RTC_CTRL_1_12_24 (0X02) //0-24H 1-12H 39 | #define RTC_CTRL_1_CAP_SEL (0X01) //0-7PF 1-12.5PF 40 | 41 | //RTC_CTRL_2 registar 42 | #define RTC_CTRL_2_AIE (0X80) //alarm interrupt 0-disalbe 1-enable 43 | #define RTC_CTRL_2_AF (0X40) //alarm flag 0-inactive/cleared 1-active/unchanged 44 | #define RTC_CTRL_2_MI (0X20) //minute interrupt 0-disalbe 1-enable 45 | #define RTC_CTRL_2_HMI (0X10) //half minute interrupt 46 | #define RTC_CTRL_2_TF (0X08) 47 | 48 | // 49 | #define RTC_OFFSET_MODE (0X80) 50 | 51 | // 52 | #define RTC_TIMER_MODE_TE (0X04) //timer enable 0-disalbe 1-enable 53 | #define RTC_TIMER_MODE_TIE (0X02) //timer interrupt enable 0-disalbe 1-enable 54 | #define RTC_TIMER_MODE_TI_TP (0X01) //timer interrupt mode 0-interrupt follows timer flag 1-interrupt generates a pulse 55 | 56 | // format 57 | #define RTC_ALARM (0x80) // set AEN_x registers 58 | #define RTC_CTRL_1_DEFAULT (0x00) 59 | #define RTC_CTRL_2_DEFAULT (0x00) 60 | 61 | #define RTC_TIMER_FLAG (0x08) 62 | 63 | typedef struct { 64 | uint16_t year; 65 | uint8_t month; 66 | uint8_t day; 67 | uint8_t dotw; 68 | uint8_t hour; 69 | uint8_t minute; 70 | uint8_t second; 71 | }datetime_t; 72 | 73 | 74 | extern datetime_t datetime; 75 | 76 | void PCF85063_Init(void); 77 | void PCF85063_Loop(void); 78 | void PCF85063_Reset(void); 79 | 80 | void PCF85063_Set_Time(datetime_t time); 81 | void PCF85063_Set_Date(datetime_t date); 82 | void PCF85063_Set_All(datetime_t time); 83 | 84 | void PCF85063_Read_Time(datetime_t *time); 85 | 86 | 87 | void PCF85063_Enable_Alarm(void); 88 | uint8_t PCF85063_Get_Alarm_Flag(); 89 | void PCF85063_Set_Alarm(datetime_t time); 90 | void PCF85063_Read_Alarm(datetime_t *time); 91 | 92 | void datetime_to_str(char *datetime_str,datetime_t time); 93 | 94 | 95 | // weekday format 96 | // 0 - sunday 97 | // 1 - monday 98 | // 2 - tuesday 99 | // 3 - wednesday 100 | // 4 - thursday 101 | // 5 - friday 102 | // 6 - saturday -------------------------------------------------------------------------------- /waveClock/LVGL_Driver.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | | File : LVGL_Driver.c 3 | 4 | | help : 5 | The provided LVGL library file must be installed first 6 | ******************************************************************************/ 7 | #include "LVGL_Driver.h" 8 | 9 | static lv_disp_draw_buf_t draw_buf; 10 | static lv_color_t buf1[ LVGL_BUF_LEN ]; 11 | static lv_color_t buf2[ LVGL_BUF_LEN ]; 12 | // static lv_color_t* buf1 = (lv_color_t*) heap_caps_malloc(LVGL_BUF_LEN, MALLOC_CAP_SPIRAM); 13 | // static lv_color_t* buf2 = (lv_color_t*) heap_caps_malloc(LVGL_BUF_LEN, MALLOC_CAP_SPIRAM); 14 | 15 | 16 | 17 | /* Serial debugging */ 18 | void Lvgl_print(const char * buf) 19 | { 20 | // Serial.printf(buf); 21 | // Serial.flush(); 22 | } 23 | void Lvgl_port_rounder_callback(struct _lv_disp_drv_t * disp_drv, lv_area_t * area) 24 | { 25 | uint16_t x1 = area->x1; 26 | uint16_t x2 = area->x2; 27 | 28 | // round the start of coordinate down to the nearest 4M number 29 | area->x1 = (x1 >> 2) << 2; 30 | 31 | // round the end of coordinate up to the nearest 4N+3 number 32 | area->x2 = ((x2 >> 2) << 2) + 3; 33 | } 34 | /* Display flushing 35 | Displays LVGL content on the LCD 36 | This function implements associating LVGL data to the LCD screen 37 | */ 38 | void Lvgl_Display_LCD( lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p ) 39 | { 40 | LCD_addWindow(area->x1, area->y1, area->x2, area->y2, ( uint16_t *)&color_p->full); 41 | lv_disp_flush_ready( disp_drv ); 42 | } 43 | /*Read the touchpad*/ 44 | void Lvgl_Touchpad_Read( lv_indev_drv_t * indev_drv, lv_indev_data_t * data ) 45 | { 46 | bool tp_pressed = false; 47 | uint16_t tp_x = 0; 48 | uint16_t tp_y = 0; 49 | uint8_t tp_cnt = 0; 50 | tp_pressed = Touch_Get_xy(&tp_x, &tp_y, NULL, &tp_cnt, CONFIG_ESP_LCD_TOUCH_MAX_POINTS); 51 | if (tp_pressed && (tp_cnt > 0)) { 52 | data->point.x = tp_x; 53 | data->point.y = tp_y; 54 | data->state = LV_INDEV_STATE_PR; 55 | // printf("LVGL : X=%u Y=%u points=%d\r\n", tp_x , tp_y,tp_cnt); 56 | }else { 57 | data->state = LV_INDEV_STATE_REL; 58 | } 59 | 60 | } 61 | void example_increase_lvgl_tick(void *arg) 62 | { 63 | /* Tell LVGL how many milliseconds has elapsed */ 64 | lv_tick_inc(EXAMPLE_LVGL_TICK_PERIOD_MS); 65 | } 66 | void Lvgl_Init(void) 67 | { 68 | lv_init(); 69 | lv_disp_draw_buf_init( &draw_buf, buf1, buf2, LVGL_BUF_LEN); 70 | 71 | /*Initialize the display*/ 72 | static lv_disp_drv_t disp_drv; 73 | lv_disp_drv_init( &disp_drv ); 74 | /*Change the following line to your display resolution*/ 75 | disp_drv.hor_res = LCD_WIDTH; 76 | disp_drv.ver_res = LCD_HEIGHT; 77 | disp_drv.flush_cb = Lvgl_Display_LCD; 78 | disp_drv.rounder_cb = Lvgl_port_rounder_callback; 79 | disp_drv.full_refresh = 1; /**< 1: Always make the whole screen redrawn*/ 80 | disp_drv.draw_buf = &draw_buf; 81 | lv_disp_drv_register( &disp_drv ); 82 | 83 | /*Initialize the (dummy) input device driver*/ 84 | static lv_indev_drv_t indev_drv; 85 | lv_indev_drv_init( &indev_drv ); 86 | indev_drv.type = LV_INDEV_TYPE_POINTER; 87 | indev_drv.read_cb = Lvgl_Touchpad_Read; 88 | lv_indev_drv_register( &indev_drv ); 89 | 90 | /* Create simple label */ 91 | lv_obj_t *label = lv_label_create( lv_scr_act() ); 92 | lv_label_set_text( label, "Hello Ardino and LVGL!"); 93 | lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 ); 94 | 95 | const esp_timer_create_args_t lvgl_tick_timer_args = { 96 | .callback = &example_increase_lvgl_tick, 97 | .name = "lvgl_tick" 98 | }; 99 | esp_timer_handle_t lvgl_tick_timer = NULL; 100 | esp_timer_create(&lvgl_tick_timer_args, &lvgl_tick_timer); 101 | esp_timer_start_periodic(lvgl_tick_timer, EXAMPLE_LVGL_TICK_PERIOD_MS * 1000); 102 | 103 | } 104 | void Lvgl_Loop(void) 105 | { 106 | lv_timer_handler(); /* let the GUI do its work */ 107 | // delay( 5 ); 108 | } 109 | -------------------------------------------------------------------------------- /waveClock/ui_helpers.h: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.3.4 3 | // LVGL version: 8.3.6 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, const 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, void (*target_init)(void)); 44 | 45 | void _ui_screen_delete(lv_obj_t ** target); 46 | 47 | void _ui_arc_increment(lv_obj_t * target, int val); 48 | 49 | void _ui_bar_increment(lv_obj_t * target, int val, int anm); 50 | 51 | void _ui_slider_increment(lv_obj_t * target, int val, int anm); 52 | 53 | void _ui_keyboard_set_target(lv_obj_t * keyboard, lv_obj_t * textarea); 54 | 55 | #define _UI_MODIFY_FLAG_ADD 0 56 | #define _UI_MODIFY_FLAG_REMOVE 1 57 | #define _UI_MODIFY_FLAG_TOGGLE 2 58 | void _ui_flag_modify(lv_obj_t * target, int32_t flag, int value); 59 | 60 | #define _UI_MODIFY_STATE_ADD 0 61 | #define _UI_MODIFY_STATE_REMOVE 1 62 | #define _UI_MODIFY_STATE_TOGGLE 2 63 | void _ui_state_modify(lv_obj_t * target, int32_t state, int value); 64 | 65 | void scr_unloaded_delete_cb(lv_event_t * e); 66 | 67 | void _ui_opacity_set(lv_obj_t * target, int val); 68 | 69 | /** Describes an animation*/ 70 | typedef struct _ui_anim_user_data_t { 71 | lv_obj_t * target; 72 | lv_img_dsc_t ** imgset; 73 | int32_t imgset_size; 74 | int32_t val; 75 | } ui_anim_user_data_t; 76 | void _ui_anim_callback_free_user_data(lv_anim_t * a); 77 | 78 | void _ui_anim_callback_set_x(lv_anim_t * a, int32_t v); 79 | 80 | void _ui_anim_callback_set_y(lv_anim_t * a, int32_t v); 81 | 82 | void _ui_anim_callback_set_width(lv_anim_t * a, int32_t v); 83 | 84 | void _ui_anim_callback_set_height(lv_anim_t * a, int32_t v); 85 | 86 | void _ui_anim_callback_set_opacity(lv_anim_t * a, int32_t v); 87 | 88 | void _ui_anim_callback_set_image_zoom(lv_anim_t * a, int32_t v); 89 | 90 | void _ui_anim_callback_set_image_angle(lv_anim_t * a, int32_t v); 91 | 92 | void _ui_anim_callback_set_image_frame(lv_anim_t * a, int32_t v); 93 | 94 | int32_t _ui_anim_callback_get_x(lv_anim_t * a); 95 | 96 | int32_t _ui_anim_callback_get_y(lv_anim_t * a); 97 | 98 | int32_t _ui_anim_callback_get_width(lv_anim_t * a); 99 | 100 | int32_t _ui_anim_callback_get_height(lv_anim_t * a); 101 | 102 | int32_t _ui_anim_callback_get_opacity(lv_anim_t * a); 103 | 104 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t * a); 105 | 106 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t * a); 107 | 108 | int32_t _ui_anim_callback_get_image_frame(lv_anim_t * a); 109 | 110 | void _ui_arc_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix); 111 | 112 | void _ui_slider_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix); 113 | 114 | void _ui_checked_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * txt_on, const char * txt_off); 115 | 116 | void _ui_spinbox_step(lv_obj_t * target, int val) 117 | ; 118 | 119 | #ifdef __cplusplus 120 | } /*extern "C"*/ 121 | #endif 122 | 123 | #endif 124 | -------------------------------------------------------------------------------- /waveClock/UI/ui_helpers.h: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.3.4 3 | // LVGL version: 8.3.6 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, const 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, void (*target_init)(void)); 44 | 45 | void _ui_screen_delete(lv_obj_t ** target); 46 | 47 | void _ui_arc_increment(lv_obj_t * target, int val); 48 | 49 | void _ui_bar_increment(lv_obj_t * target, int val, int anm); 50 | 51 | void _ui_slider_increment(lv_obj_t * target, int val, int anm); 52 | 53 | void _ui_keyboard_set_target(lv_obj_t * keyboard, lv_obj_t * textarea); 54 | 55 | #define _UI_MODIFY_FLAG_ADD 0 56 | #define _UI_MODIFY_FLAG_REMOVE 1 57 | #define _UI_MODIFY_FLAG_TOGGLE 2 58 | void _ui_flag_modify(lv_obj_t * target, int32_t flag, int value); 59 | 60 | #define _UI_MODIFY_STATE_ADD 0 61 | #define _UI_MODIFY_STATE_REMOVE 1 62 | #define _UI_MODIFY_STATE_TOGGLE 2 63 | void _ui_state_modify(lv_obj_t * target, int32_t state, int value); 64 | 65 | void scr_unloaded_delete_cb(lv_event_t * e); 66 | 67 | void _ui_opacity_set(lv_obj_t * target, int val); 68 | 69 | /** Describes an animation*/ 70 | typedef struct _ui_anim_user_data_t { 71 | lv_obj_t * target; 72 | lv_img_dsc_t ** imgset; 73 | int32_t imgset_size; 74 | int32_t val; 75 | } ui_anim_user_data_t; 76 | void _ui_anim_callback_free_user_data(lv_anim_t * a); 77 | 78 | void _ui_anim_callback_set_x(lv_anim_t * a, int32_t v); 79 | 80 | void _ui_anim_callback_set_y(lv_anim_t * a, int32_t v); 81 | 82 | void _ui_anim_callback_set_width(lv_anim_t * a, int32_t v); 83 | 84 | void _ui_anim_callback_set_height(lv_anim_t * a, int32_t v); 85 | 86 | void _ui_anim_callback_set_opacity(lv_anim_t * a, int32_t v); 87 | 88 | void _ui_anim_callback_set_image_zoom(lv_anim_t * a, int32_t v); 89 | 90 | void _ui_anim_callback_set_image_angle(lv_anim_t * a, int32_t v); 91 | 92 | void _ui_anim_callback_set_image_frame(lv_anim_t * a, int32_t v); 93 | 94 | int32_t _ui_anim_callback_get_x(lv_anim_t * a); 95 | 96 | int32_t _ui_anim_callback_get_y(lv_anim_t * a); 97 | 98 | int32_t _ui_anim_callback_get_width(lv_anim_t * a); 99 | 100 | int32_t _ui_anim_callback_get_height(lv_anim_t * a); 101 | 102 | int32_t _ui_anim_callback_get_opacity(lv_anim_t * a); 103 | 104 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t * a); 105 | 106 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t * a); 107 | 108 | int32_t _ui_anim_callback_get_image_frame(lv_anim_t * a); 109 | 110 | void _ui_arc_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix); 111 | 112 | void _ui_slider_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix); 113 | 114 | void _ui_checked_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * txt_on, const char * txt_off); 115 | 116 | void _ui_spinbox_step(lv_obj_t * target, int val) 117 | ; 118 | 119 | #ifdef __cplusplus 120 | } /*extern "C"*/ 121 | #endif 122 | 123 | #endif 124 | -------------------------------------------------------------------------------- /waveClock/UI/ui_setMenu.c: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.3.4 3 | // LVGL version: 8.3.6 4 | // Project name: SquareLine_Project 5 | 6 | #include "ui.h" 7 | 8 | void ui_setMenu_screen_init(void) 9 | { 10 | ui_setMenu = lv_obj_create(NULL); 11 | lv_obj_clear_flag(ui_setMenu, LV_OBJ_FLAG_SCROLLABLE); /// Flags 12 | lv_obj_set_style_bg_color(ui_setMenu, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 13 | lv_obj_set_style_bg_opa(ui_setMenu, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 14 | lv_obj_set_style_border_color(ui_setMenu, lv_color_hex(0x615C5C), LV_PART_MAIN | LV_STATE_DEFAULT); 15 | lv_obj_set_style_border_opa(ui_setMenu, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 16 | 17 | ui_Button2 = lv_btn_create(ui_setMenu); 18 | lv_obj_set_width(ui_Button2, 169); 19 | lv_obj_set_height(ui_Button2, 58); 20 | lv_obj_set_x(ui_Button2, 0); 21 | lv_obj_set_y(ui_Button2, -68); 22 | lv_obj_set_align(ui_Button2, LV_ALIGN_CENTER); 23 | lv_obj_add_flag(ui_Button2, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags 24 | lv_obj_clear_flag(ui_Button2, LV_OBJ_FLAG_SCROLLABLE); /// Flags 25 | lv_obj_set_style_bg_color(ui_Button2, lv_color_hex(0xACC6DE), LV_PART_MAIN | LV_STATE_DEFAULT); 26 | lv_obj_set_style_bg_opa(ui_Button2, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 27 | lv_obj_set_style_border_width(ui_Button2, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 28 | 29 | ui_Label6 = lv_label_create(ui_Button2); 30 | lv_obj_set_width(ui_Label6, LV_SIZE_CONTENT); /// 1 31 | lv_obj_set_height(ui_Label6, LV_SIZE_CONTENT); /// 1 32 | lv_obj_set_align(ui_Label6, LV_ALIGN_CENTER); 33 | lv_label_set_text(ui_Label6, "SET TIME"); 34 | lv_obj_set_style_text_color(ui_Label6, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 35 | lv_obj_set_style_text_opa(ui_Label6, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 36 | lv_obj_set_style_text_font(ui_Label6, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 37 | 38 | ui_Button3 = lv_btn_create(ui_setMenu); 39 | lv_obj_set_width(ui_Button3, 169); 40 | lv_obj_set_height(ui_Button3, 58); 41 | lv_obj_set_x(ui_Button3, 2); 42 | lv_obj_set_y(ui_Button3, 68); 43 | lv_obj_set_align(ui_Button3, LV_ALIGN_CENTER); 44 | lv_obj_add_flag(ui_Button3, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags 45 | lv_obj_clear_flag(ui_Button3, LV_OBJ_FLAG_SCROLLABLE); /// Flags 46 | lv_obj_set_style_bg_color(ui_Button3, lv_color_hex(0x292831), LV_PART_MAIN | LV_STATE_DEFAULT); 47 | lv_obj_set_style_bg_opa(ui_Button3, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 48 | lv_obj_set_style_border_width(ui_Button3, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 49 | 50 | ui_Label7 = lv_label_create(ui_Button3); 51 | lv_obj_set_width(ui_Label7, LV_SIZE_CONTENT); /// 1 52 | lv_obj_set_height(ui_Label7, LV_SIZE_CONTENT); /// 1 53 | lv_obj_set_align(ui_Label7, LV_ALIGN_CENTER); 54 | lv_label_set_text(ui_Label7, "HOME"); 55 | lv_obj_set_style_text_color(ui_Label7, lv_color_hex(0xB8C8D5), LV_PART_MAIN | LV_STATE_DEFAULT); 56 | lv_obj_set_style_text_opa(ui_Label7, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 57 | lv_obj_set_style_text_font(ui_Label7, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 58 | 59 | ui_Button4 = lv_btn_create(ui_setMenu); 60 | lv_obj_set_width(ui_Button4, 169); 61 | lv_obj_set_height(ui_Button4, 58); 62 | lv_obj_set_align(ui_Button4, LV_ALIGN_CENTER); 63 | lv_obj_add_flag(ui_Button4, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags 64 | lv_obj_clear_flag(ui_Button4, LV_OBJ_FLAG_SCROLLABLE); /// Flags 65 | lv_obj_set_style_bg_color(ui_Button4, lv_color_hex(0xACC6DE), LV_PART_MAIN | LV_STATE_DEFAULT); 66 | lv_obj_set_style_bg_opa(ui_Button4, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 67 | lv_obj_set_style_border_width(ui_Button4, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 68 | 69 | ui_Label12 = lv_label_create(ui_Button4); 70 | lv_obj_set_width(ui_Label12, LV_SIZE_CONTENT); /// 1 71 | lv_obj_set_height(ui_Label12, LV_SIZE_CONTENT); /// 1 72 | lv_obj_set_align(ui_Label12, LV_ALIGN_CENTER); 73 | lv_label_set_text(ui_Label12, "SET DATE"); 74 | lv_obj_set_style_text_color(ui_Label12, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 75 | lv_obj_set_style_text_opa(ui_Label12, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 76 | lv_obj_set_style_text_font(ui_Label12, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 77 | 78 | lv_obj_add_event_cb(ui_Button2, ui_event_Button2, LV_EVENT_ALL, NULL); 79 | lv_obj_add_event_cb(ui_Button3, ui_event_Button3, LV_EVENT_ALL, NULL); 80 | lv_obj_add_event_cb(ui_Button4, ui_event_Button4, LV_EVENT_ALL, NULL); 81 | 82 | } 83 | -------------------------------------------------------------------------------- /waveClock/ui_setMenu.c: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.3.4 3 | // LVGL version: 8.3.6 4 | // Project name: SquareLine_Project 5 | 6 | #include "ui.h" 7 | 8 | void ui_setMenu_screen_init(void) 9 | { 10 | ui_setMenu = lv_obj_create(NULL); 11 | lv_obj_clear_flag(ui_setMenu, LV_OBJ_FLAG_SCROLLABLE); /// Flags 12 | lv_obj_set_style_bg_color(ui_setMenu, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 13 | lv_obj_set_style_bg_opa(ui_setMenu, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 14 | lv_obj_set_style_border_color(ui_setMenu, lv_color_hex(0x615C5C), LV_PART_MAIN | LV_STATE_DEFAULT); 15 | lv_obj_set_style_border_opa(ui_setMenu, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 16 | 17 | ui_Button2 = lv_btn_create(ui_setMenu); 18 | lv_obj_set_width(ui_Button2, 169); 19 | lv_obj_set_height(ui_Button2, 58); 20 | lv_obj_set_x(ui_Button2, 0); 21 | lv_obj_set_y(ui_Button2, -68); 22 | lv_obj_set_align(ui_Button2, LV_ALIGN_CENTER); 23 | lv_obj_add_flag(ui_Button2, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags 24 | lv_obj_clear_flag(ui_Button2, LV_OBJ_FLAG_SCROLLABLE); /// Flags 25 | lv_obj_set_style_bg_color(ui_Button2, lv_color_hex(0xACC6DE), LV_PART_MAIN | LV_STATE_DEFAULT); 26 | lv_obj_set_style_bg_opa(ui_Button2, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 27 | lv_obj_set_style_border_width(ui_Button2, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 28 | 29 | ui_Label6 = lv_label_create(ui_Button2); 30 | lv_obj_set_width(ui_Label6, LV_SIZE_CONTENT); /// 1 31 | lv_obj_set_height(ui_Label6, LV_SIZE_CONTENT); /// 1 32 | lv_obj_set_align(ui_Label6, LV_ALIGN_CENTER); 33 | lv_label_set_text(ui_Label6, "SET TIME"); 34 | lv_obj_set_style_text_color(ui_Label6, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 35 | lv_obj_set_style_text_opa(ui_Label6, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 36 | lv_obj_set_style_text_font(ui_Label6, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 37 | 38 | ui_Button3 = lv_btn_create(ui_setMenu); 39 | lv_obj_set_width(ui_Button3, 169); 40 | lv_obj_set_height(ui_Button3, 58); 41 | lv_obj_set_x(ui_Button3, 2); 42 | lv_obj_set_y(ui_Button3, 68); 43 | lv_obj_set_align(ui_Button3, LV_ALIGN_CENTER); 44 | lv_obj_add_flag(ui_Button3, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags 45 | lv_obj_clear_flag(ui_Button3, LV_OBJ_FLAG_SCROLLABLE); /// Flags 46 | lv_obj_set_style_bg_color(ui_Button3, lv_color_hex(0x292831), LV_PART_MAIN | LV_STATE_DEFAULT); 47 | lv_obj_set_style_bg_opa(ui_Button3, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 48 | lv_obj_set_style_border_width(ui_Button3, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 49 | 50 | ui_Label7 = lv_label_create(ui_Button3); 51 | lv_obj_set_width(ui_Label7, LV_SIZE_CONTENT); /// 1 52 | lv_obj_set_height(ui_Label7, LV_SIZE_CONTENT); /// 1 53 | lv_obj_set_align(ui_Label7, LV_ALIGN_CENTER); 54 | lv_label_set_text(ui_Label7, "HOME"); 55 | lv_obj_set_style_text_color(ui_Label7, lv_color_hex(0xB8C8D5), LV_PART_MAIN | LV_STATE_DEFAULT); 56 | lv_obj_set_style_text_opa(ui_Label7, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 57 | lv_obj_set_style_text_font(ui_Label7, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 58 | 59 | ui_Button4 = lv_btn_create(ui_setMenu); 60 | lv_obj_set_width(ui_Button4, 169); 61 | lv_obj_set_height(ui_Button4, 58); 62 | lv_obj_set_align(ui_Button4, LV_ALIGN_CENTER); 63 | lv_obj_add_flag(ui_Button4, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags 64 | lv_obj_clear_flag(ui_Button4, LV_OBJ_FLAG_SCROLLABLE); /// Flags 65 | lv_obj_set_style_bg_color(ui_Button4, lv_color_hex(0xACC6DE), LV_PART_MAIN | LV_STATE_DEFAULT); 66 | lv_obj_set_style_bg_opa(ui_Button4, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 67 | lv_obj_set_style_border_width(ui_Button4, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 68 | 69 | ui_Label12 = lv_label_create(ui_Button4); 70 | lv_obj_set_width(ui_Label12, LV_SIZE_CONTENT); /// 1 71 | lv_obj_set_height(ui_Label12, LV_SIZE_CONTENT); /// 1 72 | lv_obj_set_align(ui_Label12, LV_ALIGN_CENTER); 73 | lv_label_set_text(ui_Label12, "SET DATE"); 74 | lv_obj_set_style_text_color(ui_Label12, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 75 | lv_obj_set_style_text_opa(ui_Label12, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 76 | lv_obj_set_style_text_font(ui_Label12, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 77 | 78 | lv_obj_add_event_cb(ui_Button2, ui_event_Button2, LV_EVENT_ALL, NULL); 79 | lv_obj_add_event_cb(ui_Button3, ui_event_Button3, LV_EVENT_ALL, NULL); 80 | lv_obj_add_event_cb(ui_Button4, ui_event_Button4, LV_EVENT_ALL, NULL); 81 | 82 | } 83 | -------------------------------------------------------------------------------- /waveClock/TCA9554PWR.cpp: -------------------------------------------------------------------------------- 1 | #include "TCA9554PWR.h" 2 | 3 | /***************************************************** Operation register REG ****************************************************/ 4 | uint8_t I2C_Read_EXIO(uint8_t REG) // Read the value of the TCA9554PWR register REG 5 | { 6 | Wire.beginTransmission(TCA9554_ADDRESS); 7 | Wire.write(REG); 8 | uint8_t result = Wire.endTransmission(); 9 | if (result != 0) { 10 | printf("The I2C transmission fails. - I2C Read EXIO\r\n"); 11 | } 12 | Wire.requestFrom(TCA9554_ADDRESS, 1); 13 | uint8_t bitsStatus; 14 | if (Wire.available()) { 15 | bitsStatus = Wire.read(); 16 | } 17 | return bitsStatus; 18 | } 19 | uint8_t I2C_Write_EXIO(uint8_t REG,uint8_t Data) // Write Data to the REG register of the TCA9554PWR 20 | { 21 | Wire.beginTransmission(TCA9554_ADDRESS); 22 | Wire.write(REG); 23 | Wire.write(Data); 24 | uint8_t result = Wire.endTransmission(); 25 | if (result != 0) { 26 | printf("The I2C transmission fails. - I2C Write EXIO\r\n"); 27 | return -1; 28 | } 29 | return 0; 30 | } 31 | /********************************************************** Set EXIO mode **********************************************************/ 32 | void Mode_EXIO(uint8_t Pin,uint8_t State) // Set the mode of the TCA9554PWR Pin. The default is Output mode (output mode or input mode). State: 0= Output mode 1= input mode 33 | { 34 | uint8_t bitsStatus = I2C_Read_EXIO(TCA9554_CONFIG_REG); 35 | uint8_t Data = (0x01 << (Pin-1)) | bitsStatus; 36 | uint8_t result = I2C_Write_EXIO(TCA9554_CONFIG_REG,Data); 37 | if (result != 0) { 38 | printf("I/O Configuration Failure !!!\r\n"); 39 | } 40 | } 41 | void Mode_EXIOS(uint8_t PinState) // Set the mode of the 7 pins from the TCA9554PWR with PinState 42 | { 43 | uint8_t result = I2C_Write_EXIO(TCA9554_CONFIG_REG,PinState); 44 | if (result != 0) { 45 | printf("I/O Configuration Failure !!!\r\n"); 46 | } 47 | } 48 | /********************************************************** Read EXIO status **********************************************************/ 49 | uint8_t Read_EXIO(uint8_t Pin) // Read the level of the TCA9554PWR Pin 50 | { 51 | uint8_t inputBits = I2C_Read_EXIO(TCA9554_INPUT_REG); 52 | uint8_t bitStatus = (inputBits >> (Pin-1)) & 0x01; 53 | return bitStatus; 54 | } 55 | uint8_t Read_EXIOS(uint8_t REG = TCA9554_INPUT_REG) // Read the level of all pins of TCA9554PWR, the default read input level state, want to get the current IO output state, pass the parameter TCA9554_OUTPUT_REG, such as Read_EXIOS(TCA9554_OUTPUT_REG); 56 | { 57 | uint8_t inputBits = I2C_Read_EXIO(REG); 58 | return inputBits; 59 | } 60 | 61 | /********************************************************** Set the EXIO output status **********************************************************/ 62 | void Set_EXIO(uint8_t Pin,uint8_t State) // Sets the level state of the Pin without affecting the other pins 63 | { 64 | uint8_t Data; 65 | if(State < 2 && Pin < 9 && Pin > 0){ 66 | uint8_t bitsStatus = Read_EXIOS(TCA9554_OUTPUT_REG); 67 | if(State == 1) 68 | Data = (0x01 << (Pin-1)) | bitsStatus; 69 | else if(State == 0) 70 | Data = (~(0x01 << (Pin-1))) & bitsStatus; 71 | uint8_t result = I2C_Write_EXIO(TCA9554_OUTPUT_REG,Data); 72 | if (result != 0) { 73 | printf("Failed to set GPIO!!!\r\n"); 74 | } 75 | } 76 | else 77 | printf("Parameter error, please enter the correct parameter!\r\n"); 78 | } 79 | void Set_EXIOS(uint8_t PinState) // Set 7 pins to the PinState state such as :PinState=0x23, 0010 0011 state (the highest bit is not used) 80 | { 81 | uint8_t result = I2C_Write_EXIO(TCA9554_OUTPUT_REG,PinState); 82 | if (result != 0) { 83 | printf("Failed to set GPIO!!!\r\n"); 84 | } 85 | } 86 | /********************************************************** Flip EXIO state **********************************************************/ 87 | void Set_Toggle(uint8_t Pin) // Flip the level of the TCA9554PWR Pin 88 | { 89 | uint8_t bitsStatus = Read_EXIO(Pin); 90 | Set_EXIO(Pin,(bool)!bitsStatus); 91 | } 92 | /********************************************************* TCA9554PWR Initializes the device ***********************************************************/ 93 | void TCA9554PWR_Init(uint8_t PinState) // Set the seven pins to PinState state, for example :PinState=0x23, 0010 0011 State (Output mode or input mode) 0= Output mode 1= Input mode. The default value is output mode 94 | { 95 | Mode_EXIOS(PinState); 96 | } 97 | -------------------------------------------------------------------------------- /waveClock/esp_lcd_spd2010.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | #include "esp_lcd_panel_vendor.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /** 18 | * @brief LCD panel initialization commands. 19 | * 20 | */ 21 | typedef struct { 22 | int cmd; /* 4 | #include 5 | #include "esp_intr_alloc.h" 6 | #include "driver/spi_master.h" 7 | #include "esp_lcd_panel_io.h" 8 | #include "esp_lcd_spd2010.h" 9 | 10 | #include "esp_lcd_panel_io_interface.h" 11 | #include "esp_lcd_panel_ops.h" 12 | 13 | uint8_t LCD_Backlight = 60; 14 | 15 | void SPD2010_Reset(){ 16 | Set_EXIO(EXIO_PIN2,Low); 17 | delay(50); 18 | Set_EXIO(EXIO_PIN2,High); 19 | delay(50); 20 | } 21 | void LCD_Init() { 22 | SPD2010_Init(); 23 | Touch_Init(); 24 | } 25 | 26 | static void test_draw_bitmap(esp_lcd_panel_handle_t panel_handle) 27 | { 28 | uint16_t row_line = ((EXAMPLE_LCD_WIDTH / EXAMPLE_LCD_COLOR_BITS) << 1) >> 1; 29 | uint8_t byte_per_pixel = EXAMPLE_LCD_COLOR_BITS / 8; 30 | uint8_t *color = (uint8_t *)heap_caps_calloc(1, row_line * EXAMPLE_LCD_HEIGHT * byte_per_pixel, MALLOC_CAP_DMA); 31 | for (int j = 0; j < EXAMPLE_LCD_COLOR_BITS; j++) { 32 | for (int i = 0; i < row_line * EXAMPLE_LCD_HEIGHT; i++) { 33 | for (int k = 0; k < byte_per_pixel; k++) { 34 | color[i * byte_per_pixel + k] = (SPI_SWAP_DATA_TX(BIT(j), EXAMPLE_LCD_COLOR_BITS) >> (k * 8)) & 0xff; 35 | } 36 | } 37 | esp_lcd_panel_draw_bitmap(panel_handle, 0, j * row_line, EXAMPLE_LCD_HEIGHT, (j + 1) * row_line, color); 38 | } 39 | free(color); 40 | } 41 | 42 | bool QSPI_Init(void){ 43 | static const spi_bus_config_t host_config = { 44 | .data0_io_num = ESP_PANEL_LCD_SPI_IO_DATA0, 45 | .data1_io_num = ESP_PANEL_LCD_SPI_IO_DATA1, 46 | .sclk_io_num = ESP_PANEL_LCD_SPI_IO_SCK, 47 | .data2_io_num = ESP_PANEL_LCD_SPI_IO_DATA2, 48 | .data3_io_num = ESP_PANEL_LCD_SPI_IO_DATA3, 49 | .data4_io_num = -1, 50 | .data5_io_num = -1, 51 | .data6_io_num = -1, 52 | .data7_io_num = -1, 53 | .max_transfer_sz = ESP_PANEL_HOST_SPI_MAX_TRANSFER_SIZE, 54 | .flags = SPICOMMON_BUSFLAG_MASTER, 55 | .intr_flags = 0, 56 | }; 57 | if(spi_bus_initialize(SPI2_HOST, &host_config, SPI_DMA_CH_AUTO) != ESP_OK){ 58 | printf("The SPI initialization failed.\r\n"); 59 | return false; 60 | } 61 | printf("The SPI initialization succeeded.\r\n"); 62 | return true; 63 | } 64 | 65 | esp_lcd_panel_handle_t panel_handle = NULL; 66 | bool SPD2010_Init() { 67 | SPD2010_Reset(); 68 | pinMode(ESP_PANEL_LCD_SPI_IO_TE, OUTPUT); 69 | if(!QSPI_Init()){ 70 | printf("SPD2010 Failed to be initialized\r\n"); 71 | } 72 | 73 | const esp_lcd_panel_io_spi_config_t io_config ={ 74 | .cs_gpio_num = ESP_PANEL_LCD_SPI_IO_CS, 75 | .dc_gpio_num = -1, 76 | .spi_mode = ESP_PANEL_LCD_SPI_MODE, 77 | .pclk_hz = ESP_PANEL_LCD_SPI_CLK_HZ, 78 | .trans_queue_depth = ESP_PANEL_LCD_SPI_TRANS_QUEUE_SZ, 79 | .on_color_trans_done = NULL, // 传输完成时调用该函数 80 | .user_ctx = NULL, 81 | .lcd_cmd_bits = ESP_PANEL_LCD_SPI_CMD_BITS, 82 | .lcd_param_bits = ESP_PANEL_LCD_SPI_PARAM_BITS, 83 | .flags = { 84 | .dc_low_on_data = 0, 85 | .octal_mode = 0, 86 | .quad_mode = 1, 87 | .sio_mode = 0, 88 | .lsb_first = 0, 89 | .cs_high_active = 0, 90 | }, 91 | }; 92 | esp_lcd_panel_io_handle_t io_handle = NULL; 93 | if(esp_lcd_new_panel_io_spi((esp_lcd_spi_bus_handle_t)ESP_PANEL_HOST_SPI_ID_DEFAULT, &io_config, &io_handle) != ESP_OK){ 94 | printf("Failed to set LCD communication parameters -- SPI\r\n"); 95 | return false; 96 | }else{ 97 | printf("LCD communication parameters are set successfully -- SPI\r\n"); 98 | } 99 | 100 | printf("Install LCD driver of spd2010\r\n"); 101 | spd2010_vendor_config_t vendor_config={ 102 | .flags = { 103 | .use_qspi_interface = 1, 104 | }, 105 | }; 106 | esp_lcd_panel_dev_config_t panel_config={ 107 | .reset_gpio_num = EXAMPLE_LCD_PIN_NUM_RST, 108 | .rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB, 109 | .data_endian = LCD_RGB_DATA_ENDIAN_BIG, 110 | .bits_per_pixel = EXAMPLE_LCD_COLOR_BITS, 111 | // .flags = { 112 | // .reset_active_high = 0, 113 | // }, 114 | .vendor_config = (void *) &vendor_config, 115 | }; 116 | esp_lcd_new_panel_spd2010(io_handle, &panel_config, &panel_handle); 117 | 118 | esp_lcd_panel_reset(panel_handle); 119 | esp_lcd_panel_init(panel_handle); 120 | // esp_lcd_panel_invert_color(panel_handle,false); 121 | 122 | esp_lcd_panel_disp_on_off(panel_handle, true); 123 | test_draw_bitmap(panel_handle); 124 | printf("spd2010 LCD OK\r\n"); 125 | return true; 126 | } 127 | 128 | void LCD_addWindow(uint16_t Xstart, uint16_t Ystart, uint16_t Xend, uint16_t Yend,uint16_t* color) 129 | { 130 | uint32_t size = (Xend - Xstart +1 ) * (Yend - Ystart + 1); 131 | for (size_t i = 0; i < size; i++) { 132 | color[i] = (((color[i] >> 8) & 0xFF) | ((color[i] << 8) & 0xFF00)); 133 | } 134 | 135 | Xend = Xend + 1; // esp_lcd_panel_draw_bitmap: x_end End index on x-axis (x_end not included) 136 | Yend = Yend + 1; // esp_lcd_panel_draw_bitmap: y_end End index on y-axis (y_end not included) 137 | if (Xend > EXAMPLE_LCD_WIDTH) 138 | Xend = EXAMPLE_LCD_WIDTH; 139 | if (Yend > EXAMPLE_LCD_HEIGHT) 140 | Yend = EXAMPLE_LCD_HEIGHT; 141 | 142 | // printf("Xstart = %d Ystart = %d Xend = %d Yend = %d \r\n",Xstart, Ystart, Xend, Yend); 143 | esp_lcd_panel_draw_bitmap(panel_handle, Xstart, Ystart, Xend, Yend, color); // x_end End index on x-axis (x_end not included) 144 | } 145 | 146 | 147 | 148 | // backlight 149 | void Backlight_Init() 150 | { 151 | ledcAttach(LCD_Backlight_PIN, Frequency, Resolution); // 设置通道 152 | ledcWrite(LCD_Backlight_PIN, Dutyfactor); // 设置亮度 153 | Set_Backlight(LCD_Backlight); //0~100 154 | } 155 | 156 | void Set_Backlight(uint8_t Light) // 157 | { 158 | if(Light > Backlight_MAX || Light < 0) 159 | printf("Set Backlight parameters in the range of 0 to 100 \r\n"); 160 | else{ 161 | uint32_t Backlight = Light*10; 162 | if(Backlight == 1000) 163 | Backlight = 1024; 164 | ledcWrite(LCD_Backlight_PIN, Backlight); 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /waveClock/waveClock.ino: -------------------------------------------------------------------------------- 1 | /*Using LVGL with Arduino requires some extra steps: 2 | *Be sure to read the docs here: https://docs.lvgl.io/master/get-started/platforms/arduino.html */ 3 | 4 | #include "Display_SPD2010.h" 5 | #include "RTC_PCF85063.h" 6 | #include "LVGL_Driver.h" 7 | //#include "PWR_Key.h" 8 | #include "RTC_PCF85063.h" 9 | #include "ui.h" 10 | 11 | #define BAT_ADC_PIN 8 12 | #define Measurement_offset 0.990476 13 | #define MIN_VOLTAGE 3.2 // Voltage when the battery is empty 14 | #define MAX_VOLTAGE 4.2 // Voltage when the battery is fully charged 15 | int brightness[5]={20,40,60,80,100}; 16 | int bright=1; 17 | 18 | String daysWeek[7]={"SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"}; 19 | 20 | int h,s,m,y,mm,d,dow=0; 21 | String hr,mi,se,da,mo,timeStr,dateStr,batStr,percentStr=""; 22 | float voltage,percent=0; 23 | 24 | int sethour,setminute,setmonth,setday,setyear,setdow; 25 | 26 | float BAT_Get_Volts(void) 27 | { 28 | int Volts = analogReadMilliVolts(BAT_ADC_PIN); // millivolts 29 | float BAT_analogVolts = (float)(Volts * 3.0 / 1000.0) / Measurement_offset; 30 | // printf("BAT voltage : %.2f V\r\n", BAT_analogVolts); 31 | return BAT_analogVolts; 32 | } 33 | 34 | 35 | float getBatteryPercentage(float voltage) { 36 | // Clamp the voltage to the range [MIN_VOLTAGE, MAX_VOLTAGE] 37 | if (voltage > MAX_VOLTAGE) voltage = MAX_VOLTAGE; 38 | if (voltage < MIN_VOLTAGE) voltage = MIN_VOLTAGE; 39 | 40 | // Calculate percentage 41 | float percentage = ((voltage - MIN_VOLTAGE) / (MAX_VOLTAGE - MIN_VOLTAGE)) * 100.0; 42 | return percentage; 43 | } 44 | 45 | 46 | void settTime(int y,int m,int d,int h,int mm,int s,int dow) 47 | {datetime_t tt; 48 | tt.year=y+2000; 49 | tt.month=m; 50 | tt.day=d; 51 | tt.hour=h; 52 | tt.minute=mm; 53 | tt.second=s; 54 | tt.dotw=dow; 55 | PCF85063_Set_All(tt); 56 | } 57 | 58 | void setup() 59 | { 60 | //Driver_Init(); 61 | pinMode(7,OUTPUT); 62 | digitalWrite(7,1); 63 | 64 | LCD_Init(); 65 | Backlight_Init(); 66 | Set_Backlight(40); 67 | I2C_Init(); 68 | TCA9554PWR_Init(0x00); 69 | PCF85063_Init(); 70 | 71 | Lvgl_Init(); 72 | ui_init(); 73 | 74 | } 75 | 76 | void cngBright(lv_event_t * e) 77 | { 78 | bright++; 79 | if(bright>4) bright=0; 80 | Set_Backlight(brightness[bright]); 81 | 82 | if(bright==0) 83 | { 84 | lv_obj_add_flag(ui_Panel8,LV_OBJ_FLAG_HIDDEN); 85 | lv_obj_add_flag(ui_Panel9,LV_OBJ_FLAG_HIDDEN); 86 | lv_obj_add_flag(ui_Panel10,LV_OBJ_FLAG_HIDDEN); 87 | lv_obj_add_flag(ui_Panel13,LV_OBJ_FLAG_HIDDEN); 88 | } 89 | if(bright==1) 90 | { 91 | lv_obj_clear_flag(ui_Panel8,LV_OBJ_FLAG_HIDDEN); 92 | lv_obj_add_flag(ui_Panel9,LV_OBJ_FLAG_HIDDEN); 93 | lv_obj_add_flag(ui_Panel10,LV_OBJ_FLAG_HIDDEN); 94 | lv_obj_add_flag(ui_Panel13,LV_OBJ_FLAG_HIDDEN); 95 | } 96 | 97 | if(bright==2) 98 | { 99 | lv_obj_clear_flag(ui_Panel8,LV_OBJ_FLAG_HIDDEN); 100 | lv_obj_clear_flag(ui_Panel9,LV_OBJ_FLAG_HIDDEN); 101 | lv_obj_add_flag(ui_Panel10,LV_OBJ_FLAG_HIDDEN); 102 | lv_obj_add_flag(ui_Panel13,LV_OBJ_FLAG_HIDDEN); 103 | } 104 | 105 | if(bright==3) 106 | { 107 | lv_obj_clear_flag(ui_Panel8,LV_OBJ_FLAG_HIDDEN); 108 | lv_obj_clear_flag(ui_Panel9,LV_OBJ_FLAG_HIDDEN); 109 | lv_obj_clear_flag(ui_Panel10,LV_OBJ_FLAG_HIDDEN); 110 | lv_obj_add_flag(ui_Panel13,LV_OBJ_FLAG_HIDDEN); 111 | } 112 | 113 | if(bright==4) 114 | { 115 | lv_obj_clear_flag(ui_Panel8,LV_OBJ_FLAG_HIDDEN); 116 | lv_obj_clear_flag(ui_Panel9,LV_OBJ_FLAG_HIDDEN); 117 | lv_obj_clear_flag(ui_Panel10,LV_OBJ_FLAG_HIDDEN); 118 | lv_obj_clear_flag(ui_Panel13,LV_OBJ_FLAG_HIDDEN); 119 | } 120 | 121 | 122 | } 123 | 124 | void prepareTime(lv_event_t * e) 125 | { 126 | sethour=h; 127 | setminute=m; 128 | setyear=25; 129 | setmonth=mm; 130 | setday=d; 131 | setdow=dow; 132 | } 133 | 134 | void choseTime(lv_event_t * e) 135 | { 136 | lv_obj_t * btn = lv_event_get_target(e); 137 | if(btn==ui_hrUp) 138 | {sethour++; if(sethour>23) sethour=0;} 139 | if(btn==ui_hrDown) 140 | {sethour--; if(sethour<0) sethour=23;} 141 | 142 | if(btn==ui_minDown) 143 | {setminute--; if(setminute<0) setminute=59;} 144 | if(btn==ui_minUp) 145 | {setminute++; if(setminute>59) setminute=0;} 146 | 147 | if(btn==ui_monthUP) 148 | {setmonth++; if(setmonth>12) setmonth=1;} 149 | if(btn==ui_monthDowm) 150 | {setmonth--; if(setmonth<1) setmonth=12;} 151 | 152 | if(btn==ui_dayUp) 153 | {setday++; if(setday>31) setday=1;} 154 | if(btn==ui_dayDown) 155 | {setday--; if(setday<1) setday=31;} 156 | 157 | if(btn==ui_yearUp) 158 | {setyear++; if(setyear>60) setyear=24;} 159 | if(btn==ui_yearDown) 160 | {setyear--; if(setyear<24) setyear=60;} 161 | 162 | if(btn==ui_dowUp) 163 | {dow++; if(dow>6) dow=0;} 164 | if(btn==ui_dowDown) 165 | {setdow--; if(setdow<0) setdow=0;} 166 | 167 | if(btn==ui_saveTime || btn==ui_saveDate ) 168 | { 169 | settTime(setyear,setmonth,setday,sethour,setminute,0,setdow); 170 | lv_scr_load(ui_Screen1); 171 | } 172 | 173 | } 174 | 175 | void loop() { 176 | 177 | if (lv_scr_act() == ui_Screen1) 178 | { 179 | PCF85063_Loop(); 180 | s=datetime.second; 181 | m=datetime.minute; 182 | h=datetime.hour; 183 | d=datetime.day; 184 | y=datetime.year; 185 | mm=datetime.month; 186 | dow=datetime.dotw; 187 | 188 | if(s<10) se="0"+String(s); else se=String(s); 189 | if(m<10) mi="0"+String(m); else mi=String(m); 190 | if(h<10) hr="0"+String(h); else hr=String(h); 191 | if(d<10) da="0"+String(d); else da=String(d); 192 | if(mm<10) mo="0"+String(mm); else mo=String(mm); 193 | timeStr=hr+":"+mi; 194 | dateStr=mo+"-"+da; 195 | 196 | voltage=BAT_Get_Volts(); 197 | percent=getBatteryPercentage(voltage); 198 | batStr=String(voltage)+ " V"; 199 | percentStr=String((int)percent)+"%"; 200 | 201 | lv_label_set_text(ui_timeLBL,timeStr.c_str()); 202 | lv_label_set_text(ui_secLBL,String(se).c_str()); 203 | lv_label_set_text(ui_dateLBL,dateStr.c_str()); 204 | lv_label_set_text(ui_dayLBL,daysWeek[dow].c_str()); 205 | lv_label_set_text(ui_batVoltage,batStr.c_str()); 206 | lv_label_set_text(ui_batPercent,percentStr.c_str()); 207 | lv_bar_set_value(ui_Bar1,(int)percent,LV_ANIM_OFF); 208 | } 209 | 210 | if (lv_scr_act() == ui_setTime) 211 | { 212 | lv_label_set_text(ui_setHrLBL, String(sethour).c_str()); 213 | lv_label_set_text(ui_setMinLBL, String(setminute).c_str()); 214 | } 215 | 216 | if (lv_scr_act() == ui_setDate) 217 | { 218 | lv_label_set_text(ui_setMonthLBL, String(setmonth).c_str()); 219 | lv_label_set_text(ui_setDayLBL, String(setday).c_str()); 220 | lv_label_set_text(ui_setYearLBL, String(setyear).c_str()); 221 | lv_label_set_text(ui_setDowLBL, String(setdow).c_str()); 222 | } 223 | 224 | 225 | 226 | lv_timer_handler(); 227 | vTaskDelay(pdMS_TO_TICKS(5)); 228 | 229 | } 230 | -------------------------------------------------------------------------------- /waveClock/RTC_PCF85063.cpp: -------------------------------------------------------------------------------- 1 | #include "RTC_PCF85063.h" 2 | 3 | datetime_t datetime= {0}; 4 | 5 | static uint8_t decToBcd(int val); 6 | static int bcdToDec(uint8_t val); 7 | 8 | const unsigned char MonthStr[12][4] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov","Dec"}; 9 | 10 | /****************************************************************************** 11 | function: PCF85063 initialized 12 | parameter: 13 | 14 | Info:Initiate Normal Mode, RTC Run, NO reset, No correction , 24hr format, Internal load capacitane 12.5pf 15 | ******************************************************************************/ 16 | void PCF85063_Init() 17 | { 18 | uint8_t Value = RTC_CTRL_1_DEFAULT|RTC_CTRL_1_CAP_SEL; 19 | 20 | I2C_Write(PCF85063_ADDRESS, RTC_CTRL_1_ADDR, &Value, 1); 21 | I2C_Read(PCF85063_ADDRESS, RTC_CTRL_1_ADDR, &Value, 1); 22 | if(Value & RTC_CTRL_1_STOP) 23 | printf("PCF85063 failed to be initialized.state :%d\r\n",Value); 24 | else 25 | printf("PCF85063 is running,state :%d\r\n",Value); 26 | 27 | // datetime_t Now_datetime= {0}; 28 | // Now_datetime.year = 2024; 29 | // Now_datetime.month = 9; 30 | // Now_datetime.day = 20; 31 | // Now_datetime.dotw = 5; 32 | // Now_datetime.hour = 9; 33 | // Now_datetime.minute = 50; 34 | // Now_datetime.second = 0; 35 | // PCF85063_Set_All(Now_datetime); 36 | } 37 | 38 | void PCF85063_Loop(void) 39 | { 40 | PCF85063_Read_Time(&datetime); 41 | } 42 | /****************************************************************************** 43 | function: Reset PCF85063 44 | parameter: 45 | Info: 46 | ******************************************************************************/ 47 | void PCF85063_Reset() 48 | { 49 | uint8_t Value = RTC_CTRL_1_DEFAULT|RTC_CTRL_1_CAP_SEL|RTC_CTRL_1_SR; 50 | esp_err_t ret = I2C_Write(PCF85063_ADDRESS, RTC_CTRL_1_ADDR, &Value, 1); 51 | if(ret != ESP_OK) 52 | printf("PCF85063 : Reset failure\r\n"); 53 | } 54 | /****************************************************************************** 55 | function: Set Time 56 | parameter: 57 | Info: 58 | ******************************************************************************/ 59 | void PCF85063_Set_Time(datetime_t time) 60 | { 61 | uint8_t buf[3] = {decToBcd(time.second), 62 | decToBcd(time.minute), 63 | decToBcd(time.hour)}; 64 | esp_err_t ret = I2C_Write(PCF85063_ADDRESS, RTC_SECOND_ADDR, buf, sizeof(buf)); 65 | if(ret != ESP_OK) 66 | printf("PCF85063 : Time setting failure\r\n"); 67 | } 68 | 69 | /****************************************************************************** 70 | function: Set Date 71 | parameter: 72 | Info: 73 | ******************************************************************************/ 74 | void PCF85063_Set_Date(datetime_t date) 75 | { 76 | uint8_t buf[4] = {decToBcd(date.day), 77 | decToBcd(date.dotw), 78 | decToBcd(date.month), 79 | decToBcd(date.year - YEAR_OFFSET)}; 80 | esp_err_t ret = I2C_Write(PCF85063_ADDRESS, RTC_DAY_ADDR, buf, sizeof(buf)); 81 | if(ret != ESP_OK) 82 | printf("PCF85063 : Date setting failed\r\n"); 83 | } 84 | 85 | /****************************************************************************** 86 | function: Set Time And Date 87 | parameter: 88 | Info: 89 | ******************************************************************************/ 90 | void PCF85063_Set_All(datetime_t time) 91 | { 92 | uint8_t buf[7] = {decToBcd(time.second), 93 | decToBcd(time.minute), 94 | decToBcd(time.hour), 95 | decToBcd(time.day), 96 | decToBcd(time.dotw), 97 | decToBcd(time.month), 98 | decToBcd(time.year - YEAR_OFFSET)}; 99 | esp_err_t ret = I2C_Write(PCF85063_ADDRESS, RTC_SECOND_ADDR, buf, sizeof(buf)); 100 | if(ret != ESP_OK) 101 | printf("PCF85063 : Failed to set the date and time\r\n"); 102 | } 103 | 104 | /****************************************************************************** 105 | function: Read Time And Date 106 | parameter: 107 | Info: 108 | ******************************************************************************/ 109 | void PCF85063_Read_Time(datetime_t *time) 110 | { 111 | uint8_t buf[7] = {0}; 112 | esp_err_t ret = I2C_Read(PCF85063_ADDRESS, RTC_SECOND_ADDR, buf, sizeof(buf)); 113 | if(ret != ESP_OK) 114 | printf("PCF85063 : Time read failure\r\n"); 115 | else{ 116 | time->second = bcdToDec(buf[0] & 0x7F); 117 | time->minute = bcdToDec(buf[1] & 0x7F); 118 | time->hour = bcdToDec(buf[2] & 0x3F); 119 | time->day = bcdToDec(buf[3] & 0x3F); 120 | time->dotw = bcdToDec(buf[4] & 0x07); 121 | time->month = bcdToDec(buf[5] & 0x1F); 122 | time->year = bcdToDec(buf[6]) + YEAR_OFFSET; 123 | } 124 | } 125 | 126 | /****************************************************************************** 127 | function: Enable Alarm and Clear Alarm flag 128 | parameter: 129 | Info: 130 | ******************************************************************************/ 131 | void PCF85063_Enable_Alarm() 132 | { 133 | uint8_t Value = RTC_CTRL_2_DEFAULT | RTC_CTRL_2_AIE; 134 | Value &= ~RTC_CTRL_2_AF; 135 | esp_err_t ret = I2C_Write(PCF85063_ADDRESS, RTC_CTRL_2_ADDR, &Value, 1); 136 | if(ret != ESP_OK) 137 | printf("PCF85063 : Failed to enable Alarm Flag and Clear Alarm Flag \r\n"); 138 | } 139 | 140 | /****************************************************************************** 141 | function: Get Alarm flag 142 | parameter: 143 | Info: 144 | ******************************************************************************/ 145 | uint8_t PCF85063_Get_Alarm_Flag() 146 | { 147 | uint8_t Value = 0; 148 | esp_err_t ret = I2C_Read(PCF85063_ADDRESS, RTC_CTRL_2_ADDR, &Value, 1); 149 | if(ret != ESP_OK) 150 | printf("PCF85063 : Failed to obtain a warning flag.\r\n"); 151 | else 152 | Value &= RTC_CTRL_2_AF | RTC_CTRL_2_AIE; 153 | //printf("Value = 0x%x",Value); 154 | return Value; 155 | } 156 | 157 | /****************************************************************************** 158 | function: Set Alarm 159 | parameter: 160 | Info: 161 | ******************************************************************************/ 162 | void PCF85063_Set_Alarm(datetime_t time) 163 | { 164 | 165 | uint8_t buf[5] ={ 166 | decToBcd(time.second)&(~RTC_ALARM), 167 | decToBcd(time.minute)&(~RTC_ALARM), 168 | decToBcd(time.hour)&(~RTC_ALARM), 169 | //decToBcd(time.day)&(~RTC_ALARM), 170 | //decToBcd(time.dotw)&(~RTC_ALARM) 171 | RTC_ALARM, //disalbe day 172 | RTC_ALARM //disalbe weekday 173 | }; 174 | esp_err_t ret = I2C_Write(PCF85063_ADDRESS, RTC_SECOND_ALARM, buf, sizeof(buf)); 175 | if(ret != ESP_OK) 176 | printf("PCF85063 : Failed to set alarm flag\r\n"); 177 | } 178 | 179 | /****************************************************************************** 180 | function: Read Alarm 181 | parameter: 182 | Info: 183 | ******************************************************************************/ 184 | void PCF85063_Read_Alarm(datetime_t *time) 185 | { 186 | uint8_t buf[5] = {0}; 187 | esp_err_t ret = I2C_Read(PCF85063_ADDRESS, RTC_SECOND_ALARM, buf, sizeof(buf)); 188 | if(ret != ESP_OK) 189 | printf("PCF85063 : Failed to read the alarm sign\r\n"); 190 | else{ 191 | time->second = bcdToDec(buf[0] & 0x7F); 192 | time->minute = bcdToDec(buf[1] & 0x7F); 193 | time->hour = bcdToDec(buf[2] & 0x3F); 194 | time->day = bcdToDec(buf[3] & 0x3F); 195 | time->dotw = bcdToDec(buf[4] & 0x07); 196 | } 197 | } 198 | 199 | 200 | /****************************************************************************** 201 | function: Convert normal decimal numbers to binary coded decimal 202 | parameter: 203 | Info: 204 | ******************************************************************************/ 205 | static uint8_t decToBcd(int val) 206 | { 207 | return (uint8_t)((val / 10 * 16) + (val % 10)); 208 | } 209 | 210 | /****************************************************************************** 211 | function: Convert binary coded decimal to normal decimal numbers 212 | parameter: 213 | Info: 214 | ******************************************************************************/ 215 | static int bcdToDec(uint8_t val) 216 | { 217 | return (int)((val / 16 * 10) + (val % 16)); 218 | } 219 | 220 | /****************************************************************************** 221 | function: 222 | parameter: 223 | Info: 224 | ******************************************************************************/ 225 | void datetime_to_str(char *datetime_str,datetime_t time) 226 | { 227 | sprintf(datetime_str, " %d.%d.%d %d %d:%d:%d ", time.year, time.month, 228 | time.day, time.dotw, time.hour, time.minute, time.second); 229 | } -------------------------------------------------------------------------------- /waveClock/ui_helpers.c: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.3.4 3 | // LVGL version: 8.3.6 4 | // Project name: 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 | void _ui_dropdown_set_property(lv_obj_t * target, int id, int val) 23 | { 24 | if(id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val); 25 | } 26 | 27 | void _ui_image_set_property(lv_obj_t * target, int id, uint8_t * val) 28 | { 29 | if(id == _UI_IMAGE_PROPERTY_IMAGE) lv_img_set_src(target, val); 30 | } 31 | 32 | void _ui_label_set_property(lv_obj_t * target, int id, const char * val) 33 | { 34 | if(id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val); 35 | } 36 | 37 | void _ui_roller_set_property(lv_obj_t * target, int id, int val) 38 | { 39 | if(id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON); 40 | if(id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF); 41 | } 42 | 43 | void _ui_slider_set_property(lv_obj_t * target, int id, int val) 44 | { 45 | if(id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON); 46 | if(id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF); 47 | } 48 | 49 | void _ui_screen_change(lv_obj_t ** target, lv_scr_load_anim_t fademode, int spd, int delay, void (*target_init)(void)) 50 | { 51 | if(*target == NULL) 52 | target_init(); 53 | lv_scr_load_anim(*target, fademode, spd, delay, false); 54 | } 55 | 56 | void _ui_screen_delete(lv_obj_t ** target) 57 | { 58 | if(*target == NULL) { 59 | lv_obj_del(*target); 60 | target = NULL; 61 | } 62 | } 63 | 64 | void _ui_arc_increment(lv_obj_t * target, int val) 65 | { 66 | int old = lv_arc_get_value(target); 67 | lv_arc_set_value(target, old + val); 68 | lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0); 69 | } 70 | 71 | void _ui_bar_increment(lv_obj_t * target, int val, int anm) 72 | { 73 | int old = lv_bar_get_value(target); 74 | lv_bar_set_value(target, old + val, anm); 75 | } 76 | 77 | void _ui_slider_increment(lv_obj_t * target, int val, int anm) 78 | { 79 | int old = lv_slider_get_value(target); 80 | lv_slider_set_value(target, old + val, anm); 81 | lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0); 82 | } 83 | 84 | void _ui_keyboard_set_target(lv_obj_t * keyboard, lv_obj_t * textarea) 85 | { 86 | lv_keyboard_set_textarea(keyboard, textarea); 87 | } 88 | 89 | void _ui_flag_modify(lv_obj_t * target, int32_t flag, int value) 90 | { 91 | if(value == _UI_MODIFY_FLAG_TOGGLE) { 92 | if(lv_obj_has_flag(target, flag)) lv_obj_clear_flag(target, flag); 93 | else lv_obj_add_flag(target, flag); 94 | } 95 | else if(value == _UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target, flag); 96 | else lv_obj_clear_flag(target, flag); 97 | } 98 | void _ui_state_modify(lv_obj_t * target, int32_t state, int value) 99 | { 100 | if(value == _UI_MODIFY_STATE_TOGGLE) { 101 | if(lv_obj_has_state(target, state)) lv_obj_clear_state(target, state); 102 | else lv_obj_add_state(target, state); 103 | } 104 | else if(value == _UI_MODIFY_STATE_ADD) lv_obj_add_state(target, state); 105 | else lv_obj_clear_state(target, state); 106 | } 107 | 108 | void scr_unloaded_delete_cb(lv_event_t * e) 109 | { 110 | lv_obj_t ** var = lv_event_get_user_data(e); 111 | lv_obj_del(*var); 112 | (*var) = NULL; 113 | } 114 | 115 | void _ui_opacity_set(lv_obj_t * target, int val) 116 | { 117 | lv_obj_set_style_opa(target, val, 0); 118 | } 119 | 120 | void _ui_anim_callback_free_user_data(lv_anim_t * a) 121 | { 122 | lv_mem_free(a->user_data); 123 | a->user_data = NULL; 124 | } 125 | 126 | void _ui_anim_callback_set_x(lv_anim_t * a, int32_t v) 127 | { 128 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 129 | lv_obj_set_x(usr->target, v); 130 | } 131 | 132 | void _ui_anim_callback_set_y(lv_anim_t * a, int32_t v) 133 | { 134 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 135 | lv_obj_set_y(usr->target, v); 136 | } 137 | 138 | void _ui_anim_callback_set_width(lv_anim_t * a, int32_t v) 139 | { 140 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 141 | lv_obj_set_width(usr->target, v); 142 | } 143 | 144 | void _ui_anim_callback_set_height(lv_anim_t * a, int32_t v) 145 | { 146 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 147 | lv_obj_set_height(usr->target, v); 148 | } 149 | 150 | void _ui_anim_callback_set_opacity(lv_anim_t * a, int32_t v) 151 | { 152 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 153 | lv_obj_set_style_opa(usr->target, v, 0); 154 | } 155 | 156 | void _ui_anim_callback_set_image_zoom(lv_anim_t * a, int32_t v) 157 | { 158 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 159 | lv_img_set_zoom(usr->target, v); 160 | } 161 | 162 | void _ui_anim_callback_set_image_angle(lv_anim_t * a, int32_t v) 163 | { 164 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 165 | lv_img_set_angle(usr->target, v); 166 | } 167 | 168 | void _ui_anim_callback_set_image_frame(lv_anim_t * a, int32_t v) 169 | { 170 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 171 | usr->val = v; 172 | if(v < 0) v = 0; 173 | if(v >= usr->imgset_size) v = usr->imgset_size - 1; 174 | lv_img_set_src(usr->target, usr->imgset[v]); 175 | } 176 | 177 | int32_t _ui_anim_callback_get_x(lv_anim_t * a) 178 | { 179 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 180 | return lv_obj_get_x_aligned(usr->target); 181 | } 182 | 183 | int32_t _ui_anim_callback_get_y(lv_anim_t * a) 184 | { 185 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 186 | return lv_obj_get_y_aligned(usr->target); 187 | } 188 | 189 | int32_t _ui_anim_callback_get_width(lv_anim_t * a) 190 | { 191 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 192 | return lv_obj_get_width(usr->target); 193 | } 194 | 195 | int32_t _ui_anim_callback_get_height(lv_anim_t * a) 196 | { 197 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 198 | return lv_obj_get_height(usr->target); 199 | } 200 | 201 | int32_t _ui_anim_callback_get_opacity(lv_anim_t * a) 202 | { 203 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 204 | return lv_obj_get_style_opa(usr->target, 0); 205 | } 206 | 207 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t * a) 208 | { 209 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 210 | return lv_img_get_zoom(usr->target); 211 | } 212 | 213 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t * a) 214 | { 215 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 216 | return lv_img_get_angle(usr->target); 217 | } 218 | 219 | int32_t _ui_anim_callback_get_image_frame(lv_anim_t * a) 220 | { 221 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 222 | return usr->val; 223 | } 224 | 225 | void _ui_arc_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix) 226 | { 227 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 228 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix); 229 | lv_label_set_text(trg, buf); 230 | } 231 | 232 | void _ui_slider_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix) 233 | { 234 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 235 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix); 236 | lv_label_set_text(trg, buf); 237 | } 238 | void _ui_checked_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * txt_on, const char * txt_off) 239 | { 240 | if(lv_obj_has_state(src, LV_STATE_CHECKED)) lv_label_set_text(trg, txt_on); 241 | else lv_label_set_text(trg, txt_off); 242 | } 243 | 244 | void _ui_spinbox_step(lv_obj_t * target, int val) 245 | { 246 | if(val > 0) lv_spinbox_increment(target); 247 | else lv_spinbox_decrement(target); 248 | 249 | lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0); 250 | } 251 | 252 | -------------------------------------------------------------------------------- /waveClock/UI/ui_helpers.c: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.3.4 3 | // LVGL version: 8.3.6 4 | // Project name: 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 | void _ui_dropdown_set_property(lv_obj_t * target, int id, int val) 23 | { 24 | if(id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val); 25 | } 26 | 27 | void _ui_image_set_property(lv_obj_t * target, int id, uint8_t * val) 28 | { 29 | if(id == _UI_IMAGE_PROPERTY_IMAGE) lv_img_set_src(target, val); 30 | } 31 | 32 | void _ui_label_set_property(lv_obj_t * target, int id, const char * val) 33 | { 34 | if(id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val); 35 | } 36 | 37 | void _ui_roller_set_property(lv_obj_t * target, int id, int val) 38 | { 39 | if(id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON); 40 | if(id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF); 41 | } 42 | 43 | void _ui_slider_set_property(lv_obj_t * target, int id, int val) 44 | { 45 | if(id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON); 46 | if(id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF); 47 | } 48 | 49 | void _ui_screen_change(lv_obj_t ** target, lv_scr_load_anim_t fademode, int spd, int delay, void (*target_init)(void)) 50 | { 51 | if(*target == NULL) 52 | target_init(); 53 | lv_scr_load_anim(*target, fademode, spd, delay, false); 54 | } 55 | 56 | void _ui_screen_delete(lv_obj_t ** target) 57 | { 58 | if(*target == NULL) { 59 | lv_obj_del(*target); 60 | target = NULL; 61 | } 62 | } 63 | 64 | void _ui_arc_increment(lv_obj_t * target, int val) 65 | { 66 | int old = lv_arc_get_value(target); 67 | lv_arc_set_value(target, old + val); 68 | lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0); 69 | } 70 | 71 | void _ui_bar_increment(lv_obj_t * target, int val, int anm) 72 | { 73 | int old = lv_bar_get_value(target); 74 | lv_bar_set_value(target, old + val, anm); 75 | } 76 | 77 | void _ui_slider_increment(lv_obj_t * target, int val, int anm) 78 | { 79 | int old = lv_slider_get_value(target); 80 | lv_slider_set_value(target, old + val, anm); 81 | lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0); 82 | } 83 | 84 | void _ui_keyboard_set_target(lv_obj_t * keyboard, lv_obj_t * textarea) 85 | { 86 | lv_keyboard_set_textarea(keyboard, textarea); 87 | } 88 | 89 | void _ui_flag_modify(lv_obj_t * target, int32_t flag, int value) 90 | { 91 | if(value == _UI_MODIFY_FLAG_TOGGLE) { 92 | if(lv_obj_has_flag(target, flag)) lv_obj_clear_flag(target, flag); 93 | else lv_obj_add_flag(target, flag); 94 | } 95 | else if(value == _UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target, flag); 96 | else lv_obj_clear_flag(target, flag); 97 | } 98 | void _ui_state_modify(lv_obj_t * target, int32_t state, int value) 99 | { 100 | if(value == _UI_MODIFY_STATE_TOGGLE) { 101 | if(lv_obj_has_state(target, state)) lv_obj_clear_state(target, state); 102 | else lv_obj_add_state(target, state); 103 | } 104 | else if(value == _UI_MODIFY_STATE_ADD) lv_obj_add_state(target, state); 105 | else lv_obj_clear_state(target, state); 106 | } 107 | 108 | void scr_unloaded_delete_cb(lv_event_t * e) 109 | { 110 | lv_obj_t ** var = lv_event_get_user_data(e); 111 | lv_obj_del(*var); 112 | (*var) = NULL; 113 | } 114 | 115 | void _ui_opacity_set(lv_obj_t * target, int val) 116 | { 117 | lv_obj_set_style_opa(target, val, 0); 118 | } 119 | 120 | void _ui_anim_callback_free_user_data(lv_anim_t * a) 121 | { 122 | lv_mem_free(a->user_data); 123 | a->user_data = NULL; 124 | } 125 | 126 | void _ui_anim_callback_set_x(lv_anim_t * a, int32_t v) 127 | { 128 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 129 | lv_obj_set_x(usr->target, v); 130 | } 131 | 132 | void _ui_anim_callback_set_y(lv_anim_t * a, int32_t v) 133 | { 134 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 135 | lv_obj_set_y(usr->target, v); 136 | } 137 | 138 | void _ui_anim_callback_set_width(lv_anim_t * a, int32_t v) 139 | { 140 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 141 | lv_obj_set_width(usr->target, v); 142 | } 143 | 144 | void _ui_anim_callback_set_height(lv_anim_t * a, int32_t v) 145 | { 146 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 147 | lv_obj_set_height(usr->target, v); 148 | } 149 | 150 | void _ui_anim_callback_set_opacity(lv_anim_t * a, int32_t v) 151 | { 152 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 153 | lv_obj_set_style_opa(usr->target, v, 0); 154 | } 155 | 156 | void _ui_anim_callback_set_image_zoom(lv_anim_t * a, int32_t v) 157 | { 158 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 159 | lv_img_set_zoom(usr->target, v); 160 | } 161 | 162 | void _ui_anim_callback_set_image_angle(lv_anim_t * a, int32_t v) 163 | { 164 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 165 | lv_img_set_angle(usr->target, v); 166 | } 167 | 168 | void _ui_anim_callback_set_image_frame(lv_anim_t * a, int32_t v) 169 | { 170 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 171 | usr->val = v; 172 | if(v < 0) v = 0; 173 | if(v >= usr->imgset_size) v = usr->imgset_size - 1; 174 | lv_img_set_src(usr->target, usr->imgset[v]); 175 | } 176 | 177 | int32_t _ui_anim_callback_get_x(lv_anim_t * a) 178 | { 179 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 180 | return lv_obj_get_x_aligned(usr->target); 181 | } 182 | 183 | int32_t _ui_anim_callback_get_y(lv_anim_t * a) 184 | { 185 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 186 | return lv_obj_get_y_aligned(usr->target); 187 | } 188 | 189 | int32_t _ui_anim_callback_get_width(lv_anim_t * a) 190 | { 191 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 192 | return lv_obj_get_width(usr->target); 193 | } 194 | 195 | int32_t _ui_anim_callback_get_height(lv_anim_t * a) 196 | { 197 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 198 | return lv_obj_get_height(usr->target); 199 | } 200 | 201 | int32_t _ui_anim_callback_get_opacity(lv_anim_t * a) 202 | { 203 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 204 | return lv_obj_get_style_opa(usr->target, 0); 205 | } 206 | 207 | int32_t _ui_anim_callback_get_image_zoom(lv_anim_t * a) 208 | { 209 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 210 | return lv_img_get_zoom(usr->target); 211 | } 212 | 213 | int32_t _ui_anim_callback_get_image_angle(lv_anim_t * a) 214 | { 215 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 216 | return lv_img_get_angle(usr->target); 217 | } 218 | 219 | int32_t _ui_anim_callback_get_image_frame(lv_anim_t * a) 220 | { 221 | ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data; 222 | return usr->val; 223 | } 224 | 225 | void _ui_arc_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix) 226 | { 227 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 228 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix); 229 | lv_label_set_text(trg, buf); 230 | } 231 | 232 | void _ui_slider_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix) 233 | { 234 | char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE]; 235 | lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix); 236 | lv_label_set_text(trg, buf); 237 | } 238 | void _ui_checked_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * txt_on, const char * txt_off) 239 | { 240 | if(lv_obj_has_state(src, LV_STATE_CHECKED)) lv_label_set_text(trg, txt_on); 241 | else lv_label_set_text(trg, txt_off); 242 | } 243 | 244 | void _ui_spinbox_step(lv_obj_t * target, int val) 245 | { 246 | if(val > 0) lv_spinbox_increment(target); 247 | else lv_spinbox_decrement(target); 248 | 249 | lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0); 250 | } 251 | 252 | -------------------------------------------------------------------------------- /waveClock/UI/ui_setTime.c: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.3.4 3 | // LVGL version: 8.3.6 4 | // Project name: SquareLine_Project 5 | 6 | #include "ui.h" 7 | 8 | void ui_setTime_screen_init(void) 9 | { 10 | ui_setTime = lv_obj_create(NULL); 11 | lv_obj_clear_flag(ui_setTime, LV_OBJ_FLAG_SCROLLABLE); /// Flags 12 | lv_obj_set_style_bg_color(ui_setTime, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 13 | lv_obj_set_style_bg_opa(ui_setTime, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 14 | 15 | ui_hrUp = lv_obj_create(ui_setTime); 16 | lv_obj_set_width(ui_hrUp, 100); 17 | lv_obj_set_height(ui_hrUp, 50); 18 | lv_obj_set_x(ui_hrUp, -65); 19 | lv_obj_set_y(ui_hrUp, -76); 20 | lv_obj_set_align(ui_hrUp, LV_ALIGN_CENTER); 21 | lv_obj_clear_flag(ui_hrUp, LV_OBJ_FLAG_SCROLLABLE); /// Flags 22 | lv_obj_set_style_radius(ui_hrUp, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 23 | lv_obj_set_style_bg_color(ui_hrUp, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 24 | lv_obj_set_style_bg_opa(ui_hrUp, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 25 | lv_obj_set_style_border_width(ui_hrUp, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 26 | 27 | ui_Label20 = lv_label_create(ui_hrUp); 28 | lv_obj_set_width(ui_Label20, LV_SIZE_CONTENT); /// 1 29 | lv_obj_set_height(ui_Label20, LV_SIZE_CONTENT); /// 1 30 | lv_obj_set_align(ui_Label20, LV_ALIGN_CENTER); 31 | lv_label_set_text(ui_Label20, "+"); 32 | lv_obj_set_style_text_color(ui_Label20, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 33 | lv_obj_set_style_text_opa(ui_Label20, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 34 | lv_obj_set_style_text_font(ui_Label20, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 35 | 36 | ui_Button6 = lv_btn_create(ui_setTime); 37 | lv_obj_set_width(ui_Button6, 169); 38 | lv_obj_set_height(ui_Button6, 58); 39 | lv_obj_set_x(ui_Button6, 0); 40 | lv_obj_set_y(ui_Button6, 149); 41 | lv_obj_set_align(ui_Button6, LV_ALIGN_CENTER); 42 | lv_obj_add_flag(ui_Button6, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags 43 | lv_obj_clear_flag(ui_Button6, LV_OBJ_FLAG_SCROLLABLE); /// Flags 44 | lv_obj_set_style_bg_color(ui_Button6, lv_color_hex(0x292831), LV_PART_MAIN | LV_STATE_DEFAULT); 45 | lv_obj_set_style_bg_opa(ui_Button6, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 46 | lv_obj_set_style_border_width(ui_Button6, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 47 | 48 | ui_Label14 = lv_label_create(ui_Button6); 49 | lv_obj_set_width(ui_Label14, LV_SIZE_CONTENT); /// 1 50 | lv_obj_set_height(ui_Label14, LV_SIZE_CONTENT); /// 1 51 | lv_obj_set_align(ui_Label14, LV_ALIGN_CENTER); 52 | lv_label_set_text(ui_Label14, "HOME"); 53 | lv_obj_set_style_text_color(ui_Label14, lv_color_hex(0xB8C8D5), LV_PART_MAIN | LV_STATE_DEFAULT); 54 | lv_obj_set_style_text_opa(ui_Label14, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 55 | lv_obj_set_style_text_font(ui_Label14, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 56 | 57 | ui_minUp = lv_obj_create(ui_setTime); 58 | lv_obj_set_width(ui_minUp, 100); 59 | lv_obj_set_height(ui_minUp, 50); 60 | lv_obj_set_x(ui_minUp, 65); 61 | lv_obj_set_y(ui_minUp, -76); 62 | lv_obj_set_align(ui_minUp, LV_ALIGN_CENTER); 63 | lv_obj_clear_flag(ui_minUp, LV_OBJ_FLAG_SCROLLABLE); /// Flags 64 | lv_obj_set_style_radius(ui_minUp, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 65 | lv_obj_set_style_bg_color(ui_minUp, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 66 | lv_obj_set_style_bg_opa(ui_minUp, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 67 | lv_obj_set_style_border_width(ui_minUp, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 68 | 69 | ui_Label21 = lv_label_create(ui_minUp); 70 | lv_obj_set_width(ui_Label21, LV_SIZE_CONTENT); /// 1 71 | lv_obj_set_height(ui_Label21, LV_SIZE_CONTENT); /// 1 72 | lv_obj_set_align(ui_Label21, LV_ALIGN_CENTER); 73 | lv_label_set_text(ui_Label21, "+"); 74 | lv_obj_set_style_text_color(ui_Label21, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 75 | lv_obj_set_style_text_opa(ui_Label21, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 76 | lv_obj_set_style_text_font(ui_Label21, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 77 | 78 | ui_hrDown = lv_obj_create(ui_setTime); 79 | lv_obj_set_width(ui_hrDown, 100); 80 | lv_obj_set_height(ui_hrDown, 50); 81 | lv_obj_set_x(ui_hrDown, -65); 82 | lv_obj_set_y(ui_hrDown, 67); 83 | lv_obj_set_align(ui_hrDown, LV_ALIGN_CENTER); 84 | lv_obj_clear_flag(ui_hrDown, LV_OBJ_FLAG_SCROLLABLE); /// Flags 85 | lv_obj_set_style_radius(ui_hrDown, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 86 | lv_obj_set_style_bg_color(ui_hrDown, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 87 | lv_obj_set_style_bg_opa(ui_hrDown, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 88 | lv_obj_set_style_border_width(ui_hrDown, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 89 | 90 | ui_Label22 = lv_label_create(ui_hrDown); 91 | lv_obj_set_width(ui_Label22, LV_SIZE_CONTENT); /// 1 92 | lv_obj_set_height(ui_Label22, LV_SIZE_CONTENT); /// 1 93 | lv_obj_set_align(ui_Label22, LV_ALIGN_CENTER); 94 | lv_label_set_text(ui_Label22, "-"); 95 | lv_obj_set_style_text_color(ui_Label22, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 96 | lv_obj_set_style_text_opa(ui_Label22, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 97 | lv_obj_set_style_text_font(ui_Label22, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 98 | 99 | ui_minDown = lv_obj_create(ui_setTime); 100 | lv_obj_set_width(ui_minDown, 100); 101 | lv_obj_set_height(ui_minDown, 50); 102 | lv_obj_set_x(ui_minDown, 65); 103 | lv_obj_set_y(ui_minDown, 67); 104 | lv_obj_set_align(ui_minDown, LV_ALIGN_CENTER); 105 | lv_obj_clear_flag(ui_minDown, LV_OBJ_FLAG_SCROLLABLE); /// Flags 106 | lv_obj_set_style_radius(ui_minDown, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 107 | lv_obj_set_style_bg_color(ui_minDown, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 108 | lv_obj_set_style_bg_opa(ui_minDown, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 109 | lv_obj_set_style_border_width(ui_minDown, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 110 | 111 | ui_Label23 = lv_label_create(ui_minDown); 112 | lv_obj_set_width(ui_Label23, LV_SIZE_CONTENT); /// 1 113 | lv_obj_set_height(ui_Label23, LV_SIZE_CONTENT); /// 1 114 | lv_obj_set_align(ui_Label23, LV_ALIGN_CENTER); 115 | lv_label_set_text(ui_Label23, "-"); 116 | lv_obj_set_style_text_color(ui_Label23, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 117 | lv_obj_set_style_text_opa(ui_Label23, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 118 | lv_obj_set_style_text_font(ui_Label23, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 119 | 120 | ui_saveTime = lv_obj_create(ui_setTime); 121 | lv_obj_set_width(ui_saveTime, 139); 122 | lv_obj_set_height(ui_saveTime, 50); 123 | lv_obj_set_x(ui_saveTime, -4); 124 | lv_obj_set_y(ui_saveTime, -144); 125 | lv_obj_set_align(ui_saveTime, LV_ALIGN_CENTER); 126 | lv_obj_clear_flag(ui_saveTime, LV_OBJ_FLAG_SCROLLABLE); /// Flags 127 | lv_obj_set_style_radius(ui_saveTime, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 128 | lv_obj_set_style_bg_color(ui_saveTime, lv_color_hex(0xE1109F), LV_PART_MAIN | LV_STATE_DEFAULT); 129 | lv_obj_set_style_bg_opa(ui_saveTime, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 130 | lv_obj_set_style_border_width(ui_saveTime, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 131 | 132 | ui_Label24 = lv_label_create(ui_saveTime); 133 | lv_obj_set_width(ui_Label24, LV_SIZE_CONTENT); /// 1 134 | lv_obj_set_height(ui_Label24, LV_SIZE_CONTENT); /// 1 135 | lv_obj_set_align(ui_Label24, LV_ALIGN_CENTER); 136 | lv_label_set_text(ui_Label24, "SAVE"); 137 | lv_obj_set_style_text_color(ui_Label24, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 138 | lv_obj_set_style_text_opa(ui_Label24, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 139 | lv_obj_set_style_text_font(ui_Label24, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 140 | 141 | ui_setHrLBL = lv_label_create(ui_setTime); 142 | lv_obj_set_width(ui_setHrLBL, LV_SIZE_CONTENT); /// 1 143 | lv_obj_set_height(ui_setHrLBL, LV_SIZE_CONTENT); /// 1 144 | lv_obj_set_x(ui_setHrLBL, -63); 145 | lv_obj_set_y(ui_setHrLBL, 5); 146 | lv_obj_set_align(ui_setHrLBL, LV_ALIGN_CENTER); 147 | lv_label_set_text(ui_setHrLBL, "25"); 148 | lv_obj_set_style_text_font(ui_setHrLBL, &ui_font_digits, LV_PART_MAIN | LV_STATE_DEFAULT); 149 | 150 | ui_setMinLBL = lv_label_create(ui_setTime); 151 | lv_obj_set_width(ui_setMinLBL, LV_SIZE_CONTENT); /// 1 152 | lv_obj_set_height(ui_setMinLBL, LV_SIZE_CONTENT); /// 1 153 | lv_obj_set_x(ui_setMinLBL, 68); 154 | lv_obj_set_y(ui_setMinLBL, 4); 155 | lv_obj_set_align(ui_setMinLBL, LV_ALIGN_CENTER); 156 | lv_label_set_text(ui_setMinLBL, "25"); 157 | lv_obj_set_style_text_font(ui_setMinLBL, &ui_font_digits, LV_PART_MAIN | LV_STATE_DEFAULT); 158 | 159 | ui_Panel16 = lv_obj_create(ui_setTime); 160 | lv_obj_set_width(ui_Panel16, 8); 161 | lv_obj_set_height(ui_Panel16, 8); 162 | lv_obj_set_align(ui_Panel16, LV_ALIGN_CENTER); 163 | lv_obj_clear_flag(ui_Panel16, LV_OBJ_FLAG_SCROLLABLE); /// Flags 164 | lv_obj_set_style_bg_color(ui_Panel16, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); 165 | lv_obj_set_style_bg_opa(ui_Panel16, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 166 | lv_obj_set_style_border_width(ui_Panel16, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 167 | 168 | ui_Panel24 = lv_obj_create(ui_setTime); 169 | lv_obj_set_width(ui_Panel24, 8); 170 | lv_obj_set_height(ui_Panel24, 8); 171 | lv_obj_set_x(ui_Panel24, 0); 172 | lv_obj_set_y(ui_Panel24, 18); 173 | lv_obj_set_align(ui_Panel24, LV_ALIGN_CENTER); 174 | lv_obj_clear_flag(ui_Panel24, LV_OBJ_FLAG_SCROLLABLE); /// Flags 175 | lv_obj_set_style_bg_color(ui_Panel24, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); 176 | lv_obj_set_style_bg_opa(ui_Panel24, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 177 | lv_obj_set_style_border_width(ui_Panel24, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 178 | 179 | lv_obj_add_event_cb(ui_hrUp, ui_event_hrUp, LV_EVENT_ALL, NULL); 180 | lv_obj_add_event_cb(ui_Button6, ui_event_Button6, LV_EVENT_ALL, NULL); 181 | lv_obj_add_event_cb(ui_minUp, ui_event_minUp, LV_EVENT_ALL, NULL); 182 | lv_obj_add_event_cb(ui_hrDown, ui_event_hrDown, LV_EVENT_ALL, NULL); 183 | lv_obj_add_event_cb(ui_minDown, ui_event_minDown, LV_EVENT_ALL, NULL); 184 | lv_obj_add_event_cb(ui_saveTime, ui_event_saveTime, LV_EVENT_ALL, NULL); 185 | 186 | } 187 | -------------------------------------------------------------------------------- /waveClock/ui_setTime.c: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.3.4 3 | // LVGL version: 8.3.6 4 | // Project name: SquareLine_Project 5 | 6 | #include "ui.h" 7 | 8 | void ui_setTime_screen_init(void) 9 | { 10 | ui_setTime = lv_obj_create(NULL); 11 | lv_obj_clear_flag(ui_setTime, LV_OBJ_FLAG_SCROLLABLE); /// Flags 12 | lv_obj_set_style_bg_color(ui_setTime, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 13 | lv_obj_set_style_bg_opa(ui_setTime, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 14 | 15 | ui_hrUp = lv_obj_create(ui_setTime); 16 | lv_obj_set_width(ui_hrUp, 100); 17 | lv_obj_set_height(ui_hrUp, 50); 18 | lv_obj_set_x(ui_hrUp, -65); 19 | lv_obj_set_y(ui_hrUp, -76); 20 | lv_obj_set_align(ui_hrUp, LV_ALIGN_CENTER); 21 | lv_obj_clear_flag(ui_hrUp, LV_OBJ_FLAG_SCROLLABLE); /// Flags 22 | lv_obj_set_style_radius(ui_hrUp, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 23 | lv_obj_set_style_bg_color(ui_hrUp, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 24 | lv_obj_set_style_bg_opa(ui_hrUp, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 25 | lv_obj_set_style_border_width(ui_hrUp, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 26 | 27 | ui_Label20 = lv_label_create(ui_hrUp); 28 | lv_obj_set_width(ui_Label20, LV_SIZE_CONTENT); /// 1 29 | lv_obj_set_height(ui_Label20, LV_SIZE_CONTENT); /// 1 30 | lv_obj_set_align(ui_Label20, LV_ALIGN_CENTER); 31 | lv_label_set_text(ui_Label20, "+"); 32 | lv_obj_set_style_text_color(ui_Label20, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 33 | lv_obj_set_style_text_opa(ui_Label20, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 34 | lv_obj_set_style_text_font(ui_Label20, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 35 | 36 | ui_Button6 = lv_btn_create(ui_setTime); 37 | lv_obj_set_width(ui_Button6, 169); 38 | lv_obj_set_height(ui_Button6, 58); 39 | lv_obj_set_x(ui_Button6, 0); 40 | lv_obj_set_y(ui_Button6, 149); 41 | lv_obj_set_align(ui_Button6, LV_ALIGN_CENTER); 42 | lv_obj_add_flag(ui_Button6, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags 43 | lv_obj_clear_flag(ui_Button6, LV_OBJ_FLAG_SCROLLABLE); /// Flags 44 | lv_obj_set_style_bg_color(ui_Button6, lv_color_hex(0x292831), LV_PART_MAIN | LV_STATE_DEFAULT); 45 | lv_obj_set_style_bg_opa(ui_Button6, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 46 | lv_obj_set_style_border_width(ui_Button6, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 47 | 48 | ui_Label14 = lv_label_create(ui_Button6); 49 | lv_obj_set_width(ui_Label14, LV_SIZE_CONTENT); /// 1 50 | lv_obj_set_height(ui_Label14, LV_SIZE_CONTENT); /// 1 51 | lv_obj_set_align(ui_Label14, LV_ALIGN_CENTER); 52 | lv_label_set_text(ui_Label14, "HOME"); 53 | lv_obj_set_style_text_color(ui_Label14, lv_color_hex(0xB8C8D5), LV_PART_MAIN | LV_STATE_DEFAULT); 54 | lv_obj_set_style_text_opa(ui_Label14, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 55 | lv_obj_set_style_text_font(ui_Label14, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 56 | 57 | ui_minUp = lv_obj_create(ui_setTime); 58 | lv_obj_set_width(ui_minUp, 100); 59 | lv_obj_set_height(ui_minUp, 50); 60 | lv_obj_set_x(ui_minUp, 65); 61 | lv_obj_set_y(ui_minUp, -76); 62 | lv_obj_set_align(ui_minUp, LV_ALIGN_CENTER); 63 | lv_obj_clear_flag(ui_minUp, LV_OBJ_FLAG_SCROLLABLE); /// Flags 64 | lv_obj_set_style_radius(ui_minUp, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 65 | lv_obj_set_style_bg_color(ui_minUp, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 66 | lv_obj_set_style_bg_opa(ui_minUp, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 67 | lv_obj_set_style_border_width(ui_minUp, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 68 | 69 | ui_Label21 = lv_label_create(ui_minUp); 70 | lv_obj_set_width(ui_Label21, LV_SIZE_CONTENT); /// 1 71 | lv_obj_set_height(ui_Label21, LV_SIZE_CONTENT); /// 1 72 | lv_obj_set_align(ui_Label21, LV_ALIGN_CENTER); 73 | lv_label_set_text(ui_Label21, "+"); 74 | lv_obj_set_style_text_color(ui_Label21, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 75 | lv_obj_set_style_text_opa(ui_Label21, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 76 | lv_obj_set_style_text_font(ui_Label21, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 77 | 78 | ui_hrDown = lv_obj_create(ui_setTime); 79 | lv_obj_set_width(ui_hrDown, 100); 80 | lv_obj_set_height(ui_hrDown, 50); 81 | lv_obj_set_x(ui_hrDown, -65); 82 | lv_obj_set_y(ui_hrDown, 67); 83 | lv_obj_set_align(ui_hrDown, LV_ALIGN_CENTER); 84 | lv_obj_clear_flag(ui_hrDown, LV_OBJ_FLAG_SCROLLABLE); /// Flags 85 | lv_obj_set_style_radius(ui_hrDown, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 86 | lv_obj_set_style_bg_color(ui_hrDown, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 87 | lv_obj_set_style_bg_opa(ui_hrDown, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 88 | lv_obj_set_style_border_width(ui_hrDown, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 89 | 90 | ui_Label22 = lv_label_create(ui_hrDown); 91 | lv_obj_set_width(ui_Label22, LV_SIZE_CONTENT); /// 1 92 | lv_obj_set_height(ui_Label22, LV_SIZE_CONTENT); /// 1 93 | lv_obj_set_align(ui_Label22, LV_ALIGN_CENTER); 94 | lv_label_set_text(ui_Label22, "-"); 95 | lv_obj_set_style_text_color(ui_Label22, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 96 | lv_obj_set_style_text_opa(ui_Label22, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 97 | lv_obj_set_style_text_font(ui_Label22, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 98 | 99 | ui_minDown = lv_obj_create(ui_setTime); 100 | lv_obj_set_width(ui_minDown, 100); 101 | lv_obj_set_height(ui_minDown, 50); 102 | lv_obj_set_x(ui_minDown, 65); 103 | lv_obj_set_y(ui_minDown, 67); 104 | lv_obj_set_align(ui_minDown, LV_ALIGN_CENTER); 105 | lv_obj_clear_flag(ui_minDown, LV_OBJ_FLAG_SCROLLABLE); /// Flags 106 | lv_obj_set_style_radius(ui_minDown, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 107 | lv_obj_set_style_bg_color(ui_minDown, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 108 | lv_obj_set_style_bg_opa(ui_minDown, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 109 | lv_obj_set_style_border_width(ui_minDown, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 110 | 111 | ui_Label23 = lv_label_create(ui_minDown); 112 | lv_obj_set_width(ui_Label23, LV_SIZE_CONTENT); /// 1 113 | lv_obj_set_height(ui_Label23, LV_SIZE_CONTENT); /// 1 114 | lv_obj_set_align(ui_Label23, LV_ALIGN_CENTER); 115 | lv_label_set_text(ui_Label23, "-"); 116 | lv_obj_set_style_text_color(ui_Label23, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 117 | lv_obj_set_style_text_opa(ui_Label23, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 118 | lv_obj_set_style_text_font(ui_Label23, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 119 | 120 | ui_saveTime = lv_obj_create(ui_setTime); 121 | lv_obj_set_width(ui_saveTime, 139); 122 | lv_obj_set_height(ui_saveTime, 50); 123 | lv_obj_set_x(ui_saveTime, -4); 124 | lv_obj_set_y(ui_saveTime, -144); 125 | lv_obj_set_align(ui_saveTime, LV_ALIGN_CENTER); 126 | lv_obj_clear_flag(ui_saveTime, LV_OBJ_FLAG_SCROLLABLE); /// Flags 127 | lv_obj_set_style_radius(ui_saveTime, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 128 | lv_obj_set_style_bg_color(ui_saveTime, lv_color_hex(0xE1109F), LV_PART_MAIN | LV_STATE_DEFAULT); 129 | lv_obj_set_style_bg_opa(ui_saveTime, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 130 | lv_obj_set_style_border_width(ui_saveTime, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 131 | 132 | ui_Label24 = lv_label_create(ui_saveTime); 133 | lv_obj_set_width(ui_Label24, LV_SIZE_CONTENT); /// 1 134 | lv_obj_set_height(ui_Label24, LV_SIZE_CONTENT); /// 1 135 | lv_obj_set_align(ui_Label24, LV_ALIGN_CENTER); 136 | lv_label_set_text(ui_Label24, "SAVE"); 137 | lv_obj_set_style_text_color(ui_Label24, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 138 | lv_obj_set_style_text_opa(ui_Label24, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 139 | lv_obj_set_style_text_font(ui_Label24, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 140 | 141 | ui_setHrLBL = lv_label_create(ui_setTime); 142 | lv_obj_set_width(ui_setHrLBL, LV_SIZE_CONTENT); /// 1 143 | lv_obj_set_height(ui_setHrLBL, LV_SIZE_CONTENT); /// 1 144 | lv_obj_set_x(ui_setHrLBL, -63); 145 | lv_obj_set_y(ui_setHrLBL, 5); 146 | lv_obj_set_align(ui_setHrLBL, LV_ALIGN_CENTER); 147 | lv_label_set_text(ui_setHrLBL, "25"); 148 | lv_obj_set_style_text_font(ui_setHrLBL, &ui_font_digits, LV_PART_MAIN | LV_STATE_DEFAULT); 149 | 150 | ui_setMinLBL = lv_label_create(ui_setTime); 151 | lv_obj_set_width(ui_setMinLBL, LV_SIZE_CONTENT); /// 1 152 | lv_obj_set_height(ui_setMinLBL, LV_SIZE_CONTENT); /// 1 153 | lv_obj_set_x(ui_setMinLBL, 68); 154 | lv_obj_set_y(ui_setMinLBL, 4); 155 | lv_obj_set_align(ui_setMinLBL, LV_ALIGN_CENTER); 156 | lv_label_set_text(ui_setMinLBL, "25"); 157 | lv_obj_set_style_text_font(ui_setMinLBL, &ui_font_digits, LV_PART_MAIN | LV_STATE_DEFAULT); 158 | 159 | ui_Panel16 = lv_obj_create(ui_setTime); 160 | lv_obj_set_width(ui_Panel16, 8); 161 | lv_obj_set_height(ui_Panel16, 8); 162 | lv_obj_set_align(ui_Panel16, LV_ALIGN_CENTER); 163 | lv_obj_clear_flag(ui_Panel16, LV_OBJ_FLAG_SCROLLABLE); /// Flags 164 | lv_obj_set_style_bg_color(ui_Panel16, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); 165 | lv_obj_set_style_bg_opa(ui_Panel16, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 166 | lv_obj_set_style_border_width(ui_Panel16, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 167 | 168 | ui_Panel24 = lv_obj_create(ui_setTime); 169 | lv_obj_set_width(ui_Panel24, 8); 170 | lv_obj_set_height(ui_Panel24, 8); 171 | lv_obj_set_x(ui_Panel24, 0); 172 | lv_obj_set_y(ui_Panel24, 18); 173 | lv_obj_set_align(ui_Panel24, LV_ALIGN_CENTER); 174 | lv_obj_clear_flag(ui_Panel24, LV_OBJ_FLAG_SCROLLABLE); /// Flags 175 | lv_obj_set_style_bg_color(ui_Panel24, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT); 176 | lv_obj_set_style_bg_opa(ui_Panel24, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 177 | lv_obj_set_style_border_width(ui_Panel24, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 178 | 179 | lv_obj_add_event_cb(ui_hrUp, ui_event_hrUp, LV_EVENT_ALL, NULL); 180 | lv_obj_add_event_cb(ui_Button6, ui_event_Button6, LV_EVENT_ALL, NULL); 181 | lv_obj_add_event_cb(ui_minUp, ui_event_minUp, LV_EVENT_ALL, NULL); 182 | lv_obj_add_event_cb(ui_hrDown, ui_event_hrDown, LV_EVENT_ALL, NULL); 183 | lv_obj_add_event_cb(ui_minDown, ui_event_minDown, LV_EVENT_ALL, NULL); 184 | lv_obj_add_event_cb(ui_saveTime, ui_event_saveTime, LV_EVENT_ALL, NULL); 185 | 186 | } 187 | -------------------------------------------------------------------------------- /waveClock/UI/ui.c: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.3.4 3 | // LVGL version: 8.3.6 4 | // Project name: SquareLine_Project 5 | 6 | #include "ui.h" 7 | #include "ui_helpers.h" 8 | 9 | ///////////////////// VARIABLES //////////////////// 10 | 11 | 12 | // SCREEN: ui_Screen1 13 | void ui_Screen1_screen_init(void); 14 | lv_obj_t * ui_Screen1; 15 | lv_obj_t * ui_Panel1; 16 | lv_obj_t * ui_Panel2; 17 | lv_obj_t * ui_Panel3; 18 | lv_obj_t * ui_Panel4; 19 | lv_obj_t * ui_Label3; 20 | lv_obj_t * ui_Panel5; 21 | lv_obj_t * ui_Label1; 22 | lv_obj_t * ui_Panel23; 23 | lv_obj_t * ui_Label18; 24 | lv_obj_t * ui_timeLBL; 25 | lv_obj_t * ui_secLBL; 26 | lv_obj_t * ui_Image1; 27 | lv_obj_t * ui_Label5; 28 | lv_obj_t * ui_Label2; 29 | lv_obj_t * ui_dateLBL; 30 | lv_obj_t * ui_dayLBL; 31 | lv_obj_t * ui_Spinner1; 32 | lv_obj_t * ui_Panel6; 33 | lv_obj_t * ui_Label8; 34 | lv_obj_t * ui_Label9; 35 | lv_obj_t * ui_Panel7; 36 | lv_obj_t * ui_Panel8; 37 | lv_obj_t * ui_Panel9; 38 | lv_obj_t * ui_Panel10; 39 | lv_obj_t * ui_Label10; 40 | lv_obj_t * ui_Panel11; 41 | lv_obj_t * ui_Panel12; 42 | lv_obj_t * ui_batVoltage; 43 | lv_obj_t * ui_batPercent; 44 | lv_obj_t * ui_Label11; 45 | lv_obj_t * ui_Panel13; 46 | lv_obj_t * ui_Panel15; 47 | lv_obj_t * ui_Bar1; 48 | void ui_event_Image2(lv_event_t * e); 49 | lv_obj_t * ui_Image2; 50 | void ui_event_Image3(lv_event_t * e); 51 | lv_obj_t * ui_Image3; 52 | lv_obj_t * ui_Panel14; 53 | lv_obj_t * ui_Chart1; 54 | lv_obj_t * ui_Label13; 55 | lv_obj_t * ui_Panel17; 56 | lv_obj_t * ui_Panel18; 57 | lv_obj_t * ui_Panel19; 58 | lv_obj_t * ui_Panel20; 59 | lv_obj_t * ui_Label15; 60 | lv_obj_t * ui_Label16; 61 | lv_obj_t * ui_Label17; 62 | lv_obj_t * ui_Panel21; 63 | lv_obj_t * ui_Panel22; 64 | lv_obj_t * ui_Label19; 65 | 66 | 67 | // SCREEN: ui_setMenu 68 | void ui_setMenu_screen_init(void); 69 | lv_obj_t * ui_setMenu; 70 | void ui_event_Button2(lv_event_t * e); 71 | lv_obj_t * ui_Button2; 72 | lv_obj_t * ui_Label6; 73 | void ui_event_Button3(lv_event_t * e); 74 | lv_obj_t * ui_Button3; 75 | lv_obj_t * ui_Label7; 76 | void ui_event_Button4(lv_event_t * e); 77 | lv_obj_t * ui_Button4; 78 | lv_obj_t * ui_Label12; 79 | 80 | 81 | // SCREEN: ui_setTime 82 | void ui_setTime_screen_init(void); 83 | lv_obj_t * ui_setTime; 84 | void ui_event_hrUp(lv_event_t * e); 85 | lv_obj_t * ui_hrUp; 86 | lv_obj_t * ui_Label20; 87 | void ui_event_Button6(lv_event_t * e); 88 | lv_obj_t * ui_Button6; 89 | lv_obj_t * ui_Label14; 90 | void ui_event_minUp(lv_event_t * e); 91 | lv_obj_t * ui_minUp; 92 | lv_obj_t * ui_Label21; 93 | void ui_event_hrDown(lv_event_t * e); 94 | lv_obj_t * ui_hrDown; 95 | lv_obj_t * ui_Label22; 96 | void ui_event_minDown(lv_event_t * e); 97 | lv_obj_t * ui_minDown; 98 | lv_obj_t * ui_Label23; 99 | void ui_event_saveTime(lv_event_t * e); 100 | lv_obj_t * ui_saveTime; 101 | lv_obj_t * ui_Label24; 102 | lv_obj_t * ui_setHrLBL; 103 | lv_obj_t * ui_setMinLBL; 104 | lv_obj_t * ui_Panel16; 105 | lv_obj_t * ui_Panel24; 106 | 107 | 108 | // SCREEN: ui_setDate 109 | void ui_setDate_screen_init(void); 110 | lv_obj_t * ui_setDate; 111 | void ui_event_monthUP(lv_event_t * e); 112 | lv_obj_t * ui_monthUP; 113 | lv_obj_t * ui_Label4; 114 | void ui_event_Button1(lv_event_t * e); 115 | lv_obj_t * ui_Button1; 116 | lv_obj_t * ui_Label25; 117 | void ui_event_dayUp(lv_event_t * e); 118 | lv_obj_t * ui_dayUp; 119 | lv_obj_t * ui_Label26; 120 | void ui_event_monthDowm(lv_event_t * e); 121 | lv_obj_t * ui_monthDowm; 122 | lv_obj_t * ui_Label27; 123 | void ui_event_dayDown(lv_event_t * e); 124 | lv_obj_t * ui_dayDown; 125 | lv_obj_t * ui_Label28; 126 | void ui_event_saveDate(lv_event_t * e); 127 | lv_obj_t * ui_saveDate; 128 | lv_obj_t * ui_Label29; 129 | lv_obj_t * ui_setMonthLBL; 130 | lv_obj_t * ui_setDayLBL; 131 | void ui_event_yearUp(lv_event_t * e); 132 | lv_obj_t * ui_yearUp; 133 | lv_obj_t * ui_Label30; 134 | void ui_event_yearDown(lv_event_t * e); 135 | lv_obj_t * ui_yearDown; 136 | lv_obj_t * ui_Label31; 137 | void ui_event_dowUp(lv_event_t * e); 138 | lv_obj_t * ui_dowUp; 139 | lv_obj_t * ui_Label32; 140 | void ui_event_dowDown(lv_event_t * e); 141 | lv_obj_t * ui_dowDown; 142 | lv_obj_t * ui_Label33; 143 | lv_obj_t * ui_setYearLBL; 144 | lv_obj_t * ui_setDowLBL; 145 | lv_obj_t * ui_Label34; 146 | lv_obj_t * ui____initial_actions0; 147 | 148 | ///////////////////// TEST LVGL SETTINGS //////////////////// 149 | #if LV_COLOR_DEPTH != 16 150 | #error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings" 151 | #endif 152 | #if LV_COLOR_16_SWAP !=0 153 | #error "LV_COLOR_16_SWAP should be 0 to match SquareLine Studio's settings" 154 | #endif 155 | 156 | ///////////////////// ANIMATIONS //////////////////// 157 | 158 | ///////////////////// FUNCTIONS //////////////////// 159 | void ui_event_Image2(lv_event_t * e) 160 | { 161 | lv_event_code_t event_code = lv_event_get_code(e); 162 | lv_obj_t * target = lv_event_get_target(e); 163 | if(event_code == LV_EVENT_CLICKED) { 164 | _ui_screen_change(&ui_setMenu, LV_SCR_LOAD_ANIM_MOVE_RIGHT, 500, 0, &ui_setMenu_screen_init); 165 | } 166 | } 167 | void ui_event_Image3(lv_event_t * e) 168 | { 169 | lv_event_code_t event_code = lv_event_get_code(e); 170 | lv_obj_t * target = lv_event_get_target(e); 171 | if(event_code == LV_EVENT_CLICKED) { 172 | cngBright(e); 173 | } 174 | } 175 | void ui_event_Button2(lv_event_t * e) 176 | { 177 | lv_event_code_t event_code = lv_event_get_code(e); 178 | lv_obj_t * target = lv_event_get_target(e); 179 | if(event_code == LV_EVENT_CLICKED) { 180 | _ui_screen_change(&ui_setTime, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0, &ui_setTime_screen_init); 181 | } 182 | if(event_code == LV_EVENT_CLICKED) { 183 | prepareTime(e); 184 | } 185 | } 186 | void ui_event_Button3(lv_event_t * e) 187 | { 188 | lv_event_code_t event_code = lv_event_get_code(e); 189 | lv_obj_t * target = lv_event_get_target(e); 190 | if(event_code == LV_EVENT_CLICKED) { 191 | _ui_screen_change(&ui_Screen1, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0, &ui_Screen1_screen_init); 192 | } 193 | } 194 | void ui_event_Button4(lv_event_t * e) 195 | { 196 | lv_event_code_t event_code = lv_event_get_code(e); 197 | lv_obj_t * target = lv_event_get_target(e); 198 | if(event_code == LV_EVENT_CLICKED) { 199 | _ui_screen_change(&ui_setDate, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0, &ui_setDate_screen_init); 200 | } 201 | if(event_code == LV_EVENT_CLICKED) { 202 | prepareTime(e); 203 | } 204 | } 205 | void ui_event_hrUp(lv_event_t * e) 206 | { 207 | lv_event_code_t event_code = lv_event_get_code(e); 208 | lv_obj_t * target = lv_event_get_target(e); 209 | if(event_code == LV_EVENT_CLICKED) { 210 | choseTime(e); 211 | } 212 | } 213 | void ui_event_Button6(lv_event_t * e) 214 | { 215 | lv_event_code_t event_code = lv_event_get_code(e); 216 | lv_obj_t * target = lv_event_get_target(e); 217 | if(event_code == LV_EVENT_CLICKED) { 218 | _ui_screen_change(&ui_Screen1, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0, &ui_Screen1_screen_init); 219 | } 220 | } 221 | void ui_event_minUp(lv_event_t * e) 222 | { 223 | lv_event_code_t event_code = lv_event_get_code(e); 224 | lv_obj_t * target = lv_event_get_target(e); 225 | if(event_code == LV_EVENT_CLICKED) { 226 | choseTime(e); 227 | } 228 | } 229 | void ui_event_hrDown(lv_event_t * e) 230 | { 231 | lv_event_code_t event_code = lv_event_get_code(e); 232 | lv_obj_t * target = lv_event_get_target(e); 233 | if(event_code == LV_EVENT_CLICKED) { 234 | choseTime(e); 235 | } 236 | } 237 | void ui_event_minDown(lv_event_t * e) 238 | { 239 | lv_event_code_t event_code = lv_event_get_code(e); 240 | lv_obj_t * target = lv_event_get_target(e); 241 | if(event_code == LV_EVENT_CLICKED) { 242 | choseTime(e); 243 | } 244 | } 245 | void ui_event_saveTime(lv_event_t * e) 246 | { 247 | lv_event_code_t event_code = lv_event_get_code(e); 248 | lv_obj_t * target = lv_event_get_target(e); 249 | if(event_code == LV_EVENT_CLICKED) { 250 | choseTime(e); 251 | } 252 | } 253 | void ui_event_monthUP(lv_event_t * e) 254 | { 255 | lv_event_code_t event_code = lv_event_get_code(e); 256 | lv_obj_t * target = lv_event_get_target(e); 257 | if(event_code == LV_EVENT_CLICKED) { 258 | choseTime(e); 259 | } 260 | } 261 | void ui_event_Button1(lv_event_t * e) 262 | { 263 | lv_event_code_t event_code = lv_event_get_code(e); 264 | lv_obj_t * target = lv_event_get_target(e); 265 | if(event_code == LV_EVENT_CLICKED) { 266 | _ui_screen_change(&ui_Screen1, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0, &ui_Screen1_screen_init); 267 | } 268 | } 269 | void ui_event_dayUp(lv_event_t * e) 270 | { 271 | lv_event_code_t event_code = lv_event_get_code(e); 272 | lv_obj_t * target = lv_event_get_target(e); 273 | if(event_code == LV_EVENT_CLICKED) { 274 | choseTime(e); 275 | } 276 | } 277 | void ui_event_monthDowm(lv_event_t * e) 278 | { 279 | lv_event_code_t event_code = lv_event_get_code(e); 280 | lv_obj_t * target = lv_event_get_target(e); 281 | if(event_code == LV_EVENT_CLICKED) { 282 | choseTime(e); 283 | } 284 | } 285 | void ui_event_dayDown(lv_event_t * e) 286 | { 287 | lv_event_code_t event_code = lv_event_get_code(e); 288 | lv_obj_t * target = lv_event_get_target(e); 289 | if(event_code == LV_EVENT_CLICKED) { 290 | choseTime(e); 291 | } 292 | } 293 | void ui_event_saveDate(lv_event_t * e) 294 | { 295 | lv_event_code_t event_code = lv_event_get_code(e); 296 | lv_obj_t * target = lv_event_get_target(e); 297 | if(event_code == LV_EVENT_CLICKED) { 298 | choseTime(e); 299 | } 300 | } 301 | void ui_event_yearUp(lv_event_t * e) 302 | { 303 | lv_event_code_t event_code = lv_event_get_code(e); 304 | lv_obj_t * target = lv_event_get_target(e); 305 | if(event_code == LV_EVENT_CLICKED) { 306 | choseTime(e); 307 | } 308 | } 309 | void ui_event_yearDown(lv_event_t * e) 310 | { 311 | lv_event_code_t event_code = lv_event_get_code(e); 312 | lv_obj_t * target = lv_event_get_target(e); 313 | if(event_code == LV_EVENT_CLICKED) { 314 | choseTime(e); 315 | } 316 | } 317 | void ui_event_dowUp(lv_event_t * e) 318 | { 319 | lv_event_code_t event_code = lv_event_get_code(e); 320 | lv_obj_t * target = lv_event_get_target(e); 321 | if(event_code == LV_EVENT_CLICKED) { 322 | choseTime(e); 323 | } 324 | } 325 | void ui_event_dowDown(lv_event_t * e) 326 | { 327 | lv_event_code_t event_code = lv_event_get_code(e); 328 | lv_obj_t * target = lv_event_get_target(e); 329 | if(event_code == LV_EVENT_CLICKED) { 330 | choseTime(e); 331 | } 332 | } 333 | 334 | ///////////////////// SCREENS //////////////////// 335 | 336 | void ui_init(void) 337 | { 338 | lv_disp_t * dispp = lv_disp_get_default(); 339 | lv_theme_t * theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), 340 | true, LV_FONT_DEFAULT); 341 | lv_disp_set_theme(dispp, theme); 342 | ui_Screen1_screen_init(); 343 | ui_setMenu_screen_init(); 344 | ui_setTime_screen_init(); 345 | ui_setDate_screen_init(); 346 | ui____initial_actions0 = lv_obj_create(NULL); 347 | lv_disp_load_scr(ui_Screen1); 348 | } 349 | -------------------------------------------------------------------------------- /waveClock/ui.c: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.3.4 3 | // LVGL version: 8.3.6 4 | // Project name: SquareLine_Project 5 | 6 | #include "ui.h" 7 | #include "ui_helpers.h" 8 | 9 | ///////////////////// VARIABLES //////////////////// 10 | 11 | 12 | // SCREEN: ui_Screen1 13 | void ui_Screen1_screen_init(void); 14 | lv_obj_t * ui_Screen1; 15 | lv_obj_t * ui_Panel1; 16 | lv_obj_t * ui_Panel2; 17 | lv_obj_t * ui_Panel3; 18 | lv_obj_t * ui_Panel4; 19 | lv_obj_t * ui_Label3; 20 | lv_obj_t * ui_Panel5; 21 | lv_obj_t * ui_Label1; 22 | lv_obj_t * ui_Panel23; 23 | lv_obj_t * ui_Label18; 24 | lv_obj_t * ui_timeLBL; 25 | lv_obj_t * ui_secLBL; 26 | lv_obj_t * ui_Image1; 27 | lv_obj_t * ui_Label5; 28 | lv_obj_t * ui_Label2; 29 | lv_obj_t * ui_dateLBL; 30 | lv_obj_t * ui_dayLBL; 31 | lv_obj_t * ui_Spinner1; 32 | lv_obj_t * ui_Panel6; 33 | lv_obj_t * ui_Label8; 34 | lv_obj_t * ui_Label9; 35 | lv_obj_t * ui_Panel7; 36 | lv_obj_t * ui_Panel8; 37 | lv_obj_t * ui_Panel9; 38 | lv_obj_t * ui_Panel10; 39 | lv_obj_t * ui_Label10; 40 | lv_obj_t * ui_Panel11; 41 | lv_obj_t * ui_Panel12; 42 | lv_obj_t * ui_batVoltage; 43 | lv_obj_t * ui_batPercent; 44 | lv_obj_t * ui_Label11; 45 | lv_obj_t * ui_Panel13; 46 | lv_obj_t * ui_Panel15; 47 | lv_obj_t * ui_Bar1; 48 | void ui_event_Image2(lv_event_t * e); 49 | lv_obj_t * ui_Image2; 50 | void ui_event_Image3(lv_event_t * e); 51 | lv_obj_t * ui_Image3; 52 | lv_obj_t * ui_Panel14; 53 | lv_obj_t * ui_Chart1; 54 | lv_obj_t * ui_Label13; 55 | lv_obj_t * ui_Panel17; 56 | lv_obj_t * ui_Panel18; 57 | lv_obj_t * ui_Panel19; 58 | lv_obj_t * ui_Panel20; 59 | lv_obj_t * ui_Label15; 60 | lv_obj_t * ui_Label16; 61 | lv_obj_t * ui_Label17; 62 | lv_obj_t * ui_Panel21; 63 | lv_obj_t * ui_Panel22; 64 | lv_obj_t * ui_Label19; 65 | 66 | 67 | // SCREEN: ui_setMenu 68 | void ui_setMenu_screen_init(void); 69 | lv_obj_t * ui_setMenu; 70 | void ui_event_Button2(lv_event_t * e); 71 | lv_obj_t * ui_Button2; 72 | lv_obj_t * ui_Label6; 73 | void ui_event_Button3(lv_event_t * e); 74 | lv_obj_t * ui_Button3; 75 | lv_obj_t * ui_Label7; 76 | void ui_event_Button4(lv_event_t * e); 77 | lv_obj_t * ui_Button4; 78 | lv_obj_t * ui_Label12; 79 | 80 | 81 | // SCREEN: ui_setTime 82 | void ui_setTime_screen_init(void); 83 | lv_obj_t * ui_setTime; 84 | void ui_event_hrUp(lv_event_t * e); 85 | lv_obj_t * ui_hrUp; 86 | lv_obj_t * ui_Label20; 87 | void ui_event_Button6(lv_event_t * e); 88 | lv_obj_t * ui_Button6; 89 | lv_obj_t * ui_Label14; 90 | void ui_event_minUp(lv_event_t * e); 91 | lv_obj_t * ui_minUp; 92 | lv_obj_t * ui_Label21; 93 | void ui_event_hrDown(lv_event_t * e); 94 | lv_obj_t * ui_hrDown; 95 | lv_obj_t * ui_Label22; 96 | void ui_event_minDown(lv_event_t * e); 97 | lv_obj_t * ui_minDown; 98 | lv_obj_t * ui_Label23; 99 | void ui_event_saveTime(lv_event_t * e); 100 | lv_obj_t * ui_saveTime; 101 | lv_obj_t * ui_Label24; 102 | lv_obj_t * ui_setHrLBL; 103 | lv_obj_t * ui_setMinLBL; 104 | lv_obj_t * ui_Panel16; 105 | lv_obj_t * ui_Panel24; 106 | 107 | 108 | // SCREEN: ui_setDate 109 | void ui_setDate_screen_init(void); 110 | lv_obj_t * ui_setDate; 111 | void ui_event_monthUP(lv_event_t * e); 112 | lv_obj_t * ui_monthUP; 113 | lv_obj_t * ui_Label4; 114 | void ui_event_Button1(lv_event_t * e); 115 | lv_obj_t * ui_Button1; 116 | lv_obj_t * ui_Label25; 117 | void ui_event_dayUp(lv_event_t * e); 118 | lv_obj_t * ui_dayUp; 119 | lv_obj_t * ui_Label26; 120 | void ui_event_monthDowm(lv_event_t * e); 121 | lv_obj_t * ui_monthDowm; 122 | lv_obj_t * ui_Label27; 123 | void ui_event_dayDown(lv_event_t * e); 124 | lv_obj_t * ui_dayDown; 125 | lv_obj_t * ui_Label28; 126 | void ui_event_saveDate(lv_event_t * e); 127 | lv_obj_t * ui_saveDate; 128 | lv_obj_t * ui_Label29; 129 | lv_obj_t * ui_setMonthLBL; 130 | lv_obj_t * ui_setDayLBL; 131 | void ui_event_yearUp(lv_event_t * e); 132 | lv_obj_t * ui_yearUp; 133 | lv_obj_t * ui_Label30; 134 | void ui_event_yearDown(lv_event_t * e); 135 | lv_obj_t * ui_yearDown; 136 | lv_obj_t * ui_Label31; 137 | void ui_event_dowUp(lv_event_t * e); 138 | lv_obj_t * ui_dowUp; 139 | lv_obj_t * ui_Label32; 140 | void ui_event_dowDown(lv_event_t * e); 141 | lv_obj_t * ui_dowDown; 142 | lv_obj_t * ui_Label33; 143 | lv_obj_t * ui_setYearLBL; 144 | lv_obj_t * ui_setDowLBL; 145 | lv_obj_t * ui_Label34; 146 | lv_obj_t * ui____initial_actions0; 147 | 148 | ///////////////////// TEST LVGL SETTINGS //////////////////// 149 | #if LV_COLOR_DEPTH != 16 150 | #error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings" 151 | #endif 152 | #if LV_COLOR_16_SWAP !=0 153 | #error "LV_COLOR_16_SWAP should be 0 to match SquareLine Studio's settings" 154 | #endif 155 | 156 | ///////////////////// ANIMATIONS //////////////////// 157 | 158 | ///////////////////// FUNCTIONS //////////////////// 159 | void ui_event_Image2(lv_event_t * e) 160 | { 161 | lv_event_code_t event_code = lv_event_get_code(e); 162 | lv_obj_t * target = lv_event_get_target(e); 163 | if(event_code == LV_EVENT_CLICKED) { 164 | _ui_screen_change(&ui_setMenu, LV_SCR_LOAD_ANIM_MOVE_RIGHT, 500, 0, &ui_setMenu_screen_init); 165 | } 166 | } 167 | void ui_event_Image3(lv_event_t * e) 168 | { 169 | lv_event_code_t event_code = lv_event_get_code(e); 170 | lv_obj_t * target = lv_event_get_target(e); 171 | if(event_code == LV_EVENT_CLICKED) { 172 | cngBright(e); 173 | } 174 | } 175 | void ui_event_Button2(lv_event_t * e) 176 | { 177 | lv_event_code_t event_code = lv_event_get_code(e); 178 | lv_obj_t * target = lv_event_get_target(e); 179 | if(event_code == LV_EVENT_CLICKED) { 180 | _ui_screen_change(&ui_setTime, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0, &ui_setTime_screen_init); 181 | } 182 | if(event_code == LV_EVENT_CLICKED) { 183 | prepareTime(e); 184 | } 185 | } 186 | void ui_event_Button3(lv_event_t * e) 187 | { 188 | lv_event_code_t event_code = lv_event_get_code(e); 189 | lv_obj_t * target = lv_event_get_target(e); 190 | if(event_code == LV_EVENT_CLICKED) { 191 | _ui_screen_change(&ui_Screen1, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0, &ui_Screen1_screen_init); 192 | } 193 | } 194 | void ui_event_Button4(lv_event_t * e) 195 | { 196 | lv_event_code_t event_code = lv_event_get_code(e); 197 | lv_obj_t * target = lv_event_get_target(e); 198 | if(event_code == LV_EVENT_CLICKED) { 199 | _ui_screen_change(&ui_setDate, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0, &ui_setDate_screen_init); 200 | } 201 | if(event_code == LV_EVENT_CLICKED) { 202 | prepareTime(e); 203 | } 204 | } 205 | void ui_event_hrUp(lv_event_t * e) 206 | { 207 | lv_event_code_t event_code = lv_event_get_code(e); 208 | lv_obj_t * target = lv_event_get_target(e); 209 | if(event_code == LV_EVENT_CLICKED) { 210 | choseTime(e); 211 | } 212 | } 213 | void ui_event_Button6(lv_event_t * e) 214 | { 215 | lv_event_code_t event_code = lv_event_get_code(e); 216 | lv_obj_t * target = lv_event_get_target(e); 217 | if(event_code == LV_EVENT_CLICKED) { 218 | _ui_screen_change(&ui_Screen1, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0, &ui_Screen1_screen_init); 219 | } 220 | } 221 | void ui_event_minUp(lv_event_t * e) 222 | { 223 | lv_event_code_t event_code = lv_event_get_code(e); 224 | lv_obj_t * target = lv_event_get_target(e); 225 | if(event_code == LV_EVENT_CLICKED) { 226 | choseTime(e); 227 | } 228 | } 229 | void ui_event_hrDown(lv_event_t * e) 230 | { 231 | lv_event_code_t event_code = lv_event_get_code(e); 232 | lv_obj_t * target = lv_event_get_target(e); 233 | if(event_code == LV_EVENT_CLICKED) { 234 | choseTime(e); 235 | } 236 | } 237 | void ui_event_minDown(lv_event_t * e) 238 | { 239 | lv_event_code_t event_code = lv_event_get_code(e); 240 | lv_obj_t * target = lv_event_get_target(e); 241 | if(event_code == LV_EVENT_CLICKED) { 242 | choseTime(e); 243 | } 244 | } 245 | void ui_event_saveTime(lv_event_t * e) 246 | { 247 | lv_event_code_t event_code = lv_event_get_code(e); 248 | lv_obj_t * target = lv_event_get_target(e); 249 | if(event_code == LV_EVENT_CLICKED) { 250 | choseTime(e); 251 | } 252 | } 253 | void ui_event_monthUP(lv_event_t * e) 254 | { 255 | lv_event_code_t event_code = lv_event_get_code(e); 256 | lv_obj_t * target = lv_event_get_target(e); 257 | if(event_code == LV_EVENT_CLICKED) { 258 | choseTime(e); 259 | } 260 | } 261 | void ui_event_Button1(lv_event_t * e) 262 | { 263 | lv_event_code_t event_code = lv_event_get_code(e); 264 | lv_obj_t * target = lv_event_get_target(e); 265 | if(event_code == LV_EVENT_CLICKED) { 266 | _ui_screen_change(&ui_Screen1, LV_SCR_LOAD_ANIM_MOVE_LEFT, 500, 0, &ui_Screen1_screen_init); 267 | } 268 | } 269 | void ui_event_dayUp(lv_event_t * e) 270 | { 271 | lv_event_code_t event_code = lv_event_get_code(e); 272 | lv_obj_t * target = lv_event_get_target(e); 273 | if(event_code == LV_EVENT_CLICKED) { 274 | choseTime(e); 275 | } 276 | } 277 | void ui_event_monthDowm(lv_event_t * e) 278 | { 279 | lv_event_code_t event_code = lv_event_get_code(e); 280 | lv_obj_t * target = lv_event_get_target(e); 281 | if(event_code == LV_EVENT_CLICKED) { 282 | choseTime(e); 283 | } 284 | } 285 | void ui_event_dayDown(lv_event_t * e) 286 | { 287 | lv_event_code_t event_code = lv_event_get_code(e); 288 | lv_obj_t * target = lv_event_get_target(e); 289 | if(event_code == LV_EVENT_CLICKED) { 290 | choseTime(e); 291 | } 292 | } 293 | void ui_event_saveDate(lv_event_t * e) 294 | { 295 | lv_event_code_t event_code = lv_event_get_code(e); 296 | lv_obj_t * target = lv_event_get_target(e); 297 | if(event_code == LV_EVENT_CLICKED) { 298 | choseTime(e); 299 | } 300 | } 301 | void ui_event_yearUp(lv_event_t * e) 302 | { 303 | lv_event_code_t event_code = lv_event_get_code(e); 304 | lv_obj_t * target = lv_event_get_target(e); 305 | if(event_code == LV_EVENT_CLICKED) { 306 | choseTime(e); 307 | } 308 | } 309 | void ui_event_yearDown(lv_event_t * e) 310 | { 311 | lv_event_code_t event_code = lv_event_get_code(e); 312 | lv_obj_t * target = lv_event_get_target(e); 313 | if(event_code == LV_EVENT_CLICKED) { 314 | choseTime(e); 315 | } 316 | } 317 | void ui_event_dowUp(lv_event_t * e) 318 | { 319 | lv_event_code_t event_code = lv_event_get_code(e); 320 | lv_obj_t * target = lv_event_get_target(e); 321 | if(event_code == LV_EVENT_CLICKED) { 322 | choseTime(e); 323 | } 324 | } 325 | void ui_event_dowDown(lv_event_t * e) 326 | { 327 | lv_event_code_t event_code = lv_event_get_code(e); 328 | lv_obj_t * target = lv_event_get_target(e); 329 | if(event_code == LV_EVENT_CLICKED) { 330 | choseTime(e); 331 | } 332 | } 333 | 334 | ///////////////////// SCREENS //////////////////// 335 | 336 | void ui_init(void) 337 | { 338 | lv_disp_t * dispp = lv_disp_get_default(); 339 | lv_theme_t * theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), 340 | true, LV_FONT_DEFAULT); 341 | lv_disp_set_theme(dispp, theme); 342 | ui_Screen1_screen_init(); 343 | ui_setMenu_screen_init(); 344 | ui_setTime_screen_init(); 345 | ui_setDate_screen_init(); 346 | ui____initial_actions0 = lv_obj_create(NULL); 347 | lv_disp_load_scr(ui_Screen1); 348 | } 349 | -------------------------------------------------------------------------------- /waveClock/Touch_SPD2010.cpp: -------------------------------------------------------------------------------- 1 | #include "Touch_SPD2010.h" 2 | 3 | struct SPD2010_Touch touch_data = {0}; 4 | uint8_t Touch_interrupts=0; 5 | 6 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 7 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 8 | bool I2C_Read_Touch(uint8_t Driver_addr, uint16_t Reg_addr, uint8_t *Reg_data, uint32_t Length) 9 | { 10 | Wire.beginTransmission(Driver_addr); 11 | Wire.write((uint8_t)(Reg_addr >> 8)); 12 | Wire.write((uint8_t)Reg_addr); 13 | if (Wire.endTransmission(true)){ 14 | printf("The I2C transmission fails. - I2C Read Touch\r\n"); 15 | return false; 16 | } 17 | Wire.requestFrom(Driver_addr, Length); 18 | while (Wire.available()) { 19 | *Reg_data++ =Wire.read(); 20 | } 21 | return true; 22 | } 23 | bool I2C_Write_Touch(uint8_t Driver_addr, uint16_t Reg_addr, const uint8_t *Reg_data, uint32_t Length) 24 | { 25 | Wire.beginTransmission(Driver_addr); 26 | Wire.write((uint8_t)(Reg_addr >> 8)); 27 | Wire.write((uint8_t)Reg_addr); 28 | for (int i = 0; i < Length; i++) { 29 | Wire.write(*Reg_data++); 30 | } 31 | if (Wire.endTransmission(true)) 32 | { 33 | printf("The I2C transmission fails. - I2C Write Touch\r\n"); 34 | return false; 35 | } 36 | return true; 37 | } 38 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 39 | 40 | 41 | 42 | void IRAM_ATTR Touch_SPD2010_ISR(void) { 43 | Touch_interrupts = true; 44 | } 45 | uint8_t Touch_Init(void) { 46 | SPD2010_Touch_Reset(); 47 | SPD2010_Read_cfg(); 48 | 49 | pinMode(EXAMPLE_PIN_NUM_TOUCH_INT, INPUT_PULLUP); 50 | attachInterrupt(EXAMPLE_PIN_NUM_TOUCH_INT, Touch_SPD2010_ISR, FALLING); 51 | return true; 52 | } 53 | /* Reset controller */ 54 | uint8_t SPD2010_Touch_Reset(void) 55 | { 56 | Set_EXIO(EXIO_PIN1,Low); 57 | delay(50); 58 | Set_EXIO(EXIO_PIN1,High); 59 | delay(50); 60 | return true; 61 | } 62 | 63 | uint16_t SPD2010_Read_cfg(void) { 64 | read_fw_version(); 65 | return 1; 66 | } 67 | // reads sensor and touches 68 | // updates Touch Points 69 | void Touch_Read_Data(void) { 70 | uint8_t touch_cnt = 0; 71 | struct SPD2010_Touch touch = {0}; 72 | tp_read_data(&touch); 73 | 74 | noInterrupts(); 75 | /* Expect Number of touched points */ 76 | touch_cnt = (touch.touch_num > CONFIG_ESP_LCD_TOUCH_MAX_POINTS ? CONFIG_ESP_LCD_TOUCH_MAX_POINTS : touch.touch_num); 77 | touch_data.touch_num = touch_cnt; 78 | /* Fill all coordinates */ 79 | for (int i = 0; i < touch_cnt; i++) { 80 | touch_data.rpt[i].x = touch.rpt[i].x; 81 | touch_data.rpt[i].y = touch.rpt[i].y; 82 | touch_data.rpt[i].weight = touch.rpt[i].weight; 83 | } 84 | interrupts(); 85 | } 86 | bool Touch_Get_xy(uint16_t *x, uint16_t *y, uint16_t *strength, uint8_t *point_num, uint8_t max_point_num){ 87 | /* Read data from touch controller */ 88 | Touch_Read_Data(); 89 | /* Count of points */ 90 | *point_num = (touch_data.touch_num > max_point_num ? max_point_num : touch_data.touch_num); 91 | for (size_t i = 0; i < *point_num; i++) { 92 | x[i] = touch_data.rpt[i].x; 93 | y[i] = touch_data.rpt[i].y; 94 | if (strength) { 95 | strength[i] = touch_data.rpt[i].weight; 96 | } 97 | } 98 | /* Clear available touch points count */ 99 | touch_data.touch_num = 0; 100 | return (*point_num > 0);; 101 | } 102 | 103 | void example_touchpad_read(void){ 104 | bool tp_pressed = false; 105 | uint16_t tp_x = 0; 106 | uint16_t tp_y = 0; 107 | uint8_t tp_cnt = 0; 108 | /* Read data from touch controller */ 109 | tp_pressed = Touch_Get_xy(&tp_x, &tp_y, NULL, &tp_cnt, 1); 110 | if (tp_pressed && (tp_cnt > 0)) { 111 | printf("Touch position: %d,%d\r\n", tp_x, tp_y); 112 | }else { 113 | // data->state = LV_INDEV_STATE_REL; 114 | } 115 | } 116 | void Touch_Loop(void){ 117 | example_touchpad_read(); 118 | } 119 | 120 | 121 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 122 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 123 | esp_err_t write_tp_point_mode_cmd() 124 | { 125 | uint8_t sample_data[4]; 126 | sample_data[0] = 0x50; 127 | sample_data[1] = 0x00; 128 | sample_data[2] = 0x00; 129 | sample_data[3] = 0x00; 130 | I2C_Write_Touch(SPD2010_ADDR, (((uint16_t)sample_data[0] << 8) | (sample_data[1])), &sample_data[2], 2); 131 | esp_rom_delay_us(200); 132 | return ESP_OK; 133 | } 134 | 135 | esp_err_t write_tp_start_cmd() 136 | { 137 | uint8_t sample_data[4]; 138 | sample_data[0] = 0x46; 139 | sample_data[1] = 0x00; 140 | sample_data[2] = 0x00; 141 | sample_data[3] = 0x00; 142 | I2C_Write_Touch(SPD2010_ADDR, (((uint16_t)sample_data[0] << 8) | (sample_data[1])), &sample_data[2], 2); 143 | esp_rom_delay_us(200); 144 | return ESP_OK; 145 | } 146 | 147 | esp_err_t write_tp_cpu_start_cmd() 148 | { 149 | uint8_t sample_data[4]; 150 | sample_data[0] = 0x04; 151 | sample_data[1] = 0x00; 152 | sample_data[2] = 0x01; 153 | sample_data[3] = 0x00; 154 | I2C_Write_Touch(SPD2010_ADDR, (((uint16_t)sample_data[0] << 8) | (sample_data[1])),&sample_data[2], 2); 155 | esp_rom_delay_us(200); 156 | return ESP_OK; 157 | } 158 | 159 | esp_err_t write_tp_clear_int_cmd() 160 | { 161 | uint8_t sample_data[4]; 162 | sample_data[0] = 0x02; 163 | sample_data[1] = 0x00; 164 | sample_data[2] = 0x01; 165 | sample_data[3] = 0x00; 166 | I2C_Write_Touch(SPD2010_ADDR, (((uint16_t)sample_data[0] << 8) | (sample_data[1])),&sample_data[2], 2); 167 | esp_rom_delay_us(200); 168 | return ESP_OK; 169 | } 170 | 171 | esp_err_t read_tp_status_length(tp_status_t *tp_status) 172 | { 173 | uint8_t sample_data[4]; 174 | sample_data[0] = 0x20; 175 | sample_data[1] = 0x00; 176 | I2C_Read_Touch(SPD2010_ADDR, (((uint16_t)sample_data[0] << 8) | (sample_data[1])),sample_data, 4); 177 | esp_rom_delay_us(200); 178 | tp_status->status_low.pt_exist = (sample_data[0] & 0x01); 179 | tp_status->status_low.gesture = (sample_data[0] & 0x02); 180 | tp_status->status_low.aux = ((sample_data[0] & 0x08)); //aux, cytang 181 | tp_status->status_high.tic_busy = ((sample_data[1] & 0x80) >> 7); 182 | tp_status->status_high.tic_in_bios = ((sample_data[1] & 0x40) >> 6); 183 | tp_status->status_high.tic_in_cpu = ((sample_data[1] & 0x20) >> 5); 184 | tp_status->status_high.tint_low = ((sample_data[1] & 0x10) >> 4); 185 | tp_status->status_high.cpu_run = ((sample_data[1] & 0x08) >> 3); 186 | tp_status->read_len = (sample_data[3] << 8 | sample_data[2]); 187 | return ESP_OK; 188 | } 189 | 190 | esp_err_t read_tp_hdp(tp_status_t *tp_status, SPD2010_Touch *touch) 191 | { 192 | uint8_t sample_data[4+(10*6)]; // 4 Bytes Header + 10 Finger * 6 Bytes 193 | uint8_t i, offset; 194 | uint8_t check_id; 195 | sample_data[0] = 0x00; 196 | sample_data[1] = 0x03; 197 | I2C_Read_Touch(SPD2010_ADDR, (((uint16_t)sample_data[0] << 8) | (sample_data[1])),sample_data, tp_status->read_len); 198 | 199 | 200 | check_id = sample_data[4]; 201 | if ((check_id <= 0x0A) && tp_status->status_low.pt_exist) { 202 | touch->touch_num = ((tp_status->read_len - 4)/6); 203 | touch->gesture = 0x00; 204 | for (i = 0; i < touch->touch_num; i++) { 205 | offset = i*6; 206 | touch->rpt[i].id = sample_data[4 + offset]; 207 | touch->rpt[i].x = (((sample_data[7 + offset] & 0xF0) << 4)| sample_data[5 + offset]); 208 | touch->rpt[i].y = (((sample_data[7 + offset] & 0x0F) << 8)| sample_data[6 + offset]); 209 | touch->rpt[i].weight = sample_data[8 + offset]; 210 | } 211 | /* For slide gesture recognize */ 212 | if ((touch->rpt[0].weight != 0) && (touch->down != 1)) { 213 | touch->down = 1; 214 | touch->up = 0 ; 215 | touch->down_x = touch->rpt[0].x; 216 | touch->down_y = touch->rpt[0].y; 217 | } else if ((touch->rpt[0].weight == 0) && (touch->down == 1)) { 218 | touch->up = 1; 219 | touch->down = 0; 220 | touch->up_x = touch->rpt[0].x; 221 | touch->up_y = touch->rpt[0].y; 222 | } 223 | /* Dump Log */ 224 | // for (uint8_t finger_num = 0; finger_num < touch->touch_num; finger_num++) { 225 | // printf("ID[%d], X[%d], Y[%d], Weight[%d]\n", 226 | // touch->rpt[finger_num].id, 227 | // touch->rpt[finger_num].x, 228 | // touch->rpt[finger_num].y, 229 | // touch->rpt[finger_num].weight); 230 | // } 231 | } else if ((check_id == 0xF6) && tp_status->status_low.gesture) { 232 | touch->touch_num = 0x00; 233 | touch->up = 0; 234 | touch->down = 0; 235 | touch->gesture = sample_data[6] & 0x07; 236 | printf("gesture : 0x%02x\n", touch->gesture); 237 | } else { 238 | touch->touch_num = 0x00; 239 | touch->gesture = 0x00; 240 | } 241 | return ESP_OK; 242 | } 243 | 244 | esp_err_t read_tp_hdp_status(tp_hdp_status_t *tp_hdp_status) 245 | { 246 | uint8_t sample_data[8]; 247 | sample_data[0] = 0xFC; 248 | sample_data[1] = 0x02; 249 | I2C_Read_Touch(SPD2010_ADDR, (((uint16_t)sample_data[0] << 8) | (sample_data[1])),sample_data, 8); 250 | tp_hdp_status->status = sample_data[5]; 251 | tp_hdp_status->next_packet_len = (sample_data[2] | sample_data[3] << 8); 252 | return ESP_OK; 253 | } 254 | 255 | esp_err_t Read_HDP_REMAIN_DATA(tp_hdp_status_t *tp_hdp_status) 256 | { 257 | uint8_t sample_data[32]; 258 | sample_data[0] = 0x00; 259 | sample_data[1] = 0x03; 260 | I2C_Read_Touch(SPD2010_ADDR, (((uint16_t)sample_data[0] << 8) | (sample_data[1])),sample_data, tp_hdp_status->next_packet_len); 261 | return ESP_OK; 262 | } 263 | 264 | esp_err_t read_fw_version() 265 | { 266 | uint8_t sample_data[18]; 267 | uint16_t DVer; 268 | uint32_t Dummy, PID, ICName_H, ICName_L; 269 | sample_data[0] = 0x26; 270 | sample_data[1] = 0x00; 271 | I2C_Read_Touch(SPD2010_ADDR, (((uint16_t)sample_data[0] << 8) | (sample_data[1])),sample_data, 18); 272 | Dummy = ((sample_data[0] << 24) | (sample_data[1] << 16) | (sample_data[3] << 8) | (sample_data[0])); 273 | DVer = ((sample_data[5] << 8) | (sample_data[4])); 274 | PID = ((sample_data[9] << 24) | (sample_data[8] << 16) | (sample_data[7] << 8) | (sample_data[6])); 275 | ICName_L = ((sample_data[13] << 24) | (sample_data[12] << 16) | (sample_data[11] << 8) | (sample_data[10])); // "2010" 276 | ICName_H = ((sample_data[17] << 24) | (sample_data[16] << 16) | (sample_data[15] << 8) | (sample_data[14])); // "SPD" 277 | printf("Dummy[%d], DVer[%d], PID[%d], Name[%d-%d]\r\n", Dummy, DVer, PID, ICName_H, ICName_L); 278 | return ESP_OK; 279 | } 280 | 281 | esp_err_t tp_read_data(SPD2010_Touch *touch) 282 | { 283 | tp_status_t tp_status = {0}; 284 | tp_hdp_status_t tp_hdp_status = {0}; 285 | read_tp_status_length(&tp_status); 286 | if (tp_status.status_high.tic_in_bios) { 287 | /* Write Clear TINT Command */ 288 | write_tp_clear_int_cmd(); 289 | /* Write CPU Start Command */ 290 | write_tp_cpu_start_cmd(); 291 | } else if (tp_status.status_high.tic_in_cpu) { 292 | /* Write Touch Change Command */ 293 | write_tp_point_mode_cmd(); 294 | /* Write Touch Start Command */ 295 | write_tp_start_cmd(); 296 | /* Write Clear TINT Command */ 297 | write_tp_clear_int_cmd(); 298 | } else if (tp_status.status_high.cpu_run && tp_status.read_len == 0) { 299 | write_tp_clear_int_cmd(); 300 | } else if (tp_status.status_low.pt_exist || tp_status.status_low.gesture) { 301 | /* Read HDP */ 302 | read_tp_hdp(&tp_status, touch); 303 | hdp_done_check: 304 | /* Read HDP Status */ 305 | read_tp_hdp_status(&tp_hdp_status); 306 | if (tp_hdp_status.status == 0x82) { 307 | /* Clear INT */ 308 | write_tp_clear_int_cmd(); 309 | } 310 | else if (tp_hdp_status.status == 0x00) { 311 | /* Read HDP Remain Data */ 312 | Read_HDP_REMAIN_DATA(&tp_hdp_status); 313 | goto hdp_done_check; 314 | } 315 | } else if (tp_status.status_high.cpu_run && tp_status.status_low.aux) { 316 | write_tp_clear_int_cmd(); 317 | } 318 | 319 | return ESP_OK; 320 | } 321 | 322 | -------------------------------------------------------------------------------- /waveClock/UI/ui_setDate.c: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.3.4 3 | // LVGL version: 8.3.6 4 | // Project name: SquareLine_Project 5 | 6 | #include "ui.h" 7 | 8 | void ui_setDate_screen_init(void) 9 | { 10 | ui_setDate = lv_obj_create(NULL); 11 | lv_obj_clear_flag(ui_setDate, LV_OBJ_FLAG_SCROLLABLE); /// Flags 12 | lv_obj_set_style_bg_color(ui_setDate, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 13 | lv_obj_set_style_bg_opa(ui_setDate, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 14 | 15 | ui_monthUP = lv_obj_create(ui_setDate); 16 | lv_obj_set_width(ui_monthUP, 80); 17 | lv_obj_set_height(ui_monthUP, 50); 18 | lv_obj_set_x(ui_monthUP, -130); 19 | lv_obj_set_y(ui_monthUP, -76); 20 | lv_obj_set_align(ui_monthUP, LV_ALIGN_CENTER); 21 | lv_obj_clear_flag(ui_monthUP, LV_OBJ_FLAG_SCROLLABLE); /// Flags 22 | lv_obj_set_style_radius(ui_monthUP, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 23 | lv_obj_set_style_bg_color(ui_monthUP, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 24 | lv_obj_set_style_bg_opa(ui_monthUP, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 25 | lv_obj_set_style_border_width(ui_monthUP, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 26 | 27 | ui_Label4 = lv_label_create(ui_monthUP); 28 | lv_obj_set_width(ui_Label4, LV_SIZE_CONTENT); /// 1 29 | lv_obj_set_height(ui_Label4, LV_SIZE_CONTENT); /// 1 30 | lv_obj_set_align(ui_Label4, LV_ALIGN_CENTER); 31 | lv_label_set_text(ui_Label4, "+"); 32 | lv_obj_set_style_text_color(ui_Label4, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 33 | lv_obj_set_style_text_opa(ui_Label4, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 34 | lv_obj_set_style_text_font(ui_Label4, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 35 | 36 | ui_Button1 = lv_btn_create(ui_setDate); 37 | lv_obj_set_width(ui_Button1, 169); 38 | lv_obj_set_height(ui_Button1, 58); 39 | lv_obj_set_x(ui_Button1, 0); 40 | lv_obj_set_y(ui_Button1, 149); 41 | lv_obj_set_align(ui_Button1, LV_ALIGN_CENTER); 42 | lv_obj_add_flag(ui_Button1, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags 43 | lv_obj_clear_flag(ui_Button1, LV_OBJ_FLAG_SCROLLABLE); /// Flags 44 | lv_obj_set_style_bg_color(ui_Button1, lv_color_hex(0x292831), LV_PART_MAIN | LV_STATE_DEFAULT); 45 | lv_obj_set_style_bg_opa(ui_Button1, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 46 | lv_obj_set_style_border_width(ui_Button1, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 47 | 48 | ui_Label25 = lv_label_create(ui_Button1); 49 | lv_obj_set_width(ui_Label25, LV_SIZE_CONTENT); /// 1 50 | lv_obj_set_height(ui_Label25, LV_SIZE_CONTENT); /// 1 51 | lv_obj_set_align(ui_Label25, LV_ALIGN_CENTER); 52 | lv_label_set_text(ui_Label25, "HOME"); 53 | lv_obj_set_style_text_color(ui_Label25, lv_color_hex(0xB8C8D5), LV_PART_MAIN | LV_STATE_DEFAULT); 54 | lv_obj_set_style_text_opa(ui_Label25, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 55 | lv_obj_set_style_text_font(ui_Label25, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 56 | 57 | ui_dayUp = lv_obj_create(ui_setDate); 58 | lv_obj_set_width(ui_dayUp, 80); 59 | lv_obj_set_height(ui_dayUp, 50); 60 | lv_obj_set_x(ui_dayUp, -40); 61 | lv_obj_set_y(ui_dayUp, -76); 62 | lv_obj_set_align(ui_dayUp, LV_ALIGN_CENTER); 63 | lv_obj_clear_flag(ui_dayUp, LV_OBJ_FLAG_SCROLLABLE); /// Flags 64 | lv_obj_set_style_radius(ui_dayUp, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 65 | lv_obj_set_style_bg_color(ui_dayUp, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 66 | lv_obj_set_style_bg_opa(ui_dayUp, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 67 | lv_obj_set_style_border_width(ui_dayUp, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 68 | 69 | ui_Label26 = lv_label_create(ui_dayUp); 70 | lv_obj_set_width(ui_Label26, LV_SIZE_CONTENT); /// 1 71 | lv_obj_set_height(ui_Label26, LV_SIZE_CONTENT); /// 1 72 | lv_obj_set_align(ui_Label26, LV_ALIGN_CENTER); 73 | lv_label_set_text(ui_Label26, "+"); 74 | lv_obj_set_style_text_color(ui_Label26, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 75 | lv_obj_set_style_text_opa(ui_Label26, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 76 | lv_obj_set_style_text_font(ui_Label26, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 77 | 78 | ui_monthDowm = lv_obj_create(ui_setDate); 79 | lv_obj_set_width(ui_monthDowm, 80); 80 | lv_obj_set_height(ui_monthDowm, 50); 81 | lv_obj_set_x(ui_monthDowm, -130); 82 | lv_obj_set_y(ui_monthDowm, 67); 83 | lv_obj_set_align(ui_monthDowm, LV_ALIGN_CENTER); 84 | lv_obj_clear_flag(ui_monthDowm, LV_OBJ_FLAG_SCROLLABLE); /// Flags 85 | lv_obj_set_style_radius(ui_monthDowm, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 86 | lv_obj_set_style_bg_color(ui_monthDowm, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 87 | lv_obj_set_style_bg_opa(ui_monthDowm, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 88 | lv_obj_set_style_border_width(ui_monthDowm, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 89 | 90 | ui_Label27 = lv_label_create(ui_monthDowm); 91 | lv_obj_set_width(ui_Label27, LV_SIZE_CONTENT); /// 1 92 | lv_obj_set_height(ui_Label27, LV_SIZE_CONTENT); /// 1 93 | lv_obj_set_align(ui_Label27, LV_ALIGN_CENTER); 94 | lv_label_set_text(ui_Label27, "-"); 95 | lv_obj_set_style_text_color(ui_Label27, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 96 | lv_obj_set_style_text_opa(ui_Label27, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 97 | lv_obj_set_style_text_font(ui_Label27, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 98 | 99 | ui_dayDown = lv_obj_create(ui_setDate); 100 | lv_obj_set_width(ui_dayDown, 80); 101 | lv_obj_set_height(ui_dayDown, 50); 102 | lv_obj_set_x(ui_dayDown, -40); 103 | lv_obj_set_y(ui_dayDown, 67); 104 | lv_obj_set_align(ui_dayDown, LV_ALIGN_CENTER); 105 | lv_obj_clear_flag(ui_dayDown, LV_OBJ_FLAG_SCROLLABLE); /// Flags 106 | lv_obj_set_style_radius(ui_dayDown, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 107 | lv_obj_set_style_bg_color(ui_dayDown, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 108 | lv_obj_set_style_bg_opa(ui_dayDown, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 109 | lv_obj_set_style_border_width(ui_dayDown, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 110 | 111 | ui_Label28 = lv_label_create(ui_dayDown); 112 | lv_obj_set_width(ui_Label28, LV_SIZE_CONTENT); /// 1 113 | lv_obj_set_height(ui_Label28, LV_SIZE_CONTENT); /// 1 114 | lv_obj_set_align(ui_Label28, LV_ALIGN_CENTER); 115 | lv_label_set_text(ui_Label28, "-"); 116 | lv_obj_set_style_text_color(ui_Label28, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 117 | lv_obj_set_style_text_opa(ui_Label28, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 118 | lv_obj_set_style_text_font(ui_Label28, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 119 | 120 | ui_saveDate = lv_obj_create(ui_setDate); 121 | lv_obj_set_width(ui_saveDate, 139); 122 | lv_obj_set_height(ui_saveDate, 50); 123 | lv_obj_set_x(ui_saveDate, -4); 124 | lv_obj_set_y(ui_saveDate, -144); 125 | lv_obj_set_align(ui_saveDate, LV_ALIGN_CENTER); 126 | lv_obj_clear_flag(ui_saveDate, LV_OBJ_FLAG_SCROLLABLE); /// Flags 127 | lv_obj_set_style_radius(ui_saveDate, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 128 | lv_obj_set_style_bg_color(ui_saveDate, lv_color_hex(0x64144B), LV_PART_MAIN | LV_STATE_DEFAULT); 129 | lv_obj_set_style_bg_opa(ui_saveDate, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 130 | lv_obj_set_style_border_width(ui_saveDate, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 131 | 132 | ui_Label29 = lv_label_create(ui_saveDate); 133 | lv_obj_set_width(ui_Label29, LV_SIZE_CONTENT); /// 1 134 | lv_obj_set_height(ui_Label29, LV_SIZE_CONTENT); /// 1 135 | lv_obj_set_align(ui_Label29, LV_ALIGN_CENTER); 136 | lv_label_set_text(ui_Label29, "SAVE"); 137 | lv_obj_set_style_text_color(ui_Label29, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 138 | lv_obj_set_style_text_opa(ui_Label29, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 139 | lv_obj_set_style_text_font(ui_Label29, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 140 | 141 | ui_setMonthLBL = lv_label_create(ui_setDate); 142 | lv_obj_set_width(ui_setMonthLBL, LV_SIZE_CONTENT); /// 1 143 | lv_obj_set_height(ui_setMonthLBL, LV_SIZE_CONTENT); /// 1 144 | lv_obj_set_x(ui_setMonthLBL, -128); 145 | lv_obj_set_y(ui_setMonthLBL, 12); 146 | lv_obj_set_align(ui_setMonthLBL, LV_ALIGN_CENTER); 147 | lv_label_set_text(ui_setMonthLBL, "25"); 148 | lv_obj_set_style_text_font(ui_setMonthLBL, &ui_font_secs, LV_PART_MAIN | LV_STATE_DEFAULT); 149 | 150 | ui_setDayLBL = lv_label_create(ui_setDate); 151 | lv_obj_set_width(ui_setDayLBL, LV_SIZE_CONTENT); /// 1 152 | lv_obj_set_height(ui_setDayLBL, LV_SIZE_CONTENT); /// 1 153 | lv_obj_set_x(ui_setDayLBL, -38); 154 | lv_obj_set_y(ui_setDayLBL, 14); 155 | lv_obj_set_align(ui_setDayLBL, LV_ALIGN_CENTER); 156 | lv_label_set_text(ui_setDayLBL, "25"); 157 | lv_obj_set_style_text_font(ui_setDayLBL, &ui_font_secs, LV_PART_MAIN | LV_STATE_DEFAULT); 158 | 159 | ui_yearUp = lv_obj_create(ui_setDate); 160 | lv_obj_set_width(ui_yearUp, 80); 161 | lv_obj_set_height(ui_yearUp, 50); 162 | lv_obj_set_x(ui_yearUp, 50); 163 | lv_obj_set_y(ui_yearUp, -76); 164 | lv_obj_set_align(ui_yearUp, LV_ALIGN_CENTER); 165 | lv_obj_clear_flag(ui_yearUp, LV_OBJ_FLAG_SCROLLABLE); /// Flags 166 | lv_obj_set_style_radius(ui_yearUp, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 167 | lv_obj_set_style_bg_color(ui_yearUp, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 168 | lv_obj_set_style_bg_opa(ui_yearUp, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 169 | lv_obj_set_style_border_width(ui_yearUp, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 170 | 171 | ui_Label30 = lv_label_create(ui_yearUp); 172 | lv_obj_set_width(ui_Label30, LV_SIZE_CONTENT); /// 1 173 | lv_obj_set_height(ui_Label30, LV_SIZE_CONTENT); /// 1 174 | lv_obj_set_align(ui_Label30, LV_ALIGN_CENTER); 175 | lv_label_set_text(ui_Label30, "+"); 176 | lv_obj_set_style_text_color(ui_Label30, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 177 | lv_obj_set_style_text_opa(ui_Label30, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 178 | lv_obj_set_style_text_font(ui_Label30, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 179 | 180 | ui_yearDown = lv_obj_create(ui_setDate); 181 | lv_obj_set_width(ui_yearDown, 80); 182 | lv_obj_set_height(ui_yearDown, 50); 183 | lv_obj_set_x(ui_yearDown, 50); 184 | lv_obj_set_y(ui_yearDown, 67); 185 | lv_obj_set_align(ui_yearDown, LV_ALIGN_CENTER); 186 | lv_obj_clear_flag(ui_yearDown, LV_OBJ_FLAG_SCROLLABLE); /// Flags 187 | lv_obj_set_style_radius(ui_yearDown, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 188 | lv_obj_set_style_bg_color(ui_yearDown, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 189 | lv_obj_set_style_bg_opa(ui_yearDown, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 190 | lv_obj_set_style_border_width(ui_yearDown, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 191 | 192 | ui_Label31 = lv_label_create(ui_yearDown); 193 | lv_obj_set_width(ui_Label31, LV_SIZE_CONTENT); /// 1 194 | lv_obj_set_height(ui_Label31, LV_SIZE_CONTENT); /// 1 195 | lv_obj_set_align(ui_Label31, LV_ALIGN_CENTER); 196 | lv_label_set_text(ui_Label31, "-"); 197 | lv_obj_set_style_text_color(ui_Label31, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 198 | lv_obj_set_style_text_opa(ui_Label31, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 199 | lv_obj_set_style_text_font(ui_Label31, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 200 | 201 | ui_dowUp = lv_obj_create(ui_setDate); 202 | lv_obj_set_width(ui_dowUp, 80); 203 | lv_obj_set_height(ui_dowUp, 50); 204 | lv_obj_set_x(ui_dowUp, 140); 205 | lv_obj_set_y(ui_dowUp, -76); 206 | lv_obj_set_align(ui_dowUp, LV_ALIGN_CENTER); 207 | lv_obj_clear_flag(ui_dowUp, LV_OBJ_FLAG_SCROLLABLE); /// Flags 208 | lv_obj_set_style_radius(ui_dowUp, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 209 | lv_obj_set_style_bg_color(ui_dowUp, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 210 | lv_obj_set_style_bg_opa(ui_dowUp, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 211 | lv_obj_set_style_border_width(ui_dowUp, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 212 | 213 | ui_Label32 = lv_label_create(ui_dowUp); 214 | lv_obj_set_width(ui_Label32, LV_SIZE_CONTENT); /// 1 215 | lv_obj_set_height(ui_Label32, LV_SIZE_CONTENT); /// 1 216 | lv_obj_set_align(ui_Label32, LV_ALIGN_CENTER); 217 | lv_label_set_text(ui_Label32, "+"); 218 | lv_obj_set_style_text_color(ui_Label32, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 219 | lv_obj_set_style_text_opa(ui_Label32, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 220 | lv_obj_set_style_text_font(ui_Label32, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 221 | 222 | ui_dowDown = lv_obj_create(ui_setDate); 223 | lv_obj_set_width(ui_dowDown, 80); 224 | lv_obj_set_height(ui_dowDown, 50); 225 | lv_obj_set_x(ui_dowDown, 140); 226 | lv_obj_set_y(ui_dowDown, 67); 227 | lv_obj_set_align(ui_dowDown, LV_ALIGN_CENTER); 228 | lv_obj_clear_flag(ui_dowDown, LV_OBJ_FLAG_SCROLLABLE); /// Flags 229 | lv_obj_set_style_radius(ui_dowDown, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 230 | lv_obj_set_style_bg_color(ui_dowDown, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 231 | lv_obj_set_style_bg_opa(ui_dowDown, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 232 | lv_obj_set_style_border_width(ui_dowDown, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 233 | 234 | ui_Label33 = lv_label_create(ui_dowDown); 235 | lv_obj_set_width(ui_Label33, LV_SIZE_CONTENT); /// 1 236 | lv_obj_set_height(ui_Label33, LV_SIZE_CONTENT); /// 1 237 | lv_obj_set_align(ui_Label33, LV_ALIGN_CENTER); 238 | lv_label_set_text(ui_Label33, "-"); 239 | lv_obj_set_style_text_color(ui_Label33, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 240 | lv_obj_set_style_text_opa(ui_Label33, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 241 | lv_obj_set_style_text_font(ui_Label33, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 242 | 243 | ui_setYearLBL = lv_label_create(ui_setDate); 244 | lv_obj_set_width(ui_setYearLBL, LV_SIZE_CONTENT); /// 1 245 | lv_obj_set_height(ui_setYearLBL, LV_SIZE_CONTENT); /// 1 246 | lv_obj_set_x(ui_setYearLBL, 51); 247 | lv_obj_set_y(ui_setYearLBL, 14); 248 | lv_obj_set_align(ui_setYearLBL, LV_ALIGN_CENTER); 249 | lv_label_set_text(ui_setYearLBL, "25"); 250 | lv_obj_set_style_text_font(ui_setYearLBL, &ui_font_secs, LV_PART_MAIN | LV_STATE_DEFAULT); 251 | 252 | ui_setDowLBL = lv_label_create(ui_setDate); 253 | lv_obj_set_width(ui_setDowLBL, LV_SIZE_CONTENT); /// 1 254 | lv_obj_set_height(ui_setDowLBL, LV_SIZE_CONTENT); /// 1 255 | lv_obj_set_x(ui_setDowLBL, 140); 256 | lv_obj_set_y(ui_setDowLBL, 11); 257 | lv_obj_set_align(ui_setDowLBL, LV_ALIGN_CENTER); 258 | lv_label_set_text(ui_setDowLBL, "25"); 259 | lv_obj_set_style_text_font(ui_setDowLBL, &ui_font_secs, LV_PART_MAIN | LV_STATE_DEFAULT); 260 | 261 | ui_Label34 = lv_label_create(ui_setDate); 262 | lv_obj_set_width(ui_Label34, LV_SIZE_CONTENT); /// 1 263 | lv_obj_set_height(ui_Label34, LV_SIZE_CONTENT); /// 1 264 | lv_obj_set_x(ui_Label34, 39); 265 | lv_obj_set_y(ui_Label34, 169); 266 | lv_label_set_text(ui_Label34, " MONTH DAY YEAR WEEK D"); 267 | lv_obj_set_style_text_font(ui_Label34, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 268 | 269 | lv_obj_add_event_cb(ui_monthUP, ui_event_monthUP, LV_EVENT_ALL, NULL); 270 | lv_obj_add_event_cb(ui_Button1, ui_event_Button1, LV_EVENT_ALL, NULL); 271 | lv_obj_add_event_cb(ui_dayUp, ui_event_dayUp, LV_EVENT_ALL, NULL); 272 | lv_obj_add_event_cb(ui_monthDowm, ui_event_monthDowm, LV_EVENT_ALL, NULL); 273 | lv_obj_add_event_cb(ui_dayDown, ui_event_dayDown, LV_EVENT_ALL, NULL); 274 | lv_obj_add_event_cb(ui_saveDate, ui_event_saveDate, LV_EVENT_ALL, NULL); 275 | lv_obj_add_event_cb(ui_yearUp, ui_event_yearUp, LV_EVENT_ALL, NULL); 276 | lv_obj_add_event_cb(ui_yearDown, ui_event_yearDown, LV_EVENT_ALL, NULL); 277 | lv_obj_add_event_cb(ui_dowUp, ui_event_dowUp, LV_EVENT_ALL, NULL); 278 | lv_obj_add_event_cb(ui_dowDown, ui_event_dowDown, LV_EVENT_ALL, NULL); 279 | 280 | } 281 | -------------------------------------------------------------------------------- /waveClock/ui_setDate.c: -------------------------------------------------------------------------------- 1 | // This file was generated by SquareLine Studio 2 | // SquareLine Studio version: SquareLine Studio 1.3.4 3 | // LVGL version: 8.3.6 4 | // Project name: SquareLine_Project 5 | 6 | #include "ui.h" 7 | 8 | void ui_setDate_screen_init(void) 9 | { 10 | ui_setDate = lv_obj_create(NULL); 11 | lv_obj_clear_flag(ui_setDate, LV_OBJ_FLAG_SCROLLABLE); /// Flags 12 | lv_obj_set_style_bg_color(ui_setDate, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 13 | lv_obj_set_style_bg_opa(ui_setDate, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 14 | 15 | ui_monthUP = lv_obj_create(ui_setDate); 16 | lv_obj_set_width(ui_monthUP, 80); 17 | lv_obj_set_height(ui_monthUP, 50); 18 | lv_obj_set_x(ui_monthUP, -130); 19 | lv_obj_set_y(ui_monthUP, -76); 20 | lv_obj_set_align(ui_monthUP, LV_ALIGN_CENTER); 21 | lv_obj_clear_flag(ui_monthUP, LV_OBJ_FLAG_SCROLLABLE); /// Flags 22 | lv_obj_set_style_radius(ui_monthUP, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 23 | lv_obj_set_style_bg_color(ui_monthUP, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 24 | lv_obj_set_style_bg_opa(ui_monthUP, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 25 | lv_obj_set_style_border_width(ui_monthUP, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 26 | 27 | ui_Label4 = lv_label_create(ui_monthUP); 28 | lv_obj_set_width(ui_Label4, LV_SIZE_CONTENT); /// 1 29 | lv_obj_set_height(ui_Label4, LV_SIZE_CONTENT); /// 1 30 | lv_obj_set_align(ui_Label4, LV_ALIGN_CENTER); 31 | lv_label_set_text(ui_Label4, "+"); 32 | lv_obj_set_style_text_color(ui_Label4, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 33 | lv_obj_set_style_text_opa(ui_Label4, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 34 | lv_obj_set_style_text_font(ui_Label4, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 35 | 36 | ui_Button1 = lv_btn_create(ui_setDate); 37 | lv_obj_set_width(ui_Button1, 169); 38 | lv_obj_set_height(ui_Button1, 58); 39 | lv_obj_set_x(ui_Button1, 0); 40 | lv_obj_set_y(ui_Button1, 149); 41 | lv_obj_set_align(ui_Button1, LV_ALIGN_CENTER); 42 | lv_obj_add_flag(ui_Button1, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags 43 | lv_obj_clear_flag(ui_Button1, LV_OBJ_FLAG_SCROLLABLE); /// Flags 44 | lv_obj_set_style_bg_color(ui_Button1, lv_color_hex(0x292831), LV_PART_MAIN | LV_STATE_DEFAULT); 45 | lv_obj_set_style_bg_opa(ui_Button1, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 46 | lv_obj_set_style_border_width(ui_Button1, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 47 | 48 | ui_Label25 = lv_label_create(ui_Button1); 49 | lv_obj_set_width(ui_Label25, LV_SIZE_CONTENT); /// 1 50 | lv_obj_set_height(ui_Label25, LV_SIZE_CONTENT); /// 1 51 | lv_obj_set_align(ui_Label25, LV_ALIGN_CENTER); 52 | lv_label_set_text(ui_Label25, "HOME"); 53 | lv_obj_set_style_text_color(ui_Label25, lv_color_hex(0xB8C8D5), LV_PART_MAIN | LV_STATE_DEFAULT); 54 | lv_obj_set_style_text_opa(ui_Label25, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 55 | lv_obj_set_style_text_font(ui_Label25, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 56 | 57 | ui_dayUp = lv_obj_create(ui_setDate); 58 | lv_obj_set_width(ui_dayUp, 80); 59 | lv_obj_set_height(ui_dayUp, 50); 60 | lv_obj_set_x(ui_dayUp, -40); 61 | lv_obj_set_y(ui_dayUp, -76); 62 | lv_obj_set_align(ui_dayUp, LV_ALIGN_CENTER); 63 | lv_obj_clear_flag(ui_dayUp, LV_OBJ_FLAG_SCROLLABLE); /// Flags 64 | lv_obj_set_style_radius(ui_dayUp, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 65 | lv_obj_set_style_bg_color(ui_dayUp, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 66 | lv_obj_set_style_bg_opa(ui_dayUp, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 67 | lv_obj_set_style_border_width(ui_dayUp, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 68 | 69 | ui_Label26 = lv_label_create(ui_dayUp); 70 | lv_obj_set_width(ui_Label26, LV_SIZE_CONTENT); /// 1 71 | lv_obj_set_height(ui_Label26, LV_SIZE_CONTENT); /// 1 72 | lv_obj_set_align(ui_Label26, LV_ALIGN_CENTER); 73 | lv_label_set_text(ui_Label26, "+"); 74 | lv_obj_set_style_text_color(ui_Label26, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 75 | lv_obj_set_style_text_opa(ui_Label26, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 76 | lv_obj_set_style_text_font(ui_Label26, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 77 | 78 | ui_monthDowm = lv_obj_create(ui_setDate); 79 | lv_obj_set_width(ui_monthDowm, 80); 80 | lv_obj_set_height(ui_monthDowm, 50); 81 | lv_obj_set_x(ui_monthDowm, -130); 82 | lv_obj_set_y(ui_monthDowm, 67); 83 | lv_obj_set_align(ui_monthDowm, LV_ALIGN_CENTER); 84 | lv_obj_clear_flag(ui_monthDowm, LV_OBJ_FLAG_SCROLLABLE); /// Flags 85 | lv_obj_set_style_radius(ui_monthDowm, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 86 | lv_obj_set_style_bg_color(ui_monthDowm, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 87 | lv_obj_set_style_bg_opa(ui_monthDowm, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 88 | lv_obj_set_style_border_width(ui_monthDowm, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 89 | 90 | ui_Label27 = lv_label_create(ui_monthDowm); 91 | lv_obj_set_width(ui_Label27, LV_SIZE_CONTENT); /// 1 92 | lv_obj_set_height(ui_Label27, LV_SIZE_CONTENT); /// 1 93 | lv_obj_set_align(ui_Label27, LV_ALIGN_CENTER); 94 | lv_label_set_text(ui_Label27, "-"); 95 | lv_obj_set_style_text_color(ui_Label27, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 96 | lv_obj_set_style_text_opa(ui_Label27, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 97 | lv_obj_set_style_text_font(ui_Label27, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 98 | 99 | ui_dayDown = lv_obj_create(ui_setDate); 100 | lv_obj_set_width(ui_dayDown, 80); 101 | lv_obj_set_height(ui_dayDown, 50); 102 | lv_obj_set_x(ui_dayDown, -40); 103 | lv_obj_set_y(ui_dayDown, 67); 104 | lv_obj_set_align(ui_dayDown, LV_ALIGN_CENTER); 105 | lv_obj_clear_flag(ui_dayDown, LV_OBJ_FLAG_SCROLLABLE); /// Flags 106 | lv_obj_set_style_radius(ui_dayDown, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 107 | lv_obj_set_style_bg_color(ui_dayDown, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 108 | lv_obj_set_style_bg_opa(ui_dayDown, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 109 | lv_obj_set_style_border_width(ui_dayDown, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 110 | 111 | ui_Label28 = lv_label_create(ui_dayDown); 112 | lv_obj_set_width(ui_Label28, LV_SIZE_CONTENT); /// 1 113 | lv_obj_set_height(ui_Label28, LV_SIZE_CONTENT); /// 1 114 | lv_obj_set_align(ui_Label28, LV_ALIGN_CENTER); 115 | lv_label_set_text(ui_Label28, "-"); 116 | lv_obj_set_style_text_color(ui_Label28, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 117 | lv_obj_set_style_text_opa(ui_Label28, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 118 | lv_obj_set_style_text_font(ui_Label28, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 119 | 120 | ui_saveDate = lv_obj_create(ui_setDate); 121 | lv_obj_set_width(ui_saveDate, 139); 122 | lv_obj_set_height(ui_saveDate, 50); 123 | lv_obj_set_x(ui_saveDate, -4); 124 | lv_obj_set_y(ui_saveDate, -144); 125 | lv_obj_set_align(ui_saveDate, LV_ALIGN_CENTER); 126 | lv_obj_clear_flag(ui_saveDate, LV_OBJ_FLAG_SCROLLABLE); /// Flags 127 | lv_obj_set_style_radius(ui_saveDate, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 128 | lv_obj_set_style_bg_color(ui_saveDate, lv_color_hex(0x64144B), LV_PART_MAIN | LV_STATE_DEFAULT); 129 | lv_obj_set_style_bg_opa(ui_saveDate, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 130 | lv_obj_set_style_border_width(ui_saveDate, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 131 | 132 | ui_Label29 = lv_label_create(ui_saveDate); 133 | lv_obj_set_width(ui_Label29, LV_SIZE_CONTENT); /// 1 134 | lv_obj_set_height(ui_Label29, LV_SIZE_CONTENT); /// 1 135 | lv_obj_set_align(ui_Label29, LV_ALIGN_CENTER); 136 | lv_label_set_text(ui_Label29, "SAVE"); 137 | lv_obj_set_style_text_color(ui_Label29, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 138 | lv_obj_set_style_text_opa(ui_Label29, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 139 | lv_obj_set_style_text_font(ui_Label29, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 140 | 141 | ui_setMonthLBL = lv_label_create(ui_setDate); 142 | lv_obj_set_width(ui_setMonthLBL, LV_SIZE_CONTENT); /// 1 143 | lv_obj_set_height(ui_setMonthLBL, LV_SIZE_CONTENT); /// 1 144 | lv_obj_set_x(ui_setMonthLBL, -128); 145 | lv_obj_set_y(ui_setMonthLBL, 12); 146 | lv_obj_set_align(ui_setMonthLBL, LV_ALIGN_CENTER); 147 | lv_label_set_text(ui_setMonthLBL, "25"); 148 | lv_obj_set_style_text_font(ui_setMonthLBL, &ui_font_secs, LV_PART_MAIN | LV_STATE_DEFAULT); 149 | 150 | ui_setDayLBL = lv_label_create(ui_setDate); 151 | lv_obj_set_width(ui_setDayLBL, LV_SIZE_CONTENT); /// 1 152 | lv_obj_set_height(ui_setDayLBL, LV_SIZE_CONTENT); /// 1 153 | lv_obj_set_x(ui_setDayLBL, -38); 154 | lv_obj_set_y(ui_setDayLBL, 14); 155 | lv_obj_set_align(ui_setDayLBL, LV_ALIGN_CENTER); 156 | lv_label_set_text(ui_setDayLBL, "25"); 157 | lv_obj_set_style_text_font(ui_setDayLBL, &ui_font_secs, LV_PART_MAIN | LV_STATE_DEFAULT); 158 | 159 | ui_yearUp = lv_obj_create(ui_setDate); 160 | lv_obj_set_width(ui_yearUp, 80); 161 | lv_obj_set_height(ui_yearUp, 50); 162 | lv_obj_set_x(ui_yearUp, 50); 163 | lv_obj_set_y(ui_yearUp, -76); 164 | lv_obj_set_align(ui_yearUp, LV_ALIGN_CENTER); 165 | lv_obj_clear_flag(ui_yearUp, LV_OBJ_FLAG_SCROLLABLE); /// Flags 166 | lv_obj_set_style_radius(ui_yearUp, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 167 | lv_obj_set_style_bg_color(ui_yearUp, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 168 | lv_obj_set_style_bg_opa(ui_yearUp, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 169 | lv_obj_set_style_border_width(ui_yearUp, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 170 | 171 | ui_Label30 = lv_label_create(ui_yearUp); 172 | lv_obj_set_width(ui_Label30, LV_SIZE_CONTENT); /// 1 173 | lv_obj_set_height(ui_Label30, LV_SIZE_CONTENT); /// 1 174 | lv_obj_set_align(ui_Label30, LV_ALIGN_CENTER); 175 | lv_label_set_text(ui_Label30, "+"); 176 | lv_obj_set_style_text_color(ui_Label30, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 177 | lv_obj_set_style_text_opa(ui_Label30, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 178 | lv_obj_set_style_text_font(ui_Label30, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 179 | 180 | ui_yearDown = lv_obj_create(ui_setDate); 181 | lv_obj_set_width(ui_yearDown, 80); 182 | lv_obj_set_height(ui_yearDown, 50); 183 | lv_obj_set_x(ui_yearDown, 50); 184 | lv_obj_set_y(ui_yearDown, 67); 185 | lv_obj_set_align(ui_yearDown, LV_ALIGN_CENTER); 186 | lv_obj_clear_flag(ui_yearDown, LV_OBJ_FLAG_SCROLLABLE); /// Flags 187 | lv_obj_set_style_radius(ui_yearDown, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 188 | lv_obj_set_style_bg_color(ui_yearDown, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 189 | lv_obj_set_style_bg_opa(ui_yearDown, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 190 | lv_obj_set_style_border_width(ui_yearDown, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 191 | 192 | ui_Label31 = lv_label_create(ui_yearDown); 193 | lv_obj_set_width(ui_Label31, LV_SIZE_CONTENT); /// 1 194 | lv_obj_set_height(ui_Label31, LV_SIZE_CONTENT); /// 1 195 | lv_obj_set_align(ui_Label31, LV_ALIGN_CENTER); 196 | lv_label_set_text(ui_Label31, "-"); 197 | lv_obj_set_style_text_color(ui_Label31, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 198 | lv_obj_set_style_text_opa(ui_Label31, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 199 | lv_obj_set_style_text_font(ui_Label31, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 200 | 201 | ui_dowUp = lv_obj_create(ui_setDate); 202 | lv_obj_set_width(ui_dowUp, 80); 203 | lv_obj_set_height(ui_dowUp, 50); 204 | lv_obj_set_x(ui_dowUp, 140); 205 | lv_obj_set_y(ui_dowUp, -76); 206 | lv_obj_set_align(ui_dowUp, LV_ALIGN_CENTER); 207 | lv_obj_clear_flag(ui_dowUp, LV_OBJ_FLAG_SCROLLABLE); /// Flags 208 | lv_obj_set_style_radius(ui_dowUp, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 209 | lv_obj_set_style_bg_color(ui_dowUp, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 210 | lv_obj_set_style_bg_opa(ui_dowUp, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 211 | lv_obj_set_style_border_width(ui_dowUp, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 212 | 213 | ui_Label32 = lv_label_create(ui_dowUp); 214 | lv_obj_set_width(ui_Label32, LV_SIZE_CONTENT); /// 1 215 | lv_obj_set_height(ui_Label32, LV_SIZE_CONTENT); /// 1 216 | lv_obj_set_align(ui_Label32, LV_ALIGN_CENTER); 217 | lv_label_set_text(ui_Label32, "+"); 218 | lv_obj_set_style_text_color(ui_Label32, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 219 | lv_obj_set_style_text_opa(ui_Label32, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 220 | lv_obj_set_style_text_font(ui_Label32, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 221 | 222 | ui_dowDown = lv_obj_create(ui_setDate); 223 | lv_obj_set_width(ui_dowDown, 80); 224 | lv_obj_set_height(ui_dowDown, 50); 225 | lv_obj_set_x(ui_dowDown, 140); 226 | lv_obj_set_y(ui_dowDown, 67); 227 | lv_obj_set_align(ui_dowDown, LV_ALIGN_CENTER); 228 | lv_obj_clear_flag(ui_dowDown, LV_OBJ_FLAG_SCROLLABLE); /// Flags 229 | lv_obj_set_style_radius(ui_dowDown, 4, LV_PART_MAIN | LV_STATE_DEFAULT); 230 | lv_obj_set_style_bg_color(ui_dowDown, lv_color_hex(0xAEC7DC), LV_PART_MAIN | LV_STATE_DEFAULT); 231 | lv_obj_set_style_bg_opa(ui_dowDown, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 232 | lv_obj_set_style_border_width(ui_dowDown, 0, LV_PART_MAIN | LV_STATE_DEFAULT); 233 | 234 | ui_Label33 = lv_label_create(ui_dowDown); 235 | lv_obj_set_width(ui_Label33, LV_SIZE_CONTENT); /// 1 236 | lv_obj_set_height(ui_Label33, LV_SIZE_CONTENT); /// 1 237 | lv_obj_set_align(ui_Label33, LV_ALIGN_CENTER); 238 | lv_label_set_text(ui_Label33, "-"); 239 | lv_obj_set_style_text_color(ui_Label33, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT); 240 | lv_obj_set_style_text_opa(ui_Label33, 255, LV_PART_MAIN | LV_STATE_DEFAULT); 241 | lv_obj_set_style_text_font(ui_Label33, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 242 | 243 | ui_setYearLBL = lv_label_create(ui_setDate); 244 | lv_obj_set_width(ui_setYearLBL, LV_SIZE_CONTENT); /// 1 245 | lv_obj_set_height(ui_setYearLBL, LV_SIZE_CONTENT); /// 1 246 | lv_obj_set_x(ui_setYearLBL, 51); 247 | lv_obj_set_y(ui_setYearLBL, 14); 248 | lv_obj_set_align(ui_setYearLBL, LV_ALIGN_CENTER); 249 | lv_label_set_text(ui_setYearLBL, "25"); 250 | lv_obj_set_style_text_font(ui_setYearLBL, &ui_font_secs, LV_PART_MAIN | LV_STATE_DEFAULT); 251 | 252 | ui_setDowLBL = lv_label_create(ui_setDate); 253 | lv_obj_set_width(ui_setDowLBL, LV_SIZE_CONTENT); /// 1 254 | lv_obj_set_height(ui_setDowLBL, LV_SIZE_CONTENT); /// 1 255 | lv_obj_set_x(ui_setDowLBL, 140); 256 | lv_obj_set_y(ui_setDowLBL, 11); 257 | lv_obj_set_align(ui_setDowLBL, LV_ALIGN_CENTER); 258 | lv_label_set_text(ui_setDowLBL, "25"); 259 | lv_obj_set_style_text_font(ui_setDowLBL, &ui_font_secs, LV_PART_MAIN | LV_STATE_DEFAULT); 260 | 261 | ui_Label34 = lv_label_create(ui_setDate); 262 | lv_obj_set_width(ui_Label34, LV_SIZE_CONTENT); /// 1 263 | lv_obj_set_height(ui_Label34, LV_SIZE_CONTENT); /// 1 264 | lv_obj_set_x(ui_Label34, 39); 265 | lv_obj_set_y(ui_Label34, 169); 266 | lv_label_set_text(ui_Label34, " MONTH DAY YEAR WEEK D"); 267 | lv_obj_set_style_text_font(ui_Label34, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); 268 | 269 | lv_obj_add_event_cb(ui_monthUP, ui_event_monthUP, LV_EVENT_ALL, NULL); 270 | lv_obj_add_event_cb(ui_Button1, ui_event_Button1, LV_EVENT_ALL, NULL); 271 | lv_obj_add_event_cb(ui_dayUp, ui_event_dayUp, LV_EVENT_ALL, NULL); 272 | lv_obj_add_event_cb(ui_monthDowm, ui_event_monthDowm, LV_EVENT_ALL, NULL); 273 | lv_obj_add_event_cb(ui_dayDown, ui_event_dayDown, LV_EVENT_ALL, NULL); 274 | lv_obj_add_event_cb(ui_saveDate, ui_event_saveDate, LV_EVENT_ALL, NULL); 275 | lv_obj_add_event_cb(ui_yearUp, ui_event_yearUp, LV_EVENT_ALL, NULL); 276 | lv_obj_add_event_cb(ui_yearDown, ui_event_yearDown, LV_EVENT_ALL, NULL); 277 | lv_obj_add_event_cb(ui_dowUp, ui_event_dowUp, LV_EVENT_ALL, NULL); 278 | lv_obj_add_event_cb(ui_dowDown, ui_event_dowDown, LV_EVENT_ALL, NULL); 279 | 280 | } 281 | --------------------------------------------------------------------------------