예제 #1
0
파일: hal_rf.c 프로젝트: gxp/node
/***********************************************************************************
* @fn      halRfInit
*
* @brief   Power up, sets default tuning settings, enables autoack, enables random
*          generator.
*
* @param   none
*
* @return  SUCCESS always (for interface compatibility)
*/
uint8 halRfInit(void)
{
    uint8 i;

    // turning on power to analog part of radio and waiting for voltage regulator.
    RFPWR = 0x04;
    while( RFPWR & 0x10 );

    // Setting for AUTO CRC and AUTOACK
    MDMCTRL0L |= (AUTO_CRC | AUTO_ACK);

    // Turning on AUTO_TX2RX
    FSMTC1 = ((FSMTC1 & (~AUTO_TX2RX_OFF & ~RX2RX_TIME_OFF))  | ACCEPT_ACKPKT);

    // Turning off abortRxOnSrxon.
    FSMTC1 &= ~0x20;

    // Set FIFOP threshold to maximum
    IOCFG0 = 0x7F;
    // tuning adjustments for optimal radio performance; details available in datasheet */
    RXCTRL0H = 0x32;
    RXCTRL0L = 0xF5;

    // Turning on receiver to get output from IF-ADC
    ISRXON();
    halMcuWaitUs(1);

    // Enable random generator
    ADCCON1 &= ~0x0C;

    for(i = 0 ; i < 32 ; i++)
    {
        RNDH = ADCTSTH;
        // Clock random generator
        ADCCON1 |= 0x04;
    }
    ISRFOFF();

    // Enable CC2591 with High Gain Mode
    halPaLnaInit();

    halRfEnableRxInterrupt();

    return SUCCESS;
}
예제 #2
0
void zb_start_sniffer(zb_uint8_t channel)
{
  /* Received channel is in range of supported ZB channels*/
  if (channel >= ZB_TRANSCEIVER_START_CHANNEL_NUMBER &&
      channel <= ZB_TRANSCEIVER_MAX_CHANNEL_NUMBER)
  {
    /* Flush output buffer to prevent old chanel's packets appearance
       in the output of a new capture */
    bufFlush(&rbTxBuf);

    ZB_TRANSCEIVER_SET_CHANNEL(channel);
    ISFLUSHRX();
    ISRXON();
    
#ifndef ZB_SNIFFER_USB_TRACE
    ZB_SET_SERIAL_TRANSMIT_FLAG();
    ZB_ENABLE_SERIAL_INTER();
#endif
    
  }
}
예제 #3
0
/***********************************************************************************
* @fn      halRfReceiveOn
*
* @brief   Turn receiver on
*
* @param   none
*
* @return  none
*/
void halRfReceiveOn(void)
{
    ISFLUSHRX();     // Making sure that the TX FIFO is empty.
    ISRXON();
}
예제 #4
0
파일: hal_rf.c 프로젝트: gxp/node
/***********************************************************************************
* @fn      halRfReceiveOn
*
* @brief   Turn receiver on
*
* @param   none
*
* @return  none
*/
void halRfReceiveOn(void)
{
    FLUSH_RX_FIFO();
    ISRXON();
}