From ff34f18f50701f213f75716f8e21a102f384c25f Mon Sep 17 00:00:00 2001 From: Cheong Date: Tue, 29 Apr 2014 12:01:44 +0800 Subject: [PATCH] Fixed pin settings for Leonardo board and Blend Micro board. --- .../examples/BLEControllerSketch/Boards.h | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Arduino/libraries/RBL_nRF8001/examples/BLEControllerSketch/Boards.h b/Arduino/libraries/RBL_nRF8001/examples/BLEControllerSketch/Boards.h index 59eda81..52ac994 100644 --- a/Arduino/libraries/RBL_nRF8001/examples/BLEControllerSketch/Boards.h +++ b/Arduino/libraries/RBL_nRF8001/examples/BLEControllerSketch/Boards.h @@ -214,15 +214,31 @@ writePort(port, value, bitmask): Write an 8 bit port. #define PIN_TO_SERVO(p) (p) +// Blend Micro +#elif defined(BLEND_MICRO) +#define TOTAL_ANALOG_PINS 6 +#define TOTAL_PINS 24 // 11 digital + 12 analog +#define VERSION_BLINK_PIN 13 +#define IS_PIN_DIGITAL(p) ( (p) >= 0 && (p) < 24 && !((p) == 4) && !((p) >= 6 && (p) <= 7) && !((p) >=14 && (p) <= 17) ) +#define IS_PIN_ANALOG(p) ((p) >= 18 && (p) < 24) +#define IS_PIN_PWM(p) ( (p) == 3 || (p) == 5 || (p) == 9 || (p) == 10 || (p) == 11 || (p) == 13 ) +#define IS_PIN_SERVO(p) ( (p) >= 0 && (p) < MAX_SERVOS && !((p) == 4) && !((p) >= 6 && (p) <= 7) ) +#define IS_PIN_I2C(p) ((p) == 5 || (p) == 6) +#define PIN_TO_DIGITAL(p) (p) +#define PIN_TO_ANALOG(p) ((p)-18) +#define PIN_TO_PWM(p) PIN_TO_DIGITAL(p) +#define PIN_TO_SERVO(p) (p) + + // Teensy 2.0 #elif defined(__AVR_ATmega32U4__) #define TOTAL_ANALOG_PINS 6 #define TOTAL_PINS 24 // 11 digital + 12 analog #define VERSION_BLINK_PIN 13 -#define IS_PIN_DIGITAL(p) ((p) >= 0 && (p) < 24 && !((p) >=14 && (p) <= 17)) +#define IS_PIN_DIGITAL(p) ( (p) >= 0 && (p) < 24 && !((p) >= 8 && (p) <= 9) && !((p) >=14 && (p) <= 17) ) #define IS_PIN_ANALOG(p) ((p) >= 18 && (p) < 24) -#define IS_PIN_PWM(p) ((p) == 3 || (p) == 5 || (p) == 6 || (p) == 9 || (p) == 10 || (p) == 11 || (p) == 13) -#define IS_PIN_SERVO(p) ((p) >= 0 && (p) < MAX_SERVOS) +#define IS_PIN_PWM(p) ( (p) == 3 || (p) == 5 || (p) == 6 || (p) == 10 || (p) == 11 || (p) == 13 ) +#define IS_PIN_SERVO(p) ( (p) >= 0 && (p) < MAX_SERVOS && !((p) >= 8 && (p) <= 9) ) #define IS_PIN_I2C(p) ((p) == 5 || (p) == 6) #define PIN_TO_DIGITAL(p) (p) #define PIN_TO_ANALOG(p) ((p)-18) @@ -380,4 +396,3 @@ static inline unsigned char writePort(byte port, byte value, byte bitmask) #endif /* Firmata_Boards_h */ -