86 if(cover_open_flag ==1)
87 PORTD.OUTTGL = PIN3_bm;
89 TCC1.INTCTRLA = (TCC1.INTCTRLA & ~(TC1_OVFINTLVL_gm | TC1_ERRINTLVL_gm))|TC1_OVFINTLVL0_bm;
96 PORTD.PIN4CTRL = PORT_OPC_WIREDANDPULL_gc;
101 SLEEP.CTRL = (SLEEP.CTRL & ~SLEEP_SMODE_gm)| SLEEP_SMODE_IDLE_gc;
104 TCC1.CTRLA = ( TCC1.CTRLA & ~TC1_CLKSEL_gm ) | TC_CLKSEL_DIV64_gc;
113 if( active_power[0] > max_demand )
115 max_demand = active_power[0];
118 if(calibration_flag != 0)
121 if (calibration_flag == 1)
124 else if (calibration_flag == 2)
127 else if (calibration_flag == 3)
130 else if (calibration_flag == 4)
133 else if (calibration_flag == 5)
135 else if (calibration_flag == 6)
146 PORTD.PIN4CTRL = PORT_OPC_WIREDAND_gc;
149 SLEEP.CTRL = (SLEEP.CTRL & ~SLEEP_SMODE_gm)| SLEEP_SMODE_PSAVE_gc;
157 TCC1.CTRLA = ( TCC1.CTRLA & ~TC1_CLKSEL_gm ) | TC_CLKSEL_OFF_gc;
167 SLEEP.CTRL |= SLEEP_SEN_bm;