Browse Source
Fix SAMD51 i2c EEPROM (#17815)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
vanilla_fb_2.0.x
Giuliano Zaro
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
7 additions and
2 deletions
-
Marlin/src/HAL/SAMD51/eeprom_wired.cpp
-
Marlin/src/HAL/shared/eeprom_if.h
-
Marlin/src/HAL/shared/eeprom_if_i2c.cpp
|
|
@ -33,9 +33,13 @@ |
|
|
|
#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() { |
|
|
|
eeprom_init(); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { |
|
|
|
while (size--) { |
|
|
|
const uint8_t v = *value; |
|
|
|
|
|
@ -24,5 +24,6 @@ |
|
|
|
//
|
|
|
|
// EEPROM
|
|
|
|
//
|
|
|
|
void eeprom_init(); |
|
|
|
void eeprom_write_byte(uint8_t *pos, unsigned char value); |
|
|
|
uint8_t eeprom_read_byte(uint8_t *pos); |
|
|
|
|
|
@ -52,7 +52,7 @@ static constexpr uint8_t eeprom_device_address = I2C_ADDRESS(EEPROM_DEVICE_ADDRE |
|
|
|
// Public functions
|
|
|
|
// ------------------------
|
|
|
|
|
|
|
|
static void eeprom_init() { Wire.begin(); } |
|
|
|
void eeprom_init() { Wire.begin(); } |
|
|
|
|
|
|
|
void eeprom_write_byte(uint8_t *pos, unsigned char value) { |
|
|
|
const unsigned eeprom_address = (unsigned)pos; |
|
|
|