serial

package
v0.0.0-...-6a117d1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: AGPL-3.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(portAddress string) (serial.Port, error)

Open used to open the given serial port at 9600 BaudRate

func SendCommandAndClose

func SendCommandAndClose(port serial.Port, msg Command) error

SendCommandAndClose send a command and immediately close the serial port afterwards.

Types

type AvailablePorts

type AvailablePorts map[string]bool

AvailablePorts represent all the available serial ports

func AllPorts

func AllPorts() (AvailablePorts, error)

AllPorts returns the list of alla available serial ports.

func (*AvailablePorts) NewPort

func (last *AvailablePorts) NewPort() (string, bool, error)

NewPort every 250ms checks if a new serial port is detected, for a maximum of 10 seconds. If a new serial port is detect it's added to the AvailablePorts map and returned as a string.

type Command

type Command string

Command represent a command sent through the serial port. This is used to distinguish a command that will trigger a specific function of the `commands.ino` sketch.

const (
	// RebootCommand puts the board in ESP mode.
	RebootCommand Command = "r\n\r"
	// VersionCommand gets the semver firmware version.
	VersionCommand Command = "v\n\r"
)

Directories

Path Synopsis
Package utils contains functions token from https://github.com/arduino/arduino-cli/blob/master/arduino/serialutils/serialutils.go that's because we don't have the `tr` here and importing the serialutils from the cli will lead to a panic
Package utils contains functions token from https://github.com/arduino/arduino-cli/blob/master/arduino/serialutils/serialutils.go that's because we don't have the `tr` here and importing the serialutils from the cli will lead to a panic

Jump to

Keyboard shortcuts

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