From 9eab78d6481b143e56c7c19a20cf2f44cd4d9b8b Mon Sep 17 00:00:00 2001 From: gaoyang3513 Date: Wed, 31 Jul 2024 20:42:14 +0800 Subject: [PATCH] =?UTF-8?q?[Mod]=20=E4=B8=AD=E6=96=AD=E8=B0=83=E6=95=B4=20?= =?UTF-8?q?=E5=BC=95=E7=94=A8cmt2310=E4=B8=8B=E7=9A=84=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 中断必须在gd_it.c中定义,否则可能卡死; 2. 中断处理中再调用CMT2310 中断处理; --- .../0_Project/Uart_PingPong/irq_handle.c | 211 +++++++ .../0_Project/Uart_PingPong/irq_handle.h | 38 ++ .../0_Project/Uart_PingPong/stm8l15x_it.c | 553 ------------------ .../0_Project/Uart_PingPong/stm8l15x_it.h | 73 --- NSPE/WIFI_IOT/bsp/drivers/CMakeLists.txt | 2 +- NSPE/WIFI_IOT/bsp/gd32_it.c | 38 +- 6 files changed, 252 insertions(+), 663 deletions(-) create mode 100755 NSPE/WIFI_IOT/bsp/drivers/0_Project/Uart_PingPong/irq_handle.c create mode 100755 NSPE/WIFI_IOT/bsp/drivers/0_Project/Uart_PingPong/irq_handle.h delete mode 100755 NSPE/WIFI_IOT/bsp/drivers/0_Project/Uart_PingPong/stm8l15x_it.c delete mode 100755 NSPE/WIFI_IOT/bsp/drivers/0_Project/Uart_PingPong/stm8l15x_it.h diff --git a/NSPE/WIFI_IOT/bsp/drivers/0_Project/Uart_PingPong/irq_handle.c b/NSPE/WIFI_IOT/bsp/drivers/0_Project/Uart_PingPong/irq_handle.c new file mode 100755 index 0000000..64afbbf --- /dev/null +++ b/NSPE/WIFI_IOT/bsp/drivers/0_Project/Uart_PingPong/irq_handle.c @@ -0,0 +1,211 @@ +/** + ****************************************************************************** + * @file stm8l15x_it.c + * @author MCD Application Team + * @version V1.0.0 + * @date 09/28/2010 + * @brief Main Interrupt Service Routines. + * This file provides template for all peripherals interrupt service routine. + ****************************************************************************** + * @copy + * + * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS + * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE + * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY + * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING + * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE + * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. + * + *

© COPYRIGHT 2010 STMicroelectronics

+ */ + +/* Includes ------------------------------------------------------------------*/ +#include "gd32_it.h" +#include "ebyte_kfifo.h" +#include "ebyte_core.h" +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +static uint8_t Uart_isInRecvState = 0; +static uint8_t Uart_isContinuousRecv = 0; +static uint32_t Uart_TickCounter = 0; +extern uint8_t Uart_isRecvReady; + +static uint16_t Button1_TickCounter = 0; +static uint16_t Button2_TickCounter = 0; + +extern Ebyte_FIFO_t hfifo; +extern uint8_t FIFO_isTimeCheckReady; +static uint32_t FIFO_TickCounter = 0; +/* Private function prototypes -----------------------------------------------*/ +void IT_Timer_ButtonCheck(void); +void IT_Timer_UartCheck(void); +/* Private functions ---------------------------------------------------------*/ + +/** @addtogroup IT_Functions + * @{ + */ + +#ifdef _COSMIC_ +/** + * @brief Dummy interrupt routine + * @par Parameters: + * None + * @retval + * None +*/ +INTERRUPT_HANDLER(NonHandledInterrupt, 0) +{ + /* In order to detect unexpected events during development, + it is recommended to set a breakpoint on the following instruction. + */ +} +#endif + +/*! + \brief This function handles TIMER2 interrupt request. + \param[in] none + \param[out] none + \retval none +*/ +void __TIMER2_IRQHandler(void) +{ + if(SET == timer_interrupt_flag_get(TIMER2, TIMER_INT_UP)){ + /* clear channel 0 interrupt bit */ + timer_interrupt_flag_clear(TIMER2, TIMER_INT_UP); + + /* */ + IT_Timer_ButtonCheck(); + + /* ״̬ */ +// IT_Timer_UartCheck(); + + /* ʱʱ */ + Ebyte_BSP_TimerDecrement(); + } +} + +#if 0 // GY3513 +/** + * @brief USART1 RX / Timer5 Capture/Compare Interrupt routine. + * @param None + * @retval None + */ +INTERRUPT_HANDLER(USART1_RX_TIM5_CC_IRQHandler, 28) +{ + + /* ֡ж ״̬ ʱʱ 10msδյһֽ֡ */ + if( !Uart_isInRecvState ) + { + Uart_isInRecvState = 1; + } + Uart_isContinuousRecv = 1; + + /* մ 1 Byte */ + uint8_t temp = USART_ReceiveData8(USART1) ; + + /* д뻺 1 Byte */ + Ebyte_FIFO_Write( &hfifo, &temp, 1 ); + + /* жϱʶ */ + USART_ClearITPendingBit( USART1, USART_IT_RXNE ); +} + +/* ! + * @brief ʱж ״̬ + */ +void IT_Timer_ButtonCheck(void) +{ + /* 1 */ + if( !Ebyte_BSP_ReadButton( BSP_BUTTON_1 ) ) + { + Button1_TickCounter++; + } + else + { + if( Button1_TickCounter > 1000 ) // 1 + { + Ebyte_BTN_FIFO_Push( &BSP_BTN_FIFO, BTN_1_LONG); + } + else if( Button1_TickCounter > 50 ) //50 ̰ + { + Ebyte_BTN_FIFO_Push( &BSP_BTN_FIFO, BTN_1_SHORT); + } + else {} //50 ΪǶ + + Button1_TickCounter=0; + } + + /* 2 */ + if( !Ebyte_BSP_ReadButton( BSP_BUTTON_2 ) ) + { + Button2_TickCounter++; + } + else + { + if( Button2_TickCounter > 1000 ) // 1 + { + Ebyte_BTN_FIFO_Push( &BSP_BTN_FIFO, BTN_2_LONG); + } + else if( Button2_TickCounter > 50 ) //50 ̰ + { + Ebyte_BTN_FIFO_Push( &BSP_BTN_FIFO, BTN_2_SHORT); + } + else {} //50 ΪǶ + + Button2_TickCounter=0; + } +} + +/* ! + * @brief ʱж ״̬ ʱ֡ + */ +void IT_Timer_UartCheck(void) +{ + /* ڽյһֽͿʼʱ */ + if( Uart_isInRecvState ) + { + Uart_TickCounter++; + + /* 10msûнյڶֽ Ϊ֡ */ + if( Uart_TickCounter > 10 ) + { + /* ֪ͨյһ֡ */ + Uart_isRecvReady ++; + /* ֹͣʱ */ + Uart_isInRecvState = 0; + Uart_TickCounter = 0; + } + + /* λFIFOʱ */ + FIFO_TickCounter = 0; + } + else + { + /* ڴûнʱ ûз֡ 500msʱ FIFOе */ + if( (!Uart_isInRecvState) && Uart_isRecvReady ) + { + FIFO_TickCounter++; + if( FIFO_TickCounter > 500) + { + FIFO_isTimeCheckReady=1; + Uart_isRecvReady = 0; + FIFO_TickCounter = 0; + } + } + } + + /* ÿյ1ֽھ¼ */ + if( Uart_isInRecvState && Uart_isContinuousRecv ) + { + Uart_TickCounter = 0; + Uart_isContinuousRecv = 0; + } +} +#endif // GY3513 + +/** + * @} + */ +/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ \ No newline at end of file diff --git a/NSPE/WIFI_IOT/bsp/drivers/0_Project/Uart_PingPong/irq_handle.h b/NSPE/WIFI_IOT/bsp/drivers/0_Project/Uart_PingPong/irq_handle.h new file mode 100755 index 0000000..084f897 --- /dev/null +++ b/NSPE/WIFI_IOT/bsp/drivers/0_Project/Uart_PingPong/irq_handle.h @@ -0,0 +1,38 @@ +/** + ****************************************************************************** + * @file stm8l15x_it.h + * @author MCD Application Team + * @version V1.0.0 + * @date 09/28/2010 + * @brief This file contains the headers of the interrupt handlers. + ****************************************************************************** + * @copy + * + * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS + * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE + * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY + * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING + * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE + * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. + * + *

