gpio

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GPIOAdapter

type GPIOAdapter interface {
	WriteTogglePin(value bool)
	ReadOpenPin() bool
	ReadClosedPin() bool
	Reset() error
}

GPIOAdapter specifies the interface for GPIO operations.

func GetGPIOAdapter

func GetGPIOAdapter() GPIOAdapter

GetGPIOAdapter returns the GPIO adapter based on the current mode.

type GPIOMockAdapter

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

GPIOMockAdapter is a mock GPIO adapter, which: - mimicks the behavior of the garage door, without the delays of a physical door and motor. - reports all actions to the log.

func NewGPIOMockAdapter

func NewGPIOMockAdapter(togglePin int, openPin int, closedPin int) *GPIOMockAdapter

NewGPIOMockAdapter creates a new GPIOMockAdapter.

func (*GPIOMockAdapter) ReadClosedPin

func (g *GPIOMockAdapter) ReadClosedPin() bool

ReadClosedPin returns true if the closed pin is high, and false otherwise.

func (*GPIOMockAdapter) ReadOpenPin

func (g *GPIOMockAdapter) ReadOpenPin() bool

ReadOpenPin returns true if the open pin is high, and false otherwise.

func (*GPIOMockAdapter) Reset

func (g *GPIOMockAdapter) Reset() error

Reset the pins to their initial state.

func (*GPIOMockAdapter) WriteTogglePin

func (g *GPIOMockAdapter) WriteTogglePin(value bool)

WriteTogglePin sets the toggle pin to high when value is true.

type GPIORPiAdapter

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

GPIORPiAdapter is an adapter for the Raspberry Pi GPIO pins.

func NewGPIORPiAdapter

func NewGPIORPiAdapter(togglePin int, openPin int, closedPin int) *GPIORPiAdapter

NewGPIORPiAdapter creates a new GPIORPiAdapter.

func (*GPIORPiAdapter) ReadClosedPin

func (g *GPIORPiAdapter) ReadClosedPin() bool

ReadClosedPin returns true if the closed pin is high, and false otherwise

func (*GPIORPiAdapter) ReadOpenPin

func (g *GPIORPiAdapter) ReadOpenPin() bool

ReadOpenPin returns true if the open pin is high, and false otherwise

func (*GPIORPiAdapter) Reset

func (g *GPIORPiAdapter) Reset() error

Reset isn't implemented dfor this adapter type.

func (*GPIORPiAdapter) WriteTogglePin

func (g *GPIORPiAdapter) WriteTogglePin(value bool)

WriteTogglePin sets the toggle pin to high when value is true.

Jump to

Keyboard shortcuts

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