123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- #ifndef _IFACE_CC2500_H_
- #define _IFACE_CC2500_H_
-
- #include <stdint.h>
-
- enum {
- CC2500_00_IOCFG2 = 0x00,
- CC2500_01_IOCFG1 = 0x01,
- CC2500_02_IOCFG0 = 0x02,
- CC2500_03_FIFOTHR = 0x03,
- CC2500_04_SYNC1 = 0x04,
- CC2500_05_SYNC0 = 0x05,
- CC2500_06_PKTLEN = 0x06,
- CC2500_07_PKTCTRL1 = 0x07,
- CC2500_08_PKTCTRL0 = 0x08,
- CC2500_09_ADDR = 0x09,
- CC2500_0A_CHANNR = 0x0A,
- CC2500_0B_FSCTRL1 = 0x0B,
- CC2500_0C_FSCTRL0 = 0x0C,
- CC2500_0D_FREQ2 = 0x0D,
- CC2500_0E_FREQ1 = 0x0E,
- CC2500_0F_FREQ0 = 0x0F,
- CC2500_10_MDMCFG4 = 0x10,
- CC2500_11_MDMCFG3 = 0x11,
- CC2500_12_MDMCFG2 = 0x12,
- CC2500_13_MDMCFG1 = 0x13,
- CC2500_14_MDMCFG0 = 0x14,
- CC2500_15_DEVIATN = 0x15,
- CC2500_16_MCSM2 = 0x16,
- CC2500_17_MCSM1 = 0x17,
- CC2500_18_MCSM0 = 0x18,
- CC2500_19_FOCCFG = 0x19,
- CC2500_1A_BSCFG = 0x1A,
- CC2500_1B_AGCCTRL2 = 0x1B,
- CC2500_1C_AGCCTRL1 = 0x1C,
- CC2500_1D_AGCCTRL0 = 0x1D,
- CC2500_1E_WOREVT1 = 0x1E,
- CC2500_1F_WOREVT0 = 0x1F,
- CC2500_20_WORCTRL = 0x20,
- CC2500_21_FREND1 = 0x21,
- CC2500_22_FREND0 = 0x22,
- CC2500_23_FSCAL3 = 0x23,
- CC2500_24_FSCAL2 = 0x24,
- CC2500_25_FSCAL1 = 0x25,
- CC2500_26_FSCAL0 = 0x26,
- CC2500_27_RCCTRL1 = 0x27,
- CC2500_28_RCCTRL0 = 0x28,
- CC2500_29_FSTEST = 0x29,
- CC2500_2A_PTEST = 0x2A,
- CC2500_2B_AGCTEST = 0x2B,
- CC2500_2C_TEST2 = 0x2C,
- CC2500_2D_TEST1 = 0x2D,
- CC2500_2E_TEST0 = 0x2E,
-
-
- CC2500_30_PARTNUM = 0x30,
- CC2500_31_VERSION = 0x31,
- CC2500_32_FREQEST = 0x32,
- CC2500_33_LQI = 0x33,
- CC2500_34_RSSI = 0x34,
- CC2500_35_MARCSTATE = 0x35,
- CC2500_36_WORTIME1 = 0x36,
- CC2500_37_WORTIME0 = 0x37,
- CC2500_38_PKTSTATUS = 0x38,
- CC2500_39_VCO_VC_DAC = 0x39,
- CC2500_3A_TXBYTES = 0x3A,
- CC2500_3B_RXBYTES = 0x3B,
-
-
- CC2500_3E_PATABLE = 0x3E,
- CC2500_3F_TXFIFO = 0x3F,
- CC2500_3F_RXFIFO = 0x3F,
- };
-
-
- #define CC2500_WRITE_SINGLE 0x00
- #define CC2500_WRITE_BURST 0x40
- #define CC2500_READ_SINGLE 0x80
- #define CC2500_READ_BURST 0xC0
-
-
- #define CC2500_SRES 0x30
- #define CC2500_SFSTXON 0x31
-
-
- #define CC2500_SXOFF 0x32
- #define CC2500_SCAL 0x33
-
- #define CC2500_SRX 0x34
-
- #define CC2500_STX 0x35
-
-
- #define CC2500_SIDLE 0x36
-
- #define CC2500_SAFC 0x37
- #define CC2500_SWOR 0x38
- #define CC2500_SPWD 0x39
- #define CC2500_SFRX 0x3A
- #define CC2500_SFTX 0x3B
- #define CC2500_SWORRST 0x3C
- #define CC2500_SNOP 0x3D
-
-
-
-
-
-
- #define CC2500_STATUS_CHIP_RDYn_BM 0x80
- #define CC2500_STATUS_STATE_BM 0x70
- #define CC2500_STATUS_FIFO_BYTES_AVAILABLE_BM 0x0F
-
-
- #define CC2500_STATE_IDLE 0x00
- #define CC2500_STATE_RX 0x10
- #define CC2500_STATE_TX 0x20
- #define CC2500_STATE_FSTXON 0x30
- #define CC2500_STATE_CALIBRATE 0x40
- #define CC2500_STATE_SETTLING 0x50
- #define CC2500_STATE_RX_OVERFLOW 0x60
- #define CC2500_STATE_TX_UNDERFLOW 0x70
-
-
-
-
- #define CC2500_LQI_CRC_OK_BM 0x80
- #define CC2500_LQI_EST_BM 0x7F
-
- void cc2500ReadRegisterMulti(uint8_t address, uint8_t data[], uint8_t length);
- void cc2500WriteRegisterMulti(uint8_t address, const uint8_t data[], uint8_t length);
-
- uint8_t cc2500ReadReg(uint8_t address);
- void cc2500WriteReg(uint8_t address, uint8_t data);
-
- void cc2500Strobe(uint8_t address);
- void cc2500ResetChip(void);
-
- inline void cc2500ReadFifo(uint8_t *dpbuffer, int len) {
- cc2500ReadRegisterMulti(CC2500_3F_RXFIFO | CC2500_READ_BURST, dpbuffer, len);
- }
-
- inline void cc2500WriteFifo(uint8_t *dpbuffer, uint8_t len) {
- cc2500Strobe(CC2500_SFTX);
- cc2500WriteRegisterMulti(CC2500_3F_TXFIFO, dpbuffer, len);
- cc2500Strobe(CC2500_STX);
- }
-
- #endif
|