Minor cleanup

This commit is contained in:
microbuilder committed 2017-04-19 20:15:51 +02:00
1 parent 89a0956ab4
commit dcc5282dc4
1 file changed
+13 -13
@@ -15,7 +15,7 @@
/*
* 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 Camera App
* to capture a photo when you are in the camera app
*/
#include <bluefruit.h>
@@ -24,10 +24,10 @@ BLEHidAdafruit blehid;
#define PIN_SHUTTER 27
void setup()
void setup()
{
pinMode(PIN_SHUTTER, INPUT_PULLUP);
Serial.begin(115200);
Serial.println("Bluefruit52 HID Camera Shutter Example");
@@ -44,7 +44,7 @@ void setup()
Bluefruit.begin();
Bluefruit.setName("Bluefruit52");
// Configure and Start Device Information Service
// Configure and start DIS (Device Information Service)
bledis.setManufacturer("Adafruit Industries");
bledis.setModel("Bluefruit Feather 52");
bledis.begin();
@@ -52,16 +52,16 @@ void setup()
/* Start BLE HID
* Note: Apple requires BLE devices to have a min connection interval >= 20m
* (The smaller the connection interval the faster we can send data).
* However for HID and MIDI device, Apple will accept a min connection interval
* as low as 11.25 ms. Therefore BLEHidAdafruit::begin() will try to set
* the min and max connection interval to 11.25 ms and 15 ms respectively
* However, for HID and MIDI device Apple will accept a min connection
* interval as low as 11.25 ms. Therefore BLEHidAdafruit::begin() will try to
* set the min and max connection interval to 11.25 ms and 15 ms respectively
* for the best performance.
*/
blehid.begin();
/* Set connection interval (min, max) to your perferred value.
* Note: It is already set by BLEHidAdafruit::begin() to 11.25ms - 15ms
* min = 9*1.25=11.25 ms, max = 12*1.25= 15 ms
* min = 9*1.25=11.25 ms, max = 12*1.25= 15 ms
*/
/* Bluefruit.setConnInterval(9, 12); */
@@ -73,12 +73,12 @@ void setup()
}
void setupAdv(void)
{
{
Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
Bluefruit.Advertising.addTxPower();
Bluefruit.Advertising.addAppearance(BLE_APPEARANCE_HID_KEYBOARD);
// Include BLE HID service
Bluefruit.Advertising.addService(blehid);
@@ -86,7 +86,7 @@ void setupAdv(void)
Bluefruit.Advertising.addName();
}
void loop()
void loop()
{
// Make sure you are connected and bonded/paired
if ( Bluefruit.connected() && Bluefruit.connPaired() )
@@ -96,14 +96,14 @@ void loop()
{
// Turn on red LED when we start sending data
digitalWrite(LED_RED, 1);
// Send the 'volume down' key press
// Check BLEHidGerneric.h for list of defined consumer usage codes
blehid.consumerKeyPress(HID_USAGE_CONSUMER_VOLUME_DECREMENT);
// Delay a bit between reports
delay(10);
// Send key release
blehid.consumerKeyRelease();