ch32v20x_it.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 <user_config.h>
  16. #include "ch32v20x_it.h"
  17. #include "user_nfc.h"
  18. #include "user_can.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 USB_LP_CAN1_RX0_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
  26. /*********************************************************************
  27. * @fn NMI_Handler
  28. *
  29. * @brief This function handles NMI exception.
  30. *
  31. * @return None
  32. */
  33. void NMI_Handler(void)
  34. {
  35. }
  36. /*********************************************************************
  37. * @fn HardFault_Handler
  38. *
  39. * @brief This function handles Hard Fault exception.
  40. *
  41. * @return None
  42. */
  43. void HardFault_Handler(void)
  44. {
  45. while(1)
  46. {
  47. }
  48. }
  49. /*********************************************************************
  50. * @fn BB_IRQHandler
  51. *
  52. * @brief BB Interrupt for BLE.
  53. *
  54. * @return None
  55. */
  56. void BB_IRQHandler(void)
  57. {
  58. BB_IRQLibHandler();
  59. }
  60. ///*********************************************************************
  61. // * @fn LLE_IRQHandler
  62. // *
  63. // * @brief LLE Interrupt for BLE.
  64. // *
  65. // * @return None
  66. // */
  67. //void LLE_IRQHandler(void)
  68. //{
  69. // LLE_IRQLibHandler();
  70. //}
  71. // CAN接收中断服务函数
  72. void USB_LP_CAN1_RX0_IRQHandler(void)
  73. {
  74. if(CAN_GetITStatus(CAN1, CAN_IT_FMP0)) // 检查FIFO0消息挂起中断
  75. {
  76. CanRxMsg RxMessage;
  77. CAN_Receive(CAN_TYPE, CAN_FIFO0, &RxMessage);
  78. vUser_can_recv_data(&RxMessage);
  79. // 清除中断标志
  80. CAN_ClearITPendingBit(CAN1, CAN_IT_FMP0);
  81. }
  82. }