© COPYRIGHT 2010 STMicroelectronics

+ */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM8L15x_IT_H +#define __STM8L15x_IT_H + +/* Includes ------------------------------------------------------------------*/ +//#include "stm8l15x.h" + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* Exported macro ------------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + +void __TIMER2_IRQHandler(void); + +#endif /* __STM8L15x_IT_H */ + +/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ \ No newline at end of file diff --git a/NSPE/WIFI_IOT/bsp/drivers/0_Project/Uart_PingPong/stm8l15x_it.c b/NSPE/WIFI_IOT/bsp/drivers/0_Project/Uart_PingPong/stm8l15x_it.c deleted file mode 100755 index 3c58091..0000000 --- a/NSPE/WIFI_IOT/bsp/drivers/0_Project/Uart_PingPong/stm8l15x_it.c +++ /dev/null @@ -1,553 +0,0 @@ -/** - ****************************************************************************** - * @file stm8l15x_it.c - * @author MCD Application Team - * @version V1.0.0 - * @date 09/28/2010 - * @brief Main Interrupt Service Routines. - * This file provides template for all peripherals interrupt service routine. - ****************************************************************************** - * @copy - * - * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS - * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE - * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY - * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING - * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE - * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. - * - *

© COPYRIGHT 2010 STMicroelectronics

