diff --git a/internal/PinControlService/Pin.go b/internal/PinControlService/Pin.go index e2096ed..80dabe4 100644 --- a/internal/PinControlService/Pin.go +++ b/internal/PinControlService/Pin.go @@ -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) + } } } diff --git a/internal/PinControlService/PinControlConfig.go b/internal/PinControlService/PinControlConfig.go index b8ba27f..bb7b7d6 100644 --- a/internal/PinControlService/PinControlConfig.go +++ b/internal/PinControlService/PinControlConfig.go @@ -4,7 +4,7 @@ type PinConfig struct { PinNumber int `yaml:"number"` Name string `yaml:"name"` Direction PinDirection `yaml:"direction"` - PullConfig PinPull `yaml:"pull-config"` + PullConfig *PinPull `yaml:"pull-config"` InitialState *PinCommand `yaml:"initial-state"` SendPollingEvents *bool `yaml:"send-polling-events"` SendChangeEvents *bool `yaml:"send-change-events"`