Skip to content

Commit d75770d

Browse files
feat: implement the timer based datetime
Within this commit, we enable the clock to track the time using the kernel timers in Zephyr. It is neccessary since counters and RTCs are not supported in the Zephyr's SDK.
1 parent 9bdd146 commit d75770d

28 files changed

+268
-1101
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
set(BOARD esp32s3_touch_lcd_1_28/esp32s3/procpu)
2+
set(DTC_OVERLAY_FILE boards/esp32.overlay)
23

34
cmake_minimum_required(VERSION 3.20.0)
45
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
@@ -7,5 +8,4 @@ project(Esp32SmartWatch)
78
file(GLOB_RECURSE app_sources src/*.c)
89

910
target_sources(app PRIVATE ${app_sources})
10-
target_include_directories(app PRIVATE inc)
11-
11+
target_include_directories(app PRIVATE src/)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
west build -p always . --board esp32s3_touch_lcd_1_28/esp32s3/procpu
2+
west blobs fetch hal_espressif

boards/esp32.overlay

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
&timer0 {
2+
status = "okay";
3+
};

prj.conf

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
# Important for LVGL to work.
2-
CONFIG_MAIN_STACK_SIZE=4096
3-
CONFIG_LV_MEM_CUSTOM=y
4-
CONFIG_LV_Z_MEM_POOL_SIZE=16384
5-
61
# Display Configurations
72
CONFIG_DISPLAY=y
83
CONFIG_DISPLAY_LOG_LEVEL_ERR=y
@@ -20,40 +15,52 @@ CONFIG_LV_USE_LOG=n
2015
CONFIG_LVGL=y
2116
CONFIG_LV_FONT_MONTSERRAT_46=y
2217
CONFIG_LV_FONT_MONTSERRAT_18=y
18+
# Important for LVGL to work.
19+
CONFIG_MAIN_STACK_SIZE=4096
20+
# CONFIG_LV_MEM_CUSTOM=y
21+
CONFIG_LV_Z_MEM_POOL_SIZE=16384
2322

2423
# PWM Configurations
2524
CONFIG_PWM=y
2625

2726
# Bluetooth Configurations
28-
CONFIG_BT=y
29-
CONFIG_BT_PERIPHERAL=y
30-
CONFIG_BT_SETTINGS=y
31-
CONFIG_BT_DEVICE_NAME="ZephyrWatch"
32-
CONFIG_BT_SMP=y
33-
CONFIG_BT_SIGNING=y
34-
CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
35-
CONFIG_BT_PRIVACY=y
27+
# CONFIG_BT=y
28+
# CONFIG_BT_PERIPHERAL=y
29+
# CONFIG_BT_SETTINGS=y
30+
# CONFIG_BT_DEVICE_NAME="ZephyrWatch"
31+
# CONFIG_BT_SMP=y
32+
# CONFIG_BT_SIGNING=y
33+
# CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
34+
# CONFIG_BT_PRIVACY=y
3635

3736
# Bluetooth GATT Device Information Service Configuration
38-
CONFIG_BT_DIS=y
39-
CONFIG_BT_DIS_PNP=n
40-
CONFIG_BT_DIS_MODEL="ZephyrWatch_001"
41-
CONFIG_BT_DIS_MANUF="github.com/electricalgorithm"
42-
CONFIG_BT_DIS_SERIAL_NUMBER=y
43-
CONFIG_BT_DIS_FW_REV=y
44-
CONFIG_BT_DIS_HW_REV=y
45-
CONFIG_BT_DIS_SW_REV=y
46-
CONFIG_BT_DIS_SERIAL_NUMBER_STR="0.0.1"
47-
CONFIG_BT_DIS_FW_REV_STR="0.0.1"
48-
CONFIG_BT_DIS_HW_REV_STR="0.0.1"
49-
CONFIG_BT_DIS_SW_REV_STR="0.0.1"
50-
CONFIG_BT_DIS_SETTINGS=y
51-
CONFIG_BT_DIS_STR_MAX=21
37+
# CONFIG_BT_DIS=y
38+
# CONFIG_BT_DIS_PNP=n
39+
# CONFIG_BT_DIS_MODEL="ZephyrWatch_001"
40+
# CONFIG_BT_DIS_MANUF="github.com/electricalgorithm"
41+
# CONFIG_BT_DIS_SERIAL_NUMBER=y
42+
# CONFIG_BT_DIS_FW_REV=y
43+
# CONFIG_BT_DIS_HW_REV=y
44+
# CONFIG_BT_DIS_SW_REV=y
45+
# CONFIG_BT_DIS_SERIAL_NUMBER_STR="0.0.1"
46+
# CONFIG_BT_DIS_FW_REV_STR="0.0.1"
47+
# CONFIG_BT_DIS_HW_REV_STR="0.0.1"
48+
# CONFIG_BT_DIS_SW_REV_STR="0.0.1"
49+
# CONFIG_BT_DIS_SETTINGS=y
50+
# CONFIG_BT_DIS_STR_MAX=21
5251

5352
# Flash Configurations
5453
CONFIG_FLASH=y
5554
CONFIG_FLASH_MAP=y
5655
CONFIG_NVS=y
5756

57+
# Counter
58+
CONFIG_TIMER=y
59+
5860
# RTC
59-
CONFIG_RTC=y
61+
# CONFIG_RTC=y
62+
# CONFIG_CLOCK_CONTROL=y
63+
# CONFIG_CLOCK_CONTROL_ESP32=y
64+
# CONFIG_RTC_ALARM=y
65+
# CONFIG_RTC_UPDATE=y
66+
# CONFIG_RTC_CALIBRATION=y

src/bluetooth/bluetooth_infra.c

Lines changed: 0 additions & 81 deletions
This file was deleted.

src/bluetooth/bluetooth_infra.h

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/bluetooth/current_time_service.c

Lines changed: 0 additions & 83 deletions
This file was deleted.

src/bluetooth/current_time_service.h

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/display/display.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "lvgl.h"
2+
#include "display/display.h"
3+
4+
5+
void display_init() {
6+
lv_disp_t *display = lv_disp_get_default();
7+
lv_theme_t *theme = lv_theme_default_init(
8+
display,
9+
lv_palette_main(LV_PALETTE_BLUE),
10+
lv_palette_main(LV_PALETTE_RED),
11+
true,
12+
LV_FONT_DEFAULT
13+
);
14+
lv_disp_set_theme(display, theme);
15+
home_screen_init();
16+
lv_disp_load_scr(home_screen);
17+
}

src/display/display.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef _SMART_WATCH_UI_UI_H
2+
#define _SMART_WATCH_UI_UI_H
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
#include "lvgl.h"
9+
#include "display/screens/home/home.h"
10+
11+
void display_init();
12+
13+
#ifdef __cplusplus
14+
} // extern "C"
15+
#endif
16+
17+
#endif

0 commit comments

Comments
 (0)