Was the Received Power Detection (RPD) trigger?
This flag is asserted during an RX session (after a mandatory 130 microseconds duration) if a signal stronger than -64 dBm was detected.
Note that if a payload was placed in RX mode, then that means the signal used to transmit that payload was stronger than either
Sensitivity may vary based of the radio's model and manufacturer. The information above is stated in the nRF24L01+ datasheet.
Reset the specified StatusFlags.
Optionalflags: StatusFlags | nullIf no value is given, then all flags are reset.
Discard all 3 levels of the radio's RX FIFO.
Discard all 3 levels of the radio's TX FIFO.
This is automatically called by RF24.asTx when ACK payloads are enabled (via RF24.ackPayloads).
Get the length of the next available payload in the RX FIFO.
If dynamically sized payloads are not enabled (via RF24.dynamicPayloads), then use RF24.payloadLength.
Get the state of the specified FIFO.
True returns data about the TX FIFO. False returns data about the RX FIFO.
Get the Automatic Retry Count (ARC) of attempts made during the last transmission.
This resets with every new transmission. The returned value is meaningless if the auto-ack feature is disabled.
Use RF24.setAutoRetries to configure the automatic retries feature.
Get the current state of the StatusFlags.
This function simply returns the value of the flags that was cached from the last SPI transaction. It does not actually update the values (from the radio) before returning them.
Use RF24.update to update them first.
A non-blocking function to restart a failed transmission.
This is a helper function to RF24.resend. Use RF24.update and RF24.getStatusFlags to determine if retransmission was successful.
Start a constant carrier wave
This functionality is meant for hardware tests (in conjunction with RF24.rpd). Typically, this behavior is required by government agencies to enforce regional restrictions.
The Power Amplitude level to use when transmitting.
The channel (radio's frequency) used to transmit. The channel should not be changed while transmitting because it can cause undefined behavior.
Stop the constant carrier wave started via RF24.startCarrierWave.
This function leaves the radio in a configuration that may be undesired or
unexpected because of the setup involved in RF24.startCarrierWave.
The PaLevel and channel passed to RF24.startCarrierWave are
still set.
If RF24.isPlusVariant returns true, the following features are all disabled:
Update the cached value of Status flags.
Use RF24.getStatusFlags to get the updated values.
A non-blocking function that uploads a given buf to the radio's TX FIFO.
This is a helper function to RF24.send. Use this in combination with RF24.update and RF24.getStatusFlags to determine if transmission was successful.
The buffer of bytes to load into the TX FIFO.
OptionalwriteConfig: WriteConfig | nullA Boolean that describes if the given buf was successfully loaded
into the TX FIFO. Remember, the TX FIFO has only 3 levels ("slots").
Upload a given ACK packet's payload (buf) into the radio's TX FIFO.
This feature requires RF24.ackPayloads to be enabled.
The pipe number that (when data is received) will be responded
with the given payload (buf).
The payload to attach to the auto-ack packet when responding to
data received on specified pipe.
A boolean value that describes if the payload was successfully uploaded to the TX FIFO. Remember, the TX FIFO only has 3 levels ("slots").
Construct an object to control the radio.
The GPIO pin number connected to the radio's CE pin.
The identifying number for the SPI bus' CS pin; also labeled as "CEx" (where "x" is this parameter's value) on many Raspberry Pi pin diagrams. See HardwareConfig.devSpiBus for more detail.
OptionalhardwareConfig: HardwareConfig | nullOptional parameters to fine tune hardware configuration (like SPI bus number and GPIO chip number).
Set the channel (frequency) that the radio uses to transmit and receive.
This value is clamped to the range [0, 125].
This value can be roughly translated into a frequency with the formula:
frequency (in Hz) = channel + 2400
Is the radio in active RX mode?
Put the radio into active RX mode.
Conventionally, this should be called after setting the RX addresses via RF24.openRxPipe.
This function will restore the cached RX address set to pipe 0. This is done because the RF24.asTx will appropriate the RX address on pipe 0 for auto-ack purposes.
Puts the radio into an inactive TX mode.
This must be called at least once before calling RF24.send or RF24.write.
For auto-ack purposes, this function will also restore
the cached txAddress to the RX pipe 0.
The datasheet recommends idling the radio in an inactive TX mode.
This function will also flush the TX FIFO when ACK payloads are enabled (via RF24.ackPayloads).
OptionaltxAddress: Buffer<ArrayBufferLike> | nullIf specified, then this buffer will be cached and set as the new TX address.
Is there a payload available in the RX FIFO?
Use RF24.read to get the payload data.
Similar to RF24.available but also returns the pipe that received the next available payload.
Initialize the radio on the configured hardware (as specified to RF24 constructor).
A Generic Error if a hardware failure caused problems (includes a message to describe what problem was detected).
This is the same as RF24.withConfig, but this function also
Close the specified pipe from receiving transmissions.
Use RF24.openRxPipe to set the address for a specific pipe.
The pipe to close. This must be in range [0, 5], otherwise this function does nothing.
Open a specific pipe for receiving from the given address.
It is highly recommended to avoid using pipe 0 to receive because it is also used to transmit automatic acknowledgements.
Only pipes 0 and 1 actually use up to 5 bytes of the given address. Pipes 2 - 5 only use the first byte of the given address and last 4 bytes of the address set to pipe 1.
The pipe number to receive data. This must be in range [0, 5], otherwise this function does nothing.
The address to receive data from.
Read data from the radio's RX FIFO.
Use RF24.available to determine if there is data ready to read from the RX FIFO.
Optionallen: number | nullAn optional number of bytes to read from the FIFO. This is capped at 32.
If not specified, then the length of the next available payload is used (which automatically
respects if dynamic payloads are enabled).
Use RF24.dynamicPayloads for dynamically sized payload or RF24.payloadLength for statically sized payloads.
A blocking function to resend a failed payload in the TX FIFO.
This is similar to RF24.send but specifically for failed transmissions.
Blocking function that loads a given buf into the TX FIFO, waits for a response
(if auto-ack is enabled), then returns a Boolean describing success.
The buffer of bytes to transmit.
OptionalaskNoAck: number | booleanA flag to disable the auto-ack feature for the given payload in buf.
This has no effect if auto-ack is disabled or
RF24.allowAskNoAck is not enabled.
A boolean that describes if transmission is successful or not. This will always return true if auto-ack is disabled.
Enable or disable the custom ACK payloads attached to auto-ack packets.
This feature requires dynamically sized payloads. This attribute will enable RF24.dynamicPayloads automatically when needed. This attribute will not disable RF24.dynamicPayloads.
Set the address length (applied to all pipes).
The address length is clamped to the range [2, 5].
Get/set the CrcLength used for all outgoing and incoming transmissions.
If disabled (CrcLength.Disabled) while auto-ack feature is enabled, then this function's returned value does not reflect the fact that CRC is forcefully enabled by the radio's firmware (needed by the auto-ack feature).
Enable or disable the dynamically sized payloads feature.
If set to true, the statically sized payload length (set via
RF24.payloadLength) are not used.
Is this radio a nRF24L01+ variant?
The bool that this attribute returns is only valid after calling RF24.begin.
Get/set the statically sized payload length.
This configuration is not used if dynamic payloads are enabled. Use RF24.getDynamicPayloadLength instead if dynamically sized payloads are enabled (via RF24.dynamicPayloads).
Control the radio's powered level.
This is just a convenience attribute that calls RF24.powerUp or RF24.powerDown.
Use RF24.isRx to determine if the radio is in RX or TX mode.
The driver will delay for this duration (32 bit unsigned int of microseconds) when RF24.asTx is called.
If the auto-ack feature is disabled, then this can be set as low as 0. If the auto-ack feature is enabled, then set to 100 microseconds minimum on generally faster devices (like RPi).
This value cannot be negative.
Since this value can be optimized per the radio's data rate, this value is automatically adjusted when changing RF24.dataRate. If setting this to a custom value be sure, to set it after changing the radio's data rate.
If set to 0, then the concurrent outgoing ACK packet (when auto-ack is enabled) may fail to transmit when exiting RX mode with RF24.asTx.
Allow disabling the auto-ack feature for individual payloads.
Setting this to true will allow the askNoAck parameter to
take effect. See RF24.send and
WriteConfig.askNoAck for more detail.
Power Down the radio.
No transmissions can be received when the radio is powered down.
Power up the radio.
Optionaldelay: number | nullThe number of nanoseconds to wait for the radio to finish powering up. If not specified, the default wait time defaults to 5 milliseconds.
Print helpful debug information to stdout.
Enable or disable the auto-ack feature for all pipes.
This feature requires CRC to be enabled. See RF24.crcLength for more detail.
Enable or disable the auto-ack feature for a specified pipe.
Configure the automatic retry feature.
This feature is part of the auto-ack feature, thus the auto-ack feature is required for this function to have any effect.
This value is clamped to the range [0, 15]. This value is
translated to microseconds with the formula 250 + (delay * 250) = microseconds.
Meaning, the effective range of delay is [250, 4000].
The number of attempt to retransmit when no ACK packet was received (after transmitting). This value is clamped to the range [0, 15].
Enable or disable the LNA feature.
This is enabled by default (regardless of chip variant). See PaLevel for effective behavior.
On nRF24L01+ modules with a builtin antenna, this feature is always enabled. For clone's and module's with a separate PA/LNA circuit (external antenna), this function may not behave exactly as expected. Consult the radio module's manufacturer.
Configure the IRQ pin to reflect the specified StatusFlags.
Optionalflags: StatusFlags | nullIf no value is given, then all flags are reflected by the IRQ pin.
Reconfigure the radio with the specified config.
It is strongly encouraged to call RF24.begin after constructing the RF24 object.
Only use this function subsequently to quickly switch between different network settings.
This class provides the user facing API to interact with a nRF24L01 transceiver.