Src/eeprom.c
/**
  * @brief  Erases PAGE0 and PAGE1 and writes VALID_PAGE header to PAGE0
  * @param  None
  * @retval Status of the last operation (Flash write or erase) done during
  *         EEPROM formating
  */
@brief  Erases PAGE0 and PAGE1 and writes VALID_PAGE header to PAGE0
@param  None
@retval Status of the last operation (Flash write or erase) done during
EEPROM formating
@brief Erases PAGE0 and PAGE1 and writes VALID_PAGE header to PAGE0 @param None @retval Status of the last operation ( Flash write or erase ) done during EEPROM formating
static FLASH_Status EE_Format(void)
{
  FLASH_Status FlashStatus = FLASH_COMPLETE;
  FlashStatus = FLASH_ErasePage(PAGE0_BASE_ADDRESS);
  if (FlashStatus != FLASH_COMPLETE)
  {
    return FlashStatus;
  }
  FlashStatus = FLASH_ProgramHalfWord(PAGE0_BASE_ADDRESS, VALID_PAGE);
  if (FlashStatus != FLASH_COMPLETE)
  {
    return FlashStatus;
  }
  FlashStatus = FLASH_ErasePage(PAGE1_BASE_ADDRESS);
  return FlashStatus;
}
static FLASH_Status EE_Format ( void ) { FLASH_Status FlashStatus = FLASH_COMPLETE ; FlashStatus = FLASH_ErasePage ( PAGE0_BASE_ADDRESS ) ; if ( FlashStatus != FLASH_COMPLETE ) { return FlashStatus ; } FlashStatus = FLASH_ProgramHalfWord ( PAGE0_BASE_ADDRESS , VALID_PAGE ) ; if ( FlashStatus != FLASH_COMPLETE ) { return FlashStatus ; } FlashStatus = FLASH_ErasePage ( PAGE1_BASE_ADDRESS ) ; return FlashStatus ; }
@brief  Erases PAGE0 and PAGE1 and writes VALID_PAGE header to PAGE0
 @param  None
 @retval Status of the last operation (Flash write or erase) done during
         EEPROM formating
@brief Erases PAGE0 and PAGE1 and writes VALID_PAGE header to PAGE0 @param None @retval Status of the last operation ( Flash write or erase ) done during EEPROM formating
/* Erase Page0 */ /* If erase operation was failed, a Flash error code is returned */ /* Set Page0 as valid page: Write VALID_PAGE at Page0 base address */ /* If program operation was failed, a Flash error code is returned */ /* Erase Page1 */ /* Return Page1 erase operation status */