Skip to content

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

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

Conversation

RecursiveError
Copy link
Contributor

No description provided.

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 {};
Copy link
Collaborator

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);
Copy link
Collaborator

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 {};
Copy link
Collaborator

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| {
Copy link
Collaborator

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", .{
Copy link
Collaborator

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);
Copy link
Collaborator

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 {
Copy link
Collaborator

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,
Copy link
Collaborator

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
Copy link
Collaborator

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);
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants