serial

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	POLLING_DELAY_MS = "100"
)

Variables

This section is empty.

Functions

func CreatePort

func CreatePort(channel string, mode goSerial.Mode) (io.ReadWriteCloser, error)

func CreateReadWriter

func CreateReadWriter(portName string, mode goSerial.Mode) (io.ReadWriteCloser, error)

func GetSerialPorts

func GetSerialPorts() []string

func OpenSerialConnection

func OpenSerialConnection(com string, mode goSerial.Mode) (goSerial.Port, error)

func SerialList

func SerialList()

func StartSerial

func StartSerial(com string, baud uint, parity string, dataLen uint, stopBits bool)

Types

type CustomPort

type CustomPort struct {
	Port goSerial.Port
}

Wraps the goSerial.Port because its Read() function does not return EOF on timeout. This causes problems with io.Copy when this is used as a reader, since no error is returned it will hang. https://github.com/bugst/go-serial/issues/141

func NewCustomPort

func NewCustomPort(port goSerial.Port) CustomPort

func (CustomPort) Close

func (p CustomPort) Close() error

io.Closer.Close

func (CustomPort) Read

func (p CustomPort) Read(b []byte) (n int, err error)

io.Reader.Read

func (CustomPort) Write

func (p CustomPort) Write(b []byte) (int, error)

io.Writer.Write

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL