Skip to content

Commit

Permalink
- Add skeleton for RV-8263-C8 RTC
Browse files Browse the repository at this point in the history
- Rename display driver to match it with the vendor_type scheme of the other drivers
- Remove Funkytown song from Buzzer driver
- Disable selecting of the step counter and battery arc in digital watchface
- Reorganize Kconfig and move the application configuration into the "Applications" menu
  • Loading branch information
Kampi committed May 27, 2024
1 parent 8152f4b commit 69801cb
Show file tree
Hide file tree
Showing 27 changed files with 857 additions and 101 deletions.
48 changes: 25 additions & 23 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,31 @@ menu "ZSWatch"
bool
prompt "Activate the application 'PPT remote'"
default n

menu "Configuration"
menu "Compass"
depends on APPLICATIONS_USE_COMPASS

config APPLICATIONS_CONFIGURATION_COMPASS_REFRESH_INTERVAL_MS
int
prompt "Refresh interval in milliseconds"
default 50

config APPLICATIONS_CONFIGURATION_COMPASS_CALIBRATION_TIME_S
int
prompt "Calibration time in seconds"
default 30
endmenu

menu "Sensors Summary"
depends on APPLICATIONS_USE_SENSORS_SUMMARY

config APPLICATIONS_CONFIGURATION_SENSORS_SUMMARY_REFRESH_INTERVAL_MS
int
prompt "Refresh interval in milliseconds"
default 100
endmenu
endmenu
endmenu

menu "Watchface"
Expand Down Expand Up @@ -111,29 +136,6 @@ menu "ZSWatch"
default 85
endmenu

menu "Sensors Summary"
depends on APPLICATIONS_USE_SENSORS_SUMMARY

config DEFAULT_CONFIGURATION_SENSORS_SUMMARY_REFRESH_INTERVAL_MS
int
prompt "Refresh interval in milliseconds"
default 100
endmenu

menu "Compass"
depends on APPLICATIONS_USE_COMPASS

config DEFAULT_CONFIGURATION_COMPASS_REFRESH_INTERVAL_MS
int
prompt "Refresh interval in milliseconds"
default 50

config DEFAULT_CONFIGURATION_COMPASS_CALIBRATION_TIME_S
int
prompt "Calibration time in seconds"
default 30
endmenu

menu "Power Management"
config POWER_MANAGEMENT_IDLE_TIMEOUT_SECONDS
int
Expand Down
4 changes: 2 additions & 2 deletions app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_5.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
CONFIG_ZSWATCH_PCB_REV=5
CONFIG_BT_DIS_HW_REV_STR="5"

#---------------
# FLASH
#-----------------
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_STREAM_FLASH=y
Expand Down Expand Up @@ -49,3 +47,5 @@ CONFIG_NVS=y

CONFIG_DEBUG_COREDUMP_BACKEND_OTHER=y

CONFIG_RTC=y
CONFIG_RTC_ALARM=y
59 changes: 40 additions & 19 deletions app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_5.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<NRF_PSEL(QSPI_IO3, 0, 16)>;
low-power-enable;
};

