firmata / arduino

Firmata firmware for Arduino
GNU Lesser General Public License v2.1
1.54k stars 514 forks source link

Arduino Uno Wifi Rev 2 Board Configured For Pyfirmata #487

Closed stellaaa42 closed 2 years ago

stellaaa42 commented 2 years ago

Arduino_Uno_Wifi_Rev2_Firmata.zip

Arduino Uno Wifi Rev 2 Board Configured For Pyfirmata

Major Changes:

Added pinouts to boards.h

(mac: ./Documents/Arduino/libraries/Firmata)

Added HWSerial port ID to SerialFirmata.h

(mac: ./Documents/Arduino/libraries/Firmata/utility/SerialFirmata.h)

boards.h

`//Arduino Uno Wifi Rev2

elif defined(__AVR_ATmega4809__)

define TOTAL_ANALOG_PINS NUM_ANALOG_INPUTS //6

define TOTAL_PINS 41 // 14 digital + 6 analog + 6 reserved + 10 internal used + 2 I2C + 3 SPI

define TOTAL_PORTS 3

define VERSION_BLINK_PIN LED_BUILTIN //25

define PIN_SERIAL1_RX 0

define PIN_SERIAL1_TX 1

define PIN_SERIAL2_RX 23

define PIN_SERIAL2_TX 24

define PIN_SERIAL0_RX 26

define PIN_SERIAL0_TX 27

define IS_PIN_DIGITAL(p) (((p) >= 0 && (p) < 20) || (p) == 25)

define IS_PIN_ANALOG(p) ((p) >= 14 && (p) < 19)

define IS_PIN_PWM(p) digitalPinHasPWM(p)

define IS_PIN_SERVO(p) ((p) >= 0 && (p) < MAX_SERVOS)

define IS_PIN_I2C(p) ((p) == 20 || (p) == 21)

define IS_PIN_SPI(p) ((p) == SS || (p) == MOSI || (p) == MISO || (p) == SCK)

define IS_PIN_SERIAL(p) ((p) == 23 || (p) == 24 || (p) == 26 || (p) == 27)

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)

// anything else

else

error "Please edit Boards.h with a hardware abstraction for this board"

endif`

SerialFirmata.h

`// map configuration query response resolution value to serial pin type

define RES_RX0 0x00

define RES_TX0 0x01

define RES_RX1 0x02

define RES_TX1 0x03

if defined(PIN_SERIAL0_RX)

// TODO when use of HW_SERIAL0 is enabled
if (pin == PIN_SERIAL0_RX) return RES_RX0;
if (pin == PIN_SERIAL0_TX) return RES_TX0;

endif

if defined(PIN_SERIAL1_RX)

if (pin == PIN_SERIAL1_RX) return RES_RX1;
if (pin == PIN_SERIAL1_TX) return RES_TX1;

endif

if defined(PIN_SERIAL0_RX)

  case HW_SERIAL0:
    pins.rx = PIN_SERIAL0_RX;
    pins.tx = PIN_SERIAL0_TX;
    break;

endif

  default:
    pins.rx = 0;
    pins.tx = 0;

`

pgrawehr commented 2 years ago

@Space48121111 This PR is asking to merge master into another (deprecated) branch. That's probably not what you intended. Please check the branches to merge (just below the PR title).

stellaaa42 commented 2 years ago

Replaced with a new formatted pull request.