规范串口通讯

This commit is contained in:
2024-12-19 10:49:02 +08:00
parent 3f760e2955
commit b4913d63b3
5 changed files with 37 additions and 21 deletions

View File

@@ -13,7 +13,8 @@ import (
type Reader interface {
io.Closer
SetSlave(uint8)
// SetSlave 设置读卡器的 UnitID
SetSlave(byte)
// WriteUnitId 写入读卡器的 UnitID
WriteUnitId(uint16) error
// Init 初始化读卡器配置

View File

@@ -7,10 +7,15 @@ import (
type Relay interface {
io.Closer
SetSlave(slaveID byte)
On(num int) error
Off(num int) error
// SetSlave 设置继电器的 UnitID
SetSlave(byte)
// On 打开继电器
On(int) error
// Off 关闭继电器
Off(int) error
// OnAll 打开所有继电器
OnAll() error
// OffAll 关闭所有继电器
OffAll() error
}