fix interrupt code, add interrupt callback handlers for external interrupts