-
Notifications
You must be signed in to change notification settings - Fork 516
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
Conversation
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.
…ly other Bluefruit LE boards/modules that communicate with the nRF51822 via SPI) to StandardFirmataBLE
Thanks! I'll try to find time to look at this more closely over the weekend. |
@@ -772,14 +768,7 @@ void setup() | |||
Firmata.attach(START_SYSEX, sysexCallback); | |||
Firmata.attach(SYSTEM_RESET, systemResetCallback); | |||
|
|||
stream.setLocalName(FIRMATA_BLE_LOCAL_NAME); |
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.
Overall LGTM, I had one comment about removal of some setters. |
I think you may also need to add the Adafruit Feather M0 Bluefruit LE to Boards.h unless it's pin compatible with an existing M0 board already defined (my hunch is that it is not). |
* 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 |
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.
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 // 8ms
and // 30ms
like you did for the Bluefruit configuration.
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'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.
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.
ok sgtm
The Feather M0 masquerades as an Arduino Zero. Its variant.h even defines The only difference I see is that the Feather has two more analog inputs (A6 and A7). However, those inputs don't follow the digital_pin=analog_pin+14 numbering that A0-A5 do, and the analogInputToDigitalPin macro defined in variant.h doesn't handle them. Personally, I'm OK with ignoring them. |
This should be good to go now. Thanks! |
Ok, I'll confirm on my Arduino 101 just to make sure there were no unexpected regressions. |
These changes add support for the Adafruit Feather M0 Bluefruit LE board to StandardFirmataBLE. They should also work with other Bluefruit LE boards/modules that communicate with the nRF51822 via SPI, although I've only tested the Feather M0. The changes require a few small modifications to the Adafruit BluefruitLE nRF51 package (pull request: adafruit/Adafruit_BluefruitLE_nRF51#43).
I also moved the configuration of the BLE connection and flush intervals to bleConfig.h and updated the connection interval values for the Arduino 101 (which, as of Intel Curie Boards package v2.0.2, must be given in units of milliseconds, not 1.25ms).
I tested the changes on both an Arduino 101 and a Feather M0 Bluefruit LE.