Compile only selected PIO environment (#11519)
This commit is contained in:
committed by
Scott Lahteine
parent
5be2559eda
commit
c64199941e
@ -26,7 +26,7 @@
|
||||
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||
|
||||
#include "HAL.h"
|
||||
#include "../Delay.h"
|
||||
#include "../shared/Delay.h"
|
||||
|
||||
#include <Wire.h>
|
||||
|
||||
|
@ -42,8 +42,8 @@
|
||||
#undef sq
|
||||
#define sq(x) ((x)*(x))
|
||||
|
||||
#include "../math_32bit.h"
|
||||
#include "../HAL_SPI.h"
|
||||
#include "../shared/math_32bit.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
|
||||
#include "fastio_Teensy.h"
|
||||
#include "watchdog_Teensy.h"
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
|
||||
#include "../persistent_store_api.h"
|
||||
#include "../shared/persistent_store_api.h"
|
||||
#include <avr/eeprom.h>
|
||||
|
||||
bool PersistentStore::access_start() { return true; }
|
||||
|
51
Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp
Normal file
51
Marlin/src/HAL/HAL_TEENSY35_36/persistent_store_impl.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
|
||||
#include "../shared/persistent_store_api.h"
|
||||
|
||||
namespace HAL {
|
||||
namespace PersistentStore {
|
||||
|
||||
bool access_start() { return true; }
|
||||
bool access_finish() { return true; }
|
||||
|
||||
bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) {
|
||||
while (size--) {
|
||||
uint8_t * const p = (uint8_t * const)pos;
|
||||
uint8_t v = *value;
|
||||
// EEPROM has only ~100,000 write cycles,
|
||||
// so only write bytes that have changed!
|
||||
if (v != eeprom_read_byte(p)) {
|
||||
eeprom_write_byte(p, v);
|
||||
if (eeprom_read_byte(p) != v) {
|
||||
SERIAL_ECHO_START();
|
||||
SERIAL_ECHOLNPGM(MSG_ERR_EEPROM_WRITE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
crc16(crc, &v, 1);
|
||||
pos++;
|
||||
value++;
|
||||
};
|
||||
return false;
|
||||
}
|
||||
|
||||
bool read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc, const bool writing/*=true*/) {
|
||||
do {
|
||||
uint8_t c = eeprom_read_byte((unsigned char*)pos);
|
||||
if (writing) *value = c;
|
||||
crc16(crc, &c, 1);
|
||||
pos++;
|
||||
value++;
|
||||
} while (--size);
|
||||
return false;
|
||||
}
|
||||
|
||||
} // PersistentStore
|
||||
} // HAL
|
||||
|
||||
#endif // EEPROM_SETTINGS
|
||||
#endif // __MK64FX512__ || __MK66FX1M0__
|
Reference in New Issue
Block a user