Microchip® Advanced Software Framework

tal_pwr_mgmt.c File Reference

This file implements TAL power management functionality of the transceiver.

Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include "pal.h"
#include "return_val.h"
#include "ieee_const.h"
#include "tal.h"
#include "tal_config.h"
#include "tal_internal.h"
#include "tal_pib.h"

Functions

retval_t tal_trx_sleep (trx_id_t trx_id)
 Sets the transceiver to SLEEP. More...
 
retval_t tal_trx_wakeup (trx_id_t trx_id)
 Wakes up the transceiver from SLEEP. More...
 

retval_t tal_trx_sleep ( trx_id_t  trx_id)

Sets the transceiver to SLEEP.

Sets the transceiver to sleep.

This function sets the entire device to state DEEP_SLEEP.

Parameters
trx_idTransceiver identifier
modeDefines sleep mode of transceiver (Not used for 215 trx)
Returns

References Assert, bmm_buffer_free(), MAC_SUCCESS, NUM_TRX, RF09, RF24, RF_BASE_ADDR_OFFSET, RF_SLEEP, RF_TRXOFF, RG_RF09_CMD, TAL_BB_IRQ_CLR_ALL, tal_buf_shortage, TAL_BUSY, TAL_IDLE, TAL_RF_IRQ_CLR_ALL, tal_rx_buffer, TAL_SLEEP, tal_state, TAL_TRX_ASLEEP, trx_reg_write(), and trx_state.

Referenced by toggle_trx_sleep().

retval_t tal_trx_wakeup ( trx_id_t  trx_id)

Wakes up the transceiver from SLEEP.

Wakes up the transceiver from sleep.

This function awakes the transceiver from state SLEEP.

Parameters
trx_idTransceiver identifier
Returns
  • TAL_TRX_AWAKE - The transceiver is already awake
  • MAC_SUCCESS - The transceiver is woken up from sleep
  • FAILURE - The transceiver did not wake-up from sleep

References Assert, bmm_buffer_alloc(), BMM_BUFFER_POINTER, config_phy(), FAILURE, LARGE_BUFFER_SIZE, MAC_SUCCESS, NUM_TRX, pal_get_current_time(), pal_sub_time_us(), RF09, RF24, RF_BASE_ADDR_OFFSET, RF_IRQ_WAKEUP, RF_TRXOFF, RG_RF09_CMD, start_time, TAL_IDLE, TAL_RF_IRQ_CLR, TAL_RF_IS_IRQ_SET, tal_rx_buffer, TAL_SLEEP, tal_state, TAL_TRX_AWAKE, TAL_WAKING_UP, trx_config(), frame_info_tag::trx_id, trx_reg_write(), trx_state, and write_all_tal_pib_to_trx().

Referenced by toggle_trx_sleep().