From 3c080ee3e6c6b73a9867cbd05456b77aab5caae9 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 30 Apr 2020 17:33:20 -0500 Subject: [PATCH] Cleanup, comment "wired" eeproms --- Marlin/src/HAL/AVR/eeprom.cpp | 5 +++++ Marlin/src/HAL/DUE/eeprom_wired.cpp | 5 +++++ Marlin/src/HAL/LPC1768/eeprom_wired.cpp | 13 ++++++++----- Marlin/src/HAL/SAMD51/eeprom_wired.cpp | 5 +++++ Marlin/src/HAL/STM32/eeprom_wired.cpp | 9 ++++++++- Marlin/src/HAL/STM32F1/eeprom_wired.cpp | 5 +++++ .../STM32_F4_F7/{eeprom.cpp => eeprom_wired.cpp} | 13 +++++++++++-- Marlin/src/HAL/STM32_F4_F7/inc/Conditionals_post.h | 1 - Marlin/src/HAL/TEENSY31_32/eeprom.cpp | 5 +++++ Marlin/src/HAL/TEENSY35_36/eeprom.cpp | 5 +++++ 10 files changed, 57 insertions(+), 9 deletions(-) rename Marlin/src/HAL/STM32_F4_F7/{eeprom.cpp => eeprom_wired.cpp} (90%) diff --git a/Marlin/src/HAL/AVR/eeprom.cpp b/Marlin/src/HAL/AVR/eeprom.cpp index e946668054..0519e5732e 100644 --- a/Marlin/src/HAL/AVR/eeprom.cpp +++ b/Marlin/src/HAL/AVR/eeprom.cpp @@ -25,6 +25,11 @@ #if EITHER(EEPROM_SETTINGS, SD_FIRMWARE_UPDATE) +/** + * PersistentStore for Arduino-style EEPROM interface + * with implementations supplied by the framework. + */ + #include "../shared/eeprom_api.h" size_t PersistentStore::capacity() { return E2END + 1; } diff --git a/Marlin/src/HAL/DUE/eeprom_wired.cpp b/Marlin/src/HAL/DUE/eeprom_wired.cpp index 429d8df374..a9b2cc92d2 100644 --- a/Marlin/src/HAL/DUE/eeprom_wired.cpp +++ b/Marlin/src/HAL/DUE/eeprom_wired.cpp @@ -26,6 +26,11 @@ #if USE_WIRED_EEPROM +/** + * PersistentStore for Arduino-style EEPROM interface + * with simple implementations supplied by Marlin. + */ + #include "../shared/eeprom_if.h" #include "../shared/eeprom_api.h" diff --git a/Marlin/src/HAL/LPC1768/eeprom_wired.cpp b/Marlin/src/HAL/LPC1768/eeprom_wired.cpp index f5db53434d..e0f72b78e5 100644 --- a/Marlin/src/HAL/LPC1768/eeprom_wired.cpp +++ b/Marlin/src/HAL/LPC1768/eeprom_wired.cpp @@ -25,20 +25,25 @@ #if USE_WIRED_EEPROM -#include "../shared/eeprom_if.h" +/** + * PersistentStore for Arduino-style EEPROM interface + * with implementations supplied by the framework. + */ + #include "../shared/eeprom_api.h" #ifndef EEPROM_SIZE #define EEPROM_SIZE 0x8000 // 32kB‬ #endif +size_t PersistentStore::capacity() { return EEPROM_SIZE; } +bool PersistentStore::access_finish() { return true; } + bool PersistentStore::access_start() { TERN_(SPI_EEPROM, eeprom_init()); return true; } -bool PersistentStore::access_finish() { return true; } - bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { while (size--) { uint8_t v = *value; @@ -75,7 +80,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t return false; } -size_t PersistentStore::capacity() { return EEPROM_SIZE; } - #endif // USE_WIRED_EEPROM #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/SAMD51/eeprom_wired.cpp b/Marlin/src/HAL/SAMD51/eeprom_wired.cpp index 9dc83f37e6..8c94422422 100644 --- a/Marlin/src/HAL/SAMD51/eeprom_wired.cpp +++ b/Marlin/src/HAL/SAMD51/eeprom_wired.cpp @@ -24,6 +24,11 @@ #if USE_WIRED_EEPROM +/** + * PersistentStore for Arduino-style EEPROM interface + * with simple implementations supplied by Marlin. + */ + #include "../shared/eeprom_if.h" #include "../shared/eeprom_api.h" diff --git a/Marlin/src/HAL/STM32/eeprom_wired.cpp b/Marlin/src/HAL/STM32/eeprom_wired.cpp index 465cf44a25..5639e532cc 100644 --- a/Marlin/src/HAL/STM32/eeprom_wired.cpp +++ b/Marlin/src/HAL/STM32/eeprom_wired.cpp @@ -26,14 +26,21 @@ #if USE_WIRED_EEPROM +/** + * PersistentStore for Arduino-style EEPROM interface + * with simple implementations supplied by Marlin. + */ #include "../shared/eeprom_if.h" #include "../shared/eeprom_api.h" size_t PersistentStore::capacity() { return E2END + 1; } -bool PersistentStore::access_start() { return true; } bool PersistentStore::access_finish() { return true; } +bool PersistentStore::access_start() { + return true; +} + bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { while (size--) { uint8_t v = *value; diff --git a/Marlin/src/HAL/STM32F1/eeprom_wired.cpp b/Marlin/src/HAL/STM32F1/eeprom_wired.cpp index e53e9d8674..8d584c67b0 100644 --- a/Marlin/src/HAL/STM32F1/eeprom_wired.cpp +++ b/Marlin/src/HAL/STM32F1/eeprom_wired.cpp @@ -23,6 +23,11 @@ #if USE_WIRED_EEPROM +/** + * PersistentStore for Arduino-style EEPROM interface + * with simple implementations supplied by Marlin. + */ + #include "../shared/eeprom_if.h" #include "../shared/eeprom_api.h" diff --git a/Marlin/src/HAL/STM32_F4_F7/eeprom.cpp b/Marlin/src/HAL/STM32_F4_F7/eeprom_wired.cpp similarity index 90% rename from Marlin/src/HAL/STM32_F4_F7/eeprom.cpp rename to Marlin/src/HAL/STM32_F4_F7/eeprom_wired.cpp index 370d2885ae..7eb06ebdde 100644 --- a/Marlin/src/HAL/STM32_F4_F7/eeprom.cpp +++ b/Marlin/src/HAL/STM32_F4_F7/eeprom_wired.cpp @@ -24,7 +24,12 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(EEPROM_SETTINGS) +#if USE_WIRED_EEPROM + +/** + * PersistentStore for Arduino-style EEPROM interface + * with simple implementations supplied by Marlin. + */ #include "../shared/eeprom_if.h" #include "../shared/eeprom_api.h" @@ -33,6 +38,10 @@ size_t PersistentStore::capacity() { return E2END + 1; } bool PersistentStore::access_start() { return true; } bool PersistentStore::access_finish() { return true; } +bool PersistentStore::access_start() { + return true; +} + bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { while (size--) { uint8_t * const p = (uint8_t * const)pos; @@ -64,5 +73,5 @@ bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t return false; } -#endif // EEPROM_SETTINGS +#endif // USE_WIRED_EEPROM #endif // STM32GENERIC && (STM32F4 || STM32F7) diff --git a/Marlin/src/HAL/STM32_F4_F7/inc/Conditionals_post.h b/Marlin/src/HAL/STM32_F4_F7/inc/Conditionals_post.h index a96352376e..d21624955e 100644 --- a/Marlin/src/HAL/STM32_F4_F7/inc/Conditionals_post.h +++ b/Marlin/src/HAL/STM32_F4_F7/inc/Conditionals_post.h @@ -26,5 +26,4 @@ #undef SRAM_EEPROM_EMULATION #undef SDCARD_EEPROM_EMULATION #define FLASH_EEPROM_EMULATION - #warning "Forcing use of FLASH_EEPROM_EMULATION." #endif diff --git a/Marlin/src/HAL/TEENSY31_32/eeprom.cpp b/Marlin/src/HAL/TEENSY31_32/eeprom.cpp index a00c1062aa..5e3c8bfcfc 100644 --- a/Marlin/src/HAL/TEENSY31_32/eeprom.cpp +++ b/Marlin/src/HAL/TEENSY31_32/eeprom.cpp @@ -22,6 +22,11 @@ #if USE_WIRED_EEPROM +/** + * PersistentStore for Arduino-style EEPROM interface + * with implementations supplied by the framework. + */ + #include "../shared/eeprom_api.h" bool PersistentStore::access_start() { return true; } diff --git a/Marlin/src/HAL/TEENSY35_36/eeprom.cpp b/Marlin/src/HAL/TEENSY35_36/eeprom.cpp index ff8fa3626d..9926745511 100644 --- a/Marlin/src/HAL/TEENSY35_36/eeprom.cpp +++ b/Marlin/src/HAL/TEENSY35_36/eeprom.cpp @@ -26,6 +26,11 @@ #if USE_WIRED_EEPROM +/** + * PersistentStore for Arduino-style EEPROM interface + * with implementations supplied by the framework. + */ + #include "../shared/eeprom_api.h" #include