serial

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

README

串口处理

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CRC16Big

func CRC16Big(frame []byte, preval int) []byte

func Close

func Close()

关闭串口的读写

func InitSerial

func InitSerial(name string, baud int)

串口的初始化

func Prepared

func Prepared() bool

外部判断串口是否已准备完毕

func SubscribeReader

func SubscribeReader(key string, subscriber chan []byte)

添加串口读取的订阅者

func UnsubscribeReader

func UnsubscribeReader(key string)

取消串口的订阅

func WriteCmd

func WriteCmd(cmd []byte) (err error)

向串口写数据

Types

type Logger

type Logger struct{}

func (Logger) Debug

func (l Logger) Debug(m map[string]interface{}, msg string, v ...interface{})

func (Logger) Error

func (l Logger) Error(m map[string]interface{}, msg string, v ...interface{})

func (Logger) Info

func (l Logger) Info(m map[string]interface{}, msg string, v ...interface{})

type SLogger

type SLogger interface {
	Info(map[string]interface{}, string, ...interface{})
	Error(map[string]interface{}, string, ...interface{})
	Debug(map[string]interface{}, string, ...interface{})
}

Jump to

Keyboard shortcuts

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