⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rx.c

📁 CC1100_CC2500_Examples_Libraries_1_31
💻 C
字号:
/*******************************************************************************************************
 *                                                                                                     *
 *        **********                                                                                   *
 *       ************                                                                                  *
 *      ***        ***                                                                                 *
 *      ***   +++   ***                                                                                *
 *      ***   + +   ***     This file contains all functions related to packet reception in the        *
 *      ***   +             Link1 example                                                              *
 *      ***   + +   ***                                                                                *
 *      ***   +++   ***     Rx.c                                                                       *
 *      ***        ***                                                                                 *
 *       ************                                                                                  *
 *        **********                                                                                   *
 *                                                                                                     *
 *******************************************************************************************************
 * Compiler:                Keil C51 V7.50                                                             *
 * Target platform:         Chipcon CCxxx0 (Silabs F320)                                               *
 * Author:                  SNA                                                                        *
 *******************************************************************************************************
 * Revision history:     See end of file                                                               *
 *******************************************************************************************************/
#include <Chipcon\srf04\regssrf04.h>
#include <Chipcon\srf04\halsrf04.h>
#include <Chipcon\srf04\ebsrf04.h>
#include <Link1.h>




//-------------------------------------------------------------------------------------------------------
//  Global Variables
PKT_DATA xdata pktData;
//-------------------------------------------------------------------------------------------------------




//-------------------------------------------------------------------------------------------------------
//  void pktStartRx(UINT16 timeout)
//
//  DESCRIPTION:
//      This function should be called every time the radio shall enter RX mode.
//
//  ARGUMENTS:
//      UINT16 timeout
//          If the radio shall go back to IDLE after a given time, timeout =! 0.
//          RX Timeout [ms] = timeout * 200 us
//          Min RX Timeout: 0.2 ms
//          Max RX Timeout: 13107 ms
//          timeout = 0 => No timeout. Radio will stay in RX until a packet is received,
//-------------------------------------------------------------------------------------------------------
void pktStartRx(UINT16 timeout) {
    if (timeout) {
        pktData.rxTimeout = timeout;
        pktData.rxTimeoutActive = TRUE;
        pktData.rxTimeoutReached = FALSE;
    }
    halSpiStrobe(CCxxx0_SRX);
}// pktStartRx




//-------------------------------------------------------------------------------------------------------
//  void pktRxHandler(void)
//
//  DESCRIPTION:
//      This function is called every time a timer1 interrupt occurs (every 200 us). The function starts
//      with timeout handling and continues by getting the status byte. A counter, 
//      pktData.rxTimeout, has an initial value timeout (see pktStartRx) and is decremented each
//      time this function is called until it reaches 0 => strobe IDLE (RX mode is terminated).
//      Every time the status byte indicates that there are available bytes in the RX FIFO, bytes are read
//      from the RX FIFO and written to rxBuffer. This is done until the whole packet is received
//      (pktData.pktReceived = TRUE). Due to the FIFO bug, the RX FIFO is not emptied before the last 
//      byte has been received (see Discrepancy Note). If the status byte indicates that there has been an
//      RX FIFO overflow, or the timeout has been reached, the RX FIFO is being flushed. Please see the 
//      SmartRF

⌨️ 快捷键说明

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