- */ - -/* Includes ------------------------------------------------------------------*/ -#include "stm8l15x_it.h" -#include "ebyte_kfifo.h" -#include "ebyte_core.h" -/* Private typedef -----------------------------------------------------------*/ -/* Private define ------------------------------------------------------------*/ -/* Private macro -------------------------------------------------------------*/ -/* Private variables ---------------------------------------------------------*/ -static uint8_t Uart_isInRecvState = 0; -static uint8_t Uart_isContinuousRecv = 0; -static uint32_t Uart_TickCounter = 0; -extern uint8_t Uart_isRecvReady; - -static uint16_t Button1_TickCounter = 0; -static uint16_t Button2_TickCounter = 0; - - -extern Ebyte_FIFO_t hfifo; -extern uint8_t FIFO_isTimeCheckReady; -static uint32_t FIFO_TickCounter = 0; -/* Private function prototypes -----------------------------------------------*/ -void IT_Timer_ButtonCheck(void); -void IT_Timer_UartCheck(void); -/* Private functions ---------------------------------------------------------*/ - -/** @addtogroup IT_Functions - * @{ - */ - -#ifdef _COSMIC_ -/** - * @brief Dummy interrupt routine - * @par Parameters: - * None - * @retval - * None -*/ -INTERRUPT_HANDLER(NonHandledInterrupt, 0) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} -#endif - -/** - * @brief TRAP interrupt routine - * @par Parameters: - * None - * @retval - * None -*/ -INTERRUPT_HANDLER_TRAP(TRAP_IRQHandler) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief FLASH Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(FLASH_IRQHandler, 1) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief DMA1 channel0 and channel1 Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(DMA1_CHANNEL0_1_IRQHandler, 2) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief DMA1 channel2 and channel3 Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(DMA1_CHANNEL2_3_IRQHandler, 3) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief RTC / CSS_LSE Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(RTC_CSSLSE_IRQHandler, 4) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief External IT PORTE/F and PVD Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(EXTIE_F_PVD_IRQHandler, 5) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief External IT PORTB / PORTG Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(EXTIB_G_IRQHandler, 6) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief External IT PORTD /PORTH Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(EXTID_H_IRQHandler, 7) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief External IT PIN0 Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(EXTI0_IRQHandler, 8) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ - -} - -/** - * @brief External IT PIN1 Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(EXTI1_IRQHandler, 9) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief External IT PIN2 Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(EXTI2_IRQHandler, 10) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -// Ebyte_BSP_LedControl( BSP_LED_1, ON ); -// Ebyte_E49x_InterruptTrigger(); - EXTI_ClearITPendingBit(EXTI_IT_Pin2); -} - -/** - * @brief External IT PIN3 Interrupt routine. - * @param None - * @retval None - */ - -INTERRUPT_HANDLER(EXTI3_IRQHandler, 11) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ - EXTI_ClearITPendingBit(EXTI_IT_Pin3); -} - -/** - * @brief External IT PIN4 Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(EXTI4_IRQHandler, 12) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ - EXTI_ClearITPendingBit(EXTI_IT_Pin4); -} - -/** - * @brief External IT PIN5 Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(EXTI5_IRQHandler, 13) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ - EXTI_ClearITPendingBit(EXTI_IT_Pin5); -} - -/** - * @brief External IT PIN6 Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(EXTI6_IRQHandler, 14) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief External IT PIN7 Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(EXTI7_IRQHandler, 15) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief LCD /AES Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(LCD_AES_IRQHandler, 16) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief CLK switch/CSS/TIM1 break Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(SWITCH_CSS_BREAK_DAC_IRQHandler, 17) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief ADC1/Comparator Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(ADC1_COMP_IRQHandler, 18) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ - /* Clear the comparator1 event flag */ - COMP_ClearFlag(COMP_Selection_COMP1); -} - -/** - * @brief TIM2 Update/Overflow/Trigger/Break /USART2 TX Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(TIM2_UPD_OVF_TRG_BRK_USART2_TX_IRQHandler, 19) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief Timer2 Capture/Compare / USART2 RX Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(TIM2_CC_USART2_RX_IRQHandler, 20) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief Timer3 Update/Overflow/Trigger/Break Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(TIM3_UPD_OVF_TRG_BRK_USART3_TX_IRQHandler, 21) -{ - /* */ - IT_Timer_ButtonCheck(); - - /* ״̬ */ - IT_Timer_UartCheck(); - - /* ʱʱ */ - Ebyte_BSP_TimerDecrement(); - - TIM3_ClearITPendingBit(TIM3_IT_Update); -} - -/** - * @brief Timer3 Capture/Compare /USART3 RX Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(TIM3_CC_USART3_RX_IRQHandler, 22) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief TIM1 Update/Overflow/Trigger/Commutation Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_COM_IRQHandler, 23) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief TIM1 Capture/Compare Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(TIM1_CC_IRQHandler, 24) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief TIM4 Update/Overflow/Trigger Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(TIM4_UPD_OVF_TRG_IRQHandler, 25) -{ - -} - -/** - * @brief SPI1 Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(SPI1_IRQHandler, 26) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief USART1 TX / TIM5 Update/Overflow/Trigger/Break Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(USART1_TX_TIM5_UPD_OVF_TRG_BRK_IRQHandler, 27) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ -} - -/** - * @brief USART1 RX / Timer5 Capture/Compare Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(USART1_RX_TIM5_CC_IRQHandler, 28) -{ - - /* ֡ж ״̬ ʱʱ 10msδյһֽ֡ */ - if( !Uart_isInRecvState ) - { - Uart_isInRecvState = 1; - } - Uart_isContinuousRecv = 1; - - /* մ 1 Byte */ - uint8_t temp = USART_ReceiveData8(USART1) ; - - /* д뻺 1 Byte */ - Ebyte_FIFO_Write( &hfifo, &temp, 1 ); - - /* жϱʶ */ - USART_ClearITPendingBit( USART1, USART_IT_RXNE ); -} - -/** - * @brief I2C1 / SPI2 Interrupt routine. - * @param None - * @retval None - */ -INTERRUPT_HANDLER(I2C1_SPI2_IRQHandler, 29) -{ - /* In order to detect unexpected events during development, - it is recommended to set a breakpoint on the following instruction. - */ - -} - -/* ! - * @brief ʱж ״̬ - */ -void IT_Timer_ButtonCheck(void) -{ - /* 1 */ - if( !Ebyte_BSP_ReadButton( BSP_BUTTON_1 ) ) - { - Button1_TickCounter++; - } - else - { - if( Button1_TickCounter > 1000 ) // 1 - { - Ebyte_BTN_FIFO_Push( &BSP_BTN_FIFO, BTN_1_LONG); - } - else if( Button1_TickCounter > 50 ) //50 ̰ - { - Ebyte_BTN_FIFO_Push( &BSP_BTN_FIFO, BTN_1_SHORT); - } - else {} //50 ΪǶ - - Button1_TickCounter=0; - } - - /* 2 */ - if( !Ebyte_BSP_ReadButton( BSP_BUTTON_2 ) ) - { - Button2_TickCounter++; - } - else - { - if( Button2_TickCounter > 1000 ) // 1 - { - Ebyte_BTN_FIFO_Push( &BSP_BTN_FIFO, BTN_2_LONG); - } - else if( Button2_TickCounter > 50 ) //50 ̰ - { - Ebyte_BTN_FIFO_Push( &BSP_BTN_FIFO, BTN_2_SHORT); - } - else {} //50 ΪǶ - - Button2_TickCounter=0; - } -} - -/* ! - * @brief ʱж ״̬ ʱ֡ - */ -void IT_Timer_UartCheck(void) -{ - /* ڽյһֽͿʼʱ */ - if( Uart_isInRecvState ) - { - Uart_TickCounter++; - - /* 10msûнյڶֽ Ϊ֡ */ - if( Uart_TickCounter > 10 ) - { - /* ֪ͨյһ֡ */ - Uart_isRecvReady ++; - /* ֹͣʱ */ - Uart_isInRecvState = 0; - Uart_TickCounter = 0; - } - - /* λFIFOʱ */ - FIFO_TickCounter = 0; - } - else - { - /* ڴûнʱ ûз֡ 500msʱ FIFOе */ - if( (!Uart_isInRecvState) && Uart_isRecvReady ) - { - FIFO_TickCounter++; - if( FIFO_TickCounter > 500) - { - FIFO_isTimeCheckReady=1; - Uart_isRecvReady = 0; - FIFO_TickCounter = 0; - } - } - } - - /* ÿյ1ֽھ¼ */ - if( Uart_isInRecvState && Uart_isContinuousRecv ) - { - Uart_TickCounter = 0; - Uart_isContinuousRecv = 0; - } -} - -/** - * @} - */ -/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ \ No newline at end of file diff --git a/NSPE/WIFI_IOT/bsp/drivers/0_Project/Uart_PingPong/stm8l15x_it.h b/NSPE/WIFI_IOT/bsp/drivers/0_Project/Uart_PingPong/stm8l15x_it.h deleted file mode 100755 index c415cda..0000000 --- a/NSPE/WIFI_IOT/bsp/drivers/0_Project/Uart_PingPong/stm8l15x_it.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - ****************************************************************************** - * @file stm8l15x_it.h - * @author MCD Application Team - * @version V1.0.0 - * @date 09/28/2010 - * @brief This file contains the headers of the interrupt handlers. - ****************************************************************************** - * @copy - * - * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS - * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE - * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY - * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING - * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE - * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. - * - *

