-
Notifications
You must be signed in to change notification settings - Fork 155
Add HTS221 sensor driver (temperature only) #746
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?
Conversation
|
|
||
| // 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 { |
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.
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(.{ |
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.
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
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.
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 { |
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.
what was the inline issue? Do we need to fix other examples?
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.
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.
No description provided.