RadioConfig¶
rf24_py.RadioConfig ¶
RadioConfig()
Instantiate a RadioConfig object with library defaults.
| feature | default value |
|---|---|
channel |
76 |
address_length |
5 |
pa_level |
PaLevel.Max |
lna_enable |
True |
crc_length |
CrcLength.Bit16 |
data_rate |
DataRate.Mbps1 |
payload_length |
32 |
dynamic_payloads |
False |
auto_ack |
0x3F (enabled for pipes 0 - 5) |
ack_payloads |
False |
ask_no_ack |
False |
auto_retry_delay |
5 |
auto_retry_count |
15 |
tx_address |
b"\xE7" * 5 |
get_rx_address() |
See below table about Default RX addresses |
rx_dr |
True |
tx_ds |
True |
tx_df |
True |
Default RX pipes' configuration¶
| pipe number | state | address |
|---|---|---|
| 01 | closed | b"\xE7" * 5 |
| 1 | open | b"\xC2" * 5 |
| 22 | closed | 0xC3 |
| 32 | closed | 0xC4 |
| 42 | closed | 0xC5 |
| 52 | closed | 0xC6 |
address_length
property
writable
¶
address_length: int
The address length.
This value is clamped to range [2, 5].
payload_length
property
writable
¶
payload_length: int
The payload length for statically sized payloads.
This value can not be set larger than 32 bytes.
See RF24.payload_length.
channel
property
writable
¶
channel: int
Set the channel (over the air frequency).
This value is clamped to range [0, 125]. The radio's frequency can be determined by the following equation:
frequency (in Hz) = channel + 2400
lna_enable
property
writable
¶
lna_enable: bool
Enable or disable the chip's Low Noise Amplifier (LNA) feature.
This value may not be respected depending on the radio module used. Consult the radio's manufacturer for accurate details.
crc_length
property
writable
¶
crc_length: CrcLength
The Cyclical Redundancy Checksum (CRC) length.
See RF24.crc_length.
auto_ack
property
writable
¶
auto_ack: int
Enable or disable auto-ACK feature.
The given value (in binary form) is used to control the auto-ack feature for each pipe. Bit 0 controls the feature for pipe 0. Bit 1 controls the feature for pipe 1. And so on.
To enable the feature for pipes 0, 1 and 4:
config = RadioConfig()
config.auto_ack = 0b010011
dynamic_payloads
property
writable
¶
dynamic_payloads: bool
Enable or disable dynamically sized payloads.
Enabling this feature nullifies the utility of RadioConfig.payload_length.
This feature is enabled automatically when enabling ACK payloads
via RadioConfig.ack_payloads.
ack_payloads
property
writable
¶
ack_payloads: bool
Enable or disable custom ACK payloads for auto-ACK packets.
ACK payloads require the RadioConfig.auto_ack
and RadioConfig.dynamic_payloads
to be enabled. If ACK payloads are enabled, then this function also enables those
features (for all pipes).
ask_no_ack
property
writable
¶
ask_no_ack: bool
Allow disabling auto-ack per payload.
See ask_no_ack parameter for
RF24.send() and
RF24.write().
auto_retry_delay
property
¶
auto_retry_delay: int
The auto-retry feature's delay set by
RadioConfig.set_auto_retries().
auto_retry_count
property
¶
auto_retry_count: int
The auto-retry feature's count set by
RadioConfig.set_auto_retries().
rx_dr
property
writable
¶
rx_dr: bool
Enable or disable the "RX Data Ready" event triggering the radio's IRQ.
See StatusFlags.rx_dr.
tx_ds
property
writable
¶
tx_ds: bool
Enable or disable the "TX Data Sent" event triggering the radio's IRQ.
See StatusFlags.tx_ds.
tx_df
property
writable
¶
tx_df: bool
Enable or disable the "TX Data Failed" event triggering the radio's IRQ.
See StatusFlags.tx_df.
tx_address
property
writable
¶
tx_address: bytes
Set the TX address.
Only pipe 0 can be used for TX operations (including auto-ACK packets during RX operations).
set_auto_retries ¶
Set the auto-retry feature's delay and count parameters.
set_rx_address ¶
Set the address of a specified RX pipe for receiving data.
This does nothing if the given pipe is greater than 8.
For pipes 2 - 5, the 4 LSBytes are used from address set to pipe 1 with the
MSByte from the given address.
See also RadioConfig.tx_address().
get_rx_address ¶
Get the address for a specified pipe set by RadioConfig.set_rx_address().
close_rx_pipe ¶
close_rx_pipe(pipe: int) -> None
Close a RX pipe from receiving data.
This is only useful if pipe 1 should be closed instead of open
(after constructing RadioConfig).