serial

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorClosed = errors.New("port has been closed")

Functions

This section is empty.

Types

type Port

type Port interface {
	io.ReadWriteCloser

	/* Configuration */
	SetInterfaceRate(rate uint32) error
	SetFlowControl(enabled bool) error

	/* Pins */
	SetDTR(enabled bool) error
	SetRTS(enabled bool) error
	GetPins() (PortPins, error)

	/* Break */
	DoBreak(duration time.Duration) error
}

Port is an extended io.ReadWriteCloser that also allows changing some serial port specific settings

func Open

func Open(options *PortOptions) (Port, error)

Open creates an object that implements the SerialPort interface

type PortOptions

type PortOptions struct {
	PortName      string
	InterfaceRate uint32
	FlowControl   bool
}

PortOptions is a parameter struct for Open

type PortPins

type PortPins struct {
	DSR bool
	DTR bool
	RTS bool
	CTS bool
	DCD bool
	RNG bool
}

PortPins indicates the state of the modem control signals

Jump to

Keyboard shortcuts

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