Skip to content

Commit

Permalink
- Add "CONFIG_ZSWATCH_REV" macro and remove "ZSWATCH_REV" from CMakeL…
Browse files Browse the repository at this point in the history
…ists

- Add CMakeLists to images and fonts
  • Loading branch information
Kampi committed Nov 3, 2023
1 parent b5e4026 commit 6ed3464
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 26 deletions.
9 changes: 2 additions & 7 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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/)
Expand All @@ -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)
Expand Down
7 changes: 5 additions & 2 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -202,8 +207,6 @@ menu "ZSWatch"
endmenu
endmenu



module = APP
module-str = APP
source "subsys/logging/Kconfig.template.log_config"
3 changes: 3 additions & 0 deletions app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_1.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_ZSWATCH_PCB_REV=1

CONFIG_BMI270=y
3 changes: 3 additions & 0 deletions app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_2.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_ZSWATCH_PCB_REV=2

CONFIG_BMI270=y
7 changes: 5 additions & 2 deletions app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_3.conf
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
CONFIG_ZSWATCH_PCB_REV=3

#---------------
# FLASH
#-----------------
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
Expand All @@ -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
CONFIG_FS_LITTLEFS_FC_HEAP_SIZE=16384

CONFIG_BMI270=y
13 changes: 12 additions & 1 deletion app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
CONFIG_BMP581=y

CONFIG_LIS2MDL=y
CONFIG_LIS2MDL_MAG_ODR_RUNTIME=y
12 changes: 0 additions & 12 deletions app/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/src/images/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FILE(GLOB image_sources *.c)
target_sources(app PRIVATE ${image_sources})
2 changes: 2 additions & 0 deletions app/src/images/fonts/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FILE(GLOB font_sources *.c)
target_sources(app PRIVATE ${font_sources})
4 changes: 2 additions & 2 deletions app/src/sensors/zsw_imu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6ed3464

Please sign in to comment.