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.

80 lines
2.2 KiB

1 year ago
  1. #include "stm32irq.h"
  2. #include "gins.h"
  3. #include "main.h"
  4. #include "stm32f4xx_it.h"
  5. static stm32_irq_cb_t irqcb[100];
  6. static void callirqcb(stm32irq_type_t type) {
  7. if (irqcb[type] != NULL) {
  8. irqcb[type]();
  9. }
  10. }
  11. void NMI_Handler(void) {
  12. while (1) {
  13. }
  14. }
  15. void HardFault_Handler(void) {
  16. while (1) {
  17. }
  18. }
  19. void MemManage_Handler(void) {
  20. while (1) {
  21. }
  22. }
  23. void BusFault_Handler(void) {
  24. while (1) {
  25. }
  26. }
  27. void UsageFault_Handler(void) {
  28. while (1) {
  29. }
  30. }
  31. void DebugMon_Handler(void) {}
  32. /***********************************************************************************************************************
  33. * IRQ *
  34. ***********************************************************************************************************************/
  35. void DMA1_Stream1_IRQHandler(void) {
  36. if (hdma1_stream1_enable) HAL_DMA_IRQHandler(&hdma1_stream1);
  37. }
  38. void DMA2_Stream2_IRQHandler(void) {
  39. if (hdma2_stream2_enable) HAL_DMA_IRQHandler(&hdma2_stream2);
  40. }
  41. void DMA1_Stream3_IRQHandler(void) {
  42. if (hdma1_stream3_enable) HAL_DMA_IRQHandler(&hdma1_stream3);
  43. }
  44. void CAN1_TX_IRQHandler(void) {
  45. if (hcan1_enable) HAL_CAN_IRQHandler(&hcan1);
  46. }
  47. void CAN1_RX0_IRQHandler(void) {
  48. if (hcan1_enable) HAL_CAN_IRQHandler(&hcan1);
  49. }
  50. void CAN1_RX1_IRQHandler(void) {
  51. if (hcan1_enable) HAL_CAN_IRQHandler(&hcan1);
  52. }
  53. void CAN1_SCE_IRQHandler(void) {
  54. if (hcan1_enable) HAL_CAN_IRQHandler(&hcan1);
  55. }
  56. void TIM1_TRG_COM_TIM11_IRQHandler(void) {
  57. if (htim11_enable) HAL_TIM_IRQHandler(&htim11);
  58. }
  59. void USART1_IRQHandler(void) {
  60. if (huart1_enable) HAL_UART_IRQHandler(&huart1);
  61. }
  62. void TIM6_DAC_IRQHandler(void) {
  63. if (htim6_enable) HAL_TIM_IRQHandler(&htim6);
  64. }
  65. void TIM7_IRQHandler(void) {
  66. if (htim7_enable) HAL_TIM_IRQHandler(&htim7);
  67. }
  68. /***********************************************************************************************************************
  69. * EXT *
  70. ***********************************************************************************************************************/
  71. void stm32irq_reg(stm32irq_type_t type, stm32_irq_cb_t cb) { irqcb[type] = cb; }