-
Notifications
You must be signed in to change notification settings - Fork 124
basic f1 HAL #431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
basic f1 HAL #431
Conversation
for (0..0xFF) |val| { | ||
byte[0] = @intCast(val); | ||
i2c2.write_blocking(ADDR, &byte, null) catch |err| { | ||
usart2.writer().print(" Transmite error {any}\n", .{err}) catch {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
|
||
var byte: [1]u8 = undefined; | ||
var to_read: [4]u8 = undefined; | ||
try usart2.write_blocking("START UART ECHO\n", null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Hello from from i2c master" or something
continue; | ||
}; | ||
i2c2.read_blocking(ADDR, &to_read, null) catch |err| { | ||
usart2.writer().print("Recive error {any}\n", .{err}) catch {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
var to_read: [4]u8 = undefined; | ||
try usart2.write_blocking("START UART ECHO\n", null); | ||
while (true) { | ||
for (0..0xFF) |val| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's let this run forever and just loop over the values
i2c2.clear_errors(); | ||
continue; | ||
}; | ||
try usart2.writer().print("0x{x}{x}{x}{x}\n", .{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are nicer ways to do this
}, | ||
.Fast => { | ||
if (speed > 400_000) { | ||
return comptime_fail_or_error("speed: {d} is too high for Fast mode", .{speed}, ConfigError.SpeedOverflow); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fast -> fast (or at least be consistent)
i2c.apply_internla(config, CCR, Trise); | ||
} | ||
|
||
fn apply_internla(i2c: I2C, config: Config, CCR: usize, Trise: usize) void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo internla -> internal
const mode: F_S = @enumFromInt(@intFromEnum(config.mode)); | ||
|
||
regs.CR1.modify(.{ | ||
.PE = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can one-line these
_ = i2c; | ||
_ = addr; | ||
_ = IO; | ||
//TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file issue please
//TODO: add timeout | ||
pub fn writev_blocking(uart: UART, payloads: []const []const u8, _: ?mdf.time.Duration) TransmitError!void { | ||
const regs = uart.get_regs(); | ||
//const deadline = mdf.time.Deadline.init_relative(time.get_time_since_boot(), timeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An issue for a time device for stm would be nice as well
No description provided.