Versions in this module Expand all Collapse all v0 v0.0.7 Jan 10, 2025 Changes in this version + type AnalogDevice struct + func NewAnalogDevice(name string, pin int) *AnalogDevice + type AnalogPin struct + func NewAnalogPin(name string, offset int) *AnalogPin + func (a *AnalogPin) Get() float64 + func (a *AnalogPin) Set(v float64) type Device + func (d *Device) EventLoop(done chan bool, readpub func() error) + func (d *Device) Shutdown() + func (d *Device) Subscribe(topic string, f func(*messanger.Msg)) + func (d *Device) TimerLoop(done chan bool, readpub func() error) type GPIO + func GetMockGPIO() *GPIO + type GPIODevice struct + func NewGPIODevice(name string, idx int, mode Mode, opts ...gpiocdev.LineReqOption) *GPIODevice + func (d *GPIODevice) Off() + func (d *GPIODevice) On() + func (d *GPIODevice) Set(v int) v0.0.6 Jan 3, 2025 Changes in this version type Device + Pub string + func (d *Device) Publish(data any) + type SerialDevice struct + Baud int + PortName string + func NewSerialDevice(name, port string, baud int) *SerialDevice + func (s *SerialDevice) Open() (err error) + func (s *SerialDevice) Read(buf []byte) (int, error) + func (s *SerialDevice) Write(buf []byte) (int, error) v0.0.5 Dec 31, 2024 v0.0.4 Dec 29, 2024 Changes in this version type Device + func NewDevice(name string) *Device + func (d *Device) AddPub(p string) v0.0.3 Dec 27, 2024 Changes in this version + type Device struct + EvtQ chan gpiocdev.LineEvent + Name string + Period time.Duration + Pubs []string + Subs []string + type DeviceGPIO struct + func NewDeviceGPIO(name string, idx int, mode Mode, opts ...gpiocdev.LineReqOption) *DeviceGPIO + func (d *DeviceGPIO) Off() + func (d *DeviceGPIO) On() + func (d *DeviceGPIO) Set(v int) + type DeviceManager struct + func GetDeviceManager() *DeviceManager + func (dm *DeviceManager) Add(d *Device) + func (dm *DeviceManager) Get(name string) *Device + type GPIO struct + Chipname string + Mock bool + Pins map[int]*Pin + func GetGPIO() *GPIO + func (gpio *GPIO) Init() error + func (gpio *GPIO) JSON() (j []byte, err error) + func (gpio *GPIO) Pin(name string, offset int, opts ...gpiocdev.LineReqOption) (p *Pin) + func (gpio *GPIO) Shutdown() + func (gpio *GPIO) String() string + type I2CDevice struct + Addr int + Bus string + func NewI2CDevice(name string, bus string, addr int) I2CDevice + type Line interface + Close func() error + Offset func() int + Reconfigure func(...gpiocdev.LineConfigOption) error + SetValue func(int) error + Value func() (int, error) + type MockLine struct + Val int + func GetMockLine(offset int, opts ...gpiocdev.LineReqOption) *MockLine + func (m *MockLine) Callback(msg *message.Msg) + func (m *MockLine) MockHWInput(v int) + func (m *MockLine) SetValue(val int) error + func (m MockLine) Close() error + func (m MockLine) Offset() int + func (m MockLine) Reconfigure(...gpiocdev.LineConfigOption) error + func (m MockLine) Value() (int, error) + type Mode int + const ModeInput + const ModeNone + const ModeOutput + const ModePWM + type Pin struct + Opts []gpiocdev.LineReqOption + func (p *Pin) Init() error + func (pin *Pin) Get() (int, error) + func (pin *Pin) Off() error + func (pin *Pin) On() error + func (pin *Pin) Set(v int) error + func (pin *Pin) String() string + func (pin *Pin) Toggle() error + func (pin Pin) Callback(msg *message.Msg)