Detection and Restart

On a detected current spike, the hardware stops the motor without any CPU involvement. Pressing button SW0 on the AVR128DB48 Curiosity Nano will trigger the Interrupt Service Routine (ISR) ISR(PORTB_PORT_vect), which will invoke the fan_start() routine to restart the fan motor.


ISR(PORTB_PORT_vect)
{
	fan_start();
	PORTB.INTFLAGS=0xff;
}