Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate code to the nRF Connect SDK #76

Merged
merged 55 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
bae0695
Initial commit
rbaron Nov 12, 2022
9c94925
PWM kinda works
rbaron Nov 13, 2022
522452b
ADC works
rbaron Nov 13, 2022
6b1f529
Moved adc stuff to adc.c
rbaron Nov 13, 2022
1079367
Better error handling in adc.c
rbaron Nov 13, 2022
59f2aad
Some hacky macros for error handling
rbaron Nov 13, 2022
3d6b4ea
Tame log levels
rbaron Nov 13, 2022
2779fe9
Started adding a b-parasite board. Not working yet
rbaron Nov 14, 2022
a639343
Code commpiles for custom bparasite_nrf52840 board
rbaron Nov 14, 2022
c151201
Enables RTT console for bparasite_nrf52840
rbaron Nov 14, 2022
ffeca36
Configures LED
rbaron Nov 14, 2022
8cfb87e
Configs button
rbaron Nov 14, 2022
3749d68
Very minimal, working BLE advertising
rbaron Nov 15, 2022
5975426
Moved BLE stuff to src/ble/
rbaron Nov 16, 2022
8c7a2c3
Update shtc3 API
rbaron Nov 16, 2022
9333913
Encoding of b-parasite protocol v2 works I guess
rbaron Nov 17, 2022
a65b00a
Cleanup
rbaron Nov 17, 2022
c5a5fca
Adds simple Kconfig
rbaron Nov 17, 2022
d18e7ab
Kconfigure BLE service data length
rbaron Nov 18, 2022
6705c11
Cleanup
rbaron Nov 18, 2022
339e5be
Fixs PWM current consumption - SYSTEM ON sleep @ ~2.7uA
rbaron Nov 22, 2022
5510fd9
BLE sample kinda works. Pending calibration
rbaron Nov 25, 2022
a9d551f
Adds a calibration sample
rbaron Nov 25, 2022
df7700c
Recalibrated. BLE sample seems to work e2e @ 2.7uA sleep :)
rbaron Nov 25, 2022
5ceccfa
Extracts prstlib
rbaron Nov 27, 2022
00a7114
Extracts boards/ and dts/ to prstlib
rbaron Nov 27, 2022
cc4c479
Moves soil_read_loop to samples/
rbaron Nov 27, 2022
89d2999
Deletes old sample
rbaron Nov 27, 2022
46a8285
Reuse macros.h in nrf-connect/samples/soil_read_loop/src/main.c
rbaron Nov 27, 2022
fc3a065
Add blinky sample
rbaron Nov 28, 2022
4a6e3dc
Update github action & workflow to build nrf-connect samples
rbaron Nov 28, 2022
3b104cd
Implements BTHome v1 and v2 encodings for ble sample
rbaron Nov 29, 2022
dbaf44e
Cleanup comments
rbaron Nov 29, 2022
9c62b12
Update default Kconfig in samples/ble
rbaron Nov 29, 2022
fe09c0b
Update github actions to generate more samples
rbaron Nov 30, 2022
0bda7de
Add b-parasite with nRF52833 board definition
rbaron Nov 30, 2022
a9a478f
Add a nRF52840 build to GitHub workflow
rbaron Nov 30, 2022
b731006
Adds bthomv1 build for nRF52833 to GitHub workflow
rbaron Nov 30, 2022
ad45efb
Cleanup actions
rbaron Nov 30, 2022
b483af4
Fixes actions
rbaron Nov 30, 2022
a93171b
Adds support for user-supplied BT address
rbaron Dec 1, 2022
dc88916
Add board 1.0.0, 1.1.0, 1.2.0 board revisions for nRF52840 variant
rbaron Dec 3, 2022
f476e69
Adds board revisions for nRF52833 variant
rbaron Dec 3, 2022
6969d74
Fixes GitHub actions to use board revisions
rbaron Dec 3, 2022
7c0b83e
Add blackmagicprobe.board.cmake to board.cmake for both variants
rbaron Dec 3, 2022
bc08c82
Updates Zephyr imports to use the <zephyr/...> prefix
rbaron Dec 3, 2022
8bfd75d
Fix BTHome v2 encoding - sort entries by Object IDs
rbaron Dec 3, 2022
cc62786
Updates GitHub actions to build for different board revisions
rbaron Dec 3, 2022
381bbb7
Fix illuminance encoding in ble, BTHome v2
rbaron Dec 4, 2022
cab55d9
<zephyr/zephyr.h> -> <zephyr/kernel.h> everywhere
rbaron Dec 4, 2022
f7806d4
Really fixing BTHome v2 illuminance encoding this time
rbaron Dec 4, 2022
a8c7d3c
<zephyr/zephyr.h> -> <zephyr/kernel.h> in prstlib
rbaron Dec 6, 2022
002500d
Adds samples/ble/README.md
rbaron Dec 7, 2022
192cca1
Update README.md
rbaron Dec 7, 2022
3bf9045
Remove legacy nrf-sdk code/b-parasite
rbaron Dec 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "nrf-connect:v2.1",
"image": "nordicplayground/nrfconnect-sdk:v2.1-branch",
"features": {
},
"customizations": {
"vscode": {
"extensions": [
"nordic-semiconductor.nrf-connect"
]
}
}
}
10 changes: 1 addition & 9 deletions .github/actions/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
FROM debian:bullseye-slim

