Skip to content

Commit 68f5574

Browse files
jacobrosenthalsandeepmistry
authored andcommitted
clarify BLEPeripheral constructor pin required, but hardcoded/ignored… (sandeepmistry#130)
* clarify BLEPeripheral constructor pin required, but hardcoded/ignored for some boards * remove REQ, RDY, and RST pins from examples * API.md * constructor text
1 parent abdd0cd commit 68f5574

File tree

21 files changed

+45
-136
lines changed

21 files changed

+45
-136
lines changed

API.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# BLEPeripheral
22

33
## Constructor
4+
Creates the BLEPeripheral object. Pin Arguments are optional as pins are self detecting. See https://github.com/sandeepmistry/arduino-BLEPeripheral#pinouts
5+
46
```c
5-
BLEPeripheral(unsigned char req, unsigned char rdy, unsigned char rst);
6-
```
7+
BLEPeripheral(unsigned char req = BLE_DEFAULT_REQ, unsigned char rdy = BLE_DEFAULT_RDY, unsigned char rst = BLE_DEFAULT_RST);
78
* req - REQ pin
89
* rdy - RDY pin
910
* rst - RST pin, can be ```UNUSED```

examples/Eddystone/EddystoneUID/EddystoneUID.ino

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,8 @@
55
#include <SPI.h>
66
#include <EddystoneBeacon.h>
77

8-
// define pins (varies per shield/board)
9-
//
10-
// Adafruit Bluefruit LE 10, 2, 9
11-
// Blend 9, 8, UNUSED
12-
// Blend Micro 6, 7, 4
13-
// RBL BLE Shield 9, 8, UNUSED
14-
15-
#define EDDYSTONE_BEACON_REQ 6
16-
#define EDDYSTONE_BEACON_RDY 7
17-
#define EDDYSTONE_BEACON_RST 4
18-
19-
EddystoneBeacon eddystoneBeacon = EddystoneBeacon(EDDYSTONE_BEACON_REQ, EDDYSTONE_BEACON_RDY, EDDYSTONE_BEACON_RST);
8+
//custom boards may override default pin definitions with EddystoneBeacon(PIN_REQ, PIN_RDY, PIN_RST)
9+
EddystoneBeacon eddystoneBeacon = EddystoneBeacon();
2010
BLEUuid uid = BLEUuid("01020304050607080910-AABBCCDDEEFF"); // <namespace id>-<instance id>
2111

2212
void setup() {

examples/Eddystone/EddystoneURL/EddystoneURL.ino

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,8 @@
55
#include <SPI.h>
66
#include <EddystoneBeacon.h>
77

8-
// define pins (varies per shield/board)
9-
//
10-
// Adafruit Bluefruit LE 10, 2, 9
11-
// Blend 9, 8, UNUSED
12-
// Blend Micro 6, 7, 4
13-
// RBL BLE Shield 9, 8, UNUSED
14-
15-
#define EDDYSTONE_BEACON_REQ 6
16-
#define EDDYSTONE_BEACON_RDY 7
17-
#define EDDYSTONE_BEACON_RST 4
18-
19-
EddystoneBeacon eddystoneBeacon = EddystoneBeacon(EDDYSTONE_BEACON_REQ, EDDYSTONE_BEACON_RDY, EDDYSTONE_BEACON_RST);
8+
//custom boards may override default pin definitions with EddystoneBeacon(PIN_REQ, PIN_RDY, PIN_RST)
9+
EddystoneBeacon eddystoneBeacon = EddystoneBeacon();
2010

2111
void setup() {
2212
Serial.begin(9600);

examples/HID/HID_joystick_mouse/HID_joystick_mouse.ino

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,8 @@
1111
#define JOYSTICK_Y_AXIS_PIN A1
1212
#define JOYSTICK_RANGE 24
1313

14-
// define pins (varies per shield/board)
15-
#define BLE_REQ 9
16-
#define BLE_RDY 8
17-
#define BLE_RST 4
18-
19-
// create peripheral instance, see pinouts above
20-
BLEHIDPeripheral bleHIDPeripheral = BLEHIDPeripheral(BLE_REQ, BLE_RDY, BLE_RST);
14+
//custom boards may override default pin definitions with BLEHIDPeripheral(PIN_REQ, PIN_RDY, PIN_RST)
15+
BLEHIDPeripheral bleHIDPeripheral = BLEHIDPeripheral();
2116
BLEMouse bleMouse;
2217

2318
int buttonState;

examples/HID/HID_keyboard/HID_keyboard.ino

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@
66
#include <BLEHIDPeripheral.h>
77
#include <BLEKeyboard.h>
88

9-
// define pins (varies per shield/board)
10-
#define BLE_REQ 6
11-
#define BLE_RDY 7
12-
#define BLE_RST 4
13-
149
//#define ANDROID_CENTRAL
1510

16-
// create peripheral instance, see pinouts above
17-
BLEHIDPeripheral bleHIDPeripheral = BLEHIDPeripheral(BLE_REQ, BLE_RDY, BLE_RST);
11+
//custom boards may override default pin definitions with BLEHIDPeripheral(PIN_REQ, PIN_RDY, PIN_RST)
12+
BLEHIDPeripheral bleHIDPeripheral = BLEHIDPeripheral();
1813
BLEKeyboard bleKeyboard;
1914

2015
void setup() {

examples/HID/HID_keypad/HID_keypad.ino

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,8 @@ byte colPins[COLS] = { 7, 6, 5 }; //connect to the column pinouts of the keypad
2222

2323
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
2424

25-
// define pins (varies per shield/board)
26-
#define BLE_REQ 9
27-
#define BLE_RDY 8
28-
#define BLE_RST 4
29-
30-
// create peripheral instance, see pinouts above
31-
BLEHIDPeripheral bleHIDPeripheral = BLEHIDPeripheral(BLE_REQ, BLE_RDY, BLE_RST);
25+
//custom boards may override default pin definitions with BLEHIDPeripheral(PIN_REQ, PIN_RDY, PIN_RST)
26+
BLEHIDPeripheral bleHIDPeripheral = BLEHIDPeripheral();
3227
BLEKeyboard bleKeyboard;
3328

3429
void setup() {

examples/HID/HID_test/HID_test.ino

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@
99
#include <BLEMultimedia.h>
1010
#include <BLESystemControl.h>
1111

12-
// define pins (varies per shield/board)
13-
#define BLE_REQ 6
14-
#define BLE_RDY 7
15-
#define BLE_RST 4
16-
17-
BLEHIDPeripheral bleHID = BLEHIDPeripheral(BLE_REQ, BLE_RDY, BLE_RST);
12+
//custom boards may override default pin definitions with BLEHIDPeripheral(PIN_REQ, PIN_RDY, PIN_RST)
13+
BLEHIDPeripheral bleHID = BLEHIDPeripheral();
1814
BLEMouse bleMouse;
1915
BLEKeyboard bleKeyboard;
2016
BLEMultimedia bleMultimedia;

examples/HID/HID_volume/HID_volume.ino

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99
// http://www.pjrc.com/teensy/td_libs_Encoder.html
1010
#include <Encoder.h>
1111

12-
// define pins (varies per shield/board)
13-
#define BLE_REQ 10
14-
#define BLE_RDY 2
15-
#define BLE_RST 9
16-
1712
#define BUTTON_PIN 5
1813

1914
#define ENC_RIGHT_PIN 3
@@ -23,7 +18,8 @@
2318

2419
//#define ANDROID_CENTRAL
2520

26-
BLEHIDPeripheral bleHIDPeripheral = BLEHIDPeripheral(BLE_REQ, BLE_RDY, BLE_RST);
21+
//custom boards may override default pin definitions with BLEHIDPeripheral(PIN_REQ, PIN_RDY, PIN_RST)
22+
BLEHIDPeripheral bleHIDPeripheral = BLEHIDPeripheral();
2723
BLEMultimedia bleMultimedia;
2824

2925
Encoder encoder(ENC_RIGHT_PIN, ENC_LEFT_PIN);

examples/ancs/ancs.ino

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,8 @@
77

88
#include <BLEUtil.h>
99

10-
// define pins (varies per shield/board)
11-
#define BLE_REQ 6
12-
#define BLE_RDY 7
13-
#define BLE_RST 4
14-
15-
// create peripheral instance, see pinouts above
16-
BLEPeripheral blePeripheral = BLEPeripheral(BLE_REQ, BLE_RDY, BLE_RST);
10+
//custom boards may override default pin definitions with BLEPeripheral(PIN_REQ, PIN_RDY, PIN_RST)
11+
BLEPeripheral blePeripheral = BLEPeripheral();
1712
BLEBondStore bleBondStore;
1813

1914
// remote services

examples/ir_bridge/ir_bridge.ino

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
// https://github.com/shirriff/Arduino-IRremote
99
#include <IRremote.h>
1010

11-
// define pins (varies per shield/board)
12-
#define BLE_REQ 10
13-
#define BLE_RDY 2
14-
#define BLE_RST 9
15-
1611
#define IR_SEND_PIN 3
1712
#define IR_RECV_PIN 4
1813

@@ -30,8 +25,8 @@ IRsend irSend = IRsend(/*IR_SEND_
3025
IRrecv irRecv = IRrecv(IR_RECV_PIN);
3126
IRValue irValue;
3227

33-
// create peripheral instance, see pinouts above
34-
BLEPeripheral blePeripheral = BLEPeripheral(BLE_REQ, BLE_RDY, BLE_RST);
28+
//custom boards may override default pin definitions with BLEPeripheral(PIN_REQ, PIN_RDY, PIN_RST)
29+
BLEPeripheral blePeripheral = BLEPeripheral();
3530

3631
// create service and characteristics
3732
BLEService irService = BLEService("00004952-0000-bbbb-0123-456789abcdef");

0 commit comments

Comments
 (0)