- fix RPI crash when changing state of output pin
(reason: DetectAnyEdge() was also configured for output pins) - version string has now also build date - updated golang dependencies
This commit is contained in:
@@ -3,26 +3,35 @@
|
||||
package PinControlService
|
||||
|
||||
type PinEmu struct {
|
||||
state State
|
||||
number int
|
||||
}
|
||||
|
||||
func (*PinEmu) Toggle() {}
|
||||
func (*PinEmu) High() {}
|
||||
func (*PinEmu) Low() {}
|
||||
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 }
|
||||
func (*PinEmu) Input() {}
|
||||
func (*PinEmu) Output() {}
|
||||
func (*PinEmu) Detect(Edge) {}
|
||||
func (*PinEmu) PullUp() {}
|
||||
func (*PinEmu) PullDown() {}
|
||||
func (*PinEmu) PullOff() {}
|
||||
func (*PinEmu) Read() State { return LowState }
|
||||
func (p *PinEmu) Read() State { return p.state }
|
||||
func (*PinEmu) EdgeDetected() bool { return false }
|
||||
|
||||
type HardwarePin struct {
|
||||
Pin PinEmu
|
||||
}
|
||||
|
||||
func NewHardwarePin(n int) HardwarePinInterface {
|
||||
return &PinEmu{}
|
||||
func NewHardwarePin(num int) HardwarePinInterface {
|
||||
return &PinEmu{state: LowState, number: num}
|
||||
}
|
||||
|
||||
func HardwarePinOpen() error {
|
||||
|
||||
Reference in New Issue
Block a user