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.

17 lines
458 B

2 years ago
  1. #include "irq_dispatcher.hpp"
  2. using namespace iflytop;
  3. using namespace std;
  4. extern "C" {
  5. void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim) { ZIRQDispatcher::instance()._callOnTimIrq(htim); }
  6. }
  7. ZIRQDispatcher &ZIRQDispatcher::instance() {}
  8. void ZIRQDispatcher::regTimIrqListener(ontimirq_t listener) { m_ontimirqs.push_back(listener); }
  9. void ZIRQDispatcher::_callOnTimIrq(zchip_tim_t *tim) {
  10. for (auto &listener : m_ontimirqs) {
  11. listener(tim);
  12. }
  13. }