diff --git a/main.c b/main.c index 44e9302..649665b 100644 --- a/main.c +++ b/main.c @@ -43,15 +43,6 @@ void software_reset(void) { CCP = CCP_IOREG_gc; // unlock protected registers RSTCTRL.SWRR = 1; // trigger software reset - cli(); // disable interrupts - - // Unlock protected registers - CCP = CCP_IOREG_gc; - - - // Enable WDT with shortest period (~8 cycles) - WDT.CTRLA = WDT_PERIOD_8CLK_gc; - while (1) ; // wait for reset } @@ -60,6 +51,7 @@ ISR(PORTA_PORT_vect) { // Clear interrupt flags for PA0 PORTA.INTFLAGS = BUTTON_PIN_MASK; + if (!(VPORTA.IN & BUTTON_PIN_MASK)) // check PA0 low { // Turn off all LEDs @@ -73,12 +65,6 @@ ISR(PORTA_PORT_vect) */ int main(void) { - bLedEnabled = true; - bBtnPressed = false; - - cli(); // disable interrupts - - // register8_t backuop_dir = VPORTA.DIR; // Configure LED pins as outputs VPORTA.DIR = (PA1_SET_MASK | PA2_SET_MASK | PA3_SET_MASK | PA6_SET_MASK | PA7_SET_MASK);