main.c
Go to the documentation of this file.00001 /** 00002 ****************************************************************************** 00003 * @file EEPROM_Emulation/src/main.c 00004 * @author MCD Application Team 00005 * @version V3.1.0 00006 * @date 07/27/2009 00007 * @brief Main program body 00008 ****************************************************************************** 00009 * @copy 00010 * 00011 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 00012 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 00013 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 00014 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 00015 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 00016 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 00017 * 00018 * <h2><center>© COPYRIGHT 2009 STMicroelectronics</center></h2> 00019 */ 00020 00021 /** @addtogroup EEPROM_Emulation 00022 * @{ 00023 */ 00024 00025 /* Includes ------------------------------------------------------------------*/ 00026 #include "eeprom.h" 00027 00028 /* Private typedef -----------------------------------------------------------*/ 00029 /* Private define ------------------------------------------------------------*/ 00030 /* Private macro -------------------------------------------------------------*/ 00031 /* Private variables ---------------------------------------------------------*/ 00032 ErrorStatus HSEStartUpStatus; 00033 FLASH_Status FlashStatus; 00034 uint16_t VarValue = 0; 00035 00036 /* Virtual address defined by the user: 0xFFFF value is prohibited */ 00037 uint16_t VirtAddVarTab[NumbOfVar] = {0x5555, 0x6666, 0x7777}; 00038 00039 /* Private function prototypes -----------------------------------------------*/ 00040 /* Private functions ---------------------------------------------------------*/ 00041 00042 /** 00043 * @brief Main program. 00044 * @param None 00045 * @retval None 00046 */ 00047 int main(void) 00048 { 00049 /* Setup STM32 system (clock, PLL and Flash configuration) */ 00050 SystemInit(); 00051 00052 /* Unlock the Flash Program Erase controller */ 00053 FLASH_Unlock(); 00054 00055 /* EEPROM Init */ 00056 EE_Init(); 00057 00058 /* --- Store successively many values of the three variables in the EEPROM ---*/ 00059 /* Store 1000 values of Variable1 in EEPROM */ 00060 for (VarValue = 0; VarValue < 1000; VarValue++) 00061 { 00062 EE_WriteVariable(VirtAddVarTab[0], VarValue); 00063 } 00064 00065 /* Store 500 values of Variable2 in EEPROM */ 00066 for (VarValue = 0; VarValue < 500; VarValue++) 00067 { 00068 EE_WriteVariable(VirtAddVarTab[1], VarValue); 00069 } 00070 00071 /* Store 800 values of Variable3 in EEPROM */ 00072 for (VarValue = 0; VarValue < 800; VarValue++) 00073 { 00074 EE_WriteVariable(VirtAddVarTab[2], VarValue); 00075 } 00076 00077 while (1); 00078 } 00079 00080 #ifdef USE_FULL_ASSERT 00081 /** 00082 * @brief Reports the name of the source file and the source line number 00083 * where the assert_param error has occurred. 00084 * @param file: pointer to the source file name 00085 * @param line: assert_param error line source number 00086 * @retval None 00087 */ 00088 void assert_failed(uint8_t* file, uint32_t line) 00089 { 00090 /* User can add his own implementation to report the file name and line number, 00091 ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ 00092 00093 /* Infinite loop */ 00094 while (1) 00095 {} 00096 } 00097 #endif 00098 00099 /** 00100 * @} 00101 */ 00102 00103 /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
|