[Mod] 中断调整 引用cmt2310下的回调

1. 中断必须在gd_it.c中定义,否则可能卡死;
2. 中断处理中再调用CMT2310 中断处理;
This commit is contained in:
gaoyang3513
2024-07-31 20:42:14 +08:00
parent 8fab7d67c4
commit 9eab78d648
6 changed files with 252 additions and 663 deletions

View File

@ -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.
*
* <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
*/
/* 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);
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
IT_Timer_ButtonCheck();
/* <20><><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD> */
// IT_Timer_UartCheck();
/* <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
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)
{
/* <20><>֡<EFBFBD>ж<EFBFBD> ״̬<D7B4><CCAC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ 10ms<6D><73>δ<EFBFBD>յ<EFBFBD><D5B5><EFBFBD>һ<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>֡ */
if( !Uart_isInRecvState )
{
Uart_isInRecvState = 1;
}
Uart_isContinuousRecv = 1;
/* <20><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 Byte */
uint8_t temp = USART_ReceiveData8(USART1) ;
/* д<><EFBFBD><EBBBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 Byte */
Ebyte_FIFO_Write( &hfifo, &temp, 1 );
/* <20><><EFBFBD><EFBFBD><EFBFBD>жϱ<D0B6>ʶ */
USART_ClearITPendingBit( USART1, USART_IT_RXNE );
}
/* !
* @brief <20><>ʱ<EFBFBD><CAB1><EFBFBD>ж<EFBFBD> ״̬<D7B4><CCAC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
void IT_Timer_ButtonCheck(void)
{
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
if( !Ebyte_BSP_ReadButton( BSP_BUTTON_1 ) )
{
Button1_TickCounter++;
}
else
{
if( Button1_TickCounter > 1000 ) // 1<><31> <20><><EFBFBD><EFBFBD>
{
Ebyte_BTN_FIFO_Push( &BSP_BTN_FIFO, BTN_1_LONG);
}
else if( Button1_TickCounter > 50 ) //50<35><30><EFBFBD><EFBFBD> <20>̰<EFBFBD>
{
Ebyte_BTN_FIFO_Push( &BSP_BTN_FIFO, BTN_1_SHORT);
}
else {} //50<35><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ϊ<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Button1_TickCounter=0;
}
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
if( !Ebyte_BSP_ReadButton( BSP_BUTTON_2 ) )
{
Button2_TickCounter++;
}
else
{
if( Button2_TickCounter > 1000 ) // 1<><31> <20><><EFBFBD><EFBFBD>
{
Ebyte_BTN_FIFO_Push( &BSP_BTN_FIFO, BTN_2_LONG);
}
else if( Button2_TickCounter > 50 ) //50<35><30><EFBFBD><EFBFBD> <20>̰<EFBFBD>
{
Ebyte_BTN_FIFO_Push( &BSP_BTN_FIFO, BTN_2_SHORT);
}
else {} //50<35><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ϊ<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Button2_TickCounter=0;
}
}
/* !
* @brief <20><>ʱ<EFBFBD><CAB1><EFBFBD>ж<EFBFBD> ״̬<D7B4><CCAC> <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>֡
*/
void IT_Timer_UartCheck(void)
{
/* <20><><EFBFBD>ڽ<EFBFBD><DABD>յ<EFBFBD><D5B5><EFBFBD>һ<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>Ϳ<EFBFBD>ʼ<EFBFBD><CABC>ʱ */
if( Uart_isInRecvState )
{
Uart_TickCounter++;
/* <20><><EFBFBD><EFBFBD>10msû<73>н<EFBFBD><D0BD>յ<EFBFBD><D5B5>ڶ<EFBFBD><DAB6>ֽ<EFBFBD> <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>֡ */
if( Uart_TickCounter > 10 )
{
/* ֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>һ֡ */
Uart_isRecvReady ++;
/* ֹͣ<CDA3><D6B9>ʱ */
Uart_isInRecvState = 0;
Uart_TickCounter = 0;
}
/* <20><>λFIFO<46><4F>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> */
FIFO_TickCounter = 0;
}
else
{
/* <20><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>û<EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡ 500ms<6D><73><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>FIFO<46>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD> */
if( (!Uart_isInRecvState) && Uart_isRecvReady )
{
FIFO_TickCounter++;
if( FIFO_TickCounter > 500)
{
FIFO_isTimeCheckReady=1;
Uart_isRecvReady = 0;
FIFO_TickCounter = 0;
}
}
}
/* <20><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>յ<EFBFBD>1<EFBFBD><31><EFBFBD>ֽھ<D6BD><DABE><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD> */
if( Uart_isInRecvState && Uart_isContinuousRecv )
{
Uart_TickCounter = 0;
Uart_isContinuousRecv = 0;
}
}
#endif // GY3513
/**
* @}
*/
/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/

