Skip to content

Instantly share code, notes, and snippets.

@via
Created July 13, 2019 14:56
Show Gist options
  • Save via/5601df999e08953ab65d597db4cb792f to your computer and use it in GitHub Desktop.
Save via/5601df999e08953ab65d597db4cb792f to your computer and use it in GitHub Desktop.
pub const Console = struct {
buf: [1024]u8,
_buf: []u8,
outstream: std.io.SliceOutStream,
pub fn init() Console {
var ret : Console = undefined;
ret._buf = ret.buf[0..];
ret.outstream = std.io.SliceOutStream.init(ret._buf);
return ret;
}
pub fn process(self: *Console) void {
self.outstream.reset();
self.outstream.stream.print("rpm: {}\n", c_tfi.config.decoder.rpm) catch unreachable;
self.outstream.stream.print("fueling_us: {}\n", c_tfi.calculated_values.fueling_us) catch unreachable;
const output = self.outstream.getWritten();
std.debug.warn("{}", output);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment