STM32F0xx Standard Peripherals Firmware Library
|
STM32F0xx_StdPeriph_Examples/CAN/CAN_DualFIFO/stm32f0xx_it.c
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file CAN/CAN_DualFIFO/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>© 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 CAN_DualFIFO 00038 * @{ 00039 */ 00040 00041 /* Private typedef -----------------------------------------------------------*/ 00042 /* Private define ------------------------------------------------------------*/ 00043 #define MESSAGE1 "FIFO0 : Msg received" 00044 #define MESSAGE2 "FIFO1 : Msg received" 00045 00046 /* Private macro -------------------------------------------------------------*/ 00047 /* Private variables ---------------------------------------------------------*/ 00048 CanRxMsg RxMessage, RxMessage1; 00049 extern uint8_t KeyNumber; 00050 extern CanTxMsg TxMessage, TxMessage1; 00051 00052 /* Private function prototypes -----------------------------------------------*/ 00053 /* Private functions ---------------------------------------------------------*/ 00054 00055 /******************************************************************************/ 00056 /* Cortex-M0 Processor Exceptions Handlers */ 00057 /******************************************************************************/ 00058 00059 /** 00060 * @brief This function handles NMI exception. 00061 * @param None 00062 * @retval None 00063 */ 00064 void NMI_Handler(void) 00065 { 00066 } 00067 00068 /** 00069 * @brief This function handles Hard Fault exception. 00070 * @param None 00071 * @retval None 00072 */ 00073 void HardFault_Handler(void) 00074 { 00075 /* Go to infinite loop when Hard Fault exception occurs */ 00076 while (1) 00077 { 00078 } 00079 } 00080 00081 /** 00082 * @brief This function handles Memory Manage exception. 00083 * @param None 00084 * @retval None 00085 */ 00086 void MemManage_Handler(void) 00087 { 00088 /* Go to infinite loop when Memory Manage exception occurs */ 00089 while (1) 00090 { 00091 } 00092 } 00093 00094 /** 00095 * @brief This function handles Bus Fault exception. 00096 * @param None 00097 * @retval None 00098 */ 00099 void BusFault_Handler(void) 00100 { 00101 /* Go to infinite loop when Bus Fault exception occurs */ 00102 while (1) 00103 { 00104 } 00105 } 00106 00107 /** 00108 * @brief This function handles Usage Fault exception. 00109 * @param None 00110 * @retval None 00111 */ 00112 void UsageFault_Handler(void) 00113 { 00114 /* Go to infinite loop when Usage Fault exception occurs */ 00115 while (1) 00116 { 00117 } 00118 } 00119 00120 /** 00121 * @brief This function handles SVCall exception. 00122 * @param None 00123 * @retval None 00124 */ 00125 void SVC_Handler(void) 00126 { 00127 } 00128 00129 /** 00130 * @brief This function handles Debug Monitor exception. 00131 * @param None 00132 * @retval None 00133 */ 00134 void DebugMon_Handler(void) 00135 { 00136 } 00137 00138 /** 00139 * @brief This function handles PendSVC exception. 00140 * @param None 00141 * @retval None 00142 */ 00143 void PendSV_Handler(void) 00144 { 00145 } 00146 00147 /** 00148 * @brief This function handles SysTick Handler. 00149 * @param None 00150 * @retval None 00151 */ 00152 void SysTick_Handler(void) 00153 { 00154 } 00155 00156 /******************************************************************************/ 00157 /* STM32F0xx Peripherals Interrupt Handlers */ 00158 /******************************************************************************/ 00159 /** 00160 * @brief This function handles CAN request. 00161 * @param None 00162 * @retval None 00163 */ 00164 void CEC_CAN_IRQHandler(void) 00165 { 00166 if (CAN_MessagePending(CANx, CAN_FIFO0) != 0) 00167 { 00168 /* Set the LCD Back Color */ 00169 LCD_SetBackColor(Green); 00170 /* Set the LCD Text Color */ 00171 LCD_SetTextColor(Black); 00172 /* Displays MESSAGE1 on line 1 */ 00173 LCD_DisplayStringLine(LINE(6), (uint8_t *)MESSAGE1); 00174 00175 CAN_Receive(CANx, CAN_FIFO0, &RxMessage); 00176 LED_Display(RxMessage.Data[0]); 00177 KeyNumber = RxMessage.Data[0]; 00178 } 00179 00180 if (CAN_MessagePending(CANx, CAN_FIFO1) != 0) 00181 { 00182 /* Set the LCD Back Color */ 00183 LCD_SetBackColor(Cyan); 00184 00185 /* Set the LCD Text Color */ 00186 LCD_SetTextColor(Black); 00187 00188 /* Displays MESSAGE1 on line 1 */ 00189 LCD_DisplayStringLine(LINE(6), (uint8_t *)MESSAGE2); 00190 CAN_Receive(CANx, CAN_FIFO1, &RxMessage1); 00191 LED_Display(RxMessage1.Data[0]); 00192 KeyNumber = RxMessage1.Data[0]; 00193 } 00194 00195 } 00196 00197 /** 00198 * @brief This function handles EXTI 6 request. 00199 * @param None 00200 * @retval None 00201 */ 00202 void EXTI4_15_IRQHandler(void) 00203 { 00204 if(KeyNumber < 0x2) 00205 00206 { 00207 KeyNumber = 0x05; 00208 } 00209 LED_Display(--KeyNumber); 00210 00211 TxMessage.Data[0] = KeyNumber; 00212 00213 CAN_Transmit(CANx, &TxMessage); 00214 00215 /* Set the LCD Back Color */ 00216 LCD_SetBackColor(Green); 00217 /* Set the LCD Text Color */ 00218 LCD_SetTextColor(Black); 00219 /* Displays MESSAGE1 on line 6 */ 00220 LCD_DisplayStringLine(LINE(6), (uint8_t *)MESSAGE1); 00221 00222 /* Clear the EXTI line 6 pending bit */ 00223 EXTI_ClearITPendingBit(EXTI_Line13); 00224 } 00225 00226 /** 00227 * @brief This function handles EXTI 10 to 15 request. 00228 * @param None 00229 * @retval None 00230 */ 00231 void EXTI0_1_IRQHandler(void) 00232 { 00233 if(KeyNumber == 0x4) 00234 { 00235 KeyNumber = 0x00; 00236 } 00237 LED_Display(++KeyNumber); 00238 TxMessage1.Data[0] = KeyNumber; 00239 CAN_Transmit(CANx, &TxMessage1); 00240 00241 /* Set the LCD Back Color */ 00242 LCD_SetBackColor(Cyan); 00243 00244 /* Set the LCD Text Color */ 00245 LCD_SetTextColor(Black); 00246 00247 /* Displays MESSAGE1 on line 6 */ 00248 LCD_DisplayStringLine(LINE(6), (uint8_t *)MESSAGE2); 00249 00250 /* Clear the EXTI line 13 pending bit */ 00251 EXTI_ClearITPendingBit(EXTI_Line0); 00252 00253 } 00254 /******************************************************************************/ 00255 /* STM32F0xx Peripherals Interrupt Handlers */ 00256 /******************************************************************************/ 00257 00258 /** 00259 * @brief This function handles PPP interrupt request. 00260 * @param None 00261 * @retval None 00262 */ 00263 /*void PPP_IRQHandler(void) 00264 { 00265 }*/ 00266 00267 /** 00268 * @} 00269 */ 00270 00271 /** 00272 * @} 00273 */ 00274 00275 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/