upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Public Member Functions | List of all members

API for the NRF24L01 Transceiver Module. More...

Detailed Description

id This module defines the NRF24L01 interface for libnrf24l01

nrf24l01.jpg
upm_nrf24l01.NRF24L01 comm = new upm_nrf24l01.NRF24L01((short) 7, (short) 8);
Callback callback = new ReceiverCallback(comm);
comm.setSourceAddress(local_address);
comm.setDestinationAddress(broadcast_address);
comm.setPayload((short) upm_nrf24l01.javaupm_nrf24l01Constants.MAX_BUFFER);
comm.configure();
comm.setSpeedRate(upm_nrf24l01.speed_rate_t.NRF_250KBPS);
comm.setChannel((short) 99);
comm.setDataReceivedHandler(callback);
while (true) {
comm.pollListener();
}
upm_nrf24l01.NRF24L01 comm = new upm_nrf24l01.NRF24L01((short) 7, (short) 8);
Callback callback = new TransmitterCallback();
comm.setSourceAddress(srcAddress);
comm.setDestinationAddress(destAddress);
comm.setPayload((short) upm_nrf24l01.javaupm_nrf24l01Constants.MAX_BUFFER);
comm.setChannel((short) 99);
comm.configure();
comm.setDataReceivedHandler(callback);
while (true) {
comm.send(tx_buffer);
System.out.println("devi2 :: sending data ....");
for (int i = 0; i < tx_buffer.length; i++)
System.out.print(tx_buffer[i]);
System.out.println();
Thread.sleep(3000);
}

Public Member Functions

synchronized void delete ()
 
 NRF24L01 (short cs, short ce)
 
String name ()
 
void init (short chipSelect, short chipEnable)
 
void configure ()
 
void send (byte[] value)
 
void send ()
 
void setSourceAddress (byte[] addr)
 
void setDestinationAddress (byte[] addr)
 
void setBroadcastAddress (byte[] addr)
 
void setPayload (short load)
 
void setDataReceivedHandler (Callback call_obj)
 
boolean dataReady ()
 
boolean dataSending ()
 
void getData (byte[] data)
 
short getStatus ()
 
boolean rxFifoEmpty ()
 
void rxPowerUp ()
 
void rxFlushBuffer ()
 
void txPowerUp ()
 
void powerDown ()
 
void setChannel (short channel)
 
void setPower (power_t power)
 
short setSpeedRate (speed_rate_t rate)
 
void txFlushBuffer ()
 
void pollListener ()
 
int ceHigh ()
 
int ceLow ()
 
int csOn ()
 
int csOff ()
 
void setBeaconingMode ()
 
void sendBeaconingMsg (byte[] msg)
 
void setM_rxBuffer (short[] value)
 
short[] getM_rxBuffer ()
 
void setM_txBuffer (short[] value)
 
short[] getM_txBuffer ()
 
void setM_bleBuffer (short[] value)
 
short[] getM_bleBuffer ()
 

Constructor & Destructor Documentation

NRF24L01 ( short  cs,
short  ce 
)

Instantiates an NRF24l01 object

Parameters
csChip select pin

Member Function Documentation

int ceHigh ( )

Sets the chip enable pin to HIGH

int ceLow ( )

Sets the chip enable pin to LOW

void configure ( )

Configures the NRF24L01 transceiver

int csOff ( )

Sets the chip select pin to HIGH

int csOn ( )

Sets the chip select pin to LOW

boolean dataReady ( )

Checks if the data has arrived

boolean dataSending ( )

Checks if the transceiver is in the sending mode

void getData ( byte[]  data)

Sinks all the arrived data into a provided buffer

Parameters
loadSize of the payload (MAX 32)
short getStatus ( )

Checks the transceiver state

void init ( short  chipSelect,
short  chipEnable 
)

Initializes needed GPIO pins and SPI

Parameters
chipSelectSets up the chip select pin
chipEnableSets up the chip enable pin
String name ( )

Returns the name of the component

void pollListener ( )

Pulling the method listening for the arrived data, dataRecievedHandler is triggered if data arrives

void powerDown ( )

Powers everything down

boolean rxFifoEmpty ( )

Checks if the receive stack is empty

void rxFlushBuffer ( )

Flushes the receive stack

void rxPowerUp ( )

Powers the receiver up

void send ( byte[]  value)

Sends the buffer data

Parameters
*valuePointer to the buffer
void send ( )

Sends the data located in an inner bufer; the user must fill the m_txBuffer buffer

void sendBeaconingMsg ( byte[]  msg)

Beacons the provided message to BLE scanners.

Parameters
msgBeacons the provided message (max length is 16 bytes)
void setBeaconingMode ( )

Configures the NRF24L01 transceiver to behave as a BLE (Bluetooth Low Energy) beaconing devcie.

void setBroadcastAddress ( byte[]  addr)

Sets a broadcasting address

Parameters
addr5-byte address
void setDataReceivedHandler ( Callback  call_obj)

Sets the handler to be called when data has been received

Parameters
call_objObject used for callback - Java
void setDestinationAddress ( byte[]  addr)

Sets a recipient address. The nrfSend method sends the data buffer to this address

Parameters
addr5-byte address
void setPayload ( short  load)

Sets the payload size

Parameters
loadSize of the payload (MAX 32)
void setSourceAddress ( byte[]  addr)

Sets a receiving address of the device

Parameters
addr5-byte address
void txFlushBuffer ( )

Flushes the transmit stack

void txPowerUp ( )

Powers the transmitter up


The documentation for this class was generated from the following file: