Getting Started documentation doesn't work with MicroZig 0.15.0
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 35/100
- Issue 类型
- 文档
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- raspberry-pi
调研方向
Start with the Getting Started page in the docs and the RP2xxx pin configuration apply() in the MicroZig HAL, which the issue says returns void in 0.15.0. Check the docs example against that signature, and use the workaround in the issue as a reference for the gpio.num() form. Done means either the docs example compiles against 0.15.0 or the maintainers have chosen between the two fixes. The thread is stale and the fix direction is not settled, so confirm with a maintainer before writing the change.
由索引模型根据 Issue 内容生成。
描述
Problem
The Getting Started guide shows example code that doesn't compile with the recommended MicroZig version (0.15.0).
Steps to Reproduce
- Follow the getting started guide exactly as written
- Install MicroZig 0.15.0 as instructed:
zig fetch --save https://github.com/ZigEmbeddedGroup/microzig/releases/download/0.15.0/microzig.tar.gz - Use the example code from the docs:
const pin_config = rp2xxx.pins.GlobalConfiguration{ .GPIO25 = .{ .name = "led", .direction = .out, }, }; pub fn main() !void { const pins = pin_config.apply(); while (true) { pins.led.toggle(); time.sleep_ms(250); } } - Run
zig build
Expected Behavior
The code should compile and work as documented.
Actual Behavior
Compilation fails with:
src/main.zig:17:13: error: type 'void' does not support field access
pins.led.toggle();
~~~~^~~~
Root Cause
In MicroZig 0.15.0, the GlobalConfiguration.apply() function returns void, not a struct with named pin fields. The function signature is:
pub fn apply(comptime config: GlobalConfiguration) void {
So const pins = pin_config.apply() results in pins having type void, which doesn't support field access.
Environment
- Zig version: 0.15.2
- MicroZig version: 0.15.0 (as recommended in docs)
- Target: Raspberry Pi Pico (RP2040)
Suggested Fix
Either:
- Update the documentation to show code that works with 0.15.0 (using
gpio.num()directly), or - Release a new version of MicroZig where
apply()returns a struct with named pins, and update the docs to recommend that version
Workaround
For anyone hitting this issue, here's working code for MicroZig 0.15.0:
const std = @import("std");
const microzig = @import("microzig");
const rp2xxx = microzig.hal;
const time = rp2xxx.time;
const gpio = rp2xxx.gpio;
pub fn main() !void {
const led = gpio.num(25);
led.set_function(.sio);
led.set_direction(.out);
while (true) {
led.toggle();
time.sleep_ms(250);
}
}
- 主要语言
- 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
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
Frontmatter next to `src:` is applied to every imported slide, not only the first (undocumented)未关闭
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
[scanner] check:spelling skips blog/ — posts and author metadata are never spell-checked可能已有人在做 @hivecommons-hive 今天认领。 未关闭agent/scanner bug hive/covered-by-pr hive/hosted-available-lke648397-260827-5n31
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
-
status:untriaged
难度 2/5 1-3 小时 新手友好度 72/100
midnightntwrk/midnight-js#1482 ·
维护者通常 1 天内回复