Improved interrupt handling

Fix an issue with the Core will crash if interrupt on backlight happens too often. Now interrupt is detached when backlight is on, and re-attach when backlight is off.