亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? rfsendpacketserial.c

?? c51控制cc1100示范程序
?? C
字號:
/*******************************************************************************************************
 *                                                                                                     *
 *        **********                                                                                   *
 *       ************                                                                                  *
 *      ***        ***                                                                                 *
 *      ***   +++   ***                                                                                *
 *      ***   + +   ***     This function transmits a packet                                           *
 *      ***   +                                                                                        *
 *      ***   + +   ***                                                                                *
 *      ***   +++   ***     RfSendPacketSerial.c                                                       *
 *      ***        ***                                                                                 *
 *       ************                                                                                  *
 *        **********                                                                                   *
 *                                                                                                     *
 *******************************************************************************************************
 * Compiler:                Keil C51 V7.50                                                             *
 * Target platform:         Chipcon CCxxx0 (Silabs F320)                                               *
 * Author:                  SNA                                                                        *
 *******************************************************************************************************
 * Revision history:        See end of file                                                            *
 ******************************************************************************************************/
#include <Chipcon\srf04\halsrf04.h>
#include <Chipcon\srf04\regssrf04.h>
#include <Chipcon\srf04\culsrf04.h>




//-------------------------------------------------------------------------------------------------------
// Defines
#define GDO1_PIN        P0_1
#define SERIAL_CLK      GDO1_PIN

#define GDO0_PIN        P0_6
#define SERIAL_DATA     GDO0_PIN
//-------------------------------------------------------------------------------------------------------




//-------------------------------------------------------------------------------------------------------
//  void halRfSendPacketSerial(BYTE *txBuffer, UINT8 size, UINT8 startOfPayload, BOOL crcEnable)
//
//  DESCRIPTION:
//      This function transmits a packet using synchronous serial mode. The radio must be configured to 
//      use GIO1 as the serial clock (IOCFG1 = 0x0B) and GDO0 as serial synchronous data output
//      (IOCFG0 = 0x0C).
//      The packet should have the following format:
//      
//      ----------------------------------------------------------------------------------
//      | preamble | sync3 | sync2 | sync1 | sync0 | length byte | payload | crc1 | crc0 |
//      ----------------------------------------------------------------------------------
//
//      The length byte and the crc is optional.
//      Be aware that modifications to this function might be necessary if it is ported to other
//      MCUs or if the data rate is increased, due to timing issues.
//      The function is only meant to give an indication on how to use the serial synchronous mode
//      of the CCxx00.    
//      
//  ARGUMENTS:
//      BYTE *txBuffer
//          Pointer to array containing the packet to be sent.
//          For example:
//          BYTE xdata txBuffer[] = {0x55,  0x55,   0x55,   0x55,  Preamble
//                                   SYNC3, SYNC2,  SYNC1,  SYNC0, Sync word (it is not necessary to
//                                                                 transmit 4 sync bytes but the culSyncSearch
//                                                                 function in the cul library must be  
//                                                                 modified if other sync lengths should be used. 
//                                   3,     'A',    'B',    'C',   length byte + payload (length byte is optional, 
//                                                                 depending on how the receiver is configured
//                                                                 (fixed or variable packet length)
//                                   CRC1, CRC0};                  CRC bytes (optional)
//                                                                 This is just 2 dummy bytes which will be 
//                                                                 replaced with 'real' crc bytes if crc calculation 
//                                                                 is enabled
//
//      UINT8 size
//          Size of the txBuffer
// 
//      UINT8 startOfPayload
//          Indicates where in the txBuffer the crc calculation should start (crc is calculated over the
//          optional length byte and the payload.
//
//      BOOL crcEnable
//          TRUE: Calculate CRC and replace CRC1 and CRC0 in txBuffer with 'real' crc bytes
//          FALSE: CRC is not calculated and TX mode is terminated after the payload has been sent  
//-------------------------------------------------------------------------------------------------------
void halRfSendPacketSerial(BYTE *txBuffer, UINT8 size, UINT8 startOfPayload, BOOL crcEnable) {

    UINT8 data i;
    UINT16 xdata checksum;
    UINT8 data dataByte = 0;
    UINT8 data lengthByte;
    UINT8 data bufferIndex = 0;

    if (crcEnable) {

        // Generate CRC
        checksum = CRC_INIT;   //Init value for CRC calculation

        for(i = startOfPayload; i < (size - 2); i++)
            checksum = culCalcCRC(txBuffer[i], checksum);



        txBuffer[size - 2] = checksum >> 8;     // CRC1
        txBuffer[size - 1] = checksum & 0x00FF; // CRC0
    }

    lengthByte = txBuffer[0];
                    
    // MSB of the first byte needs to ready on the data line before strobing TX
    if (((lengthByte & MSB) >> 7) == 0)
        SERIAL_DATA = 0;
    else
        SERIAL_DATA = 1;

    lengthByte = lengthByte << 1;

    // Enter TX mode
    halSpiStrobe(CCxxx0_STX);

    // Transmit the first byte
    for (i = 1; i < 8; i++) {
        while (!SERIAL_CLK);
                     
        if (((lengthByte & MSB) >> 7) == 0)
            SERIAL_DATA = 0;
        else
            SERIAL_DATA = 1;
        
        lengthByte = lengthByte << 1;

        while (SERIAL_CLK);
    }
    
    // Tranmit the rest of the packet                               
    for (bufferIndex = 1; bufferIndex < size; bufferIndex++) {
        dataByte = txBuffer[bufferIndex];
        for (i = 0; i < 8; i++) {
            while (!SERIAL_CLK);
            
            if (((dataByte & MSB) >> 7) == 0)
                SERIAL_DATA = 0;
            else
                SERIAL_DATA = 1;

            dataByte = dataByte << 1;
            while (SERIAL_CLK);
        }
    }
    while (!SERIAL_CLK);
    while (SERIAL_CLK);  
    
    // Transmit 2 dummy bytes. 
    SERIAL_DATA = 0;  
    for (i = 0; i < 16; i++) {
        while (!SERIAL_CLK);
        while (SERIAL_CLK);
    }            

    // Enter IDLE mode
    halSpiStrobe(CCxxx0_SIDLE);
}// halRfSendPacketSerial