View File

@ -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.
*
* <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
*/
/* 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****/

View File

@ -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.
*
* <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
*/
/* 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)
{
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
IT_Timer_ButtonCheck();
/* <20><><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD> */
IT_Timer_UartCheck();
/* <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
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)
{
/* <20><>֡<EFBFBD>ж<EFBFBD> ״̬<D7B4><CCAC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ 10ms<6D><73>δ<EFBFBD>յ<EFBFBD><D5B5><EFBFBD>һ<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>֡ */
if( !Uart_isInRecvState )
{
Uart_isInRecvState = 1;
}
Uart_isContinuousRecv = 1;
/* <20><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 Byte */
uint8_t temp = USART_ReceiveData8(USART1) ;
/* д<><EFBFBD><EBBBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 Byte */
Ebyte_FIFO_Write( &hfifo, &temp, 1 );
/* <20><><EFBFBD><EFBFBD><EFBFBD>жϱ<D0B6>ʶ */
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 <20><>ʱ<EFBFBD><CAB1><EFBFBD>ж<EFBFBD> ״̬<D7B4><CCAC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
void IT_Timer_ButtonCheck(void)
{
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
if( !Ebyte_BSP_ReadButton( BSP_BUTTON_1 ) )
{
Button1_TickCounter++;
}
else
{
if( Button1_TickCounter > 1000 ) // 1<><31> <20><><EFBFBD><EFBFBD>
{
Ebyte_BTN_FIFO_Push( &BSP_BTN_FIFO, BTN_1_LONG);
}
else if( Button1_TickCounter > 50 ) //50<35><30><EFBFBD><EFBFBD> <20>̰<EFBFBD>
{
Ebyte_BTN_FIFO_Push( &BSP_BTN_FIFO, BTN_1_SHORT);
}
else {} //50<35><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ϊ<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Button1_TickCounter=0;
}
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
if( !Ebyte_BSP_ReadButton( BSP_BUTTON_2 ) )
{
Button2_TickCounter++;
}
else
{
if( Button2_TickCounter > 1000 ) // 1<><31> <20><><EFBFBD><EFBFBD>
{
Ebyte_BTN_FIFO_Push( &BSP_BTN_FIFO, BTN_2_LONG);
}
else if( Button2_TickCounter > 50 ) //50<35><30><EFBFBD><EFBFBD> <20>̰<EFBFBD>
{
Ebyte_BTN_FIFO_Push( &BSP_BTN_FIFO, BTN_2_SHORT);
}
else {} //50<35><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ϊ<EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Button2_TickCounter=0;
}
}
/* !
* @brief <20><>ʱ<EFBFBD><CAB1><EFBFBD>ж<EFBFBD> ״̬<D7B4><CCAC> <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>֡
*/
void IT_Timer_UartCheck(void)
{
/* <20><><EFBFBD>ڽ<EFBFBD><DABD>յ<EFBFBD><D5B5><EFBFBD>һ<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD>Ϳ<EFBFBD>ʼ<EFBFBD><CABC>ʱ */
if( Uart_isInRecvState )
{
Uart_TickCounter++;
/* <20><><EFBFBD><EFBFBD>10msû<73>н<EFBFBD><D0BD>յ<EFBFBD><D5B5>ڶ<EFBFBD><DAB6>ֽ<EFBFBD> <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>֡ */
if( Uart_TickCounter > 10 )
{
/* ֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>һ֡ */
Uart_isRecvReady ++;
/* ֹͣ<CDA3><D6B9>ʱ */
Uart_isInRecvState = 0;
Uart_TickCounter = 0;
}
/* <20><>λFIFO<46><4F>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> */
FIFO_TickCounter = 0;
}
else
{
/* <20><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>û<EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡ 500ms<6D><73><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>FIFO<46>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD> */
if( (!Uart_isInRecvState) && Uart_isRecvReady )
{
FIFO_TickCounter++;
if( FIFO_TickCounter > 500)
{
FIFO_isTimeCheckReady=1;
Uart_isRecvReady = 0;
FIFO_TickCounter = 0;
}
}
}
/* <20><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>յ<EFBFBD>1<EFBFBD><31><EFBFBD>ֽھ<D6BD><DABE><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD> */
if( Uart_isInRecvState && Uart_isContinuousRecv )
{
Uart_TickCounter = 0;
Uart_isContinuousRecv = 0;
}
}
/**
* @}
*/
/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/

View File

@ -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.
*
* <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
*/
/* 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****/

View File

@ -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

View File

@ -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();
}