Skip to content
This repository was archived by the owner on Mar 2, 2026. It is now read-only.
This repository was archived by the owner on Mar 2, 2026. It is now read-only.

Halt() does not unblock WaitForEdge() #423

@toxygene

Description

@toxygene

According to the documentation, calling Halt() or In() on a pin should cause WaitForEdge() to unblock and return false. When I attempt to do this on a Raspberry Pi Zero W, however, WaitForEdge() does not become unblocked.

package main

import (
	"fmt"
	"time"

	"periph.io/x/periph/conn/gpio"
	"periph.io/x/periph/conn/gpio/gpioreg"
	"periph.io/x/periph/host"
)

func main() {
	if _, err := host.Init(); err != nil {
		panic(err)
	}

	aPin := gpioreg.ByName("23")
	aPin.In(gpio.PullUp, gpio.BothEdges)

	go func() {
		time.Sleep(1 * time.Second)

		fmt.Println("calling Halt()")
		aPin.Halt()
		fmt.Println("called Halt()")
	}()

	fmt.Println("wait for edge")
	aPin.WaitForEdge(-1)
	fmt.Println("done waiting for edge")
}

This program will output:

wait for edge
calling Halt()
called Halt()

and then block indefinitely.

Platform:

  • OS: Raspbian GNU/Linux 9
  • Board: Raspberry Pi Zero Wireless

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions