Skip to content

Conversation

@mathk
Copy link
Contributor

@mathk mathk commented Dec 2, 2025

No description provided.

@Grazfather Grazfather changed the title Add HTS221 sensor driver for remperature only Add HTS221 sensor driver (temperature only) Dec 3, 2025

// Simpler version of MMIO to ease register setting.
// I guess this would be a nice abstraction to have in the framework base
fn Reg(comptime PackedT: type) type {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this could be moved somewhere. If you move it we should file an issue to update other drivers to use it.

fn setup_average(self: *@This(), avgt: AVGT, avgh: AVGH) !void {
try self.dev.write_then_read(address, &[_]u8{RegsAddr.AV_CONF.v()}, self.read_buffer[0..1]);
var reg = AV_CONF.from(self.read_buffer[0]);
reg.modify(.{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only time you actually set more than one field with modify. We can probably just use simple structs, maybe an extra PR to add this reg type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest for consistency to always use the Regs abstraction. Even when the solution could be accomplish with struct alone. (It also hide those bitCast). Wdyt?

microzig.board.init_log();
}

pub noinline fn main() !void {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what was the inline issue? Do we need to fix other examples?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is due to the FPU. and release mode. If the main is inline into microzig_main the function will start with some vpush instruction before you can enable fpu which rise a fault. I guess a better approach would be to enable FPU at the very beginning and even maybe decide that at build time with some options.

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