IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 嵌入式 -> stm32+cc1101外部中断接收信息 -> 正文阅读

[嵌入式]stm32+cc1101外部中断接收信息

要把外部中断先关掉,在初始化之后再打开。在gpio.c里面注释掉:

上拉,下跳沿检测

    /*Configure GPIO pins : PB0 PB1 */
  GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1;
  GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
  GPIO_InitStruct.Pull = GPIO_PULLUP;
  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

/* EXTI interrupt init*/
  HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0);
  //HAL_NVIC_EnableIRQ(EXTI0_IRQn);

  HAL_NVIC_SetPriority(EXTI1_IRQn, 0, 0);
  //HAL_NVIC_EnableIRQ(EXTI1_IRQn);

接收端主函数:

	CC1101Reset(&hspi1);
	CC1101WORInit(&hspi1);
	CC1101Init(&hspi1);
	CC1101WriteCmd( CC1101_SRX ,&hspi1);
	
	HAL_NVIC_EnableIRQ(EXTI0_IRQn);
	HAL_NVIC_EnableIRQ(EXTI1_IRQn);

  while (1)
  {
	  if (rx[0] %2 ==  1)
	  {
		  HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET);
	  }
	  else {HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_SET);}
	  
  }

发送端主函数:

CC1101Reset(&hspi1);
CC1101WORInit(&hspi1);
CC1101Init(&hspi1);

  while (1)
  {
    /* USER CODE END WHILE */
	
    /* USER CODE BEGIN 3 */
	  HAL_Delay(1000);
	  tx[0] = tx[0]+1;
	  CC1101SendPacket(tx , sizeof(tx), BROADCAST, &hspi1);
	  if (flag==0){
			HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_SET);
			flag=1;
	  }
	  else {
		  HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET);
		  flag=0;
	  }

	  
  }

?cc1101.c:

#include "cc1101.h"
#include "spi.h"

uint8_t Rx_Flag;

static const uint8_t CC1101InitData[30][2]= 
{
/*  {CC1101_IOCFG0,      0x06},
  {CC1101_FIFOTHR,     0x47},
  {CC1101_PKTCTRL0,    0x05},
  {CC1101_CHANNR,      0x00},
  {CC1101_FSCTRL1,     0x08},
	{CC1101_FREQ2,       0x10},//433.92
  {CC1101_FREQ1,       0xB0},
  {CC1101_FREQ0,       0x3f},
//  {CC1101_FREQ2,       0x10},//433.862
//  {CC1101_FREQ1,       0xAf},
//  {CC1101_FREQ0,       0xdf},
  {CC1101_MDMCFG4,     0x5B},
  {CC1101_MDMCFG3,     0xF8},
  {CC1101_MDMCFG2,     0x03},
  {CC1101_DEVIATN,     0x47},
  {CC1101_MCSM0,       0x18},
  {CC1101_FOCCFG,      0x1D},
  {CC1101_WORCTRL,     0xFB},
  {CC1101_FSCAL3,      0xEA},
  {CC1101_FSCAL2,      0x2A},
  {CC1101_FSCAL1,      0x00},
  {CC1101_FSCAL0,      0x11},
  {CC1101_TEST2,       0x81},
  {CC1101_TEST1,       0x35},
  {CC1101_MCSM1,       0x3B},*/
	 //2-FSK
  {CC1101_MCSM1,       0x3c},
  {CC1101_IOCFG2,      0x06},
  {CC1101_IOCFG0,      0x06},
  {CC1101_FIFOTHR,     0x47},
  {CC1101_PKTCTRL0,    0x05},
  {CC1101_CHANNR,      0x01},
  {CC1101_FSCTRL1,     0x06},
  {CC1101_FREQ2,       0x10},   //433.92
  {CC1101_FREQ1,       0xB0},
  {CC1101_FREQ0,       0x3f},
  {CC1101_MDMCFG4,     0xF6},
  {CC1101_MDMCFG3,     0x43},		//2.00224kBaud  58.035714khz
  {CC1101_MDMCFG2,     0x03},
  {CC1101_MDMCFG1,     0x20},
  {CC1101_MDMCFG0,     0x00},	
  {CC1101_DEVIATN,     0x15},   //0x15:5.157471khz 0x34:19khz, 0x77:380.85khz,0x64:152khz,0x71:228.5khz
  {CC1101_MCSM0,       0x18},
  {CC1101_FOCCFG,      0x16},
  {CC1101_WORCTRL,     0xFB},
  {CC1101_FSCAL3,      0xE9},
  {CC1101_FSCAL2,      0x2A},
  {CC1101_FSCAL1,      0x00},
  {CC1101_FSCAL0,      0x1F},
  {CC1101_TEST2,       0x81},
  {CC1101_TEST1,       0x35},
  {CC1101_TEST0,       0x09},	
};

