Use uint8_t in EEPROM code

This commit is contained in:
Scott Lahteine 2018-10-09 18:59:49 -05:00
parent ce82015d5f
commit 0bd54392b7
19 changed files with 30 additions and 30 deletions

View File

@ -53,7 +53,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
do {
uint8_t c = eeprom_read_byte((unsigned char*)pos);
uint8_t c = eeprom_read_byte((uint8_t*)pos);
if (writing) *value = c;
crc16(crc, &c, 1);
pos++;

View File

@ -124,8 +124,8 @@ uint8_t spiRec(uint32_t chan);
//
// EEPROM
//
void eeprom_write_byte(unsigned char *pos, unsigned char value);
unsigned char eeprom_read_byte(unsigned char *pos);
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n);

View File

@ -67,7 +67,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
do {
uint8_t c = eeprom_read_byte((unsigned char*)pos);
uint8_t c = eeprom_read_byte((uint8_t*)pos);
if (writing) *value = c;
crc16(crc, &c, 1);
pos++;

View File

@ -98,8 +98,8 @@ int freeMemory(void);
void analogWrite(int pin, int value);
// EEPROM
void eeprom_write_byte(unsigned char *pos, unsigned char value);
unsigned char eeprom_read_byte(unsigned char *pos);
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n);

View File

@ -143,11 +143,11 @@ uint16_t analogRead(pin_t adc_pin) {
// Persistent Config Storage
// **************************
void eeprom_write_byte(unsigned char *pos, unsigned char value) {
void eeprom_write_byte(uint8_t *pos, unsigned char value) {
}
unsigned char eeprom_read_byte(uint8_t * pos) { return '\0'; }
uint8_t eeprom_read_byte(uint8_t * pos) { return '\0'; }
void eeprom_read_block(void *__dst, const void *__src, size_t __n) { }

View File

@ -109,8 +109,8 @@ void analogWrite(pin_t, int);
uint16_t analogRead(pin_t);
// EEPROM
void eeprom_write_byte(unsigned char *pos, unsigned char value);
unsigned char eeprom_read_byte(unsigned char *pos);
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n);

View File

@ -196,8 +196,8 @@ uint8_t spiRec(uint32_t chan);
/**
* Wire library should work for i2c eeproms.
*/
void eeprom_write_byte(unsigned char *pos, unsigned char value);
unsigned char eeprom_read_byte(unsigned char *pos);
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n);

View File

@ -79,7 +79,7 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t
#if DISABLED(EEPROM_EMULATED_WITH_SRAM)
eeprom_buffered_read_byte(pos)
#else
(*(__IO uint8_t *)(BKPSRAM_BASE + ((unsigned char*)pos)))
(*(__IO uint8_t *)(BKPSRAM_BASE + ((uint8_t*)pos)))
#endif
);

View File

@ -212,8 +212,8 @@ uint8_t spiRec(uint32_t chan);
* TODO: Write all this eeprom stuff. Can emulate eeprom in flash as last resort.
* Wire library should work for i2c eeproms.
*/
void eeprom_write_byte(unsigned char *pos, unsigned char value);
unsigned char eeprom_read_byte(unsigned char *pos);
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n);

View File

@ -96,7 +96,7 @@ void eeprom_init() {
}
}
void eeprom_write_byte(unsigned char *pos, unsigned char value) {
void eeprom_write_byte(uint8_t *pos, unsigned char value) {
uint16_t eeprom_address = (unsigned) pos;
eeprom_init();
@ -110,7 +110,7 @@ void eeprom_write_byte(unsigned char *pos, unsigned char value) {
HAL_FLASH_Lock();
}
unsigned char eeprom_read_byte(unsigned char *pos) {
uint8_t eeprom_read_byte(uint8_t *pos) {
uint16_t data = 0xFF;
uint16_t eeprom_address = (unsigned)pos;

View File

@ -212,8 +212,8 @@ uint8_t spiRec(uint32_t chan);
* TODO: Write all this eeprom stuff. Can emulate eeprom in flash as last resort.
* Wire library should work for i2c eeproms.
*/
void eeprom_write_byte(unsigned char *pos, unsigned char value);
unsigned char eeprom_read_byte(unsigned char *pos);
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n);

View File

@ -55,7 +55,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing) {
do {
uint8_t c = eeprom_read_byte((unsigned char*)pos);
uint8_t c = eeprom_read_byte((uint8_t*)pos);
if (writing) *value = c;
crc16(crc, &c, 1);
pos++;

View File

@ -94,7 +94,7 @@ void eeprom_init() {
}
}
void eeprom_write_byte(unsigned char *pos, unsigned char value) {
void eeprom_write_byte(uint8_t *pos, unsigned char value) {
uint16_t eeprom_address = (unsigned) pos;
eeprom_init();
@ -108,7 +108,7 @@ void eeprom_write_byte(unsigned char *pos, unsigned char value) {
HAL_FLASH_Lock();
}
unsigned char eeprom_read_byte(unsigned char *pos) {
uint8_t eeprom_read_byte(uint8_t *pos) {
uint16_t data = 0xFF;
uint16_t eeprom_address = (unsigned)pos;

View File

@ -200,8 +200,8 @@ uint8_t spiRec(uint32_t chan);
* TODO: Write all this eeprom stuff. Can emulate eeprom in flash as last resort.
* Wire library should work for i2c eeproms.
*/
void eeprom_write_byte(unsigned char *pos, unsigned char value);
unsigned char eeprom_read_byte(unsigned char *pos);
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n);

View File

@ -55,7 +55,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc) {
do {
uint8_t c = eeprom_read_byte((unsigned char*)pos);
uint8_t c = eeprom_read_byte((uint8_t*)pos);
*value = c;
crc16(crc, &c, 1);
pos++;

View File

@ -35,7 +35,7 @@ bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
bool read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc, const bool writing/*=true*/) {
do {
uint8_t c = eeprom_read_byte((unsigned char*)pos);
uint8_t c = eeprom_read_byte((uint8_t*)pos);
if (writing) *value = c;
crc16(crc, &c, 1);
pos++;

View File

@ -56,7 +56,7 @@ bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, ui
bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
do {
uint8_t c = eeprom_read_byte((unsigned char*)pos);
uint8_t c = eeprom_read_byte((uint8_t*)pos);
if (writing) *value = c;
crc16(crc, &c, 1);
pos++;

View File

@ -35,7 +35,7 @@ bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
bool read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc, const bool writing/*=true*/) {
do {
uint8_t c = eeprom_read_byte((unsigned char*)pos);
uint8_t c = eeprom_read_byte((uint8_t*)pos);
if (writing) *value = c;
crc16(crc, &c, 1);
pos++;

View File

@ -82,7 +82,7 @@ static void eeprom_init(void) {
}
}
void eeprom_write_byte(unsigned char *pos, unsigned char value) {
void eeprom_write_byte(uint8_t *pos, unsigned char value) {
unsigned eeprom_address = (unsigned) pos;
eeprom_init();
@ -128,7 +128,7 @@ void eeprom_update_block(const void *pos, void* eeprom_address, size_t n) {
}
unsigned char eeprom_read_byte(unsigned char *pos) {
uint8_t eeprom_read_byte(uint8_t *pos) {
byte data = 0xFF;
unsigned eeprom_address = (unsigned)pos;