Giusto per capirci, l'unica modifica che devi fare, oltre ad attivare il pin per leggere il tasto, è questa:
if (tastopremuto) // modifica
{
while (boot_state==0)
{
while ((!(Serial_Available())) && (boot_state == 0)) // wait for data
{
_delay_ms(0.001);
boot_timer++;
if (boot_timer > boot_timeout)
{
boot_state = 1; // (after ++ -> boot_state=2 bootloader timeout, jump to main 0x00000 )
}
#ifdef BLINK_LED_WHILE_WAITING
if ((boot_timer % 7000) == 0)
{
//* toggle the LED
PROGLED_PORT ^= (1<<PROGLED_PIN); // turn LED ON
}
#endif
}
boot_state++; // ( if boot_state=1 bootloader received byte from UART, enter bootloader mode)
}
}
else boot_state=0; // garantisce l'esecuzione immediata del programma utente