Пример #1
0
/**************************************************************************************************
 * @fn          macRadioTurnOnPower
 *
 * @brief       Logic and sequence for powering up the radio.
 *
 * @param       none
 *
 * @return      none
 **************************************************************************************************
 */
MAC_INTERNAL_API void macRadioTurnOnPower(void)
{
  /* Enable RF error trap */
  MAC_MCU_RFERR_ENABLE_INTERRUPT();

#if defined MAC_RUNTIME_CC2591 || defined MAC_RUNTIME_CC2590
  /* table ID is referenced only when runtime configuratino is enabled */
  if (macRadioDefsRefTableId & 0xf0)
#endif /* defined MAC_RUNTIME_CC2591 || defined MAC_RUNTIME_CC2590 */

#if defined MAC_RUNTIME_CC2591 || defined MAC_RUNTIME_CC2590 || \
  defined HAL_PA_LNA || defined HAL_PA_LNA_CC2590
  { /* either if compound statement or non-conditional compound statement */

    /* (Re-)Configure PA and LNA control signals to RF frontend chips.
    * Note that The register values are not retained during sleep.
    */

    /* P1_1 -> PAEN */
    //RFC_OBS_CTRL0 = RFC_OBS_CTRL_PA_PD_INV;
    //OBSSEL1       = OBSSEL_OBS_CTRL0;

    /* P1_4 -> EN (LNA control) */
    //RFC_OBS_CTRL1 = RFC_OBS_CTRL_LNAMIX_PD_INV;
    //OBSSEL4       = OBSSEL_OBS_CTRL1;
    /* P1_5 -> PAEN */
    RFC_OBS_CTRL0 = RFC_OBS_CTRL_PA_PD_INV;
    OBSSEL5       = OBSSEL_OBS_CTRL0;      

    P1SEL &= ~0X10;    
    P1DIR |= 0X10;
    P1_4 = 1;         //P1_4 RXEN   andy pa    
    
    /* For any RX, change CCA settings for CC2591 compression workaround.
     * This will override LNA control if CC2591_COMPRESSION_WORKAROUND 
     * flag is defined. 
     */
    COMPRESSION_WORKAROUND_ON();
  }
#endif /* defined MAC_RUNTIME_CC2591 || ... || defined HAL_PA_LNA_CC2590 */

  if (macChipVersion <= REV_B)
  {
    /* radio initializations for disappearing RAM; PG1.0 and before only */
    MAC_RADIO_SET_PAN_ID(macPib.panId);
    MAC_RADIO_SET_SHORT_ADDR(macPib.shortAddress);
    MAC_RADIO_SET_IEEE_ADDR(macPib.extendedAddress.addr.extAddr);
  }

  /* Turn on frame filtering */
  MAC_RADIO_TURN_ON_RX_FRAME_FILTERING();
}
Пример #2
0
/**************************************************************************************************
 * @fn          macRadioEnergyDetectStop
 *
 * @brief       Called at completion of an energy detect.  Note: can be called even if energy
 *              detect is already stopped (needed by reset).
 *
 * @param       none
 *
 * @return      highest energy detect measurement
 **************************************************************************************************
 */
uint8 macRadioEnergyDetectStop(void)
{
  uint8 rssiDbm;
  uint8 energyDetectMeasurement;

  rssiDbm = MAC_RADIO_RECORD_MAX_RSSI_STOP() + MAC_RADIO_RSSI_OFFSET;
  MAC_RADIO_RSSI_LNA_OFFSET(rssiDbm);
  energyDetectMeasurement = radioComputeED(rssiDbm);

  /* Trun on CC2591 compresson workaround */
  COMPRESSION_WORKAROUND_ON();

  return(energyDetectMeasurement);
}