uint8_t PaTabel[] = { 0xc0, 0xC8, 0x84, 0x60, 0x68, 0x34, 0x1D, 0x0E};//433M?table
//uint8_t PaTabel[] = { 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

/*read a byte from the specified register*/
uint8_t CC1101ReadStatus( uint8_t addr , SPI_HandleTypeDef *hspi);

/*Read some bytes from the rigisters continously*/
void CC1101ReadMultiReg( uint8_t addr, uint8_t *buff, uint8_t size , SPI_HandleTypeDef *hspi);

/*Write a byte to the specified register*/
void CC1101WriteReg( uint8_t addr, uint8_t value , SPI_HandleTypeDef *hspi);

/*Flush the TX buffer of CC1101*/
void CC1101ClrTXBuff( SPI_HandleTypeDef *hspi );

/*Flush the RX buffer of CC1101*/
void CC1101ClrRXBuff( SPI_HandleTypeDef *hspi );

/*Get received count of CC1101*/
uint8_t CC1101GetRXCnt( SPI_HandleTypeDef *hspi );

/*Reset the CC1101 device*/
void CC1101Reset( SPI_HandleTypeDef *hspi );

/*Write some bytes to the specified register*/
void CC1101WriteMultiReg( uint8_t addr, uint8_t *buff, uint8_t size , SPI_HandleTypeDef *hspi);

void CC1101WriteCmd( uint8_t command , SPI_HandleTypeDef *hspi);