/******************************************************************************************************
 * Revision history:                                                                                  *
 *
 * $Log: RfSendPacketSerial.c,v $
 * Revision 1.1  2005/11/09 09:40:17  sna
 * Initial version in CVS.
 *
 *
 *
 ******************************************************************************************************/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人a级片| 国产成人精品在线看| 国产精品久久久久久久久图文区| 欧美一区二区三区播放老司机| 日本伦理一区二区| 欧美三级三级三级爽爽爽| 欧美网站大全在线观看| 欧美少妇bbb| 日韩欧美亚洲一区二区| 久久男人中文字幕资源站| 久久男人中文字幕资源站| 国产日韩欧美一区二区三区综合| 国产亚洲制服色| 自拍偷拍国产精品| 亚洲一区二区视频在线观看| 亚洲成在人线免费| 韩日欧美一区二区三区| 成人av集中营| 欧美日韩国产片| 91精品国产一区二区三区| 欧美成人女星排名| 欧美韩日一区二区三区四区| 亚洲精品自拍动漫在线| 日韩国产成人精品| 国产精品99久久久| 91高清在线观看| 欧美一区二区视频网站| 国产亚洲精品中文字幕| 一区二区三区久久| 另类调教123区| 91色在线porny| 日韩精品一区二区在线| 中文字幕在线一区免费| 亚洲成人在线网站| 成人免费av在线| 欧美精品乱人伦久久久久久| 国产欧美一二三区| 婷婷久久综合九色综合绿巨人| 国产最新精品精品你懂的| 在线观看视频一区二区欧美日韩| 日韩丝袜美女视频| 一区二区日韩av| 国产乱码精品1区2区3区| 欧美日韩视频在线一区二区| 中文一区一区三区高中清不卡| 亚洲成人精品在线观看| 99久久99久久精品国产片果冻| 日韩亚洲欧美在线| 一区二区三区中文字幕精品精品| 国内外成人在线视频| 欧美三级电影网| 亚洲视频一区在线| 国产成人在线视频网址| 91精品国产综合久久久久久久| 综合网在线视频| 国产精品资源在线| 日韩欧美高清一区| 午夜一区二区三区视频| 91色九色蝌蚪| 国产精品久久久久影院| 国产mv日韩mv欧美| 国产亚洲欧美在线| 久久精品国产亚洲5555| 欧美肥妇bbw| 亚洲午夜视频在线观看| 色丁香久综合在线久综合在线观看| 久久久久88色偷偷免费 | 国产宾馆实践打屁股91| 欧美二区乱c少妇| 亚洲小说春色综合另类电影| 色视频一区二区| 亚洲美女在线一区| 99久久精品国产导航| 中文字幕第一区第二区| 国产精品一区一区| 国产清纯在线一区二区www| 国产高清亚洲一区| 亚洲国产激情av| 成人丝袜18视频在线观看| 久久久.com| 不卡的av网站| 亚洲精品亚洲人成人网| 色屁屁一区二区| 天堂一区二区在线| 欧美tickling网站挠脚心| 精品一区二区三区久久| xfplay精品久久| 国产不卡视频在线播放| 国产精品久久久久精k8| 一本久久a久久免费精品不卡| 亚洲精品乱码久久久久久日本蜜臀| 91福利区一区二区三区| 亚洲成av人片一区二区梦乃| 欧美一区在线视频| 国产精品一区在线观看你懂的| 国产精品女主播在线观看| 色综合夜色一区| 图片区日韩欧美亚洲| 精品久久久久久综合日本欧美| 国产精品一二三四| 一区二区高清视频在线观看| 51午夜精品国产| 国产成人精品免费一区二区| 一区二区三区在线视频播放| 777亚洲妇女| 成人免费va视频| 日欧美一区二区| 国产三级三级三级精品8ⅰ区| 99国产精品国产精品久久| 蜜臀av性久久久久蜜臀av麻豆| 欧美韩国一区二区| 欧美电影在线免费观看| 成人激情开心网| 日本亚洲天堂网| 亚洲欧美怡红院| 日韩小视频在线观看专区| 成人爱爱电影网址| 日本视频免费一区| 亚洲欧美成人一区二区三区| 欧美大胆人体bbbb| 91精品1区2区| 成人开心网精品视频| 老司机精品视频一区二区三区| 中文字幕一区二区三区在线不卡 | 久久99久久99精品免视看婷婷| 国产精品福利在线播放| 日韩小视频在线观看专区| 91免费国产在线观看| 国产高清不卡二三区| 青青草91视频| 亚洲二区在线视频| 国产精品高潮呻吟| 欧美极品少妇xxxxⅹ高跟鞋 | 久久婷婷一区二区三区| 欧美视频一区二| 色综合天天性综合| 国产91丝袜在线18| 国内精品免费在线观看| 欧美96一区二区免费视频| 亚洲国产成人tv| 亚洲综合视频在线观看| 亚洲欧美激情小说另类| 国产精品第一页第二页第三页| 精品sm捆绑视频| 欧美一区二区三区在线电影| 欧美丝袜丝交足nylons| 在线亚洲一区二区| 欧洲一区在线观看| 欧美午夜视频网站| 欧美天堂一区二区三区| 91久久香蕉国产日韩欧美9色| 北条麻妃国产九九精品视频| 国产99久久精品| 成人性生交大片免费看中文网站| 国产一区二三区好的| 韩国精品免费视频| 粉嫩在线一区二区三区视频| 国产成人综合视频| 成人a区在线观看| 99久久国产综合精品色伊 | 欧美剧情电影在线观看完整版免费励志电影 | 99精品国产视频| 国产99久久久精品| 国产v综合v亚洲欧| 99久久综合狠狠综合久久| 国产不卡在线播放| 91影视在线播放| 欧洲精品一区二区三区在线观看| 91农村精品一区二区在线| 欧美在线一区二区| 欧美一区二区成人| 国产日韩欧美精品一区| 国产精品久久久久三级| 亚洲激情图片qvod| 水蜜桃久久夜色精品一区的特点| 日本视频一区二区| 成人午夜av在线| 7777女厕盗摄久久久| 日韩一区二区中文字幕| 国产亚洲欧美一级| 亚洲成人免费视| 国产一区二区伦理| 在线精品视频一区二区三四 | 欧美r级电影在线观看| 国产婷婷色一区二区三区| 亚洲精品国产无天堂网2021 | 欧美亚洲国产bt| 日韩免费电影网站| 中文字幕一区不卡| 久久国产乱子精品免费女| gogogo免费视频观看亚洲一| 欧美久久久久免费| 久久久精品国产免费观看同学| 中文字幕一区二区三| 偷拍一区二区三区四区| 波多野结衣中文一区| 日韩三级av在线播放| 一区二区在线观看视频在线观看| 久久99精品久久久久| 欧美亚洲高清一区|