Custom `Frequency` enum shared across hals
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 18/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- zig
- 领域
- embedded-iot
调研方向
The issue names no files or tests; the only code is a proof-of-concept Frequency enum and a call to i2c.apply(.{ .baud_rate = .khz(100) }). Start by finding where the HAL I2C config and its baud_rate field are defined in the repository. The open question is whether a shared frequency type should exist and where other measures could use decl literals, so a maintainer must decide the scope before any code. Done would need that decision recorded.
由索引模型根据 Issue 内容生成。
描述
i2c.apply(.{
.baud_rate = .khz(100),
});
// POC implementation
const Frequency = enum(u32) {
_,
pub fn hz(value: u32) Frequency {
return @enumFromInt(value);
}
pub fn khz(value: u32) Frequency {
return @enumFromInt(value * 1_000);
}
pub fn mhz(value: u32) Frequency {
// what to do about overflows? Though I think it's fine to assert that the result must fit into u32.
return @enumFromInt(value * 1_000_000);
}
};
This would be used for baud rates, etc.
Something like this can be applied for other measures as well (apart from Frequency). In what other places can we use decl literals for more verbose initializations?
- 主要语言
- Zig
- 星标
- 2.3k
- 派生
- 198
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 37
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ZigEmbeddedGroup/microzig 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 88/100
ZigEmbeddedGroup/microzig#1086 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 69/100
ZigEmbeddedGroup/microzig#1085 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
ZigEmbeddedGroup/microzig#1061 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
ZigEmbeddedGroup/microzig#1059 · 1 条评论 ·
维护者通常 1 天内回复
-
regz: AVR peripherals generated at address 0 when the register-group name matches the module (ATDF)未关闭
难度 4/5 3-5 天 新手友好度 48/100
ZigEmbeddedGroup/microzig#1072 ·
维护者通常 1 天内回复
查看 ZigEmbeddedGroup/microzig 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 88/100
zephyrproject-rtos/zephyr#122261 ·
维护者通常 3 天内回复
-
area: core priority: p2 type: bug
难度 2/5 1-3 小时 新手友好度 72/100
EPFL-TOP/smart-microscope-control#132 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
FujiNetWIFI/fujinet-config#264 ·
维护者通常 1 天内回复
-
scope:mqtt-bridge type:feature
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
bvis/aegis-hass#588 · 1 条评论 ·
维护者通常 1 天内回复