© COPYRIGHT 2010 STMicroelectronics

- */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __STM8L15x_IT_H -#define __STM8L15x_IT_H - -/* Includes ------------------------------------------------------------------*/ -#include "stm8l15x.h" - -/* Exported types ------------------------------------------------------------*/ -/* Exported constants --------------------------------------------------------*/ - -/* Exported macro ------------------------------------------------------------*/ -/* Exported functions ------------------------------------------------------- */ -#ifdef _COSMIC_ - void _stext(void); /* RESET startup routine */ - INTERRUPT void NonHandledInterrupt(void); -#endif /* _COSMIC_ */ - -#ifndef _RAISONANCE_ - INTERRUPT void TRAP_IRQHandler(void); /* TRAP */ - INTERRUPT void FLASH_IRQHandler(void); /* FLASH EOP/PG_DIS */ - INTERRUPT void DMA1_CHANNEL0_1_IRQHandler(void); /* DMA1 Channel0/1*/ - INTERRUPT void DMA1_CHANNEL2_3_IRQHandler(void); /*DMA1 Channel2/3*/ - INTERRUPT void RTC_CSSLSE_IRQHandler(void); /* RTC /CSS_LSE */ - INTERRUPT void EXTIE_F_PVD_IRQHandler(void); /*EXTI PORTE/EXTI PORTF/PVD*/ - INTERRUPT void EXTIB_G_IRQHandler(void); /* EXTI PORTB / EXTI PORTG */ - INTERRUPT void EXTID_H_IRQHandler(void); /* EXTI PORTD / EXTI PORTH*/ - INTERRUPT void EXTI0_IRQHandler(void); /* EXTI PIN0 */ - INTERRUPT void EXTI1_IRQHandler(void); /* EXTI PIN1 */ - INTERRUPT void EXTI2_IRQHandler(void); /* EXTI PIN2 */ - INTERRUPT void EXTI3_IRQHandler(void); /* EXTI PIN3 */ - INTERRUPT void EXTI4_IRQHandler(void); /* EXTI PIN4 */ - INTERRUPT void EXTI5_IRQHandler(void); /* EXTI PIN5 */ - INTERRUPT void EXTI6_IRQHandler(void); /* EXTI PIN6 */ - INTERRUPT void EXTI7_IRQHandler(void); /* EXTI PIN7 */ - INTERRUPT void LCD_AES_IRQHandler(void); /* LCD /AES */ - INTERRUPT void SWITCH_CSS_BREAK_DAC_IRQHandler(void); /* Switch CLK/CSS/TIM1 Break/DAC */ - INTERRUPT void ADC1_COMP_IRQHandler(void); /*ADC1/COMP*/ - INTERRUPT void TIM2_UPD_OVF_TRG_BRK_USART2_TX_IRQHandler(void); /* TIM2 UPD/OVF/TRG/BRK / USART2 TX */ - INTERRUPT void TIM2_CC_USART2_RX_IRQHandler(void); /* TIM2 CAP / USART2 RX */ - INTERRUPT void TIM3_UPD_OVF_TRG_BRK_USART3_TX_IRQHandler(void); /* TIM3 UPD/OVF/TRG/BRK /USART3 TX*/ - INTERRUPT void TIM3_CC_USART3_RX_IRQHandler(void); /* TIM3 CAP/ USART3 RX */ - INTERRUPT void TIM1_UPD_OVF_TRG_COM_IRQHandler(void);/* TIM1 UPD/OVF/TRG/COM */ - INTERRUPT void TIM1_CC_IRQHandler(void);/* TIM1 CAP*/ - INTERRUPT void TIM4_UPD_OVF_TRG_IRQHandler(void); /* TIM4 UPD/OVF/TRI */ - INTERRUPT void SPI1_IRQHandler(void); /* SPI1 */ - INTERRUPT void USART1_TX_TIM5_UPD_OVF_TRG_BRK_IRQHandler(void); /* USART1 TX / TIM5 UPD/OVF/TRG/BRK */ - INTERRUPT void USART1_RX_TIM5_CC_IRQHandler(void); /* USART1 RX / TIM5 CAP */ - INTERRUPT void I2C1_SPI2_IRQHandler(void); /* I2C1 / SPI2 */ -#endif /* _RAISONANCE_ */ - -#endif /* __STM8L15x_IT_H */ - -/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ \ No newline at end of file diff --git a/NSPE/WIFI_IOT/bsp/drivers/CMakeLists.txt b/NSPE/WIFI_IOT/bsp/drivers/CMakeLists.txt index 1a4a52f..39a2472 100644 --- a/NSPE/WIFI_IOT/bsp/drivers/CMakeLists.txt +++ b/NSPE/WIFI_IOT/bsp/drivers/CMakeLists.txt @@ -9,7 +9,7 @@ target_sources(cmt2310 0_Project/Uart_PingPong/ebyte/ebyte_callback.c 0_Project/Uart_PingPong/ebyte/ebyte_core.c 0_Project/Uart_PingPong/ebyte/ebyte_port.c -# 0_Project/Uart_PingPong/stm8l15x_it.c + 0_Project/Uart_PingPong/irq_handle.c 1_Middleware/Kfifo/ebyte_kfifo.c 1_Middleware/Produce/ebyte_debug.c 2_Ebyte_Board_Support/E15-EVB02/board_button.c diff --git a/NSPE/WIFI_IOT/bsp/gd32_it.c b/NSPE/WIFI_IOT/bsp/gd32_it.c index de5a82b..ad8e15e 100644 --- a/NSPE/WIFI_IOT/bsp/gd32_it.c +++ b/NSPE/WIFI_IOT/bsp/gd32_it.c @@ -41,29 +41,7 @@ OF SUCH DAMAGE. #include "bsp_wlan.h" #include "wakelock.h" //#include "systick.h" -#include "board.h" -#include "ebyte_kfifo.h" -#include "ebyte_core.h" -/* Private typedef -----------------------------------------------------------*/ -/* Private define ------------------------------------------------------------*/ -/* Private macro -------------------------------------------------------------*/ -/* Private variables ---------------------------------------------------------*/ -static uint8_t Uart_isInRecvState = 0; -static uint8_t Uart_isContinuousRecv = 0; -static uint32_t Uart_TickCounter = 0; -extern uint8_t Uart_isRecvReady; - -static uint16_t Button1_TickCounter = 0; -static uint16_t Button2_TickCounter = 0; - - -extern Ebyte_FIFO_t hfifo; -extern uint8_t FIFO_isTimeCheckReady; -static uint32_t FIFO_TickCounter = 0; -/* Private function prototypes -----------------------------------------------*/ -void IT_Timer_ButtonCheck(void); -void IT_Timer_UartCheck(void); -/* Private functions ---------------------------------------------------------*/ +#include "irq_handle.h" extern void wlan_interrupt_rx_handler(void); extern void wlan_interrupt_tx_handler(void); @@ -499,17 +477,5 @@ void WLAN_Cmn_IRQHandler(void) */ void TIMER2_IRQHandler(void) { - if(SET == timer_interrupt_flag_get(TIMER2, TIMER_INT_UP)){ - /* clear channel 0 interrupt bit */ - timer_interrupt_flag_clear(TIMER2, TIMER_INT_UP); - - /* 按键检测 */ - IT_Timer_ButtonCheck(); - - /* 串口状态检测 */ -// IT_Timer_UartCheck(); - - /* 定时器延时辅助计算 */ - Ebyte_BSP_TimerDecrement(); - } + __TIMER2_IRQHandler(); } \ No newline at end of file