![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Fork to see if I can get working
Dependencies: BufferedSerial OneWire WinbondSPIFlash libxDot-dev-mbed5-deprecated
Fork of xDotBridge_update_test20180823 by
Diff: xDotBridge/src/EepromLog.cpp
- Revision:
- 73:dc5adf462660
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xDotBridge/src/EepromLog.cpp Mon Apr 10 16:06:31 2017 -0600 @@ -0,0 +1,40 @@ +/* + * EepromLog.cpp + * + * Created on: Mar 23, 2017 + * Author: mbriggs + */ + +#include "EepromLog.h" +#include "dot_util.h" +#include <cstring> + +EepromLog::EepromLog(uint16_t baseAddr, uint8_t size) +{ + mBaseAddr = baseAddr; + mLogSize = size; + mData = new uint8_t[size]; +} +EepromLog::~EepromLog() +{ + mLogSize=0; + delete mData; +} +void EepromLog::clear() +{ + if (mLogSize == 0 || mData == NULL) + return; + std::memset(mData, 0x00, mLogSize); +} +bool EepromLog::read() +{ + if (mLogSize == 0 || mData == NULL) + return false; + return dot->nvmRead(mBaseAddr, mData, mLogSize); +} +bool EepromLog::save() +{ + if (mLogSize == 0 || mData == NULL) + return false; + return dot->nvmWrite(mBaseAddr, mData, mLogSize); +}