Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 4.0% on proxy.golang.org
Top 2.5% dependent packages on proxy.golang.org
Top 2.3% dependent repos on proxy.golang.org
Top 4.9% forks on proxy.golang.org

proxy.golang.org : github.com/albenik/go-serial

Package serial is a cross-platform serial library for the go language. It is possible to get the list of available serial ports with the GetPortsList function: The serial port can be opened with the Open function: The Open function needs a "mode" parameter that specifies the configuration options for the serial port. If not specified the default options are 9600_N81, in the example above only the speed is changed so the port is opened using 115200_N81. The following snippets shows how to declare a configuration for 57600_E71: The configuration can be changed at any time with the SetMode function: The port object implements the io.ReadWriteCloser interface, so we can use the usual Read, Write and Close functions to send and receive data from the serial port: If a port is a virtual USB-CDC serial port (for example an USB-to-RS232 cable or a microcontroller development board) is possible to retrieve the USB metadata, like VID/PID or USB Serial Number, with the GetDetailedPortsList function in the enumerator package: for details on USB port enumeration see the documentation of the specific package. This library tries to avoid the use of the "C" package (and consequently the need of cgo) to simplify cross compiling. Unfortunately the USB enumeration package for darwin (MacOSX) requires cgo to access the IOKit framework. This means that if you need USB enumeration on darwin you're forced to use cgo. This example prints the list of serial ports and use the first one to send a string "10,20,30" and prints the response on the screen.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/albenik/go-serial
Keywords: cross-platform, go, golang, library, macos, serial, serial-port
License: BSD-3-Clause
Latest release: almost 5 years ago
First release: almost 6 years ago
Namespace: github.com/albenik
Dependent packages: 5
Dependent repositories: 5
Stars: 43 on GitHub
Forks: 21 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: about 1 month ago

    Loading...
    Readme
    Loading...