Skip to content

Commit

Permalink
Merge branch 'main' into Add-RV-8263-C8-Driver
Browse files Browse the repository at this point in the history
  • Loading branch information
Kampi committed Jul 16, 2024
2 parents 9d78181 + c01767d commit 5b6632c
Show file tree
Hide file tree
Showing 122 changed files with 7,434 additions and 410 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
name: Build

on:
push:
pull_request:
on: [workflow_call]

jobs:
build:
Expand All @@ -16,7 +12,7 @@ jobs:
board: [zswatch_nrf5340_cpuapp@1, zswatch_nrf5340_cpuapp@3, zswatch_nrf5340_cpuapp@4, zswatch_nrf5340_cpuapp@5, native_posix, nrf5340dk_nrf5340_cpuapp]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ZSWatch
submodules: recursive
Expand All @@ -26,7 +22,7 @@ jobs:
wget https://sourceforge.net/projects/astyle/files/astyle/astyle%203.4/astyle-3.4.10.tar.bz2/download -O astyle.tar.bz2
tar -xf astyle.tar.bz2
cd astyle-3.4.10
mkdir as-gcc-exe
mkdir -p as-gcc-exe
cd as-gcc-exe
cmake ../
make
Expand All @@ -38,7 +34,7 @@ jobs:
west init -l app
west config manifest.group-filter +bsec2
west update -o=--depth=1 -n
mkdir fw_images
mkdir -p fw_images
- name: Style
working-directory: ZSWatch
Expand Down Expand Up @@ -66,9 +62,9 @@ jobs:
west build app --build-dir ${{ matrix.board }}_${{ matrix.built_type }} -p -b ${{ matrix.board }} -- -DOVERLAY_CONFIG=boards/${{ matrix.built_type }}.conf
- name : Upload Firmware
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4.3.3
with:
name: ${{ matrix.board }}_${{ matrix.built_type }}
path: |
ZSWatch/fw_images
if-no-files-found: ignore
if-no-files-found: ignore
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
on:
pull_request:
workflow_dispatch:

jobs:
build:
uses: ./.github/workflows/build.yml

test:
needs: [build]
uses: ./.github/workflows/test.yml
51 changes: 51 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
on: [workflow_call]

jobs:
test:
runs-on: self-hosted
container:
image: ghcr.io/zephyrproject-rtos/zephyr-build:v0.26.2
volumes:
- /dev/bus/usb/:/dev/bus/usb
options: --privileged

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install dependencies
continue-on-error: true # JLink install will fail
run: |
if [ ! -f "`which JLinkExe`" ]; then
echo "Installing JLink tools..."
wget -q --post-data 'accept_license_agreement=accepted&non_emb_ctr=confirmed&submit=Download+software' https://www.segger.com/downloads/jlink/JLink_Linux_V796t_x86_64.deb
sudo apt -qq update
sudo apt -y install ./JLink_Linux_V796t_x86_64.deb &>/dev/null
fi
if [ ! -f "`which nrfjprog`" ]; then
echo "Installing Nordic command line tools..."
wget -q https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/desktop-software/nrf-command-line-tools/sw/versions-10-x-x/10-24-2/nrf-command-line-tools_10.24.2_amd64.deb
sudo apt -y install ./nrf-command-line-tools_10.24.2_amd64.deb &>/dev/null
export PATH=$PATH:/opt
fi
python -m pip install --upgrade pip
pip install -r app/pytest/requirements.txt
- name: 'Download image'
uses: actions/download-artifact@v4
with:
name: zswatch_nrf5340_cpuapp@3_debug

- name: Display structure of downloaded files
run: ls

