Skip to content

Commit

Permalink
Merge pull request #155 from pgrawehr/UnoR4
Browse files Browse the repository at this point in the history
Basic support for Arduino Uno R4
  • Loading branch information
pgrawehr authored Jul 25, 2023
2 parents 7c72d93 + a6a7794 commit 6647a15
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 11 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "git",
"url": "https://github.com/firmata/ConfigurableFirmata.git"
},
"version": "3.1.0",
"version": "3.2.0",
"exclude": [
"extras",
"test"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ConfigurableFirmata
version=3.1.0
version=3.2.0
author=Firmata Developers
maintainer=https://github.com/firmata/ConfigurableFirmata
sentence=This library implements the Firmata protocol as a set of plugins that can be used to create applications to remotely interface with an Arduino board.
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigurableFirmata.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* Query using the REPORT_FIRMWARE message.
*/
#define FIRMATA_FIRMWARE_MAJOR_VERSION 3 // for non-compatible changes
#define FIRMATA_FIRMWARE_MINOR_VERSION 1 // for backwards compatible changes
#define FIRMATA_FIRMWARE_MINOR_VERSION 2 // for backwards compatible changes
#define FIRMATA_FIRMWARE_BUGFIX_VERSION 0 // for bugfix releases

#ifdef LARGE_MEM_DEVICE
Expand Down
16 changes: 8 additions & 8 deletions src/I2CFirmata.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
#include "FirmataFeature.h"
#include "FirmataReporting.h"

#define I2C_WRITE B00000000
#define I2C_READ B00001000
#define I2C_READ_CONTINUOUSLY B00010000
#define I2C_STOP_READING B00011000
#define I2C_READ_WRITE_MODE_MASK B00011000
#define I2C_10BIT_ADDRESS_MODE_MASK B00100000
#define I2C_END_TX_MASK B01000000
#define I2C_10BIT_ADDRESS_MASK B00000111
#define I2C_WRITE 0B00000000
#define I2C_READ 0B00001000
#define I2C_READ_CONTINUOUSLY 0B00010000
#define I2C_STOP_READING 0B00011000
#define I2C_READ_WRITE_MODE_MASK 0B00011000
#define I2C_10BIT_ADDRESS_MODE_MASK 0B00100000
#define I2C_END_TX_MASK 0B01000000
#define I2C_10BIT_ADDRESS_MASK 0B00000111
#define I2C_STOP_TX 1
#define I2C_RESTART_TX 0
#define I2C_MAX_QUERIES 8
Expand Down
25 changes: 25 additions & 0 deletions src/utility/Boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ writePort(port, value, bitmask): Write an 8 bit port.
#define digitalPinHasPWM(p) IS_PIN_DIGITAL(p)
#endif

#undef IS_PIN_INTERRUPT
#if defined(digitalPinToInterrupt) && defined(NOT_AN_INTERRUPT)
#define IS_PIN_INTERRUPT(p) (digitalPinToInterrupt(p) > NOT_AN_INTERRUPT)
#else
Expand Down Expand Up @@ -797,6 +798,30 @@ static inline void attachInterrupt(pin_size_t interruptNumber, voidFuncPtr callb
#define PIN_TO_PWM(p) (p)
#define PIN_TO_SERVO(p) (p)

// Arduino UNO R4 Minima and Wifi
// The pinout is the same as for the classical UNO R3
#elif defined(ARDUINO_UNOR4_MINIMA) || defined(ARDUINO_UNOR4_WIFI)
#if defined(NUM_ANALOG_INPUTS) && NUM_ANALOG_INPUTS == 6
#define TOTAL_ANALOG_PINS 6
#define TOTAL_PINS 20 // 14 digital + 6 analog
#else
#define TOTAL_ANALOG_PINS 8
#define TOTAL_PINS 22 // 14 digital + 8 analog
#endif
// These have conflicting(?) definitions in the core for this CPU
#undef IS_PIN_PWM
#undef IS_PIN_ANALOG
#define VERSION_BLINK_PIN 13
#define IS_PIN_DIGITAL(p) ((p) >= 2 && (p) <= 19)
#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) - 2 < MAX_SERVOS)
#define IS_PIN_I2C(p) ((p) == 18 || (p) == 19)
#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) - 2)

// anything else
#else
Expand Down

0 comments on commit 6647a15

Please sign in to comment.