void ST_EEPROM_Init(void)
{
FLASH_SetProgrammingTime(FLASH_ProgramTime_TProg);
do/*EEPROM存储*/
{
FLASH->DUKR=0xAE;
FLASH->DUKR=0x56;
}while ((FLASH->IAPSR & 0x08)==0);/* Wait until Data EEPROM area unlocked flag is set*/
}
/***********************************ST_EEPROM写************************************/
void ST_EEPROM_Write(uint16_t addr,uint8_t data)
{
/*uint8_t *p;
p =(u8 *)(0X1000+addr);
*p =data;*/
*(PointerAttr uint8_t*) (uint16_t)(0X1000+addr) = data;
while ((FLASH->IAPSR & 0x04)==0);/* Wait until Data EEPROM area unlocked flag is set*/
}
|