-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Latest changes to V3 firmware - still WIP
- Loading branch information
Showing
37 changed files
with
276 additions
and
2,364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,40 @@ | ||
// this file no longer used | ||
#include <Arduino.h> | ||
#include <EEPROM.h> | ||
|
||
// put - Specialization for Arduino Strings ------------------------------- | ||
// to put an Arduino String to the EEPROM we copy its internal buffer | ||
// including the trailing \0 to the eprom | ||
|
||
template <> | ||
const String &EEPROMClass::put(int idx, const String &s) | ||
{ | ||
const uint8_t *ptr = (uint8_t *)s.c_str(); | ||
|
||
#ifdef __arm__ | ||
eeprom_write_block(ptr, (void *)idx, s.length() + 1); // length() doesn't account for the trailing \0 | ||
#else | ||
EEPtr e = idx; | ||
for (int count = s.length() + 1; count; --count, ++e) | ||
(*e).update(*ptr++); | ||
#endif | ||
return s; | ||
} | ||
|
||
// get - Specialization for Arduino Strings ------------------------------- | ||
// to "get" an Arduino String from the EEPROM we append chars from the EEPROM | ||
// into it until we find the delimiting /0. | ||
// String.append is not very efficient, code could probably be opitimized if required... | ||
|
||
template <> | ||
String &EEPROMClass::get(int idx, String &s){ | ||
s = ""; // just in case... | ||
EEPtr e = idx; | ||
|
||
char c = *e; // read in bytes until we find the terminating \0 | ||
while (c != '\0') { | ||
s.append(c); | ||
c = *(++e); | ||
} | ||
return s; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.