⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 91x_it.c

📁 本源码是基于STR91的I2C驱动
💻 C
📖 第 1 页 / 共 2 页
字号:
* Return         : None
*******************************************************************************/
void MC_IRQHandler(void)
{
   /*write your handler here*/
   /* ... */
           
   
   /*write any value to VIC0 VAR*/  
   VIC0->VAR = 0xFF;
}
/*******************************************************************************
* Function Name  : ADC_IRQHandler
* Description    : This function handles the ADC interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void ADC_IRQHandler(void)
{
   /*write your handler here*/
   /* ... */
           
   
   /*write any value to VIC0 VAR*/  
   VIC0->VAR = 0xFF;
}
/*******************************************************************************
* Function Name  : UART0_IRQHandler
* Description    : This function handles the UART0 interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void UART0_IRQHandler(void)
{
   /*write your handler here*/
   /* ... */	
    
}
/*******************************************************************************
* Function Name  : UART1_IRQHandler
* Description    : This function handles the UART1 interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void UART1_IRQHandler(void)
{
   /*write your handler here*/
   /* ... */
    
}
/*******************************************************************************
* Function Name  : UART2_IRQHandler
* Description    : This function handles the UART2 interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void UART2_IRQHandler(void)
{
   /*write your handler here*/
   /* ... */
   
}
/*******************************************************************************
* Function Name  : I2C0_IRQHandler
* Description    : This function handles the I2C0 interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void I2C0_IRQHandler(void)
{
   
    switch (I2C_GetLastEvent(I2C0))
  {  	
  	
    case I2C_EVENT_SLAVE_ADDRESS_MATCHED:           // EV1
    break;

    case I2C_EVENT_SLAVE_BYTE_RECEIVED:             // EV2
    I2C0_Buffer_Rx[Rx_Idx++] = I2C_ReceiveData(I2C0);
    break;

    case I2C_EVENT_SLAVE_BYTE_TRANSMITTED:           //only BTF
    if (EV31count ==1)                               //workaround
    {
     I2C_SendData(I2C0, 0xFF);                        
    }
    else
    {
      I2C_SendData(I2C0, I2C0_Buffer_Tx[Tx_Idx]);
      Tx_Idx ++;
    }
    break;

    case I2C_EVENT_SLAVE_ACK_FAILURE:               //only AF (workaround)
    EV31count=1;
    break;  
      
    case I2C_EV31:                                  //AF and BTF received in same interrupt
    I2C_SendData(I2C0, 0xFF); 
    break;

    case I2C_EVENT_SLAVE_STOP_DETECTED:             // EV4
    EV31count = 0;
    Tx_Idx++;
    break;

    default:
    break;
  }	
    
}
/*******************************************************************************
* Function Name  : I2C1_IRQHandler
* Description    : This function handles the I2C1 interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void I2C1_IRQHandler(void)
{
    switch (I2C_GetLastEvent(I2C1))
  {
    case I2C_EVENT_MASTER_MODE_SELECT:             // EV5
      I2C_Send7bitAddress(I2C1, I2C_SLAVE_ADDRESS7, Direction);
      break;

    case I2C_EVENT_MASTER_MODE_SELECTED:           // EV6
      // Clear EV6 by set again the PE bit
      I2C1->CR |=  0x20;
      if (Direction == I2C_MODE_TRANSMITTER)
        I2C_SendData(I2C1, I2C1_Buffer_Tx[Tx_Idx++]);//EV8 just after EV6
      break;

    case I2C_EVENT_MASTER_BYTE_TRANSMITTED:         // EV8
      if ( Tx_Idx == BUFFER_SIZE )
      {
        I2C_GenerateSTOP (I2C1, ENABLE);
      }
      else
      {
        I2C_SendData(I2C1, I2C1_Buffer_Tx[Tx_Idx]);
        Tx_Idx++;
      }
      break;
      
      case I2C_EVENT_MASTER_BYTE_RECEIVED:           // EV7

      if ( Rx_Idx == BUFFER_SIZE-2 )
      {
        /* Send STOP Condition */
        I2C_AcknowledgeConfig (I2C1, DISABLE);
      }   
      if ( Rx_Idx == BUFFER_SIZE-1 )     
      /* Send STOP Condition */
      I2C_GenerateSTOP(I2C1, ENABLE);
      I2C1_Buffer_Rx[Rx_Idx] = I2C_ReceiveData(I2C1);   
      Rx_Idx++;
      
      break;
           
      default:
      break;
   }
 
    
}
/*******************************************************************************
* Function Name  : SSP0_IRQHandler
* Description    : This function handles the SSP0 interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SSP0_IRQHandler(void)
{
   /*write your handler here*/
   /* ... */
    
}
/*******************************************************************************
* Function Name  : SSP1_IRQHandler
* Description    : This function handles the SSP1 interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SSP1_IRQHandler(void)
{
   /*write your handler here*/
   /* ... */
   
}
/*******************************************************************************
* Function Name  : LVD_IRQHandler
* Description    : This function handles the LVD interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void LVD_IRQHandler(void)
{
   /*write your handler here*/
   /* ... */
    
}
/*******************************************************************************
* Function Name  : RTC_IRQHandler
* Description    : This function handles the RTC interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void RTC_IRQHandler(void)
{
   /*write your handler here*/
   /* ... */
   
}
/*******************************************************************************
* Function Name  : WIU_IRQHandler
* Description    : This function handles the WIU interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void WIU_IRQHandler(void)
{

   /*write your handler here*/
   /* ... */
    
}
/*******************************************************************************
* Function Name  : EXTIT0_IRQHandler
* Description    : This function handles the EXTIT0 interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void EXTIT0_IRQHandler(void)
{
   /*write your handler here*/
   /* ... */
    
}
/*******************************************************************************
* Function Name  : EXTIT1_IRQHandler
* Description    : This function handles the EXTIT1 interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void EXTIT1_IRQHandler(void)
{
   /*write your handler here*/
   /* ... */
    
}
/*******************************************************************************
* Function Name  : EXTIT2_IRQHandler
* Description    : This function handles the EXTIT2 interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void EXTIT2_IRQHandler(void)
{
   /*write your handler here*/
   /* ... */
    
}
/*******************************************************************************
* Function Name  : EXTIT3_IRQHandler
* Description    : This function handles the EXTIT3 interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void EXTIT3_IRQHandler(void)
{ 
   /*write your handler here*/
   /* ... */
  
}
/*******************************************************************************
* Function Name  : USBWU_IRQHandler
* Description    : This function handles the USBWU interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void USBWU_IRQHandler(void)
{ 
   /*write your handler here*/
   /* ... */
    
}
/*******************************************************************************
* Function Name  : PFQBC_IRQHandler
* Description    : This function handles the PFQBC interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void PFQBC_IRQHandler(void)
{
   /*write your handler here*/
   /* ... */
    
}

/*******************************************************************************
* Function Name  : Dummy_Handler
* Description    : This function is used for handling a case of spurious interrupt
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void DefaultVector_Handler(void)
{
    /* Write any value to VICs	*/
    VIC0->VAR = 0xFF;
    VIC1->VAR = 0xFF;	
}

/******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -