feat(ezcoo): serial driver for EZCOO HDMI matrix

This commit is contained in:
2026-05-24 18:52:52 +03:00
parent e5dd77a00d
commit e99616a135
6 changed files with 256 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
package ezcoo
import (
"errors"
"fmt"
"time"
)
type Config struct {
Port string `yaml:"port"`
Baud int `yaml:"baud"`
PollInterval time.Duration `yaml:"poll_interval"`
}
func (c *Config) SetDefaults() {
if c.Port == "" {
c.Port = "/dev/ttyACM0"
}
if c.Baud == 0 {
c.Baud = 57600
}
if c.PollInterval == 0 {
c.PollInterval = 15 * time.Second
}
}
func (c *Config) Validate() error {
if c.Port == "" {
return errors.New("device.port is required")
}
if c.Baud <= 0 {
return fmt.Errorf("device.baud must be positive, got %d", c.Baud)
}
return nil
}