Browse Source

Use uint8_t in EEPROM code

pull/1/head
Scott Lahteine 6 years ago
parent
commit
0bd54392b7
  1. 2
      Marlin/src/HAL/HAL_AVR/persistent_store_eeprom.cpp
  2. 4
      Marlin/src/HAL/HAL_DUE/HAL.h
  3. 2
      Marlin/src/HAL/HAL_DUE/persistent_store_eeprom.cpp
  4. 4
      Marlin/src/HAL/HAL_ESP32/HAL.h
  5. 4
      Marlin/src/HAL/HAL_LPC1768/arduino.cpp
  6. 4
      Marlin/src/HAL/HAL_LPC1768/include/Arduino.h
  7. 4
      Marlin/src/HAL/HAL_STM32/HAL.h
  8. 2
      Marlin/src/HAL/HAL_STM32/persistent_store_impl.cpp
  9. 4
      Marlin/src/HAL/HAL_STM32F1/HAL.h
  10. 4
      Marlin/src/HAL/HAL_STM32F4/EmulatedEeprom.cpp
  11. 4
      Marlin/src/HAL/HAL_STM32F4/HAL.h
  12. 2
      Marlin/src/HAL/HAL_STM32F4/persistent_store_eeprom.cpp
  13. 4
      Marlin/src/HAL/HAL_STM32F7/EmulatedEeprom.cpp
  14. 4
      Marlin/src/HAL/HAL_STM32F7/HAL.h
  15. 2
      Marlin/src/HAL/HAL_STM32F7/persistent_store_eeprom.cpp
  16. 2
      Marlin/src/HAL/HAL_TEENSY31_32/persistent_store_impl.cpp
  17. 2
      Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_eeprom.cpp
  18. 2
      Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp
  19. 4
      Marlin/src/HAL/shared/I2cEeprom.cpp

2
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++;

4
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);

2
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++;

4
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);

4
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) { }

4
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);

4
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);

2
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
);

4
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);

4
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;

4
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);

2
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++;

4
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;

4
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);

2
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++;

2
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++;

2
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++;

2
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++;

4
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;

Loading…
Cancel
Save