Skip to content

Commit cca4989

Browse files
committed
Fix name collision in ArduinoISP sketch with function declared by Mbed OS
The name collision between the variable named "error" in the ArduinoISP sketch and a function of that name declared by Mbed OS causes compilation of the sketch to fail for boards that use the "Arduino nRF528x Boards (Mbed OS)" or "Arduino Mbed OS Boards (nRF52840 / STM32H747)" cores.
1 parent b94e757 commit cca4989

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

Diff for: examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino

+14-14
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ void setup() {
233233

234234
}
235235

236-
int error = 0;
236+
int ISPError = 0;
237237
int pmode = 0;
238238
// address for reading and writing, set by 'U' command
239239
unsigned int here;
@@ -293,7 +293,7 @@ void loop(void) {
293293
digitalWrite(LED_PMODE, LOW);
294294
}
295295
// is there an error?
296-
if (error) {
296+
if (ISPError) {
297297
digitalWrite(LED_ERR, HIGH);
298298
} else {
299299
digitalWrite(LED_ERR, LOW);
@@ -344,7 +344,7 @@ void empty_reply() {
344344
SERIAL.print((char)STK_INSYNC);
345345
SERIAL.print((char)STK_OK);
346346
} else {
347-
error++;
347+
ISPError++;
348348
SERIAL.print((char)STK_NOSYNC);
349349
}
350350
}
@@ -355,7 +355,7 @@ void breply(uint8_t b) {
355355
SERIAL.print((char)b);
356356
SERIAL.print((char)STK_OK);
357357
} else {
358-
error++;
358+
ISPError++;
359359
SERIAL.print((char)STK_NOSYNC);
360360
}
361361
}
@@ -494,7 +494,7 @@ void write_flash(int length) {
494494
SERIAL.print((char) STK_INSYNC);
495495
SERIAL.print((char) write_flash_pages(length));
496496
} else {
497-
error++;
497+
ISPError++;
498498
SERIAL.print((char) STK_NOSYNC);
499499
}
500500
}
@@ -523,7 +523,7 @@ uint8_t write_eeprom(unsigned int length) {
523523
unsigned int start = here * 2;
524524
unsigned int remaining = length;
525525
if (length > param.eepromsize) {
526-
error++;
526+
ISPError++;
527527
return STK_FAILED;
528528
}
529529
while (remaining > EECHUNK) {
@@ -564,7 +564,7 @@ void program_page() {
564564
SERIAL.print((char) STK_INSYNC);
565565
SERIAL.print(result);
566566
} else {
567-
error++;
567+
ISPError++;
568568
SERIAL.print((char) STK_NOSYNC);
569569
}
570570
return;
@@ -608,7 +608,7 @@ void read_page() {
608608
length += getch();
609609
char memtype = getch();
610610
if (CRC_EOP != getch()) {
611-
error++;
611+
ISPError++;
612612
SERIAL.print((char) STK_NOSYNC);
613613
return;
614614
}
@@ -624,7 +624,7 @@ void read_page() {
624624

625625
void read_signature() {
626626
if (CRC_EOP != getch()) {
627-
error++;
627+
ISPError++;
628628
SERIAL.print((char) STK_NOSYNC);
629629
return;
630630
}
@@ -647,7 +647,7 @@ void avrisp() {
647647
uint8_t ch = getch();
648648
switch (ch) {
649649
case '0': // signon
650-
error = 0;
650+
ISPError = 0;
651651
empty_reply();
652652
break;
653653
case '1':
@@ -656,7 +656,7 @@ void avrisp() {
656656
SERIAL.print("AVR ISP");
657657
SERIAL.print((char) STK_OK);
658658
} else {
659-
error++;
659+
ISPError++;
660660
SERIAL.print((char) STK_NOSYNC);
661661
}
662662
break;
@@ -706,7 +706,7 @@ void avrisp() {
706706
universal();
707707
break;
708708
case 'Q': //0x51
709-
error = 0;
709+
ISPError = 0;
710710
end_pmode();
711711
empty_reply();
712712
break;
@@ -718,13 +718,13 @@ void avrisp() {
718718
// expecting a command, not CRC_EOP
719719
// this is how we can get back in sync
720720
case CRC_EOP:
721-
error++;
721+
ISPError++;
722722
SERIAL.print((char) STK_NOSYNC);
723723
break;
724724

725725
// anything else we will return STK_UNKNOWN
726726
default:
727-
error++;
727+
ISPError++;
728728
if (CRC_EOP == getch()) {
729729
SERIAL.print((char)STK_UNKNOWN);
730730
} else {

0 commit comments

Comments
 (0)