/* Erase All FLASH. 
This performs all operations necessary to erase all user pages in the FLASH memory. The information block is unaffected.  */
void flash_erase_all_pages(void)
/* Erase All FLASH. 
This performs all operations necessary to erase all user pages in the FLASH memory. The information block is unaffected.  */
void flash_erase_all_pages(void)
{
	flash_wait_for_last_operation();
	FLASH_CR |= FLASH_CR_MER;
	FLASH_CR |= FLASH_CR_STRT;
	flash_wait_for_last_operation();
	FLASH_CR &= ~FLASH_CR_MER;
	FLASH_CR2 |= FLASH_CR_MER;
	FLASH_CR2 |= FLASH_CR_STRT;
	flash_wait_for_last_operation();
	FLASH_CR2 &= ~FLASH_CR_MER;
}