1 | /*==================================================================================================
|
---|
2 | * BLE CONFIGURATION
|
---|
3 | *
|
---|
4 | * If you are using an Arduino 101, you do not need to make any changes to this file (unless you
|
---|
5 | * need a unique ble local name (see below). If you are using another supported BLE board or shield,
|
---|
6 | * follow the instructions for the specific board or shield below.
|
---|
7 | *
|
---|
8 | * Supported boards and shields:
|
---|
9 | * - Arduino 101 (recommended)
|
---|
10 | * - RedBearLab BLE Shield (v2) ** to be verified **
|
---|
11 | * - RedBearLab BLE Nano ** works with modifications **
|
---|
12 | *
|
---|
13 | *================================================================================================*/
|
---|
14 |
|
---|
15 | // change this to a unique name per board if running StandardFirmataBLE on multiple boards
|
---|
16 | // within the same physical space
|
---|
17 | #define FIRMATA_BLE_LOCAL_NAME "FIRMATA"
|
---|
18 |
|
---|
19 | /*
|
---|
20 | * RedBearLab BLE Shield
|
---|
21 | *
|
---|
22 | * If you are using a RedBearLab BLE shield, uncomment the define below.
|
---|
23 | * Also, change the define for BLE_RST if you have the jumper set to pin 7 rather than pin 4.
|
---|
24 | *
|
---|
25 | * You will need to use the shield with an Arduino Zero, Due, Mega, or other board with sufficient
|
---|
26 | * Flash and RAM. Arduino Uno, Leonardo and other ATmega328p and Atmega32u4 boards to not have
|
---|
27 | * enough memory to run StandardFirmataBLE.
|
---|
28 | *
|
---|
29 | * TODO: verify if this works and with which boards it works.
|
---|
30 | *
|
---|
31 | * Test script: https://gist.github.com/soundanalogous/927360b797574ed50e27
|
---|
32 | */
|
---|
33 | //#define REDBEAR_BLE_SHIELD
|
---|
34 |
|
---|
35 | #ifdef REDBEAR_BLE_SHIELD
|
---|
36 | #include <SPI.h>
|
---|
37 | #include <BLEPeripheral.h>
|
---|
38 | #include "utility/BLEStream.h"
|
---|
39 |
|
---|
40 | #define BLE_REQ 9
|
---|
41 | #define BLE_RDY 8
|
---|
42 | #define BLE_RST 4 // 4 or 7 via jumper on shield
|
---|
43 |
|
---|
44 | BLEStream stream(BLE_REQ, BLE_RDY, BLE_RST);
|
---|
45 | #endif
|
---|
46 |
|
---|
47 |
|
---|
48 | /*==================================================================================================
|
---|
49 | * END BLE CONFIGURATION - you should not need to change anything below this line
|
---|
50 | *================================================================================================*/
|
---|
51 |
|
---|
52 | /*
|
---|
53 | * Arduino 101
|
---|
54 | *
|
---|
55 | * Test script: https://gist.github.com/soundanalogous/927360b797574ed50e27
|
---|
56 | */
|
---|
57 | #ifdef _VARIANT_ARDUINO_101_X_
|
---|
58 | #include <CurieBLE.h>
|
---|
59 | #include "utility/BLEStream.h"
|
---|
60 | BLEStream stream;
|
---|
61 | #endif
|
---|
62 |
|
---|
63 |
|
---|
64 | /*
|
---|
65 | * RedBearLab BLE Nano (with default switch settings)
|
---|
66 | *
|
---|
67 | * Blocked on this issue: https://github.com/RedBearLab/nRF51822-Arduino/issues/46
|
---|
68 | * Works with modifications. See comments at top of the test script referenced below.
|
---|
69 | * When the RBL nRF51822-Arduino library issue is resolved, this should work witout
|
---|
70 | * any modifications.
|
---|
71 | *
|
---|
72 | * Test script: https://gist.github.com/soundanalogous/d39bb3eb36333a0906df
|
---|
73 | *
|
---|
74 | * Note: If you have changed the solder jumpers on the Nano you may encounter issues since
|
---|
75 | * the pins are currently mapped in Firmata only for the default (factory) jumper settings.
|
---|
76 | */
|
---|
77 | // #ifdef BLE_NANO
|
---|
78 | // #include <BLEPeripheral.h>
|
---|
79 | // #include "utility/BLEStream.h"
|
---|
80 | // BLEStream stream;
|
---|
81 | // #endif
|
---|
82 |
|
---|
83 |
|
---|
84 | /*
|
---|
85 | * RedBearLab Blend and Blend Micro
|
---|
86 | *
|
---|
87 | * StandardFirmataBLE requires too much Flash and RAM to run on the ATmega32u4-based Blend
|
---|
88 | * and Blend Micro boards. It may work with ConfigurableFirmata selecting only analog and/or
|
---|
89 | * digital I/O.
|
---|
90 | */
|
---|
91 | // #if defined(BLEND_MICRO) || defined(BLEND)
|
---|
92 | // #include <SPI.h>
|
---|
93 | // #include <BLEPeripheral.h>
|
---|
94 | // #include "utility/BLEStream.h"
|
---|
95 |
|
---|
96 | // #define BLE_REQ 6
|
---|
97 | // #define BLE_RDY 7
|
---|
98 | // #define BLE_RST 4
|
---|
99 |
|
---|
100 | // BLEStream stream(BLE_REQ, BLE_RDY, BLE_RST);
|
---|
101 | // #endif
|
---|
102 |
|
---|
103 |
|
---|
104 | #if defined(BLE_REQ) && defined(BLE_RDY) && defined(BLE_RST)
|
---|
105 | #define IS_IGNORE_BLE_PINS(p) ((p) == BLE_REQ || (p) == BLE_RDY || (p) == BLE_RST)
|
---|
106 | #endif
|
---|