Getting Started documentation doesn't work with MicroZig 0.15.0
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 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時間
- マージ済み PR(30日)
- 37
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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
components-web-app/docs#245 ·
-
難易度 1/5 1〜3時間 初心者へのやさしさ 75/100
siyuan-note/siyuan#20629 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
aws-samples/sample-per-model-bedrock#261 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100