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

Support for Arduino Nano Every #130

Merged
merged 1 commit into from
May 16, 2022
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
6 changes: 2 additions & 4 deletions src/Frequency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ boolean Frequency::handleSysex(byte command, byte argc, byte* argv)
if (_activePin == -1)
{
// not yet enabled on this pin
int internalMode = LOW;
// Must use "auto" here, because the value uses an enum type on newer boards.
auto internalMode = LOW;
switch (mode)
{
case INTERRUPT_MODE_LOW:
Expand All @@ -101,9 +102,6 @@ boolean Frequency::handleSysex(byte command, byte argc, byte* argv)
case INTERRUPT_MODE_CHANGE:
internalMode = CHANGE;
break;
default:
internalMode = -1;
break;
}
if (internalMode >= 0)
{
Expand Down
14 changes: 14 additions & 0 deletions src/utility/Boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,20 @@ writePort(port, value, bitmask): Write an 8 bit port.
#define PIN_TO_SERVO(p) ((p) - 2)
#define ARDUINO_PINOUT_OPTIMIZE 1

#elif defined(AVR_NANO_EVERY) || defined(ARDUINO_NANO_EVERY) || defined(ARDUINO_AVR_NANO_EVERY)
#define TOTAL_ANALOG_PINS 8
#define TOTAL_PINS 24 // 14 digital + 8 analog + 2 i2c
#define IS_PIN_DIGITAL(p) ((p) >= 2 && (p) <= 21) // TBD if pins 0 and 1 are usable
#define IS_PIN_ANALOG(p) ((p) >= 14 && (p) < 14 + TOTAL_ANALOG_PINS)
#define IS_PIN_PWM(p) digitalPinHasPWM(p)
#define IS_PIN_SERVO(p) (IS_PIN_DIGITAL(p) && (p) < MAX_SERVOS) // deprecated since v2.4
#define IS_PIN_I2C(p) ((p) == PIN_WIRE_SDA || (p) == PIN_WIRE_SCL) // SDA = 22, SCL = 23
#define IS_PIN_SPI(p) ((p) == SS || (p) == MOSI || (p) == MISO || (p) == SCK)
#define PIN_TO_DIGITAL(p) (p)
#define PIN_TO_ANALOG(p) ((p) - 14)
#define PIN_TO_PWM(p) PIN_TO_DIGITAL(p)
#define PIN_TO_SERVO(p) (p) // deprecated since v2.4


// Wiring (and board)
#elif defined(WIRING)
Expand Down