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

Update nrf-connect SDK to 2.7 #218

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nrf-connect:v2.4",
"image": "nordicplayground/nrfconnect-sdk:v2.5-branch",
"name": "nrf-connect:v2.7",
"image": "nordicplayground/nrfconnect-sdk:v2.7-branch",
"features": {
},
"customizations": {
Expand Down
12 changes: 6 additions & 6 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ inputs:
sample-dir:
description: "Sample directory to build"
required: true
board:
description: "Board definition to use"
default: bparasite_nrf52840
soc:
description: "SoC to use"
default: nrf52840
revision:
description: "Board revision use"
default: "2.0.0"
Expand All @@ -18,10 +18,10 @@ runs:
steps:
- run: |
docker run --rm -v ${GITHUB_WORKSPACE}:/repo \
nordicplayground/nrfconnect-sdk:v2.5-branch \
nordicplayground/nrfconnect-sdk:v2.7-branch \
west build \
--build-dir /repo/${{ inputs.sample-dir }}/build \
--build-dir /repo/${{ inputs.sample-dir }}/build_${{ inputs.soc }}_${{ inputs.revision }} \
--pristine \
--board ${{ inputs.board }}@${{ inputs.revision }} \
--board bparasite@${{ inputs.revision }}/${{ inputs.soc }} \
/repo/${{ inputs.sample-dir }} -- ${{ inputs.cmake-extra }}
shell: bash
10 changes: 5 additions & 5 deletions .github/workflows/b-parasite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: ./.github/actions/build
with:
sample-dir: code/nrf-connect/samples/blinky
board: bparasite_nrf52840
soc: nrf52840
revision: 2.0.0
output-bin: blinky_nrf52840.hex

Expand All @@ -48,7 +48,7 @@ jobs:
uses: ./.github/actions/build
with:
sample-dir: code/nrf-connect/samples/input
board: bparasite_nrf52840
soc: nrf52840
revision: 2.0.0
output-bin: input_nrf52840.hex

Expand All @@ -64,7 +64,7 @@ jobs:
uses: ./.github/actions/build
with:
sample-dir: code/nrf-connect/samples/soil_read_loop
board: bparasite_nrf52840
soc: nrf52840
revision: 2.0.0
output-bin: soil_read_loop_nrf52840.hex

Expand All @@ -84,7 +84,7 @@ jobs:
uses: ./.github/actions/build
with:
sample-dir: code/nrf-connect/samples/ble
board: bparasite_${{ matrix.soc }}
soc: ${{ matrix.soc }}
revision: ${{ matrix.revision }}
cmake-extra: -DCONFIG_PRST_BLE_ENCODING_BTHOME_V2=y -DCONFIG_PRST_SLEEP_DURATION_MSEC=1000 -DCONFIG_PRSTLIB_LOG_LEVEL_DBG=y
output-bin: ble_${{ matrix.soc }}_${{ matrix.revision }}_debug.hex
Expand All @@ -105,7 +105,7 @@ jobs:
uses: ./.github/actions/build
with:
sample-dir: code/nrf-connect/samples/zigbee
board: bparasite_${{ matrix.soc }}
soc: ${{ matrix.soc }}
revision: ${{ matrix.revision }}
cmake-extra: -DCONFIG_PRSTLIB_LOG_LEVEL_DBG=y
output-bin: zigbee_${{ matrix.soc }}_${{ matrix.revision }}_debug.hex

This file was deleted.

10 changes: 0 additions & 10 deletions code/nrf-connect/prstlib/boards/arm/bparasite_nrf52833/board.cmake

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions code/nrf-connect/prstlib/boards/arm/bparasite_nrf52840/Kconfig

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

if BOARD_BPARASITE_NRF52833
if BOARD_BPARASITE

config BOARD_ENABLE_DCDC
bool "DCDC mode"
select SOC_DCDC_NRF52X
default y

endif # BOARD_BPARASITE_NRF52833
endif # BOARD_BPARASITE
5 changes: 5 additions & 0 deletions code/nrf-connect/prstlib/boards/bparasite/Kconfig.bparasite
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

config BOARD_BPARASITE
bool "b-parasite board"
select SOC_NRF52833_QIAA if BOARD_BPARASITE_NRF52833
select SOC_NRF52840_QIAA if BOARD_BPARASITE_NRF52840
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

if BOARD_BPARASITE_NRF52833
if BOARD_BPARASITE

config BOARD
default "bparasite_nrf52833"
default "bparasite"

config BOARD_REVISION
string "Board revision."
Expand All @@ -15,4 +15,4 @@ config BOARD_REVISION_CODE
config BT_CTLR
default BT

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

if (CONFIG_BPARASITE_NRF52833)
board_runner_args(jlink "--device=nRF52833_xxAA" "--speed=4000")
board_runner_args(pyocd "--target=nrf52833" "--frequency=4000000")
elseif (CONFIG_BPARASITE_NRF52840)
board_runner_args(jlink "--device=nRF52840_xxAA" "--speed=4000")
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
endif()

# set(OPENOCD_NRF5_SUBFAMILY "nrf52")
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
Expand Down
13 changes: 13 additions & 0 deletions code/nrf-connect/prstlib/boards/bparasite/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
board:
name: bparasite
socs:
- name: nrf52833
- name: nrf52840
revision:
format: major.minor.patch
default: "2.0.0"
revisions:
- name: "1.0.0"
- name: "1.1.0"
- name: "1.2.0"
- name: "2.0.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
identifier: bparasite/nrf52833
name: "b-parasite nRF52833"
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@

CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52833_QIAA=y
CONFIG_BOARD_BPARASITE_NRF52833=y

# Enable MPU
CONFIG_ARM_MPU=y

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
identifier: bparasite/nrf52840
name: "b-parasite nRF52840"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@

CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_BPARASITE_NRF52840=y

# Enable MPU
CONFIG_ARM_MPU=y

Expand Down
2 changes: 2 additions & 0 deletions code/nrf-connect/prstlib/include/prstlib/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@

#define UNUSED_OK(expr) (void)expr;

#define DOUBLE_PROMO_OK(expr) (double)(expr)

#endif // _PRST_MACROS_H_
7 changes: 4 additions & 3 deletions code/nrf-connect/prstlib/src/adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ static inline float get_soil_moisture_percent(float battery_voltage,
const float wet = eval_poly(wet_coeffs, x);
const float percent = (raw_adc_output - dry) / (wet - dry);
LOG_DBG("Read soil moisture 2: %.2f | Raw %u | Batt: %.2f | Dry: %.2f | Wet: %.2f",
100.0f * percent, raw_adc_output, x, dry, wet);
DOUBLE_PROMO_OK(100 * percent),
raw_adc_output, DOUBLE_PROMO_OK(x), DOUBLE_PROMO_OK(dry), DOUBLE_PROMO_OK(wet));
return percent;
}