RUN apt-get update && \
apt-get -y install wget tar unzip make clang-format gcc-arm-none-eabi

RUN cd /opt && \
wget https://www.nordicsemi.com/-/media/Software-and-other-downloads/SDKs/nRF5/Binaries/nRF5SDK1702d674dde.zip -O nRF5_SDK.zip && \
unzip nRF5_SDK.zip && \
mv nRF5_SDK_17.0.2_d674dde nRF5_SDK
FROM nordicplayground/nrfconnect-sdk:v2.1-branch

COPY build.sh /build.sh

Expand Down
20 changes: 19 additions & 1 deletion .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
name: 'Build'
description: 'Builds b-parasite firmware'
description: 'Builds a nrf-connect sample for b-parasite'
inputs:
sample-dir:
description: 'Sample directory to build'
required: true
board:
description: 'Board definition to use'
default: bparasite_nrf52840
cmake-extra:
description: 'Extra CMake arguments'
default: ''
output-bin:
description: 'Name of the .hex output'
required: true
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.sample-dir }}
- ${{ inputs.board }}
- ${{ inputs.cmake-extra }}
- ${{ inputs.output-bin }}
15 changes: 9 additions & 6 deletions .github/actions/build/build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/bin/bash
set -eux -o pipefail

export SDK_ROOT=/opt/nRF5_SDK
export GNU_INSTALL_ROOT=/usr/bin/
SAMPLE_DIR=$1
BOARD=$2
CMAKE_EXTRA=$3
OUTPUT_BIN=$4

cd "$GITHUB_WORKSPACE/code/b-parasite"
make clean
make lint
make
cd "${GITHUB_WORKSPACE}/${SAMPLE_DIR}"

west build --build-dir ./build --pristine --board "${BOARD}" -- $CMAKE_EXTRA

mv build/zephyr/zephyr.hex build/zephyr/"${OUTPUT_BIN}"
29 changes: 29 additions & 0 deletions .github/actions/build_and_upload/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 'Build and upload artifact'
description: 'Builds a nrf-connect sample for b-parasite'
inputs:
sample-dir:
description: 'Sample directory to build'
required: true
board:
description: 'Board definition to use'
required: true
cmake-extra:
description: 'Extra CMake arguments'
default: ''
output-bin:
description: 'Name of the .hex output'
required: true

