serial

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package serial provides primitives for serial communication on Go >=1.12 with the runtime poller API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaudRate

type BaudRate int

BaudRate represents a serial communication baud rate.

const (
	BaudRate4800    BaudRate = 4800
	BaudRate9600    BaudRate = 9600
	BaudRate19200   BaudRate = 19200
	BaudRate38400   BaudRate = 38400
	BaudRate57600   BaudRate = 57600
	BaudRate115200  BaudRate = 115200
	BaudRate230400  BaudRate = 230400
	BaudRate460800  BaudRate = 460800
	BaudRate921600  BaudRate = 921600
	BaudRate2000000 BaudRate = 2000000
)

func (BaudRate) String

func (i BaudRate) String() string

type Port

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

Port is a serial port.

func Open

func Open(filename string, baudRate BaudRate) (*Port, error)

Open a serial port.

func (*Port) Close

func (p *Port) Close() error

Close the port.

func (*Port) Flush

func (p *Port) Flush() error

Flush the buffered data in the port.

func (*Port) Read

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

Read data from the port.

func (*Port) SetReadDeadline

func (p *Port) SetReadDeadline(t time.Time) error

SetReadDeadline sets the port's read deadline.

func (*Port) SetWriteDeadline

func (p *Port) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets the port's write deadline.

func (*Port) Write

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

Write data to the port.

Jump to

Keyboard shortcuts

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