From 96d159114af675d55fe0d7c0f22a69d65e9563fc Mon Sep 17 00:00:00 2001 From: xengineering Date: Thu, 30 May 2024 16:47:29 +0200 Subject: 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. --- software/main.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'software/main.go') 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() } -- cgit v1.2.3-70-g09d2