MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / load

Method load

libraries/FRAM_I2C/FRAM_RINGBUFFER.cpp:143–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141
142
143bool FRAM_RINGBUFFER::load()
144{
145 uint32_t pos = _start - 20;
146 uint32_t size = _fram->read32(pos + 0);
147 uint32_t front = _fram->read32(pos + 4);
148 uint32_t tail = _fram->read32(pos + 8);
149 uint32_t count = _fram->read32(pos + 12);
150 uint32_t checksum = _fram->read32(pos + 16);
151 // checksum test should be enough.
152 // optional these are possible
153 // (_start <= _front) && (_front < _start + _size);
154 // (_start <= _tail) && (_tail < _start + _size);
155 _saved = (checksum == size + front + tail + count);
156 if (_saved)
157 {
158 _size = size;
159 _front = front;
160 _tail = tail;
161 _count = count;
162 }
163 return _saved;
164}
165
166
167void FRAM_RINGBUFFER::wipe()

Callers

nothing calls this directly

Calls 1

read32Method · 0.80

Tested by

no test coverage detected