remove bytesize stopbits

This commit is contained in:
zhiqiang feng
2020-12-29 16:31:23 +08:00
parent 0aee912649
commit 93ae291efc
3 changed files with 3 additions and 26 deletions
+1 -20
View File
@@ -10,8 +10,6 @@ import (
var (
device string
baudrate int
bytesize byte
stopbits byte
// port *serial.Port
sp *serial.SerialPort
portOpened = false
@@ -24,9 +22,7 @@ const readDuration = 500 * time.Millisecond
func OpenPort(device string, baudrate int, bytesize byte, stopbits byte) error {
Log.Info("opening serial device ",
zap.String("port", device),
zap.Int("baudrate", baudrate),
zap.Int("bytesize", int(bytesize)),
zap.Int("stopbits", int(stopbits)))
zap.Int("baudrate", baudrate))
sp = serial.New()
sp.EOL('\r')
sp.Verbose = false
@@ -36,21 +32,6 @@ func OpenPort(device string, baudrate int, bytesize byte, stopbits byte) error {
portOpened = true
}
return err
// config := &serial.Config{Name: device,
// Baud: baudrate,
// Size: bytesize,
// StopBits: serial.StopBits(stopbits),
// ReadTimeout: readDuration}
// var err error
// port, err = serial.OpenPort(config)
// if err != nil {
// Log.Fatal("error in open serial port ", zap.Error(err))
// return err
// }
// Log.Info("opened ", zap.String("port", device))
// portOpened = true
// return nil
}
//ReadPort read byte array from port