fix: reimpl debug reads w/out throwing away *const Self

This commit is contained in:
2022-10-21 05:12:55 -03:00
parent 20056eff2c
commit 7488fd7fd5
6 changed files with 155 additions and 76 deletions

View File

@@ -340,6 +340,10 @@ const Eeprom = struct {
return self.reader.read();
}
pub fn dbgRead(self: *const Self) u1 {
return self.reader.dbgRead();
}
pub fn write(self: *Self, word_count: u16, buf: *[]u8, bit: u1) void {
if (self.guessKind(word_count)) |found| {
log.info("EEPROM Kind: {}", .{found});
@@ -492,6 +496,19 @@ const Eeprom = struct {
return bit;
}
fn dbgRead(self: *const This) u1 {
if (!self.enabled) return 1;
const bit = if (self.i < 4) blk: {
break :blk 0;
} else blk: {
const idx = @intCast(u6, 63 - (self.i - 4));
break :blk @truncate(u1, self.data >> idx);
};
return bit;
}
};
const Writer = struct {