com

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package com reads from COM port.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Port is the COMport name like COM1
	Port string

	// Baud is the configured baudrate of the serial port
	Baud int
)

Functions

func GetSerialPorts

func GetSerialPorts() ([]string, error)

GetSerialPorts scans for serial ports

Types

type COM

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

COM is a serial device trice receiver

func New

func New() *COM

New creates an instance of a serial device type trice receiver

func (*COM) Close

func (p *COM) Close() error

Close releases port

func (*COM) Open

func (p *COM) Open() bool

open() initializes the serial receiver.

It opens a serial port.

func (*COM) Read

func (p *COM) Read(buf []byte) (int, error)

Stores data received from the serial port into the provided byte array buffer. The function returns the number of bytes read.

The Read function blocks until (at least) one byte is received from the serial port or an error occurs.

Jump to

Keyboard shortcuts

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