diff options
author | xengineering <me@xengineering.eu> | 2024-05-30 18:21:27 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2024-05-30 20:06:16 +0200 |
commit | a4705ffdb76d412bbc3999877843f886cbd41f4c (patch) | |
tree | 6fc2ef15be337b55c523a5ea55f9e323037deed0 | |
parent | 0f62b35cb1a1ff69e8c29285322a251010cf5ee1 (diff) | |
download | iot-core-a4705ffdb76d412bbc3999877843f886cbd41f4c.tar iot-core-a4705ffdb76d412bbc3999877843f886cbd41f4c.tar.zst iot-core-a4705ffdb76d412bbc3999877843f886cbd41f4c.zip |
software: communication: Split setup and start
-rw-r--r-- | software/communication/interface.go | 4 | ||||
-rw-r--r-- | software/communication/physical.go | 5 | ||||
-rw-r--r-- | software/main.go | 2 |
3 files changed, 10 insertions, 1 deletions
diff --git a/software/communication/interface.go b/software/communication/interface.go index ebd8d6b..d124a48 100644 --- a/software/communication/interface.go +++ b/software/communication/interface.go @@ -20,6 +20,10 @@ func NewSerialInterface() (SerialInterface, error) { return iface, nil } +func (i *SerialInterface) Start() { + i.phy.start() +} + func (i *SerialInterface) Cat() { for { data := <-i.phy.rx diff --git a/software/communication/physical.go b/software/communication/physical.go index 0ba3690..e24c574 100644 --- a/software/communication/physical.go +++ b/software/communication/physical.go @@ -36,11 +36,14 @@ func newPhysical() (physical, error) { } p.rx = make(chan byte) - go p.Receive() return p, nil } +func (p *physical) start() { + go p.Receive() +} + func getStSerials() ([]string, error) { retval := make([]string, 0) diff --git a/software/main.go b/software/main.go index 0a6b590..dfc5de3 100644 --- a/software/main.go +++ b/software/main.go @@ -12,5 +12,7 @@ func main() { log.Fatal(err) } + iface.Start() + iface.Cat() } |