📄 stm8s_it.c
字号:
/**
******************************************************************************
* @file I2C_Interrupt\stm8s_it.c
* @brief This file contains all the interrupt routines.
* @author STMicroelectronics - MCD Application Team
* @version V1.0.1
* @date 09/22/2008
******************************************************************************
*
* 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>© COPYRIGHT 2008 STMicroelectronics</center></h2>
* @image html logo.bmp
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm8s_it.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
bool DataSent = FALSE;
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/* Public functions ----------------------------------------------------------*/
/** @addtogroup I2C_Interrupt_IT_Functions
* @{
*/
/**
* @brief Dummy interrupt routine
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void NonHandledInterrupt(void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief TRAP interrupt routine
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void TRAP_IRQHandler(void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief Top Level Interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void TLI_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief Auto Wake Up interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void AWU_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief Clock Controller interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void CLK_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief External Interrupt PORTA routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void EXTI_PORTA_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief External Interrupt PORTB routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void EXTI_PORTB_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief External Interrupt PORTC routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void EXTI_PORTC_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief External Interrupt PORTD routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void EXTI_PORTD_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief External Interrupt PORTE routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void EXTI_PORTE_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief CAN RX interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void CAN_RX_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief CAN TX interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void CAN_TX_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief SPI interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void SPI_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief Timer1 Update/Overflow/Trigger/Break interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void TIM1_UPD_OVF_TRG_BRK_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief Timer1 Capture/Compare interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void TIM1_CAP_COM_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief Timer2 Update/Overflow/Break interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void TIM2_UPD_OVF_BRK_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief Timer2 Capture/Compare interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void TIM2_CAP_COM_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief Timer3 Update/Overflow/Break interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void TIM3_UPD_OVF_BRK_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief Timer3 Capture/Compare interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void TIM3_CAP_COM_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief UART1 TX interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void UART1_TX_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief UART1 RX interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void UART1_RX_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief I2C interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@interrupt void I2C_IRQHandler (void)
{
/* Master mode */
if (I2C_GetFlagStatus(I2C_FLAG_MASTERSLAVE))
{
if (I2C_CheckEvent(I2C_EVENT_MASTER_START_SENT) == SUCCESS)
{
/* Send slave Address for write */
I2C_Send7bitAddress(0xA0, I2C_DIRECTION_TX);
}
if (I2C_CheckEvent(I2C_EVENT_MASTER_ADDRESS_ACKED) == SUCCESS)
{
I2C_GetFlagStatus(I2C_FLAG_ADDRESSSENTMATCHED);
I2C_GetFlagStatus(I2C_FLAG_BUSBUSY);
}
if (I2C_CheckEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTED) == SUCCESS)
{
if (DataSent != FALSE)
{
I2C_GenerateSTOP(ENABLE);
DataSent = FALSE;
}
else
{
I2C_SendData(0x5A);
DataSent = TRUE;
}
}
}
/* Slave mode*/
else
{
if (I2C_CheckEvent(I2C_EVENT_SLAVE_ADDRESS_MATCHED) == SUCCESS);
{
I2C_GetFlagStatus(I2C_FLAG_ADDRESSSENTMATCHED);
I2C_GetFlagStatus(I2C_FLAG_BUSBUSY);
}
if (I2C_CheckEvent(I2C_EVENT_SLAVE_BYTE_RECEIVED) == SUCCESS);
{
I2C_ReceiveData();
}
if (I2C_CheckEvent(I2C_EVENT_SLAVE_STOP_DETECTED) == SUCCESS);
{
I2C_ClearITPendingBit(I2C_ITPENDINGBIT_STOPDETECTION);
}
}
}
/**
* @brief UART2 TX interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void UART2_TX_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief UART2 RX interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void UART2_RX_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief UART3 TX interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void UART3_TX_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief UART3 RX interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void UART3_RX_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief ADC1 interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void ADC1_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief ADC2 interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void ADC2_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief Timer4 Update/Overflow interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void TIM4_UPD_OVF_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief Eeprom EEC interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void EEPROM_EEC_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @}
*/
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -