Documentation ¶
Index ¶
- Constants
- Variables
- func GetCLM(firmware []byte) []byte
- type Config
- type Device
- func (d *Device) BufferedHCI() int
- func (d *Device) GPIOSet(wlGPIO uint8, value bool) (err error)
- func (d *Device) HCIReadWriter() (interface{ ... }, error)
- func (d *Device) HardwareAddr6() ([6]byte, error)
- func (d *Device) Init(cfg Config) (err error)
- func (d *Device) IsLinkUp() bool
- func (d *Device) JoinWPA2(ssid, pass string) error
- func (d *Device) MACAs6() [6]bytedeprecated
- func (d *Device) MTU() int
- func (d *Device) NetFlags() (flags net.Flags)
- func (d *Device) PollOne() (bool, error)
- func (d *Device) ReadHCI(b []byte) (int, error)
- func (d *Device) RecvEthHandle(handler func(pkt []byte) error)
- func (d *Device) Reset()
- func (d *Device) SendEth(pkt []byte) error
- func (d *Device) SetLogger(l *slog.Logger)
- func (d *Device) StartAP(ssid, pass string, channel uint8) error
- func (d *Device) TryPoll() (gotPacket bool, err error)deprecated
- func (d *Device) WriteHCI(b []byte) (int, error)
- type Function
- type Interrupts
- type Status
- func (s Status) DataUnavailable() bool
- func (s Status) F2Interrupt() bool
- func (s Status) F2PacketAvailable() bool
- func (s Status) F2PacketLength() uint16
- func (s Status) F2RxReady() bool
- func (s Status) F3PacketAvailable() bool
- func (s Status) F3PacketLength() uint16
- func (s Status) F3RxReady() bool
- func (s Status) GSPIPacketAvailable() bool
- func (s Status) HostCommandDataError() bool
- func (s Status) IsOverflow() bool
- func (s Status) IsUnderflow() bool
- func (s Status) String() (str string)
Constants ¶
const MTU = 2048 - mtuPrefix
Variables ¶
var ErrDataNotAvailable = errors.New("requested data not available")
Functions ¶
Types ¶
type Config ¶
type Config struct { Firmware string CLM string Logger *slog.Logger // contains filtered or unexported fields }
func DefaultBluetoothConfig ¶
func DefaultBluetoothConfig() Config
func DefaultWifiBluetoothConfig ¶
func DefaultWifiBluetoothConfig() Config
func DefaultWifiConfig ¶
func DefaultWifiConfig() Config
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
type OutputPin func(bool)
func (*Device) BufferedHCI ¶
BufferedHCI returns amounts of HCI bytes stored inside CYW43439 internal ring buffer.
func (*Device) HCIReadWriter ¶
func (d *Device) HCIReadWriter() (interface { io.ReadWriter Buffered() int }, error)
HCIReaderWriter returns a io.ReadWriter interface which wraps the BufferedHCI, WriteHCI and ReadHCI methods.
func (*Device) HardwareAddr6 ¶
HardwareAddr6 returns the device's 6-byte MAC address.
func (*Device) MTU ¶
MTU (maximum transmission unit) returns the maximum amount of bytes that can be sent in a single ethernet frame in a call to SendEth.
func (*Device) PollOne ¶
PollOne attempts to read a packet from the device. Returns true if a packet was read, false if no packet was available.
func (*Device) ReadHCI ¶
WriteHCI reads from HCI ring buffer internal to the CYW43439. Used for bluetooth.
func (*Device) RecvEthHandle ¶
RecvEthHandle sets handler for receiving Ethernet pkt If set to nil then incoming packets are ignored.
func (*Device) Reset ¶
func (d *Device) Reset()
Reset power-cycles the CYW43439 by turning WLREGON off and on and waiting the suggested amount of time for SPI bus to initialize. To use Device again Init should be called after a Reset.
type Function ¶
type Function uint32
const ( // All SPI-specific registers. FuncBus Function = 0b00 // Registers and memories belonging to other blocks in the chip (64 bytes max). FuncBackplane Function = 0b01 // DMA channel 1. WLAN packets up to 2048 bytes. FuncDMA1 Function = 0b10 FuncWLAN = FuncDMA1 // DMA channel 2 (optional). Packets up to 2048 bytes. FuncDMA2 Function = 0b11 )
type Interrupts ¶
type Interrupts uint16
func (Interrupts) IsBusOverflowedOrUnderflowed ¶
func (Int Interrupts) IsBusOverflowedOrUnderflowed() bool
func (Interrupts) IsDataUnavailable ¶
func (Int Interrupts) IsDataUnavailable() bool
func (Interrupts) IsF2Available ¶
func (Int Interrupts) IsF2Available() bool
func (Interrupts) String ¶
func (Int Interrupts) String() (s string)
type Status ¶
type Status uint32
Status supports status notification to the host after a read/write transaction over gSPI. This status notification provides information about packet errors, protocol errors, available packets in the RX queue, etc. The status information helps reduce the number of interrupts to the host. The status-reporting feature can be switched off using a register bit, without any timing overhead.
func (Status) DataUnavailable ¶
DataUnavailable returns true if requested read data is unavailable.
func (Status) F2Interrupt ¶
F2Interrupt returns true if F2 channel interrupt set.
func (Status) F2PacketAvailable ¶
F2PacketAvailable returns true if Packet is available/ready in F2 TX FIFO.
func (Status) F2PacketLength ¶
F2PacketAvailable returns F2 packet length.
func (Status) F3PacketAvailable ¶
F3PacketAvailable returns true if Packet is available/ready in F3 TX FIFO.
func (Status) F3PacketLength ¶
F3PacketAvailable returns F3 packet length.
func (Status) GSPIPacketAvailable ¶
GSPIPacketAvailable notifies there is a packet available over gSPI.
func (Status) HostCommandDataError ¶
HostCommandDataError TODO document.
func (Status) IsOverflow ¶
IsOverflow returns true if FIFO overflow occurred due to current (F1, F2, F3) write command.
func (Status) IsUnderflow ¶
IsUnderflow returns true if FIFO underflow occurred due to current (F2, F3) read command.