/*
================================================================================
Function : CC1101WORInit( )
    Initialize the WOR function of CC1101
INPUT    : None
OUTPUT   : None
================================================================================
*/
void  CC1101WORInit(SPI_HandleTypeDef *hspi )
{

    CC1101WriteReg(CC1101_MCSM0,0x18,hspi);
    CC1101WriteReg(CC1101_WORCTRL,0x78,hspi); //Wake On Radio Control
    CC1101WriteReg(CC1101_MCSM2,0x00,hspi);
    CC1101WriteReg(CC1101_WOREVT1,0x8C,hspi);
    CC1101WriteReg(CC1101_WOREVT0,0xA0,hspi);
	
	CC1101WriteCmd( CC1101_SWORRST ,hspi);
}
/*
================================================================================
Function : CC1101ReadReg( )
    read a byte from the specified register
INPUT    : addr, The address of the register
OUTPUT   : the byte read from the rigister
================================================================================
*/
uint8_t CC1101ReadReg( uint8_t addr , SPI_HandleTypeDef *hspi)
{
	uint8_t input[1];
	uint8_t output[1];

	output[0] = addr | READ_SINGLE; //?á??′??÷?üá?
	CSN_reset;
	while (MISO);
	HAL_SPI_TransmitReceive(hspi, output, input, 1, 2000);
	HAL_SPI_Receive(hspi, input, 1, 2000);
	CSN_set;
	return input[0];
}
/*
================================================================================
Function : CC1101ReadMultiReg( )
    Read some bytes from the rigisters continously
INPUT    : addr, The address of the register
           buff, The buffer stores the data
           size, How many bytes should be read
OUTPUT   : None
================================================================================
*/
void CC1101ReadMultiReg( uint8_t addr, uint8_t *buff, uint8_t size , SPI_HandleTypeDef *hspi)
{
    uint8_t i, j;
	uint8_t input[1];
	uint8_t output[1];
    
	output[0] = addr | READ_BURST; //D′è?òa?áμ???????′??÷μ??·oí?á?üá?
	CSN_reset; //CSN = 0;
	while (MISO);
    HAL_SPI_TransmitReceive(hspi, output, input, 1, 2000);
    for( i = 0; i < size; i ++ )
    {
		output[0] = buff[i];
        HAL_SPI_TransmitReceive(hspi, output, input, 1, 2000);
        buff[i] = input[0];
    }
    CSN_set;//CSN = 1;
}
/*
================================================================================
Function : CC1101ReadStatus( )
    Read a status register
INPUT    : addr, The address of the register
OUTPUT   : the value read from the status register
================================================================================
*/
uint8_t CC1101ReadStatus( uint8_t addr , SPI_HandleTypeDef *hspi)
{
	uint8_t input[1];
	uint8_t output[1];

	output[0] = addr | READ_BURST; //D′è?òa?áμ?×′ì???′??÷μ?μ??·í?ê±D′è??á?üá?
	CSN_reset;
	while (MISO);
	HAL_SPI_TransmitReceive(hspi, output, input, 1, 2000);
	HAL_SPI_Receive(hspi, input, 1, 2000);
	CSN_set;
	return input[0];
}
/*
================================================================================
Function : CC1101SetTRMode( )
    Set the device as TX mode or RX mode
INPUT    : mode selection
OUTPUT   : None
================================================================================
*/
void CC1101SetTRMode( TRMODE mode , SPI_HandleTypeDef *hspi)
{
    if( mode == TX_MODE )
    {
        CC1101WriteReg(CC1101_IOCFG0,0x46,hspi);
        CC1101WriteCmd( CC1101_STX ,hspi);
    }
    else if( mode == RX_MODE )
    {
        CC1101WriteReg(CC1101_IOCFG0,0x46,hspi);
        CC1101WriteCmd( CC1101_SRX ,hspi);
    }
}
/*
================================================================================
Function : CC1101WriteReg( )
    Write a byte to the specified register
INPUT    : addr, The address of the register
           value, the byte you want to write
OUTPUT   : None
================================================================================
*/
void CC1101WriteReg( uint8_t addr, uint8_t value , SPI_HandleTypeDef *hspi)
{
	uint8_t input[1];
	uint8_t output[1];

	CSN_reset;
	while (MISO);
	output[0] = addr;
	HAL_SPI_TransmitReceive(hspi, output, input, 1, 2000); //D′μ??·
	output[0] = value;
	HAL_SPI_TransmitReceive(hspi, output, input, 1, 2000); //D′è?????
	CSN_set;
}
/*
================================================================================
Function : CC1101WriteMultiReg( )
    Write some bytes to the specified register
INPUT    : addr, The address of the register
           buff, a buffer stores the values
           size, How many byte should be written
OUTPUT   : None
================================================================================
*/
void CC1101WriteMultiReg( uint8_t addr, uint8_t *buff, uint8_t size , SPI_HandleTypeDef *hspi)
{
    uint8_t i, output[1], input[1];
	output[0] = addr | WRITE_BURST;
    CSN_reset; //CSN = 0;
	while (MISO);
    HAL_SPI_TransmitReceive(hspi, output, input, 1, 2000);
    for( i = 0; i < size; i ++ )
    {
        output[0] = buff[i];
		HAL_SPI_TransmitReceive(hspi, output, input, 1, 2000);
    }
    CSN_set;//CSN = 1;
}
/*
================================================================================
Function : CC1101WriteCmd( )
    Write a command byte to the device
INPUT    : command, the byte you want to write
OUTPUT   : None
================================================================================
*/
void CC1101WriteCmd( uint8_t command , SPI_HandleTypeDef *hspi)
{
	uint8_t input[1];
	uint8_t output[1];
	
    CSN_reset; //CSN = 0;
    while (MISO);
	output[0] = command;
	HAL_SPI_TransmitReceive(hspi, output, input, 1, 2000); D′è??üá?
    CSN_set;//CSN = 1;
}
/*
================================================================================
Function : CC1101Reset( )
    Reset the CC1101 device
INPUT    : None
OUTPUT   : None
================================================================================
*/
void CC1101Reset( SPI_HandleTypeDef *hspi )
{
    uint8_t x;

    CSN_set;//CSN = 1;
    CSN_reset; //CSN = 0;
    CSN_set;//CSN = 1;
    for( x = 0; x < 100; x ++ );
    CC1101WriteCmd( CC1101_SRES ,hspi);
}
/*
================================================================================
Function : CC1101SetIdle( )
    Set the CC1101 into IDLE mode
INPUT    : None
OUTPUT   : None
================================================================================
*/
void CC1101SetIdle( SPI_HandleTypeDef *hspi )
{
    CC1101WriteCmd(CC1101_SIDLE,hspi);
}
/*
================================================================================
Function : CC1101ClrTXBuff( )
    Flush the TX buffer of CC1101
INPUT    : None
OUTPUT   : None
================================================================================
*/
void CC1101ClrTXBuff( SPI_HandleTypeDef *hspi )
{
    CC1101SetIdle(hspi);//MUST BE IDLE MODE
    CC1101WriteCmd( CC1101_SFTX ,hspi);
}
/*
================================================================================
Function : CC1101ClrRXBuff( )
    Flush the RX buffer of CC1101
INPUT    : None
OUTPUT   : None
================================================================================
*/
void CC1101ClrRXBuff( SPI_HandleTypeDef *hspi )
{
    CC1101SetIdle(hspi);//MUST BE IDLE MODE
    CC1101WriteCmd( CC1101_SFRX ,hspi);
}
/*
================================================================================
Function : CC1101SendPacket( )
    Send a packet
INPUT    : txbuffer, The buffer stores data to be sent
           size, How many bytes should be sent
           mode, Broadcast or address check packet
OUTPUT   : None
================================================================================
*/
void CC1101SendPacket( uint8_t *txbuffer, uint8_t size, TX_DATA_MODE mode ,SPI_HandleTypeDef *hspi)
{
    uint8_t address;
    if( mode == BROADCAST )             { address = 0; }
    else if( mode == ADDRESS_CHECK )    { address = CC1101ReadReg( CC1101_ADDR ,hspi); }

    CC1101ClrTXBuff( hspi);
    
    if( ( CC1101ReadReg( CC1101_PKTCTRL1 ,hspi) & ~0x03 ) != 0 )
    {
        CC1101WriteReg( CC1101_TXFIFO, size + 1 ,hspi);
        CC1101WriteReg( CC1101_TXFIFO, address ,hspi);
    }
    else
    {
        CC1101WriteReg( CC1101_TXFIFO, size ,hspi);
    }

    CC1101WriteMultiReg( CC1101_TXFIFO, txbuffer, size ,hspi);
    CC1101SetTRMode( TX_MODE ,hspi);
    while( GDO0 != 0 );
    while( GDO0 == 0 );

    CC1101ClrTXBuff( hspi);
}
/*
================================================================================
Function : CC1101GetRXCnt( )
    Get received count of CC1101
INPUT    : None
OUTPUT   : How many bytes hae been received
================================================================================
*/
uint8_t CC1101GetRXCnt( SPI_HandleTypeDef *hspi )
{
    return ( CC1101ReadStatus( CC1101_RXBYTES ,hspi)  & BYTES_IN_RXFIFO );
}
/*
================================================================================
Function : CC1101SetAddress( )
    Set the address and address mode of the CC1101
INPUT    : address, The address byte
           AddressMode, the address check mode
OUTPUT   : None
================================================================================
*/
void CC1101SetAddress( uint8_t address, ADDR_MODE AddressMode,SPI_HandleTypeDef *hspi)
{
    uint8_t btmp = CC1101ReadReg( CC1101_PKTCTRL1 ,hspi) & ~0x03;
    CC1101WriteReg(CC1101_ADDR, address,hspi);
    if     ( AddressMode == BROAD_ALL )     {}
    else if( AddressMode == BROAD_NO  )     { btmp |= 0x01; }
    else if( AddressMode == BROAD_0   )     { btmp |= 0x02; }
    else if( AddressMode == BROAD_0AND255 ) { btmp |= 0x03; }   
}
/*
================================================================================
Function : CC1101SetSYNC( )
    Set the SYNC bytes of the CC1101
INPUT    : sync, 16bit sync 
OUTPUT   : None
================================================================================
*/
void CC1101SetSYNC( uint16_t sync ,SPI_HandleTypeDef *hspi)
{
    CC1101WriteReg(CC1101_SYNC1, 0xFF & ( sync>>8 ) ,hspi);
    CC1101WriteReg(CC1101_SYNC0, 0xFF & sync ,hspi); 
}
/*
================================================================================
Function : CC1101RecPacket( )
    Receive a packet
INPUT    : rxBuffer, A buffer store the received data
OUTPUT   : 1:received count, 0:no data
================================================================================
*/
uint8_t CC1101RecPacket( uint8_t *rxBuffer ,SPI_HandleTypeDef *hspi)
{
    uint8_t status[2];
    uint8_t pktLen;
    uint16_t x;

    if ( CC1101GetRXCnt( hspi) != 0 )
    {
        pktLen = CC1101ReadReg(CC1101_RXFIFO,hspi);           // Read length byte
        if( ( CC1101ReadReg( CC1101_PKTCTRL1 ,hspi) & ~0x03 ) != 0 )
        {
            x = CC1101ReadReg(CC1101_RXFIFO,hspi);
        }
        if( pktLen == 0 )           { return 0; }
        else                        { pktLen --; }
        CC1101ReadMultiReg(CC1101_RXFIFO, rxBuffer, pktLen,hspi); // Pull data
        CC1101ReadMultiReg(CC1101_RXFIFO, status, 2,hspi);   // Read  status bytes

        CC1101ClrRXBuff(hspi );

        if( status[1] & CRC_OK ) {   return pktLen; }
        else                     {   return 0; }
		
		
    }
    else   {  return 0; }                               // Error
}
/*
================================================================================
Function : CC1101Init( )
    Initialize the CC1101, User can modify it
INPUT    : None
OUTPUT   : None
================================================================================
*/
void CC1101Init( SPI_HandleTypeDef *hspi )
{
    volatile uint8_t i, j;

    CC1101Reset(hspi );    
    
    for( i = 0; i < 24; i++ )
    {
        CC1101WriteReg( CC1101InitData[i][0], CC1101InitData[i][1] ,hspi);
    }
    CC1101SetAddress( 0x05, BROAD_0AND255 ,hspi);
    CC1101SetSYNC( 0x8799 ,hspi);
    CC1101WriteReg(CC1101_MDMCFG1,   0x72,hspi); //Modem Configuration

    CC1101WriteMultiReg(CC1101_PATABLE, PaTabel, 8 ,hspi);
		//CC1101WriteReg(CC1101_FREND0,0x40);
    i = CC1101ReadStatus( CC1101_PARTNUM ,hspi);//for test, must be 0x80
    i = CC1101ReadStatus( CC1101_VERSION ,hspi);//for test, refer to the datasheet
		CC1101WriteReg(CC1101_TEST1,0xaa,hspi);
		i=CC1101ReadStatus(CC1101_TEST1,hspi);

    i=0;
}


