/*
* PLMEEnergyDetect : Measure channel energy.
*
* Parameters : None
*
* Return : Energy
*/
UINT8 PLMEEnergyDetect (void)
/* Note: Actual power returned is: -(power/2) */
/* Global calibration required for accuracy. */
{
UINT16 u16Reg;
UINT8 u8Power;
gu8RTxMode = CCA_MODE; /* Write energy detect mode */
u16Reg = SPIDrvRead(MODE_ADDR);
u16Reg &= 0xFFF8;
u16Reg |= CCA_MODE;
SPIDrvWrite(MODE_ADDR, u16Reg);
RTXENAssert();
while (gu8RTxMode != IDLE_MODE) /* Wait for energy detect to complete */
{
MCU_LOW_POWER_WHILE();
}
u16Reg = (SPIDrvRead(CCA_RESULT_ADDR) & 0xFF00);
u8Power = (u16Reg >> 8);
return u8Power;
}
/*
* PLMELinkQuality : Report energy from last successful RX packet.
*
* Parameters : None
*
* Return : Energy
*/
UINT8 PLMELinkQuality (void)
/* Note: Actual power returned is: -(power/2) */
/* Global calibration required for accuracy. */
{
UINT16 u16Reg;
UINT8 u8Power;