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

📄 main.h

📁 chipcon公司的无线射频射频芯片cc1100应用的公共程序
💻 H
字号:
/*****************************************************************************
 *                                                                           *
 *        **********                                                         *
 *       ************                                                        *
 *      ***        ***                                                       *
 *      ***   +++   ***                                                      *
 *      ***   + +   ***                                                      *
 *      ***   +                CHIPCON CC1010 Wireless headset project       *
 *      ***   + +   ***                                                      *
 *      ***   +++   ***        Common headerfile for the main functions      *
 *      ***       ***            (common for both master and slave)          *
 *       ***********                                                         *
 *        *********                                                          *
 *                                                                           *
 *****************************************************************************
 * This source file is part of a software project for Full Duplex,           *
 * single-chip, wireless intercom, written for the CC1010 chip               *
 * (RF-transceiver chip with integrated 8051 micro-controller).              *
 *****************************************************************************
 * Author:              OAE                                                  *
 *****************************************************************************
 * Revision history:                                                         *
 *                                                                           *
 * $Log: Main.h,v $
 * Revision 1.1  2003/08/04 12:35:07  tos
 * Initial version in CVS.
 *
 *                                                                           *
 *                                                                           *
 ****************************************************************************/

#ifndef Main_h
#define Main_h// Only include this header file once

#include <chipcon/reg1010.h>
#include <chipcon/cc1010eb.h>
#include <chipcon/hal.h>
#include <string.h>

#define BUFFER0 0
#define BUFFER1 1

// Define the clock frequency
#define CLK_FREQ CC1010EB_CLKFREQ

// Define the packet size in bytes
#define PACKET_SIZE 256

// Define DES key
byte xdata DES_KEY[7] _at_ 0x0400;
byte xdata DES_KEY_TEMP[7] =
{
    0x03, 0x56, 0xA9, 0x7B, 0x2F, 0x5A, 0x0E
};

/**************************************************************************
*   RF RX/TX-pair settings extracted from Chipcon's SmartRF studio        *
**************************************************************************/

/******* Initial RXTX-pair settings *********
*   X-tal frequency: 14.745600 MHz          *
*   RF frequency A: 868.277200 MHz  Rx      *
*   RF frequency B: 868.277200 MHz  Tx      *
*   RX Mode: Low side LO                    *
*   Frequency separation: 64 kHz            *
*   Data rate: 76.8 kBaud                   *
*   Data Format: NRZ                        *
*   RF output power: 0 dBm                  *
*   IF/RSSI: Disabled                       *
*                                           *
*   Average filter is free running          *
********************************************/
RF_RXTXPAIR_SETTINGS code RF_SETTINGS_INIT =
{
    0xA0, 0x2F, 0x52,    // Modem 0, 1 and 2
    0x75, 0xA0, 0x00,    // Freq A
    0x58, 0x32, 0x8D,    // Freq B
    0x01, 0xAB,          // FSEP 1 and 0
    0x40,                // PLL_RX
    0x30,                // PLL_TX
    0x6C,                // CURRENT_RX
    0xF3,                // CURRENT_TX
    0x30,                // FREND
    0xA0,                // PA_POW
    0x00,                // MATCH
    0x00,                // PRESCALER
};

/******* Active RXTX-pair settings **********
*   X-tal frequency: 14.745600 MHz          *
*   RF frequency A: 868.277200 MHz  Rx      *
*   RF frequency B: 868.277200 MHz  Tx      *
*   RX Mode: Low side LO                    *
*   Frequency separation: 64 kHz            *
*   Data rate: 76.8 kBaud                   *
*   Data Format: NRZ                        *
*   RF output power: -2 dBm                 *
*   IF/RSSI: Disabled                       *
*                                           *
*   Average filter is locked                *
********************************************/
RF_RXTXPAIR_SETTINGS code RF_SETTINGS_ACTIVE =
{
    0xA0, 0x6F, 0x52,    // Modem 0, 1 and 2
    0x75, 0xA0, 0x00,    // Freq A
    0x58, 0x32, 0x8D,    // Freq B
    0x01, 0xAB,          // FSEP 1 and 0
    0x40,                // PLL_RX
    0x30,                // PLL_TX
    0x6C,                // CURRENT_RX
    0xF3,                // CURRENT_TX
    0x30,                // FREND
    0x70,                // PA_POW
    0x00,                // MATCH
    0x00,                // PRESCALER
};

/**************************************************************************
**************************************************************************/

// Calibration data
RF_RXTXPAIR_CALDATA xdata RF_CALDATA;

// Function prototypes
void ConfigureTimer01(byte options, ulong period, word clkFreq);
ulong ConfigureTimer23(byte options, ulong period, word clkFreq);
byte PacketDisassembler();
void PacketSend(byte numpreambles, byte xdata *bufferaddress,
    word packetsize, RF_RXTXPAIR_SETTINGS* RF_SETTINGS);
void PacketReceive(byte numpreamblebitsense, byte xdata *bufferaddress,
    word packetsize, RF_RXTXPAIR_SETTINGS* RF_SETTINGS);

#endif //Main_h

⌨️ 快捷键说明

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