You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
732 B
34 lines
732 B
#include "zirq_dispatcher.hpp"
|
|
|
|
using namespace iflytop;
|
|
using namespace std;
|
|
|
|
extern "C" {
|
|
/**
|
|
* @brief Õâ¸ö·½·¨±ØÐëÔÚHAL_TIM_PeriodElapsedCallbackÖе÷ÓÃ
|
|
*
|
|
* @param htim
|
|
*/
|
|
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
|
|
#ifdef IFLTYOP_ZTICKET_TIMER
|
|
if (htim->Instance == IFLTYOP_ZTICKET_TIMER) {
|
|
HAL_IncTick();
|
|
return;
|
|
}
|
|
#endif
|
|
ZIRQDispatcher::instance()._callOnTimIrq(htim);
|
|
}
|
|
}
|
|
|
|
ZIRQDispatcher &ZIRQDispatcher::instance() {
|
|
static ZIRQDispatcher instance;
|
|
return instance;
|
|
}
|
|
|
|
void ZIRQDispatcher::regTimIrqListener(ontimirq_t listener) { m_ontimirqs.push_back(listener); }
|
|
|
|
void ZIRQDispatcher::_callOnTimIrq(zchip_tim_t *tim) {
|
|
for (auto &listener : m_ontimirqs) {
|
|
listener(tim);
|
|
}
|
|
}
|