cc1101.h:

#ifndef __CC1101_H
#define __CC1101_H
#include "main.h"
#include "gpio.h"
//#include "delay.h"


/* define  ********************************************************************/
//#define   CSN   PAout(4) 
#define   CSN_set    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_SET)	  // D???????	Serial configuration interface, chip
#define   CSN_reset    HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET)	  // D???????	Serial configuration interface, chip select (MCU output)	 
#define   GDO0   HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_1)	  // cc1101μ?í¨ó?ê?3? Digital output pin for general use          (MCU input)
#define   MISO   HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_6)	    // cc1101μ?êy?Yê?3? Serial configuration interface,data output  (MCU input)
typedef enum {false,true}bool;
/*   **********************************************************************/
typedef enum { TX_MODE, RX_MODE }TRMODE;
typedef enum { BROAD_ALL, BROAD_NO, BROAD_0, BROAD_0AND255 }ADDR_MODE;
typedef enum { BROADCAST, ADDRESS_CHECK} TX_DATA_MODE;

extern uint8_t Rx_Flag;

/* ??  **********************************************************************/

/*read a byte from the specified register*/
uint8_t CC1101ReadReg( uint8_t addr , SPI_HandleTypeDef *hspi);

/*Read a status register*/
uint8_t CC1101ReadStatus( uint8_t addr , SPI_HandleTypeDef *hspi);

