volatile char timerStatus(char key, char first)
{
	static uint8_t counter;
	if(first)
	{
		counter = 0;
	}

	if(counter++ > 3)
	{
		counter = 0;
		lcd.cls();

		displayTimerStatus(0);

		menu.setTitle(TEXT("Running"));
		menu.setBar(TEXT(""), TEXT("STOP"));
		lcd.update();
	}

	if(!timer.running) return FN_CANCEL;

	if(key == FR_KEY)
	{
		menu.push();
		menu.spawn((void*)timerStop);
		return FN_JUMP;
	}

	return FN_CONTINUE;
}
volatile char runHandler(char key, char first)
{
	static char pressed;

	if(first)
	{
		pressed = key;
		key = 0;
	}

	if(pressed == FR_KEY)
	{
		menu.message(TEXT("Timer Started"));
		timer.begin();
		menu.spawn((void*)timerStatus);
		return FN_JUMP;
	}

	menu.push();
	menu.select(0);
	menu.init((menu_item*)menu_options);
	lcd.update();

	return FN_CANCEL;
}
volatile char timerRemoteStart(char key, char first)
{
	menu.message(TEXT("Started Remote"));
	remote.set(REMOTE_PROGRAM);
	remote.set(REMOTE_START);
	menu.spawn((void*)timerStatusRemote);
	return FN_JUMP;
}
void hardware_off(void)
{
    hardware_flashlight(0);
    if(battery_status() == 0)
    {
        //if(timer.cableIsConnected())
        //{
        //    menu.message(STR("Error: Cable"));
        //}
        //else
        //{
            shutter_off();

            // Save the current time-lapse settings to nv-mem
            timer.saveCurrent();

            // If USB is used, detach from the bus
            USB_Detach();

            // Shutdown bluetooth
            bt.disconnect();
            bt.sleep();

            // Disable all interrupts
            cli();

            // Shutdown
            setHigh(POWER_HOLD_PIN);

            FOREVER;
        //}
    } 
    else // Plugged in
    {
        // Charging screen //
        clock.sleeping = 1;
        menu.spawn((void *) batteryStatus);
    }
}