Exemple #1
0
void task_powerdown_init()
{
	//Lower F_CPU
	ClockSetSource(x2MHz);
	//disable other oscilators
	OSC.CTRL = 0b00000001;

	buttons_deinit();

	uart_stop();
	_delay_ms(10);

	turnoff_subsystems();

	uart_low_speed();
	_delay_ms(10);

	DEBUG(" *** POWER DOWN INIT ***\n");

	test_memory();

	//we do not want to enter sleep
	powerdown_loop_break = false;
	powerdown_lock.Lock();

	task_timer_setup(false);

	SD_EN_OFF;

	DEBUG("Using low speed uart\n");
}
Exemple #2
0
void buttons_step()
{
    if (config.gui.disp_flags & CFG_DISP_FLIP)
    {
        button_handle(2, GpioRead(SWITCH1));
        button_handle(0, GpioRead(SWITCH3));
    }
    else
    {
        button_handle(0, GpioRead(SWITCH1));
        button_handle(2, GpioRead(SWITCH3));
    }
    button_handle(1, GpioRead(SWITCH2));

    if (buttons_state[0] > BS_IDLE || buttons_state[1] > BS_IDLE || buttons_state[2] > BS_IDLE)
        button_lock.Lock();
    else
        button_lock.Unlock();
}