- name: Test with pytest
run: |
pip install pytest
pytest app/pytest/
4 changes: 3 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/app/build/zephyr/zephyr.exe",
"args": ["--bt-dev=hci0"],
"args": [
"--bt-dev=hci0"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"preLaunchTask": "Disable BT",
Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@
"terminal.integrated.env.linux": {
"GTK_PATH": ""
},
"search.useIgnoreFiles": false
"search.useIgnoreFiles": false,
"[c]": {
"editor.defaultFormatter": "chiehyu.vscode-astyle"
}
}
39 changes: 9 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Smartwatch built from scratch, both hardware and software. Built on the [Zephyr

<kbd><img title="Overview" src=".github/images/overview.jpg"/></kbd><br/>

**Synced remote control over BLE**
**UI and features**

[https://user-images.githubusercontent.com/64562059/234390129-321d4f35-cb4b-45e8-89d9-20ae292f34fc.mp4](https://github.com/jakkra/ZSWatch/assets/4318648/8d0f40c2-d519-4db1-8634-b43caa502cbe)
https://github.com/jakkra/ZSWatch/assets/4318648/ec1a94fd-a682-4559-9e68-f3e5bfcbe682

<p align="center" >
<a href="https://www.youtube.com/watch?v=MmCzV0jV9hs"><img width="55%" src=".github/images/presentation.png" ></a>
Expand Down Expand Up @@ -64,7 +64,6 @@ If you are interested in a kit, or want to get notified when the missing parts a
- [Android phone communication](#android-phone-communication)
- [iOS device communication](#ios-device-communication)
- [PCB](#pcb)
- [ZSWatch v1 in action (Note old, not updated for latest HW and SW).](#zswatch-v1-in-action-note-old-not-updated-for-latest-hw-and-sw)
- [Environment, Compiling and running the code](#environment-compiling-and-running-the-code)
- [Writing apps for the Application Manager](#writing-apps-for-the-application-manager)
- [Other tools](#other-tools)
Expand Down Expand Up @@ -126,30 +125,19 @@ See more at https://github.com/jakkra/ZSWatch-Dock
There are almost endless of posiblities for features that could be implemented, see [here for full progress](https://github.com/users/jakkra/projects/1) and in GitHub issues.

## Watchfaces
Alternative watch faces can be chosen by selecting one or many of the appropriate Kconfig. <br>
Swiping left to right will change the watchface.
for something else, and can then be disabled.

`CONFIG_WATCHFACE_ANALOG=n`<br>
`CONFIG_WATCHFACE_DIGITAL=y`<br>
`CONFIG_WATCHFACE_MINIMAL=y`<br>
https://github.com/jakkra/ZSWatch/assets/4318648/13e43401-1c00-40ab-866f-e6518e61940d

## Smartphone communication

To select watchface background see below config in prj.conf:
### Android phone communication
Fortunately there is a great Android app called [GadgetBridge](https://codeberg.org/Freeyourgadget) which handles everything needed on the phone side, such as notifications management, music control and so much more... The ZSWatch right now pretends to be one of the supported Smart Watches in Gadgetbridge, following the same API as it does. In future there may be a point adding native support, we'll see.

`CONFIG_WATCHFACE_BACKGROUND_SPACE=y`<br>
`CONFIG_WATCHFACE_BACKGROUND_FLOWER=n`<br>
`CONFIG_WATCHFACE_BACKGROUND_PLANET=n`<br>
`CONFIG_WATCHFACE_BACKGROUND_NONE=n`<br>
**Demo of doing HTTP requests over BLE through Gadgetbridge.**

<p float="center">
<img src=".github/images/watchfaces.png" width="99%"/>
</p>

## Smartphone communication
https://github.com/jakkra/ZSWatch/assets/4318648/12d6e754-ceb3-4efd-9a75-d207aaeb0e82

### Android phone communication
Fortunately there is a great Android app called [GadgetBridge](https://codeberg.org/Freeyourgadget) which handles everything needed on the phone side, such as notifications management, music control and so much more... The ZSWatch right now pretends to be one of the supported Smart Watches in Gadgetbridge, following the same API as it does. In future there may be a point adding native support, we'll see.

#### Pairing
- In the watch go to Settings -> Bluetooth -> Enable pairing
Expand All @@ -159,6 +147,7 @@ Fortunately there is a great Android app called [GadgetBridge](https://codeberg.
### iOS device communication
Apple exposes [Apple Notification Center Service](https://developer.apple.com/library/archive/documentation/CoreBluetooth/Reference/AppleNotificationCenterServiceSpecification/Specification/Specification.html) GATT server which handles notifications management on the phone side, music control is done in the same fashion using [Apple Media Service](https://developer.apple.com/library/archive/documentation/CoreBluetooth/Reference/AppleMediaService_Reference/Specification/Specification.html)... The ZSWatch communicates straight to the iOS with no extra Apps.


#### Pairing
- In the watch go to Settings -> Bluetooth -> Enable pairing
- Now go to your device settings -> Bluetooth and choose "ZSWatch"
Expand All @@ -176,16 +165,6 @@ More info here: https://github.com/jakkra/ZSWatch-HW
<img src=".github/images/back_pcb_render.png" width="40%" object-fit="cover"/>
</p>

## ZSWatch v1 in action (Note old, not updated for latest HW and SW).
|*Music control*|*Accelerometer for step count and tap detection*|
|---|---|
| <img src=".github/images/music.gif" object-fit="cover" /> | <img src=".github/images/accel.gif" object-fit="cover" /> |
|*Notifications from phone (Gmail here)*|*Settings*|
| <img src=".github/images/notifications.gif" object-fit="cover" /> | <img src=".github/images/settings.gif" object-fit="cover"/> |


https://github.com/jakkra/ZSWatch/assets/4318648/8d8ec724-8145-4a30-b241-e69a8c2853bf

## Environment, Compiling and running the code
See [GETTING_STARTED.md](GETTING_STARTED.md)

Expand Down
9 changes: 9 additions & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,19 @@ if("nrf5340dk_nrf5340_cpuapp" STREQUAL "${BOARD}")
endif()

set(BOARD_ROOT ${CMAKE_CURRENT_SOURCE_DIR})

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(ZSWatchFW)

# These are XIP related anomalies and aren't applicable for us and cause
# throughput issues and QSPI issues on NCS 2.6.0
zephyr_compile_definitions(
-DNRF53_ERRATA_43_ENABLE_WORKAROUND=0
-DNRF52_ERRATA_215_ENABLE_WORKAROUND=0
)

add_subdirectory(drivers)
add_subdirectory(src/history)
add_subdirectory(src/applications)
add_subdirectory(src/ui/watchfaces)
add_subdirectory(src/sensors)
Expand Down
17 changes: 11 additions & 6 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ menu "ZSWatch"
prompt "Activate the application 'Accelerometer'"
default y

config APPLICATIONS_USE_BATTERY
bool
prompt "Activate the application 'Battery'"
default y

config APPLICATIONS_USE_COMPASS
bool
prompt "Activate the application 'Compass'"
Expand Down Expand Up @@ -141,6 +136,8 @@ menu "ZSWatch"
int
prompt "Idle timeout in seconds"
default 20

rsource "src/fuel_gauge/Kconfig"
endmenu
endmenu

Expand Down Expand Up @@ -226,10 +223,16 @@ menu "ZSWatch"
endmenu

menu "Misc"
config MENU_ENABLE_SYSTEM_RESET
config MISC_ENABLE_SYSTEM_RESET
bool
prompt "Enable a system reset via button 3"
default n

config MISC_HISTORY_MAX_LENGTH
int
range 10 65535
prompt "The maximum history length in samples"
default 672
endmenu

menu "Custom drivers"
Expand All @@ -241,6 +244,8 @@ menu "ZSWatch"
module-str = ZSW_APP
source "subsys/logging/Kconfig.template.log_config"

rsource "src/basic_battery/Kconfig"
rsource "src/history/Kconfig"
rsource "src/sensors/Kconfig"
rsource "src/sensor_fusion/Kconfig"
rsource "src/ble/Kconfig"
Expand Down
5 changes: 5 additions & 0 deletions app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_3.conf
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@ CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL=y
CONFIG_PM_PARTITION_SIZE_LITTLEFS=0x200000

CONFIG_DEBUG_COREDUMP_BACKEND_OTHER=y

# Save flash
CONFIG_WATCHFACE_ANALOG=n
CONFIG_WATCHFACE_MINIMAL=n
CONFIG_APPLICATIONS_USE_2048=n
2 changes: 0 additions & 2 deletions app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_5.conf
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ CONFIG_MFD_NPM1300_INIT_PRIORITY=51
CONFIG_REGULATOR_NPM1300_COMMON_INIT_PRIORITY=52
CONFIG_REGULATOR_NPM1300_INIT_PRIORITY=53

CONFIG_APPLICATIONS_USE_BATTERY=n

CONFIG_SETTINGS_NVS=y
CONFIG_NVS=y

Expand Down
Loading

0 comments on commit 5b6632c

Please sign in to comment.