rpicontrol/internal/PinControlService/HardwarePinEmu.go

40 lines
856 B
Go
Raw Normal View History

2022-12-30 17:42:48 +00:00
//go:build !arm && !arm64
package PinControlService
type PinEmu struct {
state State
number int
2022-12-30 17:42:48 +00:00
}
func (p *PinEmu) Toggle() {
if p.state == LowState {
p.state = HighState
} else {
p.state = LowState
}
}
func (p *PinEmu) High() { p.state = HighState }
func (p *PinEmu) Low() { p.state = LowState }
2022-12-30 17:42:48 +00:00
func (*PinEmu) Input() {}
func (*PinEmu) Output() {}
func (*PinEmu) Detect(Edge) {}
func (*PinEmu) PullUp() {}
func (*PinEmu) PullDown() {}
func (*PinEmu) PullOff() {}
func (p *PinEmu) Read() State { return p.state }
2022-12-30 17:42:48 +00:00
func (*PinEmu) EdgeDetected() bool { return false }
type HardwarePin struct {
Pin PinEmu
}
func NewHardwarePin(num int) HardwarePinInterface {
return &PinEmu{state: LowState, number: num}
2022-12-30 17:42:48 +00:00
}
func HardwarePinOpen() error {
return nil
}