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

📄 91x_it.c

📁 万利ARM9的STR912开发板配套资料和源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
* File Name          : 91x_it.c
* Author             : MCD Application Team
* Date First Issued  : 03/31/2006 :  Beta Version V0.1
* Description        : Main Interrupt Service Routines.
********************************************************************************
*    This file can be used to describe all the exceptions subroutines
*    that may occur within user application.
*    When an interrupt happens, the software will branch automatically
*    to the corresponding routine according to the interrupt vector
*    loaded in the PC register.
*    The following routines are all empty, user can write code for
*    exceptions handlers and peripherals IRQ interrupts.
********************************************************************************
* History:
* 03/31/2006 :  Beta Version V0.1
********************************************************************************
* THE PRESENT SOFTWARE 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 SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
* CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*******************************************************************************/
#include "91x_it.h"
#include "main.h"
#include "wavedata.h"
#include "alarmwavedata.h"

  vu32 index = 0;
  u8 LedIndex = 0;
  u16 Pulse = 0;
  u16 LedPulse = 0;
  bool AlarmStatus = FALSE;   /* Detect if an alarm is occurred */
  extern bool LedShowStatus;  /* Led show global Status */
  extern vu16 PlayIntroDelay; /* Play Intro delay: 2sec */
  extern void USB_Istr(void);

/*******************************************************************************
* Function Name  : Undefined_Handler
* Description    : This function Undefined instruction exception.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void Undefined_Handler(void)
{
}
/*******************************************************************************
* Function Name  : SWI_Handler
* Description    : This function handles SW exception.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SWI_Handler(void)
{
}
/*******************************************************************************
* Function Name  : Prefetch_Handler
* Description    : This function handles preftetch abort exception.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void Prefetch_Handler(void)
{
}
/*******************************************************************************
* Function Name  : Abort_Handler
* Description    : This function handles data abort exception.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void Abort_Handler(void)
{
}
/*******************************************************************************
* Function Name  : FIQ_Handler
* Description    : This function handles FIQ exception.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void FIQ_Handler(void)
{
}
/*******************************************************************************
* Function Name  : WDG_IRQHandler
* Description    : This function handles the WDG interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void WDG_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name  : SW_IRQHandler
* Description    : This function handles the SW interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SW_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name  : ARMRX_IRQHandler
* Description    : This function handles the ARMRX interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void ARMRX_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name  : ARMTX_IRQHandler
* Description    : This function handles the ARMTX interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void ARMTX_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name  : TIM0_IRQHandler
* Description    : This function handles the TIM0 interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM0_IRQHandler(void)
{
  Pulse += 0x440;
  /* Play the Alarm Wave */
  if(AlarmStatus != FALSE)
  {
    TIM_SetPulse(TIM3, TIM_PWM_OC1_Channel, AlarmWaveData[index++]);
    if(index == AlarmWaveDataLength)
    {
      WavePlayerAlarm_Stop();
      index = 0;
    }
  }
  /* Play OSIRIS wave */
  else
  {
    TIM_SetPulse(TIM3, TIM_PWM_OC1_Channel, WaveData[index++]);
    if(index == WaveDataLength)
    {
      index = 0;
      WavePlayer_Stop();
    }
  }
  /* Set the TIM0 OC1 value */
  TIM_SetPulse(TIM0, TIM_PWM_OC1_Channel, Pulse);
  /* Clear the TIM OC1 flag */
  TIM_ClearFlag(TIM0, TIM_FLAG_OC1);
}
/*******************************************************************************
* Function Name  : TIM1_IRQHandler
* Description    : This function handles the TIM1 interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM1_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name  : TIM2_IRQHandler
* Description    : This function handles the TIM2 interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM2_IRQHandler(void)
{
  LedPulse += 0x493E;

  /* If LedShowStatus is TRUE: enable leds toggling */
  if(LedShowStatus)
  {
    switch(LedIndex)
    {
      /* LD5 turned on, LD2 turned off */
      case 0:
      {
        GPIO_WriteBit(GPIO9, GPIO_Pin_3, Bit_RESET);
        GPIO_WriteBit(GPIO9, GPIO_Pin_0, Bit_SET);
        LedIndex++;
        break;
      }
      /* LD2 turned on, LD3 turned off */
      case 1:
      {
        GPIO_WriteBit(GPIO9, GPIO_Pin_0, Bit_RESET);
        GPIO_WriteBit(GPIO9, GPIO_Pin_1, Bit_SET);
        LedIndex++;
        break;
      }
      /* LD3 turned on, LD4 turned off */
      case 2:
      {

        GPIO_WriteBit(GPIO9, GPIO_Pin_1, Bit_RESET);
        GPIO_WriteBit(GPIO9, GPIO_Pin_2, Bit_SET);
        LedIndex++;
        break;
      }
      /* LD3 turned on, LD4 turned off */
      case 3:
      {
        GPIO_WriteBit(GPIO9, GPIO_Pin_2, Bit_RESET);
        GPIO_WriteBit(GPIO9, GPIO_Pin_3, Bit_SET);
        LedIndex++;
        break;
      }
    }
    /* Reset Index to replay leds switch on sequence  */
    if(LedIndex == 4)
      LedIndex = 0;
  }

  /* Decrement PlayIntroDelay counter */
  PlayIntroDelay--;

  TIM_SetPulse(TIM2, TIM_PWM_OC1_Channel, LedPulse);

  TIM_ClearFlag(TIM2, TIM_FLAG_OC1);
}
/*******************************************************************************
* Function Name  : TIM3_IRQHandler
* Description    : This function handles the TIM3 interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM3_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name  : USBHP_IRQHandler
* Description    : This function handles the USBHP interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void USBHP_IRQHandler(void)
{
}
/*******************************************************************************
* Function Name  : USBLP_IRQHandler
* Description    : This function handles the USBLP interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void USBLP_IRQHandler(void)
{
  USB_Istr();
}
/*******************************************************************************
* Function Name  : SCU_IRQHandler

⌨️ 快捷键说明

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