LPC176x SPI / I2C PersistentStore (#17651)

This commit is contained in:
randellhodges
2020-04-28 02:27:55 -05:00
committed by GitHub
parent 7c3909bc3f
commit 5f7a75979f
29 changed files with 132 additions and 210 deletions

View File

@@ -35,6 +35,10 @@
#define CMD_READ 2 // WRITE
#define CMD_WRITE 2 // WRITE
#ifndef EEPROM_WRITE_DELAY
#define EEPROM_WRITE_DELAY 7
#endif
uint8_t eeprom_read_byte(uint8_t* pos) {
uint8_t v;
uint8_t eeprom_temp[3];
@@ -90,7 +94,7 @@ void eeprom_write_byte(uint8_t* pos, uint8_t value) {
spiSend(SPI_CHAN_EEPROM1, value);
WRITE(SPI_EEPROM1_CS, HIGH);
delay(7); // wait for page write to complete
delay(EEPROM_WRITE_DELAY); // wait for page write to complete
}
void eeprom_update_block(const void* src, void* eeprom_address, size_t n) {
@@ -112,7 +116,7 @@ void eeprom_update_block(const void* src, void* eeprom_address, size_t n) {
spiSend(SPI_CHAN_EEPROM1, (const uint8_t*)src, n);
WRITE(SPI_EEPROM1_CS, HIGH);
delay(7); // wait for page write to complete
delay(EEPROM_WRITE_DELAY); // wait for page write to complete
}
#endif // SPI_EEPROM