xevi/simulation/include/EEPROM.h
Mikael Degerfält 266b3334cb Simple simulation code
Builds a native program on MacOS that runs the NuEVI firmware compiled for x86_64.
Only input is arrow keys for menu buttons for now. Only output is console and display.

Copied some more library files into the simulation folder, and renamed the modified *.cpp files from the libraries to *_sim.cpp.
2019-06-13 20:51:45 +02:00

42 lines
1.4 KiB
C

#ifndef __EEPROM_H
#define __EEPROM_H
#include <stdint.h>
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 ); }
//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 E2END + 1; }
//Functionality to 'get' and 'put' objects to and from EEPROM.
// template< typename T > T &get( int idx, T &t ){
// EEPtr e = idx;
// uint8_t *ptr = (uint8_t*) &t;
// for( int count = sizeof(T) ; count ; --count, ++e ) *ptr++ = *e;
// return t;
// }
// template< typename T > const T &put( int idx, const T &t ){
// const uint8_t *ptr = (const uint8_t*) &t;
// #ifdef __arm__
// eeprom_write_block(ptr, (void *)idx, sizeof(T));
// #else
// EEPtr e = idx;
// for( int count = sizeof(T) ; count ; --count, ++e ) (*e).update( *ptr++ );
// #endif
// return t;
// }
};
static EEPROMClass EEPROM __attribute__ ((unused));
#endif