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 1593b1829c..c129226bb0 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 8e7b4490d3..6c872026dc 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 fa611111d0..e7ff4f9c81 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 106299295a..7921f9bf5f 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 92efd3495a..e7a3d5e8f4 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 aebc76a6ea..63502ad710 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 29a0947fdb..7d789d7418 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 313edf2735..b89e29ae99 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 81d08d5278..9faf200fbc 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 19853171fe..4820bd6abd 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 b0abf81995..dc6bda473c 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 194cd21bc6..576ecc6dea 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 0a7f5193f0..a0a00dd4dc 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 2eb8f89b79..c911ff07f7 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 bd08ad7f0b..50bf09a9a3 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 ac59212300..71908bc1cd 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 46e88e04a5..7a1fa0e44c 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 009cdaa504..c0c9dc2684 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 a73cefa2d3..91b9d4626f 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;