| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- /********************************** (C) COPYRIGHT *******************************
- * File Name : ch32v20x_it.c
- * Author : WCH
- * Version : V1.0.0
- * Date : 2023/12/29
- * Description : Main Interrupt Service Routines.
- *********************************************************************************
- * Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
- * Attention: This software (modified or not) and binary are used for
- * microcontroller manufactured by Nanjing Qinheng Microelectronics.
- *******************************************************************************/
- #include "ch32v20x_it.h"
- #include "ws2812b_spi.h"
- #include "user_ws2812b.h"
- #include "user_led.h"
- #include "download.h"
- #include "upload.h"
- void NMI_Handler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
- void HardFault_Handler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
- void USER_WS2812B_DMA_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
- void SysTick_Handler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
- /*********************************************************************
- * @fn NMI_Handler
- *
- * @brief This function handles NMI exception.
- *
- * @return none
- */
- void NMI_Handler(void)
- {
- while (1)
- {
- }
- }
- /*********************************************************************
- * @fn HardFault_Handler
- *
- * @brief This function handles Hard Fault exception.
- *
- * @return none
- */
- void HardFault_Handler(void)
- {
- NVIC_SystemReset();
- while (1)
- {
- }
- }
- void USER_WS2812B_DMA_IRQHandler(void)
- {
- if(DMA_GetITStatus(USER_WS2812B_DMA_IT_TC))
- {
- // 清除中断标志
- DMA_ClearITPendingBit(USER_WS2812B_DMA_IT_TC);
- DMA_Cmd(USER_WS2812B_DMA_CHANNEL, DISABLE);
- SPI_I2S_DMACmd(USER_WS2812B_SPI, SPI_I2S_DMAReq_Tx, DISABLE);
- // 在这里处理传输完成逻辑
- // 例如: 设置标志、准备下一次传输等
- vUser_ws2812b_set_tx_stat(false);
- }
- }
- /*********************************************************************
- * @fn ADC1_IRQHandler
- *
- * @brief ADC1_2 Interrupt Service Function.
- *
- * @return none
- */
- void SysTick_Handler(void)
- {
- // printf("Systick\r\n");
- SysTick->SR = 0;
- vDownload_tick();
- vUpload_tick();
- led_task_tick();
- vWs2812b_task_tick();
- }
|