rfoverrideoutputpower.c

来自「ti-Chipcon CC1010 1G以下Soc源码库。包括rf,powerm」· C语言 代码 · 共 73 行

C
73
字号
/*****************************************************************************
 *                                                                           *
 *        **********                                                         *
 *       ************                                                        *
 *      ***        ***                                                       *
 *      ***   +++   ***                                                      *
 *      ***   + +   ***                                                      *
 *      ***   +                            CHIPCON CC1010                    *
 *      ***   + +   ***                 HAL - RFOverrideOutputPower          *
 *      ***   +++   ***                                                      *
 *      ***       ***                                                        *
 *       ***********                                                         *
 *        *********                                                          *
 *                                                                           *
 *****************************************************************************
 *                                                                           *
 *****************************************************************************
 * Author:              ROH                                                  *
 *****************************************************************************
 * Revision history:                                                         *
 *                                                                           *
 * $Log: RFOverrideOutputPower.c,v $
 * Revision 1.1  2002/10/14 13:04:34  tos
 * Initial version in CVS.
 *
 *                                                                           *
 ****************************************************************************/

#include <chipcon/hal.h>

// Variables that are used to override baudrate and PA output power
extern byte xdata   hal_dataformat_override, 
                    hal_baudrate_override, 
                    hal_pa_pow_override,
                    hal_modem0_original,
                    hal_pa_pow_original;

//----------------------------------------------------------------------------
//  halRFOverrideOutputPower(...)
//
//  Description:
//      Function used to override the dataformat specified by an RX/TX-pair.
//      If this function is called before halRFSetRxTxOff(...) it uses
//      the parameter passed to this function instead of whatever the
//      RX/TX-pair defines. If it is passed during an RF-operation, i.e. after
//      halRFSetRxTxOff(...) is called, the parameter passed is immediately
//      updated in hardware.
//
//  Arguments:
//      byte txPower
//          A value between 1 and 28 indicates desired power level -- 28 is
//          highest and 1 lowest. Some useful constants are defined below.
//          The override is turned off by passing 0 or RF_NO_OVERRIDE.
//
//  Return value:
//      void
//----------------------------------------------------------------------------
void halRFOverrideOutputPower(byte txPower) {

    // Adjust format of txPower
    if (txPower&0x0F) {      // > 15
        txPower=((txPower-16)<<4)+0x30;
        if (!txPower)
            txPower=0xFF;
    }
    
    if (hal_pa_pow_override=txPower)
        PA_POW=txPower;
    else
        PA_POW=hal_pa_pow_original;
}    

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?