STM32F10x_StdPeriph_Examples/SPI/Simplex_Interrupt/stm32f10x_it.c

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    SPI/Simplex_Interrupt/stm32f10x_it.c 
00004   * @author  MCD Application Team
00005   * @version V3.4.0
00006   * @date    10/15/2010
00007   * @brief   Main Interrupt Service Routines.
00008   *          This file provides template for all exceptions handler and peripherals
00009   *          interrupt service routine.
00010   ******************************************************************************
00011   * @copy
00012   *
00013   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00014   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
00015   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
00016   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
00017   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
00018   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00019   *
00020   * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
00021   */ 
00022 
00023 /* Includes ------------------------------------------------------------------*/
00024 #include "stm32f10x_it.h"
00025 #include "platform_config.h"
00026 
00027 /** @addtogroup STM32F10x_StdPeriph_Examples
00028   * @{
00029   */
00030 
00031 /** @addtogroup SPI_Simplex_Interrupt
00032   * @{
00033   */ 
00034 
00035 /* Private typedef -----------------------------------------------------------*/
00036 /* Private define ------------------------------------------------------------*/
00037 #define BufferSize  32
00038 
00039 /* Private macro -------------------------------------------------------------*/
00040 /* Private variables ---------------------------------------------------------*/
00041 extern __IO uint8_t TxIdx, RxIdx;
00042 extern uint8_t SPI_MASTER_Buffer_Tx[BufferSize], SPI_SLAVE_Buffer_Rx[BufferSize];
00043 
00044 /* Private variables ---------------------------------------------------------*/
00045 /* Private function prototypes -----------------------------------------------*/
00046 /* Private functions ---------------------------------------------------------*/
00047 
00048 /******************************************************************************/
00049 /*            Cortex-M3 Processor Exceptions Handlers                         */
00050 /******************************************************************************/
00051 
00052 /**
00053   * @brief  This function handles NMI exception.
00054   * @param  None
00055   * @retval None
00056   */
00057 void NMI_Handler(void)
00058 {
00059 }
00060 
00061 /**
00062   * @brief  This function handles Hard Fault exception.
00063   * @param  None
00064   * @retval None
00065   */
00066 void HardFault_Handler(void)
00067 {
00068   /* Go to infinite loop when Hard Fault exception occurs */
00069   while (1)
00070   {}
00071 }
00072 
00073 /**
00074   * @brief  This function handles Memory Manage exception.
00075   * @param  None
00076   * @retval None
00077   */
00078 void MemManage_Handler(void)
00079 {
00080   /* Go to infinite loop when Memory Manage exception occurs */
00081   while (1)
00082   {}
00083 }
00084 
00085 /**
00086   * @brief  This function handles Bus Fault exception.
00087   * @param  None
00088   * @retval None
00089   */
00090 void BusFault_Handler(void)
00091 {
00092   /* Go to infinite loop when Bus Fault exception occurs */
00093   while (1)
00094   {}
00095 }
00096 
00097 /**
00098   * @brief  This function handles Usage Fault exception.
00099   * @param  None
00100   * @retval None
00101   */
00102 void UsageFault_Handler(void)
00103 {
00104   /* Go to infinite loop when Usage Fault exception occurs */
00105   while (1)
00106   {}
00107 }
00108 
00109 /**
00110   * @brief  This function handles Debug Monitor exception.
00111   * @param  None
00112   * @retval None
00113   */
00114 void DebugMon_Handler(void)
00115 {}
00116 
00117 /**
00118   * @brief  This function handles SVCall exception.
00119   * @param  None
00120   * @retval None
00121   */
00122 void SVC_Handler(void)
00123 {}
00124 
00125 /**
00126   * @brief  This function handles PendSV_Handler exception.
00127   * @param  None
00128   * @retval None
00129   */
00130 void PendSV_Handler(void)
00131 {}
00132 
00133 /**
00134   * @brief  This function handles SysTick Handler.
00135   * @param  None
00136   * @retval None
00137   */
00138 void SysTick_Handler(void)
00139 {}
00140 
00141 /******************************************************************************/
00142 /*            STM32F10x Peripherals Interrupt Handlers                        */
00143 /******************************************************************************/
00144 
00145 /**
00146   * @brief  This function handles SPI1 or SPI3 global interrupt request.
00147   * @param  None
00148   * @retval None
00149   */
00150 #ifndef  USE_STM3210C_EVAL
00151  void SPI1_IRQHandler(void)
00152 #else
00153  void SPI3_IRQHandler(void)
00154 #endif
00155 {
00156   if (SPI_I2S_GetITStatus(SPI_MASTER, SPI_I2S_IT_TXE) != RESET)
00157   {
00158     /* Send SPI_MASTER data */
00159     SPI_I2S_SendData(SPI_MASTER, SPI_MASTER_Buffer_Tx[TxIdx++]);
00160 
00161     /* Disable SPI_MASTER TXE interrupt */
00162     if (TxIdx == BufferSize)
00163     {
00164       SPI_I2S_ITConfig(SPI_MASTER, SPI_I2S_IT_TXE, DISABLE);
00165     }
00166   }
00167 }
00168 
00169 /**
00170   * @brief  This function handles SPI2 global interrupt request.
00171   * @param  None
00172   * @retval None
00173   */
00174 void SPI2_IRQHandler(void)
00175 {
00176   /* Store SPI_SLAVE received data */
00177   SPI_SLAVE_Buffer_Rx[RxIdx++] = SPI_I2S_ReceiveData(SPI_SLAVE);
00178 }
00179 
00180 /******************************************************************************/
00181 /*                 STM32F10x Peripherals Interrupt Handlers                   */
00182 /*  Add here the Interrupt Handler for the used peripheral(s) (PPP), for the  */
00183 /*  available peripheral interrupt handler's name please refer to the startup */
00184 /*  file (startup_stm32f10x_xx.s).                                            */
00185 /******************************************************************************/
00186 
00187 /**
00188   * @brief  This function handles PPP interrupt request.
00189   * @param  None
00190   * @retval None
00191   */
00192 /*void PPP_IRQHandler(void)
00193 {
00194 }*/
00195 
00196 /**
00197   * @}
00198   */ 
00199 
00200 /**
00201   * @}
00202   */ 
00203 
00204 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32