/*Set the device as TX mode or RX mode*/
void CC1101SetTRMode( TRMODE mode , SPI_HandleTypeDef *hspi);

/*Write a command byte to the device*/
void CC1101WriteCmd( uint8_t command , SPI_HandleTypeDef *hspi);

/*Set the CC1101 into IDLE mode*/
void CC1101SetIdle( SPI_HandleTypeDef *hspi );

/*Send a packet*/
void CC1101SendPacket( uint8_t *txbuffer, uint8_t size, TX_DATA_MODE mode ,SPI_HandleTypeDef *hspi);

/*Set the address and address mode of the CC1101*/
void CC1101SetAddress( uint8_t address, ADDR_MODE AddressMode,SPI_HandleTypeDef *hspi);

/*Set the SYNC bytes of the CC1101*/
void CC1101SetSYNC( uint16_t sync ,SPI_HandleTypeDef *hspi);

/*Receive a packet*/
uint8_t CC1101RecPacket( uint8_t *rxBuffer ,SPI_HandleTypeDef *hspi);

/*Initialize the WOR function of CC1101*/
void  CC1101WORInit(SPI_HandleTypeDef *hspi );

/*Initialize the CC1101, User can modify it*/
void CC1101Init( SPI_HandleTypeDef *hspi );

void CC1101Reset( SPI_HandleTypeDef *hspi );

