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

This commit is contained in:
2022-08-07 05:11:29 -05:00
parent 5a18b1dcc7
commit 739db99c83
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 {