SpenceKonde / megaTinyCore

Arduino core for the tinyAVR 0/1/2-series - Ones's digit 2,4,5,7 (pincount, 8,14,20,24), tens digit 0, 1, or 2 (featureset), preceded by flash in kb. Library maintainers: porting help available!
Other
551 stars 142 forks source link

Compile Issue on 1614 and 1604 Bad arguement #278

Closed ldalep closed 3 years ago

ldalep commented 3 years ago

This use to work on the 1604 now it gives me a compile error

SoftwareSerial pixieSerial(-1, PIXIEPIN);

I have to declare a receive pin

SoftwareSerial pixieSerial(2 PIXIEPIN);

Arduino: 1.8.13 (Mac OS X), Board: "ATtiny1614/1604/814/804/414/404/214/204, No (saves space), ATtiny1604, 20 MHz Internal, 1.8V (5 MHz or less), Disabled/Disabled, EEPROM retained, Enabled (default timer), UPDI (pick this unless you have an HV UPDI programmer!), 8ms, Closer to 5v"

/Users/ldalep/Library/Arduino15/packages/megaTinyCore/hardware/megaavr/2.1.5/cores/megatinycore/wiring_digital.c:33:32: error: call to 'badArg' declared with attribute error: if (pin >= NUM_TOTAL_PINS) badArg("Digital pin is constant, but not a valid pin"); ^ lto-wrapper: fatal error: /Users/ldalep/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc returned 1 exit status compilation terminated.

SpenceKonde commented 3 years ago

Oh my! Good catch!

The real question is how widespread this "trick" is for taking -1/255/NOT_A_PIN for a "don't use any pin for this" and just rely on pinMode/digitalWrite doing nothing with the invalid value, rather than something destructive...