go232

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2019 License: Apache-2.0 Imports: 5 Imported by: 2

README

go-serial

GoDoc

My go language serial port implementation for linux.

Documentation

Overview

Package go232 provides a simple but usable way to interact with devices that have serial ports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindSerialPorts

func FindSerialPorts() ([]string, error)

FindSerialPorts finds and lists the available serial ports

Types

type Serial

type Serial struct {
	Name      string // The filename of the serial port
	Baud      int    // The baud rate
	Config    string // The configuration is a string in the form: '8N1' or similar.
	Canonical bool
	Vmin      byte
	Vtime     time.Duration
	// contains filtered or unexported fields
}

Serial structure

func (*Serial) Close

func (s *Serial) Close() error

Close closes the serial port or returns an error if one happens

func (*Serial) Flush

func (s *Serial) Flush() error

Flush any characters that may be in a incoming or outgoing buffer

func (*Serial) Open

func (s *Serial) Open() error

Open opens the specified file name for serial port access

func (*Serial) Read

func (s *Serial) Read(b []byte) (n int, err error)

Read into the specified array of bytes and return the number of bytes written

func (*Serial) SendBreak

func (s *Serial) SendBreak() error

SendBreak sends the serial break signal

func (*Serial) UpdateCfg

func (s *Serial) UpdateCfg() error

SetBaud sets the baud rate for the serial port as well as the rest of the configuration. The configuration is a string in the form: '8N1' or similar.

func (*Serial) Write

func (s *Serial) Write(b []byte) (n int, err error)

Write an array of bytes and return the number of bytes written

Jump to

Keyboard shortcuts

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