Expand Down Expand Up @@ -177,7 +178,7 @@ int prst_adc_photo_read(float battery_voltage, prst_adc_photo_sensor_t* out) {
const float current_sun = 3.59e-3f;
const float current = out->adc_read.voltage / phototransistor_resistor;
out->brightness = MAX(0, MIN(lux_sun * current / current_sun, UINT16_MAX));
LOG_DBG("Read phototransistor: %u lx | %.2f V", out->brightness, out->adc_read.voltage);
LOG_DBG("Read phototransistor: %u lx | %.2f V", out->brightness, DOUBLE_PROMO_OK(out->adc_read.voltage));

#elif DT_NODE_EXISTS(DT_NODELABEL(ldr))
RET_IF_ERR(gpio_pin_set_dt(&ldr_enable_dt, 1));
Expand All @@ -201,7 +202,7 @@ int prst_adc_photo_read(float battery_voltage, prst_adc_photo_sensor_t* out) {
const float pow_value = 1.5832f;
out->brightness =
MAX(0, MIN(mult_value / powf(photo_resistance, pow_value), UINT16_MAX));
LOG_DBG("Read LDR: %u lx | %.2f V", out->brightness, out->adc_read.voltage);
LOG_DBG("Read LDR: %u lx | %.2f V", out->brightness, DOUBLE_PROMO_OK(out->adc_read.voltage));

#endif

Expand Down
8 changes: 4 additions & 4 deletions code/nrf-connect/prstlib/src/sensors.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ int prst_sensors_read_all(prst_sensors_t *sensors) {
RET_IF_ERR(prst_shtc3_read(&sensors->shtc3))

LOG_DBG("Batt: %d mV (%.2f%%)", sensors->batt.adc_read.millivolts,
100 * sensors->batt.percentage);
LOG_DBG("Soil: %.0f %%", 100 * sensors->soil.percentage);
DOUBLE_PROMO_OK(100 * sensors->batt.percentage));
LOG_DBG("Soil: %.0f %%", DOUBLE_PROMO_OK(100 * sensors->soil.percentage));
LOG_DBG("Photo: %u lx (%d mV)", sensors->photo.brightness,
sensors->photo.adc_read.millivolts);
LOG_DBG("Temp: %f oC", sensors->shtc3.temp_c);
LOG_DBG("Humi: %.0f %%", 100 * sensors->shtc3.rel_humi);
LOG_DBG("Temp: %f oC", DOUBLE_PROMO_OK(sensors->shtc3.temp_c));
LOG_DBG("Humi: %.0f %%", DOUBLE_PROMO_OK(100 * sensors->shtc3.rel_humi));
LOG_DBG("--------------------------------------------------");

return 0;
Expand Down
4 changes: 2 additions & 2 deletions code/nrf-connect/prstlib/src/shtc3.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int prst_shtc3_read(prst_shtc3_read_t *out) {
out->temp_c = -45 + 175 * ((float)((buff[0] << 8) | buff[1])) / (1 << 16);
out->rel_humi = ((float)((buff[3] << 8) | buff[4])) / UINT16_MAX;

LOG_DBG("Read temp: %f oC (%d)", out->temp_c, (int)out->temp_c);
LOG_DBG("Read humi: %.0f %%", 100.0 * out->rel_humi);
LOG_DBG("Read temp: %f oC (%d)", DOUBLE_PROMO_OK(out->temp_c), (int)out->temp_c);
LOG_DBG("Read humi: %.0f %%", DOUBLE_PROMO_OK(100.0f * out->rel_humi));
return 0;
}
86 changes: 0 additions & 86 deletions code/nrf-connect/samples/ble/nrf52840dk_nrf52840.overlay

This file was deleted.

Loading
Loading