Documentation
¶
Overview ¶
Package radio provides interface to universal 2.4 GHz radio peripheral that supports Bluetooth LE (Smart) and other protocols.
Index ¶
- Constants
- Variables
- type Event
- type Freq
- type Mode
- type ModeConf0
- type Periph
- func (p *Periph) Event(e Event) *te.Event
- func (p *Periph) LoadBASE(n int) uint32
- func (p *Periph) LoadBCC() int
- func (p *Periph) LoadCRCCNF() (length int, skipAddr bool)
- func (p *Periph) LoadCRCINIT() uint32
- func (p *Periph) LoadCRCPOLY() uint32
- func (p *Periph) LoadCRCSTATUS() bool
- func (p *Periph) LoadDAB(n int) uint32
- func (p *Periph) LoadDACNF() (match, txadd byte)
- func (p *Periph) LoadDAI() int
- func (p *Periph) LoadDAP(n int) uint16
- func (p *Periph) LoadDATAWHITEIV() uint32
- func (p *Periph) LoadFREQUENCY() Freq
- func (p *Periph) LoadMODE() Mode
- func (p *Periph) LoadMODECNF0() ModeConf0
- func (p *Periph) LoadOVERRIDE(n int) uint32
- func (p *Periph) LoadPACKETPTR() uintptr
- func (p *Periph) LoadPCNF0() PktCnf0
- func (p *Periph) LoadPCNF1() PktCnf1
- func (p *Periph) LoadPOWER() bool
- func (p *Periph) LoadPREFIX(n int) uint32
- func (p *Periph) LoadRSSISAMPLE() int
- func (p *Periph) LoadRXADDRESSES() uint32
- func (p *Periph) LoadRXCRC() uint32
- func (p *Periph) LoadRXMATCH() int
- func (p *Periph) LoadSHORTS() Shorts
- func (p *Periph) LoadSTATE() State
- func (p *Periph) LoadTEST() (constCarrier, pllLock bool)
- func (p *Periph) LoadTIFS() int
- func (p *Periph) LoadTXADDRESS() int
- func (p *Periph) LoadTXPOWER() int
- func (p *Periph) StoreBASE(n, ba uint32)
- func (p *Periph) StoreBCC(bcc int)
- func (p *Periph) StoreCRCCNF(length int, skipAddr bool)
- func (p *Periph) StoreCRCINIT(crcinit uint32)
- func (p *Periph) StoreCRCPOLY(crcpoly uint32)
- func (p *Periph) StoreDAB(n int, dab uint32)
- func (p *Periph) StoreDACNF(match, txadd byte)
- func (p *Periph) StoreDAP(n int, dap uint16)
- func (p *Periph) StoreDATAWHITEIV(initVal uint32)
- func (p *Periph) StoreFREQUENCY(f Freq)
- func (p *Periph) StoreMODE(mode Mode)
- func (p *Periph) StoreMODECNF0(c ModeConf0)
- func (p *Periph) StoreOVERRIDE(n int, override uint32)
- func (p *Periph) StorePACKETPTR(addr unsafe.Pointer)
- func (p *Periph) StorePCNF0(pcnf PktCnf0)
- func (p *Periph) StorePCNF1(pcnf PktCnf1)
- func (p *Periph) StorePOWER(on bool)
- func (p *Periph) StorePREFIX(n int, prefix uint32)
- func (p *Periph) StoreRXADDRESSES(lamask uint32)
- func (p *Periph) StoreSHORTS(s Shorts)
- func (p *Periph) StoreTEST(constCarrier, pllLock bool)
- func (p *Periph) StoreTIFS(us int)
- func (p *Periph) StoreTXADDRESS(laddr int)
- func (p *Periph) StoreTXPOWER(dBm int)
- func (p *Periph) Task(t Task) *te.Task
- type PktCnf0
- type PktCnf1
- type Shorts
- type State
- type Task
Constants ¶
const ( NRF_1M = 0 NRF_2M = 1 NRF_250K = 2 BLE_1M = 3 BLE_2M = 4 )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event byte
const ( READY Event = 0 // Ready event. ADDRESS Event = 1 // Address event. PAYLOAD Event = 2 // Payload event. END Event = 3 // End event. DISABLED Event = 4 // Disabled event. DEVMATCH Event = 5 // An address match occurred on the last received pkt. DEVMISS Event = 6 // No address match occurred on the last received pkt. RSSIEND Event = 7 // A new RSSI sample is ready in RSSISAMPLE register. BCMATCH Event = 10 // Bit counter reached bit count value specified in BCC. )
type Periph ¶
func (*Periph) LoadCRCCNF ¶
LoadCRCCNF returns number of bytes in CRC field and whether address field is skipped for CRC calculation.
func (*Periph) LoadCRCINIT ¶
LoadCRCINIT returns initial value for CRC calculation.
func (*Periph) LoadCRCPOLY ¶
LoadCRCPOLY returns CRC polynominal coefficients.
func (*Periph) LoadCRCSTATUS ¶
LoadCRCSTATUS returns CRC status of packet received.
func (*Periph) LoadDAB ¶
LoadDAB returns n-th device address base segment (32 LSBits of device address).
func (*Periph) LoadDACNF ¶
LoadDACNF returns a dap and txadd bit fields. Dap is a bit field where eache of 8 low significant bits enables or disables one device adressess (DAP-DAB pairs) for matching.
func (*Periph) LoadDAI ¶
LoadDAI returns index(n) of device address, see DAB[n] and DAP[n], that got an address match.
func (*Periph) LoadDATAWHITEIV ¶
LoadATAWHITEIV returns data whitening initial value.
func (*Periph) LoadFREQUENCY ¶
LoadFREQUENCY returns a bitmap that encodes current radio channel and channelmap.
func (*Periph) LoadMODE ¶
LoadMODE returns radio data rate and modulation setting. The radio supports Frequency-shift Keying (FSK) modulation, which depending on setting are compatible with either Nordic Semiconductor’s proprietary radios, or Bluetooth low energy.
func (*Periph) LoadOVERRIDE ¶
LoadOVERRIDE returns OVERRIDE[n] parameter. nRF51.
func (*Periph) LoadPACKETPTR ¶
LoadPACKETPTR returns packet address to be used for the next transmission or reception. When transmitting, the packet pointed to by this address will be transmitted and when receiving, the received packet will be written to this address.
func (*Periph) LoadPREFIX ¶
LoadPREFIX returns prefix bytes from n-th PREFIX register.
func (*Periph) LoadRSSISAMPLE ¶
LoadRSSISAMPLE returns received signal strength [dBm].
func (*Periph) LoadRXADDRESSES ¶
LoadRXADDRESSES returns bit field where eache of 8 low significant bits enables or disables one logical addresses for receive.
func (*Periph) LoadRXMATCH ¶
LoadRXMATCH returns logical address on which previous packet was received.
func (*Periph) LoadSHORTS ¶
func (*Periph) LoadTIFS ¶
LoadTIFS returns interframe spacing as the number of microseconds from the end of the last bit of the previous packet to the start of the first bit of the subsequent packet.
func (*Periph) LoadTXADDRESS ¶
LoadTXADDRESS returns logical address used when transmitting a packet.
func (*Periph) LoadTXPOWER ¶
LoadTXPOWER returns RADIO output power in dBm.
func (*Periph) StoreCRCCNF ¶
StoreCRCCNF stores number of bytes in CRC field and whether address will be skipped for CRC calculation.
func (*Periph) StoreCRCINIT ¶
StoreCRCINIT stores initial value for CRC calculation.
func (*Periph) StoreCRCPOLY ¶
StoreCRCPOLY stores CRC polynominal coefficients.
func (*Periph) StoreDAB ¶
StoreDAB stores n-th device address base segment (32 LSBits of device address).
func (*Periph) StoreDACNF ¶
StoreDACNF stores bitmask that lists device adressess (DAP-DAB pairs) enabled for matching and TxAdd bits
func (*Periph) StoreDATAWHITEIV ¶
StoreDATAWHITEIV stores data whitening initial value.
func (*Periph) StoreFREQUENCY ¶
StoreFREQUENCY stores radio channel and channel map.
func (*Periph) StoreMODECNF0 ¶
StoreMODECNF0 (nRF52 only).
func (*Periph) StoreOVERRIDE ¶
StoreOVERRIDE stores OVERRIDE[n] parameter. nRF51.
func (*Periph) StorePACKETPTR ¶
StorePACKETPTR stores PACKETPTR. See LoadPACKETPTR for more information.
func (*Periph) StorePCNF0 ¶
func (*Periph) StorePCNF1 ¶
func (*Periph) StorePOWER ¶
StorePOWER sets peripheral power on or off.
func (*Periph) StorePREFIX ¶
StorePREFIX stores prefix bytes in n-th PREFIX register.
func (*Periph) StoreRXADDRESSES ¶
StoreRXADDRESSES stores bit field where eache of 8 low significant bits enables or disables one logical addresses for receive.
func (*Periph) StoreSHORTS ¶
func (*Periph) StoreTIFS ¶
StoreTIFS stores interframe spacing as the number of microseconds from the end of the last bit of the previous packet to the start of the first bit of the subsequent packet.
func (*Periph) StoreTXADDRESS ¶
StoreTXADDRESS stores logical address to be used when transmitting a packet.
func (*Periph) StoreTXPOWER ¶
StoreTXPOWER stores TXPOWER. See LoadTXPOWER for more information.
type PktCnf0 ¶
type PktCnf0 uint32
type PktCnf1 ¶
type PktCnf1 uint32
func MaxLen ¶
MaxLen returns PktCnf1 field that sets the maximum length of packet payload to n bytes.
type State ¶
type State byte
const ( Disabled State = 0 // RADIO is in the Disabled state RxRU State = 1 // RADIO is in the RXRU state RxIdle State = 2 // RADIO is in the RXIDLE state Rx State = 3 // RADIO is in the RX state RxDisable State = 4 // ADIO is in the RXDISABLED state TxRU State = 9 // RADIO is in the TXRU state TxIdle State = 10 // RADIO is in the TXIDLE state Tx State = 11 // RADIO is in the TX state TxDisable State = 12 // RADIO is in the TXDISABLED state )
type Task ¶
type Task byte
const ( TXEN Task = 0 // Enable radio in TX mode. RXEN Task = 1 // Enable radio in RX mode. START Task = 2 // Start radio. STOP Task = 3 // Stop radio. DISABLE Task = 4 // Disable radio. RSSISTART Task = 5 // Start measurement and take single sample of the RSSI. RSSISTOP Task = 6 // Stop the RSSI measurement. BCSTART Task = 7 // Start bit counter. BCSTOP Task = 8 // Stop bit counter. )