protocol

package
v0.0.0-...-5c37f9e Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GroupMax     = 9
	HifHdrOffset = 8
)

Variables

This section is empty.

Functions

func Bytes

func Bytes[T any](in *T) []byte

func Itoa

func Itoa(val int) string

Itoa converts val to a decimal string.

func PrintByte

func PrintByte(b byte)

func PrintBytes

func PrintBytes(s []byte)

func SetDataPacketSize

func SetDataPacketSize(sz int)

SetDataPacketSize sets the data packet size returned from the device client. Call this before initialization.

func ToUint32

func ToUint32(buffer []byte) (val uint32)

func Uitoa

func Uitoa(val uint) string

Uitoa converts val to a decimal string.

Types

type Event

type Event struct {
	Group  GroupId
	Opcode OpcodeId
	Data   any
}

type GroupId

type GroupId uint8

type Hif

type Hif struct {
	// contains filtered or unexported fields
}

func CreateHif

func CreateHif(spi drivers.SPI, cs hal.Pin) Hif

func (*Hif) ChipSleep

func (hif *Hif) ChipSleep() error

func (*Hif) ChipWake

func (hif *Hif) ChipWake() (err error)

func (*Hif) GetChipId

func (hif *Hif) GetChipId() (uint32, error)

func (*Hif) GetGPIOValue

func (hif *Hif) GetGPIOValue(gpio uint8) (state uint8, err error)

func (*Hif) Halt

func (hif *Hif) Halt() error

func (*Hif) Init

func (hif *Hif) Init() (err error)

func (*Hif) InitDownload

func (hif *Hif) InitDownload() (err error)

func (*Hif) Isr

func (hif *Hif) Isr() (err error)

func (*Hif) OpenEventChannel

func (hif *Hif) OpenEventChannel() <-chan Event

func (*Hif) ReadBlock

func (hif *Hif) ReadBlock(address uint32, data []byte) (err error)

func (*Hif) ReadRegister

func (hif *Hif) ReadRegister(address uint32) (uint32, error)

func (*Hif) Receive

func (hif *Hif) Receive(address uint32, data []byte, done bool) (err error)

func (*Hif) RegisterCallback

func (hif *Hif) RegisterCallback(group GroupId, callback IsrCallback)

func (*Hif) Send

func (hif *Hif) Send(group GroupId, opcode OpcodeId, control, data []byte, offset uint16) (err error)

func (*Hif) SetGPIODirection

func (hif *Hif) SetGPIODirection(gpio, direction uint8) (err error)

func (*Hif) SetGPIOValue

func (hif *Hif) SetGPIOValue(gpio, state uint8) (err error)

func (*Hif) Shutdown

func (hif *Hif) Shutdown()

func (*Hif) WriteBlock

func (hif *Hif) WriteBlock(address uint32, data []byte) (err error)

func (*Hif) WriteRegister

func (hif *Hif) WriteRegister(address, value uint32) error

type IsrCallback

type IsrCallback func(id OpcodeId, sz uint16, address uint32) (any, error)

type OpcodeId

type OpcodeId uint8
const (
	OpcodeReqConfigPkt OpcodeId = 0
	OpcodeReqDataPkt   OpcodeId = 0x80 /*BIT7*/
)

Jump to

Keyboard shortcuts

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