4. Data Rate Command¶
Selects the transmitter bit rate and the expected receiver bit rate.
Register Fields¶
Bits |
Name |
Meaning |
API |
|---|---|---|---|
7 |
|
Data-rate scale selection |
|
6:0 |
|
Data-rate parameter R |
The setter selects a predefined data rate, which the driver encodes into the
cs and R fields. The setter and reset function update staged
configuration without communicating with the radio. Use
rfm12_apply_to_radio() to write the staged settings.
The getter returns the staged selection without reading from the radio.
Command Functions¶
rfm12_set_data_rate()¶
-
RFM12_result_t rfm12_set_data_rate(RFM12_t *dev, RFM12_data_rate_t rate)¶
Stage the receiver and transmitter data rate.
Select one of the predefined rates:
RFM12_DATA_RATE_1200,RFM12_DATA_RATE_2400,RFM12_DATA_RATE_4800,RFM12_DATA_RATE_9600,RFM12_DATA_RATE_19200,RFM12_DATA_RATE_28800,RFM12_DATA_RATE_38400,RFM12_DATA_RATE_57600, orRFM12_DATA_RATE_115200. The names indicate nominal rates in bits per second; pass the enum constant rather than a numeric bit rate.RFM12_DATA_RATE_COUNTis a count sentinel, not a selectable rate.This function does not communicate with the radio. The staged data rate is written to the radio by
rfm12_apply_to_radio().- Parameters:
dev – RFM12 radio instance.
rate – Predefined data-rate selection.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.
rfm12_get_data_rate()¶
-
RFM12_result_t rfm12_get_data_rate(const RFM12_t *dev, RFM12_data_rate_t *rate)¶
Get the currently staged data-rate selection.
This function returns the staged enum value without communicating with the radio. It does not measure or read back the hardware bit rate.
- Parameters:
dev – RFM12 radio instance.
rate – Receives the staged data-rate selection.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.
rfm12_reset_data_rate()¶
-
RFM12_result_t rfm12_reset_data_rate(RFM12_t *dev)¶
Reset the staged data-rate selection to its default value.
This function does not communicate with the radio. The changed data rate is written to the radio by
rfm12_apply_to_radio().- Parameters:
dev – RFM12 radio instance.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.