Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Getting Started documentation doesn't work with MicroZig 0.15.0

オープン
#860 コメント 3 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 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

  1. Follow the getting started guide exactly as written
  2. Install MicroZig 0.15.0 as instructed:
    zig fetch --save https://github.com/ZigEmbeddedGroup/microzig/releases/download/0.15.0/microzig.tar.gz
    
  3. 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);
        }
    }
    
  4. 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:

  1. Update the documentation to show code that works with 0.15.0 (using gpio.num() directly), or
  2. 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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ZigEmbeddedGroup/microzig のほかの issue

ZigEmbeddedGroup/microzig の issue をすべて見る

似ている issue

Documentation の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。