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

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

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

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

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

Loading…
Cancel
Save