runs:
using: "composite"
steps:
- uses: ./.github/actions/build
with:
sample-dir: ${{ inputs.sample-dir }}
board: ${{ inputs.board }}
cmake-extra: ${{ inputs.cmake-extra }}
output-bin: ${{ inputs.output-bin }}
- uses: actions/upload-artifact@v3
with:
name: sample-binaries
path: code/nrf-connect/samples/ble/build/zephyr/${{ inputs.output-bin }}
46 changes: 43 additions & 3 deletions .github/workflows/b-parasite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,49 @@ on:
jobs:
build:
runs-on: ubuntu-latest
name: Checks format & builds b-parasite's firmware
name: Check format & build samples
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build
uses: actions/checkout@v3
- name: Check clang-format
uses: jidicula/clang-format-action@v4.9.0
with:
check-path: 'code/nrf-connect'
- name: Build blinky
uses: ./.github/actions/build
with:
sample-dir: code/nrf-connect/samples/blinky
board: bparasite_nrf52840
output-bin: blinky_nrf52840.hex
- name: Build soil_read_loop
uses: ./.github/actions/build
with:
sample-dir: code/nrf-connect/samples/soil_read_loop
board: bparasite_nrf52840
output-bin: soil_read_loop_nrf52840.hex
- name: Build ble_nrf52840_default.hex
uses: ./.github/actions/build_and_upload
with:
sample-dir: code/nrf-connect/samples/ble
board: bparasite_nrf52840
output-bin: ble_nrf52840_default.hex
- name: Build ble_nrf52840_bthomev1.hex
uses: ./.github/actions/build_and_upload
with:
sample-dir: code/nrf-connect/samples/ble
board: bparasite_nrf52840
cmake-extra: -DCONFIG_PRST_BLE_ENCODING_BTHOME_V1=y
output-bin: ble_nrf52840_bthomev1.hex
- name: Build ble_nrf52833_default.hex
uses: ./.github/actions/build_and_upload
with:
sample-dir: code/nrf-connect/samples/ble
board: bparasite_nrf52833
output-bin: ble_nrf52833_default.hex
- name: Build ble_nrf52833_bthomev1.hex
uses: ./.github/actions/build_and_upload
with:
sample-dir: code/nrf-connect/samples/ble
board: bparasite_nrf52833
cmake-extra: -DCONFIG_PRST_BLE_ENCODING_BTHOME_V1=y
output-bin: ble_nrf52833_bthomev1.hex
4 changes: 4 additions & 0 deletions code/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---

BasedOnStyle: Google
ColumnLimit: 0
14 changes: 14 additions & 0 deletions code/nrf-connect/prstlib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})

add_library(prstlib STATIC
src/adc.c
src/button.c
src/led.c
src/sensors.c
src/shtc3.c
)

target_include_directories(prstlib PRIVATE include)
target_link_libraries(prstlib PUBLIC zephyr_interface)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

if BOARD_BPARASITE_NRF52833

config BOARD_ENABLE_DCDC
bool "DCDC mode"
select SOC_DCDC_NRF52X
default y

endif # BOARD_BPARASITE_NRF52833
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

config BOARD_BPARASITE_NRF52833
bool "b-parasite nRF52833 board"
depends on SOC_NRF52833_QIAA
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

if BOARD_BPARASITE_NRF52833

config BOARD
default "bparasite_nrf52833"

config BT_CTLR
default BT

endif # BOARD_BPARASITE_NRF52833
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0

board_runner_args(jlink "--device=nRF52833_xxAA" "--speed=4000")
board_runner_args(pyocd "--target=nrf52833" "--frequency=4000000")
# set(OPENOCD_NRF5_SUBFAMILY "nrf52")
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)
rbaron marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

&pinctrl {
uart0_default: uart0_default {
group1 {
psels = <NRF_PSEL(UART_TX, 0, 25)>,
<NRF_PSEL(UART_RX, 0, 23)>;
};
};

uart0_sleep: uart0_sleep {
group1 {
psels = <NRF_PSEL(UART_TX, 0, 25)>,
<NRF_PSEL(UART_RX, 0, 23)>;
low-power-enable;
};
};

/* Configure pwm0 instance to use pin 5. */
pwm0_default: pwm0_default {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 5)>;
nordic,invert;
};
};

pwm0_sleep: pwm0_sleep {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 5)>;
low-power-enable;
};
};

/* Configure i2c0 instance to use pins 24 (SDA) & 13 (SCL). */
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 24)>,
<NRF_PSEL(TWIM_SCL, 0, 13)>;
};
};

i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 24)>,
<NRF_PSEL(TWIM_SCL, 0, 13)>;
low-power-enable;
};
};
};
Loading