serial

package
v0.0.0-...-5449bc4 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	PortPath    string
	BaudRate    uint32
	ReadTimeout time.Duration
	DataBits    byte
	StopBits    StopBits
	Parity      Parity
}

func NewConfig

func NewConfig(portPath string, baudrate uint32) *Config

type Parity

type Parity byte
const (
	ParityNone Parity = iota
	ParityOdd
	ParityEven
	ParityMark
	ParitySpace
)

type Port

type Port struct {
	Config *Config
	// contains filtered or unexported fields
}

func OpenPort

func OpenPort(config *Config) (*Port, error)

func (*Port) Close

func (port *Port) Close()

func (*Port) Flush

func (p *Port) Flush() error

func (*Port) Read

func (p *Port) Read(b []byte) (int, error)

func (*Port) SetBaudrate

func (p *Port) SetBaudrate(baudrate uint32) error

func (*Port) SetDTR

func (port *Port) SetDTR(dtr bool) error

func (*Port) SetRTS

func (p *Port) SetRTS(rts bool) error

func (*Port) Write

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

type StopBits

type StopBits byte
const (
	StopBitsOne StopBits = iota
	StopBitsOneHalf
	StopBitsTwo
)

Jump to

Keyboard shortcuts

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