Skip to content

Commit d1564be

Browse files
committed
clean up blehid example
1 parent 801bf13 commit d1564be

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

libraries/Bluefruit52Lib/examples/Peripheral/blehid_camerashutter/blehid_camerashutter.ino

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,23 @@ BLEHidAdafruit blehid;
2929
uint8_t pinShutter = A0;
3030
#endif
3131

32+
// Circuit Play Bluefruit has button active state = high
33+
#ifdef ARDUINO_NRF52840_CIRCUITPLAY
34+
#define BTN_ACTIVE HIGH
35+
#else
36+
#define BTN_ACTIVE LOW
37+
#endif
38+
3239
void setup()
3340
{
3441
pinMode(pinShutter, INPUT_PULLUP);
3542

3643
Serial.begin(115200);
44+
45+
#if CFG_DEBUG
46+
// Blocking wait for connection when debug mode is enabled via IDE
3747
while ( !Serial ) delay(10); // for nrf52840 with native usb
48+
#endif
3849

3950
Serial.println("Bluefruit52 HID Camera Shutter Example");
4051
Serial.println("--------------------------------------\n");
@@ -106,7 +117,7 @@ void startAdv(void)
106117
void loop()
107118
{
108119
// Skip if shutter pin is not Ground
109-
if ( digitalRead(pinShutter) == 1 ) return;
120+
if ( digitalRead(pinShutter) != BTN_ACTIVE ) return;
110121

111122
// Make sure we are connected and bonded/paired
112123
for (uint16_t conn_hdl=0; conn_hdl < BLE_MAX_CONNECTION; conn_hdl++)

0 commit comments

Comments
 (0)