This commit is contained in:
zhiqiang feng
2020-12-22 12:08:06 +08:00
parent f0983f0d02
commit 689c5748ec
+3 -3
View File
@@ -1,10 +1,11 @@
package utils package utils
import ( import (
"github.com/tarm/serial"
"io" "io"
"log" "log"
"time" "time"
"github.com/tarm/serial"
) )
var ( var (
@@ -12,7 +13,7 @@ var(
baudrate int baudrate int
bytesize byte bytesize byte
port *serial.Port port *serial.Port
portOpened bool portOpened = false
) )
func OpenPort(device string, baudrate int, bytesize byte) error { func OpenPort(device string, baudrate int, bytesize byte) error {
@@ -45,4 +46,3 @@ func ReadPort() ([]byte, int){
func IsPortOpen() bool { func IsPortOpen() bool {
return portOpened return portOpened
} }