SHA-256 hash verification of flash slots, pico_hash_binary, flash:: namespace, ring_buffer iterator, non-destructive log

This commit is contained in:
Ian Gulliver
2026-04-12 23:47:00 +09:00
parent cc37b711a4
commit 23587c41e2
7 changed files with 210 additions and 64 deletions

View File

@@ -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()}; }
};