Compare commits
3 Commits
feature/re
...
bugfix/fix
| Author | SHA1 | Date | |
|---|---|---|---|
| 735087eb17 | |||
| 78c9247396 | |||
| 851e1c0ffb |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1,3 @@
|
|||||||
install/*
|
install/*
|
||||||
|
rpicontrol
|
||||||
|
rpicontrol*.tar.gz
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ type Pin struct {
|
|||||||
Id int
|
Id int
|
||||||
Name string
|
Name string
|
||||||
Direction PinDirection
|
Direction PinDirection
|
||||||
PullConfig PinPull
|
PullConfig *PinPull
|
||||||
InitialState *PinCommand
|
InitialState *PinCommand
|
||||||
PinHandle HardwarePinInterface
|
PinHandle HardwarePinInterface
|
||||||
SendPollingEvents bool
|
SendPollingEvents bool
|
||||||
@@ -77,7 +77,7 @@ func (p *Pin) Configure() {
|
|||||||
log.Infof("configuring pin %s (pin no: %d) as Output", p.Name, p.Id)
|
log.Infof("configuring pin %s (pin no: %d) as Output", p.Name, p.Id)
|
||||||
p.PinHandle.Output()
|
p.PinHandle.Output()
|
||||||
if p.InitialState != nil {
|
if p.InitialState != nil {
|
||||||
log.Infof("set initial state \"%s\" for pin %s (pin no: %d)", p.InitialState, p.Name, p.Id)
|
log.Infof("set initial state \"%s\" for pin %s (pin no: %d)", *p.InitialState, p.Name, p.Id)
|
||||||
_ = p.Command(*p.InitialState)
|
_ = p.Command(*p.InitialState)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,14 +85,16 @@ func (p *Pin) Configure() {
|
|||||||
|
|
||||||
p.PinHandle.Detect(AnyEdge)
|
p.PinHandle.Detect(AnyEdge)
|
||||||
|
|
||||||
if p.PullConfig == PullUp {
|
if p.PullConfig != nil {
|
||||||
|
if *p.PullConfig == PullUp {
|
||||||
p.PinHandle.PullUp()
|
p.PinHandle.PullUp()
|
||||||
} else if p.PullConfig == PullDown {
|
} else if *p.PullConfig == PullDown {
|
||||||
p.PinHandle.PullDown()
|
p.PinHandle.PullDown()
|
||||||
} else if p.PullConfig == PullOff {
|
} else if *p.PullConfig == PullOff {
|
||||||
p.PinHandle.PullOff()
|
p.PinHandle.PullOff()
|
||||||
} else {
|
} else {
|
||||||
log.Errorf("unknown config value \"%s\" for pull-config", p.PullConfig)
|
log.Errorf("unknown config value \"%s\" for pull-config", *p.PullConfig)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ type PinConfig struct {
|
|||||||
PinNumber int `yaml:"number"`
|
PinNumber int `yaml:"number"`
|
||||||
Name string `yaml:"name"`
|
Name string `yaml:"name"`
|
||||||
Direction PinDirection `yaml:"direction"`
|
Direction PinDirection `yaml:"direction"`
|
||||||
PullConfig PinPull `yaml:"pull-config"`
|
PullConfig *PinPull `yaml:"pull-config"`
|
||||||
InitialState *PinCommand `yaml:"initial-state"`
|
InitialState *PinCommand `yaml:"initial-state"`
|
||||||
SendPollingEvents *bool `yaml:"send-polling-events"`
|
SendPollingEvents *bool `yaml:"send-polling-events"`
|
||||||
SendChangeEvents *bool `yaml:"send-change-events"`
|
SendChangeEvents *bool `yaml:"send-change-events"`
|
||||||
|
|||||||
Reference in New Issue
Block a user