uart improvements and improved definition of how many clock units there are (#16)
This commit is contained in:
parent
b0b90a7cf0
commit
e9af302b69
|
@ -82,7 +82,7 @@ pub const Generator = enum(u32) {
|
|||
}
|
||||
|
||||
const generators = @intToPtr(
|
||||
*volatile [10]GeneratorRegs,
|
||||
*volatile [@typeInfo(Generator).Enum.fields.len]GeneratorRegs,
|
||||
regs.CLOCKS.base_address,
|
||||
);
|
||||
|
||||
|
|
|
@ -226,6 +226,7 @@ var uart_logger: ?UART.Writer = null;
|
|||
|
||||
pub fn initLogger(uart: UART) void {
|
||||
uart_logger = uart.writer();
|
||||
uart_logger.?.writeAll("\r\n================ STARTING NEW LOGGER ================\r\n") catch {};
|
||||
}
|
||||
|
||||
pub fn log(
|
||||
|
@ -248,3 +249,16 @@ pub fn log(
|
|||
uart.print(prefix ++ format ++ "\r\n", .{ seconds, microseconds } ++ args) catch {};
|
||||
}
|
||||
}
|
||||
|
||||
pub fn panic(
|
||||
message: []const u8,
|
||||
_: ?*std.builtin.StackTrace,
|
||||
_: ?usize,
|
||||
) noreturn {
|
||||
if (uart_logger) |writer| {
|
||||
writer.print("PANIC: {s}\r\n", .{message}) catch {};
|
||||
}
|
||||
|
||||
@breakpoint();
|
||||
while (true) {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user