SHA-256 hash verification of flash slots, pico_hash_binary, flash:: namespace, ring_buffer iterator, non-destructive log
This commit is contained in:
@@ -53,4 +53,15 @@ struct ring_buffer {
|
||||
uint16_t len = pending < contig ? pending : contig;
|
||||
return {data.data() + offset, len};
|
||||
}
|
||||
|
||||
struct iterator {
|
||||
const ring_buffer* rb;
|
||||
uint16_t index;
|
||||
const T& operator*() const { return rb->data[(rb->head + index) % N]; }
|
||||
iterator& operator++() { index++; return *this; }
|
||||
bool operator!=(const iterator& o) const { return index != o.index; }
|
||||
};
|
||||
|
||||
iterator begin() const { return {this, 0}; }
|
||||
iterator end() const { return {this, used()}; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user