1
0

Blindly pull all plugins up to current

This commit is contained in:
Jesse Vincent 2019-12-05 11:13:27 -08:00
parent da4c3e1b31
commit 8fe8470067
No known key found for this signature in database
GPG Key ID: CC228463465E40BC
7 changed files with 233 additions and 150 deletions

@ -1 +1 @@
Subproject commit 54ec4d63cf214db6d73245d5aa4cb98d78d46f79
Subproject commit eb52795c799e5da66c6b45965b2281c7dd374662

View File

@ -282,15 +282,33 @@ long map(long, long, long, long, long);
#ifdef __cplusplus
// Not sure if these are acceptable substitute definitions in our context or not
inline uint8_t pgm_read_byte_near(const uint8_t *addr) { return *addr; }
inline int8_t pgm_read_byte_near(const int8_t *addr) { return *addr; }
inline char pgm_read_byte_near(const char *addr) { return *addr; }
inline uint16_t pgm_read_word_near(const uint16_t *addr) { return *addr; }
inline int16_t pgm_read_word_near(const int16_t *addr) { return *addr; }
inline uint32_t pgm_read_dword_near(const uint32_t *addr) { return *addr; }
inline int32_t pgm_read_dword_near(const int32_t *addr) { return *addr; }
inline float pgm_read_float_near(const float *addr) { return *addr; }
inline const void *pgm_read_ptr_near(const void **addr) { return *addr; }
inline uint8_t pgm_read_byte_near(const uint8_t *addr) {
return *addr;
}
inline int8_t pgm_read_byte_near(const int8_t *addr) {
return *addr;
}
inline char pgm_read_byte_near(const char *addr) {
return *addr;
}
inline uint16_t pgm_read_word_near(const uint16_t *addr) {
return *addr;
}
inline int16_t pgm_read_word_near(const int16_t *addr) {
return *addr;
}
inline uint32_t pgm_read_dword_near(const uint32_t *addr) {
return *addr;
}
inline int32_t pgm_read_dword_near(const int32_t *addr) {
return *addr;
}
inline float pgm_read_float_near(const float *addr) {
return *addr;
}
inline const void *pgm_read_ptr_near(const void **addr) {
return *addr;
}
#else
#define pgm_read_byte_near(addr) (*(const byte*)(addr))
#define pgm_read_word_near(addr) (*(const word*)(addr))

View File

@ -41,28 +41,63 @@ struct EERef{
: index(index) {}
//Access/read members.
uint8_t operator*() const { return eeprom_[index]; }
operator uint8_t() const { return **this; }
uint8_t operator*() const {
return eeprom_[index];
}
operator uint8_t() const {
return **this;
}
//Assignment/write members.
EERef &operator=( const EERef &ref ) { return *this = *ref; }
EERef &operator=( uint8_t in ) { eeprom_[index] = in; return *this; }
EERef &operator +=( uint8_t in ) { return *this = **this + in; }
EERef &operator -=( uint8_t in ) { return *this = **this - in; }
EERef &operator *=( uint8_t in ) { return *this = **this * in; }
EERef &operator /=( uint8_t in ) { return *this = **this / in; }
EERef &operator ^=( uint8_t in ) { return *this = **this ^ in; }
EERef &operator %=( uint8_t in ) { return *this = **this % in; }
EERef &operator &=( uint8_t in ) { return *this = **this & in; }
EERef &operator |=( uint8_t in ) { return *this = **this | in; }
EERef &operator <<=( uint8_t in ) { return *this = **this << in; }
EERef &operator >>=( uint8_t in ) { return *this = **this >> in; }
EERef &operator=(const EERef &ref) {
return *this = *ref;
}
EERef &operator=(uint8_t in) {
eeprom_[index] = in;
return *this;
}
EERef &operator +=(uint8_t in) {
return *this = **this + in;
}
EERef &operator -=(uint8_t in) {
return *this = **this - in;
}
EERef &operator *=(uint8_t in) {
return *this = **this * in;
}
EERef &operator /=(uint8_t in) {
return *this = **this / in;
}
EERef &operator ^=(uint8_t in) {
return *this = **this ^ in;
}
EERef &operator %=(uint8_t in) {
return *this = **this % in;
}
EERef &operator &=(uint8_t in) {
return *this = **this & in;
}
EERef &operator |=(uint8_t in) {
return *this = **this | in;
}
EERef &operator <<=(uint8_t in) {
return *this = **this << in;
}
EERef &operator >>=(uint8_t in) {
return *this = **this >> in;
}
EERef &update( uint8_t in ) { return in != *this ? *this = in : *this; }
EERef &update(uint8_t in) {
return in != *this ? *this = in : *this;
}
/** Prefix increment/decrement **/
EERef& operator++() { return *this += 1; }
EERef& operator--() { return *this -= 1; }
EERef& operator++() {
return *this += 1;
}
EERef& operator--() {
return *this -= 1;
}
/** Postfix increment/decrement **/
uint8_t operator++ (int) {
@ -93,18 +128,34 @@ struct EEPtr{
EEPtr(const int index)
: index(index) {}
operator int() const { return index; }
EEPtr &operator=( int in ) { return index = in, *this; }
operator int() const {
return index;
}
EEPtr &operator=(int in) {
return index = in, *this;
}
//Iterator functionality.
bool operator!=( const EEPtr &ptr ) { return index != ptr.index; }
EERef operator*() { return index; }
bool operator!=(const EEPtr &ptr) {
return index != ptr.index;
}
EERef operator*() {
return index;
}
/** Prefix & Postfix increment/decrement **/
EEPtr& operator++() { return ++index, *this; }
EEPtr& operator--() { return --index, *this; }
EEPtr operator++ (int) { return index++; }
EEPtr operator-- (int) { return index--; }
EEPtr& operator++() {
return ++index, *this;
}
EEPtr& operator--() {
return --index, *this;
}
EEPtr operator++ (int) {
return index++;
}
EEPtr operator-- (int) {
return index--;
}
int index; //Index of current EEPROM cell.
};
@ -120,15 +171,29 @@ struct EEPtr{
struct EEPROMClass {
//Basic user access methods.
EERef operator[]( const int idx ) { return idx; }
uint8_t read( int idx ) { return EERef( idx ); }
void write( int idx, uint8_t val ) { (EERef( idx )) = val; }
void update( int idx, uint8_t val ) { EERef( idx ).update( val ); }
EERef operator[](const int idx) {
return idx;
}
uint8_t read(int idx) {
return EERef(idx);
}
void write(int idx, uint8_t val) {
(EERef(idx)) = val;
}
void update(int idx, uint8_t val) {
EERef(idx).update(val);
}
//STL and C++11 iteration capability.
EEPtr begin() { return 0x00; }
EEPtr end() { return length(); } //Standards requires this to be the item after the last valid entry. The returned pointer is invalid.
uint16_t length() { return kaleidoscope::hardware::mcu::eeprom_size; }
EEPtr begin() {
return 0x00;
}
EEPtr end() {
return length(); //Standards requires this to be the item after the last valid entry. The returned pointer is invalid.
}
uint16_t length() {
return kaleidoscope::hardware::mcu::eeprom_size;
}
//Functionality to 'get' and 'put' objects to and from EEPROM.
template< typename T > T &get(int idx, T &t) {