com

package
v0.49.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package com reads from COM port.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Baud is the configured baudrate of the serial port. It is set as command line parameter.
	Baud int

	// Databits is the serial port bit count fpr one "byte".
	Databits int

	// Parity is the transmitted bit parity: even, odd, none
	Parity string

	// stopbits is the number of stop bits: "1", "1.5", "2"
	Stopbits string
)

Functions

func GetSerialPorts

func GetSerialPorts(w io.Writer) ([]string, error)

GetSerialPorts scans for serial ports.

Types

type COMport

type COMport interface {
	Open() bool
	Read(buf []byte) (int, error)
	Close() error
}

COMport is the comport interface type to use different COMports.

type PortGoBugSt

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

PortGoBugSt is a serial device trice receiver

func NewCOMPortGoBugSt

func NewCOMPortGoBugSt(w io.Writer, verbose bool, comPortName string) *PortGoBugSt

NewCOMPortGoBugSt creates an instance of a serial device type trice receiver

func (*PortGoBugSt) Close

func (p *PortGoBugSt) Close() error

Close releases port.

func (*PortGoBugSt) Open

func (p *PortGoBugSt) Open() bool

Open initializes the serial receiver.

It opens a serial port.

func (*PortGoBugSt) Read

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

Read blocks until (at least) one byte is received from the serial port or an error occurs. It stores data received from the serial port into the provided byte array buffer. The function returns the number of bytes read.

Jump to

Keyboard shortcuts

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