//*****************************************************************************************
// CC1100 STROBE, CONTROL AND STATUS REGSITER
#define CC1101_IOCFG2       0x00        // GDO2 output pin configuration
#define CC1101_IOCFG1       0x01        // GDO1 output pin configuration
#define CC1101_IOCFG0       0x02        // GDO0 output pin configuration
#define CC1101_FIFOTHR      0x03        // RX FIFO and TX FIFO thresholds
#define CC1101_SYNC1        0x04        // Sync word, high u8
#define CC1101_SYNC0        0x05        // Sync word, low u8
#define CC1101_PKTLEN       0x06        // Packet length
#define CC1101_PKTCTRL1     0x07        // Packet automation control
#define CC1101_PKTCTRL0     0x08        // Packet automation control
#define CC1101_ADDR         0x09        // Device address
#define CC1101_CHANNR       0x0A        // Channel number
#define CC1101_FSCTRL1      0x0B        // Frequency synthesizer control
#define CC1101_FSCTRL0      0x0C        // Frequency synthesizer control
#define CC1101_FREQ2        0x0D        // Frequency control word, high u8
#define CC1101_FREQ1        0x0E        // Frequency control word, middle u8
#define CC1101_FREQ0        0x0F        // Frequency control word, low u8
#define CC1101_MDMCFG4      0x10        // Modem configuration
#define CC1101_MDMCFG3      0x11        // Modem configuration
#define CC1101_MDMCFG2      0x12        // Modem configuration
#define CC1101_MDMCFG1      0x13        // Modem configuration
#define CC1101_MDMCFG0      0x14        // Modem configuration
#define CC1101_DEVIATN      0x15        // Modem deviation setting
#define CC1101_MCSM2        0x16        // Main Radio Control State Machine configuration
#define CC1101_MCSM1        0x17        // Main Radio Control State Machine configuration
#define CC1101_MCSM0        0x18        // Main Radio Control State Machine configuration
#define CC1101_FOCCFG       0x19        // Frequency Offset Compensation configuration
#define CC1101_BSCFG        0x1A        // Bit Synchronization configuration
#define CC1101_AGCCTRL2     0x1B        // AGC control
#define CC1101_AGCCTRL1     0x1C        // AGC control
#define CC1101_AGCCTRL0     0x1D        // AGC control
#define CC1101_WOREVT1      0x1E        // High u8 Event 0 timeout
#define CC1101_WOREVT0      0x1F        // Low u8 Event 0 timeout
#define CC1101_WORCTRL      0x20        // Wake On Radio control
#define CC1101_FREND1       0x21        // Front end RX configuration
#define CC1101_FREND0       0x22        // Front end TX configuration
#define CC1101_FSCAL3       0x23        // Frequency synthesizer calibration
#define CC1101_FSCAL2       0x24        // Frequency synthesizer calibration
#define CC1101_FSCAL1       0x25        // Frequency synthesizer calibration
#define CC1101_FSCAL0       0x26        // Frequency synthesizer calibration
#define CC1101_RCCTRL1      0x27        // RC oscillator configuration
#define CC1101_RCCTRL0      0x28        // RC oscillator configuration
#define CC1101_FSTEST       0x29        // Frequency synthesizer calibration control
#define CC1101_PTEST        0x2A        // Production test
#define CC1101_AGCTEST      0x2B        // AGC test
#define CC1101_TEST2        0x2C        // Various test settings
#define CC1101_TEST1        0x2D        // Various test settings
#define CC1101_TEST0        0x2E        // Various test settings

