From 0bd54392b7a4f2813101fea780a410bf0bf06359 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 9 Oct 2018 18:59:49 -0500 Subject: [PATCH] Use uint8_t in EEPROM code --- Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp | 2 +- Marlin/src/HAL/HAL_DUE/HAL.h | 4 ++-- Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp | 2 +- Marlin/src/HAL/HAL_ESP32/HAL.h | 4 ++-- Marlin/src/HAL/HAL_LPC1768/arduino.cpp | 4 ++-- Marlin/src/HAL/HAL_LPC1768/include/Arduino.h | 4 ++-- Marlin/src/HAL/HAL_STM32/HAL.h | 4 ++-- Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp | 2 +- Marlin/src/HAL/HAL_STM32F1/HAL.h | 4 ++-- Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp | 4 ++-- Marlin/src/HAL/HAL_STM32F4/HAL.h | 4 ++-- Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp | 2 +- Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp | 4 ++-- Marlin/src/HAL/HAL_STM32F7/HAL.h | 4 ++-- Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp | 2 +- Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp | 2 +- Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp | 2 +- Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp | 2 +- Marlin/src/HAL/shared/I2cEeprom.cpp | 4 ++-- 19 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp index 1593b1829..c129226bb 100644 --- a/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp @@ -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++; diff --git a/Marlin/src/HAL/HAL_DUE/HAL.h b/Marlin/src/HAL/HAL_DUE/HAL.h index 8e7b4490d..6c872026d 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL.h +++ b/Marlin/src/HAL/HAL_DUE/HAL.h @@ -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); diff --git a/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp index fa611111d..e7ff4f9c8 100644 --- a/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp @@ -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++; diff --git a/Marlin/src/HAL/HAL_ESP32/HAL.h b/Marlin/src/HAL/HAL_ESP32/HAL.h index 106299295..7921f9bf5 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL.h +++ b/Marlin/src/HAL/HAL_ESP32/HAL.h @@ -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); diff --git a/Marlin/src/HAL/HAL_LPC1768/arduino.cpp b/Marlin/src/HAL/HAL_LPC1768/arduino.cpp index 92efd3495..e7a3d5e8f 100644 --- a/Marlin/src/HAL/HAL_LPC1768/arduino.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/arduino.cpp @@ -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) { } diff --git a/Marlin/src/HAL/HAL_LPC1768/include/Arduino.h b/Marlin/src/HAL/HAL_LPC1768/include/Arduino.h index aebc76a6e..63502ad71 100644 --- a/Marlin/src/HAL/HAL_LPC1768/include/Arduino.h +++ b/Marlin/src/HAL/HAL_LPC1768/include/Arduino.h @@ -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); diff --git a/Marlin/src/HAL/HAL_STM32/HAL.h b/Marlin/src/HAL/HAL_STM32/HAL.h index 29a0947fd..7d789d741 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL.h +++ b/Marlin/src/HAL/HAL_STM32/HAL.h @@ -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); diff --git a/Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp b/Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp index 313edf273..b89e29ae9 100644 --- a/Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp +++ b/Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp @@ -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 ); diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL.h b/Marlin/src/HAL/HAL_STM32F1/HAL.h index 81d08d527..9faf200fb 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL.h @@ -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); diff --git a/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp b/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp index 19853171f..4820bd6ab 100644 --- a/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp @@ -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; diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL.h b/Marlin/src/HAL/HAL_STM32F4/HAL.h index b0abf8199..dc6bda473 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F4/HAL.h @@ -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); diff --git a/Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp index 194cd21bc..576ecc6de 100644 --- a/Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp @@ -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++; diff --git a/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp b/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp index 0a7f5193f..a0a00dd4d 100644 --- a/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp @@ -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; diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL.h b/Marlin/src/HAL/HAL_STM32F7/HAL.h index 2eb8f89b7..c911ff07f 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F7/HAL.h @@ -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); diff --git a/Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp index bd08ad7f0..50bf09a9a 100644 --- a/Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp @@ -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++; diff --git a/Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp b/Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp index ac5921230..71908bc1c 100644 --- a/Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp +++ b/Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp @@ -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++; diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp index 46e88e04a..7a1fa0e44 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp +++ b/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp @@ -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++; diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp b/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp index 009cdaa50..c0c9dc268 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp +++ b/Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp @@ -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++; diff --git a/Marlin/src/HAL/shared/I2cEeprom.cpp b/Marlin/src/HAL/shared/I2cEeprom.cpp index a73cefa2d..91b9d4626 100644 --- a/Marlin/src/HAL/shared/I2cEeprom.cpp +++ b/Marlin/src/HAL/shared/I2cEeprom.cpp @@ -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;