Browse Source

Fix SAMD51 i2c EEPROM (#17815)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Giuliano Zaro 5 years ago
parent
commit
bd8436d1c5
No account linked to committer's email address

+ 5
- 1
Marlin/src/HAL/SAMD51/eeprom_wired.cpp View File

@@ -33,9 +33,13 @@
33 33
 #include "../shared/eeprom_api.h"
34 34
 
35 35
 size_t PersistentStore::capacity()    { return E2END + 1; }
36
-bool PersistentStore::access_start()  { return true; }
37 36
 bool PersistentStore::access_finish() { return true; }
38 37
 
38
+bool PersistentStore::access_start() {
39
+  eeprom_init();
40
+  return true;
41
+}
42
+
39 43
 bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
40 44
   while (size--) {
41 45
     const uint8_t v = *value;

+ 1
- 0
Marlin/src/HAL/shared/eeprom_if.h View File

@@ -24,5 +24,6 @@
24 24
 //
25 25
 // EEPROM
26 26
 //
27
+void eeprom_init();
27 28
 void eeprom_write_byte(uint8_t *pos, unsigned char value);
28 29
 uint8_t eeprom_read_byte(uint8_t *pos);

+ 1
- 1
Marlin/src/HAL/shared/eeprom_if_i2c.cpp View File

@@ -52,7 +52,7 @@ static constexpr uint8_t eeprom_device_address = I2C_ADDRESS(EEPROM_DEVICE_ADDRE
52 52
 // Public functions
53 53
 // ------------------------
54 54
 
55
-static void eeprom_init() { Wire.begin(); }
55
+void eeprom_init() { Wire.begin(); }
56 56
 
57 57
 void eeprom_write_byte(uint8_t *pos, unsigned char value) {
58 58
   const unsigned eeprom_address = (unsigned)pos;

Loading…
Cancel
Save