Basic hat support. (#20)
Reviewed-on: #20 Co-authored-by: Anna Rose Wiggins <annabunches@gmail.com> Co-committed-by: Anna Rose Wiggins <annabunches@gmail.com>
This commit is contained in:
parent
62befa045a
commit
5e005478f1
12 changed files with 151 additions and 13 deletions
|
|
@ -54,6 +54,10 @@ func (dc *RuleConfig) UnmarshalYAML(unmarshal func(data interface{}) error) erro
|
|||
config := RuleConfigModeSelect{}
|
||||
err = unmarshal(&config)
|
||||
dc.Config = config
|
||||
case RuleTypeHat:
|
||||
config := RuleConfigHat{}
|
||||
err = unmarshal(&config)
|
||||
dc.Config = config
|
||||
}
|
||||
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -31,3 +31,9 @@ type RuleTargetConfigRelaxis struct {
|
|||
type RuleTargetConfigModeSelect struct {
|
||||
Modes []string
|
||||
}
|
||||
|
||||
type RuleTargetConfigHat struct {
|
||||
Device string
|
||||
Hat string
|
||||
Inverted bool
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ const (
|
|||
RuleTypeAxisToButton RuleType = "axis-to-button"
|
||||
RuleTypeAxisToRelaxis RuleType = "axis-to-relaxis"
|
||||
RuleTypeModeSelect RuleType = "mode-select"
|
||||
RuleTypeHat RuleType = "hat"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -30,6 +31,7 @@ var (
|
|||
"axis-to-button": RuleTypeAxisToButton,
|
||||
"axis-to-relaxis": RuleTypeAxisToRelaxis,
|
||||
"mode-select": RuleTypeModeSelect,
|
||||
"hat": RuleTypeHat,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,11 @@ type RuleConfigAxis struct {
|
|||
Output RuleTargetConfigAxis
|
||||
}
|
||||
|
||||
type RuleConfigHat struct {
|
||||
Input RuleTargetConfigHat
|
||||
Output RuleTargetConfigHat
|
||||
}
|
||||
|
||||
type RuleConfigAxisCombined struct {
|
||||
InputLower RuleTargetConfigAxis `yaml:"input_lower,omitempty"`
|
||||
InputUpper RuleTargetConfigAxis `yaml:"input_upper,omitempty"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue