UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

NRF24L01 Class

Module: nrf24l01

id This module defines the NRF24L01 interface for libnrf24l01
nrf24l01.jpg

Methods

NRF24L01

(
  • cs
  • ce
)
Number

Instantiates an NRF24l01 object

Parameters:

  • cs Number

    Chip select pin

  • ce Number

    undefined

Returns:

Number:

name

() String

Returns the name of the component

Returns:

String:

init

(
  • chipSelect
  • chipEnable
)

Initializes needed GPIO pins and SPI

Parameters:

  • chipSelect Number

    Sets up the chip select pin

  • chipEnable Number

    Sets up the chip enable pin

configure

()

Configures the NRF24L01 transceiver

send

(
  • value
)

Sends the buffer data

Parameters:

  • value Uint8_t *

    Pointer to the buffer

send

()

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

setSourceAddress

(
  • addr
)

Sets a receiving address of the device

Parameters:

  • addr Uint8_t *

    5-byte address

setDestinationAddress

(
  • addr
)

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

Parameters:

  • addr Uint8_t *

    5-byte address

setBroadcastAddress

(
  • addr
)

Sets a broadcasting address

Parameters:

  • addr Uint8_t *

    5-byte address

setPayload

(
  • load
)

Sets the payload size

Parameters:

  • load Number

    Size of the payload (MAX 32)

setDataReceivedHandler

(
  • call_obj
)

Sets the handler to be called when data has been received

Parameters:

  • call_obj Callback

    Object used for callback - Java

dataReady

() Boolean

Checks if the data has arrived

Returns:

Boolean:

dataSending

() Boolean

Checks if the transceiver is in the sending mode

Returns:

Boolean:

getData

(
  • data
)

Sinks all the arrived data into a provided buffer

Parameters:

  • data Uint8_t *

    Pointer to the buffer

getStatus

() Number

Checks the transceiver state

Returns:

Number:

rxFifoEmpty

() Boolean

Checks if the receive stack is empty

Returns:

Boolean:

rxPowerUp

()

Powers the receiver up

rxFlushBuffer

()

Flushes the receive stack

txPowerUp

()

Powers the transmitter up

powerDown

()

Powers everything down

setChannel

(
  • channel
)

Parameters:

  • channel Number

    undefined

setPower

(
  • power
)

Parameters:

  • power Power_t

    undefined

setSpeedRate

(
  • rate
)
Number

Parameters:

  • rate Speed_rate_t

    undefined

Returns:

Number:

txFlushBuffer

()

Flushes the transmit stack

pollListener

()

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

ceHigh

() Mraa::Result

Sets the chip enable pin to HIGH

Returns:

Mraa::Result:

ceLow

() Mraa::Result

Sets the chip enable pin to LOW

Returns:

Mraa::Result:

csOn

() Mraa::Result

Sets the chip select pin to LOW

Returns:

Mraa::Result:

csOff

() Mraa::Result

Sets the chip select pin to HIGH

Returns:

Mraa::Result:

setBeaconingMode

()

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

sendBeaconingMsg

(
  • msg
)

Beacons the provided message to BLE scanners.

Parameters:

  • msg Uint8_t *

    Beacons the provided message (max length is 16 bytes)

Properties

m_rxBuffer

Number

Receive buffer

m_txBuffer

Number

Transmit buffer

m_bleBuffer

Number

BLE buffer

NRF_250KBPS

Enum speed_rate_t

NRF_1MBPS

Enum speed_rate_t

NRF_2MBPS

Enum speed_rate_t

NRF_0DBM

Enum power_t

NRF_6DBM

Enum power_t

NRF_12DBM

Enum power_t

NRF_18DBM

Enum power_t