variable

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

想给你写封信,却不知从何说起

Index

Constants

View Source
const (
	Board1 // 是近在咫尺
	Board2 // 还是远在天边
	Board3
)

你现在在哪里呢

View Source
const NumMaxPacket = 5

篇幅有限,也挡不住我的思念

Variables

View Source
var TypeLen = map[string]int{
	"uint8_t":  1,
	"uint16_t": 2,
	"uint32_t": 4,
	"uint64_t": 8,
	"int8_t":   1,
	"int16_t":  2,
	"int32_t":  4,
	"int64_t":  8,
	"int":      4,
	"float":    4,
	"double":   8,
}

Functions

func AnyToBytes

func AnyToBytes(i interface{}) []byte

func BytesToFloat32

func BytesToFloat32(bytes []byte) float32

func BytesToFloat64

func BytesToFloat64(bytes []byte) float64

func BytesToInt16

func BytesToInt16(i []byte) int16

func BytesToInt32

func BytesToInt32(i []byte) int32

func BytesToInt64

func BytesToInt64(i []byte) int64

func BytesToInt8

func BytesToInt8(i []byte) int8

func BytesToUint16

func BytesToUint16(i []byte) uint16

func BytesToUint32

func BytesToUint32(i []byte) uint32

func BytesToUint64

func BytesToUint64(i []byte) uint64

func BytesToUint8

func BytesToUint8(i []byte) uint8

func Delete

func Delete(o Mod, k uint32)

func DeleteProj

func DeleteProj(k string)

func Filt

func Filt(vars []CmdT) (chart []ChartT, add []CmdT, del []CmdT)

从茫茫 vars 中,寻找我所挂念的 to[RD] ,记录在列表 chart 中。 所有的 add 我都难以忘记,所有的 del 我都不愿提起

func GetAll

func GetAll(o Mod) ([]byte, error)

以json格式获取所有Mod变量

func GetAllProj

func GetAllProj() ([]byte, error)

以json格式获取所有Proj变量

func GetKeys added in v0.11.0

func GetKeys(o Mod) (keys []uint32)

func GetOptSaveVarList

func GetOptSaveVarList() bool

Only call by option.

func GetOptUpdateByProj

func GetOptUpdateByProj() bool

Only call by option.

func JsonLoadAll

func JsonLoadAll()

func MakeCmd added in v0.11.0

func MakeCmd(act ActMode, v CmdT) []byte

把我的思念,化作一串珍珠送给你

func MakeWriteCmd added in v0.11.0

func MakeWriteCmd(v T) []byte

把我的思念,化作一串珍珠送给你

func Set

func Set(o Mod, k uint32, v T)

func SetAll

func SetAll(o Mod, v map[uint32]T)

func SetAllProj

func SetAllProj(m Projs)

func SetOptSaveVarList

func SetOptSaveVarList(v bool)

Only call by option.

func SetOptUpdateByProj

func SetOptUpdateByProj(v bool)

Only call by option.

func SetProj

func SetProj(k string, v ProjT)

func SpecFromBytes added in v0.11.0

func SpecFromBytes(vType string, data []byte) float64

func SpecToBytes

func SpecToBytes(vType string, i float64) []byte

func UpdateByProj

func UpdateByProj()

通过Proj的变量名更新Read和Write的地址和类型

Types

type ActMode added in v0.11.0

type ActMode uint8
const (
	Subscribe         ActMode // 想让你一直联系
	SubscribeReturn           // 期待你认真回应
	Unsubscribe               // 却担心打扰到你
	UnsubscribeReturn         // 有回复就够了呢
	Read                      // 你在想什么
	ReadReturn                // 能告诉我吗
	Write                     // 希望改变你的心意
	WriteReturn               // 传达到了吗
)

type ChartT

type ChartT struct {
	Board uint8
	Name  string
	Data  float64
	Tick  uint32
}

type CmdT

type CmdT struct {
	Board  uint8
	Length int
	Addr   uint32
	Tick   uint32
	Data   [8]byte
}

func Unpack added in v0.11.0

func Unpack(data []byte) ([]CmdT, []byte)

在如山的信笺里,找寻变量的回音

type Mod

type Mod int
const (
	RD Mod = iota
	WR
)

type ProjT

type ProjT struct {
	Addr string
	Name string
	Type string
}

func GetProj

func GetProj(k string) (ProjT, bool)

type Projs

type Projs map[string]ProjT

type RWMap

type RWMap struct {
	sync.RWMutex // 读写锁保护下面的map字段
	// contains filtered or unexported fields
}

type T

type T struct {
	Board      uint8
	Name       string
	Type       string
	Addr       uint32
	Data       float64
	Tick       uint32
	Inputcolor string
	SignalGain float64
	SignalBias float64
}

func Get

func Get(o Mod, k uint32) (T, bool)

Jump to

Keyboard shortcuts

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