7 files changed
+47
-34
No files matched your search
+10
-2
@@ -1,11 +1,19 @@
|
||||
# Adafruit nRF52 Arduino Core Changelog
|
||||
|
||||
# 0.11.1
|
||||
# 0.11.1 - 2019.07.10
|
||||
|
||||
- Update tinyusb core to support USB MIDI
|
||||
- Refactor Ada Callback, use ISCR to detect isr context. Use function instead of macro
|
||||
- Implement #240 run travis test with all example sketches
|
||||
- Fix auto-start of advertising when central is connected, thanks to @ogatatsu PR #268
|
||||
- Fixed auto-start of advertising when central is connected, thanks to @ogatatsu PR #268
|
||||
- Added Tone()/noTone() functions
|
||||
- Travis-ci builds all sketches when commit code
|
||||
- Fixed setAppearance/getAppearance() typo, thanks to @paulmand3l PR #292
|
||||
- Fixed rssi_proximity_peripheral sketch, thanks to @dicobrazz PR #295
|
||||
- Fixed doc typo, thanks to @yvadher PR #296
|
||||
- Fixed HID usage code location comment in exmaple sketch, thanks to @stefandz PR #297
|
||||
- Fixed #277 conn LED doesn't stop when scanner is time out
|
||||
- Added connection handle to Bluefruit.connParied()
|
||||
|
||||
# 0.11.0
|
||||
|
||||
|
||||
@@ -94,8 +94,11 @@ void startAdv(void)
|
||||
|
||||
void loop()
|
||||
{
|
||||
// If service is not yet discovered
|
||||
if ( !bleCTime.discovered() && !Bluefruit.connPaired() ) return;
|
||||
// Skip if service is not yet discovered
|
||||
if ( !bleCTime.discovered() ) return;
|
||||
|
||||
// Skip if service connection is not paired/secured
|
||||
if ( !Bluefruit.connPaired( bleCTime.connHandle() ) ) return;
|
||||
|
||||
// Get Time from iOS once per second
|
||||
// Note it is not advised to update this quickly
|
||||
|
||||
@@ -103,8 +103,11 @@ void startAdv(void)
|
||||
|
||||
void loop()
|
||||
{
|
||||
// If service is not yet discovered
|
||||
if ( !bleCTime.discovered() && !Bluefruit.connPaired() ) return;
|
||||
// Skip if service is not yet discovered
|
||||
if ( !bleCTime.discovered() ) return;
|
||||
|
||||
// Skip if service connection is not paired/secured
|
||||
if ( !Bluefruit.connPaired( bleCTime.connHandle() ) ) return;
|
||||
|
||||
// Get Time from iOS once per second
|
||||
// Note it is not advised to update this quickly
|
||||
|
||||
+19
-13
@@ -15,14 +15,16 @@
|
||||
/*
|
||||
* This sketch uses the HID Consumer Key API to send the Volume Down
|
||||
* key when PIN_SHUTTER is grounded. This will cause your mobile device
|
||||
* to capture a photo when you are in the camera app
|
||||
* to capture a photo when you are in the camera app.
|
||||
*
|
||||
* For Feather nRF52840 PIN_SHUTTER is conveniently user switch.
|
||||
*/
|
||||
#include <bluefruit.h>
|
||||
|
||||
BLEDis bledis;
|
||||
BLEHidAdafruit blehid;
|
||||
|
||||
#define PIN_SHUTTER A0
|
||||
#define PIN_SHUTTER 7
|
||||
|
||||
void setup()
|
||||
{
|
||||
@@ -101,30 +103,34 @@ void startAdv(void)
|
||||
|
||||
void loop()
|
||||
{
|
||||
// Make sure you are connected and bonded/paired
|
||||
if ( Bluefruit.connected() && Bluefruit.connPaired() )
|
||||
// Skip if shutter pin is not Ground
|
||||
if ( digitalRead(PIN_SHUTTER) == 1 ) return;
|
||||
|
||||
// Make sure we are connected and bonded/paired
|
||||
for (uint16_t conn_hdl=0; conn_hdl < BLE_MAX_CONNECTION; conn_hdl++)
|
||||
{
|
||||
// Check if pin GND'ed
|
||||
if ( digitalRead(PIN_SHUTTER) == 0 )
|
||||
BLEConnection* connection = Bluefruit.Connection(conn_hdl);
|
||||
|
||||
if ( connection && connection->connected() && connection->paired() )
|
||||
{
|
||||
// Turn on red LED when we start sending data
|
||||
digitalWrite(LED_RED, 1);
|
||||
|
||||
// Send the 'volume down' key press
|
||||
// Check hid.h for a list of valid consumer usage codes
|
||||
blehid.consumerKeyPress(HID_USAGE_CONSUMER_VOLUME_DECREMENT);
|
||||
// Send the 'volume down' key press to the peer
|
||||
// Check tinyusb/src/class/hid/hid.h for a list of valid consumer usage codes
|
||||
blehid.consumerKeyPress(conn_hdl, HID_USAGE_CONSUMER_VOLUME_DECREMENT);
|
||||
|
||||
// Delay a bit between reports
|
||||
delay(10);
|
||||
|
||||
// Send key release
|
||||
blehid.consumerKeyRelease();
|
||||
blehid.consumerKeyRelease(conn_hdl);
|
||||
|
||||
// Turn off the red LED
|
||||
digitalWrite(LED_RED, 0);
|
||||
|
||||
// Delay to avoid constant capturing
|
||||
delay(500);
|
||||
}
|
||||
}
|
||||
|
||||
// Delay to avoid constant capturing
|
||||
delay(500);
|
||||
}
|
||||
@@ -138,8 +138,8 @@ bool BLEScanner::stop(void)
|
||||
{
|
||||
VERIFY_STATUS( sd_ble_gap_scan_stop(), false );
|
||||
|
||||
Bluefruit._stopConnLed(); // stop blinking
|
||||
_runnning = false;
|
||||
Bluefruit._stopConnLed(); // stop blinking
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -406,6 +406,7 @@ void BLEScanner::_eventHandler(ble_evt_t* evt)
|
||||
if (evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_SCAN)
|
||||
{
|
||||
_runnning = false;
|
||||
Bluefruit._stopConnLed();
|
||||
if (_stop_cb) ada_callback(NULL, 0, _stop_cb);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -635,9 +635,9 @@ uint16_t AdafruitBluefruit::connHandle(void)
|
||||
return _conn_hdl;
|
||||
}
|
||||
|
||||
bool AdafruitBluefruit::connPaired(void)
|
||||
bool AdafruitBluefruit::connPaired(uint16_t conn_hdl)
|
||||
{
|
||||
BLEConnection* conn = Bluefruit.Connection(_conn_hdl);
|
||||
BLEConnection* conn = Bluefruit.Connection(conn_hdl);
|
||||
return conn && conn->paired();
|
||||
}
|
||||
|
||||
@@ -826,16 +826,7 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
|
||||
LOG_LV2("GAP", "Disconnect Reason 0x%02X", evt->evt.gap_evt.params.disconnected.reason);
|
||||
|
||||
// Turn off Conn LED If not connected at all
|
||||
bool still_connected = false;
|
||||
for (uint8_t i=0; i<BLE_MAX_CONNECTION; i++)
|
||||
{
|
||||
if ( _connection[i] && _connection[i]->connected() )
|
||||
{
|
||||
still_connected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !still_connected ) _setConnLed(false);
|
||||
if ( !this->connected() ) _setConnLed(false);
|
||||
|
||||
// Invoke disconnect callback
|
||||
if ( conn->getRole() == BLE_GAP_ROLE_PERIPH )
|
||||
@@ -848,7 +839,6 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
|
||||
|
||||
delete _connection[conn_hdl];
|
||||
_connection[conn_hdl] = NULL;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -994,6 +984,8 @@ void AdafruitBluefruit::_startConnLed(void)
|
||||
void AdafruitBluefruit::_stopConnLed(void)
|
||||
{
|
||||
xTimerStop(_led_blink_th, 0);
|
||||
|
||||
_setConnLed( this->connected() );
|
||||
}
|
||||
|
||||
void AdafruitBluefruit::_setConnLed (bool on_off)
|
||||
|
||||
@@ -173,7 +173,7 @@ class AdafruitBluefruit
|
||||
bool connected (uint16_t conn_hdl);
|
||||
|
||||
uint16_t connHandle (void);
|
||||
bool connPaired (void);
|
||||
bool connPaired (uint16_t conn_hdl);
|
||||
|
||||
// Alias to BLEConnection API()
|
||||
bool disconnect (uint16_t conn_hdl);
|
||||
|
||||
Reference in new issue
Block a user