api-hal-tim.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "api-hal-tim_i.h"
  2. #include "api-hal-irda_i.h"
  3. #include <stm32wbxx_ll_tim.h>
  4. #include <furi.h>
  5. void TIM2_IRQHandler(void)
  6. {
  7. bool consumed = false;
  8. if(LL_TIM_IsActiveFlag_CC1(TIM2) == 1) {
  9. if (LL_TIM_IsEnabledIT_CC1(TIM2)) {
  10. LL_TIM_ClearFlag_CC1(TIM2);
  11. if (READ_BIT(TIM2->CCMR1, TIM_CCMR1_CC1S)) {
  12. // input capture
  13. consumed = true;
  14. }
  15. else {
  16. // output compare
  17. // HAL_TIM_OC_DelayElapsedCallback(htim);
  18. // HAL_TIM_PWM_PulseFinishedCallback(htim);
  19. }
  20. }
  21. }
  22. if(LL_TIM_IsActiveFlag_CC2(TIM2) == 1) {
  23. if (LL_TIM_IsEnabledIT_CC2(TIM2)) {
  24. LL_TIM_ClearFlag_CC2(TIM2);
  25. if (READ_BIT(TIM2->CCMR1, TIM_CCMR1_CC2S)) {
  26. // input capture
  27. consumed = true;
  28. }
  29. else {
  30. // output compare
  31. // HAL_TIM_OC_DelayElapsedCallback(htim);
  32. // HAL_TIM_PWM_PulseFinishedCallback(htim);
  33. }
  34. }
  35. }
  36. furi_check(consumed);
  37. }