LPC176x SPI / I2C PersistentStore (#17651)
This commit is contained in:
@ -80,7 +80,7 @@ void eeprom_write_byte(uint8_t *pos, unsigned char value) {
|
||||
HAL_FLASH_Unlock();
|
||||
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR |FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR);
|
||||
|
||||
uint16_t eeprom_address = unsigned(pos);
|
||||
const unsigned eeprom_address = (unsigned)pos;
|
||||
if (EE_WriteVariable(eeprom_address, uint16_t(value)) != EE_OK)
|
||||
for (;;) HAL_Delay(1); // Spin forever until watchdog reset
|
||||
|
||||
@ -91,7 +91,7 @@ uint8_t eeprom_read_byte(uint8_t *pos) {
|
||||
eeprom_init();
|
||||
|
||||
uint16_t data = 0xFF;
|
||||
uint16_t eeprom_address = unsigned(pos);
|
||||
const unsigned eeprom_address = (unsigned)pos;
|
||||
(void)EE_ReadVariable(eeprom_address, &data); // Data unchanged on error
|
||||
|
||||
return uint8_t(data);
|
||||
@ -101,7 +101,7 @@ void eeprom_read_block(void *__dst, const void *__src, size_t __n) {
|
||||
eeprom_init();
|
||||
|
||||
uint16_t data = 0xFF;
|
||||
uint16_t eeprom_address = unsigned(__src);
|
||||
const unsigned eeprom_address = (unsigned)__src;
|
||||
LOOP_L_N(c, __n) {
|
||||
EE_ReadVariable(eeprom_address+c, &data);
|
||||
*((uint8_t*)__dst + c) = data;
|
||||
|
@ -26,4 +26,5 @@
|
||||
#undef SRAM_EEPROM_EMULATION
|
||||
#undef SDCARD_EEPROM_EMULATION
|
||||
#define FLASH_EEPROM_EMULATION
|
||||
#warning "Forcing use of FLASH_EEPROM_EMULATION."
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user