-
Notifications
You must be signed in to change notification settings - Fork 517
Add support for Adafruit Feather M0 Bluefruit LE to StandardFirmataBLE #393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
These are hardware-specific settings, so they don't belong with the hardware-agnostic code in StandardFirmataBLE.ino. For Arduino 101, specify connection intervals in milliseconds, as expected by BLEPeripheral::setConnectionInterval in Intel Curie Boards package v2.0.2.
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |
| * need a unique ble local name (see below). If you are using another supported BLE board or shield, | ||
| * follow the instructions for the specific board or shield below. | ||
| * | ||
| * Make sure you have the Intel Curie Boards package v1.0.6 or higher installed via the Arduino | ||
| * Make sure you have the Intel Curie Boards package v2.0.2 or higher installed via the Arduino | ||
| * Boards Manager. | ||
| * | ||
| * Supported boards and shields: | ||
|
|
@@ -19,6 +19,22 @@ | |
| // within the same physical space | ||
| #define FIRMATA_BLE_LOCAL_NAME "FIRMATA" | ||
|
|
||
| /* | ||
| * Arduino 101 | ||
| * | ||
| * Make sure you have the Intel Curie Boards package v2.0.2 or higher installed via the Arduino | ||
| * Boards Manager. | ||
| * | ||
| * Test script: https://gist.github.com/soundanalogous/927360b797574ed50e27 | ||
| */ | ||
| #ifdef _VARIANT_ARDUINO_101_X_ | ||
| // After conversion to units of 1.25ms, both values must be between | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can remove all the comments here since the user doesn't need to be concerned with the conversion anymore. I'd just update the comments on lines 34 and 35 to say
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd say it's still useful to know that, under the hood, the values are converted to multiples of 1.25ms -- if only to explain why using the value 8 actually gets you an interval of 7.5ms.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok sgtm |
||
| // 0x0006 (7.5ms) and 0x0c80 (4s) | ||
| #define FIRMATA_BLE_MIN_INTERVAL 8 // ( 8 * 1000) / 1250 == 0x06 -> 7.5ms | ||
| #define FIRMATA_BLE_MAX_INTERVAL 30 // (30 * 1000) / 1250 == 0x18 -> 30ms | ||
| #endif | ||
|
|
||
|
|
||
| /* | ||
| * RedBearLab BLE Shield | ||
| * | ||
|
|
@@ -36,37 +52,47 @@ | |
| //#define REDBEAR_BLE_SHIELD | ||
|
|
||
| #ifdef REDBEAR_BLE_SHIELD | ||
| #include <SPI.h> | ||
| #include <BLEPeripheral.h> | ||
| #include "utility/BLEStream.h" | ||
|
|
||
| #define BLE_REQ 9 | ||
| #define BLE_RDY 8 | ||
| #define BLE_RST 4 // 4 or 7 via jumper on shield | ||
| #endif | ||
|
|
||
| BLEStream stream(BLE_REQ, BLE_RDY, BLE_RST); | ||
|
|
||
| /* | ||
| * Generic settings | ||
| */ | ||
| #if !defined(FIRMATA_BLE_MIN_INTERVAL) && !defined(FIRMATA_BLE_MAX_INTERVAL) | ||
| // BLE connection interval - this is the fastest interval you can read inputs. | ||
| // These values apply to all devices using the Arduino BLEPeripheral library | ||
| // with a Nordic nRF8001 or nRF51822. Both values must be between | ||
| // 0x0006 (7.5ms) and 0x0c80 (4s). | ||
| #define FIRMATA_BLE_MIN_INTERVAL 0x0006 // 7.5ms (7.5 / 1.25) | ||
| #define FIRMATA_BLE_MAX_INTERVAL 0x0018 // 30ms (30 / 1.25) | ||
| #endif | ||
|
|
||
| #if !defined(FIRMATA_BLE_TXBUFFER_FLUSH_INTERVAL) | ||
| // How often the BLE TX buffer is flushed (if not full) | ||
| #define FIRMATA_BLE_TXBUFFER_FLUSH_INTERVAL 30 // 30ms | ||
| #endif | ||
|
|
||
|
|
||
| /*================================================================================================== | ||
| * END BLE CONFIGURATION - you should not need to change anything below this line | ||
| *================================================================================================*/ | ||
|
|
||
| /* | ||
| * Arduino 101 | ||
| * | ||
| * Make sure you have the Intel Curie Boards package v1.0.6 or higher installed via the Arduino | ||
| * Boards Manager. | ||
| * | ||
| * Test script: https://gist.github.com/soundanalogous/927360b797574ed50e27 | ||
| */ | ||
| #ifdef _VARIANT_ARDUINO_101_X_ | ||
| #include <CurieBLE.h> | ||
| #include "utility/BLEStream.h" | ||
| BLEStream stream; | ||
| #endif | ||
|
|
||
|
|
||
| #ifdef REDBEAR_BLE_SHIELD | ||
| #include <SPI.h> | ||
| #include "utility/BLEStream.h" | ||
| BLEStream stream(BLE_REQ, BLE_RDY, BLE_RST); | ||
| #endif | ||
|
|
||
|
|
||
| /* | ||
| * RedBearLab BLE Nano (with default switch settings) | ||
| * | ||
|
|
@@ -81,7 +107,6 @@ BLEStream stream; | |
| * the pins are currently mapped in Firmata only for the default (factory) jumper settings. | ||
| */ | ||
| // #ifdef BLE_NANO | ||
| // #include <BLEPeripheral.h> | ||
| // #include "utility/BLEStream.h" | ||
| // BLEStream stream; | ||
| // #endif | ||
|
|
@@ -96,7 +121,6 @@ BLEStream stream; | |
| */ | ||
| // #if defined(BLEND_MICRO) || defined(BLEND) | ||
| // #include <SPI.h> | ||
| // #include <BLEPeripheral.h> | ||
| // #include "utility/BLEStream.h" | ||
|
|
||
| // #define BLE_REQ 6 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can live with this change, but the reason I used these setters initially was to avoid tightly coupling defines in bleConfig.h with the BLE stream classes. The only reason your change here works is all the code in BLEStream is in the header file, otherwise BLEStream would have been precompiled and the defines in bleConfig.h would not be available due to the weird way the Arduino linker works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I was trying to simplify things, but I didn't consider this issue. I'll add the setters back.