Skip to content
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

Clean up Support for 32Bit Arduino Due #108

Merged
merged 3 commits into from
Jul 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@ jobs:
- run: |
arduino-cli core update-index
arduino-cli core install arduino:avr
arduino-cli core install arduino:sam

- run: arduino-cli compile --fqbn arduino:avr:uno ./examples/ConfigurableFirmata --warnings more

- run: arduino-cli compile --fqbn arduino:sam:arduino_due_x_dbg ./examples/ConfigurableFirmata --warnings more
2 changes: 1 addition & 1 deletion src/ConfigurableFirmata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ void FirmataClass::sendStringf(const FlashString* flashString, int sizeOfArgs, .
{
// The parameter "sizeOfArgs" is currently unused.
// 16 bit board?
#if UINT_MAX <= UINT16_MAX
#ifdef ARDUINO_ARCH_AVR
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure you want to limit this just to AVR architectures?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I actually want to limit it to all architectures with only a "small" amount of RAM, but I didn't really find a good way of detecting that. There doesn't seem to be a way that for instance tells whether a CPU is 8 bit. I may need to add something like that to boards.h.

const int maxSize = 32;
#else
const int maxSize = 255;
Expand Down
9 changes: 6 additions & 3 deletions src/utility/Boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,19 +222,22 @@ writePort(port, value, bitmask): Write an 8 bit port.
// Arduino DUE
#elif defined(__SAM3X8E__)
#define TOTAL_ANALOG_PINS 12
#define TOTAL_PINS 66 // 54 digital + 12 analog
#define TOTAL_PINS 77 // Includes some special pins, which are normally outside the counting on these boards
// The SPI pins on the Arduino Due are 74-77
#define TOTAL_DEFAULT_PINS 66 // 54 digital + 12 analog
#define VERSION_BLINK_PIN 13
#define PIN_SERIAL1_RX 19
#define PIN_SERIAL1_TX 18
#define PIN_SERIAL2_RX 17
#define PIN_SERIAL2_TX 16
#define PIN_SERIAL3_RX 15
#define PIN_SERIAL3_TX 14
#define IS_PIN_DIGITAL(p) ((p) >= 2 && (p) < TOTAL_PINS)
#define IS_PIN_ANALOG(p) ((p) >= 54 && (p) < TOTAL_PINS)
#define IS_PIN_DIGITAL(p) ((p) >= 2 && (p) < TOTAL_DEFAULT_PINS)
#define IS_PIN_ANALOG(p) ((p) >= 54 && (p) < TOTAL_DEFAULT_PINS)
#define IS_PIN_PWM(p) digitalPinHasPWM(p)
#define IS_PIN_SERVO(p) ((p) >= 2 && (p) - 2 < MAX_SERVOS)
#define IS_PIN_I2C(p) ((p) == 20 || (p) == 21) // 70 71
#define IS_PIN_SPI(p) ((p) == SS || (p) == MOSI || (p) == MISO || (p) == SCK)
#define IS_PIN_SERIAL(p) ((p) > 13 && (p) < 20)
#define PIN_TO_DIGITAL(p) (p)
#define PIN_TO_ANALOG(p) ((p) - 54)
Expand Down