gd32f3x0_it.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*!
  2. \file gd32f3x0_it.c
  3. \brief interrupt service routines
  4. */
  5. /*
  6. Copyright (C) 2017 GigaDevice
  7. 2017-06-06, V1.0.0, firmware for GD32F3x0
  8. */
  9. #include "gd32f3x0_it.h"
  10. #include "rc5_encode.h"
  11. #include "rc5_decode.h"
  12. #include "ir_decode.h"
  13. #include "systick.h"
  14. uint32_t icvalue1 = 0;
  15. uint32_t icvalue2 = 0;
  16. extern uint32_t rc5_frame_manchester_format;
  17. extern __IO trc5_packet_struct rc5_tmp_packet;
  18. /*!
  19. \brief this function handles NMI exception
  20. \param[in] none
  21. \param[out] none
  22. \retval none
  23. */
  24. void NMI_Handler(void)
  25. {
  26. }
  27. /*!
  28. \brief this function handles HardFault exception
  29. \param[in] none
  30. \param[out] none
  31. \retval none
  32. */
  33. void HardFault_Handler(void)
  34. {
  35. /* if Hard Fault exception occurs, go to infinite loop */
  36. while (1);
  37. }
  38. /*!
  39. \brief this function handles MemManage exception
  40. \param[in] none
  41. \param[out] none
  42. \retval none
  43. */
  44. void MemManage_Handler(void)
  45. {
  46. /* if Memory Manage exception occurs, go to infinite loop */
  47. while (1);
  48. }
  49. /*!
  50. \brief this function handles BusFault exception
  51. \param[in] none
  52. \param[out] none
  53. \retval none
  54. */
  55. void BusFault_Handler(void)
  56. {
  57. /* if Bus Fault exception occurs, go to infinite loop */
  58. while (1);
  59. }
  60. /*!
  61. \brief this function handles UsageFault exception
  62. \param[in] none
  63. \param[out] none
  64. \retval none
  65. */
  66. void UsageFault_Handler(void)
  67. {
  68. /* if Usage Fault exception occurs, go to infinite loop */
  69. while (1);
  70. }
  71. /*!
  72. \brief this function handles SVC exception
  73. \param[in] none
  74. \param[out] none
  75. \retval none
  76. */
  77. void SVC_Handler(void)
  78. {
  79. }
  80. /*!
  81. \brief this function handles DebugMon exception
  82. \param[in] none
  83. \param[out] none
  84. \retval none
  85. */
  86. void DebugMon_Handler(void)
  87. {
  88. }
  89. /*!
  90. \brief this function handles PendSV exception
  91. \param[in] none
  92. \param[out] none
  93. \retval none
  94. */
  95. void PendSV_Handler(void)
  96. {
  97. }
  98. /*!
  99. \brief this function handles SysTick exception
  100. \param[in] none
  101. \param[out] none
  102. \retval none
  103. */
  104. void SysTick_Handler(void)
  105. {
  106. delay_decrement( );
  107. }
  108. /*!
  109. \brief this function handles TIMER15 update interrupt request
  110. \param[in] none
  111. \param[out] none
  112. \retval none
  113. */
  114. void TIMER15_IRQHandler(void)
  115. {
  116. rc5_encode_signal_generate(rc5_frame_manchester_format);
  117. /* clear TIMER15 update interrupt */
  118. timer_interrupt_flag_clear(TIMER15, TIMER_INT_UP);
  119. }
  120. /*!
  121. \brief this function handles TIMER2 overflow and update interrupt request
  122. \param[in] none
  123. \param[out] none
  124. \retval none
  125. */
  126. void TIMER2_IRQHandler(void)
  127. {
  128. /* ic2 interrupt*/
  129. if((RESET != timer_interrupt_flag_get(IR_TIMER, TIMER_INT_CH1))){
  130. /* clear IR_TIMER CH1 interrupt */
  131. timer_interrupt_flag_clear(IR_TIMER, TIMER_INT_CH1);
  132. /* get the input capture value */
  133. icvalue2 = TIMER_CH1CV(IR_TIMER);
  134. /* rc5 */
  135. rc5_data_sampling(icvalue2, 1);
  136. }
  137. /* ic1 interrupt */
  138. if((RESET != timer_interrupt_flag_get(IR_TIMER, TIMER_INT_CH0))){
  139. /* clear IR_TIMER CH0 interrupt */
  140. timer_interrupt_flag_clear(IR_TIMER, TIMER_INT_CH0);
  141. /* get the input capture value */
  142. icvalue1 = TIMER_CH0CV(IR_TIMER) - TIMER_CH1CV(IR_TIMER);
  143. /* rc5 */
  144. rc5_data_sampling(icvalue1, 0);
  145. }
  146. }