| 51 | // Emit one byte's worth of edge pairs (MSB first) into the buffer. |
| 52 | template <fl::size N> |
| 53 | void appendByte(fl::vector<EdgeTime>& edges, u8 byte) { |
| 54 | for (int bit = 7; bit >= 0; --bit) { |
| 55 | bool one = ((byte >> bit) & 0x1) != 0; |
| 56 | edges.push_back(EdgeTime(true, one ? 800u : 400u)); // HIGH |
| 57 | edges.push_back(EdgeTime(false, one ? 450u : 850u)); // LOW |
| 58 | } |
| 59 | (void)N; |
| 60 | } |
| 61 | |
| 62 | // Wrap a `fl::vector<EdgeTime>` as a span for injectEdges(). |
| 63 | fl::span<const EdgeTime> toSpan(const fl::vector<EdgeTime>& v) { |