gpio

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bit

type Bit struct {
	// contains filtered or unexported fields
}

Bit represents a single bit in a GPIO port.

func BitForPin

func BitForPin(pin iomux.Pin) Bit

BitForPin returns the GPIO bit that corresponds to the given pin.

func UsePin

func UsePin(pin iomux.Pin) Bit

UsePin connects pin to the GPIO (SIO) peripheral and returns the corresponding GPIO bit (see also BitForPin).

func (Bit) Clear

func (b Bit) Clear()

Clear sets the output value of this bit to 0 in one atomic operation.

func (Bit) DisableOut

func (b Bit) DisableOut()

DisableOut disables output for this bit.

func (Bit) EnableOut

func (b Bit) EnableOut()

EnableOut enables output for this bit.

func (Bit) IsValid

func (b Bit) IsValid() bool

IsValid reports whether b represents a valid bit.

func (Bit) Load

func (b Bit) Load() int

Load samples the value of the connected pin.

func (Bit) LoadOut

func (b Bit) LoadOut() int

LoadOut returns the output value set for this pin.

func (Bit) Mask

func (b Bit) Mask() uint32

Mask returns a bitmask that represents the bit in a port

func (Bit) Num

func (b Bit) Num() int

Num returns the bit number in the port.

func (Bit) OutEnabled

func (b Bit) OutEnabled() bool

OutEnabled reports the output enabled state.

func (Bit) Port

func (b Bit) Port() *Port

Port returns the port where the bit is located.

func (Bit) Set

func (b Bit) Set()

Set sets the output value of this bit to 1 in one atomic operation.

func (Bit) Store

func (b Bit) Store(val int)

Store sets the bit value to the least significant bit of val.

func (Bit) Toggle

func (b Bit) Toggle()

Toggle toggles the output value of this bit in one atomic operation.

type Port

type Port struct {
	// contains filtered or unexported fields
}

Port represents an 32-bit GPIO port.

func P

func P(n int) *Port

P returns the n-th GPIO port.

func (*Port) Bit

func (p *Port) Bit(n int) Bit

Bit returns the n-th bit from the p port.

func (*Port) Clear

func (p *Port) Clear(bits uint32)

Clear sets the output value for the given bits of this port to 0.

func (*Port) DisableOut

func (p *Port) DisableOut(bits uint32)

DisableOut disables output for given bits.

func (*Port) EnableOut

func (p *Port) EnableOut(bits uint32)

EnableOut enables output for given bits.

func (*Port) Load

func (p *Port) Load() uint32

Load samples the value of the pins connected to this port.

func (*Port) LoadOut

func (p *Port) LoadOut() uint32

LoadOut returns the output value for this port.

func (*Port) Num

func (p *Port) Num() int

Num returns the port number.

func (*Port) OutEnabled

func (p *Port) OutEnabled() uint32

OutEnabled returns the bits in the output enable state.

func (*Port) Set

func (p *Port) Set(bits uint32)

Set sets the output value for the given bits of this port to 1.

func (*Port) Store

func (p *Port) Store(bits uint32)

Store sets the output of this port to bits.

func (*Port) Toggle

func (p *Port) Toggle(bits uint32)

Toggle toggles the output value for the given bits of this port.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL