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.

gpiostream: Stream.Duration() bug #206

@simokawa

Description

@simokawa

If I understand correctly, Stream.Resolution() is duration for a single bit and Duration() should return for all bits*.
Current implementation uses the count of bytes instead of bits, this looks wrong to me.
https://github.com/google/periph/blob/master/conn/gpio/gpiostream/gpiostream.go#L68
It should be
return b.Res * time.Duration(len(b.Bits)) * 8
Yeah, it is confusing that len(b.Bits) returns number of bytes.

There may be some code assuming this bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions