5
5
* need a unique ble local name (see below). If you are using another supported BLE board or shield,
6
6
* follow the instructions for the specific board or shield below.
7
7
*
8
- * Make sure you have the Intel Curie Boards package v1 .0.6 or higher installed via the Arduino
8
+ * Make sure you have the Intel Curie Boards package v2 .0.2 or higher installed via the Arduino
9
9
* Boards Manager.
10
10
*
11
11
* Supported boards and shields:
12
12
* - Arduino 101 (recommended)
13
13
* - RedBearLab BLE Shield (v2) ** to be verified **
14
14
* - RedBearLab BLE Nano ** works with modifications **
15
+ * - Adafruit Feather M0 Bluefruit LE
15
16
*
16
17
*================================================================================================*/
17
18
18
19
// change this to a unique name per board if running StandardFirmataBLE on multiple boards
19
20
// within the same physical space
20
21
#define FIRMATA_BLE_LOCAL_NAME "FIRMATA"
21
22
23
+ /*
24
+ * Arduino 101
25
+ *
26
+ * Make sure you have the Intel Curie Boards package v2.0.2 or higher installed via the Arduino
27
+ * Boards Manager.
28
+ *
29
+ * Test script: https://gist.github.com/soundanalogous/927360b797574ed50e27
30
+ */
31
+ #ifdef _VARIANT_ARDUINO_101_X_
32
+ // After conversion to units of 1.25ms, both values must be between
33
+ // 0x0006 (7.5ms) and 0x0c80 (4s)
34
+ #define FIRMATA_BLE_MIN_INTERVAL 8 // ( 8 * 1000) / 1250 == 0x06 -> 7.5ms
35
+ #define FIRMATA_BLE_MAX_INTERVAL 30 // (30 * 1000) / 1250 == 0x18 -> 30ms
36
+ #endif
37
+
38
+
22
39
/*
23
40
* RedBearLab BLE Shield
24
41
*
36
53
//#define REDBEAR_BLE_SHIELD
37
54
38
55
#ifdef REDBEAR_BLE_SHIELD
39
- #include <SPI.h>
40
- #include <BLEPeripheral.h>
41
- #include "utility/BLEStream.h"
42
-
43
56
#define BLE_REQ 9
44
57
#define BLE_RDY 8
45
58
#define BLE_RST 4 // 4 or 7 via jumper on shield
59
+ #endif
46
60
47
- BLEStream stream (BLE_REQ , BLE_RDY , BLE_RST );
61
+
62
+ /*
63
+ * Adafruit Feather M0 Bluefruit LE
64
+ *
65
+ * If you are using an Adafruit Feather M0 Bluefruit LE, uncomment the define below.
66
+ * This configuration should also work with other Bluefruit LE boards/modules that communicate
67
+ * with the nRF51822 via SPI (e.g. Bluefruit LE SPI Friend, Bluefruit LE Shield), although
68
+ * you may need to change the values of BLE_SPI_CS, BLE_SPI_IRQ, and/or BLE_SPI_RST below.
69
+ *
70
+ * You will need to install a lightly-modified version of the Adafruit BluefruitLE nRF51
71
+ * package, available at:
72
+ * https://github.com/cstawarz/Adafruit_BluefruitLE_nRF51/archive/firmata_fixes.zip
73
+ */
74
+ //#define BLUEFRUIT_LE_SPI
75
+
76
+ #ifdef BLUEFRUIT_LE_SPI
77
+ // Both values must be between 10ms and 4s
78
+ #define FIRMATA_BLE_MIN_INTERVAL 10 // 10ms
79
+ #define FIRMATA_BLE_MAX_INTERVAL 20 // 20ms
80
+
81
+ #define BLE_SPI_CS 8
82
+ #define BLE_SPI_IRQ 7
83
+ #define BLE_SPI_RST 4
84
+ #endif
85
+
86
+
87
+ /*
88
+ * Generic settings
89
+ */
90
+ #if !defined(FIRMATA_BLE_MIN_INTERVAL ) && !defined(FIRMATA_BLE_MAX_INTERVAL )
91
+ // These values apply to all devices using the Arduino BLEPeripheral library
92
+ // with a Nordic nRF8001 or nRF51822. Both values must be between
93
+ // 0x0006 (7.5ms) and 0x0c80 (4s).
94
+ #define FIRMATA_BLE_MIN_INTERVAL 0x0006 // 7.5ms (7.5 / 1.25)
95
+ #define FIRMATA_BLE_MAX_INTERVAL 0x0018 // 30ms (30 / 1.25)
96
+ #endif
97
+
98
+ #if !defined(FIRMATA_BLE_TXBUFFER_FLUSH_INTERVAL )
99
+ #define FIRMATA_BLE_TXBUFFER_FLUSH_INTERVAL 30 // 30ms
48
100
#endif
49
101
50
102
51
103
/*==================================================================================================
52
104
* END BLE CONFIGURATION - you should not need to change anything below this line
53
105
*================================================================================================*/
54
106
55
- /*
56
- * Arduino 101
57
- *
58
- * Make sure you have the Intel Curie Boards package v1.0.6 or higher installed via the Arduino
59
- * Boards Manager.
60
- *
61
- * Test script: https://gist.github.com/soundanalogous/927360b797574ed50e27
62
- */
63
107
#ifdef _VARIANT_ARDUINO_101_X_
64
- #include <CurieBLE.h>
65
108
#include "utility/BLEStream.h"
66
109
BLEStream stream ;
67
110
#endif
68
111
69
112
113
+ #ifdef REDBEAR_BLE_SHIELD
114
+ #include <SPI.h>
115
+ #include "utility/BLEStream.h"
116
+ BLEStream stream (BLE_REQ , BLE_RDY , BLE_RST );
117
+ #endif
118
+
119
+
120
+ #ifdef BLUEFRUIT_LE_SPI
121
+ #include "utility/BluefruitLE_SPI_Stream.h"
122
+ BluefruitLE_SPI_Stream stream (BLE_SPI_CS , BLE_SPI_IRQ , BLE_SPI_RST );
123
+ #endif
124
+
125
+
70
126
/*
71
127
* RedBearLab BLE Nano (with default switch settings)
72
128
*
@@ -81,7 +137,6 @@ BLEStream stream;
81
137
* the pins are currently mapped in Firmata only for the default (factory) jumper settings.
82
138
*/
83
139
// #ifdef BLE_NANO
84
- // #include <BLEPeripheral.h>
85
140
// #include "utility/BLEStream.h"
86
141
// BLEStream stream;
87
142
// #endif
@@ -96,7 +151,6 @@ BLEStream stream;
96
151
*/
97
152
// #if defined(BLEND_MICRO) || defined(BLEND)
98
153
// #include <SPI.h>
99
- // #include <BLEPeripheral.h>
100
154
// #include "utility/BLEStream.h"
101
155
102
156
// #define BLE_REQ 6
@@ -109,4 +163,6 @@ BLEStream stream;
109
163
110
164
#if defined(BLE_REQ ) && defined(BLE_RDY ) && defined(BLE_RST )
111
165
#define IS_IGNORE_BLE_PINS (p ) ((p) == BLE_REQ || (p) == BLE_RDY || (p) == BLE_RST)
166
+ #elif defined(BLE_SPI_CS ) && defined(BLE_SPI_IRQ ) && defined(BLE_SPI_RST )
167
+ #define IS_IGNORE_BLE_PINS (p ) ((p) == BLE_SPI_CS || (p) == BLE_SPI_IRQ || (p) == BLE_SPI_RST)
112
168
#endif
0 commit comments