Use E2END, if defined, for STM32F1 (SD) (#13981)
This commit is contained in:
parent
3bf43b6c1e
commit
93dd097b1c
@ -1,10 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Marlin 3D Printer Firmware
|
* Marlin 3D Printer Firmware
|
||||||
*
|
|
||||||
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
*
|
||||||
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
|
* Based on Sprinter and grbl.
|
||||||
* Copyright (c) 2016 Victor Perez victor_pv@hotmail.com
|
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -33,12 +32,18 @@
|
|||||||
|
|
||||||
#include "../shared/persistent_store_api.h"
|
#include "../shared/persistent_store_api.h"
|
||||||
|
|
||||||
|
#ifndef E2END
|
||||||
|
#define E2END 4095
|
||||||
|
#endif
|
||||||
|
#define HAL_STM32F1_EEPROM_SIZE (E2END + 1)
|
||||||
|
|
||||||
|
static char HAL_STM32F1_eeprom_content[HAL_STM32F1_EEPROM_SIZE];
|
||||||
|
|
||||||
|
#if ENABLED(SDSUPPORT)
|
||||||
|
|
||||||
#include "../../sd/cardreader.h"
|
#include "../../sd/cardreader.h"
|
||||||
|
|
||||||
#define HAL_STM32F1_EEPROM_SIZE 4096
|
static const char eeprom_filename[] = "eeprom.dat";
|
||||||
char HAL_STM32F1_eeprom_content[HAL_STM32F1_EEPROM_SIZE];
|
|
||||||
|
|
||||||
char eeprom_filename[] = "eeprom.dat";
|
|
||||||
|
|
||||||
bool PersistentStore::access_start() {
|
bool PersistentStore::access_start() {
|
||||||
if (!card.isDetected()) return false;
|
if (!card.isDetected()) return false;
|
||||||
@ -61,6 +66,12 @@ bool PersistentStore::access_finish() {
|
|||||||
return (bytes_written == HAL_STM32F1_EEPROM_SIZE);
|
return (bytes_written == HAL_STM32F1_EEPROM_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else // !SDSUPPORT
|
||||||
|
|
||||||
|
#error "Please define SPI_EEPROM (in Configuration.h) or disable EEPROM_SETTINGS."
|
||||||
|
|
||||||
|
#endif // !SDSUPPORT
|
||||||
|
|
||||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t size, uint16_t *crc) {
|
bool PersistentStore::write_data(int &pos, const uint8_t *value, const size_t size, uint16_t *crc) {
|
||||||
for (size_t i = 0; i < size; i++)
|
for (size_t i = 0; i < size; i++)
|
||||||
HAL_STM32F1_eeprom_content[pos + i] = value[i];
|
HAL_STM32F1_eeprom_content[pos + i] = value[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user