diff options
author | xengineering <me@xengineering.eu> | 2024-05-30 16:47:29 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2024-05-30 16:48:39 +0200 |
commit | 96d159114af675d55fe0d7c0f22a69d65e9563fc (patch) | |
tree | 1d7b7e6a84b5d06765084ea6414874a21d3cbaa5 /software/main.go | |
parent | 0cfd378394b6c5d90e00c217b12113e0c3284031 (diff) | |
download | iot-core-96d159114af675d55fe0d7c0f22a69d65e9563fc.tar iot-core-96d159114af675d55fe0d7c0f22a69d65e9563fc.tar.zst iot-core-96d159114af675d55fe0d7c0f22a69d65e9563fc.zip |
software: communication: Add SerialInterface
This new type bundles the whole communication stack. This is easier to
use than handling types for each layer on the user side of the
communication package.
Diffstat (limited to 'software/main.go')
-rw-r--r-- | software/main.go | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/software/main.go b/software/main.go index 48b71e7..d0d3a8c 100644 --- a/software/main.go +++ b/software/main.go @@ -7,22 +7,10 @@ import ( ) func main() { - ports, err := communication.GetStSerials() + iface, err := communication.NewSerialInterface() if err != nil { log.Fatal(err) } - if len(ports) != 1 { - log.Fatalf("Require exactly one serial port from STMicroelectronics but %d attached", len(ports)) - } - - log.Printf("Detected serial port: %s\n", ports[0]) - - phy, err := communication.NewPhy(ports[0]) - - log.Println("Starting to print out incoming data from serial port") - err = phy.Cat() - if err != nil { - log.Fatal(err) - } + iface.Log() } |