-
Notifications
You must be signed in to change notification settings - Fork 516
Added support for Arduino Primo board #360
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
Do you have a link to the pins_arduino.h file and other pin definitions for the Primo? |
Boards.h
Outdated
@@ -299,6 +299,22 @@ writePort(port, value, bitmask): Write an 8 bit port. | |||
#define PIN_TO_PWM(p) PIN_TO_DIGITAL(p) | |||
#define PIN_TO_SERVO(p) (p) // deprecated since v2.4 | |||
|
|||
// Arduino Primo | |||
#elif defined(NRF52) |
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.
Use a more specific name than NRF52, otherwise this block may be defined for other NRF52-based boards in the future. I assume there is a define like "ARDUINO_ARCH_PRIMO" for this board (where "ARCH" should be substituted for the appropriate architecture for this board).
Boards.h
Outdated
// Arduino Primo | ||
#elif defined(NRF52) | ||
#define TOTAL_ANALOG_PINS 6 | ||
#define TOTAL_PINS 22 //14 digital + 6 analog + 2 i2c |
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.
fix the indent here, and for IS_PIN_SPI and IS_PIN_SERIAL
This will simply add Firmata support for the Primo over a serial transport. A good next step would be to add it to StandardFirmataWiFi and StandardFirmataBLE (separate PRs for each). |
I found the variant.h file. |
Boards.h
Outdated
#define IS_PIN_SERVO(p) (IS_PIN_DIGITAL(p) && (p) < MAX_SERVOS+2) | ||
#define IS_PIN_I2C(p) ((p) == 20 || (p) == 21) | ||
#define IS_PIN_SPI(p) ((p)== MOSI || (p) == MISO || (p == SCK)) // 11, 12, 13 | ||
#define IS_PIN_SERIAL(p) ((p) == 0 || (p) == 1) |
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.
Do pins 0 and 1 map to Serial or Serial1?
Boards.h
Outdated
#define IS_PIN_PWM(p) digitalPinHasPWM(p) | ||
#define IS_PIN_SERVO(p) (IS_PIN_DIGITAL(p) && (p) < MAX_SERVOS+2) | ||
#define IS_PIN_I2C(p) ((p) == 20 || (p) == 21) | ||
#define IS_PIN_SPI(p) ((p)== MOSI || (p) == MISO || (p == SCK)) // 11, 12, 13 |
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.
Based on variant.h, SPI pins are 27, 24, 26 respectively rather than 11, 12, 13
I've added some of the fixes you requested. Regarding SPI pins, they are both 11, 12, 13 and 24, 26, 27. They are the same pins, enumerated twice (one for pin header and one for ICSP connector). Anyway if you prefer I will change them. |
Boards.h
Outdated
#define IS_PIN_SERVO(p) (IS_PIN_DIGITAL(p) && (p) < MAX_SERVOS+2) | ||
#define IS_PIN_I2C(p) ((p) == PIN_WIRE_SDA || (p) == PIN_WIRE_SCL) // SDA = 20, SCL = 21 | ||
#define IS_PIN_SPI(p) ((p)== MOSI || (p) == MISO || (p == SCK)) // 11, 12, 13 | ||
#define IS_PIN_SERIAL(p) ((p) == 0 || (p) == 1) |
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.
Remove the IS_PIN_SERIAL
macro. This is for the Firmata Serial feature, but it's currently only support for Serial1, Serial2 and Serial3.
You can keep the SPI pins documented as 11, 12 and 13. This is helpful actually since that was not clear by looking at the variant.h file. |
Also add a comment on the SPI line that SS = 10 |
I've added the SS pin definition that I've forgotten. Missing something else? |
That's it. If you comfortable squashing commits it would be nice to have those 6 commits squashed to a single commit. However if you're not familiar with that process, don't worry about it as it can be tricky. |
0e05baa
to
d96a110
Compare
Squashed. Thank you for the support. |
Thank you for your contribution. |
Hi,
I'm the software developer of the Arduino Primo board. I would like to add the support for this board in your library.
Thanks.