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

📄 modemhw.h

📁 msp430+无线芯片cc1020程序
💻 H
字号:
#include "CC1020.h"
#include "msp430x16x.h"

/* Pin usage definitions */

/* Transceiver pins */

/*
#define PDO         RC4
#define PDI         RC5
#define PCLK        RC3
#define PSEL        RC2
#define DIO         RC1
#define DCLK        RB0
#define CHP_OUT     RB2       //CC1000
*/

#define PDO         TI_CC_SPI_USART1_SOMI   //MISO CC1020 serial otput
#define PDI         TI_CC_SPI_USART1_SIMO   //MOSI CC1020 serial input
#define PCLK        TI_CC_SPI_USART1_UCLK   //CLK serial
#define PSEL        TI_CC_CSn_PIN           //CS pin !! Active high or low? !!
#define DIO         TI_CC_GDO0_PIN
#define DCLK        TI_CC_GDO2_PIN
//#define CHP_OUT     RB2   //CC1000

#define TI_CC_SPI_USART1_PxSEL  P5SEL
#define TI_CC_SPI_USART1_PxDIR  P5DIR

#define TI_CC_SPI_USART1_PxIN   P5IN
#define TI_CC_SPI_USART1_PxOUT  P5OUT
#define TI_CC_SPI_USART1_SIMO   0x02        //P5.1
#define TI_CC_SPI_USART1_SOMI   0x04        //P5.2
#define TI_CC_SPI_USART1_UCLK   0x08        //P5.3

#define TI_CC_CSn_PxOUT         P5OUT
#define TI_CC_CSn_PxDIR         P5DIR
#define TI_CC_CSn_PIN           0x01        //P5.0


#define TI_CC_GDO0_PxOUT        P2OUT
#define TI_CC_GDO0_PxIN         P2IN
#define TI_CC_GDO0_PxDIR        P2DIR
#define TI_CC_GDO0_PxIE         P2IE
#define TI_CC_GDO0_PxIES        P2IES
#define TI_CC_GDO0_PxIFG        P2IFG
#define TI_CC_GDO0_PIN          0x10


/* GDO2<-->SFD*/

/* I will need to activate also the interrupt ...*/

#define TI_CC_GDO2_PxOUT        P2OUT
#define TI_CC_GDO2_PxIN         P2IN
#define TI_CC_GDO2_PxDIR        P2DIR
#define TI_CC_GDO2_PxIE         P2IE
#define TI_CC_GDO2_PxIES        P2IES
#define TI_CC_GDO2_PxIFG        P2IFG
#define TI_CC_GDO2_PIN          0x40            //P2.6

#define TI_CC_CTS_PxOUT         P4OUT           //P4.0
#define TI_CC_CTS_PxDIR         P4DIR
#define TI_CC_CTS_PIN           0x01
#define TI_CC_CTS_PxSEL         P4SEL

#define TI_CC_TEST_PxOUT         P2OUT
#define TI_CC_TEST_PxDIR         P2DIR
#define TI_CC_TEST_PIN           0x04
#define TI_CC_TEST_PxSEL         P2SEL



/* PORT1 is used for the led and for the switch, not all have been implemented
   you can easily add them....                                               */

#define TI_CC_LED_PxOUT         P1OUT
#define TI_CC_LED_PxDIR         P1DIR
#define TI_CC_LED1              0x01            //P1.0
#define TI_CC_LED2              0x02            //P1.1
#define TI_CC_LED3              0x04            //P1.2
#define TI_CC_LED4              0x08            //P1.3

#define TI_CC_SW_PxIN           P1IN
#define TI_CC_SW_PxIE           P1IE
#define TI_CC_SW_PxIES          P1IES
#define TI_CC_SW_PxIFG          P1IFG
#define TI_CC_SW1               0x10            //P1.4
#define TI_CC_SW2               0x20            //P1.5
#define TI_CC_SW3               0x40            //P1.6
#define TI_CC_SW4               0x80            //P1.7

/* RF configuration */

// Time-out values
#define CAL_TIMEOUT    0x7FFE
#define LOCK_TIMEOUT   0x7FFE

// Maximum number of re-calibration attempts upon calibration failure
#define CAL_ATTEMPT_MAX   4

// LOCK status definitions
#define  LOCK_NOK         0x00
#define  LOCK_OK          0x01
#define  LOCK_RECAL_OK    0x02


// Macros for turning on and off the LEDs (for testing only)
#define FALSE 0
#define TRUE (!FALSE)

#define ON  TRUE
#define OFF FALSE

#define MIN(a, b)  ((a < b) ? a : b)
#define MAX(a, b)  ((a > b) ? a : b)

#define HEADER_SIZE     4       // 4 bytes header

#define TX_BUFFER_SIZE 64       // Size (in bytes) of transmit buffer
#define RX_BUFFER_SIZE 64       // Size (in bytes) of receive ring-buffer

#define PREAMBLE_LENGTH 4       // Number of bytes of preamble to send
#define PREAMBLE_REQ    4       // Number of bits required in addition to
                                // the initial 8 bits for the preamble to be
                                // accepted

#define PREAMBLE_BYTE           0xAA

#define VALID_PREAMBLE_BYTE_1   0x55
#define VALID_PREAMBLE_BYTE_2   0xAA




#define UI1 0xD3                // First byte of unique identifier
#define UI2 0x91                // Second byte of unique identifier

#define BUTTON1_CHAR  'Y'
#define BUTTON2_CHAR  'Z'

#define RFPACKET_EXTENSION  3   // Number of bits to send on RF after end-of-packet:
                                // maintain output power until last bit of RF-packet
                                // has definitely been transmitted on the air.

⌨️ 快捷键说明

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