资源简介
HS6200 ---- 基于RF2.4G无线通信 ------ 通信接口 SPI
代码片段和文件信息
#include “HS6200.h“
#include “qk_gpio.h“
#include “qk_xsl_task.h“
SPI_PORT_EN_T SPI_PORT;
#define GPIO_CLK 12
#define GPIO_CSN 3
#define GPIO_DI 4
#define GPIO_DO 5
#define HS6200_CSN_HIGH tls_gpio_write(GPIO_CSN IO_H)
#define HS6200_CSN_LOW tls_gpio_write(GPIO_CSN IO_L)
#define HS6200_CLK_HIGH tls_gpio_write(GPIO_CLK IO_H)
#define HS6200_CLK_LOW tls_gpio_write(GPIO_CLK IO_L)
#define HS6200_SOMI_HIGH tls_gpio_write(GPIO_DO IO_H)
#define HS6200_SOMI_LOW tls_gpio_write(GPIO_DO IO_L)
#define HS6200_DI_READ tls_gpio_read(GPIO_DI)
/*Calibration config infor*/
unsigned char HS6200_Calibration_Data[] =
{
/* Register Addr DataLenth Data*/
HS6200_BANK0_CONFIG 1 0x03
HS6200_BANK0_RF_CH 1 0x32
HS6200_BANK0_RF_SETUP 1 0x40
0xFF /*Addr=0xFFcomplete flag*/
};
unsigned char HS6200_Calibration_Analog[] =
{
/*Register Addr DataLenth Data*/
HS6200_BANK1_PLL_CTL0 4 0x400x010x100xE5
HS6200_BANK1_CAL_CTL 5 0x200x080x500x400x50
HS6200_BANK1_IF_FREQ 3 0x000x000x1F
HS6200_BANK1_FDEV 1 0x20
HS6200_BANK1_DAC_CAL_HI 1 0x7F
HS6200_BANK1_RF_IVGEN 4 0x1F0x640x000x81
0xFF /*Addr=0xFFcomplete flag*/
};
/*config infor*/
unsigned char HS6200_Analog_Data[]=
{
/*Register Addr DataLenth Data*/
HS6200_BANK1_PLL_CTL0 4 0x400x010x300xE1
HS6200_BANK1_PLL_CTL1 4 0x000x420x100x01
HS6200_BANK1_CAL_CTL 5 0x290x890x750x280x50
HS6200_BANK1_RX_CTRL 4 0x520xC20x090xAC
HS6200_BANK1_FAGC_CTRL_1 4 0x800x140x080x29
HS6200_BANK1_RF_IVGEN 4 0x1F0x640x000x01
0xFF /*Addr=0xFFcomplete flag*/
};
unsigned char HS6200_Init_Data[]=
{
/*Register Addr DataLenth Data*/
HS6200_BANK0_CONFIG 1 0x0e
HS6200_BANK0_RX_PW_P0 1 0x0A
HS6200_BANK0_DYNPD 1 0x3F
HS6200_BANK0_FEATURE 1 0x07
HS6200_BANK0_SETUP_VALUE 5 0x400x5A0x800x060x00
HS6200_BANK0_PRE_GURD 1 0x77
HS6200_BANK0_EN_AA 1 0x00
//HS6200_BANK0_EN_AA 1 0x00
HS6200_BANK0_EN_RXADDR 1 0x3F
HS6200_BANK0_SETUP_AW 1 0x03
HS6200_BANK0_SETUP_RETR 1 0x0F
//HS6200_BANK0_RF_CH 1 0x50
HS6200_BANK0_RF_CH 1 0x4D
HS6200_BANK0_RF_SETUP 1 0x47
HS6200_BANK0_RX_ADDR_P0 5 0x550x6E0x540x9C0xF6
HS6200_BANK0_TX_ADDR 5 0x550x6E0x540x9C0xF6
0xFF /*Addr=0xFFcomplete flag*/
};
/*SPI driver*/
unsigned char HS6200_spi_wrd(unsigned char Data)
{
unsigned char rxdi;
for(i=0;i<16;i++){
if(i%2)
{
if(HS6200_DI_READ) rxd |= 0x01; else rxd &= 0xFE;
HS6200_CLK_LOW;
}
else
{
if(Data & 0x80) HS6200_SOMI_HIGH; else HS6200_SOMI_LOW;
rxd <<= 1;
Data <<= 1;
HS6200_CLK_HIGH;
}
}
return rxd;
}
/*Write One Register*/
void HS6200_write_byte(unsigned char addrunsigned char D)
{
HS6200_CSN_LOW;
HS62
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 8076 2017-03-16 16:19 HS6200.h
文件 12867 2017-04-07 16:58 HS6200.c
- 上一篇:OpenGL仿微信视频聊天
- 下一篇:jli
nkV9自动升级固件与详细刷固件教程
评论
共有 条评论