STM32F0xx Standard Peripherals Firmware Library: stm32f0xx_it.c Source File

STM32F0xx Standard Peripherals Library

STM32F0xx_StdPeriph_Examples/RTC/RTC_LSI/stm32f0xx_it.c
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    RTC/RTC_LSI/stm32f0xx_it.c 
00004   * @author  MCD Application Team
00005   * @version V1.4.0
00006   * @date    24-July-2014
00007   * @brief   Main Interrupt Service Routines.
00008   *          This file provides template for all exceptions handler and 
00009   *          peripherals interrupt service routine.
00010   ******************************************************************************
00011   * @attention
00012   *
00013   * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
00014   *
00015   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
00016   * You may not use this file except in compliance with the License.
00017   * You may obtain a copy of the License at:
00018   *
00019   *        http://www.st.com/software_license_agreement_liberty_v2
00020   *
00021   * Unless required by applicable law or agreed to in writing, software 
00022   * distributed under the License is distributed on an "AS IS" BASIS, 
00023   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00024   * See the License for the specific language governing permissions and
00025   * limitations under the License.
00026   *
00027   ******************************************************************************
00028   */
00029 
00030 /* Includes ------------------------------------------------------------------*/
00031 #include "stm32f0xx_it.h"
00032 
00033 /** @addtogroup STM32F0xx_StdPeriph_Examples
00034   * @{
00035   */
00036 
00037 /** @addtogroup RTC_LSI
00038   * @{
00039   */
00040 
00041 /* Private typedef -----------------------------------------------------------*/
00042 /* Private define ------------------------------------------------------------*/
00043 /* Private macro -------------------------------------------------------------*/
00044 /* Private variables ---------------------------------------------------------*/
00045 extern __IO uint32_t CaptureNumber, PeriodValue;
00046 uint32_t IC1ReadValue1 = 0, IC1ReadValue2 =0;
00047 
00048 /* Private function prototypes -----------------------------------------------*/
00049 /* Private functions ---------------------------------------------------------*/
00050 
00051 /******************************************************************************/
00052 /*            Cortex-M0 Processor Exceptions Handlers                         */
00053 /******************************************************************************/
00054 
00055 /**
00056   * @brief  This function handles NMI exception.
00057   * @param  None
00058   * @retval None
00059   */
00060 void NMI_Handler(void)
00061 {
00062 }
00063 
00064 /**
00065   * @brief  This function handles Hard Fault exception.
00066   * @param  None
00067   * @retval None
00068   */
00069 void HardFault_Handler(void)
00070 {
00071   /* Go to infinite loop when Hard Fault exception occurs */
00072   while (1)
00073   {
00074   }
00075 }
00076 
00077 /**
00078   * @brief  This function handles SVCall exception.
00079   * @param  None
00080   * @retval None
00081   */
00082 void SVC_Handler(void)
00083 {
00084 }
00085 
00086 /**
00087   * @brief  This function handles PendSVC exception.
00088   * @param  None
00089   * @retval None
00090   */
00091 void PendSV_Handler(void)
00092 {
00093 }
00094 
00095 /**
00096   * @brief  This function handles SysTick Handler.
00097   * @param  None
00098   * @retval None
00099   */
00100 void SysTick_Handler(void)
00101 {
00102 }
00103 
00104 /******************************************************************************/
00105 /*                 STM32F0xx Peripherals Interrupt Handlers                   */
00106 /******************************************************************************/
00107 /**
00108   * @brief  This function handles TIM14 global interrupt request.
00109   * @param  None
00110   * @retval None
00111   */
00112 void TIM14_IRQHandler(void)
00113 {
00114   if (TIM_GetITStatus(TIM14, TIM_IT_CC1) != RESET)
00115   {
00116     /* Clear TIM14 Capture Compare 1 interrupt pending bit */
00117     TIM_ClearITPendingBit(TIM14, TIM_IT_CC1);
00118     
00119     if(CaptureNumber == 0)
00120     {
00121       /* Get the Input Capture value */
00122       IC1ReadValue1 = TIM_GetCapture1(TIM14);
00123       CaptureNumber = 1;
00124     }
00125     else if(CaptureNumber == 1)
00126     {
00127        /* Get the Input Capture value */
00128        IC1ReadValue2 = TIM_GetCapture1(TIM14); 
00129        TIM_ITConfig(TIM14, TIM_IT_CC1, DISABLE);
00130 
00131        /* Capture computation */
00132        if (IC1ReadValue2 > IC1ReadValue1)
00133        {
00134          PeriodValue = (IC1ReadValue2 - IC1ReadValue1);
00135        }
00136        else
00137        {
00138          PeriodValue = ((0xFFFF - IC1ReadValue1) + IC1ReadValue2);
00139        }
00140        /* capture of two values is done */
00141        CaptureNumber = 2;
00142     }
00143   }
00144 }
00145 
00146 /**
00147   * @brief  This function handles RTC Wakeup global interrupt request.
00148   * @param  None
00149   * @retval None
00150   */
00151 void RTC_IRQHandler(void)
00152 {
00153   if(RTC_GetITStatus(RTC_IT_ALRA) != RESET)
00154   {
00155     RTC_TimeTypeDef RTC_TimeStructure;
00156     /* Toggle on LED1 */
00157     STM_EVAL_LEDToggle(LED1);
00158     
00159     /* Set the time to 00h 00mn 00s AM */
00160     RTC_TimeStructure.RTC_H12     = RTC_H12_AM;
00161     RTC_TimeStructure.RTC_Hours   = 0x00;
00162     RTC_TimeStructure.RTC_Minutes = 0x00;
00163     RTC_TimeStructure.RTC_Seconds = 0x00;  
00164   
00165     RTC_SetTime(RTC_Format_BCD, &RTC_TimeStructure);
00166     
00167     RTC_ClearITPendingBit(RTC_IT_ALRA);
00168     EXTI_ClearITPendingBit(EXTI_Line17);
00169   } 
00170 }
00171 
00172 /******************************************************************************/
00173 /*                 STM32F0xx Peripherals Interrupt Handlers                   */
00174 /*  Add here the Interrupt Handler for the used peripheral(s) (PPP), for the  */
00175 /*  available peripheral interrupt handler's name please refer to the startup */
00176 /*  file (startup_stm32f0xx.s).                                               */
00177 /******************************************************************************/
00178 
00179 /**
00180   * @brief  This function handles PPP interrupt request.
00181   * @param  None
00182   * @retval None
00183   */
00184 /*void PPP_IRQHandler(void)
00185 {
00186 }*/
00187 
00188 /**
00189   * @}
00190   */
00191 
00192 /**
00193   * @}
00194   */
00195 
00196 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
STM32L1xx Standard Peripherals Library: Footer

 

 

 For complete documentation on STM32 Microcontrollers visit www.st.com/STM32