// Strobe commands
#define CC1101_SRES         0x30        // Reset chip.
#define CC1101_SFSTXON      0x31        // Enable and calibrate frequency synthesizer (if MCSM0.FS_AUTOCAL=1).
                                        // If in RX/TX: Go to a wait state where only the synthesizer is
                                        // running (for quick RX / TX turnaround).
#define CC1101_SXOFF        0x32        // Turn off crystal oscillator.
#define CC1101_SCAL         0x33        // Calibrate frequency synthesizer and turn it off
                                        // (enables quick start).
#define CC1101_SRX          0x34        // Enable RX. Perform calibration first if coming from IDLE and
                                        // MCSM0.FS_AUTOCAL=1.
#define CC1101_STX          0x35        // In IDLE state: Enable TX. Perform calibration first if
                                        // MCSM0.FS_AUTOCAL=1. If in RX state and CCA is enabled:
                                        // Only go to TX if channel is clear.
#define CC1101_SIDLE        0x36        // Exit RX / TX, turn off frequency synthesizer and exit
                                        // Wake-On-Radio mode if applicable.
#define CC1101_SAFC         0x37        // Perform AFC adjustment of the frequency synthesizer
#define CC1101_SWOR         0x38        // Start automatic RX polling sequence (Wake-on-Radio)
#define CC1101_SPWD         0x39        // Enter power down mode when CSn goes high.
#define CC1101_SFRX         0x3A        // Flush the RX FIFO buffer.
#define CC1101_SFTX         0x3B        // Flush the TX FIFO buffer.
#define CC1101_SWORRST      0x3C        // Reset real time clock.
#define CC1101_SNOP         0x3D        // No operation. May be used to pad strobe commands to two
                                        // u8s for simpler software.

#define CC1101_PARTNUM      0x30
#define CC1101_VERSION      0x31
#define CC1101_FREQEST      0x32
#define CC1101_LQI          0x33
#define CC1101_RSSI         0x34
#define CC1101_MARCSTATE    0x35
#define CC1101_WORTIME1     0x36
#define CC1101_WORTIME0     0x37
#define CC1101_PKTSTATUS    0x38
#define CC1101_VCO_VC_DAC   0x39
#define CC1101_TXBYTES      0x3A
#define CC1101_RXBYTES      0x3B

#define CC1101_PATABLE      0x3E
#define CC1101_TXFIFO       0x3F
#define CC1101_RXFIFO       0x3F

#define WRITE_BURST     	0x40						//????
#define READ_SINGLE     	0x80						//?
#define READ_BURST      	0xC0						//???
#define BYTES_IN_RXFIFO     0x7F  						//???????????
#define CRC_OK              0x80 						//CRC???????



#endif	 


参考文档:

stm32f103c8 使用cc1101模块_fghjhuangdavid的博客-CSDN博客icon-default.png?t=LA46https://blog.csdn.net/fghjhuangdavid/article/details/102461437

  嵌入式 最新文章
基于高精度单片机开发红外测温仪方案
89C51单片机与DAC0832
基于51单片机宠物自动投料喂食器控制系统仿
《痞子衡嵌入式半月刊》 第 68 期
多思计组实验实验七 简单模型机实验
CSC7720
启明智显分享| ESP32学习笔记参考--PWM(脉冲
STM32初探
STM32 总结
【STM32】CubeMX例程四---定时器中断(附工
上一篇文章      下一篇文章      查看所有文章
加:2021-11-09 19:43:26  更:2021-11-09 19:44:22 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/26 9:51:09-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码