NRFTransciever

package
v0.0.0-...-cdf6177 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CReadRegister        Command = 0x00
	CWriteRegister               = 0x20
	CReadRxPayloadWidth          = 0x60
	CReadRxPayload               = 0x61
	CWriteTxPayload              = 0xA0
	CWriteAckPayload             = 0xA8
	CWriteTxPayloadNoAck         = 0xB0
	CFlushTx                     = 0xE1
	CFlushRx                     = 0xE2
	CReuseTxPl                   = 0xE3
	CNop                         = 0xFF
)

nRF24L01 commands

View Source
const (
	RConfig    Register = 0x00
	BMaskRxDr  Bit      = 6
	BMaskTxDs           = 5
	BMaskMaxRt          = 4
	BEnCrc              = 3
	BCrcO               = 2
	BPwrUp              = 1
	BPrimRx             = 0

	REnAA   Register = 0x01
	BEnAAP5 Bit      = 5
	BEnAAP4          = 4
	BEnAAP3          = 3
	BEnAAP2          = 2
	BEnAAP1          = 1
	BEnAAP0          = 0

	REnRxAddr Register = 0x02
	BEnRxP5   Bit      = 5
	BEnRxP4            = 4
	BEnRxP3            = 3
	BEnRxP2            = 2
	BEnRxP1            = 1
	BEnRxP0            = 0

	RSetupAW Register = 0x03
	BAW      Bit      = 0

	RSetupRetr Register = 0x04
	BARD       Bit      = 4
	BARC                = 0

	RRFCh Register = 0x05

	RRFSetup  Register = 0x06
	BContWave Bit      = 7
	BRfDrLow           = 5
	BPllLock           = 4
	BRfDrHigh          = 3
	BRfPwr             = 1

	RStatus       Register = 0x07
	BRxDr         Bit      = 6
	BTxDs                  = 5
	BMaxRt                 = 4
	BRxPNo                 = 1
	BStatusTxFull          = 0
	BRxPNoMask    byte     = 0x0E

	RObserveTx Register = 0x08
	BPLosCnt   Bit      = 4
	BArcCnt             = 0

	RRPD      Register = 0x09
	RRxAddrP0          = 0x0A
	RRxAddrP1          = 0x0B
	RRxAddrP2          = 0x0C
	RRxAddrP3          = 0x0D
	RRxAddrP4          = 0x0E
	RRxAddrP5          = 0x0F
	RTxAddr            = 0x10
	RRxPwP0            = 0x11
	RRxPwP1            = 0x12
	RRxPwP2            = 0x13
	RRxPwP3            = 0x14
	RRxPwP4            = 0x15
	RRxPwP5            = 0x16

	RFifoStatus Register = 0x17
	BTxReuse    Bit      = 6
	BFifoTxFull          = 5
	BTxEmpty             = 4
	BRxFull              = 1
	BRxEmpty             = 0

	RDynPd Register = 0x1C
	BDplP5 Bit      = 5
	BDplP4          = 4
	BDplP3          = 3
	BDplP2          = 2
	BDplP1          = 1
	BDplP0          = 0

	RFeature  Register = 0x1D
	BEnDpl    Bit      = 2
	BEnAckPay          = 1
	BEnDynAck          = 0
)

nRF24L01 registers and bits

Variables

This section is empty.

Functions

func BV

func BV(b Bit) byte

BV returns 2^b

func GoIdle

func GoIdle(rf *NRFTransmitter)

GoIdle — just turn off CE

func Init

func Init(rf *NRFTransmitter, settings TransmitterSettings)

Init ...

func Listen

func Listen(rf *NRFTransmitter, address TranscieverModel.Address)

Listen — switch transciever to a listen mode

func SetRfChannel

func SetRfChannel(rf *NRFTransmitter, channel byte)

func Transmit

Transmit async request to a transciever, return immediately

func ValidateRfChannel

func ValidateRfChannel(channel byte) bool

Types

type Bit

type Bit byte

type Command

type Command byte

NRF-related stuff

type NRFTransmitter

type NRFTransmitter struct {
	TranscieverModel.Transmitter

	ReceiveMessage chan TranscieverModel.Message
	//SendMessage       chan TranscieverModel.Message
	SendMessageStatus chan TranscieverModel.Message
	// contains filtered or unexported fields
}

NRFTransmitter "handle"

func (*NRFTransmitter) Close

func (rf *NRFTransmitter) Close()

Close — release port and gpio

func (*NRFTransmitter) SendCommand

SendCommand — synchronous method: send request and wait response or timeout

type Register

type Register byte

type TransmitterSettings

type TransmitterSettings struct {
	PortName string
	IrqName  string
	CEName   string
	Speed    float32
}

Jump to

Keyboard shortcuts

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