th7/core/th7.go

59 lines
818 B
Go
Raw Normal View History

2022-11-12 14:20:29 +00:00
package core
import (
"sync"
2022-11-12 16:22:55 +00:00
"th7/data/config"
2022-11-12 14:20:29 +00:00
"th7/data/core"
"th7/ports"
)
type TH7Adapter struct {
pcbPort ports.PCBPort
mu sync.Mutex
data core.Data
}
2022-11-12 16:22:55 +00:00
func NewTH7Adapter(pcbPort ports.PCBPort, cfg config.Config) *TH7Adapter {
2022-11-12 14:20:29 +00:00
var adapter TH7Adapter
adapter.pcbPort = pcbPort
return &adapter
}
func (t *TH7Adapter) GetChannel(id int) (core.Channel, error) {
t.mu.Lock()
defer t.mu.Unlock()
return t.data.Channels[0], nil
}
func (t *TH7Adapter) GetAll() core.Data {
t.mu.Lock()
defer t.mu.Unlock()
return t.data
}
func (t *TH7Adapter) GetVref() float64 {
t.mu.Lock()
defer t.mu.Unlock()
return 0
}
func (t *TH7Adapter) GetVadj() float64 {
t.mu.Lock()
defer t.mu.Unlock()
return 0
}
func (t *TH7Adapter) GetPivdd() float64 {
t.mu.Lock()
defer t.mu.Unlock()
return 0
}