36 files changed
+311
-131
No files matched your search
@@ -149,7 +149,7 @@ which in turn is based on the [Arduino SAMD Core](https://github.com/arduino/Ard
|
||||
The following libraries are used:
|
||||
|
||||
- adafruit-nrfutil is based on Nordic Semiconductor ASA's [pc-nrfutil](https://github.com/NordicSemiconductor/pc-nrfutil)
|
||||
- freeRTOS as operating system
|
||||
- [freeRTOS](https://www.freertos.org/) as operating system
|
||||
- [tinyusb](https://github.com/hathach/tinyusb) as usb stack
|
||||
- [nrfx](https://github.com/NordicSemiconductor/nrfx) for peripherals driver
|
||||
- [littlefs](https://github.com/ARMmbed/littlefs) for internal file system
|
||||
|
||||
+3
-3
@@ -43,7 +43,7 @@ feather52832.build.extra_flags=-DNRF52832_XXAA -DNRF52
|
||||
# SofDevice Menu
|
||||
# Ram & ROM size varies depending on SoftDevice (check linker script)
|
||||
|
||||
feather52832.menu.softdevice.s132v6=0.2.5 (s132 6.1.1)
|
||||
feather52832.menu.softdevice.s132v6=0.2.6 (s132 6.1.1)
|
||||
feather52832.menu.softdevice.s132v6.build.sd_flags=-DS132
|
||||
feather52832.menu.softdevice.s132v6.build.sd_name=s132
|
||||
feather52832.menu.softdevice.s132v6.build.sd_version=6.1.1
|
||||
@@ -104,7 +104,7 @@ feather52840.build.extra_flags=-DNRF52840_XXAA
|
||||
# SofDevice Menu
|
||||
# Ram & ROM size varies depending on SoftDevice (check linker script)
|
||||
|
||||
feather52840.menu.softdevice.s140v6=0.2.5 (s140 6.1.1)
|
||||
feather52840.menu.softdevice.s140v6=0.2.6 (s140 6.1.1)
|
||||
feather52840.menu.softdevice.s140v6.build.sd_flags=-DS140
|
||||
feather52840.menu.softdevice.s140v6.build.sd_name=s140
|
||||
feather52840.menu.softdevice.s140v6.build.sd_version=6.1.1
|
||||
@@ -149,7 +149,7 @@ pca10056.build.extra_flags=-DNRF52840_XXAA
|
||||
# SofDevice Menu
|
||||
# Ram & ROM size varies depending on SoftDevice (check linker script)
|
||||
|
||||
pca10056.menu.softdevice.s140v6=0.2.5 (s140 6.1.1)
|
||||
pca10056.menu.softdevice.s140v6=0.2.6 (s140 6.1.1)
|
||||
pca10056.menu.softdevice.s140v6.build.sd_flags=-DS140
|
||||
pca10056.menu.softdevice.s140v6.build.sd_name=s140
|
||||
pca10056.menu.softdevice.s140v6.build.sd_version=6.1.1
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# Adafruit nRF52 Arduino Core Changelog
|
||||
|
||||
# 0.9.3
|
||||
|
||||
- Correct bootloader version text in IDE to 0.2.6
|
||||
- Fixed #173 ( PR #178 thanks Nenik)
|
||||
- Added Client Battery support BLEClientBas
|
||||
- Added BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST event support for Central
|
||||
- Added Jlink as programmer to upload sketch (#133)
|
||||
|
||||
## 0.9.2
|
||||
|
||||
- Fully support Feather nRF52840
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
//#include <pstorage.h>
|
||||
//#include <app_scheduler.h>
|
||||
#include <nrf_soc.h>
|
||||
#include "nffs/nffs.h"
|
||||
#include "Bluefruit_FileIO.h"
|
||||
#include "utility/debug.h"
|
||||
|
||||
#include "rtos.h"
|
||||
@@ -107,7 +107,13 @@ static uint8_t crypto_loadKeys(void)
|
||||
crypto_persistent_keys_t keys = {};
|
||||
|
||||
uint32_t keylen = sizeof(keys);
|
||||
fsutil_read_file(CRYPTO_KEYFILE, 0, keylen, &keys, &keylen);
|
||||
|
||||
File file(CRYPTO_KEYFILE, FILE_READ, InternalFS);
|
||||
VERIFY(file, 0);
|
||||
|
||||
keylen = file.read(&keys, keylen);
|
||||
|
||||
file.close();
|
||||
|
||||
if (keys.valid0 == 0x55 && keys.valid1 == 0xAA && keys.instance == CRYPTO_INSTANCE)
|
||||
{
|
||||
@@ -156,7 +162,12 @@ void crypto_storeKeys(void)
|
||||
keys.valid0 = 0x55;
|
||||
keys.valid1 = 0xAA;
|
||||
|
||||
fsutil_write_file(CRYPTO_KEYFILE, &keys, sizeof(keys));
|
||||
File file(CRYPTO_KEYFILE, FILE_WRITE, InternalFS);
|
||||
VERIFY(file,);
|
||||
|
||||
file.write(&keys, sizeof(keys));
|
||||
|
||||
file.close();
|
||||
|
||||
// err_code = pstorage_update(&handle, (uint8_t*)&keys, sizeof(keys), 0);
|
||||
// APP_ERROR_CHECK(err_code);
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <bluefruit.h>
|
||||
#include "HAPUuid.h"
|
||||
#include "HAPPairing.h"
|
||||
#include <Nffs.h>
|
||||
#include "Bluefruit_FileIO.h"
|
||||
|
||||
#include "crypto/crypto.h"
|
||||
|
||||
@@ -159,7 +159,8 @@ err_t HAPPairing::begin(void)
|
||||
setDeviceID(mac);
|
||||
|
||||
// Init cryptography
|
||||
Nffs.mkdir_p("/adafruit/homekit");
|
||||
if ( !InternalFS.exists("/adafruit/homekit") ) InternalFS.mkdir("/adafruit/homekit");
|
||||
|
||||
crypto_init();
|
||||
|
||||
return ERROR_NONE;
|
||||
|
||||
@@ -18,8 +18,9 @@
|
||||
*/
|
||||
#include <bluefruit.h>
|
||||
|
||||
BLEClientDis clientDis;
|
||||
BLEClientUart clientUart;
|
||||
BLEClientBas clientBas; // battery client
|
||||
BLEClientDis clientDis; // device information client
|
||||
BLEClientUart clientUart; // bleuart client
|
||||
|
||||
void setup()
|
||||
{
|
||||
@@ -35,6 +36,9 @@ void setup()
|
||||
|
||||
Bluefruit.setName("Bluefruit52 Central");
|
||||
|
||||
// Configure Battyer client
|
||||
clientBas.begin();
|
||||
|
||||
// Configure DIS client
|
||||
clientDis.begin();
|
||||
|
||||
@@ -91,7 +95,7 @@ void connect_callback(uint16_t conn_handle)
|
||||
{
|
||||
Serial.println("Connected");
|
||||
|
||||
Serial.print("Dicovering DIS ... ");
|
||||
Serial.print("Dicovering Device Information ... ");
|
||||
if ( clientDis.discover(conn_handle) )
|
||||
{
|
||||
Serial.println("Found it");
|
||||
@@ -114,10 +118,19 @@ void connect_callback(uint16_t conn_handle)
|
||||
}
|
||||
|
||||
Serial.println();
|
||||
}
|
||||
}
|
||||
|
||||
Serial.print("Dicovering Battery ... ");
|
||||
if ( clientBas.discover(conn_handle) )
|
||||
{
|
||||
Serial.println("Found it");
|
||||
Serial.print("Battery level: ");
|
||||
Serial.print(clientBas.read());
|
||||
Serial.println("%");
|
||||
}
|
||||
|
||||
|
||||
Serial.print("Discovering BLE Uart Service ... ");
|
||||
|
||||
if ( clientUart.discover(conn_handle) )
|
||||
{
|
||||
Serial.println("Found it");
|
||||
@@ -139,6 +152,7 @@ void connect_callback(uint16_t conn_handle)
|
||||
* Callback invoked when a connection is dropped
|
||||
* @param conn_handle
|
||||
* @param reason is a BLE_HCI_STATUS_CODE which can be found in ble_hci.h
|
||||
* https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/cores/nRF5/nordic/softdevice/s140_nrf52_6.1.1_API/include/ble_hci.h
|
||||
*/
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
|
||||
+1
@@ -188,6 +188,7 @@ void connect_callback(uint16_t conn_handle)
|
||||
* Callback invoked when a connection is dropped
|
||||
* @param conn_handle
|
||||
* @param reason is a BLE_HCI_STATUS_CODE which can be found in ble_hci.h
|
||||
* https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/cores/nRF5/nordic/softdevice/s140_nrf52_6.1.1_API/include/ble_hci.h
|
||||
*/
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
|
||||
@@ -118,7 +118,6 @@ void connect_callback(uint16_t conn_handle)
|
||||
|
||||
// Once HRM service is found, we continue to discover its characteristic
|
||||
Serial.println("Found it");
|
||||
|
||||
|
||||
Serial.print("Discovering Measurement characteristic ... ");
|
||||
if ( !hrmc.discover() )
|
||||
@@ -166,6 +165,7 @@ void connect_callback(uint16_t conn_handle)
|
||||
* Callback invoked when a connection is dropped
|
||||
* @param conn_handle
|
||||
* @param reason is a BLE_HCI_STATUS_CODE which can be found in ble_hci.h
|
||||
* https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/cores/nRF5/nordic/softdevice/s140_nrf52_6.1.1_API/include/ble_hci.h
|
||||
*/
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
|
||||
@@ -135,6 +135,7 @@ void connect_callback(uint16_t conn_handle)
|
||||
* Callback invoked when a connection is dropped
|
||||
* @param conn_handle
|
||||
* @param reason is a BLE_HCI_STATUS_CODE which can be found in ble_hci.h
|
||||
* https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/cores/nRF5/nordic/softdevice/s140_nrf52_6.1.1_API/include/ble_hci.h
|
||||
*/
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
|
||||
+2
-1
@@ -237,7 +237,8 @@ void connect_callback(uint16_t conn_handle)
|
||||
/**
|
||||
* Callback invoked when a connection is dropped
|
||||
* @param conn_handle
|
||||
* @param reason
|
||||
* @param reason is a BLE_HCI_STATUS_CODE which can be found in ble_hci.h
|
||||
* https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/cores/nRF5/nordic/softdevice/s140_nrf52_6.1.1_API/include/ble_hci.h
|
||||
*/
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
|
||||
@@ -204,8 +204,9 @@ void ancs_notification_callback(AncsNotification_t* notif)
|
||||
|
||||
/**
|
||||
* Callback invoked when a connection is dropped
|
||||
* @param conn_handle connection where this event happens
|
||||
* @param conn_handle
|
||||
* @param reason is a BLE_HCI_STATUS_CODE which can be found in ble_hci.h
|
||||
* https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/cores/nRF5/nordic/softdevice/s140_nrf52_6.1.1_API/include/ble_hci.h
|
||||
*/
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
|
||||
@@ -380,6 +380,7 @@ void ancs_notification_callback(AncsNotification_t* notif)
|
||||
* Callback invoked when a connection is dropped
|
||||
* @param conn_handle connection where this event happens
|
||||
* @param reason is a BLE_HCI_STATUS_CODE which can be found in ble_hci.h
|
||||
* https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/cores/nRF5/nordic/softdevice/s140_nrf52_6.1.1_API/include/ble_hci.h
|
||||
*/
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
|
||||
@@ -130,6 +130,7 @@ void connect_callback(uint16_t conn_handle)
|
||||
* Callback invoked when a connection is dropped
|
||||
* @param conn_handle connection where this event happens
|
||||
* @param reason is a BLE_HCI_STATUS_CODE which can be found in ble_hci.h
|
||||
* https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/cores/nRF5/nordic/softdevice/s140_nrf52_6.1.1_API/include/ble_hci.h
|
||||
*/
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
|
||||
@@ -165,6 +165,7 @@ void printTime(void)
|
||||
* Callback invoked when a connection is dropped
|
||||
* @param conn_handle connection where this event happens
|
||||
* @param reason is a BLE_HCI_STATUS_CODE which can be found in ble_hci.h
|
||||
* https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/cores/nRF5/nordic/softdevice/s140_nrf52_6.1.1_API/include/ble_hci.h
|
||||
*/
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
|
||||
@@ -180,6 +180,7 @@ void printTime(void)
|
||||
* Callback invoked when a connection is dropped
|
||||
* @param conn_handle connection where this event happens
|
||||
* @param reason is a BLE_HCI_STATUS_CODE which can be found in ble_hci.h
|
||||
* https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/cores/nRF5/nordic/softdevice/s140_nrf52_6.1.1_API/include/ble_hci.h
|
||||
*/
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
|
||||
@@ -27,12 +27,6 @@ BLEBas blebas; // BAS (Battery Service) helper class instance
|
||||
|
||||
uint8_t bps = 0;
|
||||
|
||||
// Advanced function prototypes
|
||||
void startAdv(void);
|
||||
void setupHRM(void);
|
||||
void connect_callback(uint16_t conn_handle);
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason);
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
@@ -178,6 +172,7 @@ void connect_callback(uint16_t conn_handle)
|
||||
* Callback invoked when a connection is dropped
|
||||
* @param conn_handle connection where this event happens
|
||||
* @param reason is a BLE_HCI_STATUS_CODE which can be found in ble_hci.h
|
||||
* https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/cores/nRF5/nordic/softdevice/s140_nrf52_6.1.1_API/include/ble_hci.h
|
||||
*/
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
|
||||
@@ -162,6 +162,7 @@ void connect_callback(uint16_t conn_handle)
|
||||
* Callback invoked when a connection is dropped
|
||||
* @param conn_handle connection where this event happens
|
||||
* @param reason is a BLE_HCI_STATUS_CODE which can be found in ble_hci.h
|
||||
* https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/cores/nRF5/nordic/softdevice/s140_nrf52_6.1.1_API/include/ble_hci.h
|
||||
*/
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
|
||||
@@ -99,6 +99,7 @@ void connect_callback(uint16_t conn_handle)
|
||||
* Callback invoked when a connection is dropped
|
||||
* @param conn_handle connection where this event happens
|
||||
* @param reason is a BLE_HCI_STATUS_CODE which can be found in ble_hci.h
|
||||
* https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/cores/nRF5/nordic/softdevice/s140_nrf52_6.1.1_API/include/ble_hci.h
|
||||
*/
|
||||
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
|
||||
{
|
||||
|
||||
+4
-4
@@ -12,7 +12,6 @@
|
||||
any redistribution
|
||||
*********************************************************************/
|
||||
|
||||
#include <Nffs.h>
|
||||
#include <bluefruit.h>
|
||||
#include <BLEHomekit.h>
|
||||
|
||||
@@ -126,8 +125,10 @@ void setup()
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setName("Bluefruit52");
|
||||
|
||||
//Nffs.remove(CRYPTO_KEYFILE);
|
||||
//fsutil_write_file(CRYPTO_KEYFILE, &test_keys, sizeof(test_keys));
|
||||
//InternalFS.remove(CRYPTO_KEYFILE);
|
||||
//File file(CRYPTO_KEYFILE, FILE_WRITE, InternalFS);
|
||||
//file.write(&test_keys, sizeof(test_keys));
|
||||
//file.close();
|
||||
|
||||
homekit.begin();
|
||||
|
||||
@@ -186,4 +187,3 @@ void loop()
|
||||
digitalToggle(LED_RED);
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name=Adafruit Bluefruit nRF52 Libraries
|
||||
version=0.9.2
|
||||
version=0.9.3
|
||||
author=Adafruit
|
||||
maintainer=Adafruit <info@adafruit.com>
|
||||
sentence=Arduino library for nRF52-based Adafruit Bluefruit LE modules
|
||||
|
||||
@@ -42,8 +42,9 @@
|
||||
*/
|
||||
BLECentral::BLECentral(void)
|
||||
{
|
||||
_ppcp_min_conn = BLE_GAP_CONN_MIN_INTERVAL_DFLT;
|
||||
_ppcp_max_conn = BLE_GAP_CONN_MAX_INTERVAL_DFLT;
|
||||
_conn_param.min_conn_interval = _conn_param.max_conn_interval = BLE_GAP_CONN_MIN_INTERVAL_DFLT;
|
||||
_conn_param.slave_latency = BLE_GAP_CONN_SLAVE_LATENCY;
|
||||
_conn_param.conn_sup_timeout = BLE_GAP_CONN_SUPERVISION_TIMEOUT_MS/10;
|
||||
|
||||
_connect_cb = NULL;
|
||||
_disconnect_cb = NULL;
|
||||
@@ -60,8 +61,8 @@ void BLECentral::begin(void)
|
||||
*------------------------------------------------------------------*/
|
||||
bool BLECentral::setConnInterval(uint16_t min, uint16_t max)
|
||||
{
|
||||
_ppcp_min_conn = min;
|
||||
_ppcp_max_conn = max;
|
||||
_conn_param.min_conn_interval = min;
|
||||
_conn_param.max_conn_interval = max;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -73,15 +74,8 @@ bool BLECentral::setConnIntervalMS (uint16_t min_ms, uint16_t max_ms)
|
||||
|
||||
bool BLECentral::connect(const ble_gap_addr_t* peer_addr)
|
||||
{
|
||||
ble_gap_conn_params_t gap_conn_params =
|
||||
{
|
||||
.min_conn_interval = _ppcp_min_conn, // in 1.25ms unit
|
||||
.max_conn_interval = _ppcp_max_conn, // in 1.25ms unit
|
||||
.slave_latency = BLE_GAP_CONN_SLAVE_LATENCY,
|
||||
.conn_sup_timeout = BLE_GAP_CONN_SUPERVISION_TIMEOUT_MS / 10 // in 10ms unit
|
||||
};
|
||||
|
||||
VERIFY_STATUS( sd_ble_gap_connect(peer_addr, Bluefruit.Scanner.getParams(), &gap_conn_params, CONN_CFG_CENTRAL), false );
|
||||
// Connect with default connection parameter
|
||||
VERIFY_STATUS( sd_ble_gap_connect(peer_addr, Bluefruit.Scanner.getParams(), &_conn_param, CONN_CFG_CENTRAL), false );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -147,29 +141,45 @@ void BLECentral::clearBonds(void)
|
||||
void BLECentral::_event_handler(ble_evt_t* evt)
|
||||
{
|
||||
// conn handle has fixed offset regardless of event type
|
||||
const uint16_t evt_conn_hdl = evt->evt.common_evt.conn_handle;
|
||||
const uint16_t conn_hdl = evt->evt.common_evt.conn_handle;
|
||||
|
||||
/* PrPh handle connection is already filtered. Only handle Central events or
|
||||
* connection handle is BLE_CONN_HANDLE_INVALID (e.g BLE_GAP_EVT_ADV_REPORT)
|
||||
*/
|
||||
* connection handle is BLE_CONN_HANDLE_INVALID (e.g BLE_GAP_EVT_ADV_REPORT) */
|
||||
switch ( evt->header.evt_id )
|
||||
{
|
||||
case BLE_GAP_EVT_CONNECTED:
|
||||
if ( Bluefruit.Gap.getRole(evt_conn_hdl) == BLE_GAP_ROLE_CENTRAL)
|
||||
if ( Bluefruit.Gap.getRole(conn_hdl) == BLE_GAP_ROLE_CENTRAL)
|
||||
{
|
||||
// Invoke callback
|
||||
if ( _connect_cb) ada_callback(NULL, _connect_cb, evt_conn_hdl);
|
||||
if ( _connect_cb) ada_callback(NULL, _connect_cb, conn_hdl);
|
||||
}
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVT_DISCONNECTED:
|
||||
if ( Bluefruit.Gap.getRole(evt_conn_hdl) == BLE_GAP_ROLE_CENTRAL)
|
||||
if ( Bluefruit.Gap.getRole(conn_hdl) == BLE_GAP_ROLE_CENTRAL)
|
||||
{
|
||||
// Invoke callback reason is BLE_HCI_STATUS code
|
||||
if ( _disconnect_cb) ada_callback(NULL, _disconnect_cb, evt_conn_hdl, evt->evt.gap_evt.params.disconnected.reason);
|
||||
if ( _disconnect_cb) ada_callback(NULL, _disconnect_cb, conn_hdl, evt->evt.gap_evt.params.disconnected.reason);
|
||||
}
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST:
|
||||
{
|
||||
// Peripheral request to change connection parameter
|
||||
ble_gap_conn_params_t* request_param = &evt->evt.gap_evt.params.conn_param_update_request.conn_params;
|
||||
|
||||
LOG_LV2("GAP", "Conn Param Update Request: (min, max, latency, sup) = (%.2f, %.2f, %d, %d)",
|
||||
request_param->min_conn_interval*1.25f, request_param->max_conn_interval*1.25f, request_param->slave_latency, request_param->conn_sup_timeout*10);
|
||||
|
||||
// Central could perform checks to accept or reject request
|
||||
// For now just accept parameter from prph
|
||||
ble_gap_conn_params_t conn_param = *request_param;
|
||||
conn_param.max_conn_interval = conn_param.min_conn_interval;
|
||||
|
||||
sd_ble_gap_conn_param_update(conn_hdl, &conn_param);
|
||||
}
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@@ -61,26 +61,24 @@ class BLECentral
|
||||
/*------------------------------------------------------------------*/
|
||||
/* GAP
|
||||
*------------------------------------------------------------------*/
|
||||
bool setConnInterval(uint16_t min, uint16_t max);
|
||||
bool setConnIntervalMS (uint16_t min_ms, uint16_t max_ms);
|
||||
bool setConnInterval(uint16_t min, uint16_t max);
|
||||
bool setConnIntervalMS (uint16_t min_ms, uint16_t max_ms);
|
||||
|
||||
bool connect(const ble_gap_evt_adv_report_t* adv_report);
|
||||
bool connect(const ble_gap_addr_t *peer_addr);
|
||||
bool disconnect(uint16_t conn_handle);
|
||||
bool connect(const ble_gap_evt_adv_report_t* adv_report);
|
||||
bool connect(const ble_gap_addr_t *peer_addr);
|
||||
bool disconnect(uint16_t conn_handle);
|
||||
|
||||
bool connected (uint16_t conn_handle); // If connected to a specific peripheral
|
||||
bool connected (void); // If connected to any peripherals
|
||||
bool connected (uint16_t conn_handle); // If connected to a specific peripheral
|
||||
bool connected (void); // If connected to any peripherals
|
||||
|
||||
void clearBonds (void);
|
||||
void clearBonds (void);
|
||||
|
||||
/*------------- Callbacks -------------*/
|
||||
void setConnectCallback ( BLEGap::connect_callback_t fp);
|
||||
void setDisconnectCallback( BLEGap::disconnect_callback_t fp);
|
||||
|
||||
private:
|
||||
// Peripheral Preferred Connection Parameters (PPCP)
|
||||
uint16_t _ppcp_min_conn;
|
||||
uint16_t _ppcp_max_conn;
|
||||
ble_gap_conn_params_t _conn_param;
|
||||
|
||||
BLEGap::connect_callback_t _connect_cb;
|
||||
BLEGap::disconnect_callback_t _disconnect_cb;
|
||||
|
||||
@@ -539,7 +539,7 @@ bool BLECharacteristic::notify(const void* data, uint16_t len)
|
||||
while ( remaining )
|
||||
{
|
||||
// TODO multiple connection support
|
||||
// With no free buffers, give the app a channce to retry gracefully
|
||||
// Failed if there is no free buffer
|
||||
if ( !Bluefruit.Gap.getHvnPacket( Bluefruit.connHandle() ) ) return false;
|
||||
|
||||
uint16_t packet_len = min16(max_payload, remaining);
|
||||
|
||||
@@ -263,6 +263,8 @@ void BLEGap::_eventHandler(ble_evt_t* evt)
|
||||
// Init transmission buffer for notification
|
||||
peer->hvn_tx_sem = xSemaphoreCreateCounting(getHvnQueueSize(conn_hdl), getHvnQueueSize(conn_hdl));
|
||||
peer->wrcmd_tx_sem = xSemaphoreCreateCounting(getWriteCmdQueueSize(conn_hdl), getWriteCmdQueueSize(conn_hdl));
|
||||
|
||||
LOG_LV2("GAP", "Conn Interval= %f", para->conn_params.min_conn_interval*1.25f);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -281,6 +283,13 @@ void BLEGap::_eventHandler(ble_evt_t* evt)
|
||||
}
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVT_CONN_PARAM_UPDATE:
|
||||
{
|
||||
ble_gap_conn_params_t* param = &evt->evt.gap_evt.params.conn_param_update.conn_params;
|
||||
LOG_LV2("GAP", "Conn Interval= %f", param->min_conn_interval*1.25f);
|
||||
}
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
|
||||
{
|
||||
// Pairing in progress, Peer asking for our info
|
||||
|
||||
@@ -133,9 +133,11 @@ AdafruitBluefruit::AdafruitBluefruit(void)
|
||||
|
||||
_conn_hdl = BLE_CONN_HANDLE_INVALID;
|
||||
|
||||
_ppcp_min_conn = BLE_GAP_CONN_MIN_INTERVAL_DFLT;
|
||||
_ppcp_max_conn = BLE_GAP_CONN_MAX_INTERVAL_DFLT;
|
||||
_ppcp_conn_sup_timeout = BLE_GAP_CONN_SUPERVISION_TIMEOUT_MS / 10; // in 10ms unit
|
||||
_ppcp.min_conn_interval = BLE_GAP_CONN_MIN_INTERVAL_DFLT;
|
||||
_ppcp.max_conn_interval = BLE_GAP_CONN_MAX_INTERVAL_DFLT;
|
||||
_ppcp.slave_latency = 0;
|
||||
_ppcp.conn_sup_timeout = BLE_GAP_CONN_SUPERVISION_TIMEOUT_MS / 10; // in 10ms unit
|
||||
|
||||
_conn_interval = 0;
|
||||
|
||||
_connect_cb = NULL;
|
||||
@@ -417,15 +419,7 @@ err_t AdafruitBluefruit::begin(uint8_t prph_count, uint8_t central_count)
|
||||
/*------------- Configure GAP -------------*/
|
||||
|
||||
// Peripheral Preferred Connection Parameters
|
||||
ble_gap_conn_params_t gap_conn_params =
|
||||
{
|
||||
.min_conn_interval = _ppcp_min_conn, // in 1.25ms unit
|
||||
.max_conn_interval = _ppcp_max_conn, // in 1.25ms unit
|
||||
.slave_latency = BLE_GAP_CONN_SLAVE_LATENCY,
|
||||
.conn_sup_timeout = _ppcp_conn_sup_timeout, // in 10ms unit
|
||||
};
|
||||
|
||||
VERIFY_STATUS( sd_ble_gap_ppcp_set(&gap_conn_params) );
|
||||
VERIFY_STATUS( sd_ble_gap_ppcp_set(&_ppcp) );
|
||||
|
||||
// Default device name
|
||||
ble_gap_conn_sec_mode_t sec_mode = BLE_SECMODE_OPEN;
|
||||
@@ -566,18 +560,10 @@ bool AdafruitBluefruit::disconnect(void)
|
||||
|
||||
bool AdafruitBluefruit::setConnInterval(uint16_t min, uint16_t max)
|
||||
{
|
||||
_ppcp_min_conn = min;
|
||||
_ppcp_max_conn = max;
|
||||
_ppcp.min_conn_interval = min;
|
||||
_ppcp.max_conn_interval = max;
|
||||
|
||||
ble_gap_conn_params_t gap_conn_params =
|
||||
{
|
||||
.min_conn_interval = _ppcp_min_conn, // in 1.25ms unit
|
||||
.max_conn_interval = _ppcp_max_conn, // in 1.25ms unit
|
||||
.slave_latency = BLE_GAP_CONN_SLAVE_LATENCY,
|
||||
.conn_sup_timeout = _ppcp_conn_sup_timeout // in 10ms unit
|
||||
};
|
||||
|
||||
VERIFY_STATUS( sd_ble_gap_ppcp_set(&gap_conn_params), false);
|
||||
VERIFY_STATUS( sd_ble_gap_ppcp_set(&_ppcp), false);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -589,17 +575,9 @@ bool AdafruitBluefruit::setConnIntervalMS(uint16_t min_ms, uint16_t max_ms)
|
||||
|
||||
bool AdafruitBluefruit::setConnSupervisionTimeout(uint16_t timeout)
|
||||
{
|
||||
_ppcp_conn_sup_timeout = timeout;
|
||||
_ppcp.conn_sup_timeout = timeout;
|
||||
|
||||
ble_gap_conn_params_t gap_conn_params =
|
||||
{
|
||||
.min_conn_interval = _ppcp_min_conn, // in 1.25ms unit
|
||||
.max_conn_interval = _ppcp_max_conn, // in 1.25ms unit
|
||||
.slave_latency = BLE_GAP_CONN_SLAVE_LATENCY,
|
||||
.conn_sup_timeout = _ppcp_conn_sup_timeout // in 10ms unit
|
||||
};
|
||||
|
||||
VERIFY_STATUS( sd_ble_gap_ppcp_set(&gap_conn_params), false);
|
||||
VERIFY_STATUS( sd_ble_gap_ppcp_set(&_ppcp), false);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -804,11 +782,9 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
|
||||
_conn_hdl = evt->evt.gap_evt.conn_handle;
|
||||
_conn_interval = para->conn_params.min_conn_interval;
|
||||
|
||||
LOG_LV2("GAP", "Conn Interval= %f", _conn_interval*1.25f);
|
||||
|
||||
// Connection interval set by Central is out of preferred range
|
||||
// Try to negotiate with Central using our preferred values
|
||||
if ( !is_within(_ppcp_min_conn, para->conn_params.min_conn_interval, _ppcp_max_conn) )
|
||||
if ( !is_within(_ppcp.min_conn_interval, para->conn_params.min_conn_interval, _ppcp.max_conn_interval) )
|
||||
{
|
||||
// Null, value is set by sd_ble_gap_ppcp_set will be used
|
||||
VERIFY_STATUS( sd_ble_gap_conn_param_update(_conn_hdl, NULL), );
|
||||
@@ -825,8 +801,6 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
|
||||
// min conn = max conn = actual used interval
|
||||
ble_gap_conn_params_t* param = &evt->evt.gap_evt.params.conn_param_update.conn_params;
|
||||
_conn_interval = param->min_conn_interval;
|
||||
|
||||
LOG_LV2("GAP", "Conn Interval= %f", _conn_interval*1.25f);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1015,12 +989,12 @@ void AdafruitBluefruit::printInfo(void)
|
||||
|
||||
// Connection Intervals
|
||||
Serial.printf(title_fmt, "Conn Intervals");
|
||||
Serial.printf("min = %.2f ms, ", _ppcp_min_conn*1.25f);
|
||||
Serial.printf("max = %.2f ms", _ppcp_max_conn*1.25f);
|
||||
Serial.printf("min = %.2f ms, ", _ppcp.min_conn_interval*1.25f);
|
||||
Serial.printf("max = %.2f ms", _ppcp.max_conn_interval*1.25f);
|
||||
Serial.println();
|
||||
|
||||
Serial.printf(title_fmt, "Conn Timeout");
|
||||
Serial.printf("%.2f ms", _ppcp_conn_sup_timeout*10.0f);
|
||||
Serial.printf("%.2f ms", _ppcp.conn_sup_timeout*10.0f);
|
||||
Serial.println();
|
||||
|
||||
/*------------- List the paried device -------------*/
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
#include "clients/BLEClientDis.h"
|
||||
#include "clients/BLEClientCts.h"
|
||||
#include "clients/BLEClientHidAdafruit.h"
|
||||
#include "clients/BLEClientBas.h"
|
||||
|
||||
#include "utility/AdaCallback.h"
|
||||
#include "utility/bonding.h"
|
||||
@@ -203,9 +204,7 @@ class AdafruitBluefruit
|
||||
uint8_t _central_count;
|
||||
|
||||
// Peripheral Preferred Connection Parameters (PPCP)
|
||||
uint16_t _ppcp_min_conn;
|
||||
uint16_t _ppcp_max_conn;
|
||||
uint16_t _ppcp_conn_sup_timeout;
|
||||
ble_gap_conn_params_t _ppcp;
|
||||
|
||||
// Actual connection interval in use
|
||||
uint16_t _conn_interval;
|
||||
|
||||
@@ -78,7 +78,7 @@ BLEAncs::BLEAncs(void)
|
||||
_notification(BLEANCS_UUID_CHR_NOTIFICATION), _data(BLEANCS_UUID_CHR_DATA),
|
||||
_adamsg()
|
||||
{
|
||||
_notif_cb = NULL;
|
||||
_notif_cb = NULL;
|
||||
}
|
||||
|
||||
bool BLEAncs::begin(void)
|
||||
@@ -116,11 +116,6 @@ bool BLEAncs::discover(uint16_t conn_handle)
|
||||
return true;
|
||||
}
|
||||
|
||||
void BLEAncs::disconnect(void)
|
||||
{
|
||||
BLEClientService::disconnect();
|
||||
}
|
||||
|
||||
void BLEAncs::setNotificationCallback(notification_callback_t fp)
|
||||
{
|
||||
_notif_cb = fp;
|
||||
|
||||
@@ -162,9 +162,6 @@ class BLEAncs : public BLEClientService
|
||||
bool actPositive (uint32_t uid);
|
||||
bool actNegative (uint32_t uid);
|
||||
|
||||
protected:
|
||||
virtual void disconnect(void);
|
||||
|
||||
private:
|
||||
BLEClientCharacteristic _control;
|
||||
BLEClientCharacteristic _notification;
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@file BLEClientBas.cpp
|
||||
@author hathach (tinyusb.org)
|
||||
|
||||
@section LICENSE
|
||||
|
||||
Software License Agreement (BSD License)
|
||||
|
||||
Copyright (c) 2019, Adafruit Industries (adafruit.com)
|
||||
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 holders 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 ''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 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 "bluefruit.h"
|
||||
|
||||
BLEClientBas::BLEClientBas(void)
|
||||
: BLEClientService(UUID16_SVC_BATTERY), _battery(UUID16_CHR_BATTERY_LEVEL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool BLEClientBas::begin(void)
|
||||
{
|
||||
// Invoke base class begin()
|
||||
BLEClientService::begin();
|
||||
|
||||
_battery.begin(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BLEClientBas::discover(uint16_t conn_handle)
|
||||
{
|
||||
// Call BLECentralService discover
|
||||
VERIFY( BLEClientService::discover(conn_handle) );
|
||||
_conn_hdl = BLE_CONN_HANDLE_INVALID; // make as invalid until we found all chars
|
||||
|
||||
// Discover TXD, RXD characteristics
|
||||
VERIFY( 1 == Bluefruit.Discovery.discoverCharacteristic(conn_handle, _battery) );
|
||||
|
||||
_conn_hdl = conn_handle;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint8_t BLEClientBas::read(void)
|
||||
{
|
||||
return _battery.read8();
|
||||
}
|
||||
|
||||
bool BLEClientBas::enableNotify(void)
|
||||
{
|
||||
return _battery.enableNotify();
|
||||
}
|
||||
|
||||
bool BLEClientBas::disableNotify(void)
|
||||
{
|
||||
return _battery.disableNotify();
|
||||
}
|
||||
|
||||
void BLEClientBas::setNotifyCallback(BLEClientCharacteristic::notify_cb_t fp, bool useAdaCallback)
|
||||
{
|
||||
return _battery.setNotifyCallback(fp, useAdaCallback);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@file BLEClientBas.h
|
||||
@author hathach (tinyusb.org)
|
||||
|
||||
@section LICENSE
|
||||
|
||||
Software License Agreement (BSD License)
|
||||
|
||||
Copyright (c) 2019, Adafruit Industries (adafruit.com)
|
||||
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 holders 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 ''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 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.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef BLECLIENTBAS_H_
|
||||
#define BLECLIENTBAS_H_
|
||||
|
||||
#include "bluefruit_common.h"
|
||||
#include "BLEClientCharacteristic.h"
|
||||
#include "BLEClientService.h"
|
||||
|
||||
class BLEClientBas : public BLEClientService
|
||||
{
|
||||
public:
|
||||
BLEClientBas(void);
|
||||
|
||||
virtual bool begin(void);
|
||||
virtual bool discover(uint16_t conn_handle);
|
||||
|
||||
uint8_t read(void);
|
||||
|
||||
bool enableNotify(void);
|
||||
bool disableNotify(void);
|
||||
|
||||
void setNotifyCallback(BLEClientCharacteristic::notify_cb_t fp, bool useAdaCallback = true);
|
||||
|
||||
private:
|
||||
BLEClientCharacteristic _battery;
|
||||
};
|
||||
|
||||
#endif /* BLECLIENTBAS_H_ */
|
||||
@@ -33,6 +33,7 @@
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef BLECLIENTDIS_H_
|
||||
#define BLECLIENTDIS_H_
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name=Adafruit File System Libraries
|
||||
version=0.9.2
|
||||
version=0.9.3
|
||||
author=Adafruit
|
||||
maintainer=Adafruit <info@adafruit.com>
|
||||
sentence=Arduino library for nRF52-based Adafruit Bluefruit LE modules
|
||||
|
||||
@@ -58,6 +58,7 @@ class FatFS: public BluefruitFS::FileSystemClass
|
||||
bool rmdir_r (char const *filepath);
|
||||
bool format (bool eraseall);
|
||||
|
||||
// Internal API: shouldn't be used by Arduino sketch
|
||||
virtual size_t _f_write (void* fhdl, uint8_t const *buf, size_t size);
|
||||
virtual int _f_read (void* fhdl, void *buf, uint16_t nbyte);
|
||||
virtual void _f_flush (void* fhdl);
|
||||
|
||||
@@ -58,6 +58,7 @@ class LittleFS: public BluefruitFS::FileSystemClass
|
||||
bool rmdir_r (char const *filepath);
|
||||
bool format (bool eraseall);
|
||||
|
||||
// Internal API: shouldn't be used by Arduino sketch
|
||||
virtual size_t _f_write (void* fhdl, uint8_t const *buf, size_t size);
|
||||
virtual int _f_read (void* fhdl, void *buf, uint16_t nbyte);
|
||||
virtual void _f_flush (void* fhdl);
|
||||
|
||||
+2
-11
@@ -17,7 +17,7 @@
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
name=Adafruit nRF52 Boards
|
||||
version=0.9.2
|
||||
version=0.9.3
|
||||
|
||||
# Compile variables
|
||||
# -----------------
|
||||
@@ -124,7 +124,6 @@ recipe.output.save_file={build.project_name}.{build.variant}.hex
|
||||
# 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
|
||||
@@ -133,20 +132,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
|
||||
|
||||
#***************************************************
|
||||
# Jlink for programming
|
||||
#***************************************************
|
||||
|
||||
#tools.nrfutil.upload.pattern=nrfjprog --reset --program "{build.path}/{build.project_name}.hex" --sectorerase -f nrf52
|
||||
# && nrfjprog --erasepage {upload.BOOT_SETTING_ADDR} -f nrf52 && nrfjprog --memwr {upload.BOOT_SETTING_ADDR} --val 0x00000001 -f nrf52 && nrfjprog --reset -f nrf52
|
||||
# tools.nrfutil.upload.BOOT_SETTING_ADDR=0xFF000
|
||||
|
||||
#***************************************************
|
||||
# Burning bootloader with either jlink or nrfutil
|
||||
#***************************************************
|
||||
tools.bootburn.bootloader.params.verbose=
|
||||
tools.bootburn.bootloader.params.quiet=
|
||||
tools.bootburn.bootloader.pattern={program.pattern}
|
||||
tools.bootburn.bootloader.pattern={program.burn_pattern}
|
||||
|
||||
# erase flash page while programming
|
||||
tools.bootburn.erase.params.verbose=
|
||||
|
||||
+21
-6
@@ -1,17 +1,25 @@
|
||||
#**********************************************
|
||||
# Jlink with nrfjprog to burn bootloader
|
||||
# Jlink with nrfjprog
|
||||
#**********************************************
|
||||
nrfjprog.name=J-Link for Bluefruit nRF52
|
||||
nrfjprog.program.tool=bootburn
|
||||
#nrfjprog.program.path={runtime.tools.nrfjprog.path}/
|
||||
nrfjprog.program.path=
|
||||
nrfjprog.program.cmd=nrfjprog
|
||||
nrfjprog.program.cmd.windows=nrfjprog.exe
|
||||
|
||||
nrfjprog.program.pattern="{program.path}{program.cmd}" --program "{runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.2.6_{build.sd_name}_{build.sd_version}.hex" -f nrf52 --chiperase --reset
|
||||
# Burn bootloader pattern
|
||||
nrfjprog.program.bootfile={runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.2.6_{build.sd_name}_{build.sd_version}.hex
|
||||
nrfjprog.program.burn_pattern="{program.cmd}" --program "{program.bootfile}" -f nrf52 --chiperase --reset
|
||||
|
||||
# Jlink to upload sketch
|
||||
nrfjprog.program.params.quiet=
|
||||
nrfjprog.program.params.verbose=
|
||||
nrfjprog.program.pattern="{program.cmd}" --reset --program "{build.path}/{build.project_name}.hex" --sectorerase -f nrf52
|
||||
|
||||
# && nrfjprog --erasepage {upload.BOOT_SETTING_ADDR} -f nrf52 && nrfjprog --memwr {upload.BOOT_SETTING_ADDR} --val 0x00000001 -f nrf52 && nrfjprog --reset -f nrf52
|
||||
# tools.nrfutil.upload.BOOT_SETTING_ADDR=0xFF000
|
||||
|
||||
#**********************************************
|
||||
# adafruit-nrfutil to upgrade bootloader
|
||||
# adafruit-nrfutil
|
||||
#**********************************************
|
||||
nrfutil_boot.name=Bootloader DFU for Bluefruit nRF52
|
||||
nrfutil_boot.program.tool=bootburn
|
||||
@@ -19,4 +27,11 @@ nrfutil_boot.program.cmd=adafruit-nrfutil
|
||||
nrfutil_boot.program.cmd.windows={runtime.platform.path}/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe
|
||||
nrfutil_boot.program.cmd.macosx={runtime.platform.path}/tools/adafruit-nrfutil/macos/adafruit-nrfutil
|
||||
|
||||
nrfutil_boot.program.pattern={program.cmd} --verbose dfu serial -pkg "{runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.2.6_{build.sd_name}_{build.sd_version}.zip" -p {serial.port} -b 115200 --touch 1200
|
||||
# Burn bootloader pattern
|
||||
nrfutil_boot.program.bootfile={runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.2.6_{build.sd_name}_{build.sd_version}.zip
|
||||
nrfutil_boot.program.burn_pattern={program.cmd} --verbose dfu serial -pkg "{program.bootfile}" -p {serial.port} -b 115200 --touch 1200
|
||||
|
||||
# Remind user to select Jlink when used to upload sketch
|
||||
nrfutil_boot.program.params.quiet=
|
||||
nrfutil_boot.program.params.verbose=
|
||||
nrfutil_boot.program.pattern=echo Please select <J-Link for Bluefruit nRF52> as programmer
|
||||
Reference in new issue
Block a user