2. Power Management Command¶
Enables and disables the radio’s receiver, transmitter, and supporting functional blocks.
The individual setters and reset function update staged configuration without
communicating with the radio. Use rfm12_apply_to_radio() to write the
staged settings. The mode helpers perform immediate SPI transfers and write
the complete Power Management Command, including any pending settings for
this command.
Register Fields¶
Bits |
Name |
Meaning |
API |
|---|---|---|---|
7 |
|
Receiver enable |
|
6 |
|
Receiver baseband enable |
|
5 |
|
Transmitter enable |
|
4 |
|
Synthesizer enable |
|
3 |
|
Crystal oscillator enable |
|
2 |
|
Low-battery detector enable |
|
1 |
|
Wake-up timer enable |
|
0 |
|
Clock output disable |
The functions listed in the register field table above directly configure
fields in the Power Management Command. These settings are staged and are
written to the radio by rfm12_apply_to_radio().
The Helper Functions provide higher-level operations for placing the radio into common operating modes. Unlike the staged setters, these functions communicate with the radio immediately.
Command Functions¶
rfm12_set_receiver_enable()¶
-
RFM12_result_t rfm12_set_receiver_enable(RFM12_t *dev, RFM12_enable_t enable)¶
Stage the receiver enable setting.
- Parameters:
dev – RFM12 radio instance.
enable – Enable or disable the receiver.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.
rfm12_set_baseband_enable()¶
-
RFM12_result_t rfm12_set_baseband_enable(RFM12_t *dev, RFM12_enable_t enable)¶
Stage the receiver baseband circuits enable setting.
- Parameters:
dev – RFM12 radio instance.
enable – Enable or disable the receiver baseband circuits.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.
rfm12_set_transmitter_enable()¶
-
RFM12_result_t rfm12_set_transmitter_enable(RFM12_t *dev, RFM12_enable_t enable)¶
Stage the transmitter enable setting.
- Parameters:
dev – RFM12 radio instance.
enable – Enable or disable the transmitter.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.
rfm12_set_synthesizer_enable()¶
-
RFM12_result_t rfm12_set_synthesizer_enable(RFM12_t *dev, RFM12_enable_t enable)¶
Stage the synthesizer enable setting.
- Parameters:
dev – RFM12 radio instance.
enable – Enable or disable the synthesizer.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.
rfm12_set_crystal_oscillator_enable()¶
-
RFM12_result_t rfm12_set_crystal_oscillator_enable(RFM12_t *dev, RFM12_enable_t enable)¶
Stage the crystal oscillator enable setting.
- Parameters:
dev – RFM12 radio instance.
enable – Enable or disable the crystal oscillator.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.
rfm12_set_low_battery_detector_enable()¶
-
RFM12_result_t rfm12_set_low_battery_detector_enable(RFM12_t *dev, RFM12_enable_t enable)¶
Stage the low-battery detector enable setting.
- Parameters:
dev – RFM12 radio instance.
enable – Enable or disable the low-battery detector.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.
rfm12_set_wakeup_timer_enable()¶
-
RFM12_result_t rfm12_set_wakeup_timer_enable(RFM12_t *dev, RFM12_enable_t enable)¶
Stage the wake-up timer enable setting.
- Parameters:
dev – RFM12 radio instance.
enable – Enable or disable the wake-up timer.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.
rfm12_set_clock_output_enable()¶
-
RFM12_result_t rfm12_set_clock_output_enable(RFM12_t *dev, RFM12_enable_t enable)¶
Stage the clock output enable setting.
The hardware
dcbit disables the clock output. Enabling the clock output clearsdc; disabling the clock output sets it.- Parameters:
dev – RFM12 radio instance.
enable – Enable or disable the clock output.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.
rfm12_reset_power_management()¶
-
RFM12_result_t rfm12_reset_power_management(RFM12_t *dev)¶
Reset the staged Power Management Command values to their defaults.
This function does not communicate with the radio. The changed settings are 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¶
The mode helper functions provide convenient operations for placing the radio
into its defined operating modes. They perform an immediate SPI transfer of
the Power Management Command rather than staging the change for a later
rfm12_apply_to_radio().
Any pending Power Management Command settings are included in that transfer.
rfm12_enter_rx_mode()¶
-
RFM12_result_t rfm12_enter_rx_mode(RFM12_t *dev)¶
Enter receive mode by immediately writing the Power Management Command.
This also applies any pending settings belonging to this command. The driver’s tracked operating mode is updated after a successful transfer.
- Parameters:
dev – RFM12 radio instance.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.
rfm12_enter_tx_mode()¶
-
RFM12_result_t rfm12_enter_tx_mode(RFM12_t *dev)¶
Enter transmit mode by immediately writing the Power Management Command.
This also applies any pending settings belonging to this command. The driver’s tracked operating mode is updated after a successful transfer.
- Parameters:
dev – RFM12 radio instance.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.
rfm12_enter_idle_mode()¶
-
RFM12_result_t rfm12_enter_idle_mode(RFM12_t *dev)¶
Enter idle mode by immediately writing the Power Management Command.
This also applies any pending settings belonging to this command. The driver’s tracked operating mode is updated after a successful transfer.
- Parameters:
dev – RFM12 radio instance.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.
rfm12_enter_standby_mode()¶
-
RFM12_result_t rfm12_enter_standby_mode(RFM12_t *dev)¶
Enter standby mode by immediately writing the Power Management Command.
This also applies any pending settings belonging to this command. The driver’s tracked operating mode is updated after a successful transfer.
- Parameters:
dev – RFM12 radio instance.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.
rfm12_enter_sleep_mode()¶
-
RFM12_result_t rfm12_enter_sleep_mode(RFM12_t *dev)¶
Enter sleep mode by immediately writing the Power Management Command.
This also applies any pending settings belonging to this command. The driver’s tracked operating mode is updated after a successful transfer.
- Parameters:
dev – RFM12 radio instance.
- Returns:
RFM12_OKon success, or an appropriateRFM12_result_terror.