STM32F0xx Standard Peripherals Firmware Library: main.c Source File

STM32F0xx Standard Peripherals Library

STM32F0xx_StdPeriph_Examples/SPI/SPI_TwoBoards/DataExchangeInterrupt/main.c
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    SPI/SPI_TwoBoards/DataExchangeInterrupt/main.c
00004   * @author  MCD Application Team
00005   * @version V1.4.0
00006   * @date    24-July-2014
00007   * @brief   Main program body
00008   ******************************************************************************
00009   * @attention
00010   *
00011   * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
00012   *
00013   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
00014   * You may not use this file except in compliance with the License.
00015   * You may obtain a copy of the License at:
00016   *
00017   *        http://www.st.com/software_license_agreement_liberty_v2
00018   *
00019   * Unless required by applicable law or agreed to in writing, software 
00020   * distributed under the License is distributed on an "AS IS" BASIS, 
00021   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00022   * See the License for the specific language governing permissions and
00023   * limitations under the License.
00024   *
00025   ******************************************************************************
00026   */
00027 
00028 /* Includes ------------------------------------------------------------------*/
00029 #include "main.h"
00030 
00031 /** @addtogroup STM32F0xx_StdPeriph_Examples
00032   * @{
00033   */
00034 
00035 /** @addtogroup SPI_DataExchangeInterrupt
00036   * @{
00037   */
00038 
00039 /* Private typedef -----------------------------------------------------------*/
00040 /* Private define ------------------------------------------------------------*/
00041 /* Private macro -------------------------------------------------------------*/
00042 /* Private variables ---------------------------------------------------------*/
00043 SPI_InitTypeDef  SPI_InitStructure;
00044 
00045 uint8_t TxBuffer[] = "SPI Interrupt Example: Communication between two SPI using Interrupts";
00046 uint8_t RxBuffer [RXBUFFERSIZE];
00047 
00048 __IO uint8_t Rx_Idx = 0x00;
00049 __IO uint8_t Tx_Idx = 0x00;
00050 
00051 __IO JOYState_TypeDef PressedButton  = JOY_NONE;
00052 __IO uint8_t CmdTransmitted = 0x00;
00053 __IO uint8_t CmdReceived = 0x00;
00054 __IO uint8_t CmdStatus = 0x00;
00055 __IO uint32_t TimeOut = 0x0;
00056 
00057 /* Private function prototypes -----------------------------------------------*/
00058 static void SPI_Config(void);
00059 static void SysTickConfig(void);
00060 static void TimeOut_UserCallback(void);
00061 static TestStatus Buffercmp(uint8_t* pBuffer1, uint8_t* pBuffer2, uint16_t BufferLength, uint8_t DataMask);
00062 static void Fill_Buffer(uint8_t *pBuffer, uint16_t BufferLength);
00063 #ifdef SPI_MASTER
00064 static JOYState_TypeDef Read_Joystick(void);
00065 #endif
00066 
00067 /* Private functions ---------------------------------------------------------*/
00068 
00069 /**
00070   * @brief  Main program.
00071   * @param  None
00072   * @retval None
00073   */
00074 int main(void)
00075 {
00076   /*!< At this stage the microcontroller clock setting is already configured, 
00077   this is done through SystemInit() function which is called from startup
00078   file (startup_stm32f0xx.s) before to branch to application main.
00079   To reconfigure the default setting of SystemInit() function, refer to
00080   system_stm32f0xx.c file
00081   */ 
00082   
00083   /* SPI configuration ------------------------------------------------------*/
00084   SPI_Config();
00085   
00086   /* SysTick configuration ---------------------------------------------------*/
00087   SysTickConfig();
00088   
00089   /* Initialize LEDs mounted on STM320518-EVAL board */
00090   STM_EVAL_LEDInit(LED1);
00091   STM_EVAL_LEDInit(LED2);
00092   STM_EVAL_LEDInit(LED3);
00093   STM_EVAL_LEDInit(LED4);
00094   
00095   /* Master board configuration ------------------------------------------------*/
00096 #ifdef SPI_MASTER
00097   /* Initialize push-buttons mounted on STM320518-EVAL board */
00098   STM_EVAL_PBInit(BUTTON_RIGHT, BUTTON_MODE_GPIO);
00099   STM_EVAL_PBInit(BUTTON_LEFT, BUTTON_MODE_GPIO);
00100   STM_EVAL_PBInit(BUTTON_UP, BUTTON_MODE_GPIO);
00101   STM_EVAL_PBInit(BUTTON_DOWN, BUTTON_MODE_GPIO);
00102   STM_EVAL_PBInit(BUTTON_SEL, BUTTON_MODE_GPIO);
00103   
00104   /* Initializes the SPI communication */
00105   SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
00106   SPI_Init(SPIx, &SPI_InitStructure);
00107   
00108   /* Initialize the FIFO threshold */
00109   SPI_RxFIFOThresholdConfig(SPIx, SPI_RxFIFOThreshold_QF);
00110   
00111   /* Enable the Rx buffer not empty interrupt */
00112   SPI_I2S_ITConfig(SPIx, SPI_I2S_IT_RXNE, ENABLE);
00113   /* Enable the SPI Error interrupt */
00114   SPI_I2S_ITConfig(SPIx, SPI_I2S_IT_ERR, ENABLE);
00115   /* Data transfer is performed in the SPI interrupt routine */
00116   
00117   /* Enable the SPI peripheral */
00118   SPI_Cmd(SPIx, ENABLE);
00119   
00120   while (1)
00121   {   
00122     CmdTransmitted = 0x00;
00123     CmdReceived = 0x00;
00124     CmdStatus = 0x00;
00125     Tx_Idx = 0x00;
00126     Rx_Idx = 0x00;
00127     
00128     /* Clear the RxBuffer */
00129     Fill_Buffer(RxBuffer, TXBUFFERSIZE);
00130     PressedButton = Read_Joystick();
00131     
00132     while (PressedButton == JOY_NONE)
00133     {
00134       PressedButton = Read_Joystick();
00135     }    
00136     
00137     switch (PressedButton)
00138     {
00139       /* JOY_RIGHT button pressed */
00140     case JOY_RIGHT:
00141       CmdTransmitted = CMD_RIGHT;
00142       break;
00143       /* JOY_LEFT button pressed */ 
00144     case JOY_LEFT:
00145       CmdTransmitted = CMD_LEFT;
00146       break;
00147       /* JOY_UP button pressed */
00148     case JOY_UP:
00149       CmdTransmitted = CMD_UP;
00150       break;
00151       /* JOY_DOWN button pressed */
00152     case JOY_DOWN:
00153       CmdTransmitted = CMD_DOWN;
00154       break;
00155       /* JOY_SEL button pressed */
00156     case JOY_SEL:
00157       CmdTransmitted = CMD_SEL;
00158       break;
00159     default:
00160       break;
00161     }
00162     
00163     if (CmdTransmitted != 0x00)
00164     {    
00165       /* Enable the Tx buffer empty interrupt */
00166       SPI_I2S_ITConfig(SPIx, SPI_I2S_IT_TXE, ENABLE);
00167       
00168       /* Wait until end of data transfer or time out*/
00169       TimeOut = USER_TIMEOUT;
00170       while ((Rx_Idx < DATA_SIZE)&&(TimeOut != 0x00))
00171       {}
00172       if(TimeOut == 0)
00173       {
00174         TimeOut_UserCallback();
00175       } 
00176     }
00177     
00178     /* Waiting until TX FIFO is empty */
00179     while (SPI_GetTransmissionFIFOStatus(SPIx) != SPI_TransmissionFIFOStatus_Empty)
00180     {}
00181     
00182     /* Wait busy flag */
00183     while(SPI_I2S_GetFlagStatus(SPIx, SPI_I2S_FLAG_BSY) == SET)
00184     {}
00185     
00186     /* Waiting until RX FIFO is empty */
00187     while (SPI_GetReceptionFIFOStatus(SPIx) != SPI_ReceptionFIFOStatus_Empty)
00188     {}
00189     
00190     switch (CmdTransmitted)
00191     {
00192       /* Right button pressed */
00193     case CMD_RIGHT:
00194       if ((Buffercmp(TxBuffer, RxBuffer, DATA_SIZE, SPI_DATAMASK) == PASSED) && (CmdReceived == CMD_ACK))
00195       {
00196         /* Turn ON LED2 and LED3 */
00197         STM_EVAL_LEDOn(LED2);
00198         STM_EVAL_LEDOn(LED3);
00199         /* Turn all other LEDs off */
00200         STM_EVAL_LEDOff(LED4);
00201       }
00202       break;
00203       /* Left button pressed*/
00204     case CMD_LEFT:
00205       if ((Buffercmp(TxBuffer, RxBuffer, DATA_SIZE, SPI_DATAMASK) == PASSED) && (CmdReceived == CMD_ACK))
00206       {
00207         /* Turn ON LED4 */
00208         STM_EVAL_LEDOn(LED4);
00209         /* Turn all other LEDs off */
00210         STM_EVAL_LEDOff(LED2);
00211         STM_EVAL_LEDOff(LED3);
00212       }
00213       break;
00214       /* Up button pressed */
00215     case CMD_UP:
00216       if ((Buffercmp(TxBuffer, RxBuffer, DATA_SIZE, SPI_DATAMASK) == PASSED) && (CmdReceived == CMD_ACK))
00217       {
00218         /* Turn ON LED2 */
00219         STM_EVAL_LEDOn(LED2);
00220         /* Turn all other LEDs off */
00221         STM_EVAL_LEDOff(LED3);
00222         STM_EVAL_LEDOff(LED4);
00223       }
00224       break;
00225       /* Down button pressed */
00226     case CMD_DOWN:
00227       if ((Buffercmp(TxBuffer, RxBuffer, DATA_SIZE, SPI_DATAMASK) == PASSED) && (CmdReceived == CMD_ACK))
00228       {
00229         /* Turn ON LED3 */
00230         STM_EVAL_LEDOn(LED3);
00231         /* Turn all other LEDs off */
00232         STM_EVAL_LEDOff(LED2);
00233         STM_EVAL_LEDOff(LED4);
00234       }
00235       break;
00236       /* Sel button pressed */
00237     case CMD_SEL:
00238       if ((Buffercmp(TxBuffer, RxBuffer, DATA_SIZE, SPI_DATAMASK) == PASSED) && (CmdReceived == CMD_ACK))
00239       {
00240         /* Turn ON all LEDs */
00241         STM_EVAL_LEDOn(LED2);
00242         STM_EVAL_LEDOn(LED3);
00243         STM_EVAL_LEDOn(LED4);
00244       }
00245       break;
00246     default:
00247       break;
00248     }        
00249   }
00250 #endif /* SPI_MASTER */
00251   
00252   /* Slave board configuration ----------------------------------------------*/
00253 #ifdef SPI_SLAVE
00254   /* Initializes the SPI communication */
00255   SPI_I2S_DeInit(SPIx);
00256   SPI_InitStructure.SPI_Mode = SPI_Mode_Slave;
00257   SPI_Init(SPIx, &SPI_InitStructure);
00258   
00259   /* Initialize the FIFO threshold */
00260   SPI_RxFIFOThresholdConfig(SPIx, SPI_RxFIFOThreshold_QF);
00261   
00262   /* Enable the Rx buffer not empty interrupt */
00263   SPI_I2S_ITConfig(SPIx, SPI_I2S_IT_RXNE, ENABLE);
00264   
00265   /* Enable the SPI Error interrupt */
00266   SPI_I2S_ITConfig(SPIx, SPI_I2S_IT_ERR, ENABLE);
00267   
00268   /* Enable the SPI peripheral */
00269   SPI_Cmd(SPIx, ENABLE);
00270   
00271   /* Infinite Loop */
00272   while (1)
00273   {     
00274     CmdStatus = 0x00;
00275     CmdReceived = 0x00;
00276     Rx_Idx = 0x00;
00277     Tx_Idx = 0x00;
00278     
00279     /* Write the first data in SPI shift register before enabling the interrupt
00280     this data will be transmitted when the Slave receive the generated clock
00281     by the Master */    
00282     /* Enable the Tx buffer empty interrupt */
00283     SPI_SendData8(SPIx, CMD_ACK);
00284     SPI_I2S_ITConfig(SPIx, SPI_I2S_IT_TXE, ENABLE);
00285     
00286     /* Waiting Transaction code Byte */
00287     while (CmdStatus == 0x00)
00288     {}
00289     
00290     TimeOut = USER_TIMEOUT;
00291     while ((Rx_Idx < DATA_SIZE)&&(TimeOut != 0x00))
00292     {}
00293     if(TimeOut == 0)
00294     {
00295       TimeOut_UserCallback();
00296     }    
00297     
00298     switch (CmdReceived)
00299     {
00300       /* CMD_RIGHT command received or time out*/
00301     case CMD_RIGHT:
00302       if (Buffercmp(TxBuffer, RxBuffer, DATA_SIZE, SPI_DATAMASK) != FAILED) 
00303       {
00304         /* Turn ON LED2 and LED3 */
00305         STM_EVAL_LEDOn(LED2);
00306         STM_EVAL_LEDOn(LED3);
00307         /* Turn OFF LED4 */
00308         STM_EVAL_LEDOff(LED4);
00309       }
00310       break;
00311       /* CMD_LEFT command received or time out */
00312     case CMD_LEFT:
00313       if (Buffercmp(TxBuffer, RxBuffer, DATA_SIZE, SPI_DATAMASK) != FAILED)
00314       {
00315         /* Turn ON LED4 */
00316         STM_EVAL_LEDOn(LED4);
00317         /* Turn OFF LED2 and LED3 */
00318         STM_EVAL_LEDOff(LED2);
00319         STM_EVAL_LEDOff(LED3);
00320       }
00321       break;
00322       /* CMD_UP command received or time out*/
00323     case CMD_UP:
00324       if (Buffercmp(TxBuffer, RxBuffer, DATA_SIZE, SPI_DATAMASK) != FAILED)
00325       {
00326         /* Turn ON LED2 */
00327         STM_EVAL_LEDOn(LED2);
00328         /* Turn OFF LED3 and LED4 */
00329         STM_EVAL_LEDOff(LED3);
00330         STM_EVAL_LEDOff(LED4);
00331       }
00332       break;
00333       /* CMD_DOWN command received or time out */
00334     case CMD_DOWN:
00335       if (Buffercmp(TxBuffer, RxBuffer, DATA_SIZE, SPI_DATAMASK) != FAILED)
00336       {
00337         /* Turn ON LED3 */
00338         STM_EVAL_LEDOn(LED3);
00339         /* Turn OFF LED2 and LED4 */
00340         STM_EVAL_LEDOff(LED2);
00341         STM_EVAL_LEDOff(LED4);
00342       }
00343       break;
00344       /* CMD_SEL command received or time out */
00345     case CMD_SEL:
00346       if (Buffercmp(TxBuffer, RxBuffer, DATA_SIZE, SPI_DATAMASK) != FAILED)
00347       {
00348         /* Turn ON LED2, LED3 and LED4 */
00349         STM_EVAL_LEDOn(LED2);
00350         STM_EVAL_LEDOn(LED3);
00351         STM_EVAL_LEDOn(LED4);
00352       }
00353       break;
00354     default:
00355       break;   
00356     }
00357     
00358     /* Clear the RxBuffer */
00359     Fill_Buffer(RxBuffer, TXBUFFERSIZE);
00360     
00361     /* Waiting until TX FIFO is empty */
00362     while (SPI_GetTransmissionFIFOStatus(SPIx) != SPI_TransmissionFIFOStatus_Empty)
00363     {}    
00364     
00365     /* Wait busy flag */
00366     while(SPI_I2S_GetFlagStatus(SPIx, SPI_I2S_FLAG_BSY) == SET)
00367     {}
00368     
00369     /* Disable the Tx buffer empty interrupt */
00370     SPI_I2S_ITConfig(SPIx, SPI_I2S_IT_TXE, DISABLE);
00371     
00372     /* Waiting until RX FIFO is empty */
00373     while (SPI_GetReceptionFIFOStatus(SPIx) != SPI_ReceptionFIFOStatus_Empty)
00374     {} 
00375     
00376   }
00377 #endif /* SPI_SLAVE */
00378 
00379 }
00380 
00381 /**
00382   * @brief  Returns NbrOfDataToTransfer value.
00383   * @param  None
00384   * @retval Tx Buffer Size (NbrOfDataToTransfer1).
00385   */
00386 uint8_t GetVar_NbrOfData(void)
00387 {
00388   return DATA_SIZE;
00389 }
00390 
00391 /**
00392 * @brief  Basic management of the timeout situation.
00393 * @param  None.
00394 * @retval None.
00395 */
00396 static void TimeOut_UserCallback(void)
00397 {
00398   /* User can add his own implementation to manage TimeOut Communication failure */
00399   /* Block communication and all processes */
00400   while (1)
00401   {   
00402   }
00403 }
00404 
00405 /**
00406   * @brief  Configures the SPI Peripheral.
00407   * @param  None
00408   * @retval None
00409   */
00410 static void SPI_Config(void)
00411 {
00412   GPIO_InitTypeDef GPIO_InitStructure;
00413   NVIC_InitTypeDef NVIC_InitStructure;
00414   
00415   /* Enable the SPI periph */
00416   RCC_APB2PeriphClockCmd(SPIx_CLK, ENABLE);
00417   
00418   /* Enable SCK, MOSI, MISO and NSS GPIO clocks */
00419   RCC_AHBPeriphClockCmd(SPIx_SCK_GPIO_CLK | SPIx_MISO_GPIO_CLK | SPIx_MOSI_GPIO_CLK, ENABLE);
00420   
00421   GPIO_PinAFConfig(SPIx_SCK_GPIO_PORT, SPIx_SCK_SOURCE, SPIx_SCK_AF);
00422   GPIO_PinAFConfig(SPIx_MOSI_GPIO_PORT, SPIx_MOSI_SOURCE, SPIx_MOSI_AF);
00423   GPIO_PinAFConfig(SPIx_MISO_GPIO_PORT, SPIx_MISO_SOURCE, SPIx_MISO_AF);
00424   
00425   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
00426   GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
00427   GPIO_InitStructure.GPIO_PuPd  = GPIO_PuPd_DOWN;
00428   GPIO_InitStructure.GPIO_Speed = GPIO_Speed_Level_3;
00429 
00430   /* SPI SCK pin configuration */
00431   GPIO_InitStructure.GPIO_Pin = SPIx_SCK_PIN;
00432   GPIO_Init(SPIx_SCK_GPIO_PORT, &GPIO_InitStructure);
00433 
00434   /* SPI  MOSI pin configuration */
00435   GPIO_InitStructure.GPIO_Pin =  SPIx_MOSI_PIN;
00436   GPIO_Init(SPIx_MOSI_GPIO_PORT, &GPIO_InitStructure);
00437 
00438   /* SPI MISO pin configuration */
00439   GPIO_InitStructure.GPIO_Pin = SPIx_MISO_PIN;
00440   GPIO_Init(SPIx_MISO_GPIO_PORT, &GPIO_InitStructure);
00441   
00442   /* SPI configuration -------------------------------------------------------*/
00443   SPI_I2S_DeInit(SPIx);
00444   SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
00445   SPI_InitStructure.SPI_DataSize = SPI_DATASIZE;
00446   SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;
00447   SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
00448   SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
00449   SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_4;
00450   SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
00451   SPI_InitStructure.SPI_CRCPolynomial = 7;
00452    
00453   /* Configure the SPI interrupt priority */
00454   NVIC_InitStructure.NVIC_IRQChannel = SPIx_IRQn;
00455   NVIC_InitStructure.NVIC_IRQChannelPriority = 1;
00456   NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
00457   NVIC_Init(&NVIC_InitStructure);
00458 }
00459 
00460 /**
00461   * @brief  Configure a SysTick Base time to 10 ms.
00462   * @param  None
00463   * @retval None
00464   */
00465 static void SysTickConfig(void)
00466 {
00467   /* Setup SysTick Timer for 10ms interrupts  */
00468   if (SysTick_Config(SystemCoreClock / 100))
00469   {
00470     /* Capture error */
00471     while (1);
00472   }
00473 
00474   /* Configure the SysTick handler priority */
00475   NVIC_SetPriority(SysTick_IRQn, 0x0);
00476 }
00477 
00478 /**
00479   * @brief  Compares two buffers.
00480   * @param  pBuffer1, pBuffer2: buffers to be compared.
00481   * @param  BufferLength: buffer's length
00482   * @retval PASSED: pBuffer1 identical to pBuffer2
00483   *         FAILED: pBuffer1 differs from pBuffer2
00484   */
00485 static TestStatus Buffercmp(uint8_t* pBuffer1, uint8_t* pBuffer2, uint16_t BufferLength, uint8_t DataMask)
00486 {
00487   while (BufferLength--)
00488   {
00489     if (((*pBuffer1) & DataMask) != *pBuffer2)
00490     {
00491       return FAILED;
00492     }
00493     pBuffer1++;
00494     pBuffer2++;
00495   }
00496 
00497   return PASSED;
00498 }
00499 
00500 /**
00501   * @brief  Fills buffer.
00502   * @param  pBuffer: pointer on the Buffer to fill
00503   * @param  BufferLength: size of the buffer to fill
00504   * @retval None
00505   */
00506 static void Fill_Buffer(uint8_t *pBuffer, uint16_t BufferLength)
00507 {
00508   uint16_t index = 0;
00509 
00510   /* Put in global buffer same values */
00511   for (index = 0; index < BufferLength; index++ )
00512   {
00513     pBuffer[index] = 0x00;
00514   }
00515 }
00516 
00517 #ifdef SPI_MASTER
00518 /**
00519 * @brief  Reads key from evaluationboard.
00520 * @param  None
00521 * @retval Return JOY_RIGHT, JOY_LEFT, JOY_SEL, JOY_UP, JOY_DOWN or JOY_NONE
00522 */
00523 static JOYState_TypeDef Read_Joystick(void)
00524 {
00525   /* "JOY_RIGHT" key is pressed */
00526   if (STM_EVAL_PBGetState(BUTTON_RIGHT))
00527   {
00528     while (STM_EVAL_PBGetState(BUTTON_RIGHT) == RESET)
00529     {}
00530     return JOY_RIGHT;
00531   }
00532   /* "JOY_LEFT" key is pressed */
00533   if (STM_EVAL_PBGetState(BUTTON_LEFT))
00534   {
00535     while (STM_EVAL_PBGetState(BUTTON_LEFT) == RESET)
00536     {}
00537     return JOY_LEFT;
00538   }
00539   /* "JOY_UP" key is pressed */
00540   if (STM_EVAL_PBGetState(BUTTON_UP))
00541   {
00542     while (STM_EVAL_PBGetState(BUTTON_UP) == RESET)
00543     {}
00544     return JOY_UP;
00545   }
00546   /* "JOY_DOWN" key is pressed */
00547   if (STM_EVAL_PBGetState(BUTTON_DOWN))
00548   {
00549     while (STM_EVAL_PBGetState(BUTTON_DOWN) == RESET)
00550     {}
00551     return JOY_DOWN;
00552   }
00553   /* "JOY_SEL" key is pressed */
00554   if (STM_EVAL_PBGetState(BUTTON_SEL))
00555   {
00556     while (STM_EVAL_PBGetState(BUTTON_SEL) == RESET)
00557     {}
00558     return JOY_SEL;
00559   }
00560   /* No key is pressed */
00561   else
00562   {
00563     return JOY_NONE;
00564   }
00565 }
00566 #endif
00567 
00568 #ifdef  USE_FULL_ASSERT
00569 
00570 /**
00571   * @brief  Reports the name of the source file and the source line number
00572   *         where the assert_param error has occurred.
00573   * @param  file: pointer to the source file name
00574   * @param  line: assert_param error line source number
00575   * @retval None
00576   */
00577 void assert_failed(uint8_t* file, uint32_t line)
00578 { 
00579   /* User can add his own implementation to report the file name and line number,
00580      ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
00581 
00582   /* Infinite loop */
00583   while (1)
00584   {
00585   }
00586 }
00587 #endif
00588 
00589 /**
00590   * @}
00591   */
00592 
00593 /**
00594   * @}
00595   */
00596 
00597 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
STM32L1xx Standard Peripherals Library: Footer

 

 

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