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.

20 lines
518 B

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