ch32v20x_it.c 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /********************************** (C) COPYRIGHT *******************************
  2. * File Name : ch32v20x_it.c
  3. * Author : WCH
  4. * Version : V1.0.0
  5. * Date : 2022/06/16
  6. * Description : Main Interrupt Service Routines.
  7. *********************************************************************************
  8. * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
  9. * Attention: This software (modified or not) and binary are used for
  10. * microcontroller manufactured by Nanjing Qinheng Microelectronics.
  11. *******************************************************************************/
  12. /*********************************************************************
  13. * INCLUDES
  14. */
  15. #include "ch32v20x_it.h"
  16. #include "CONFIG.h"
  17. #include "ws2812b_spi.h"
  18. #include "user_ws2812b.h"
  19. /*********************************************************************
  20. * LOCAL FUNCTIONS
  21. */
  22. void NMI_Handler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
  23. void HardFault_Handler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
  24. void BB_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
  25. //void LLE_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
  26. void USER_WS2812B_DMA_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
  27. /*********************************************************************
  28. * @fn NMI_Handler
  29. *
  30. * @brief This function handles NMI exception.
  31. *
  32. * @return None
  33. */
  34. void NMI_Handler(void)
  35. {
  36. }
  37. /*********************************************************************
  38. * @fn HardFault_Handler
  39. *
  40. * @brief This function handles Hard Fault exception.
  41. *
  42. * @return None
  43. */
  44. void HardFault_Handler(void)
  45. {
  46. NVIC_SystemReset();
  47. while(1)
  48. {
  49. }
  50. }
  51. /*********************************************************************
  52. * @fn BB_IRQHandler
  53. *
  54. * @brief BB Interrupt for BLE.
  55. *
  56. * @return None
  57. */
  58. void BB_IRQHandler(void)
  59. {
  60. BB_IRQLibHandler();
  61. }
  62. ///*********************************************************************
  63. // * @fn LLE_IRQHandler
  64. // *
  65. // * @brief LLE Interrupt for BLE.
  66. // *
  67. // * @return None
  68. // */
  69. //void LLE_IRQHandler(void)
  70. //{
  71. // LLE_IRQLibHandler();
  72. //}
  73. void USER_WS2812B_DMA_IRQHandler(void)
  74. {
  75. if(DMA_GetITStatus(USER_WS2812B_DMA_IT_TC))
  76. {
  77. // 清除中断标志
  78. DMA_ClearITPendingBit(USER_WS2812B_DMA_IT_TC);
  79. DMA_Cmd(USER_WS2812B_DMA_CHANNEL, DISABLE);
  80. SPI_I2S_DMACmd(USER_WS2812B_SPI, SPI_I2S_DMAReq_Tx, DISABLE);
  81. // 在这里处理传输完成逻辑
  82. // 例如: 设置标志、准备下一次传输等
  83. vUser_ws2812b_set_tx_stat(false);
  84. }
  85. }