first commit of files

This commit is contained in:
Adrian Zürcher
2025-04-18 10:30:18 +02:00
parent 5595af0add
commit f213f53547
22 changed files with 842 additions and 0 deletions

25
models/device.go Normal file
View File

@@ -0,0 +1,25 @@
package models
import "fmt"
type Device struct {
startAddress uint
length uint
channels *DMX
}
func NewDevice(startAddress uint, channels uint, dmx *DMX) *Device {
return &Device{
startAddress: startAddress,
length: channels,
channels: dmx,
}
}
func (d *Device) SetChannelValue(channel uint, value uint8) error {
if d.length == channel {
return fmt.Errorf("channel out of range %d", channel)
}
d.channels.SetValue(d.startAddress+channel, value)
return nil
}