3. Frequency Setting Command¶
The frequency API configures the RFM12 carrier frequency.
Register Fields¶
Bits |
Name |
Meaning |
API |
|---|---|---|---|
11:0 |
|
Frequency setting |
Data Types¶
RFM12_frequency_hz_t¶
-
typedef uint32_t RFM12_frequency_hz_t¶
Unsigned carrier frequency in Hz. The selected band determines the valid range and frequency step:
Band (MHz)
Minimum (Hz)
Maximum (Hz)
Step (Hz)
433
430240000
439757500
2500
868
860480000
879515000
5000
915
900720000
929272500
7500
The setter normalizes the requested frequency to the nearest representable value.
Command Functions¶
rfm12_set_frequency()¶
-
RFM12_result_t rfm12_set_frequency(RFM12_t *dev, RFM12_frequency_hz_t frequency_hz)¶
Stage the desired carrier frequency for the RFM12 radio.
The requested frequency is normalized to the nearest frequency that can be represented by the RFM12 for the selected frequency band.
This function does not communicate with the radio. The staged frequency is written to the radio by
rfm12_apply_to_radio().- Parameters:
dev – RFM12 radio instance.
frequency_hz – Desired carrier frequency in Hz.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.
rfm12_reset_frequency()¶
-
RFM12_result_t rfm12_reset_frequency(RFM12_t *dev)¶
Reset the staged carrier frequency to its default value.
This function does not communicate with the radio. The changed frequency is written to the radio by
rfm12_apply_to_radio().- Parameters:
dev – RFM12 radio instance.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.
Helper Functions¶
rfm12_get_frequency()¶
-
RFM12_result_t rfm12_get_frequency(const RFM12_t *dev, RFM12_frequency_hz_t *frequency_hz)¶
Get the currently staged carrier frequency.
- Parameters:
dev – RFM12 radio instance.
frequency_hz – Receives the staged carrier frequency in Hz.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.