Documentation ¶
Index ¶
- func MegaHertz(freq uint32) string
- type Hardware
- func (h *Hardware) AwaitInterrupt(timeout time.Duration)
- func (h *Hardware) Close()
- func (h *Hardware) Device() string
- func (h *Hardware) Error() error
- func (h *Hardware) ReadBurst(addr byte, n int) []byte
- func (h *Hardware) ReadInterrupt() bool
- func (h *Hardware) ReadRegister(addr byte) byte
- func (h *Hardware) SPIDevice() *spi.Device
- func (h *Hardware) SetError(err error)
- func (h *Hardware) WriteBurst(addr byte, data []byte)
- func (h *Hardware) WriteEach(data []byte)
- func (h *Hardware) WriteRegister(addr byte, value byte)
- type HardwareFlavor
- type HardwareVersionError
- type Interface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Hardware ¶
type Hardware struct {
// contains filtered or unexported fields
}
Hardware represents an SPI radio device.
func Open ¶
func Open(flavor HardwareFlavor) *Hardware
Open opens the SPI radio module described by the given flavor.
func (*Hardware) AwaitInterrupt ¶
AwaitInterrupt waits with the given timeout for a receive interrupt.
func (*Hardware) ReadBurst ¶
ReadBurst reads a burst of n bytes from given address on the radio device.
func (*Hardware) ReadInterrupt ¶
ReadInterrupt returns the state of the receive interrupt.
func (*Hardware) ReadRegister ¶
ReadRegister reads the given address on the radio device.
func (*Hardware) WriteBurst ¶
WriteBurst writes data in burst mode to the given address on the radio device.
func (*Hardware) WriteRegister ¶
WriteRegister writes the given value to the given address on the radio device.
type HardwareFlavor ¶
type HardwareFlavor interface { SPIDevice() string Speed() int CustomCS() int InterruptPin() int ReadSingleAddress(byte) byte ReadBurstAddress(byte) byte WriteSingleAddress(byte) byte WriteBurstAddress(byte) byte }
HardwareFlavor is the interface satisfied by a particular SPI device. It specifies how to open the device and how to encode common I/O operations.
type HardwareVersionError ¶
HardwareVersionError indicates a hardware version mismatch.
func (HardwareVersionError) Error ¶
func (e HardwareVersionError) Error() string
type Interface ¶
type Interface interface { Init(frequency uint32) Reset() Close() Frequency() uint32 SetFrequency(uint32) Send([]byte) Receive(time.Duration) ([]byte, int) SendAndReceive([]byte, time.Duration) ([]byte, int) State() string Error() error SetError(error) Name() string Device() string }
Interface is the interface satisfied by a radio device.