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:
Anna Rose Wiggins 2025-09-15 17:55:55 +00:00 committed by Anna Rose Wiggins
parent 62befa045a
commit 5e005478f1
12 changed files with 151 additions and 13 deletions

View file

@ -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

View file

@ -31,3 +31,9 @@ type RuleTargetConfigRelaxis struct {
type RuleTargetConfigModeSelect struct {
Modes []string
}
type RuleTargetConfigHat struct {
Device string
Hat string
Inverted bool
}

View file

@ -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,
}
)

View file

@ -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"`