diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 2135edf2..83063d55 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.20.0) string(REGEX MATCH "zswatch_nrf5340_cpuapp(_ns)?@([0-9]+)$" ZSWATCH_BOARD "${BOARD}") if(ZSWATCH_BOARD) set(ZSWATCH_REV ${CMAKE_MATCH_2}) - add_definitions(-DZSWATCH_REV=${ZSWATCH_REV}) # Rev 3 and later will handle this later in a different way. if(${ZSWATCH_REV} EQUAL 2) set(DFU_BUILD true) @@ -25,6 +24,8 @@ add_subdirectory(src/managers) add_subdirectory(src/drivers) add_subdirectory(src/ble) add_subdirectory(src/battery) +add_subdirectory(src/images) +add_subdirectory(src/images/fonts) add_subdirectory(src/ext_drivers/bmi270) include_directories(src/) @@ -48,12 +49,6 @@ if (DFU_BUILD) target_sources(app PRIVATE src/dfu.c) endif() -FILE(GLOB img_sources src/images/*.c) -target_sources(app PRIVATE ${img_sources}) - -FILE(GLOB font_sources src/images/fonts/*.c) -target_sources(app PRIVATE ${font_sources}) - zephyr_sources_ifdef(CONFIG_WATCHFACE_ANALOG src/ui/watchfaces/zsw_watchface_analog_ui.c) zephyr_sources_ifdef(CONFIG_WATCHFACE_DIGITAL src/ui/watchfaces/zsw_watchface_digital_ui.c) zephyr_sources_ifdef(CONFIG_WATCHFACE_MINIMAL src/ui/watchfaces/zsw_watchface_minimal_ui.c) diff --git a/app/Kconfig b/app/Kconfig index 74d15d88..f13e136b 100644 --- a/app/Kconfig +++ b/app/Kconfig @@ -3,6 +3,11 @@ menu "Zephyr Kernel" endmenu menu "ZSWatch" + config ZSWATCH_PCB_REV + int + prompt "ZSWatch PCB revision" + default 3 + menu "Applications" config APPLICATIONS_USE_2048 bool @@ -202,8 +207,6 @@ menu "ZSWatch" endmenu endmenu - - module = APP module-str = APP source "subsys/logging/Kconfig.template.log_config" \ No newline at end of file diff --git a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_1.conf b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_1.conf index e69de29b..94035d80 100644 --- a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_1.conf +++ b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_1.conf @@ -0,0 +1,3 @@ +CONFIG_ZSWATCH_PCB_REV=1 + +CONFIG_BMI270=y \ No newline at end of file diff --git a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_2.conf b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_2.conf index e69de29b..b41d816a 100644 --- a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_2.conf +++ b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_2.conf @@ -0,0 +1,3 @@ +CONFIG_ZSWATCH_PCB_REV=2 + +CONFIG_BMI270=y \ No newline at end of file diff --git a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_3.conf b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_3.conf index 3489b44a..25f1f06c 100644 --- a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_3.conf +++ b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_3.conf @@ -1,3 +1,5 @@ +CONFIG_ZSWATCH_PCB_REV=3 + #--------------- # FLASH #----------------- @@ -5,7 +7,6 @@ CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_STREAM_FLASH=y CONFIG_FLASH_MAP=y -CONFIG_NVS=y CONFIG_SPI_NOR=y CONFIG_SPI_NOR_SFDP_RUNTIME=y CONFIG_SPI_NOR_IDLE_IN_DPD=y @@ -25,4 +26,6 @@ CONFIG_FILE_SYSTEM_LITTLEFS=y CONFIG_LV_Z_USE_FILESYSTEM=y CONFIG_LV_IMG_CACHE_DEF_SIZE=10 -CONFIG_FS_LITTLEFS_FC_HEAP_SIZE=16384 \ No newline at end of file +CONFIG_FS_LITTLEFS_FC_HEAP_SIZE=16384 + +CONFIG_BMI270=y \ No newline at end of file diff --git a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_defconfig b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_defconfig index cfa668e3..e7abacfa 100644 --- a/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_defconfig +++ b/app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_defconfig @@ -9,12 +9,20 @@ CONFIG_ZBUS_RUNTIME_OBSERVERS=y CONFIG_ZBUS_CHANNEL_NAME=y CONFIG_ZBUS_OBSERVER_NAME=y +CONFIG_ASSERT=y +CONFIG_REBOOT=y +CONFIG_BASE64=y + CONFIG_SENSOR=y CONFIG_INPUT=y CONFIG_DISPLAY=y +CONFIG_SETTINGS=y +CONFIG_NVS=y +CONFIG_SETTINGS_NVS=y + # Enable MPU CONFIG_ARM_MPU=y @@ -43,4 +51,7 @@ CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y # Ensure GPIO P0.01 and P0.00 can be used CONFIG_SOC_ENABLE_LFXO=n -CONFIG_BMP581=y \ No newline at end of file +CONFIG_BMP581=y + +CONFIG_LIS2MDL=y +CONFIG_LIS2MDL_MAG_ODR_RUNTIME=y \ No newline at end of file diff --git a/app/prj.conf b/app/prj.conf index 74ee4b22..e9adaee7 100644 --- a/app/prj.conf +++ b/app/prj.conf @@ -4,18 +4,10 @@ CONFIG_HEAP_MEM_POOL_SIZE=25000 CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y CONFIG_CBPRINTF_FP_SUPPORT=y -CONFIG_ASSERT=y -CONFIG_REBOOT=y -CONFIG_BASE64=y - CONFIG_RETAINED_MEM=y CONFIG_RETENTION=y CONFIG_RETENTION_BOOT_MODE=y -CONFIG_BMI270=n -CONFIG_LIS2MDL=y -CONFIG_LIS2MDL_MAG_ODR_RUNTIME=y - CONFIG_PINCTRL=y CONFIG_PM_DEVICE=y CONFIG_PM_DEVICE_RUNTIME=y @@ -102,10 +94,6 @@ CONFIG_MPU_ALLOW_FLASH_WRITE=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_FLASH_MAP_LABELS=y -CONFIG_SETTINGS=y -CONFIG_NVS=y -CONFIG_SETTINGS_NVS=y - # Bluetooth CONFIG_BT=y CONFIG_BT_HCI=y diff --git a/app/src/images/CMakeLists.txt b/app/src/images/CMakeLists.txt new file mode 100644 index 00000000..112f06a8 --- /dev/null +++ b/app/src/images/CMakeLists.txt @@ -0,0 +1,2 @@ +FILE(GLOB image_sources *.c) +target_sources(app PRIVATE ${image_sources}) \ No newline at end of file diff --git a/app/src/images/fonts/CMakeLists.txt b/app/src/images/fonts/CMakeLists.txt new file mode 100644 index 00000000..9358db0d --- /dev/null +++ b/app/src/images/fonts/CMakeLists.txt @@ -0,0 +1,2 @@ +FILE(GLOB font_sources *.c) +target_sources(app PRIVATE ${font_sources}) \ No newline at end of file diff --git a/app/src/sensors/zsw_imu.c b/app/src/sensors/zsw_imu.c index 81112496..97188050 100644 --- a/app/src/sensors/zsw_imu.c +++ b/app/src/sensors/zsw_imu.c @@ -600,10 +600,10 @@ static int8_t configure_axis_remapping(struct bmi2_dev *bmi2_dev) // In ZSWatch the PCB is mounted upsidedown in enclosure, hence we need // to remap axises. BMI270 is rotated 180 degrees, hence below config. -#if ZSWATCH_REV == 1 || ZSWATCH_REV == 2 +#if (CONFIG_ZSWATCH_PCB_REV == 1) || (CONFIG_ZSWATCH_PCB_REV == 2) remapped_axis.x = BMI2_NEG_X; remapped_axis.y = BMI2_NEG_Y; -#elif ZSWATCH_REV >= 3 +#elif (CONFIG_ZSWATCH_PCB_REV >= 3) remapped_axis.x = BMI2_NEG_Y; remapped_axis.y = BMI2_X; #else