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.
21 lines
518 B
21 lines
518 B
#include "zirq_dispatcher.hpp"
|
|
|
|
using namespace iflytop;
|
|
using namespace std;
|
|
|
|
extern "C" {
|
|
void HAL_TIM_TriggerCallback(TIM_HandleTypeDef *htim) { 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);
|
|
}
|
|
}
|