55 * need a unique ble local name (see below). If you are using another supported BLE board or shield,
66 * follow the instructions for the specific board or shield below.
77 *
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
99 * Boards Manager.
1010 *
1111 * Supported boards and shields:
1919// within the same physical space
2020#define FIRMATA_BLE_LOCAL_NAME "FIRMATA"
2121
22+ /*
23+ * Arduino 101
24+ *
25+ * Make sure you have the Intel Curie Boards package v2.0.2 or higher installed via the Arduino
26+ * Boards Manager.
27+ *
28+ * Test script: https://gist.github.com/soundanalogous/927360b797574ed50e27
29+ */
30+ #ifdef _VARIANT_ARDUINO_101_X_
31+ // After conversion to units of 1.25ms, both values must be between
32+ // 0x0006 (7.5ms) and 0x0c80 (4s)
33+ #define FIRMATA_BLE_MIN_INTERVAL 8 // ( 8 * 1000) / 1250 == 0x06 -> 7.5ms
34+ #define FIRMATA_BLE_MAX_INTERVAL 30 // (30 * 1000) / 1250 == 0x18 -> 30ms
35+ #endif
36+
37+
2238/*
2339 * RedBearLab BLE Shield
2440 *
3652//#define REDBEAR_BLE_SHIELD
3753
3854#ifdef REDBEAR_BLE_SHIELD
39- #include <SPI.h>
40- #include <BLEPeripheral.h>
41- #include "utility/BLEStream.h"
42-
4355#define BLE_REQ 9
4456#define BLE_RDY 8
4557#define BLE_RST 4 // 4 or 7 via jumper on shield
58+ #endif
4659
47- BLEStream stream (BLE_REQ , BLE_RDY , BLE_RST );
60+
61+ /*
62+ * Generic settings
63+ */
64+ #if !defined(FIRMATA_BLE_MIN_INTERVAL ) && !defined(FIRMATA_BLE_MAX_INTERVAL )
65+ // BLE connection interval - this is the fastest interval you can read inputs.
66+ // These values apply to all devices using the Arduino BLEPeripheral library
67+ // with a Nordic nRF8001 or nRF51822. Both values must be between
68+ // 0x0006 (7.5ms) and 0x0c80 (4s).
69+ #define FIRMATA_BLE_MIN_INTERVAL 0x0006 // 7.5ms (7.5 / 1.25)
70+ #define FIRMATA_BLE_MAX_INTERVAL 0x0018 // 30ms (30 / 1.25)
71+ #endif
72+
73+ #if !defined(FIRMATA_BLE_TXBUFFER_FLUSH_INTERVAL )
74+ // How often the BLE TX buffer is flushed (if not full)
75+ #define FIRMATA_BLE_TXBUFFER_FLUSH_INTERVAL 30 // 30ms
4876#endif
4977
5078
5179/*==================================================================================================
5280 * END BLE CONFIGURATION - you should not need to change anything below this line
5381 *================================================================================================*/
5482
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- */
6383#ifdef _VARIANT_ARDUINO_101_X_
64- #include <CurieBLE.h>
6584#include "utility/BLEStream.h"
6685BLEStream stream ;
6786#endif
6887
6988
89+ #ifdef REDBEAR_BLE_SHIELD
90+ #include <SPI.h>
91+ #include "utility/BLEStream.h"
92+ BLEStream stream (BLE_REQ , BLE_RDY , BLE_RST );
93+ #endif
94+
95+
7096/*
7197 * RedBearLab BLE Nano (with default switch settings)
7298 *
@@ -81,7 +107,6 @@ BLEStream stream;
81107 * the pins are currently mapped in Firmata only for the default (factory) jumper settings.
82108 */
83109// #ifdef BLE_NANO
84- // #include <BLEPeripheral.h>
85110// #include "utility/BLEStream.h"
86111// BLEStream stream;
87112// #endif
@@ -96,7 +121,6 @@ BLEStream stream;
96121 */
97122// #if defined(BLEND_MICRO) || defined(BLEND)
98123// #include <SPI.h>
99- // #include <BLEPeripheral.h>
100124// #include "utility/BLEStream.h"
101125
102126// #define BLE_REQ 6
0 commit comments