group2 {
psels = <NRF_PSEL(QSPI_CSN, 0, 18)>;
low-power-enable;
Expand Down Expand Up @@ -125,21 +126,25 @@

buttons: buttons {
compatible = "gpio-keys";

button1: button_1 {
label = "top-right";
gpios = <&gpio0 27 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_1>;
};

button2: button_2 {
label = "bottom-left";
gpios = <&gpio1 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_2>;
};

button3: button_3 {
label = "bottom-right";
gpios = <&gpio0 31 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_KP0>;
};

button4: button_4 {
label = "top-left";
gpios = <&gpio0 26 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
Expand Down Expand Up @@ -167,12 +172,15 @@

pwmleds {
compatible = "pwm-leds";

display_blk: pwm_led_0 {
pwms = <&pwm0 0 PWM_USEC(15) PWM_POLARITY_INVERTED>;
};

vibrator_pwm: pwm_led_1 {
pwms = <&pwm1 0 PWM_MSEC(20) 0>;
};

buzzer_pwm: pwm_led_2 {
pwms = <&pwm2 0 PWM_HZ(880) PWM_POLARITY_NORMAL>;
};
Expand All @@ -181,25 +189,33 @@
};

&i2c1 {
bmi270: bmi270@68 {
compatible = "bosch,bmi270-plus";
reg = <0x68>;
status = "okay";
int-gpios = <&gpio1 4 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
// NOTE: The swap is performed AFTER the axis inversion. So we have to invert the y axis of the sensor
// to get the x axis of the watch coordinate system.
swap-xy;
invert-y;
};
rv_8263_c8: rv-8263-c8@A2 {
compatible = "microcrystal,rv-8263-c8";
reg = <0xA2>;
status = "okay";
clkout = <7>;
};

bmi270: bmi270@68 {
compatible = "bosch,bmi270-plus";
reg = <0x68>;
status = "okay";
int-gpios = <&gpio1 4 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
// NOTE: The swap is performed AFTER the axis inversion. So we have to invert the y axis of the sensor
// to get the x axis of the watch coordinate system.
swap-xy;
invert-y;
};

apds9306: apds9306@52 {
compatible = "avago,apds9306";
reg = <0x52>;
status = "okay";
gain = <0>;
resolution = <0>;
frequency = <0>;
};

apds9306: apds9306@52 {
compatible = "avago,apds9306";
reg = <0x52>;
status = "okay";
gain = <0>;
resolution = <0>;
frequency = <0>;
};
npm1300_ek_pmic: pmic@6b {
compatible = "nordic,npm1300";
reg = <0x6b>;
Expand Down Expand Up @@ -253,6 +269,7 @@
thermistor-beta = <3380>;
charging-enable;
};

npm1300_ek_buttons: buttons {
compatible = "gpio-keys";
status = "disabled";
Expand Down Expand Up @@ -286,6 +303,7 @@
pinctrl-0 = <&qspi_default>;
pinctrl-1 = <&qspi_sleep>;
pinctrl-names = "default", "sleep";

gd25lq128d: gd25lq128d@0 {
compatible = "nordic,qspi-nor";
reg = <0>;
Expand All @@ -309,6 +327,7 @@
/ {
fstab {
compatible = "zephyr,fstab";

lvgl_lfs: lvgl_lfs {
compatible = "zephyr,fstab,littlefs";
mount-point = "/lvgl_lfs";
Expand Down Expand Up @@ -336,13 +355,15 @@
label = "littlefs_storage";
reg = <0x00000000 0x00200000>;
};

lvgl_raw_partition: partition@200000 {
label = "lvgl_raw_partition";
reg = <0x00200000 0x00200000>;
};

storage_partition: partition@400000 {
label = "storage_partition";
reg = <0x400000 0x100000 >;
};
};
};
};
1 change: 1 addition & 0 deletions app/drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
add_subdirectory(display)
add_subdirectory(input)
add_subdirectory(rtc)

add_subdirectory_ifdef(CONFIG_SENSOR sensor)
6 changes: 2 additions & 4 deletions app/drivers/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
rsource "display/Kconfig"
rsource "input/Kconfig"

menu "Drivers"
rsource "sensor/Kconfig"
endmenu
rsource "rtc/Kconfig"
rsource "sensor/Kconfig"
2 changes: 1 addition & 1 deletion app/drivers/display/gc9a01/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
zephyr_sources(gc9a01.c)
zephyr_sources(buydisplay_gc9a01.c)
2 changes: 1 addition & 1 deletion app/drivers/display/gc9a01/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
menuconfig GC9A01
bool "GC9A01 compatible display controller driver"
bool "GC9A01 Display"
default n
select SPI
help
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions app/drivers/input/cst816s/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0

menuconfig INPUT_MODIFIED_CST816S
bool "Use modified out of tree CST816S capacitive touch panel driver"
bool "CST816S Capacitive touch panel driver"
default y
depends on DT_HAS_HYNITRON_CST816S_ENABLED
select I2C
Expand All @@ -26,4 +26,4 @@ config INPUT_CST816S_INTERRUPT
help
Enable interrupt support (requires GPIO).

endif # INPUT_CST816S
endif
6 changes: 6 additions & 0 deletions app/drivers/rtc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2024, Daniel Kampert
#
# SPDX-License-Identifier: Apache-2.0
#

add_subdirectory_ifdef(CONFIG_RV_8263_C8 rv8263c8)
3 changes: 3 additions & 0 deletions app/drivers/rtc/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if RTC
rsource "rv8263c8/Kconfig"
endif
7 changes: 7 additions & 0 deletions app/drivers/rtc/rv8263c8/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright (c) 2024, Daniel Kampert
#
# SPDX-License-Identifier: Apache-2.0
#

zephyr_sources(microcrystal_rv8263c8.c)
zephyr_sources(interrupt/microcrystal_rv8263c8_interrupt.c)
58 changes: 58 additions & 0 deletions app/drivers/rtc/rv8263c8/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# RV-8263-C8 RTC configuration options.

# Copyright (c) 240, Daniel Kampert
#
# SPDX-License-Identifier: Apache-2.0

menuconfig RV_8263_C8
bool "RV-8263-C8 RTC"
depends on DT_HAS_MICROCRYSTAL_RV_8263_C8_ENABLED
default y
select I2C
help
Enable the driver for the RV-8263-C8 RTC.

if RV_8263_C8

module = MICROCRYSTAL_RV_8263_C8
module-str = MICROCRYSTAL_RV_8263_C8
source "subsys/logging/Kconfig.template.log_config"

config RV_8263_C8_THREAD_STACK_SIZE
int "RTC delayed work thread stack size"
depends on RV_8263_C8_INTERRUPT_OWN_THREAD
default 1024

config RV_8263_C8_THREAD_PRIORITY
int "RV-8263-C8 thread priority"
depends on RV_8263_C8_INTERRUPT_OWN_THREAD
default 10

choice
prompt "RV-8263-C8 interrupt mode"
default RV_8263_C8_INTERRUPT_NONE

config RV_8263_C8_INTERRUPT_NONE
bool "No interrupt"
help
Disable the INTERRUPT interface.

config RV_8263_C8_INTERRUPT_GLOBAL_THREAD
depends on GPIO
select RV_8263_C8_INTERRUPT
bool "Use workqueue"
help
Use the global workqueue to process the interrupts from the RV-8263-C8.

config RV_8263_C8_INTERRUPT_OWN_THREAD
depends on GPIO
select RV_8263_C8_INTERRUPT
bool "Use driver thread"
help
Use a separate thread to process the interrupts from the RV-8263-C8.
endchoice

config RV_8263_C8_INTERRUPT
bool

endif
Loading

0 comments on commit 69801cb

Please sign in to comment.