At least: font code generator, exchange code support for color 128x128
This commit is contained in:
@@ -66,8 +66,8 @@ ReturnCode ButtonManager::init()
|
||||
|
||||
NextTime ButtonManager::execute()
|
||||
{
|
||||
// TODO: is this call too expensive for an interrupt handler?
|
||||
Common::time_t systime;
|
||||
Common::time_t endtime = 0;
|
||||
BSP::SystemTimer::get_time(systime);
|
||||
|
||||
|
||||
@@ -81,12 +81,22 @@ NextTime ButtonManager::execute()
|
||||
btn.m_callback(btn.m_state);
|
||||
}
|
||||
btn.m_prev_call_state = btn.m_state;
|
||||
continue;
|
||||
} else {
|
||||
|
||||
// It's not time yet. Use this to figure out the next time we should check
|
||||
if (endtime == 0 || btn.m_state_change_ts + btn.m_debounce_time < endtime) {
|
||||
endtime = btn.m_state_change_ts + btn.m_debounce_time;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Call less frequently, and let the buttonmanager re-add itself to the task list on interrupts
|
||||
return NextTime::asap();
|
||||
if (endtime == 0) {
|
||||
return NextTime::never();
|
||||
} else {
|
||||
return NextTime::at(endtime);
|
||||
}
|
||||
}
|
||||
|
||||
void ButtonManager::set_callback(Button btn, ChangeCallback callback)
|
||||
@@ -110,7 +120,7 @@ void ButtonManager::remove_callback(Button btn)
|
||||
void ButtonManager::irq()
|
||||
{
|
||||
uint32_t idr = GPIOA->IDR;
|
||||
Common::time_t systime;
|
||||
static Common::time_t systime;
|
||||
|
||||
// TODO: is this call too expensive for an interrupt handler?
|
||||
BSP::SystemTimer::get_time(systime);
|
||||
@@ -134,6 +144,10 @@ void ButtonManager::irq()
|
||||
// Clear the event
|
||||
SET(EXTI->PR, 1u << btn.m_gpio_idx);
|
||||
}
|
||||
|
||||
if (m_instance != nullptr) {
|
||||
m_instance->m_scheduler.add_task(*m_instance, NextTime::asap());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user