- fix PinPull optional configuration
This commit is contained in:
@@ -9,7 +9,7 @@ type Pin struct {
|
||||
Id int
|
||||
Name string
|
||||
Direction PinDirection
|
||||
PullConfig PinPull
|
||||
PullConfig *PinPull
|
||||
InitialState *PinCommand
|
||||
PinHandle HardwarePinInterface
|
||||
SendPollingEvents bool
|
||||
@@ -85,14 +85,16 @@ func (p *Pin) Configure() {
|
||||
|
||||
p.PinHandle.Detect(AnyEdge)
|
||||
|
||||
if p.PullConfig == PullUp {
|
||||
p.PinHandle.PullUp()
|
||||
} else if p.PullConfig == PullDown {
|
||||
p.PinHandle.PullDown()
|
||||
} else if p.PullConfig == PullOff {
|
||||
p.PinHandle.PullOff()
|
||||
} else {
|
||||
log.Errorf("unknown config value \"%s\" for pull-config", p.PullConfig)
|
||||
if p.PullConfig != nil {
|
||||
if *p.PullConfig == PullUp {
|
||||
p.PinHandle.PullUp()
|
||||
} else if *p.PullConfig == PullDown {
|
||||
p.PinHandle.PullDown()
|
||||
} else if *p.PullConfig == PullOff {
|
||||
p.PinHandle.PullOff()
|
||||
} else {
|
||||
log.Errorf("unknown config value \"%s\" for pull-config", *p.PullConfig)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user