Skip to content

Commit c27ab47

Browse files
Merge pull request #279 from firmata/ble
Intial BLE support for Arduino 101 and some BRL boards
2 parents 162f8fa + ae85c84 commit c27ab47

File tree

7 files changed

+1665
-2
lines changed

7 files changed

+1665
-2
lines changed

Boards.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,22 @@ writePort(port, value, bitmask): Write an 8 bit port.
449449
#define PIN_TO_SERVO(p) ((p) - 2)
450450

451451

452+
// RedBearLab BLE Nano with factory switch settings (S1 - S10)
453+
#elif defined(BLE_NANO)
454+
#define TOTAL_ANALOG_PINS 6
455+
#define TOTAL_PINS 15 // 9 digital + 3 analog
456+
#define IS_PIN_DIGITAL(p) ((p) >= 2 && (p) <= 14)
457+
#define IS_PIN_ANALOG(p) ((p) == 8 || (p) == 9 || (p) == 10 || (p) == 11 || (p) == 12 || (p) == 14) //A0~A5
458+
#define IS_PIN_PWM(p) ((p) == 3 || (p) == 5 || (p) == 6)
459+
#define IS_PIN_SERVO(p) ((p) >= 2 && (p) <= 7)
460+
#define IS_PIN_I2C(p) ((p) == SDA || (p) == SCL)
461+
#define IS_PIN_SPI(p) ((p) == CS || (p) == MOSI || (p) == MISO || (p) == SCK)
462+
#define PIN_TO_DIGITAL(p) (p)
463+
#define PIN_TO_ANALOG(p) ((p) - 8)
464+
#define PIN_TO_PWM(p) PIN_TO_DIGITAL(p)
465+
#define PIN_TO_SERVO(p) (p)
466+
467+
452468
// Sanguino
453469
#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__)
454470
#define TOTAL_ANALOG_PINS 8

Firmata.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ extern "C" {
3333
*/
3434
void FirmataClass::sendValueAsTwo7bitBytes(int value)
3535
{
36-
FirmataStream->write(value & B01111111); // LSB
37-
FirmataStream->write(value >> 7 & B01111111); // MSB
36+
FirmataStream->write(value & 0x7F); // LSB
37+
FirmataStream->write(value >> 7 & 0x7F); // MSB
3838
}
3939

4040
/**

examples/StandardFirmataBLE/LICENSE.txt

Lines changed: 458 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)