Merge branch 'refs/heads/master' into add-feather-833
bootloader/circuitplayground_nrf52840/circuitplayground_nrf52840_bootloader-0.6.2_s140_6.1.1.hex bootloader/circuitplayground_nrf52840/circuitplayground_nrf52840_bootloader-0.6.2_s140_6.1.1.zip bootloader/circuitplayground_nrf52840/circuitplayground_nrf52840_bootloader-0.7.0_s140_6.1.1.hex bootloader/circuitplayground_nrf52840/circuitplayground_nrf52840_bootloader-0.7.0_s140_6.1.1.zip bootloader/circuitplayground_nrf52840/circuitplayground_nrf52840_bootloader-0.9.0_s140_6.1.1.zip bootloader/clue_nrf52840/clue_nrf52840_bootloader-0.6.2_s140_6.1.1.hex bootloader/clue_nrf52840/clue_nrf52840_bootloader-0.6.2_s140_6.1.1.zip bootloader/clue_nrf52840/clue_nrf52840_bootloader-0.7.0_s140_6.1.1.hex bootloader/clue_nrf52840/clue_nrf52840_bootloader-0.7.0_s140_6.1.1.zip bootloader/clue_nrf52840/clue_nrf52840_bootloader-0.9.0_s140_6.1.1.hex bootloader/feather_nrf52832/feather_nrf52832_bootloader-0.6.2_s132_6.1.1.hex bootloader/feather_nrf52832/feather_nrf52832_bootloader-0.6.2_s132_6.1.1.zip bootloader/feather_nrf52832/feather_nrf52832_bootloader-0.7.0_s132_6.1.1.hex bootloader/feather_nrf52832/feather_nrf52832_bootloader-0.7.0_s132_6.1.1.zip bootloader/feather_nrf52832/feather_nrf52832_bootloader-0.9.0_s132_6.1.1.hex bootloader/feather_nrf52832/feather_nrf52832_bootloader-0.9.0_s132_6.1.1.zip bootloader/feather_nrf52840_express/feather_nrf52840_express_bootloader-0.7.0_s140_6.1.1.hex bootloader/feather_nrf52840_express/feather_nrf52840_express_bootloader-0.7.0_s140_6.1.1.zip bootloader/feather_nrf52840_express/feather_nrf52840_express_bootloader-0.9.0_s140_6.1.1.hex bootloader/feather_nrf52840_sense/feather_nrf52840_sense_bootloader-0.7.0_s140_6.1.1.hex bootloader/feather_nrf52840_sense/feather_nrf52840_sense_bootloader-0.7.0_s140_6.1.1.zip bootloader/feather_nrf52840_sense/feather_nrf52840_sense_bootloader-0.9.0_s140_6.1.1.hex bootloader/feather_nrf52840_sense/feather_nrf52840_sense_bootloader-0.9.0_s140_6.1.1.zip bootloader/itsybitsy_nrf52840_express/itsybitsy_nrf52840_express_bootloader-0.6.2_s140_6.1.1.hex bootloader/itsybitsy_nrf52840_express/itsybitsy_nrf52840_express_bootloader-0.6.2_s140_6.1.1.zip bootloader/itsybitsy_nrf52840_express/itsybitsy_nrf52840_express_bootloader-0.7.0_s140_6.1.1.hex bootloader/itsybitsy_nrf52840_express/itsybitsy_nrf52840_express_bootloader-0.7.0_s140_6.1.1.zip bootloader/itsybitsy_nrf52840_express/itsybitsy_nrf52840_express_bootloader-0.9.0_s140_6.1.1.hex bootloader/itsybitsy_nrf52840_express/itsybitsy_nrf52840_express_bootloader-0.9.0_s140_6.1.1.zip bootloader/ledglasses_nrf52840/ledglasses_nrf52840_bootloader-0.6.2_s140_6.1.1.zip bootloader/ledglasses_nrf52840/ledglasses_nrf52840_bootloader-0.9.0_s140_6.1.1.hex bootloader/ledglasses_nrf52840/ledglasses_nrf52840_bootloader-0.9.0_s140_6.1.1.zip bootloader/metro_nrf52840_express/metro_nrf52840_express_bootloader-0.7.0_s140_6.1.1.hex bootloader/metro_nrf52840_express/metro_nrf52840_express_bootloader-0.7.0_s140_6.1.1.zip bootloader/metro_nrf52840_express/metro_nrf52840_express_bootloader-0.9.0_s140_6.1.1.zip bootloader/particle_xenon/particle_xenon_bootloader-0.6.2_s140_6.1.1.hex bootloader/particle_xenon/particle_xenon_bootloader-0.6.2_s140_6.1.1.zip bootloader/particle_xenon/particle_xenon_bootloader-0.7.0_s140_6.1.1.hex bootloader/particle_xenon/particle_xenon_bootloader-0.9.0_s140_6.1.1.hex bootloader/raytac_mdbt50q_rx/raytac_mdbt50q_rx_bootloader-0.6.2_s140_6.1.1.hex bootloader/raytac_mdbt50q_rx/raytac_mdbt50q_rx_bootloader-0.6.2_s140_6.1.1.zip bootloader/raytac_mdbt50q_rx/raytac_mdbt50q_rx_bootloader-0.7.0_s140_6.1.1.zip bootloader/raytac_mdbt50q_rx/raytac_mdbt50q_rx_bootloader-0.9.0_s140_6.1.1.hex bootloader/raytac_mdbt50q_rx/raytac_mdbt50q_rx_bootloader-0.9.0_s140_6.1.1.zip
This commit is contained in:
103 files changed
+44709
-43877
No files matched your search
@@ -3,3 +3,6 @@ contact_links:
|
||||
- name: Adafruit Support Forum
|
||||
url: https://forums.adafruit.com
|
||||
about: If you have other questions or need help, post it here.
|
||||
- name: Discussion
|
||||
url: https://github.com/adafruit/Adafruit_nRF52_Arduino/discussions
|
||||
about: If you have other questions or need help, post it here.
|
||||
@@ -2,8 +2,13 @@ name: Build
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -14,19 +19,18 @@ jobs:
|
||||
- 'feather52832'
|
||||
- 'feather52840'
|
||||
- 'feather52840sense'
|
||||
- 'feather_nrf52840_sense_tft'
|
||||
- 'itsybitsy52840'
|
||||
- 'ledglasses_nrf52840'
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v1
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: 'true'
|
||||
|
||||
@@ -58,14 +62,11 @@ jobs:
|
||||
|
||||
# Install library dependency
|
||||
arduino-cli lib install "Adafruit AHRS" "Adafruit APDS9960 Library" "Adafruit Arcada Library" "Adafruit BMP280 Library" "Adafruit Circuit Playground" "Adafruit EPD" "Adafruit GFX Library" "Adafruit HX8357 Library" "Adafruit ILI9341" "Adafruit LIS3MDL" "Adafruit LSM6DS" "Adafruit NeoPixel" "Adafruit NeoMatrix" "Adafruit Sensor Calibration" "Adafruit SHT31 Library" "Adafruit SSD1306" "Adafruit ST7735 and ST7789 Library" "SdFat - Adafruit Fork"
|
||||
arduino-cli lib install "Arduino_TensorFlowLite" "MIDI Library"
|
||||
arduino-cli lib install "MIDI Library" "Firmata"
|
||||
|
||||
# TODO use firmata master to prevent build error with gcc v9 (should be remove after 2.5.9 is released)
|
||||
# https://github.com/firmata/arduino/pull/438
|
||||
git clone --depth 1 https://github.com/firmata/arduino.git $HOME/Arduino/libraries/firmata
|
||||
|
||||
# TODO temporarily remove TinyUSB pre-1.0.0 version install by arduino-cli
|
||||
rm -r $HOME/Arduino/libraries/Adafruit_TinyUSB_Library
|
||||
# Arduino_TensorFlowLite is removed per maintainer request https://github.com/arduino/library-registry/pull/1748
|
||||
# Find a way to compile later, skip TFL example for now
|
||||
# arduino-cli lib install "Arduino_TensorFlowLite"
|
||||
|
||||
# Library summary
|
||||
arduino-cli lib list
|
||||
|
||||
+5
-2
@@ -3,7 +3,10 @@
|
||||
*.obj
|
||||
|
||||
# Visual Studio Code
|
||||
**/.vscode/
|
||||
.vscode/
|
||||
.idea/
|
||||
.pio/
|
||||
.piopm
|
||||
|
||||
# Executables
|
||||
*.out
|
||||
@@ -20,4 +23,4 @@
|
||||
# Ignore local overrides of platform.txt and boards.txt,
|
||||
/boards.local.txt
|
||||
/platform.local.txt
|
||||
/libraries/**/build/
|
||||
|
||||
@@ -69,7 +69,7 @@ $ pip3 install adafruit-nrfutil --user
|
||||
|
||||
### Drivers
|
||||
|
||||
- [SiLabs CP2104 driver](http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx) is required for USB to Serial when using with Feather nRF52832
|
||||
- [SiLabs CP2104 driver](https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers?tab=downloads) is required for USB to Serial when using with Feather nRF52832
|
||||
|
||||
## Bootloader
|
||||
|
||||
|
||||
+284
-279
@@ -1,128 +1,6 @@
|
||||
menu.softdevice=SoftDevice
|
||||
menu.debug=Debug
|
||||
menu.debug_output=Debug Output
|
||||
|
||||
# -----------------------------------
|
||||
# Adafruit CLUE
|
||||
# -----------------------------------
|
||||
cluenrf52840.name=Adafruit CLUE
|
||||
|
||||
# VID/PID for Bootloader, Arduino & CircuitPython
|
||||
cluenrf52840.vid.0=0x239A
|
||||
cluenrf52840.pid.0=0x8071
|
||||
cluenrf52840.vid.1=0x239A
|
||||
cluenrf52840.pid.1=0x0071
|
||||
cluenrf52840.vid.2=0x239A
|
||||
cluenrf52840.pid.2=0x8072
|
||||
|
||||
# Upload
|
||||
cluenrf52840.bootloader.tool=bootburn
|
||||
cluenrf52840.upload.tool=nrfutil
|
||||
cluenrf52840.upload.protocol=nrfutil
|
||||
cluenrf52840.upload.use_1200bps_touch=true
|
||||
cluenrf52840.upload.wait_for_upload_port=true
|
||||
cluenrf52840.upload.maximum_size=815104
|
||||
cluenrf52840.upload.maximum_data_size=237568
|
||||
|
||||
# Build
|
||||
cluenrf52840.build.mcu=cortex-m4
|
||||
cluenrf52840.build.f_cpu=64000000
|
||||
cluenrf52840.build.board=NRF52840_CLUE
|
||||
cluenrf52840.build.core=nRF5
|
||||
cluenrf52840.build.variant=clue_nrf52840
|
||||
cluenrf52840.build.usb_manufacturer="Adafruit"
|
||||
cluenrf52840.build.usb_product="CLUE"
|
||||
cluenrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
|
||||
cluenrf52840.build.ldscript=nrf52840_s140_v6.ld
|
||||
cluenrf52840.build.vid=0x239A
|
||||
cluenrf52840.build.pid=0x8071
|
||||
cluenrf52840.build.uf2_family=0xADA52840
|
||||
|
||||
# SoftDevice Menu
|
||||
cluenrf52840.menu.softdevice.s140v6=S140 6.1.1
|
||||
cluenrf52840.menu.softdevice.s140v6.build.sd_name=s140
|
||||
cluenrf52840.menu.softdevice.s140v6.build.sd_version=6.1.1
|
||||
cluenrf52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6
|
||||
|
||||
# Debug Menu
|
||||
cluenrf52840.menu.debug.l0=Level 0 (Release)
|
||||
cluenrf52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
|
||||
cluenrf52840.menu.debug.l1=Level 1 (Error Message)
|
||||
cluenrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1
|
||||
cluenrf52840.menu.debug.l2=Level 2 (Full Debug)
|
||||
cluenrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
|
||||
cluenrf52840.menu.debug.l3=Level 3 (Segger SystemView)
|
||||
cluenrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
|
||||
cluenrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
|
||||
|
||||
# Debug Output Menu
|
||||
cluenrf52840.menu.debug_output.serial=Serial
|
||||
cluenrf52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
|
||||
cluenrf52840.menu.debug_output.serial1=Serial1
|
||||
cluenrf52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG
|
||||
cluenrf52840.menu.debug_output.rtt=Segger RTT
|
||||
cluenrf52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
|
||||
# -----------------------------------
|
||||
# Adafruit Circuit Playground Bluefruit
|
||||
# -----------------------------------
|
||||
cplaynrf52840.name=Adafruit Circuit Playground Bluefruit
|
||||
|
||||
# VID/PID for Bootloader, Arduino & CircuitPython
|
||||
cplaynrf52840.vid.0=0x239A
|
||||
cplaynrf52840.pid.0=0x8045
|
||||
cplaynrf52840.vid.1=0x239A
|
||||
cplaynrf52840.pid.1=0x0045
|
||||
cplaynrf52840.vid.2=0x239A
|
||||
cplaynrf52840.pid.2=0x8046
|
||||
|
||||
# Upload
|
||||
cplaynrf52840.bootloader.tool=bootburn
|
||||
cplaynrf52840.upload.tool=nrfutil
|
||||
cplaynrf52840.upload.protocol=nrfutil
|
||||
cplaynrf52840.upload.use_1200bps_touch=true
|
||||
cplaynrf52840.upload.wait_for_upload_port=true
|
||||
cplaynrf52840.upload.maximum_size=815104
|
||||
cplaynrf52840.upload.maximum_data_size=237568
|
||||
|
||||
# Build
|
||||
cplaynrf52840.build.mcu=cortex-m4
|
||||
cplaynrf52840.build.f_cpu=64000000
|
||||
cplaynrf52840.build.board=NRF52840_CIRCUITPLAY
|
||||
cplaynrf52840.build.core=nRF5
|
||||
cplaynrf52840.build.variant=circuitplayground_nrf52840
|
||||
cplaynrf52840.build.usb_manufacturer="Adafruit"
|
||||
cplaynrf52840.build.usb_product="Circuit Playground Bluefruit"
|
||||
cplaynrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
|
||||
cplaynrf52840.build.ldscript=nrf52840_s140_v6.ld
|
||||
cplaynrf52840.build.vid=0x239A
|
||||
cplaynrf52840.build.pid=0x8045
|
||||
cplaynrf52840.build.uf2_family=0xADA52840
|
||||
|
||||
# SoftDevice Menu
|
||||
cplaynrf52840.menu.softdevice.s140v6=S140 6.1.1
|
||||
cplaynrf52840.menu.softdevice.s140v6.build.sd_name=s140
|
||||
cplaynrf52840.menu.softdevice.s140v6.build.sd_version=6.1.1
|
||||
cplaynrf52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6
|
||||
|
||||
# Debug Menu
|
||||
cplaynrf52840.menu.debug.l0=Level 0 (Release)
|
||||
cplaynrf52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
|
||||
cplaynrf52840.menu.debug.l1=Level 1 (Error Message)
|
||||
cplaynrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1
|
||||
cplaynrf52840.menu.debug.l2=Level 2 (Full Debug)
|
||||
cplaynrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
|
||||
cplaynrf52840.menu.debug.l3=Level 3 (Segger SystemView)
|
||||
cplaynrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
|
||||
cplaynrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
|
||||
|
||||
# Debug Output Menu
|
||||
cplaynrf52840.menu.debug_output.serial=Serial
|
||||
cplaynrf52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
|
||||
cplaynrf52840.menu.debug_output.serial1=Serial1
|
||||
cplaynrf52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG
|
||||
cplaynrf52840.menu.debug_output.rtt=Segger RTT
|
||||
cplaynrf52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
menu.debug=Debug Level
|
||||
menu.debug_output=Debug Port
|
||||
|
||||
# -----------------------------------
|
||||
# Adafruit Feather nRF52832
|
||||
@@ -151,14 +29,15 @@ feather52832.build.usb_manufacturer="Adafruit"
|
||||
feather52832.build.usb_product="Feather nRF52832"
|
||||
feather52832.build.extra_flags=-DNRF52832_XXAA -DNRF52
|
||||
feather52832.build.ldscript=nrf52832_s132_v6.ld
|
||||
feather52832.build.openocdscript=scripts/openocd/daplink_nrf52.cfg
|
||||
|
||||
# SoftDevice Menu
|
||||
# Menu: SoftDevice
|
||||
feather52832.menu.softdevice.s132v6=S132 6.1.1
|
||||
feather52832.menu.softdevice.s132v6.build.sd_name=s132
|
||||
feather52832.menu.softdevice.s132v6.build.sd_version=6.1.1
|
||||
feather52832.menu.softdevice.s132v6.build.sd_fwid=0x00B7
|
||||
|
||||
# Debug Menu
|
||||
# Menu: Debug Level
|
||||
feather52832.menu.debug.l0=Level 0 (Release)
|
||||
feather52832.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
|
||||
feather52832.menu.debug.l1=Level 1 (Error Message)
|
||||
@@ -169,7 +48,7 @@ feather52832.menu.debug.l3=Level 3 (Segger SystemView)
|
||||
feather52832.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
|
||||
feather52832.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
|
||||
|
||||
# Debug Output Menu
|
||||
# Menu: Debug Port
|
||||
feather52832.menu.debug_output.serial=Serial
|
||||
feather52832.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
|
||||
feather52832.menu.debug_output.serial1=Serial1
|
||||
@@ -211,17 +90,18 @@ feather52840.build.usb_manufacturer="Adafruit"
|
||||
feather52840.build.usb_product="Feather nRF52840 Express"
|
||||
feather52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
|
||||
feather52840.build.ldscript=nrf52840_s140_v6.ld
|
||||
feather52840.build.openocdscript=scripts/openocd/daplink_nrf52.cfg
|
||||
feather52840.build.vid=0x239A
|
||||
feather52840.build.pid=0x8029
|
||||
feather52840.build.uf2_family=0xADA52840
|
||||
|
||||
# SoftDevice Menu
|
||||
# Menu: SoftDevice
|
||||
feather52840.menu.softdevice.s140v6=S140 6.1.1
|
||||
feather52840.menu.softdevice.s140v6.build.sd_name=s140
|
||||
feather52840.menu.softdevice.s140v6.build.sd_version=6.1.1
|
||||
feather52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6
|
||||
|
||||
# Debug Menu
|
||||
# Menu: Debug Level
|
||||
feather52840.menu.debug.l0=Level 0 (Release)
|
||||
feather52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
|
||||
feather52840.menu.debug.l1=Level 1 (Error Message)
|
||||
@@ -232,7 +112,7 @@ feather52840.menu.debug.l3=Level 3 (Segger SystemView)
|
||||
feather52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
|
||||
feather52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
|
||||
|
||||
# Debug Output Menu
|
||||
# Menu: Debug Port
|
||||
feather52840.menu.debug_output.serial=Serial
|
||||
feather52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
|
||||
feather52840.menu.debug_output.serial1=Serial1
|
||||
@@ -274,17 +154,18 @@ feather52840sense.build.usb_manufacturer="Adafruit"
|
||||
feather52840sense.build.usb_product="Feather nRF52840 Sense"
|
||||
feather52840sense.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
|
||||
feather52840sense.build.ldscript=nrf52840_s140_v6.ld
|
||||
feather52840sense.build.openocdscript=scripts/openocd/daplink_nrf52.cfg
|
||||
feather52840sense.build.vid=0x239A
|
||||
feather52840sense.build.pid=0x8087
|
||||
feather52840sense.build.uf2_family=0xADA52840
|
||||
|
||||
# SoftDevice Menu
|
||||
# Menu: SoftDevice
|
||||
feather52840sense.menu.softdevice.s140v6=S140 6.1.1
|
||||
feather52840sense.menu.softdevice.s140v6.build.sd_name=s140
|
||||
feather52840sense.menu.softdevice.s140v6.build.sd_version=6.1.1
|
||||
feather52840sense.menu.softdevice.s140v6.build.sd_fwid=0x00B6
|
||||
|
||||
# Debug Menu
|
||||
# Menu: Debug Level
|
||||
feather52840sense.menu.debug.l0=Level 0 (Release)
|
||||
feather52840sense.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
|
||||
feather52840sense.menu.debug.l1=Level 1 (Error Message)
|
||||
@@ -295,7 +176,7 @@ feather52840sense.menu.debug.l3=Level 3 (Segger SystemView)
|
||||
feather52840sense.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
|
||||
feather52840sense.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
|
||||
|
||||
# Debug Output Menu
|
||||
# Menu: Debug Port
|
||||
feather52840sense.menu.debug_output.serial=Serial
|
||||
feather52840sense.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
|
||||
feather52840sense.menu.debug_output.serial1=Serial1
|
||||
@@ -303,6 +184,70 @@ feather52840sense.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -D
|
||||
feather52840sense.menu.debug_output.rtt=Segger RTT
|
||||
feather52840sense.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
|
||||
# -----------------------------------
|
||||
# Adafruit Feather nRF52840 Sense TFT
|
||||
# -----------------------------------
|
||||
feather_nrf52840_sense_tft.name=Adafruit Feather nRF52840 Sense TFT
|
||||
|
||||
# VID/PID for Bootloader, Arduino & CircuitPython
|
||||
feather_nrf52840_sense_tft.vid.0=0x239A
|
||||
feather_nrf52840_sense_tft.pid.0=0x8087
|
||||
feather_nrf52840_sense_tft.vid.1=0x239A
|
||||
feather_nrf52840_sense_tft.pid.1=0x0087
|
||||
feather_nrf52840_sense_tft.vid.2=0x239A
|
||||
feather_nrf52840_sense_tft.pid.2=0x0088
|
||||
feather_nrf52840_sense_tft.vid.3=0x239A
|
||||
feather_nrf52840_sense_tft.pid.3=0x8088
|
||||
|
||||
# Upload
|
||||
feather_nrf52840_sense_tft.bootloader.tool=bootburn
|
||||
feather_nrf52840_sense_tft.upload.tool=nrfutil
|
||||
feather_nrf52840_sense_tft.upload.protocol=nrfutil
|
||||
feather_nrf52840_sense_tft.upload.use_1200bps_touch=true
|
||||
feather_nrf52840_sense_tft.upload.wait_for_upload_port=true
|
||||
feather_nrf52840_sense_tft.upload.maximum_size=815104
|
||||
feather_nrf52840_sense_tft.upload.maximum_data_size=237568
|
||||
|
||||
# Build
|
||||
feather_nrf52840_sense_tft.build.mcu=cortex-m4
|
||||
feather_nrf52840_sense_tft.build.f_cpu=64000000
|
||||
feather_nrf52840_sense_tft.build.board=NRF52840_FEATHER_SENSE_TFT
|
||||
feather_nrf52840_sense_tft.build.core=nRF5
|
||||
feather_nrf52840_sense_tft.build.variant=feather_nrf52840_sense_tft
|
||||
feather_nrf52840_sense_tft.build.usb_manufacturer="Adafruit"
|
||||
feather_nrf52840_sense_tft.build.usb_product="Feather nRF52840 Sense TFT"
|
||||
feather_nrf52840_sense_tft.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
|
||||
feather_nrf52840_sense_tft.build.ldscript=nrf52840_s140_v6.ld
|
||||
feather_nrf52840_sense_tft.build.openocdscript=scripts/openocd/daplink_nrf52.cfg
|
||||
feather_nrf52840_sense_tft.build.vid=0x239A
|
||||
feather_nrf52840_sense_tft.build.pid=0x8087
|
||||
feather_nrf52840_sense_tft.build.uf2_family=0xADA52840
|
||||
|
||||
# Menu: SoftDevice
|
||||
feather_nrf52840_sense_tft.menu.softdevice.s140v6=S140 6.1.1
|
||||
feather_nrf52840_sense_tft.menu.softdevice.s140v6.build.sd_name=s140
|
||||
feather_nrf52840_sense_tft.menu.softdevice.s140v6.build.sd_version=6.1.1
|
||||
feather_nrf52840_sense_tft.menu.softdevice.s140v6.build.sd_fwid=0x00B6
|
||||
|
||||
# Menu: Debug Level
|
||||
feather_nrf52840_sense_tft.menu.debug.l0=Level 0 (Release)
|
||||
feather_nrf52840_sense_tft.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
|
||||
feather_nrf52840_sense_tft.menu.debug.l1=Level 1 (Error Message)
|
||||
feather_nrf52840_sense_tft.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1
|
||||
feather_nrf52840_sense_tft.menu.debug.l2=Level 2 (Full Debug)
|
||||
feather_nrf52840_sense_tft.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
|
||||
feather_nrf52840_sense_tft.menu.debug.l3=Level 3 (Segger SystemView)
|
||||
feather_nrf52840_sense_tft.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
|
||||
feather_nrf52840_sense_tft.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
|
||||
|
||||
# Menu: Debug Port
|
||||
feather_nrf52840_sense_tft.menu.debug_output.serial=Serial
|
||||
feather_nrf52840_sense_tft.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
|
||||
feather_nrf52840_sense_tft.menu.debug_output.serial1=Serial1
|
||||
feather_nrf52840_sense_tft.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG
|
||||
feather_nrf52840_sense_tft.menu.debug_output.rtt=Segger RTT
|
||||
feather_nrf52840_sense_tft.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
|
||||
# -----------------------------------
|
||||
# Adafruit ItsyBitsy nRF52840 Express
|
||||
# -----------------------------------
|
||||
@@ -337,17 +282,18 @@ itsybitsy52840.build.usb_manufacturer="Adafruit"
|
||||
itsybitsy52840.build.usb_product="ItsyBitsy nRF52840 Express"
|
||||
itsybitsy52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
|
||||
itsybitsy52840.build.ldscript=nrf52840_s140_v6.ld
|
||||
itsybitsy52840.build.openocdscript=scripts/openocd/daplink_nrf52.cfg
|
||||
itsybitsy52840.build.vid=0x239A
|
||||
itsybitsy52840.build.pid=0x8051
|
||||
itsybitsy52840.build.uf2_family=0xADA52840
|
||||
|
||||
# SoftDevice Menu
|
||||
# Menu: SoftDevice
|
||||
itsybitsy52840.menu.softdevice.s140v6=S140 6.1.1
|
||||
itsybitsy52840.menu.softdevice.s140v6.build.sd_name=s140
|
||||
itsybitsy52840.menu.softdevice.s140v6.build.sd_version=6.1.1
|
||||
itsybitsy52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6
|
||||
|
||||
# Debug Menu
|
||||
# Menu: Debug Level
|
||||
itsybitsy52840.menu.debug.l0=Level 0 (Release)
|
||||
itsybitsy52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
|
||||
itsybitsy52840.menu.debug.l1=Level 1 (Error Message)
|
||||
@@ -358,7 +304,7 @@ itsybitsy52840.menu.debug.l3=Level 3 (Segger SystemView)
|
||||
itsybitsy52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
|
||||
itsybitsy52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
|
||||
|
||||
# Debug Output Menu
|
||||
# Menu: Debug Port
|
||||
itsybitsy52840.menu.debug_output.serial=Serial
|
||||
itsybitsy52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
|
||||
itsybitsy52840.menu.debug_output.serial1=Serial1
|
||||
@@ -366,6 +312,130 @@ itsybitsy52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG
|
||||
itsybitsy52840.menu.debug_output.rtt=Segger RTT
|
||||
itsybitsy52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
|
||||
# -----------------------------------
|
||||
# Adafruit Circuit Playground Bluefruit
|
||||
# -----------------------------------
|
||||
cplaynrf52840.name=Adafruit Circuit Playground Bluefruit
|
||||
|
||||
# VID/PID for Bootloader, Arduino & CircuitPython
|
||||
cplaynrf52840.vid.0=0x239A
|
||||
cplaynrf52840.pid.0=0x8045
|
||||
cplaynrf52840.vid.1=0x239A
|
||||
cplaynrf52840.pid.1=0x0045
|
||||
cplaynrf52840.vid.2=0x239A
|
||||
cplaynrf52840.pid.2=0x8046
|
||||
|
||||
# Upload
|
||||
cplaynrf52840.bootloader.tool=bootburn
|
||||
cplaynrf52840.upload.tool=nrfutil
|
||||
cplaynrf52840.upload.protocol=nrfutil
|
||||
cplaynrf52840.upload.use_1200bps_touch=true
|
||||
cplaynrf52840.upload.wait_for_upload_port=true
|
||||
cplaynrf52840.upload.maximum_size=815104
|
||||
cplaynrf52840.upload.maximum_data_size=237568
|
||||
|
||||
# Build
|
||||
cplaynrf52840.build.mcu=cortex-m4
|
||||
cplaynrf52840.build.f_cpu=64000000
|
||||
cplaynrf52840.build.board=NRF52840_CIRCUITPLAY
|
||||
cplaynrf52840.build.core=nRF5
|
||||
cplaynrf52840.build.variant=circuitplayground_nrf52840
|
||||
cplaynrf52840.build.usb_manufacturer="Adafruit"
|
||||
cplaynrf52840.build.usb_product="Circuit Playground Bluefruit"
|
||||
cplaynrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
|
||||
cplaynrf52840.build.ldscript=nrf52840_s140_v6.ld
|
||||
cplaynrf52840.build.openocdscript=scripts/openocd/daplink_nrf52.cfg
|
||||
cplaynrf52840.build.vid=0x239A
|
||||
cplaynrf52840.build.pid=0x8045
|
||||
cplaynrf52840.build.uf2_family=0xADA52840
|
||||
|
||||
# Menu: SoftDevice
|
||||
cplaynrf52840.menu.softdevice.s140v6=S140 6.1.1
|
||||
cplaynrf52840.menu.softdevice.s140v6.build.sd_name=s140
|
||||
cplaynrf52840.menu.softdevice.s140v6.build.sd_version=6.1.1
|
||||
cplaynrf52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6
|
||||
|
||||
# Menu: Debug Level
|
||||
cplaynrf52840.menu.debug.l0=Level 0 (Release)
|
||||
cplaynrf52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
|
||||
cplaynrf52840.menu.debug.l1=Level 1 (Error Message)
|
||||
cplaynrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1
|
||||
cplaynrf52840.menu.debug.l2=Level 2 (Full Debug)
|
||||
cplaynrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
|
||||
cplaynrf52840.menu.debug.l3=Level 3 (Segger SystemView)
|
||||
cplaynrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
|
||||
cplaynrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
|
||||
|
||||
# Menu: Debug Port
|
||||
cplaynrf52840.menu.debug_output.serial=Serial
|
||||
cplaynrf52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
|
||||
cplaynrf52840.menu.debug_output.serial1=Serial1
|
||||
cplaynrf52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG
|
||||
cplaynrf52840.menu.debug_output.rtt=Segger RTT
|
||||
cplaynrf52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
|
||||
# -----------------------------------
|
||||
# Adafruit CLUE
|
||||
# -----------------------------------
|
||||
cluenrf52840.name=Adafruit CLUE
|
||||
|
||||
# VID/PID for Bootloader, Arduino & CircuitPython
|
||||
cluenrf52840.vid.0=0x239A
|
||||
cluenrf52840.pid.0=0x8071
|
||||
cluenrf52840.vid.1=0x239A
|
||||
cluenrf52840.pid.1=0x0071
|
||||
cluenrf52840.vid.2=0x239A
|
||||
cluenrf52840.pid.2=0x8072
|
||||
|
||||
# Upload
|
||||
cluenrf52840.bootloader.tool=bootburn
|
||||
cluenrf52840.upload.tool=nrfutil
|
||||
cluenrf52840.upload.protocol=nrfutil
|
||||
cluenrf52840.upload.use_1200bps_touch=true
|
||||
cluenrf52840.upload.wait_for_upload_port=true
|
||||
cluenrf52840.upload.maximum_size=815104
|
||||
cluenrf52840.upload.maximum_data_size=237568
|
||||
|
||||
# Build
|
||||
cluenrf52840.build.mcu=cortex-m4
|
||||
cluenrf52840.build.f_cpu=64000000
|
||||
cluenrf52840.build.board=NRF52840_CLUE
|
||||
cluenrf52840.build.core=nRF5
|
||||
cluenrf52840.build.variant=clue_nrf52840
|
||||
cluenrf52840.build.usb_manufacturer="Adafruit"
|
||||
cluenrf52840.build.usb_product="CLUE"
|
||||
cluenrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
|
||||
cluenrf52840.build.ldscript=nrf52840_s140_v6.ld
|
||||
cluenrf52840.build.openocdscript=scripts/openocd/daplink_nrf52.cfg
|
||||
cluenrf52840.build.vid=0x239A
|
||||
cluenrf52840.build.pid=0x8071
|
||||
cluenrf52840.build.uf2_family=0xADA52840
|
||||
|
||||
# Menu: SoftDevice
|
||||
cluenrf52840.menu.softdevice.s140v6=S140 6.1.1
|
||||
cluenrf52840.menu.softdevice.s140v6.build.sd_name=s140
|
||||
cluenrf52840.menu.softdevice.s140v6.build.sd_version=6.1.1
|
||||
cluenrf52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6
|
||||
|
||||
# Menu: Debug Level
|
||||
cluenrf52840.menu.debug.l0=Level 0 (Release)
|
||||
cluenrf52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
|
||||
cluenrf52840.menu.debug.l1=Level 1 (Error Message)
|
||||
cluenrf52840.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1
|
||||
cluenrf52840.menu.debug.l2=Level 2 (Full Debug)
|
||||
cluenrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
|
||||
cluenrf52840.menu.debug.l3=Level 3 (Segger SystemView)
|
||||
cluenrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
|
||||
cluenrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
|
||||
|
||||
# Menu: Debug Port
|
||||
cluenrf52840.menu.debug_output.serial=Serial
|
||||
cluenrf52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
|
||||
cluenrf52840.menu.debug_output.serial1=Serial1
|
||||
cluenrf52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG
|
||||
cluenrf52840.menu.debug_output.rtt=Segger RTT
|
||||
cluenrf52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
|
||||
# -----------------------------------
|
||||
# Adafruit LED Glasses Driver nRF52840
|
||||
# -----------------------------------
|
||||
@@ -398,17 +468,18 @@ ledglasses_nrf52840.build.usb_manufacturer="Adafruit"
|
||||
ledglasses_nrf52840.build.usb_product="LED Glasses Driver nRF52840"
|
||||
ledglasses_nrf52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
|
||||
ledglasses_nrf52840.build.ldscript=nrf52840_s140_v6.ld
|
||||
ledglasses_nrf52840.build.openocdscript=scripts/openocd/daplink_nrf52.cfg
|
||||
ledglasses_nrf52840.build.vid=0x239A
|
||||
ledglasses_nrf52840.build.pid=0x810D
|
||||
ledglasses_nrf52840.build.uf2_family=0xADA52840
|
||||
|
||||
# SoftDevice Menu
|
||||
# Menu: SoftDevice
|
||||
ledglasses_nrf52840.menu.softdevice.s140v6=S140 6.1.1
|
||||
ledglasses_nrf52840.menu.softdevice.s140v6.build.sd_name=s140
|
||||
ledglasses_nrf52840.menu.softdevice.s140v6.build.sd_version=6.1.1
|
||||
ledglasses_nrf52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6
|
||||
|
||||
# Debug Menu
|
||||
# Menu: Debug Level
|
||||
ledglasses_nrf52840.menu.debug.l0=Level 0 (Release)
|
||||
ledglasses_nrf52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
|
||||
ledglasses_nrf52840.menu.debug.l1=Level 1 (Error Message)
|
||||
@@ -419,7 +490,7 @@ ledglasses_nrf52840.menu.debug.l3=Level 3 (Segger SystemView)
|
||||
ledglasses_nrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
|
||||
ledglasses_nrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
|
||||
|
||||
# Debug Output Menu
|
||||
# Menu: Debug Port
|
||||
ledglasses_nrf52840.menu.debug_output.serial=Serial
|
||||
ledglasses_nrf52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
|
||||
ledglasses_nrf52840.menu.debug_output.serial1=Serial1
|
||||
@@ -459,17 +530,18 @@ mdbt50qrx.build.usb_manufacturer="Raytac"
|
||||
mdbt50qrx.build.usb_product="nRF52840 Dongle"
|
||||
mdbt50qrx.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
|
||||
mdbt50qrx.build.ldscript=nrf52840_s140_v6.ld
|
||||
mdbt50qrx.build.openocdscript=scripts/openocd/daplink_nrf52.cfg
|
||||
mdbt50qrx.build.vid=0x239A
|
||||
mdbt50qrx.build.pid=0x810B
|
||||
mdbt50qrx.build.uf2_family=0xADA52840
|
||||
|
||||
# SoftDevice Menu
|
||||
# Menu: SoftDevice
|
||||
mdbt50qrx.menu.softdevice.s140v6=S140 6.1.1
|
||||
mdbt50qrx.menu.softdevice.s140v6.build.sd_name=s140
|
||||
mdbt50qrx.menu.softdevice.s140v6.build.sd_version=6.1.1
|
||||
mdbt50qrx.menu.softdevice.s140v6.build.sd_fwid=0x00B6
|
||||
|
||||
# Debug Menu
|
||||
# Menu: Debug Level
|
||||
mdbt50qrx.menu.debug.l0=Level 0 (Release)
|
||||
mdbt50qrx.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
|
||||
mdbt50qrx.menu.debug.l1=Level 1 (Error Message)
|
||||
@@ -480,7 +552,7 @@ mdbt50qrx.menu.debug.l3=Level 3 (Segger SystemView)
|
||||
mdbt50qrx.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
|
||||
mdbt50qrx.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
|
||||
|
||||
# Debug Output Menu
|
||||
# Menu: Debug Port
|
||||
mdbt50qrx.menu.debug_output.serial=Serial
|
||||
mdbt50qrx.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
|
||||
mdbt50qrx.menu.debug_output.serial1=Serial1
|
||||
@@ -488,12 +560,6 @@ mdbt50qrx.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB
|
||||
mdbt50qrx.menu.debug_output.rtt=Segger RTT
|
||||
mdbt50qrx.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
|
||||
# -------------------------------------------------------
|
||||
#
|
||||
# Boards not yet in production
|
||||
#
|
||||
# -------------------------------------------------------
|
||||
|
||||
# -----------------------------------
|
||||
# Adafruit Metro nRF52840 Express
|
||||
# -----------------------------------
|
||||
@@ -528,17 +594,18 @@ metro52840.build.usb_manufacturer="Adafruit"
|
||||
metro52840.build.usb_product="Metro nRF52840 Express"
|
||||
metro52840.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
|
||||
metro52840.build.ldscript=nrf52840_s140_v6.ld
|
||||
metro52840.build.openocdscript=scripts/openocd/daplink_nrf52.cfg
|
||||
metro52840.build.vid=0x239A
|
||||
metro52840.build.pid=0x803F
|
||||
metro52840.build.uf2_family=0xADA52840
|
||||
|
||||
# SoftDevice Menu
|
||||
# Menu: SoftDevice
|
||||
metro52840.menu.softdevice.s140v6=S140 6.1.1
|
||||
metro52840.menu.softdevice.s140v6.build.sd_name=s140
|
||||
metro52840.menu.softdevice.s140v6.build.sd_version=6.1.1
|
||||
metro52840.menu.softdevice.s140v6.build.sd_fwid=0x00B6
|
||||
|
||||
# Debug Menu
|
||||
# Menu: Debug Level
|
||||
metro52840.menu.debug.l0=Level 0 (Release)
|
||||
metro52840.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
|
||||
metro52840.menu.debug.l1=Level 1 (Error Message)
|
||||
@@ -549,7 +616,7 @@ metro52840.menu.debug.l3=Level 3 (Segger SystemView)
|
||||
metro52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
|
||||
metro52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
|
||||
|
||||
# Debug Output Menu
|
||||
# Menu: Debug Port
|
||||
metro52840.menu.debug_output.serial=Serial
|
||||
metro52840.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
|
||||
metro52840.menu.debug_output.serial1=Serial1
|
||||
@@ -557,135 +624,12 @@ metro52840.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUS
|
||||
metro52840.menu.debug_output.rtt=Segger RTT
|
||||
metro52840.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
|
||||
# -----------------------------------
|
||||
# Adafruit Feather nRF52833 Express
|
||||
# -----------------------------------
|
||||
feather52833.name=Adafruit Feather nRF52833 Express
|
||||
|
||||
# VID/PID for Bootloader, Arduino & CircuitPython
|
||||
feather52833.vid.0=0x239A
|
||||
feather52833.pid.0=0x8029
|
||||
feather52833.vid.1=0x239A
|
||||
feather52833.pid.1=0x0029
|
||||
feather52833.vid.2=0x239A
|
||||
feather52833.pid.2=0x002A
|
||||
feather52833.vid.3=0x239A
|
||||
feather52833.pid.3=0x802A
|
||||
|
||||
# Upload
|
||||
feather52833.bootloader.tool=bootburn
|
||||
feather52833.upload.tool=nrfutil
|
||||
feather52833.upload.protocol=nrfutil
|
||||
feather52833.upload.use_1200bps_touch=true
|
||||
feather52833.upload.wait_for_upload_port=true
|
||||
feather52833.upload.maximum_size=286720
|
||||
feather52833.upload.maximum_data_size=106496
|
||||
|
||||
# Build
|
||||
feather52833.build.mcu=cortex-m4
|
||||
feather52833.build.f_cpu=64000000
|
||||
feather52833.build.board=NRF52833_FEATHER
|
||||
feather52833.build.core=nRF5
|
||||
feather52833.build.variant=feather_nrf52833_express
|
||||
feather52833.build.usb_manufacturer="Adafruit"
|
||||
feather52833.build.usb_product="Feather nRF52833 Express"
|
||||
feather52833.build.extra_flags=-DNRF52833_XXAA {build.flags.usb}
|
||||
feather52833.build.ldscript=nrf52833_s140_v7.ld
|
||||
feather52833.build.vid=0x239A
|
||||
feather52833.build.pid=0x8029
|
||||
feather52833.build.uf2_family=0x621E937A
|
||||
|
||||
# SoftDevice Menu
|
||||
feather52833.menu.softdevice.s140v7=S140 7.3.0
|
||||
feather52833.menu.softdevice.s140v7.build.sd_name=s140
|
||||
feather52833.menu.softdevice.s140v7.build.sd_version=7.3.0
|
||||
feather52833.menu.softdevice.s140v7.build.sd_fwid=0x0123
|
||||
|
||||
# Debug Menu
|
||||
feather52833.menu.debug.l0=Level 0 (Release)
|
||||
feather52833.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
|
||||
feather52833.menu.debug.l1=Level 1 (Error Message)
|
||||
feather52833.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1
|
||||
feather52833.menu.debug.l2=Level 2 (Full Debug)
|
||||
feather52833.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
|
||||
feather52833.menu.debug.l3=Level 3 (Segger SystemView)
|
||||
feather52833.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
|
||||
feather52833.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
|
||||
|
||||
# Debug Output Menu
|
||||
feather52833.menu.debug_output.serial=Serial
|
||||
feather52833.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
|
||||
feather52833.menu.debug_output.serial1=Serial1
|
||||
feather52833.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG
|
||||
feather52833.menu.debug_output.rtt=Segger RTT
|
||||
feather52833.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
|
||||
|
||||
# -------------------------------------------------------
|
||||
#
|
||||
# Boards by 3rd Party (not Adafruit)
|
||||
#
|
||||
# Boards that aren't made by Adafruit
|
||||
# and are not officially supported
|
||||
# -------------------------------------------------------
|
||||
|
||||
# -----------------------------------
|
||||
# Particle Xenon
|
||||
# -----------------------------------
|
||||
particle_xenon.name=Particle Xenon
|
||||
|
||||
# VID/PID for Bootloader, Arduino & CircuitPython
|
||||
particle_xenon.vid.0=0x239A
|
||||
particle_xenon.pid.0=0x8029
|
||||
particle_xenon.vid.1=0x239A
|
||||
particle_xenon.pid.1=0x0029
|
||||
|
||||
# Upload
|
||||
particle_xenon.bootloader.tool=bootburn
|
||||
particle_xenon.upload.tool=nrfutil
|
||||
particle_xenon.upload.protocol=nrfutil
|
||||
particle_xenon.upload.use_1200bps_touch=true
|
||||
particle_xenon.upload.wait_for_upload_port=true
|
||||
particle_xenon.upload.maximum_size=815104
|
||||
particle_xenon.upload.maximum_data_size=237568
|
||||
|
||||
# Build
|
||||
particle_xenon.build.mcu=cortex-m4
|
||||
particle_xenon.build.f_cpu=64000000
|
||||
particle_xenon.build.board=PARTICLE_XENON
|
||||
particle_xenon.build.core=nRF5
|
||||
particle_xenon.build.variant=particle_xenon
|
||||
particle_xenon.build.usb_manufacturer="Particle"
|
||||
particle_xenon.build.usb_product="Xenon"
|
||||
particle_xenon.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
|
||||
particle_xenon.build.ldscript=nrf52840_s140_v6.ld
|
||||
particle_xenon.build.vid=0x239A
|
||||
particle_xenon.build.pid=0x8029
|
||||
particle_xenon.build.uf2_family=0xADA52840
|
||||
|
||||
# SoftDevice Menu
|
||||
particle_xenon.menu.softdevice.s140v6=S140 6.1.1
|
||||
particle_xenon.menu.softdevice.s140v6.build.sd_name=s140
|
||||
particle_xenon.menu.softdevice.s140v6.build.sd_version=6.1.1
|
||||
particle_xenon.menu.softdevice.s140v6.build.sd_fwid=0x00B6
|
||||
|
||||
# Debug Menu
|
||||
particle_xenon.menu.debug.l0=Level 0 (Release)
|
||||
particle_xenon.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
|
||||
particle_xenon.menu.debug.l1=Level 1 (Error Message)
|
||||
particle_xenon.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1
|
||||
particle_xenon.menu.debug.l2=Level 2 (Full Debug)
|
||||
particle_xenon.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
|
||||
particle_xenon.menu.debug.l3=Level 3 (Segger SystemView)
|
||||
particle_xenon.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
|
||||
particle_xenon.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
|
||||
|
||||
# Debug Output Menu
|
||||
particle_xenon.menu.debug_output.serial=Serial
|
||||
particle_xenon.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
|
||||
particle_xenon.menu.debug_output.serial1=Serial1
|
||||
particle_xenon.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG
|
||||
particle_xenon.menu.debug_output.rtt=Segger RTT
|
||||
particle_xenon.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
|
||||
# -----------------------------------
|
||||
# Nordic nRF52840 DK
|
||||
# -----------------------------------
|
||||
@@ -716,17 +660,18 @@ pca10056.build.usb_manufacturer="Nordic"
|
||||
pca10056.build.usb_product="nRF52840 DK"
|
||||
pca10056.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
|
||||
pca10056.build.ldscript=nrf52840_s140_v6.ld
|
||||
pca10056.build.openocdscript=scripts/openocd/daplink_nrf52.cfg
|
||||
pca10056.build.vid=0x239A
|
||||
pca10056.build.pid=0x8029
|
||||
pca10056.build.uf2_family=0xADA52840
|
||||
|
||||
# SoftDevice Menu
|
||||
# Menu: SoftDevice
|
||||
pca10056.menu.softdevice.s140v6=S140 6.1.1
|
||||
pca10056.menu.softdevice.s140v6.build.sd_name=s140
|
||||
pca10056.menu.softdevice.s140v6.build.sd_version=6.1.1
|
||||
pca10056.menu.softdevice.s140v6.build.sd_fwid=0x00B6
|
||||
|
||||
# Debug Menu
|
||||
# Menu: Debug Level
|
||||
pca10056.menu.debug.l0=Level 0 (Release)
|
||||
pca10056.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
|
||||
pca10056.menu.debug.l1=Level 1 (Error Message)
|
||||
@@ -737,10 +682,70 @@ pca10056.menu.debug.l3=Level 3 (Segger SystemView)
|
||||
pca10056.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
|
||||
pca10056.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
|
||||
|
||||
# Debug Output Menu
|
||||
# Menu: Debug Port
|
||||
pca10056.menu.debug_output.serial=Serial
|
||||
pca10056.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
|
||||
pca10056.menu.debug_output.serial1=Serial1
|
||||
pca10056.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG
|
||||
pca10056.menu.debug_output.rtt=Segger RTT
|
||||
pca10056.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
|
||||
# -----------------------------------
|
||||
# Particle Xenon
|
||||
# -----------------------------------
|
||||
particle_xenon.name=Particle Xenon
|
||||
|
||||
# VID/PID for Bootloader, Arduino & CircuitPython
|
||||
particle_xenon.vid.0=0x239A
|
||||
particle_xenon.pid.0=0x8029
|
||||
particle_xenon.vid.1=0x239A
|
||||
particle_xenon.pid.1=0x0029
|
||||
|
||||
# Upload
|
||||
particle_xenon.bootloader.tool=bootburn
|
||||
particle_xenon.upload.tool=nrfutil
|
||||
particle_xenon.upload.protocol=nrfutil
|
||||
particle_xenon.upload.use_1200bps_touch=true
|
||||
particle_xenon.upload.wait_for_upload_port=true
|
||||
particle_xenon.upload.maximum_size=815104
|
||||
particle_xenon.upload.maximum_data_size=237568
|
||||
|
||||
# Build
|
||||
particle_xenon.build.mcu=cortex-m4
|
||||
particle_xenon.build.f_cpu=64000000
|
||||
particle_xenon.build.board=PARTICLE_XENON
|
||||
particle_xenon.build.core=nRF5
|
||||
particle_xenon.build.variant=particle_xenon
|
||||
particle_xenon.build.usb_manufacturer="Particle"
|
||||
particle_xenon.build.usb_product="Xenon"
|
||||
particle_xenon.build.extra_flags=-DNRF52840_XXAA {build.flags.usb}
|
||||
particle_xenon.build.ldscript=nrf52840_s140_v6.ld
|
||||
particle_xenon.build.openocdscript=scripts/openocd/daplink_nrf52.cfg
|
||||
particle_xenon.build.vid=0x239A
|
||||
particle_xenon.build.pid=0x8029
|
||||
particle_xenon.build.uf2_family=0xADA52840
|
||||
|
||||
# Menu: SoftDevice
|
||||
particle_xenon.menu.softdevice.s140v6=S140 6.1.1
|
||||
particle_xenon.menu.softdevice.s140v6.build.sd_name=s140
|
||||
particle_xenon.menu.softdevice.s140v6.build.sd_version=6.1.1
|
||||
particle_xenon.menu.softdevice.s140v6.build.sd_fwid=0x00B6
|
||||
|
||||
# Menu: Debug Level
|
||||
particle_xenon.menu.debug.l0=Level 0 (Release)
|
||||
particle_xenon.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0
|
||||
particle_xenon.menu.debug.l1=Level 1 (Error Message)
|
||||
particle_xenon.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1
|
||||
particle_xenon.menu.debug.l2=Level 2 (Full Debug)
|
||||
particle_xenon.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
|
||||
particle_xenon.menu.debug.l3=Level 3 (Segger SystemView)
|
||||
particle_xenon.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
|
||||
particle_xenon.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
|
||||
|
||||
# Menu: Debug Port
|
||||
particle_xenon.menu.debug_output.serial=Serial
|
||||
particle_xenon.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0
|
||||
particle_xenon.menu.debug_output.serial1=Serial1
|
||||
particle_xenon.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG
|
||||
particle_xenon.menu.debug_output.rtt=Segger RTT
|
||||
particle_xenon.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL
|
||||
+1962
-2032
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+2142
-2072
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1280
-1342
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
-11819
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+2009
-2045
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+1990
-2053
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+2145
-2075
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
BIN
Binary file not shown.
+1998
-2063
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
+11655
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+1984
-2066
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1967
-2036
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1934
-2005
File diff suppressed because it is too large.
Load diff
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -205,6 +205,15 @@ bool HardwarePWM::removePin(uint8_t pin)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HardwarePWM::removeAllPins(void)
|
||||
{
|
||||
for(int ch=0; ch<MAX_CHANNELS; ch++)
|
||||
{
|
||||
_set_psel(ch, 0xFFFFFFFFUL);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HardwarePWM::writeChannel(uint8_t ch, uint16_t value, bool inverted)
|
||||
{
|
||||
VERIFY( ch < MAX_CHANNELS );
|
||||
|
||||
@@ -88,6 +88,9 @@ class HardwarePWM
|
||||
// Remove a pin from PWM module
|
||||
bool removePin (uint8_t pin);
|
||||
|
||||
// Remove all pins from PWM module
|
||||
bool removeAllPins (void);
|
||||
|
||||
// Get the mapped channel of a pin
|
||||
int pin2channel(uint8_t pin) const
|
||||
{
|
||||
|
||||
@@ -70,6 +70,7 @@ class HardwareSerial : public Stream
|
||||
virtual void flush(void) = 0;
|
||||
virtual size_t write(uint8_t) = 0;
|
||||
virtual size_t write(const uint8_t *buffer, size_t size) = 0;
|
||||
virtual int availableForWrite(void);
|
||||
using Print::write; // pull in write(str) from Print
|
||||
virtual operator bool() = 0;
|
||||
};
|
||||
|
||||
@@ -67,6 +67,14 @@ int RingBuffer::available()
|
||||
return delta;
|
||||
}
|
||||
|
||||
int RingBuffer::availableForStore() {
|
||||
if (_iHead >= _iTail) {
|
||||
return SERIAL_BUFFER_SIZE - 1 - _iHead + _iTail;
|
||||
} else {
|
||||
return _iTail - _iHead - 1;
|
||||
}
|
||||
}
|
||||
|
||||
int RingBuffer::peek()
|
||||
{
|
||||
if(_iTail == _iHead)
|
||||
|
||||
@@ -39,14 +39,15 @@ class RingBuffer
|
||||
public:
|
||||
RingBuffer( void ) ;
|
||||
void store_char( uint8_t c ) ;
|
||||
void clear();
|
||||
int read_char();
|
||||
int available();
|
||||
int peek();
|
||||
bool isFull();
|
||||
void clear();
|
||||
int read_char();
|
||||
int available();
|
||||
int availableForStore();
|
||||
int peek();
|
||||
bool isFull();
|
||||
|
||||
private:
|
||||
int nextIndex(int index);
|
||||
int nextIndex(int index);
|
||||
} ;
|
||||
|
||||
#endif /* _RING_BUFFER_ */
|
||||
@@ -253,6 +253,12 @@ size_t Uart::write(const uint8_t *buffer, size_t size)
|
||||
return sent;
|
||||
}
|
||||
|
||||
int Uart::availableForWrite(void) {
|
||||
// UART does not use ring buffer for TX, therefore it is either busy or not
|
||||
UBaseType_t available = uxSemaphoreGetCount(_end_tx_sem);
|
||||
return available ? SERIAL_BUFFER_SIZE : 0;
|
||||
}
|
||||
|
||||
//------------- Serial1 (or Serial in case of nRF52832) -------------//
|
||||
#ifdef NRF52832_XXAA
|
||||
Uart Serial( NRF_UARTE0, UARTE0_UART0_IRQn, PIN_SERIAL_RX, PIN_SERIAL_TX );
|
||||
|
||||
@@ -39,6 +39,7 @@ class Uart : public HardwareSerial
|
||||
void begin(unsigned long baudrate, uint16_t config);
|
||||
void end();
|
||||
int available();
|
||||
int availableForWrite(void);
|
||||
int peek();
|
||||
int read();
|
||||
void flush();
|
||||
|
||||
@@ -179,13 +179,13 @@ const char* dbg_err_str(int32_t err_id); // TODO move to other place
|
||||
#define PRINT_LOCATION() PRINTF("%s: %d:\r\n", __PRETTY_FUNCTION__, __LINE__)
|
||||
#define PRINT_MESS(x) PRINTF("%s: %d: %s \r\n" , __FUNCTION__, __LINE__, (char*)(x))
|
||||
#define PRINT_HEAP() if (CFG_DEBUG >= 3) PRINTF("\n%s: %d: Heap free: %d\r\n", __FUNCTION__, __LINE__, util_heap_get_free_size())
|
||||
#define PRINT_STR(x) PRINTF("%s: %d: " #x " = %s\r\n" , __FUNCTION__, __LINE__, (char*)(x) )
|
||||
#define PRINT_INT(x) PRINTF("%s: %d: " #x " = %ld\r\n" , __FUNCTION__, __LINE__, (uint32_t) (x) )
|
||||
#define PRINT_FLOAT(x) PRINTF("%s: %d: " #x " = %f\r\n" , __FUNCTION__, __LINE__, (float) (x) )
|
||||
#define PRINT_STR(x) PRINTF(#x " = %s\r\n" , (char*)(x) )
|
||||
#define PRINT_INT(x) PRINTF(#x " = %ld\r\n", (uint32_t) (x) )
|
||||
#define PRINT_FLOAT(x) PRINTF(#x " = %f\r\n" , (float) (x) )
|
||||
|
||||
#define PRINT_HEX(x) \
|
||||
do {\
|
||||
PRINTF("%s: %d: " #x " = 0x", __PRETTY_FUNCTION__, __LINE__);\
|
||||
PRINTF(#x " = 0x");\
|
||||
char fmt[] = "%00X\r\n";\
|
||||
fmt[2] += 2*sizeof(x); /* Hex with correct size */\
|
||||
PRINTF(fmt, (x) );\
|
||||
|
||||
@@ -128,6 +128,8 @@ void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEG
|
||||
*/
|
||||
void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;
|
||||
void vPortFree( void *pv ) PRIVILEGED_FUNCTION;
|
||||
void *pvPortRealloc( void *ptr, size_t xWantedSize ) PRIVILEGED_FUNCTION;
|
||||
void *pvPortCalloc( size_t nmemb, size_t xWantedSize ) PRIVILEGED_FUNCTION;
|
||||
void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
|
||||
size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
|
||||
size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
@@ -59,6 +59,8 @@ task.h is included from an application file. */
|
||||
// require "-Wl,--wrap=malloc -Wl,--wrap=free" linker option
|
||||
extern void *__real_malloc(size_t size);
|
||||
extern void __real_free(void *ptr);
|
||||
extern void *__real_realloc(void *ptr, size_t _size);
|
||||
extern void *__real_calloc(size_t nmemb, size_t _size);
|
||||
|
||||
void* __wrap_malloc (size_t c)
|
||||
{
|
||||
@@ -70,6 +72,17 @@ void __wrap_free (void *ptr)
|
||||
return (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) ? vPortFree(ptr) : __real_free(ptr);
|
||||
}
|
||||
|
||||
void* __wrap_realloc (void *ptr, size_t c)
|
||||
{
|
||||
return (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) ? pvPortRealloc(ptr, c) : __real_realloc(ptr, c);
|
||||
}
|
||||
|
||||
void* __wrap_calloc (size_t nmemb, size_t c)
|
||||
{
|
||||
return (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) ? pvPortCalloc(nmemb, c) : __real_calloc(nmemb, c);
|
||||
}
|
||||
|
||||
|
||||
void *pvPortMalloc( size_t xWantedSize )
|
||||
{
|
||||
void *pvReturn;
|
||||
@@ -107,3 +120,53 @@ void vPortFree( void *pv )
|
||||
( void ) xTaskResumeAll();
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void *pvPortRealloc( void *ptr, size_t xWantedSize )
|
||||
{
|
||||
void *pvReturn;
|
||||
|
||||
vTaskSuspendAll();
|
||||
{
|
||||
pvReturn = __real_realloc( ptr, xWantedSize );
|
||||
traceMALLOC( pvReturn, xWantedSize );
|
||||
}
|
||||
( void ) xTaskResumeAll();
|
||||
|
||||
#if( configUSE_MALLOC_FAILED_HOOK == 1 )
|
||||
{
|
||||
if( pvReturn == NULL )
|
||||
{
|
||||
extern void vApplicationMallocFailedHook( void );
|
||||
vApplicationMallocFailedHook();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return pvReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void *pvPortCalloc( size_t nmemb, size_t xWantedSize )
|
||||
{
|
||||
void *pvReturn;
|
||||
|
||||
vTaskSuspendAll();
|
||||
{
|
||||
pvReturn = __real_calloc( nmemb, xWantedSize );
|
||||
traceMALLOC( pvReturn, xWantedSize );
|
||||
}
|
||||
( void ) xTaskResumeAll();
|
||||
|
||||
#if( configUSE_MALLOC_FAILED_HOOK == 1 )
|
||||
{
|
||||
if( pvReturn == NULL )
|
||||
{
|
||||
extern void vApplicationMallocFailedHook( void );
|
||||
vApplicationMallocFailedHook();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return pvReturn;
|
||||
}
|
||||
@@ -0,0 +1,504 @@
|
||||
/*
|
||||
* Copyright (c) 2013 - 2020, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <nrfx.h>
|
||||
|
||||
#if NRFX_CHECK(NRFX_SPIS_ENABLED)
|
||||
|
||||
#if !(NRFX_CHECK(NRFX_SPIS0_ENABLED) || \
|
||||
NRFX_CHECK(NRFX_SPIS1_ENABLED) || \
|
||||
NRFX_CHECK(NRFX_SPIS2_ENABLED) || \
|
||||
NRFX_CHECK(NRFX_SPIS3_ENABLED))
|
||||
#error "No enabled SPIS instances. Check <nrfx_config.h>."
|
||||
#endif
|
||||
|
||||
#include <nrfx_spis.h>
|
||||
#include "prs/nrfx_prs.h"
|
||||
|
||||
#define NRFX_LOG_MODULE SPIS
|
||||
#include <nrfx_log.h>
|
||||
|
||||
#define EVT_TO_STR(event) \
|
||||
(event == NRF_SPIS_EVENT_ACQUIRED ? "NRF_SPIS_EVENT_ACQUIRED" : \
|
||||
(event == NRF_SPIS_EVENT_END ? "NRF_SPIS_EVENT_END" : \
|
||||
"UNKNOWN ERROR"))
|
||||
|
||||
#define SPISX_LENGTH_VALIDATE(peripheral, drv_inst_idx, rx_len, tx_len) \
|
||||
(((drv_inst_idx) == NRFX_CONCAT_3(NRFX_, peripheral, _INST_IDX)) && \
|
||||
NRFX_EASYDMA_LENGTH_VALIDATE(peripheral, rx_len, tx_len))
|
||||
|
||||
#if NRFX_CHECK(NRFX_SPIS0_ENABLED)
|
||||
#define SPIS0_LENGTH_VALIDATE(...) SPISX_LENGTH_VALIDATE(SPIS0, __VA_ARGS__)
|
||||
#else
|
||||
#define SPIS0_LENGTH_VALIDATE(...) 0
|
||||
#endif
|
||||
|
||||
#if NRFX_CHECK(NRFX_SPIS1_ENABLED)
|
||||
#define SPIS1_LENGTH_VALIDATE(...) SPISX_LENGTH_VALIDATE(SPIS1, __VA_ARGS__)
|
||||
#else
|
||||
#define SPIS1_LENGTH_VALIDATE(...) 0
|
||||
#endif
|
||||
|
||||
#if NRFX_CHECK(NRFX_SPIS2_ENABLED)
|
||||
#define SPIS2_LENGTH_VALIDATE(...) SPISX_LENGTH_VALIDATE(SPIS2, __VA_ARGS__)
|
||||
#else
|
||||
#define SPIS2_LENGTH_VALIDATE(...) 0
|
||||
#endif
|
||||
|
||||
#if NRFX_CHECK(NRFX_SPIS3_ENABLED)
|
||||
#define SPIS3_LENGTH_VALIDATE(...) SPISX_LENGTH_VALIDATE(SPIS3, __VA_ARGS__)
|
||||
#else
|
||||
#define SPIS3_LENGTH_VALIDATE(...) 0
|
||||
#endif
|
||||
|
||||
#define SPIS_LENGTH_VALIDATE(drv_inst_idx, rx_len, tx_len) \
|
||||
(SPIS0_LENGTH_VALIDATE(drv_inst_idx, rx_len, tx_len) || \
|
||||
SPIS1_LENGTH_VALIDATE(drv_inst_idx, rx_len, tx_len) || \
|
||||
SPIS2_LENGTH_VALIDATE(drv_inst_idx, rx_len, tx_len) || \
|
||||
SPIS3_LENGTH_VALIDATE(drv_inst_idx, rx_len, tx_len))
|
||||
|
||||
|
||||
#if NRFX_CHECK(NRFX_SPIS_NRF52_ANOMALY_109_WORKAROUND_ENABLED)
|
||||
#include <nrfx_gpiote.h>
|
||||
#define USE_DMA_ISSUE_WORKAROUND
|
||||
// This handler is called by the GPIOTE driver when a falling edge is detected
|
||||
// on the CSN line. There is no need to do anything here. The handling of the
|
||||
// interrupt itself provides a protection for DMA transfers.
|
||||
static void csn_event_handler(nrfx_gpiote_pin_t pin,
|
||||
nrf_gpiote_polarity_t action)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**@brief States of the SPI transaction state machine. */
|
||||
typedef enum
|
||||
{
|
||||
SPIS_STATE_INIT, /**< Initialization state. In this state the module waits for a call to @ref spi_slave_buffers_set. */
|
||||
SPIS_BUFFER_RESOURCE_REQUESTED, /**< State where the configuration of the memory buffers, which are to be used in SPI transaction, has started. */
|
||||
SPIS_BUFFER_RESOURCE_CONFIGURED, /**< State where the configuration of the memory buffers, which are to be used in SPI transaction, has completed. */
|
||||
SPIS_XFER_COMPLETED /**< State where SPI transaction has been completed. */
|
||||
} nrfx_spis_state_t;
|
||||
|
||||
/**@brief SPIS control block - driver instance local data. */
|
||||
typedef struct
|
||||
{
|
||||
volatile uint32_t tx_buffer_size; //!< SPI slave TX buffer size in bytes.
|
||||
volatile uint32_t rx_buffer_size; //!< SPI slave RX buffer size in bytes.
|
||||
nrfx_spis_event_handler_t handler; //!< SPI event handler.
|
||||
volatile const uint8_t * tx_buffer; //!< SPI slave TX buffer.
|
||||
volatile uint8_t * rx_buffer; //!< SPI slave RX buffer.
|
||||
nrfx_drv_state_t state; //!< driver initialization state.
|
||||
volatile nrfx_spis_state_t spi_state; //!< SPI slave state.
|
||||
void * p_context; //!< Context set on initialization.
|
||||
} spis_cb_t;
|
||||
|
||||
static spis_cb_t m_cb[NRFX_SPIS_ENABLED_COUNT];
|
||||
|
||||
nrfx_err_t nrfx_spis_init(nrfx_spis_t const * p_instance,
|
||||
nrfx_spis_config_t const * p_config,
|
||||
nrfx_spis_event_handler_t event_handler,
|
||||
void * p_context)
|
||||
{
|
||||
NRFX_ASSERT(p_config);
|
||||
NRFX_ASSERT(event_handler);
|
||||
spis_cb_t * p_cb = &m_cb[p_instance->drv_inst_idx];
|
||||
nrfx_err_t err_code;
|
||||
|
||||
NRF_SPIS_Type * p_spis = p_instance->p_reg;
|
||||
|
||||
if (p_cb->state != NRFX_DRV_STATE_UNINITIALIZED)
|
||||
{
|
||||
err_code = NRFX_ERROR_INVALID_STATE;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
|
||||
if ((uint32_t)p_config->mode > (uint32_t)NRF_SPIS_MODE_3)
|
||||
{
|
||||
err_code = NRFX_ERROR_INVALID_PARAM;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
#if NRFX_CHECK(NRFX_PRS_ENABLED)
|
||||
static nrfx_irq_handler_t const irq_handlers[NRFX_SPIS_ENABLED_COUNT] = {
|
||||
#if NRFX_CHECK(NRFX_SPIS0_ENABLED)
|
||||
nrfx_spis_0_irq_handler,
|
||||
#endif
|
||||
#if NRFX_CHECK(NRFX_SPIS1_ENABLED)
|
||||
nrfx_spis_1_irq_handler,
|
||||
#endif
|
||||
#if NRFX_CHECK(NRFX_SPIS2_ENABLED)
|
||||
nrfx_spis_2_irq_handler,
|
||||
#endif
|
||||
#if NRFX_CHECK(NRFX_SPIS3_ENABLED)
|
||||
nrfx_spis_3_irq_handler,
|
||||
#endif
|
||||
};
|
||||
if (nrfx_prs_acquire(p_spis,
|
||||
irq_handlers[p_instance->drv_inst_idx]) != NRFX_SUCCESS)
|
||||
{
|
||||
err_code = NRFX_ERROR_BUSY;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
#endif // NRFX_CHECK(NRFX_PRS_ENABLED)
|
||||
|
||||
// Configure the SPI pins for input.
|
||||
uint32_t mosi_pin;
|
||||
uint32_t miso_pin;
|
||||
|
||||
if (p_config->miso_pin != NRFX_SPIS_PIN_NOT_USED)
|
||||
{
|
||||
nrf_gpio_cfg(p_config->miso_pin,
|
||||
NRF_GPIO_PIN_DIR_INPUT,
|
||||
NRF_GPIO_PIN_INPUT_CONNECT,
|
||||
NRF_GPIO_PIN_NOPULL,
|
||||
p_config->miso_drive,
|
||||
NRF_GPIO_PIN_NOSENSE);
|
||||
miso_pin = p_config->miso_pin;
|
||||
}
|
||||
else
|
||||
{
|
||||
miso_pin = NRF_SPIS_PIN_NOT_CONNECTED;
|
||||
}
|
||||
|
||||
if (p_config->mosi_pin != NRFX_SPIS_PIN_NOT_USED)
|
||||
{
|
||||
nrf_gpio_cfg(p_config->mosi_pin,
|
||||
NRF_GPIO_PIN_DIR_INPUT,
|
||||
NRF_GPIO_PIN_INPUT_CONNECT,
|
||||
NRF_GPIO_PIN_NOPULL,
|
||||
NRF_GPIO_PIN_S0S1,
|
||||
NRF_GPIO_PIN_NOSENSE);
|
||||
mosi_pin = p_config->mosi_pin;
|
||||
}
|
||||
else
|
||||
{
|
||||
mosi_pin = NRF_SPIS_PIN_NOT_CONNECTED;
|
||||
}
|
||||
|
||||
nrf_gpio_cfg(p_config->csn_pin,
|
||||
NRF_GPIO_PIN_DIR_INPUT,
|
||||
NRF_GPIO_PIN_INPUT_CONNECT,
|
||||
p_config->csn_pullup,
|
||||
NRF_GPIO_PIN_S0S1,
|
||||
NRF_GPIO_PIN_NOSENSE);
|
||||
|
||||
nrf_gpio_cfg(p_config->sck_pin,
|
||||
NRF_GPIO_PIN_DIR_INPUT,
|
||||
NRF_GPIO_PIN_INPUT_CONNECT,
|
||||
NRF_GPIO_PIN_NOPULL,
|
||||
NRF_GPIO_PIN_S0S1,
|
||||
NRF_GPIO_PIN_NOSENSE);
|
||||
|
||||
nrf_spis_pins_set(p_spis, p_config->sck_pin, mosi_pin, miso_pin, p_config->csn_pin);
|
||||
|
||||
nrf_spis_rx_buffer_set(p_spis, NULL, 0);
|
||||
nrf_spis_tx_buffer_set(p_spis, NULL, 0);
|
||||
|
||||
// Configure SPI mode.
|
||||
nrf_spis_configure(p_spis, p_config->mode, p_config->bit_order);
|
||||
|
||||
// Configure DEF and ORC characters.
|
||||
nrf_spis_def_set(p_spis, p_config->def);
|
||||
nrf_spis_orc_set(p_spis, p_config->orc);
|
||||
|
||||
// Clear possible pending events.
|
||||
nrf_spis_event_clear(p_spis, NRF_SPIS_EVENT_END);
|
||||
nrf_spis_event_clear(p_spis, NRF_SPIS_EVENT_ACQUIRED);
|
||||
|
||||
// Enable END_ACQUIRE shortcut.
|
||||
nrf_spis_shorts_enable(p_spis, NRF_SPIS_SHORT_END_ACQUIRE);
|
||||
|
||||
p_cb->spi_state = SPIS_STATE_INIT;
|
||||
p_cb->handler = event_handler;
|
||||
p_cb->p_context = p_context;
|
||||
|
||||
#if defined(USE_DMA_ISSUE_WORKAROUND)
|
||||
// Configure a GPIOTE channel to generate interrupts on each falling edge
|
||||
// on the CSN line. Handling of these interrupts will make the CPU active,
|
||||
// and thus will protect the DMA transfers started by SPIS right after it
|
||||
// is selected for communication.
|
||||
// [the GPIOTE driver may be already initialized at this point (by this
|
||||
// driver when another SPIS instance is used, or by an application code),
|
||||
// so just ignore the returned value]
|
||||
(void)nrfx_gpiote_init(NRFX_GPIOTE_DEFAULT_CONFIG_IRQ_PRIORITY);
|
||||
static nrfx_gpiote_in_config_t const csn_gpiote_config =
|
||||
NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO(true);
|
||||
nrfx_err_t gpiote_err_code = nrfx_gpiote_in_init(p_config->csn_pin,
|
||||
&csn_gpiote_config, csn_event_handler);
|
||||
if (gpiote_err_code != NRFX_SUCCESS)
|
||||
{
|
||||
err_code = NRFX_ERROR_INTERNAL;
|
||||
NRFX_LOG_INFO("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
nrfx_gpiote_in_event_enable(p_config->csn_pin, true);
|
||||
#endif
|
||||
|
||||
// Enable IRQ.
|
||||
nrf_spis_int_enable(p_spis, NRF_SPIS_INT_ACQUIRED_MASK |
|
||||
NRF_SPIS_INT_END_MASK);
|
||||
NRFX_IRQ_PRIORITY_SET(nrfx_get_irq_number(p_instance->p_reg),
|
||||
p_config->irq_priority);
|
||||
NRFX_IRQ_ENABLE(nrfx_get_irq_number(p_instance->p_reg));
|
||||
|
||||
p_cb->state = NRFX_DRV_STATE_INITIALIZED;
|
||||
|
||||
// Enable SPI slave device.
|
||||
nrf_spis_enable(p_spis);
|
||||
|
||||
NRFX_LOG_INFO("Initialized.");
|
||||
return NRFX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
void nrfx_spis_uninit(nrfx_spis_t const * p_instance)
|
||||
{
|
||||
spis_cb_t * p_cb = &m_cb[p_instance->drv_inst_idx];
|
||||
NRFX_ASSERT(p_cb->state != NRFX_DRV_STATE_UNINITIALIZED);
|
||||
|
||||
NRF_SPIS_Type * p_spis = p_instance->p_reg;
|
||||
|
||||
#define DISABLE_ALL 0xFFFFFFFF
|
||||
nrf_spis_disable(p_spis);
|
||||
NRFX_IRQ_DISABLE(nrfx_get_irq_number(p_instance->p_reg));
|
||||
nrf_spis_int_disable(p_spis, DISABLE_ALL);
|
||||
#undef DISABLE_ALL
|
||||
|
||||
#if NRFX_CHECK(NRFX_PRS_ENABLED)
|
||||
nrfx_prs_release(p_spis);
|
||||
#endif
|
||||
|
||||
p_cb->state = NRFX_DRV_STATE_UNINITIALIZED;
|
||||
NRFX_LOG_INFO("Uninitialized.");
|
||||
}
|
||||
|
||||
|
||||
/**@brief Function for executing the state entry action. */
|
||||
static void spis_state_entry_action_execute(NRF_SPIS_Type * p_spis,
|
||||
spis_cb_t * p_cb)
|
||||
{
|
||||
nrfx_spis_evt_t event;
|
||||
|
||||
switch (p_cb->spi_state)
|
||||
{
|
||||
case SPIS_BUFFER_RESOURCE_REQUESTED:
|
||||
nrf_spis_task_trigger(p_spis, NRF_SPIS_TASK_ACQUIRE);
|
||||
break;
|
||||
|
||||
case SPIS_BUFFER_RESOURCE_CONFIGURED:
|
||||
event.evt_type = NRFX_SPIS_BUFFERS_SET_DONE;
|
||||
event.rx_amount = 0;
|
||||
event.tx_amount = 0;
|
||||
|
||||
NRFX_ASSERT(p_cb->handler != NULL);
|
||||
p_cb->handler(&event, p_cb->p_context);
|
||||
break;
|
||||
|
||||
case SPIS_XFER_COMPLETED:
|
||||
event.evt_type = NRFX_SPIS_XFER_DONE;
|
||||
event.rx_amount = nrf_spis_rx_amount_get(p_spis);
|
||||
event.tx_amount = nrf_spis_tx_amount_get(p_spis);
|
||||
NRFX_LOG_INFO("Transfer rx_len:%d.", event.rx_amount);
|
||||
NRFX_LOG_DEBUG("Rx data:");
|
||||
NRFX_LOG_HEXDUMP_DEBUG((uint8_t const *)p_cb->rx_buffer,
|
||||
event.rx_amount * sizeof(p_cb->rx_buffer[0]));
|
||||
NRFX_ASSERT(p_cb->handler != NULL);
|
||||
p_cb->handler(&event, p_cb->p_context);
|
||||
break;
|
||||
|
||||
default:
|
||||
// No implementation required.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**@brief Function for changing the state of the SPI state machine.
|
||||
*
|
||||
* @param[in] p_spis SPIS instance register.
|
||||
* @param[in] p_cb SPIS instance control block.
|
||||
* @param[in] new_state State where the state machine transits to.
|
||||
*/
|
||||
static void spis_state_change(NRF_SPIS_Type * p_spis,
|
||||
spis_cb_t * p_cb,
|
||||
nrfx_spis_state_t new_state)
|
||||
{
|
||||
p_cb->spi_state = new_state;
|
||||
spis_state_entry_action_execute(p_spis, p_cb);
|
||||
}
|
||||
|
||||
nrfx_err_t nrfx_spis_buffers_set(nrfx_spis_t const * p_instance,
|
||||
uint8_t const * p_tx_buffer,
|
||||
size_t tx_buffer_length,
|
||||
uint8_t * p_rx_buffer,
|
||||
size_t rx_buffer_length)
|
||||
{
|
||||
NRFX_ASSERT(p_tx_buffer != NULL || tx_buffer_length == 0);
|
||||
NRFX_ASSERT(p_rx_buffer != NULL || rx_buffer_length == 0);
|
||||
|
||||
spis_cb_t * p_cb = &m_cb[p_instance->drv_inst_idx];
|
||||
nrfx_err_t err_code;
|
||||
|
||||
if (!SPIS_LENGTH_VALIDATE(p_instance->drv_inst_idx,
|
||||
rx_buffer_length,
|
||||
tx_buffer_length))
|
||||
{
|
||||
return NRFX_ERROR_INVALID_LENGTH;
|
||||
}
|
||||
|
||||
// EasyDMA requires that transfer buffers are placed in Data RAM region;
|
||||
// signal error if they are not.
|
||||
if ((p_tx_buffer != NULL && !nrfx_is_in_ram(p_tx_buffer)) ||
|
||||
(p_rx_buffer != NULL && !nrfx_is_in_ram(p_rx_buffer)))
|
||||
{
|
||||
err_code = NRFX_ERROR_INVALID_ADDR;
|
||||
NRFX_LOG_WARNING("Function: %s, error code: %s.",
|
||||
__func__,
|
||||
NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
|
||||
switch (p_cb->spi_state)
|
||||
{
|
||||
case SPIS_STATE_INIT:
|
||||
case SPIS_XFER_COMPLETED:
|
||||
case SPIS_BUFFER_RESOURCE_CONFIGURED:
|
||||
p_cb->tx_buffer = p_tx_buffer;
|
||||
p_cb->rx_buffer = p_rx_buffer;
|
||||
p_cb->tx_buffer_size = tx_buffer_length;
|
||||
p_cb->rx_buffer_size = rx_buffer_length;
|
||||
err_code = NRFX_SUCCESS;
|
||||
|
||||
spis_state_change(p_instance->p_reg, p_cb, SPIS_BUFFER_RESOURCE_REQUESTED);
|
||||
break;
|
||||
|
||||
case SPIS_BUFFER_RESOURCE_REQUESTED:
|
||||
err_code = NRFX_ERROR_INVALID_STATE;
|
||||
break;
|
||||
|
||||
default:
|
||||
// @note: execution of this code path would imply internal error in the design.
|
||||
err_code = NRFX_ERROR_INTERNAL;
|
||||
break;
|
||||
}
|
||||
|
||||
NRFX_LOG_INFO("Function: %s, error code: %s.", __func__, NRFX_LOG_ERROR_STRING_GET(err_code));
|
||||
return err_code;
|
||||
}
|
||||
|
||||
static void spis_irq_handler(NRF_SPIS_Type * p_spis, spis_cb_t * p_cb)
|
||||
{
|
||||
// @note: as multiple events can be pending for processing, the correct event processing order
|
||||
// is as follows:
|
||||
// - SPI semaphore acquired event.
|
||||
// - SPI transaction complete event.
|
||||
|
||||
// Check for SPI semaphore acquired event.
|
||||
if (nrf_spis_event_check(p_spis, NRF_SPIS_EVENT_ACQUIRED))
|
||||
{
|
||||
nrf_spis_event_clear(p_spis, NRF_SPIS_EVENT_ACQUIRED);
|
||||
NRFX_LOG_DEBUG("SPIS: Event: %s.", EVT_TO_STR(NRF_SPIS_EVENT_ACQUIRED));
|
||||
|
||||
switch (p_cb->spi_state)
|
||||
{
|
||||
case SPIS_BUFFER_RESOURCE_REQUESTED:
|
||||
nrf_spis_tx_buffer_set(p_spis, (uint8_t *)p_cb->tx_buffer, p_cb->tx_buffer_size);
|
||||
nrf_spis_rx_buffer_set(p_spis, (uint8_t *)p_cb->rx_buffer, p_cb->rx_buffer_size);
|
||||
|
||||
nrf_spis_task_trigger(p_spis, NRF_SPIS_TASK_RELEASE);
|
||||
|
||||
spis_state_change(p_spis, p_cb, SPIS_BUFFER_RESOURCE_CONFIGURED);
|
||||
break;
|
||||
|
||||
default:
|
||||
// No implementation required.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for SPI transaction complete event.
|
||||
if (nrf_spis_event_check(p_spis, NRF_SPIS_EVENT_END))
|
||||
{
|
||||
nrf_spis_event_clear(p_spis, NRF_SPIS_EVENT_END);
|
||||
NRFX_LOG_DEBUG("SPIS: Event: %s.", EVT_TO_STR(NRF_SPIS_EVENT_END));
|
||||
|
||||
switch (p_cb->spi_state)
|
||||
{
|
||||
case SPIS_BUFFER_RESOURCE_CONFIGURED:
|
||||
spis_state_change(p_spis, p_cb, SPIS_XFER_COMPLETED);
|
||||
break;
|
||||
|
||||
default:
|
||||
// No implementation required.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if NRFX_CHECK(NRFX_SPIS0_ENABLED)
|
||||
void nrfx_spis_0_irq_handler(void)
|
||||
{
|
||||
spis_irq_handler(NRF_SPIS0, &m_cb[NRFX_SPIS0_INST_IDX]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NRFX_CHECK(NRFX_SPIS1_ENABLED)
|
||||
void nrfx_spis_1_irq_handler(void)
|
||||
{
|
||||
spis_irq_handler(NRF_SPIS1, &m_cb[NRFX_SPIS1_INST_IDX]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NRFX_CHECK(NRFX_SPIS2_ENABLED)
|
||||
void nrfx_spis_2_irq_handler(void)
|
||||
{
|
||||
spis_irq_handler(NRF_SPIS2, &m_cb[NRFX_SPIS2_INST_IDX]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NRFX_CHECK(NRFX_SPIS3_ENABLED)
|
||||
void nrfx_spis_3_irq_handler(void)
|
||||
{
|
||||
spis_irq_handler(NRF_SPIS3, &m_cb[NRFX_SPIS3_INST_IDX]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // NRFX_CHECK(NRFX_SPIS_ENABLED)
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Copyright (c) 2019 - 2020, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <nrfx.h>
|
||||
|
||||
#if NRFX_CHECK(NRFX_TEMP_ENABLED)
|
||||
|
||||
#include <nrfx_temp.h>
|
||||
|
||||
#if !defined(USE_WORKAROUND_FOR_TEMP_OFFSET_ANOMALY) && defined(NRF51)
|
||||
// Enable workaround for nRF51 series anomaly 28
|
||||
// (TEMP: Temperature offset value has to be manually loaded to the TEMP module).
|
||||
#define USE_WORKAROUND_FOR_TEMP_OFFSET_ANOMALY 1
|
||||
#endif
|
||||
|
||||
/** @brief Time of one check attempt.*/
|
||||
#define NRFX_TEMP_TIME_US 4
|
||||
|
||||
/** @brief Maximum attempts to check whether conversion passed.*/
|
||||
#define NRFX_TEMP_ATTEMPTS 10
|
||||
|
||||
/** @brief Internal state of TEMP driver. */
|
||||
static nrfx_drv_state_t m_temp_state;
|
||||
|
||||
/** @brief Pointer to handler to be called from interrupt routine. */
|
||||
static nrfx_temp_data_handler_t m_data_handler;
|
||||
|
||||
nrfx_err_t nrfx_temp_init(nrfx_temp_config_t const * p_config, nrfx_temp_data_handler_t handler)
|
||||
{
|
||||
NRFX_ASSERT(p_config);
|
||||
|
||||
if (m_temp_state != NRFX_DRV_STATE_UNINITIALIZED)
|
||||
{
|
||||
return NRFX_ERROR_ALREADY_INITIALIZED;
|
||||
}
|
||||
|
||||
#if NRFX_CHECK(USE_WORKAROUND_FOR_TEMP_OFFSET_ANOMALY)
|
||||
*(uint32_t volatile *)0x4000C504 = 0;
|
||||
#endif
|
||||
|
||||
m_data_handler = handler;
|
||||
|
||||
if (m_data_handler)
|
||||
{
|
||||
nrf_temp_int_enable(NRF_TEMP, NRF_TEMP_INT_DATARDY_MASK);
|
||||
NRFX_IRQ_PRIORITY_SET(TEMP_IRQn, p_config->interrupt_priority);
|
||||
NRFX_IRQ_ENABLE(TEMP_IRQn);
|
||||
}
|
||||
|
||||
m_temp_state = NRFX_DRV_STATE_INITIALIZED;
|
||||
return NRFX_SUCCESS;
|
||||
}
|
||||
|
||||
void nrfx_temp_uninit(void)
|
||||
{
|
||||
NRFX_ASSERT(m_temp_state == NRFX_DRV_STATE_INITIALIZED);
|
||||
nrf_temp_task_trigger(NRF_TEMP, NRF_TEMP_TASK_STOP);
|
||||
|
||||
if (m_data_handler)
|
||||
{
|
||||
nrf_temp_int_disable(NRF_TEMP, NRF_TEMP_INT_DATARDY_MASK);
|
||||
NRFX_IRQ_DISABLE(TEMP_IRQn);
|
||||
}
|
||||
|
||||
m_temp_state = NRFX_DRV_STATE_UNINITIALIZED;
|
||||
}
|
||||
|
||||
int32_t nrfx_temp_calculate(int32_t raw_measurement)
|
||||
{
|
||||
/* Raw temperature is a 2's complement signed value. Moreover, it is represented
|
||||
* by 0.25[C] intervals, so division by 4 is needed. To preserve
|
||||
* fractional part, raw value is multiplied by 100 before division.*/
|
||||
|
||||
return (raw_measurement * 100) / 4;
|
||||
}
|
||||
|
||||
nrfx_err_t nrfx_temp_measure(void)
|
||||
{
|
||||
NRFX_ASSERT(m_temp_state == NRFX_DRV_STATE_INITIALIZED);
|
||||
|
||||
nrfx_err_t result = NRFX_SUCCESS;
|
||||
nrf_temp_event_clear(NRF_TEMP, NRF_TEMP_EVENT_DATARDY);
|
||||
nrf_temp_task_trigger(NRF_TEMP, NRF_TEMP_TASK_START);
|
||||
|
||||
if (!m_data_handler)
|
||||
{
|
||||
bool ev_result;
|
||||
NRFX_WAIT_FOR(nrf_temp_event_check(NRF_TEMP, NRF_TEMP_EVENT_DATARDY),
|
||||
NRFX_TEMP_ATTEMPTS,
|
||||
NRFX_TEMP_TIME_US,
|
||||
ev_result);
|
||||
if (!ev_result)
|
||||
{
|
||||
result = NRFX_ERROR_INTERNAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
nrf_temp_event_clear(NRF_TEMP, NRF_TEMP_EVENT_DATARDY);
|
||||
}
|
||||
nrf_temp_task_trigger(NRF_TEMP, NRF_TEMP_TASK_STOP);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void nrfx_temp_irq_handler(void)
|
||||
{
|
||||
NRFX_ASSERT(m_data_handler);
|
||||
|
||||
nrf_temp_task_trigger(NRF_TEMP, NRF_TEMP_TASK_STOP);
|
||||
nrf_temp_event_clear(NRF_TEMP, NRF_TEMP_EVENT_DATARDY);
|
||||
|
||||
uint32_t raw_temp = nrfx_temp_result_get();
|
||||
|
||||
m_data_handler(raw_temp);
|
||||
}
|
||||
|
||||
#endif // NRFX_CHECK(NRFX_TEMP_ENABLED)
|
||||
@@ -14,6 +14,17 @@
|
||||
#define NRFX_SPIM1_ENABLED 0 // used as I2C
|
||||
#define NRFX_SPIM2_ENABLED 1
|
||||
|
||||
#define NRFX_SPIS_ENABLED 0
|
||||
#define NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY 7
|
||||
#define NRFX_SPIS_CONFIG_LOG_ENABLED 0
|
||||
#define NRFX_SPIS_CONFIG_LOG_LEVEL 3
|
||||
#define NRFX_SPIS_CONFIG_INFO_COLOR 0
|
||||
#define NRFX_SPIS_CONFIG_DEBUG_COLOR 0
|
||||
|
||||
#define NRFX_SPIS0_ENABLED 0
|
||||
#define NRFX_SPIS1_ENABLED 0
|
||||
#define NRFX_SPIS2_ENABLED 0
|
||||
|
||||
#define NRFX_PWM_ENABLED 0
|
||||
#define NRFX_PWM0_ENABLED 0
|
||||
#define NRFX_PWM1_ENABLED 0
|
||||
@@ -37,5 +48,8 @@
|
||||
#define NRFX_SPIM3_ENABLED 0
|
||||
#endif
|
||||
|
||||
// NRFX temp
|
||||
#define NRFX_TEMP_ENABLED 1
|
||||
#define NRFX_TEMP_DEFAULT_CONFIG_IRQ_PRIORITY 7
|
||||
|
||||
#endif // NRFX_CONFIG_H__
|
||||
+25
-6
@@ -74,22 +74,41 @@ uint32_t readResetReason(void)
|
||||
return _reset_reason;
|
||||
}
|
||||
|
||||
static void reset_mcu(uint32_t gpregret)
|
||||
{
|
||||
// disable SD
|
||||
sd_softdevice_disable();
|
||||
|
||||
// Disable all interrupts
|
||||
NVIC->ICER[0]=0xFFFFFFFF;
|
||||
NVIC->ICPR[0]=0xFFFFFFFF;
|
||||
#if defined(__NRF_NVIC_ISER_COUNT) && __NRF_NVIC_ISER_COUNT == 2
|
||||
NVIC->ICER[1]=0xFFFFFFFF;
|
||||
NVIC->ICPR[1]=0xFFFFFFFF;
|
||||
#endif
|
||||
|
||||
NRF_POWER->GPREGRET = gpregret;
|
||||
|
||||
NVIC_SystemReset();
|
||||
|
||||
// maybe yield ?
|
||||
while(1) {}
|
||||
}
|
||||
|
||||
void enterUf2Dfu(void)
|
||||
{
|
||||
NRF_POWER->GPREGRET = DFU_MAGIC_UF2_RESET;
|
||||
NVIC_SystemReset();
|
||||
reset_mcu(DFU_MAGIC_UF2_RESET);
|
||||
}
|
||||
|
||||
void enterSerialDfu(void)
|
||||
{
|
||||
NRF_POWER->GPREGRET = DFU_MAGIC_SERIAL_ONLY_RESET;
|
||||
NVIC_SystemReset();
|
||||
// shut down everything
|
||||
reset_mcu(DFU_MAGIC_SERIAL_ONLY_RESET);
|
||||
}
|
||||
|
||||
void enterOTADfu(void)
|
||||
{
|
||||
NRF_POWER->GPREGRET = DFU_MAGIC_OTA_RESET;
|
||||
NVIC_SystemReset();
|
||||
reset_mcu(DFU_MAGIC_OTA_RESET);
|
||||
}
|
||||
|
||||
void waitForEvent(void)
|
||||
|
||||
Submodule libraries/Adafruit_TinyUSB_Arduino updated: cea04406dd...d629476752.
Submodule libraries/Adafruit_nRFCrypto updated: 8499e741e2...2be11062ac.
@@ -18,21 +18,33 @@
|
||||
*/
|
||||
#include <bluefruit.h>
|
||||
|
||||
// Polling or callback implementation
|
||||
#define POLLING 1
|
||||
/*
|
||||
* Polling or callback implementation
|
||||
* 0 = Request data using a poll
|
||||
* 1 = Use callbacks
|
||||
*/
|
||||
#define POLLING 0
|
||||
/*
|
||||
* Device Type flag for use in the example
|
||||
* Change this if you want to demo the Gamepad!
|
||||
* 0 = Keyboard + Mouse
|
||||
* 1 = Gamepad
|
||||
*/
|
||||
#define DEVICE_TYPE 0
|
||||
|
||||
BLEClientHidAdafruit hid;
|
||||
|
||||
// Last checked report, to detect if there is changes between reports
|
||||
hid_keyboard_report_t last_kbd_report = { 0 };
|
||||
hid_mouse_report_t last_mse_report = { 0 };
|
||||
hid_gamepad_report_t last_gpd_report = { 0 };
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
// while ( !Serial ) delay(10); // for nrf52840 with native usb
|
||||
|
||||
Serial.println("Bluefruit52 Central HID (Keyboard + Mouse) Example");
|
||||
Serial.println("Bluefruit52 Central HID (Keyboard + Mouse + Gamepad) Example");
|
||||
Serial.println("--------------------------------------------------\n");
|
||||
|
||||
// Initialize Bluefruit with maximum connections as Peripheral = 0, Central = 1
|
||||
@@ -46,6 +58,7 @@ void setup()
|
||||
|
||||
#if POLLING == 0
|
||||
hid.setKeyboardReportCallback(keyboard_report_callback);
|
||||
hid.setGamepadReportCallback(gamepad_report_callback);
|
||||
#endif
|
||||
|
||||
// Increase Blink rate to different from PrPh advertising mode
|
||||
@@ -69,7 +82,7 @@ void setup()
|
||||
Bluefruit.Scanner.restartOnDisconnect(true);
|
||||
Bluefruit.Scanner.setInterval(160, 80); // in unit of 0.625 ms
|
||||
Bluefruit.Scanner.filterService(hid); // only report HID service
|
||||
Bluefruit.Scanner.useActiveScan(false);
|
||||
Bluefruit.Scanner.useActiveScan(true);
|
||||
Bluefruit.Scanner.start(0); // 0 = Don't stop scanning after n seconds
|
||||
}
|
||||
|
||||
@@ -137,8 +150,11 @@ void connection_secured_callback(uint16_t conn_handle)
|
||||
Serial.printf("HID Flags : 0x%02X\n", hidInfo[3]);
|
||||
|
||||
// BLEClientHidAdafruit currently only supports Boot Protocol Mode
|
||||
// for Keyboard and Mouse. Let's set the protocol mode on prph to Boot Mode
|
||||
// for Keyboard and Mouse. If we are using a Keyboard + Mouse,
|
||||
// let's set the protocol mode on prph to Boot Mode.
|
||||
#if DEVICE_TYPE == 0
|
||||
hid.setBootMode(true);
|
||||
#endif
|
||||
|
||||
// Enable Keyboard report notification if present on prph
|
||||
if ( hid.keyboardPresent() ) hid.enableKeyboard();
|
||||
@@ -146,6 +162,9 @@ void connection_secured_callback(uint16_t conn_handle)
|
||||
// Enable Mouse report notification if present on prph
|
||||
if ( hid.mousePresent() ) hid.enableMouse();
|
||||
|
||||
// Enable Gamepad report notification if present on prph
|
||||
if ( hid.gamepadPresent() ) hid.enableGamepad();
|
||||
|
||||
Serial.println("Ready to receive from peripheral");
|
||||
}
|
||||
}
|
||||
@@ -169,15 +188,26 @@ void loop()
|
||||
#if POLLING == 1
|
||||
// nothing to do if hid not discovered
|
||||
if ( !hid.discovered() ) return;
|
||||
|
||||
if ( hid.keyboardPresent() ) {
|
||||
/*------------- Polling Keyboard -------------*/
|
||||
hid_keyboard_report_t kbd_report;
|
||||
|
||||
/*------------- Polling Keyboard -------------*/
|
||||
hid_keyboard_report_t kbd_report;
|
||||
|
||||
// Get latest report
|
||||
hid.getKeyboardReport(&kbd_report);
|
||||
|
||||
processKeyboardReport(&kbd_report);
|
||||
// Get latest report
|
||||
Serial.println("Get report from Keyboard");
|
||||
hid.getKeyboardReport(&kbd_report);
|
||||
processKeyboardReport(&kbd_report);
|
||||
}
|
||||
|
||||
if ( hid.gamepadPresent() ) {
|
||||
/*------------- Polling Gamepad -------------*/
|
||||
hid_gamepad_report_t gpd_report;
|
||||
|
||||
// Get latest report
|
||||
Serial.println("Get report from Gamepad");
|
||||
hid.getGamepadReport(&gpd_report);
|
||||
processGamepadReport(&gpd_report);
|
||||
}
|
||||
|
||||
// polling interval is 5 ms
|
||||
delay(5);
|
||||
@@ -186,6 +216,24 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
void gamepad_report_callback(hid_gamepad_report_t* report)
|
||||
{
|
||||
Serial.println("Recieved report from Gamepad");
|
||||
processGamepadReport(report);
|
||||
}
|
||||
|
||||
void processGamepadReport(hid_gamepad_report_t* report)
|
||||
{
|
||||
memcpy(&last_gpd_report, report, sizeof(hid_gamepad_report_t));
|
||||
|
||||
Serial.print("Current Gamepad State: Buttons: ");
|
||||
Serial.print(report->buttons, BIN);
|
||||
Serial.print(" X: ");
|
||||
Serial.print(report->x);
|
||||
Serial.print(" Y: ");
|
||||
Serial.println(report->y);
|
||||
}
|
||||
|
||||
void keyboard_report_callback(hid_keyboard_report_t* report)
|
||||
{
|
||||
processKeyboardReport(report);
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
This is example usage of the nrfx_temp driver
|
||||
*/
|
||||
|
||||
#include <nrfx_temp.h>
|
||||
#include <Adafruit_TinyUSB.h>
|
||||
|
||||
nrfx_temp_config_t config = NRFX_TEMP_DEFAULT_CONFIG;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
// setting the handler to NULL will initialize the driver in blocking mode
|
||||
nrfx_temp_init(&config, NULL);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
nrfx_temp_measure(); // In blocking mode: this function waits until the measurement is finished.
|
||||
int32_t raw_temp = nrfx_temp_result_get();
|
||||
float temp_c = raw_temp / 4.0;
|
||||
|
||||
Serial.print(temp_c);
|
||||
Serial.println(" C");
|
||||
|
||||
delay(1000);
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
This is example usage of the nrfx_temp driver
|
||||
*/
|
||||
|
||||
#include <nrfx_temp.h>
|
||||
#include <Adafruit_TinyUSB.h>
|
||||
|
||||
nrfx_temp_config_t config = NRFX_TEMP_DEFAULT_CONFIG;
|
||||
|
||||
// this function is called when the temperature measurement is ready
|
||||
void temp_handler(int32_t raw_temp) {
|
||||
float temp_c = raw_temp / 4.0;
|
||||
Serial.print(temp_c);
|
||||
Serial.println(" C");
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
nrfx_temp_init(&config, &temp_handler);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
nrfx_temp_measure();
|
||||
|
||||
delay(1000);
|
||||
}
|
||||
@@ -13,32 +13,34 @@
|
||||
*********************************************************************/
|
||||
#include <bluefruit.h>
|
||||
|
||||
// Beacon uses the Manufacturer Specific Data field in the advertising
|
||||
// packet, which means you must provide a valid Manufacturer ID. Update
|
||||
// Beacon uses the Manufacturer Specific Data field in the advertising packet,
|
||||
// which means you must provide a valid Manufacturer ID. Update
|
||||
// the field below to an appropriate value. For a list of valid IDs see:
|
||||
// https://www.bluetooth.com/specifications/assigned-numbers/company-identifiers
|
||||
// 0x004C is Apple
|
||||
// 0x0822 is Adafruit
|
||||
// 0x0059 is Nordic
|
||||
// - 0x004C is Apple
|
||||
// - 0x0822 is Adafruit
|
||||
// - 0x0059 is Nordic
|
||||
// For testing with this sketch, you can use nRF Beacon app
|
||||
// - on Android you may need change the MANUFACTURER_ID to Nordic
|
||||
// - on iOS you may need to change the MANUFACTURER_ID to Apple.
|
||||
// You will also need to "Add Other Beacon, then enter Major, Minor that you set in the sketch
|
||||
#define MANUFACTURER_ID 0x0059
|
||||
|
||||
// "nRF Connect" app can be used to detect beacon
|
||||
uint8_t beaconUuid[16] =
|
||||
{
|
||||
uint8_t beaconUuid[16] = {
|
||||
0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
|
||||
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
|
||||
};
|
||||
|
||||
// A valid Beacon packet consists of the following information:
|
||||
// UUID, Major, Minor, RSSI @ 1M
|
||||
BLEBeacon beacon(beaconUuid, 0x0102, 0x0304, -54);
|
||||
BLEBeacon beacon(beaconUuid, 1, 2, -54);
|
||||
|
||||
void setup()
|
||||
{
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
// Uncomment to blocking wait for Serial connection
|
||||
// while ( !Serial ) delay(10);
|
||||
// while ( !Serial ) delay(10);
|
||||
|
||||
Serial.println("Bluefruit52 Beacon Example");
|
||||
Serial.println("--------------------------\n");
|
||||
@@ -55,7 +57,10 @@ void setup()
|
||||
// Setup the advertising packet
|
||||
startAdv();
|
||||
|
||||
Serial.println("Broadcasting beacon, open your beacon app to test");
|
||||
Serial.printf("Broadcasting beacon with MANUFACTURER_ID = 0x%04X\n", MANUFACTURER_ID);
|
||||
Serial.println("open your beacon app to test such as: nRF Beacon");
|
||||
Serial.println("- on Android you may need to change the MANUFACTURER_ID to 0x0059");
|
||||
Serial.println("- on iOS you may need to change the MANUFACTURER_ID to 0x004C");
|
||||
|
||||
// Suspend Loop() to save power, since we didn't have any code there
|
||||
suspendLoop();
|
||||
@@ -78,17 +83,16 @@ void startAdv(void)
|
||||
* - Start(timeout) with timeout = 0 will advertise forever (until connected)
|
||||
*
|
||||
* Apple Beacon specs
|
||||
* - Type: Non connectable, undirected
|
||||
* - Type: Non-connectable, scannable, undirected
|
||||
* - Fixed interval: 100 ms -> fast = slow = 100 ms
|
||||
*/
|
||||
//Bluefruit.Advertising.setType(BLE_GAP_ADV_TYPE_ADV_NONCONN_IND);
|
||||
Bluefruit.Advertising.setType(BLE_GAP_ADV_TYPE_NONCONNECTABLE_SCANNABLE_UNDIRECTED);
|
||||
Bluefruit.Advertising.restartOnDisconnect(true);
|
||||
Bluefruit.Advertising.setInterval(160, 160); // in unit of 0.625 ms
|
||||
Bluefruit.Advertising.setFastTimeout(30); // number of seconds in fast mode
|
||||
Bluefruit.Advertising.start(0); // 0 = Don't stop advertising after n seconds
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
void loop() {
|
||||
// loop is already suspended, CPU will not run loop() at all
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
@@ -42,7 +42,7 @@
|
||||
BLEAdvertisingData::BLEAdvertisingData(void)
|
||||
{
|
||||
_count = 0;
|
||||
varclr(_data);
|
||||
arrclr(_data);
|
||||
}
|
||||
|
||||
bool BLEAdvertisingData::addData(uint8_t type, const void* data, uint8_t len)
|
||||
@@ -242,7 +242,7 @@ bool BLEAdvertisingData::setData(uint8_t const * data, uint8_t count)
|
||||
void BLEAdvertisingData::clearData(void)
|
||||
{
|
||||
_count = 0;
|
||||
varclr(_data);
|
||||
arrclr(_data);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
@@ -315,6 +315,10 @@ void BLEAdvertising::setStopCallback(stop_callback_t fp)
|
||||
_stop_cb = fp;
|
||||
}
|
||||
|
||||
void BLEAdvertising::setPeerAddress(const ble_gap_addr_t& peer_addr) {
|
||||
_peer_addr = peer_addr;
|
||||
}
|
||||
|
||||
bool BLEAdvertising::isRunning(void)
|
||||
{
|
||||
return _runnning;
|
||||
@@ -338,8 +342,7 @@ void BLEAdvertising::restartOnDisconnect(bool enable)
|
||||
bool BLEAdvertising::_start(uint16_t interval, uint16_t timeout)
|
||||
{
|
||||
// ADV Params
|
||||
ble_gap_adv_params_t adv_para =
|
||||
{
|
||||
ble_gap_adv_params_t adv_para = {
|
||||
.properties = { .type = _type, .anonymous = 0 },
|
||||
.p_peer_addr = NULL , // Undirected advertisement
|
||||
.interval = interval , // advertising interval (in units of 0.625 ms)
|
||||
@@ -354,9 +357,20 @@ bool BLEAdvertising::_start(uint16_t interval, uint16_t timeout)
|
||||
// , .set_id, .scan_req_notification
|
||||
};
|
||||
|
||||
switch(_type) {
|
||||
case BLE_GAP_ADV_TYPE_CONNECTABLE_NONSCANNABLE_DIRECTED_HIGH_DUTY_CYCLE:
|
||||
case BLE_GAP_ADV_TYPE_CONNECTABLE_NONSCANNABLE_DIRECTED:
|
||||
case BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_DIRECTED:
|
||||
case BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_SCANNABLE_DIRECTED:
|
||||
case BLE_GAP_ADV_TYPE_EXTENDED_NONCONNECTABLE_NONSCANNABLE_DIRECTED:
|
||||
adv_para.p_peer_addr = &_peer_addr;
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
// gap_adv long-live is required by SD v6
|
||||
static ble_gap_adv_data_t gap_adv =
|
||||
{
|
||||
static ble_gap_adv_data_t gap_adv = {
|
||||
.adv_data = { .p_data = _data, .len = _count },
|
||||
.scan_rsp_data = { .p_data = Bluefruit.ScanResponse.getData(), .len = Bluefruit.ScanResponse.count() }
|
||||
};
|
||||
@@ -464,5 +478,4 @@ void BLEAdvertising::_eventHandler(ble_evt_t* evt)
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -134,6 +134,9 @@ public:
|
||||
bool setBeacon(BLEBeacon& beacon);
|
||||
bool setBeacon(EddyStoneUrl& eddy_url);
|
||||
|
||||
// Advertise to a single peer instead of broadcasting
|
||||
void setPeerAddress(const ble_gap_addr_t& peer_addr);
|
||||
|
||||
bool isRunning(void);
|
||||
|
||||
void restartOnDisconnect(bool enable);
|
||||
@@ -152,6 +155,7 @@ private:
|
||||
uint8_t _type;
|
||||
bool _start_if_disconnect;
|
||||
bool _runnning;
|
||||
ble_gap_addr_t _peer_addr; //! Target address for an ADV_DIRECT_IND advertisement
|
||||
|
||||
uint32_t _conn_mask;
|
||||
|
||||
|
||||
@@ -240,6 +240,10 @@ void BLEDiscovery::_eventHandler(ble_evt_t* evt)
|
||||
|
||||
LOG_LV2("DISC", "[CHR] Characteristic Count: %d", chr_rsp->count);
|
||||
|
||||
for (uint8_t i=0; i < chr_rsp->count; i++) {
|
||||
LOG_LV2("DISC", "[CHR] Characteristic #%d: 0x%04X", i, chr_rsp->chars[i].uuid.uuid);
|
||||
}
|
||||
|
||||
if (gattc->gatt_status == BLE_GATT_STATUS_SUCCESS)
|
||||
{
|
||||
if ( chr_rsp->count )
|
||||
|
||||
@@ -101,6 +101,18 @@ class BLEDiscovery
|
||||
return discoverCharacteristic(conn_handle, chr_arr, arrcount(chr_arr));
|
||||
}
|
||||
|
||||
uint8_t discoverCharacteristic(uint16_t conn_handle, BLEClientCharacteristic& chr1, BLEClientCharacteristic& chr2, BLEClientCharacteristic& chr3, BLEClientCharacteristic& chr4, BLEClientCharacteristic& chr5, BLEClientCharacteristic& chr6, BLEClientCharacteristic& chr7)
|
||||
{
|
||||
BLEClientCharacteristic* chr_arr[] = {&chr1, &chr2, &chr3, &chr4, &chr5, &chr6, &chr7};
|
||||
return discoverCharacteristic(conn_handle, chr_arr, arrcount(chr_arr));
|
||||
}
|
||||
|
||||
uint8_t discoverCharacteristic(uint16_t conn_handle, BLEClientCharacteristic& chr1, BLEClientCharacteristic& chr2, BLEClientCharacteristic& chr3, BLEClientCharacteristic& chr4, BLEClientCharacteristic& chr5, BLEClientCharacteristic& chr6, BLEClientCharacteristic& chr7, BLEClientCharacteristic& chr8)
|
||||
{
|
||||
BLEClientCharacteristic* chr_arr[] = {&chr1, &chr2, &chr3, &chr4, &chr5, &chr6, &chr7, &chr8};
|
||||
return discoverCharacteristic(conn_handle, chr_arr, arrcount(chr_arr));
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* INTERNAL USAGE ONLY
|
||||
* Although declare as public, it is meant to be invoked by internal
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
#include "services/BLEDfu.h"
|
||||
#include "services/BLEUart.h"
|
||||
#include "services/BLEBas.h"
|
||||
#include "services/BLEIas.h"
|
||||
#include "services/BLEBeacon.h"
|
||||
#include "services/BLEHidGeneric.h"
|
||||
#include "services/BLEHidAdafruit.h"
|
||||
@@ -75,6 +76,7 @@
|
||||
#include "clients/BLEClientCts.h"
|
||||
#include "clients/BLEClientHidAdafruit.h"
|
||||
#include "clients/BLEClientBas.h"
|
||||
#include "clients/BLEClientIas.h"
|
||||
|
||||
#include "utility/AdaCallback.h"
|
||||
#include "utility/bonding.h"
|
||||
|
||||
@@ -41,12 +41,15 @@ BLEClientHidAdafruit::BLEClientHidAdafruit(void)
|
||||
_protcol_mode(UUID16_CHR_PROTOCOL_MODE),
|
||||
_hid_info(UUID16_CHR_HID_INFORMATION), _hid_control(UUID16_CHR_HID_CONTROL_POINT),
|
||||
_kbd_boot_input(UUID16_CHR_BOOT_KEYBOARD_INPUT_REPORT), _kbd_boot_output(UUID16_CHR_BOOT_KEYBOARD_OUTPUT_REPORT),
|
||||
_mse_boot_input(UUID16_CHR_BOOT_MOUSE_INPUT_REPORT)
|
||||
_mse_boot_input(UUID16_CHR_BOOT_MOUSE_INPUT_REPORT),
|
||||
_gpd_report(UUID16_CHR_REPORT)
|
||||
{
|
||||
_kbd_cb = NULL;
|
||||
_mse_cb = NULL;
|
||||
_gpd_cb = NULL;
|
||||
varclr(&_last_kbd_report);
|
||||
varclr(&_last_mse_report);
|
||||
varclr(&_last_gpd_report);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +65,12 @@ void mse_client_notify_cb(BLEClientCharacteristic* chr, uint8_t* data, uint16_t
|
||||
svc._handle_mse_input(data, len);
|
||||
}
|
||||
|
||||
void gpd_client_notify_cb(BLEClientCharacteristic* chr, uint8_t* data, uint16_t len)
|
||||
{
|
||||
BLEClientHidAdafruit& svc = (BLEClientHidAdafruit&) chr->parentService();
|
||||
svc._handle_gpd_input(data, len);
|
||||
}
|
||||
|
||||
|
||||
bool BLEClientHidAdafruit::begin(void)
|
||||
{
|
||||
@@ -77,10 +86,13 @@ bool BLEClientHidAdafruit::begin(void)
|
||||
|
||||
_mse_boot_input.begin(this);
|
||||
|
||||
_gpd_report.begin(this);
|
||||
|
||||
|
||||
// set notify callback
|
||||
_kbd_boot_input.setNotifyCallback(kbd_client_notify_cb);
|
||||
_mse_boot_input.setNotifyCallback(mse_client_notify_cb);
|
||||
_gpd_report.setNotifyCallback(gpd_client_notify_cb);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -95,6 +107,12 @@ void BLEClientHidAdafruit::setMouseReportCallback(mse_callback_t fp)
|
||||
_mse_cb = fp;
|
||||
}
|
||||
|
||||
void BLEClientHidAdafruit::setGamepadReportCallback(gpd_callback_t fp)
|
||||
{
|
||||
_gpd_cb = fp;
|
||||
}
|
||||
|
||||
|
||||
bool BLEClientHidAdafruit::discover(uint16_t conn_handle)
|
||||
{
|
||||
// Call Base class discover
|
||||
@@ -102,10 +120,10 @@ bool BLEClientHidAdafruit::discover(uint16_t conn_handle)
|
||||
_conn_hdl = BLE_CONN_HANDLE_INVALID; // make as invalid until we found all chars
|
||||
|
||||
// Discover all characteristics
|
||||
Bluefruit.Discovery.discoverCharacteristic(conn_handle, _protcol_mode, _kbd_boot_input, _kbd_boot_output, _mse_boot_input, _hid_info, _hid_control);
|
||||
Bluefruit.Discovery.discoverCharacteristic(conn_handle, _protcol_mode, _kbd_boot_input, _kbd_boot_output, _mse_boot_input, _hid_info, _hid_control, _gpd_report);
|
||||
|
||||
VERIFY( _protcol_mode.discovered() && _hid_info.discovered() && _hid_control.discovered() );
|
||||
VERIFY ( keyboardPresent() || mousePresent() );
|
||||
VERIFY( _hid_info.discovered() && _hid_control.discovered() );
|
||||
VERIFY (keyboardPresent() || mousePresent() || gamepadPresent());
|
||||
|
||||
_conn_hdl = conn_handle;
|
||||
return true;
|
||||
@@ -138,7 +156,7 @@ bool BLEClientHidAdafruit::setBootMode(bool boot)
|
||||
*------------------------------------------------------------------*/
|
||||
bool BLEClientHidAdafruit::keyboardPresent(void)
|
||||
{
|
||||
return _kbd_boot_input.discovered() && _kbd_boot_output.discovered();
|
||||
return _kbd_boot_input.discovered() && _kbd_boot_output.discovered() && _protcol_mode.discovered();
|
||||
}
|
||||
|
||||
bool BLEClientHidAdafruit::enableKeyboard(void)
|
||||
@@ -169,7 +187,7 @@ void BLEClientHidAdafruit::getKeyboardReport(hid_keyboard_report_t* report)
|
||||
*------------------------------------------------------------------*/
|
||||
bool BLEClientHidAdafruit::mousePresent(void)
|
||||
{
|
||||
return _mse_boot_input.discovered();
|
||||
return _mse_boot_input.discovered() && _protcol_mode.discovered();
|
||||
}
|
||||
|
||||
bool BLEClientHidAdafruit::enableMouse(void)
|
||||
@@ -195,3 +213,34 @@ void BLEClientHidAdafruit::getMouseReport(hid_mouse_report_t* report)
|
||||
memcpy(report, &_last_mse_report, sizeof(hid_mouse_report_t));
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Gamepad
|
||||
*------------------------------------------------------------------*/
|
||||
bool BLEClientHidAdafruit::gamepadPresent(void)
|
||||
{
|
||||
return _gpd_report.discovered();
|
||||
}
|
||||
|
||||
bool BLEClientHidAdafruit::enableGamepad(void)
|
||||
{
|
||||
return _gpd_report.enableNotify();
|
||||
}
|
||||
|
||||
bool BLEClientHidAdafruit::disableGamepad(void)
|
||||
{
|
||||
return _gpd_report.disableNotify();
|
||||
}
|
||||
|
||||
void BLEClientHidAdafruit::_handle_gpd_input(uint8_t* data, uint16_t len)
|
||||
{
|
||||
varclr(&_last_gpd_report);
|
||||
memcpy(&_last_gpd_report, data, len);
|
||||
|
||||
if ( _gpd_cb ) _gpd_cb(&_last_gpd_report);
|
||||
}
|
||||
|
||||
void BLEClientHidAdafruit::getGamepadReport(hid_gamepad_report_t* report)
|
||||
{
|
||||
memcpy(report, &_last_gpd_report, sizeof(hid_gamepad_report_t));
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ class BLEClientHidAdafruit : public BLEClientService
|
||||
// Callback Signatures
|
||||
typedef void (*kbd_callback_t ) (hid_keyboard_report_t* report);
|
||||
typedef void (*mse_callback_t ) (hid_mouse_report_t* report);
|
||||
typedef void (*gpd_callback_t ) (hid_gamepad_report_t* report);
|
||||
|
||||
BLEClientHidAdafruit(void);
|
||||
|
||||
@@ -74,16 +75,26 @@ class BLEClientHidAdafruit : public BLEClientService
|
||||
|
||||
void getMouseReport(hid_mouse_report_t* report);
|
||||
|
||||
// Gamepad API
|
||||
bool gamepadPresent(void);
|
||||
bool enableGamepad(void);
|
||||
bool disableGamepad(void);
|
||||
|
||||
void getGamepadReport(hid_gamepad_report_t* report);
|
||||
|
||||
// Report callback
|
||||
void setKeyboardReportCallback(kbd_callback_t fp);
|
||||
void setMouseReportCallback(mse_callback_t fp);
|
||||
void setGamepadReportCallback(gpd_callback_t fp);
|
||||
|
||||
protected:
|
||||
kbd_callback_t _kbd_cb;
|
||||
mse_callback_t _mse_cb;
|
||||
gpd_callback_t _gpd_cb;
|
||||
|
||||
hid_keyboard_report_t _last_kbd_report;
|
||||
hid_mouse_report_t _last_mse_report;
|
||||
hid_gamepad_report_t _last_gpd_report;
|
||||
|
||||
// Only support Boot protocol for keyboard and Mouse
|
||||
BLEClientCharacteristic _protcol_mode;
|
||||
@@ -95,11 +106,15 @@ class BLEClientHidAdafruit : public BLEClientService
|
||||
|
||||
BLEClientCharacteristic _mse_boot_input;
|
||||
|
||||
BLEClientCharacteristic _gpd_report;
|
||||
|
||||
void _handle_kbd_input(uint8_t* data, uint16_t len);
|
||||
void _handle_mse_input(uint8_t* data, uint16_t len);
|
||||
void _handle_gpd_input(uint8_t* data, uint16_t len);
|
||||
|
||||
friend void kbd_client_notify_cb(BLEClientCharacteristic* chr, uint8_t* data, uint16_t len);
|
||||
friend void mse_client_notify_cb(BLEClientCharacteristic* chr, uint8_t* data, uint16_t len);
|
||||
friend void gpd_client_notify_cb(BLEClientCharacteristic* chr, uint8_t* data, uint16_t len);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// Created by Charlie Bershatsky on 4/19/23.
|
||||
//
|
||||
|
||||
#include "BLEClientIas.h"
|
||||
#include "bluefruit.h"
|
||||
|
||||
BLEClientIas::BLEClientIas() :
|
||||
BLEClientService(UUID16_SVC_IMMEDIATE_ALERT), _alert(UUID16_SVC_IMMEDIATE_ALERT) {
|
||||
|
||||
}
|
||||
|
||||
bool BLEClientIas::begin(void) {
|
||||
// invoke superclass begin()
|
||||
BLEClientService::begin();
|
||||
|
||||
_alert.begin(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BLEClientIas::discover(uint16_t conn_handle) {
|
||||
VERIFY(BLEClientService::discover(conn_handle));
|
||||
_conn_hdl = conn_handle;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint16_t BLEClientIas::getAlertLevel() {
|
||||
|
||||
uint8_t level = 0;
|
||||
ble_gattc_handle_range_t bck_range = Bluefruit.Discovery.getHandleRange();
|
||||
|
||||
_alert.begin(this);
|
||||
|
||||
if (Bluefruit.Discovery.discoverCharacteristic(_conn_hdl, _alert)) {
|
||||
level = _alert.read8();
|
||||
}
|
||||
|
||||
Bluefruit.Discovery.setHandleRange(bck_range);
|
||||
|
||||
return level;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Created by Charlie Bershatsky on 4/19/23.
|
||||
//
|
||||
|
||||
#ifndef ADAFRUIT_NRF52_ARDUINO_BLECLIENTIAS_H
|
||||
#define ADAFRUIT_NRF52_ARDUINO_BLECLIENTIAS_H
|
||||
|
||||
#include "bluefruit_common.h"
|
||||
#include "BLEClientCharacteristic.h"
|
||||
#include "BLEClientService.h"
|
||||
|
||||
class BLEClientIas : public BLEClientService {
|
||||
|
||||
public:
|
||||
BLEClientIas(void);
|
||||
|
||||
virtual bool begin(void);
|
||||
virtual bool discover(uint16_t conn_handle);
|
||||
|
||||
uint16_t getAlertLevel (void);
|
||||
|
||||
private:
|
||||
BLEClientCharacteristic _alert;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //ADAFRUIT_NRF52_ARDUINO_BLECLIENTIAS_H
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Created by Charlie Bershatsky on 4/19/23.
|
||||
//
|
||||
|
||||
#include "BLEIas.h"
|
||||
#include "bluefruit.h"
|
||||
#include "utility/utilities.h"
|
||||
#include "BLEService.h"
|
||||
|
||||
BLEIas::BLEIas(void) :
|
||||
BLEService(UUID16_SVC_IMMEDIATE_ALERT), _alert(UUID16_SVC_IMMEDIATE_ALERT) {
|
||||
|
||||
}
|
||||
|
||||
void BLEIas::write(uint8_t alert_level) {
|
||||
_alert.write8(alert_level);
|
||||
}
|
||||
|
||||
err_t BLEIas::begin(void) {
|
||||
|
||||
// Invoke the superclass begin()
|
||||
VERIFY_STATUS(BLEService::begin());
|
||||
|
||||
_alert.setProperties(CHR_PROPS_READ);
|
||||
_alert.setPermission(SECMODE_OPEN, SECMODE_NO_ACCESS);
|
||||
_alert.setFixedLen(1);
|
||||
|
||||
VERIFY_STATUS( _alert.begin() );
|
||||
|
||||
return ERROR_NONE;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// Created by Charlie Bershatsky on 4/19/23.
|
||||
//
|
||||
|
||||
#ifndef ADAFRUIT_NRF52_ARDUINO_BLEIAS_H
|
||||
#define ADAFRUIT_NRF52_ARDUINO_BLEIAS_H
|
||||
|
||||
#include "bluefruit_common.h"
|
||||
|
||||
#include "BLEService.h"
|
||||
#include "BLECharacteristic.h"
|
||||
|
||||
|
||||
class BLEIas : public BLEService {
|
||||
|
||||
protected:
|
||||
BLECharacteristic _alert;
|
||||
|
||||
public:
|
||||
BLEIas(void);
|
||||
|
||||
void write(uint8_t level);
|
||||
|
||||
virtual err_t begin(void);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //ADAFRUIT_NRF52_ARDUINO_BLEIAS_H
|
||||
@@ -41,7 +41,10 @@
|
||||
#include "bonding.h"
|
||||
#include "bluefruit.h"
|
||||
|
||||
using namespace Adafruit_LittleFS_Namespace;
|
||||
enum {
|
||||
FO_READ = Adafruit_LittleFS_Namespace::FILE_O_READ,
|
||||
FO_WRITE = Adafruit_LittleFS_Namespace::FILE_O_WRITE,
|
||||
};
|
||||
|
||||
#define BOND_DEBUG 1
|
||||
|
||||
@@ -68,7 +71,7 @@ static void get_fname (char* fname, uint8_t role, uint8_t const mac[6])
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
}
|
||||
|
||||
static bool bdata_skip_field(File* file)
|
||||
static bool bdata_skip_field(Adafruit_LittleFS_Namespace::File* file)
|
||||
{
|
||||
int len = file->read();
|
||||
VERIFY(len > 0);
|
||||
@@ -77,7 +80,7 @@ static bool bdata_skip_field(File* file)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void bdata_write(File* file, void const* buffer, uint16_t bufsize)
|
||||
static void bdata_write(Adafruit_LittleFS_Namespace::File* file, void const* buffer, uint16_t bufsize)
|
||||
{
|
||||
file->write( (uint8_t) bufsize );
|
||||
file->write( (uint8_t const*) buffer, bufsize);
|
||||
@@ -106,7 +109,7 @@ static void bond_save_keys_dfr (uint8_t role, uint16_t conn_hdl, bond_keys_t con
|
||||
// delete if file already exists
|
||||
if ( InternalFS.exists(filename) ) InternalFS.remove(filename);
|
||||
|
||||
File file(filename, FILE_O_WRITE, InternalFS);
|
||||
Adafruit_LittleFS_Namespace::File file(filename, FO_WRITE, InternalFS);
|
||||
VERIFY(file,);
|
||||
|
||||
//------------- save keys -------------//
|
||||
@@ -150,8 +153,8 @@ bool bond_load_keys(uint8_t role, ble_gap_addr_t* addr, bond_keys_t* bkeys)
|
||||
char filename[BOND_FNAME_LEN];
|
||||
get_fname(filename, role, addr->addr);
|
||||
|
||||
File file(InternalFS);
|
||||
if( file.open(filename, FILE_O_READ) )
|
||||
Adafruit_LittleFS_Namespace::File file(InternalFS);
|
||||
if( file.open(filename, FO_READ) )
|
||||
{
|
||||
int keylen = file.read();
|
||||
if ( keylen > 0 )
|
||||
@@ -172,10 +175,10 @@ bool bond_load_keys(uint8_t role, ble_gap_addr_t* addr, bond_keys_t* bkeys)
|
||||
// Resolvable address, we have to go through the whole list to perform IRK Address matching
|
||||
|
||||
char const * dpath = (role == BLE_GAP_ROLE_PERIPH ? BOND_DIR_PRPH : BOND_DIR_CNTR);
|
||||
File dir(dpath, FILE_O_READ, InternalFS);
|
||||
File file(InternalFS);
|
||||
Adafruit_LittleFS_Namespace::File dir(dpath, FO_READ, InternalFS);
|
||||
Adafruit_LittleFS_Namespace::File file(InternalFS);
|
||||
|
||||
while ( !ret && (file = dir.openNextFile(FILE_O_READ)) )
|
||||
while ( !ret && (file = dir.openNextFile(FO_READ)) )
|
||||
{
|
||||
int keylen = file.read();
|
||||
if ( keylen == sizeof(bond_keys_t) )
|
||||
@@ -217,7 +220,7 @@ static void bond_save_cccd_dfr (uint8_t role, uint16_t conn_hdl, ble_gap_addr_t
|
||||
char filename[BOND_FNAME_LEN];
|
||||
get_fname(filename, role, id_addr->addr);
|
||||
|
||||
File file(filename, FILE_O_WRITE, InternalFS);
|
||||
Adafruit_LittleFS_Namespace::File file(filename, FO_WRITE, InternalFS);
|
||||
VERIFY(file,);
|
||||
|
||||
file.seek(0); // write mode start at the end, seek to beginning
|
||||
@@ -266,7 +269,7 @@ bool bond_load_cccd(uint8_t role, uint16_t conn_hdl, ble_gap_addr_t const* id_ad
|
||||
char filename[BOND_FNAME_LEN];
|
||||
get_fname(filename, role, id_addr->addr);
|
||||
|
||||
File file(filename, FILE_O_READ, InternalFS);
|
||||
Adafruit_LittleFS_Namespace::File file(filename, FO_READ, InternalFS);
|
||||
if ( file )
|
||||
{
|
||||
bdata_skip_field(&file); // skip key
|
||||
@@ -298,10 +301,10 @@ void bond_print_list(uint8_t role)
|
||||
{
|
||||
char const * dpath = (role == BLE_GAP_ROLE_PERIPH ? BOND_DIR_PRPH : BOND_DIR_CNTR);
|
||||
|
||||
File dir(dpath, FILE_O_READ, InternalFS);
|
||||
File file(InternalFS);
|
||||
Adafruit_LittleFS_Namespace::File dir(dpath, FO_READ, InternalFS);
|
||||
Adafruit_LittleFS_Namespace::File file(InternalFS);
|
||||
|
||||
while ( (file = dir.openNextFile(FILE_O_READ)) )
|
||||
while ( (file = dir.openNextFile(FO_READ)) )
|
||||
{
|
||||
if ( !file.isDirectory() && bdata_skip_field(&file) ) // skip key
|
||||
{
|
||||
|
||||
@@ -120,14 +120,14 @@ void SwRotaryEncoder::clearAbs(void)
|
||||
|
||||
void SwRotaryEncoder::_irq_handler(void)
|
||||
{
|
||||
uint32_t val = NRF_GPIO->IN;
|
||||
uint8_t bita = bitRead(val, _pina);
|
||||
uint8_t bita = digitalRead(_pina);
|
||||
uint8_t bitb = digitalRead(_pinb);
|
||||
|
||||
if ( bita != _a_last)
|
||||
{
|
||||
int32_t step;
|
||||
|
||||
if ( bita != bitRead(val, _pinb) )
|
||||
if ( bita != bitb )
|
||||
{
|
||||
step = 1;
|
||||
}else
|
||||
|
||||
+30
-7
@@ -17,7 +17,7 @@
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
name=Adafruit nRF52 Boards
|
||||
version=1.3.0
|
||||
version=1.6.1
|
||||
|
||||
# Compile variables
|
||||
# -----------------
|
||||
@@ -49,7 +49,7 @@ compiler.elf2bin.flags=-O binary
|
||||
compiler.elf2bin.cmd=arm-none-eabi-objcopy
|
||||
compiler.elf2hex.flags=-O ihex
|
||||
compiler.elf2hex.cmd=arm-none-eabi-objcopy
|
||||
compiler.ldflags=-mcpu={build.mcu} -mthumb {build.float_flags} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--wrap=malloc -Wl,--wrap=free --specs=nano.specs --specs=nosys.specs
|
||||
compiler.ldflags=-mcpu={build.mcu} -mthumb {build.float_flags} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--wrap=malloc -Wl,--wrap=free -Wl,--wrap=realloc -Wl,--wrap=calloc --specs=nano.specs --specs=nosys.specs
|
||||
compiler.size.cmd=arm-none-eabi-size
|
||||
|
||||
# this can be overriden in boards.txt
|
||||
@@ -128,11 +128,11 @@ recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).*
|
||||
recipe.output.tmp_file={build.project_name}.hex
|
||||
recipe.output.save_file={build.project_name}.{build.variant}.hex
|
||||
|
||||
#***************************************************
|
||||
# ------------------------------------------------
|
||||
# adafruit-nrfutil for uploading
|
||||
# https://github.com/adafruit/Adafruit_nRF52_nrfutil
|
||||
# pre-built binaries are provided for macos and windows
|
||||
#***************************************************
|
||||
# ------------------------------------------------
|
||||
tools.nrfutil.cmd=adafruit-nrfutil
|
||||
tools.nrfutil.cmd.windows={runtime.platform.path}/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe
|
||||
tools.nrfutil.cmd.macosx={runtime.platform.path}/tools/adafruit-nrfutil/macos/adafruit-nrfutil
|
||||
@@ -141,12 +141,12 @@ tools.nrfutil.upload.params.verbose=--verbose
|
||||
tools.nrfutil.upload.params.quiet=
|
||||
tools.nrfutil.upload.pattern="{cmd}" {upload.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank
|
||||
|
||||
#***************************************************
|
||||
# ---------------------------------------------------
|
||||
# Burning bootloader with either jlink or nrfutil
|
||||
#***************************************************
|
||||
# ---------------------------------------------------
|
||||
|
||||
# Bootloader version
|
||||
tools.bootburn.bootloader.file={runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.7.0_{build.sd_name}_{build.sd_version}
|
||||
tools.bootburn.bootloader.file={runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.9.0_{build.sd_name}_{build.sd_version}
|
||||
|
||||
tools.bootburn.bootloader.params.verbose=
|
||||
tools.bootburn.bootloader.params.quiet=
|
||||
@@ -157,3 +157,26 @@ tools.bootburn.erase.params.verbose=
|
||||
tools.bootburn.erase.params.quiet=
|
||||
tools.bootburn.erase.pattern=
|
||||
|
||||
# ----------------------------------------
|
||||
# Debugger configuration (general options)
|
||||
# ----------------------------------------
|
||||
# EXPERIMENTAL feature:
|
||||
# - this is alpha and may be subject to change without notice
|
||||
debug.executable={build.path}/{build.project_name}.elf
|
||||
debug.toolchain=gcc
|
||||
debug.toolchain.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
|
||||
debug.toolchain.prefix=arm-none-eabi-
|
||||
|
||||
debug.server=openocd
|
||||
debug.server.openocd.path={runtime.tools.openocd-0.11.0-arduino2.path}/bin/openocd
|
||||
debug.server.openocd.scripts_dir={runtime.tools.openocd-0.11.0-arduino2.path}/share/openocd/scripts/
|
||||
debug.server.openocd.script={runtime.platform.path}/{build.openocdscript}
|
||||
|
||||
# JLinkServer is not supported by arduino-cli yet
|
||||
# https://github.com/arduino/arduino-cli/blob/eca9d9a8f00582a08fadea8a4b7e3ef01b40d082/commands/debug/debug.go#L160
|
||||
# use debug_custom.json to run JLinkGDBServer instead
|
||||
# https://docs.arduino.cc/tutorials/mkr-wifi-1010/mkr-jlink-setup
|
||||
#debug.server=jlink
|
||||
#debug.server.jlink.path=JLinkGDBServer
|
||||
#debug.server.jlink.device=nrf52840_xxaa
|
||||
#debug.server.jlink.script={runtime.platform.path}/{build.openocdscript}
|
||||
+1
-1
@@ -31,7 +31,7 @@ nrfutil_boot.program.cmd.windows={runtime.platform.path}/tools/adafruit-nrfutil/
|
||||
nrfutil_boot.program.cmd.macosx={runtime.platform.path}/tools/adafruit-nrfutil/macos/adafruit-nrfutil
|
||||
|
||||
# Burn bootloader pattern
|
||||
nrfutil_boot.program.burn_pattern={program.cmd} --verbose dfu serial -pkg "{bootloader.file}.zip" -p {serial.port} -b 115200 --touch 1200
|
||||
nrfutil_boot.program.burn_pattern="{program.cmd}" --verbose dfu serial -pkg "{bootloader.file}.zip" -p {serial.port} -b 115200 --touch 1200
|
||||
|
||||
# Remind user to select Jlink when used to upload sketch
|
||||
nrfutil_boot.program.params.quiet=
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"servertype": "jlink",
|
||||
"device": "nrf52840_xxaa",
|
||||
"interface": "SWD",
|
||||
"serverpath": "JLinkGDBServer"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
source [find interface/cmsis-dap.cfg]
|
||||
transport select swd
|
||||
source [find target/nrf52.cfg]
|
||||
@@ -0,0 +1,3 @@
|
||||
source [find interface/jlink.cfg]
|
||||
transport select swd
|
||||
source [find target/nrf52.cfg]
|
||||
+36
-25
@@ -2,7 +2,6 @@ import os
|
||||
import glob
|
||||
import sys
|
||||
import subprocess
|
||||
from subprocess import Popen, PIPE
|
||||
import time
|
||||
from multiprocessing import Pool
|
||||
|
||||
@@ -22,6 +21,7 @@ default_boards = [
|
||||
'feather52840sense',
|
||||
'itsybitsy52840'
|
||||
]
|
||||
build_boards = []
|
||||
|
||||
def get_sd(name):
|
||||
if '52832' in name:
|
||||
@@ -32,31 +32,34 @@ def get_sd(name):
|
||||
# most of the board is 52840
|
||||
return 's140v6'
|
||||
|
||||
# return [succeeded, failed, skipped]
|
||||
def build_sketch(variant, sketch):
|
||||
def build_a_example(arg):
|
||||
variant = arg[0]
|
||||
sketch = arg[1]
|
||||
|
||||
fqbn = "adafruit:nrf52:{}:softdevice={},debug=l0".format(variant, get_sd(variant))
|
||||
|
||||
# succeeded, failed, skipped
|
||||
ret = [0, 0, 0]
|
||||
|
||||
# skip TinyUSB library examples for nRF52832
|
||||
if variant == 'feather52832' and "libraries/Adafruit_TinyUSB_Arduino" in sketch:
|
||||
return ret
|
||||
|
||||
start_time = time.monotonic()
|
||||
|
||||
# Skip if contains: ".board.test.skip" or ".all.test.skip"
|
||||
# Skip if not contains: ".board.test.only" for a specific board
|
||||
sketchdir = os.path.dirname(sketch)
|
||||
if os.path.exists(sketchdir + '/.all.test.skip') or os.path.exists(sketchdir + '/.' + variant + '.test.skip') or \
|
||||
(glob.glob(sketchdir + "/.*.test.only") and not os.path.exists(sketchdir + '/.' + variant + '.test.only')):
|
||||
if os.path.exists(sketchdir + '/.all.test.skip') or os.path.exists(sketchdir + '/.' + variant + '.test.skip'):
|
||||
success = SKIPPED
|
||||
ret[2] = 1
|
||||
elif glob.glob(sketchdir + "/.*.test.only") and not os.path.exists(sketchdir + '/.' + variant + '.test.only'):
|
||||
success = SKIPPED
|
||||
ret[2] = 1
|
||||
else:
|
||||
build_result = subprocess.run("arduino-cli compile --warnings all --fqbn {} {}".format(fqbn, sketch),
|
||||
shell=True, stdout=PIPE, stderr=PIPE)
|
||||
build_result = subprocess.run("arduino-cli compile --warnings all --fqbn {} {}".format(fqbn, sketch), shell=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
||||
# get stderr into a form where warning/error was output to stderr
|
||||
if build_result.returncode != 0:
|
||||
success = FAILED
|
||||
ret[1] = 1
|
||||
success = FAILED
|
||||
else:
|
||||
ret[0] = 1
|
||||
if build_result.stderr:
|
||||
@@ -67,6 +70,7 @@ def build_sketch(variant, sketch):
|
||||
build_duration = time.monotonic() - start_time
|
||||
print(build_format.format(sketch.split(os.path.sep)[1], os.path.basename(sketch), success,
|
||||
'{:5.2f}s'.format(build_duration)))
|
||||
|
||||
if success != SKIPPED:
|
||||
# Build failed
|
||||
if build_result.returncode != 0:
|
||||
@@ -74,11 +78,14 @@ def build_sketch(variant, sketch):
|
||||
|
||||
# Build with warnings
|
||||
if build_result.stderr:
|
||||
print(f"::group::warning-message")
|
||||
print(build_result.stderr.decode("utf-8"))
|
||||
print(f"::endgroup::")
|
||||
|
||||
return ret
|
||||
|
||||
# return [succeeded, failed, skipped]
|
||||
def build_variant(variant):
|
||||
|
||||
def build_all_examples(variant):
|
||||
print('\n')
|
||||
print(build_separator)
|
||||
print('| {:^84} |'.format('Board ' + variant))
|
||||
@@ -86,35 +93,39 @@ def build_variant(variant):
|
||||
print(build_format.format('Library', 'Example', '\033[39mResult\033[0m', 'Time'))
|
||||
print(build_separator)
|
||||
|
||||
with Pool(processes=os.cpu_count()) as pool:
|
||||
pool_args = list((map(lambda e, b=variant: [b, e], all_examples)))
|
||||
result = pool.starmap(build_sketch, pool_args)
|
||||
args = [[variant, s] for s in all_examples]
|
||||
with Pool() as pool:
|
||||
result = pool.map(build_a_example, args)
|
||||
# sum all element of same index (column sum)
|
||||
return list(map(sum, list(zip(*result))))
|
||||
|
||||
if __name__ == '__main__':
|
||||
build_boards = []
|
||||
|
||||
if __name__ == "__main__":
|
||||
# build all variants if input not existed
|
||||
if len(sys.argv) > 1:
|
||||
build_boards.append(sys.argv[1])
|
||||
else:
|
||||
build_boards = default_boards
|
||||
|
||||
# All examples in libraries except TinyUSB which has its own ci to build
|
||||
all_examples = list(glob.iglob('libraries/**/*.ino', recursive=True))
|
||||
all_examples = [i for i in all_examples if "Adafruit_TinyUSB_Arduino" not in i]
|
||||
all_examples.sort()
|
||||
|
||||
total_time = time.monotonic()
|
||||
build_time = time.monotonic()
|
||||
|
||||
# succeeded, failed, skipped
|
||||
total_result = [0, 0, 0]
|
||||
|
||||
for board in build_boards:
|
||||
ret = build_variant(board)
|
||||
total_result = list(map(lambda x, y: x + y, total_result, ret))
|
||||
fret = build_all_examples(board)
|
||||
if len(fret) == len(total_result):
|
||||
total_result = [total_result[i] + fret[i] for i in range(len(fret))]
|
||||
|
||||
build_time = time.monotonic() - build_time
|
||||
|
||||
print(build_separator)
|
||||
total_time = time.monotonic() - total_time
|
||||
print("Build Summary: {} {}, {} {}, {} {} and took {:.2f}s".format(total_result[0], SUCCEEDED, total_result[1],
|
||||
FAILED, total_result[2], SKIPPED, total_time))
|
||||
print("Build Summary: {} {}, {} {}, {} {} and took {:.2f}s".format(total_result[0], SUCCEEDED, total_result[1], FAILED, total_result[2], SKIPPED, build_time))
|
||||
print(build_separator)
|
||||
|
||||
sys.exit(total_result[1])
|
||||
+109
-100
@@ -38,18 +38,18 @@ def get_mcu(name):
|
||||
def build_upload(name):
|
||||
mcu = get_mcu(name)
|
||||
print("# Upload")
|
||||
print("%s.bootloader.tool=bootburn" % name)
|
||||
print("%s.upload.tool=nrfutil" % name)
|
||||
print("%s.upload.protocol=nrfutil" % name)
|
||||
print(f"{name}.bootloader.tool=bootburn")
|
||||
print(f"{name}.upload.tool=nrfutil")
|
||||
print(f"{name}.upload.protocol=nrfutil")
|
||||
if mcu == 52832:
|
||||
print("%s.upload.use_1200bps_touch=false" % name)
|
||||
print("%s.upload.wait_for_upload_port=false" % name)
|
||||
print("%s.upload.native_usb=false" % name)
|
||||
print(f"{name}.upload.use_1200bps_touch=false")
|
||||
print(f"{name}.upload.wait_for_upload_port=false")
|
||||
print(f"{name}.upload.native_usb=false")
|
||||
else:
|
||||
print("%s.upload.use_1200bps_touch=true" % name)
|
||||
print("%s.upload.wait_for_upload_port=true" % name)
|
||||
print("%s.upload.maximum_size=%d" % (name, mcu_dict[mcu]['flash_size']))
|
||||
print("%s.upload.maximum_data_size=%d" % (name, mcu_dict[mcu]['data_size']))
|
||||
print(f"{name}.upload.use_1200bps_touch=true")
|
||||
print(f"{name}.upload.wait_for_upload_port=true")
|
||||
print(f"{name}.upload.maximum_size={mcu_dict[mcu]['flash_size']}")
|
||||
print(f"{name}.upload.maximum_data_size={mcu_dict[mcu]['data_size']}")
|
||||
print()
|
||||
|
||||
|
||||
@@ -57,90 +57,88 @@ def build_header(name, variant, vendor_name, product_name, boarddefine, vid, pid
|
||||
prettyname = vendor_name + " " + product_name
|
||||
print()
|
||||
print("# -----------------------------------")
|
||||
print("# %s" % prettyname)
|
||||
print(f"# {prettyname}")
|
||||
print("# -----------------------------------")
|
||||
print("%s.name=%s" % (name, prettyname))
|
||||
print(f"{name}.name={prettyname}")
|
||||
print()
|
||||
|
||||
print("# VID/PID for Bootloader, Arduino & CircuitPython")
|
||||
for i in range(len(pid_list)):
|
||||
print("%s.vid.%d=%s" % (name, i, vid))
|
||||
print("%s.pid.%d=%s" % (name, i, pid_list[i]))
|
||||
print(f"{name}.vid.{i}={vid}")
|
||||
print(f"{name}.pid.{i}={pid_list[i]}")
|
||||
print()
|
||||
|
||||
build_upload(name)
|
||||
|
||||
print("# Build")
|
||||
print("%s.build.mcu=cortex-m4" % name)
|
||||
print("%s.build.f_cpu=64000000" % name)
|
||||
print("%s.build.board=%s" % (name, boarddefine))
|
||||
print("%s.build.core=nRF5" % name)
|
||||
print("%s.build.variant=%s" % (name, variant))
|
||||
print('%s.build.usb_manufacturer="%s"' % (name, vendor_name))
|
||||
print('%s.build.usb_product="%s"' % (name, product_name))
|
||||
print(f"{name}.build.mcu=cortex-m4")
|
||||
print(f"{name}.build.f_cpu=64000000")
|
||||
print(f"{name}.build.board={boarddefine}")
|
||||
print(f"{name}.build.core=nRF5")
|
||||
print(f"{name}.build.variant={variant}")
|
||||
print(f'{name}.build.usb_manufacturer="{vendor_name}"')
|
||||
print(f'{name}.build.usb_product="{product_name}"')
|
||||
|
||||
mcu = get_mcu(name)
|
||||
mcu_info = mcu_dict[mcu]
|
||||
print("%s.build.extra_flags=%s" % (name, mcu_info['extra_flags']))
|
||||
print("%s.build.ldscript=%s" % (name, mcu_info['ldscript']))
|
||||
print(f"{name}.build.extra_flags={mcu_info['extra_flags']}")
|
||||
print(f"{name}.build.ldscript={mcu_info['ldscript']}")
|
||||
print(f"{name}.build.openocdscript=scripts/openocd/daplink_nrf52.cfg")
|
||||
if mcu != 52832:
|
||||
print("%s.build.vid=%s" % (name, vid))
|
||||
print("%s.build.pid=%s" % (name, pid_list[0]))
|
||||
print("%s.build.uf2_family=%s" % (name, mcu_info['uf2_family']))
|
||||
print(f"{name}.build.vid={vid}")
|
||||
print(f"{name}.build.pid={pid_list[0]}")
|
||||
print(f"{name}.build.uf2_family={mcu_info['uf2_family']}")
|
||||
print()
|
||||
|
||||
|
||||
def build_softdevice(name):
|
||||
print("# SoftDevice Menu")
|
||||
print("# Menu: SoftDevice")
|
||||
mcu = get_mcu(name)
|
||||
if mcu == 52832:
|
||||
print("%s.menu.softdevice.s132v6=S132 6.1.1" % name)
|
||||
print("%s.menu.softdevice.s132v6.build.sd_name=s132" % name)
|
||||
print("%s.menu.softdevice.s132v6.build.sd_version=6.1.1" % name)
|
||||
print("%s.menu.softdevice.s132v6.build.sd_fwid=0x00B7" % name)
|
||||
print(f"{name}.menu.softdevice.s132v6=S132 6.1.1")
|
||||
print(f"{name}.menu.softdevice.s132v6.build.sd_name=s132")
|
||||
print(f"{name}.menu.softdevice.s132v6.build.sd_version=6.1.1")
|
||||
print(f"{name}.menu.softdevice.s132v6.build.sd_fwid=0x00B7")
|
||||
elif mcu == 52833:
|
||||
print("%s.menu.softdevice.s140v7=S140 7.3.0" % name)
|
||||
print("%s.menu.softdevice.s140v7.build.sd_name=s140" % name)
|
||||
print("%s.menu.softdevice.s140v7.build.sd_version=7.3.0" % name)
|
||||
print("%s.menu.softdevice.s140v7.build.sd_fwid=0x0123" % name)
|
||||
else:
|
||||
# 52840
|
||||
print("%s.menu.softdevice.s140v6=S140 6.1.1" % name)
|
||||
print("%s.menu.softdevice.s140v6.build.sd_name=s140" % name)
|
||||
print("%s.menu.softdevice.s140v6.build.sd_version=6.1.1" % name)
|
||||
print("%s.menu.softdevice.s140v6.build.sd_fwid=0x00B6" % name)
|
||||
print(f"{name}.menu.softdevice.s140v7=S140 7.3.0")
|
||||
print(f"{name}.menu.softdevice.s140v7.build.sd_name=s140")
|
||||
print(f"{name}.menu.softdevice.s140v7.build.sd_version=7.3.0")
|
||||
print(f"{name}.menu.softdevice.s140v7.build.sd_fwid=0x0123")
|
||||
elif mcu == 52840:
|
||||
print(f"{name}.menu.softdevice.s140v6=S140 6.1.1")
|
||||
print(f"{name}.menu.softdevice.s140v6.build.sd_name=s140")
|
||||
print(f"{name}.menu.softdevice.s140v6.build.sd_version=6.1.1")
|
||||
print(f"{name}.menu.softdevice.s140v6.build.sd_fwid=0x00B6")
|
||||
print()
|
||||
|
||||
|
||||
def build_debug(name):
|
||||
print("# Debug Menu")
|
||||
print("%s.menu.debug.l0=Level 0 (Release)" % name)
|
||||
print("%s.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0" % name)
|
||||
print("%s.menu.debug.l1=Level 1 (Error Message)" % name)
|
||||
print("%s.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1" % name)
|
||||
print("%s.menu.debug.l2=Level 2 (Full Debug)" % name)
|
||||
print("%s.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2" % name)
|
||||
print("%s.menu.debug.l3=Level 3 (Segger SystemView)" % name)
|
||||
print("%s.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3" % name)
|
||||
print("%s.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1" % name)
|
||||
print("# Menu: Debug Level")
|
||||
print(f"{name}.menu.debug.l0=Level 0 (Release)")
|
||||
print(f"{name}.menu.debug.l0.build.debug_flags=-DCFG_DEBUG=0")
|
||||
print(f"{name}.menu.debug.l1=Level 1 (Error Message)")
|
||||
print(f"{name}.menu.debug.l1.build.debug_flags=-DCFG_DEBUG=1")
|
||||
print(f"{name}.menu.debug.l2=Level 2 (Full Debug)")
|
||||
print(f"{name}.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2")
|
||||
print(f"{name}.menu.debug.l3=Level 3 (Segger SystemView)")
|
||||
print(f"{name}.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3")
|
||||
print(f"{name}.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1")
|
||||
print()
|
||||
|
||||
|
||||
def build_debug_output(name):
|
||||
print("# Debug Output Menu")
|
||||
print("%s.menu.debug_output.serial=Serial" % name)
|
||||
print("%s.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0" % name)
|
||||
print("%s.menu.debug_output.serial1=Serial1" % name)
|
||||
print("%s.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG" % name)
|
||||
print("%s.menu.debug_output.rtt=Segger RTT" % name)
|
||||
print(
|
||||
"%s.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL" % name)
|
||||
|
||||
print("# Menu: Debug Port")
|
||||
print(f"{name}.menu.debug_output.serial=Serial")
|
||||
print(f"{name}.menu.debug_output.serial.build.logger_flags=-DCFG_LOGGER=0")
|
||||
print(f"{name}.menu.debug_output.serial1=Serial1")
|
||||
print(f"{name}.menu.debug_output.serial1.build.logger_flags=-DCFG_LOGGER=1 -DCFG_TUSB_DEBUG=CFG_DEBUG")
|
||||
print(f"{name}.menu.debug_output.rtt=Segger RTT")
|
||||
print(f"{name}.menu.debug_output.rtt.build.logger_flags=-DCFG_LOGGER=2 -DCFG_TUSB_DEBUG=CFG_DEBUG -DSEGGER_RTT_MODE_DEFAULT=SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL")
|
||||
|
||||
def build_global_menu():
|
||||
print("menu.softdevice=SoftDevice")
|
||||
print("menu.debug=Debug")
|
||||
print("menu.debug_output=Debug Output")
|
||||
print("menu.debug=Debug Level")
|
||||
print("menu.debug_output=Debug Port")
|
||||
|
||||
|
||||
def make_board(name, variant, vendor_name, product_name, boarddefine, vid, pid_list):
|
||||
@@ -150,60 +148,71 @@ def make_board(name, variant, vendor_name, product_name, boarddefine, vid, pid_l
|
||||
build_debug_output(name)
|
||||
|
||||
|
||||
# ------------------------------
|
||||
# main
|
||||
# ------------------------------
|
||||
build_global_menu()
|
||||
|
||||
make_board("cluenrf52840", "clue_nrf52840", "Adafruit", "CLUE", "NRF52840_CLUE",
|
||||
"0x239A", ["0x8071", "0x0071", "0x8072"])
|
||||
# ------------------------------
|
||||
# Adafruit Boards
|
||||
# ------------------------------
|
||||
|
||||
make_board("cplaynrf52840", "circuitplayground_nrf52840", "Adafruit", "Circuit Playground Bluefruit",
|
||||
"NRF52840_CIRCUITPLAY",
|
||||
"0x239A", ["0x8045", "0x0045", "0x8046"])
|
||||
adafruit_boards_list = [
|
||||
["feather52832", "feather_nrf52832", "Adafruit", "Feather nRF52832", "NRF52832_FEATHER",
|
||||
"0x239A", []],
|
||||
|
||||
make_board("feather52832", "feather_nrf52832", "Adafruit", "Feather nRF52832", "NRF52832_FEATHER",
|
||||
"0x239A", [])
|
||||
["feather52840", "feather_nrf52840_express", "Adafruit", "Feather nRF52840 Express", "NRF52840_FEATHER",
|
||||
"0x239A", ["0x8029", "0x0029", "0x002A", "0x802A"]],
|
||||
|
||||
make_board("feather52840", "feather_nrf52840_express", "Adafruit", "Feather nRF52840 Express", "NRF52840_FEATHER",
|
||||
"0x239A", ["0x8029", "0x0029", "0x002A", "0x802A"])
|
||||
["feather52840sense", "feather_nrf52840_sense", "Adafruit", "Feather nRF52840 Sense", "NRF52840_FEATHER_SENSE",
|
||||
"0x239A", ["0x8087", "0x0087", "0x0088", "0x8088"]],
|
||||
|
||||
make_board("feather52840sense", "feather_nrf52840_sense", "Adafruit", "Feather nRF52840 Sense",
|
||||
"NRF52840_FEATHER_SENSE",
|
||||
"0x239A", ["0x8087", "0x0087", "0x0088", "0x8088"])
|
||||
["feather_nrf52840_sense_tft", "feather_nrf52840_sense_tft", "Adafruit", "Feather nRF52840 Sense TFT", "NRF52840_FEATHER_SENSE_TFT",
|
||||
"0x239A", ["0x8087", "0x0087", "0x0088", "0x8088"]], # TODO shared VID with sense for now
|
||||
|
||||
make_board("itsybitsy52840", "itsybitsy_nrf52840_express", "Adafruit", "ItsyBitsy nRF52840 Express",
|
||||
"NRF52840_ITSYBITSY -DARDUINO_NRF52_ITSYBITSY",
|
||||
"0x239A", ["0x8051", "0x0051", "0x0052", "0x8052"])
|
||||
["itsybitsy52840", "itsybitsy_nrf52840_express", "Adafruit", "ItsyBitsy nRF52840 Express", "NRF52840_ITSYBITSY -DARDUINO_NRF52_ITSYBITSY",
|
||||
"0x239A", ["0x8051", "0x0051", "0x0052", "0x8052"]],
|
||||
|
||||
make_board("ledglasses_nrf52840", "ledglasses_nrf52840", "Adafruit", "LED Glasses Driver nRF52840",
|
||||
"NRF52840_LED_GLASSES",
|
||||
"0x239A", ["0x810D", "0x010D", "0x810E"])
|
||||
["cplaynrf52840", "circuitplayground_nrf52840", "Adafruit", "Circuit Playground Bluefruit", "NRF52840_CIRCUITPLAY",
|
||||
"0x239A", ["0x8045", "0x0045", "0x8046"]],
|
||||
|
||||
make_board("mdbt50qrx", "raytac_mdbt50q_rx", "Raytac", "nRF52840 Dongle", "MDBT50Q_RX",
|
||||
"0x239A", ["0x810B", "0x010B", "0x810C"])
|
||||
["cluenrf52840", "clue_nrf52840", "Adafruit", "CLUE", "NRF52840_CLUE",
|
||||
"0x239A", ["0x8071", "0x0071", "0x8072"]],
|
||||
|
||||
print()
|
||||
print("# -------------------------------------------------------")
|
||||
print("#")
|
||||
print("# Boards not yet in production")
|
||||
print("#")
|
||||
print("# -------------------------------------------------------")
|
||||
["ledglasses_nrf52840", "ledglasses_nrf52840", "Adafruit", "LED Glasses Driver nRF52840", "NRF52840_LED_GLASSES",
|
||||
"0x239A", ["0x810D", "0x010D", "0x810E"]],
|
||||
|
||||
make_board("metro52840", "metro_nrf52840_express", "Adafruit", "Metro nRF52840 Express", "NRF52840_METRO",
|
||||
"0x239A", ["0x803F", "0x003F", "0x0040", "0x8040"])
|
||||
["mdbt50qrx", "raytac_mdbt50q_rx", "Raytac", "nRF52840 Dongle", "MDBT50Q_RX",
|
||||
"0x239A", ["0x810B", "0x010B", "0x810C"]],
|
||||
|
||||
# TODO currently shared PID with nrf52840
|
||||
make_board("feather52833", "feather_nrf52833_express", "Adafruit", "Feather nRF52833 Express", "NRF52833_FEATHER",
|
||||
"0x239A", ["0x8029", "0x0029", "0x002A", "0x802A"])
|
||||
["metro52840", "metro_nrf52840_express", "Adafruit", "Metro nRF52840 Express", "NRF52840_METRO",
|
||||
"0x239A", ["0x803F", "0x003F", "0x0040", "0x8040"]],
|
||||
|
||||
# ["feather52833", "feather_nrf52833_express", "Adafruit", "Feather nRF52833 Express", "NRF52833_FEATHER",
|
||||
# "0x239A", ["0x8029", "0x0029", "0x002A", "0x802A"]],
|
||||
]
|
||||
|
||||
for b in adafruit_boards_list:
|
||||
make_board(*b)
|
||||
|
||||
# ------------------------------
|
||||
# 3rd Party Boards
|
||||
# ------------------------------
|
||||
|
||||
print()
|
||||
print()
|
||||
print("# -------------------------------------------------------")
|
||||
print("#")
|
||||
print("# Boards by 3rd Party (not Adafruit)")
|
||||
print("#")
|
||||
print("# Boards that aren't made by Adafruit")
|
||||
print("# and are not officially supported")
|
||||
print("# -------------------------------------------------------")
|
||||
|
||||
make_board("particle_xenon", "particle_xenon", "Particle", "Xenon", "PARTICLE_XENON",
|
||||
"0x239A", ["0x8029", "0x0029"])
|
||||
thirdparty_boards_list = [
|
||||
["pca10056", "pca10056", "Nordic", "nRF52840 DK", "NRF52840_PCA10056",
|
||||
"0x239A", ["0x8029", "0x0029"]],
|
||||
|
||||
make_board("pca10056", "pca10056", "Nordic", "nRF52840 DK", "NRF52840_PCA10056",
|
||||
"0x239A", ["0x8029", "0x0029"])
|
||||
["particle_xenon", "particle_xenon", "Particle", "Xenon", "PARTICLE_XENON",
|
||||
"0x239A", ["0x8029", "0x0029"]],
|
||||
]
|
||||
|
||||
for b in thirdparty_boards_list:
|
||||
make_board(*b)
|
||||
+41
-44
@@ -1,7 +1,24 @@
|
||||
import os
|
||||
import shutil
|
||||
import urllib.request
|
||||
import pathlib
|
||||
from multiprocessing import Pool
|
||||
|
||||
# Get all variants
|
||||
all_variant = []
|
||||
for entry in os.scandir("variants"):
|
||||
if entry.is_dir():
|
||||
all_variant.append(entry.name)
|
||||
all_variant.sort()
|
||||
|
||||
# Detect version in platform.txt
|
||||
version = ''
|
||||
with open('platform.txt') as pf:
|
||||
platform_txt = pf.read()
|
||||
e = '{build.variant}_bootloader-'
|
||||
v1 = platform_txt.index(e) + len(e)
|
||||
v2 = platform_txt.index('_', v1)
|
||||
version = platform_txt[v1:v2]
|
||||
|
||||
print(f'version {version}')
|
||||
|
||||
|
||||
def get_sd(name):
|
||||
@@ -14,53 +31,33 @@ def get_sd(name):
|
||||
return 's140_6.1.1'
|
||||
|
||||
|
||||
# Get all variants
|
||||
all_variant = []
|
||||
for entry in os.scandir("variants"):
|
||||
if entry.is_dir():
|
||||
all_variant.append(entry.name)
|
||||
all_variant.sort()
|
||||
|
||||
# Detect version in platform.txt
|
||||
version = '';
|
||||
with open('platform.txt') as pf:
|
||||
platform_txt = pf.read()
|
||||
e = '{build.variant}_bootloader-'
|
||||
v1 = platform_txt.index(e) + len(e)
|
||||
v2 = platform_txt.index('_', v1)
|
||||
version = platform_txt[v1:v2]
|
||||
|
||||
print('version {}'.format(version))
|
||||
|
||||
for variant in all_variant:
|
||||
# Download a variant's bootloader
|
||||
def download_variant(variant):
|
||||
sd = get_sd(variant)
|
||||
|
||||
# Download from bootloader release
|
||||
name = '{}_bootloader-{}'.format(variant, version)
|
||||
url = 'https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/download/{}/'.format(version)
|
||||
f_zip = f'{variant}_bootloader-{version}_{sd}.zip'
|
||||
f_hex = f'{variant}_bootloader-{version}_{sd}.hex'
|
||||
f_uf2 = f'update-{variant}_bootloader-{version}_nosd.uf2'
|
||||
url_prefix = f'https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/download/{version}/'
|
||||
|
||||
# Download zip, hex and uf2 if not 832
|
||||
fzip = '{}_{}.zip'.format(name, sd)
|
||||
fhex = '{}_{}.hex'.format(name, sd)
|
||||
fuf2 = 'update-{}_nosd.uf2'.format(name, sd)
|
||||
# remove existing bootloader files
|
||||
if os.path.exists(f'bootloader/{variant}'):
|
||||
for item in os.listdir(f'bootloader/{variant}'):
|
||||
os.remove(os.path.join(f'bootloader/{variant}', item))
|
||||
else:
|
||||
os.makedirs(f'bootloader/{variant}')
|
||||
|
||||
print("Downloading ", fzip)
|
||||
urllib.request.urlretrieve(url + fzip, fzip)
|
||||
print(f"Downloading {f_zip}")
|
||||
urllib.request.urlretrieve(url_prefix + f_zip, f'bootloader/{variant}/{f_zip}')
|
||||
|
||||
print("Downloading ", fhex)
|
||||
urllib.request.urlretrieve(url + fhex, fhex)
|
||||
print(f"Downloading {f_hex}")
|
||||
urllib.request.urlretrieve(url_prefix + f_hex, f'bootloader/{variant}/{f_hex}')
|
||||
|
||||
if variant != 'feather_nrf52832':
|
||||
print("Downloading ", fuf2)
|
||||
urllib.request.urlretrieve(url + fuf2, fuf2)
|
||||
if 's132' not in sd:
|
||||
print(f"Downloading {f_uf2}")
|
||||
urllib.request.urlretrieve(url_prefix + f_uf2, f'bootloader/{variant}/{f_uf2}')
|
||||
|
||||
# remove existing bootloader and copy new files
|
||||
boot_path = pathlib.Path('bootloader/{}'.format(variant))
|
||||
shutil.rmtree(boot_path, ignore_errors=True)
|
||||
os.mkdir(boot_path)
|
||||
|
||||
# move file
|
||||
os.rename(fzip, boot_path / fzip)
|
||||
os.rename(fhex, boot_path / fhex)
|
||||
if variant != 'feather_nrf52832':
|
||||
os.rename(fuf2, boot_path / fuf2)
|
||||
if __name__ == "__main__":
|
||||
with Pool() as p:
|
||||
p.map(download_variant, all_variant)
|
||||
@@ -71,7 +71,9 @@ const uint32_t g_ADigitalPinMap[] =
|
||||
// The remaining NFC pin
|
||||
9, // D33 is P0.09 (NFC1, exposed only via test point on bottom of board)
|
||||
|
||||
// Thus, there are 34 defined pins
|
||||
32+14, // D34 is P1.14
|
||||
|
||||
// Thus, there are 35 defined pins
|
||||
|
||||
// The remaining pins are not usable:
|
||||
//
|
||||
@@ -92,7 +94,6 @@ const uint32_t g_ADigitalPinMap[] =
|
||||
// 43, // P1.11 is not connected per schematic
|
||||
// 44, // P1.12 is not connected per schematic
|
||||
// 45, // P1.13 is not connected per schematic
|
||||
// 46, // P1.14 is not connected per schematic
|
||||
};
|
||||
|
||||
void initVariant()
|
||||
@@ -103,5 +104,8 @@ void initVariant()
|
||||
|
||||
pinMode(PIN_LED2, OUTPUT);
|
||||
ledOff(PIN_LED2);
|
||||
|
||||
pinMode(PIN_NEOPIXEL_POWER, OUTPUT);
|
||||
digitalWrite(PIN_NEOPIXEL_POWER, HIGH);
|
||||
}
|
||||
|
||||
@@ -37,14 +37,15 @@ extern "C"
|
||||
#endif // __cplusplus
|
||||
|
||||
// Number of pins defined in PinDescription array
|
||||
#define PINS_COUNT (34)
|
||||
#define NUM_DIGITAL_PINS (34)
|
||||
#define PINS_COUNT (35)
|
||||
#define NUM_DIGITAL_PINS (35)
|
||||
#define NUM_ANALOG_INPUTS (6) // A6 is used for battery, A7 is analog reference
|
||||
#define NUM_ANALOG_OUTPUTS (0)
|
||||
|
||||
// LEDs
|
||||
#define PIN_LED1 (3)
|
||||
#define PIN_LED2 (4)
|
||||
#define PIN_NEOPIXEL_POWER (34)
|
||||
#define PIN_NEOPIXEL (8)
|
||||
#define NEOPIXEL_NUM 1
|
||||
|
||||
|
||||
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user