External memory log
Diff: MemLog.h
- Revision:
- 0:b631881feed3
diff -r 000000000000 -r b631881feed3 MemLog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MemLog.h Mon May 30 08:10:08 2016 +0000 @@ -0,0 +1,40 @@ +/* Log system for internal memory flash +* Copyright (c) 2013 Oleg Evsegneev +* Released under the MIT License: http://mbed.org/license/mit +*/ + +#ifndef MBED_MEMLOG_H +#define MBED_MEMLOG_H + +#include "mbed.h" + +#define LOG_FILE "/local/log.txt" + +class MemLog { + +public: + MemLog( short cols, short rows ); + + /** Set new value to log + * + * @param value Value of log entry. + */ + void log( float val ); + + /** Save log to file on flash + * + */ + void save(); + +protected: + LocalFileSystem _local; + float _data[4000]; + unsigned short _addr; + short _cols; + short _rows; + short _row; + void toArray( float val, char *bytes ); + float fromArray( char *bytes ); +}; + +#endif \ No newline at end of file