📄 mrfi_spi.h
字号:
/**************************************************************************************************
Revised: $Date: 2007-07-06 11:19:00 -0700 (Fri, 06 Jul 2007) $
Revision: $Revision: 13579 $
Copyright 2007 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights granted under
the terms of a software license agreement between the user who downloaded the software,
his/her employer (which must be your employer) and Texas Instruments Incorporated (the
"License"). You may not use this Software unless you agree to abide by the terms of the
License. The License limits your use, and you acknowledge, that the Software may not be
modified, copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio frequency
transceiver, which is integrated into your product. Other than for the foregoing purpose,
you may not use, reproduce, copy, prepare derivative works of, modify, distribute,
perform, display or sell this Software and/or its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY
WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE
THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY
INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST
DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY
THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
/* ~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
* MRFI (Minimal RF Interface)
* SPI interface code for Radio FamRadios: CC1100, CC1101, CC2500
* SPI interface code.
* ~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*/
#ifndef MRFI_SPI_H
#define MRFI_SPI_H
/* ------------------------------------------------------------------------------------------------
* Includes
* ------------------------------------------------------------------------------------------------
*/
//#include "bsp.h"
#include "App.h"
/* ------------------------------------------------------------------------------------------------
* Defines
* ------------------------------------------------------------------------------------------------
*/
/* configuration registers */
#define IOCFG2 0x00 /* IOCFG2 - GDO2 output pin configuration */
#define IOCFG1 0x01 /* IOCFG1 - GDO1 output pin configuration */
#define IOCFG0 0x02 /* IOCFG1 - GDO0 output pin configuration */
#define FIFOTHR 0x03 /* FIFOTHR - RX FIFO and TX FIFO thresholds */
#define SYNC1 0x04 /* SYNC1 - Sync word, high byte */
#define SYNC0 0x05 /* SYNC0 - Sync word, low byte */
#define PKTLEN 0x06 /* PKTLEN - Packet length */
#define PKTCTRL1 0x07 /* PKTCTRL1 - Packet automation control */
#define PKTCTRL0 0x08 /* PKTCTRL0 - Packet automation control */
#define ADDR 0x09 /* ADDR - Device address */
#define CHANNR 0x0A /* CHANNR - Channel number */
#define FSCTRL1 0x0B /* FSCTRL1 - Frequency synthesizer control */
#define FSCTRL0 0x0C /* FSCTRL0 - Frequency synthesizer control */
#define FREQ2 0x0D /* FREQ2 - Frequency control word, high byte */
#define FREQ1 0x0E /* FREQ1 - Frequency control word, middle byte */
#define FREQ0 0x0F /* FREQ0 - Frequency control word, low byte */
#define MDMCFG4 0x10 /* MDMCFG4 - Modem configuration */
#define MDMCFG3 0x11 /* MDMCFG3 - Modem configuration */
#define MDMCFG2 0x12 /* MDMCFG2 - Modem configuration */
#define MDMCFG1 0x13 /* MDMCFG1 - Modem configuration */
#define MDMCFG0 0x14 /* MDMCFG0 - Modem configuration */
#define DEVIATN 0x15 /* DEVIATN - Modem deviation setting */
#define MCSM2 0x16 /* MCSM2 - Main Radio Control State Machine configuration */
#define MCSM1 0x17 /* MCSM1 - Main Radio Control State Machine configuration */
#define MCSM0 0x18 /* MCSM0 - Main Radio Control State Machine configuration */
#define FOCCFG 0x19 /* FOCCFG - Frequency Offset Compensation configuration */
#define BSCFG 0x1A /* BSCFG - Bit Synchronization configuration */
#define AGCCTRL2 0x1B /* AGCCTRL2 - AGC control */
#define AGCCTRL1 0x1C /* AGCCTRL1 - AGC control */
#define AGCCTRL0 0x1D /* AGCCTRL0 - AGC control */
#define WOREVT1 0x1E /* WOREVT1 - High byte Event0 timeout */
#define WOREVT0 0x1F /* WOREVT0 - Low byte Event0 timeout */
#define WORCTRL 0x20 /* WORCTRL - Wake On Radio control */
#define FREND1 0x21 /* FREND1 - Front end RX configuration */
#define FREND0 0x22 /* FREDN0 - Front end TX configuration */
#define FSCAL3 0x23 /* FSCAL3 - Frequency synthesizer calibration */
#define FSCAL2 0x24 /* FSCAL2 - Frequency synthesizer calibration */
#define FSCAL1 0x25 /* FSCAL1 - Frequency synthesizer calibration */
#define FSCAL0 0x26 /* FSCAL0 - Frequency synthesizer calibration */
#define RCCTRL1 0x27 /* RCCTRL1 - RC oscillator configuration */
#define RCCTRL0 0x28 /* RCCTRL0 - RC oscillator configuration */
#define FSTEST 0x29 /* FSTEST - Frequency synthesizer calibration control */
#define PTEST 0x2A /* PTEST - Production test */
#define AGCTEST 0x2B /* AGCTEST - AGC test */
#define TEST2 0x2C /* TEST2 - Various test settings */
#define TEST1 0x2D /* TEST1 - Various test settings */
#define TEST0 0x2E /* TEST0 - Various test settings */
/* status registers */
#define PARTNUM 0x30 /* PARTNUM - Chip ID */
#define VERSION 0x31 /* VERSION - Chip ID */
#define FREQEST 0x32 /* FREQEST Frequency Offset Estimate from demodulator */
#define LQI 0x33 /* LQI Demodulator estimate for Link Quality */
#define RSSI 0x34 /* RSSI Received signal strength indication */
#define MARCSTATE 0x35 /* MARCSTATE Main Radio Control State Machine state */
#define WORTIME1 0x36 /* WORTIME1 High byte of WOR time */
#define WORTIME0 0x37 /* WORTIME0 Low byte of WOR time */
#define PKTSTATUS 0x38 /* PKTSTATUS Current GDOx status and packet status */
#define VCO_VC_DAC 0x39 /* VCO_VC_DAC Current setting from PLL calibration module */
#define TXBYTES 0x3A /* TXBYTES Underflow and number of bytes */
#define RXBYTES 0x3B /* RXBYTES Overflow and number of bytes */
/* burst write registers */
#define PA_TABLE0 0x3E /* PA_TABLE0 - PA control settings table */
#define TXFIFO 0x3F /* TXFIFO - Transmit FIFO */
#define RXFIFO 0x3F /* RXFIFO - Receive FIFO */
/* command strobe registers */
#define SRES 0x30 /* SRES - Reset chip. */
#define SFSTXON 0x31 /* SFSTXON - Enable and calibrate frequency synthesizer. */
#define SXOFF 0x32 /* SXOFF - Turn off crystal oscillator. */
#define SCAL 0x33 /* SCAL - Calibrate frequency synthesizer and turn it off. */
#define SRX 0x34 /* SRX - Enable RX. Perform calibration if enabled. */
#define STX 0x35 /* STX - Enable TX. If in RX state, only enable TX if CCA passes. */
#define SIDLE 0x36 /* SIDLE - Exit RX / TX, turn off frequency synthesizer. */
#define SRSVD 0x37 /* SRVSD - Reserved. Do not use. */
#define SWOR 0x38 /* SWOR - Start automatic RX polling sequence (Wake-on-Radio) */
#define SPWD 0x39 /* SPWD - Enter power down mode when CSn goes high. */
#define SFRX 0x3A /* SFRX - Flush the RX FIFO buffer. */
#define SFTX 0x3B /* SFTX - Flush the TX FIFO buffer. */
#define SWORRST 0x3C /* SWORRST - Reset real time clock. */
#define SNOP 0x3D /* SNOP - No operation. Returns status byte. */
/* ------------------------------------------------------------------------------------------------
* Prototypes
* ------------------------------------------------------------------------------------------------
*/
extern void mrfiSpiInit(void);
extern uint8_t mrfiSpiCmdStrobe(uint8_t addr);
extern uint8_t mrfiSpiReadReg(uint8_t addr);
extern void mrfiSpiWriteReg(uint8_t addr, uint8_t value);
extern void mrfiSpiWriteTxFifo(uint8_t * pWriteData, uint8_t len);
extern void mrfiSpiReadRxFifo(uint8_t * pReadData, uint8_t len);
/**************************************************************************************************
*/
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -