// 【名称】 halRfWriteRfSettings
// 【功能】 寄存器设置
// 【参数】 无
// 【返回】 无
// 【说明】 无
//
//*****************************************************************************
void halRfWriteRfSettings(void)
{
halSpiWriteReg(CCxxx0_FSCTRL0, rfSettings.FSCTRL2,1);
halSpiWriteReg(CCxxx0_FSCTRL1, rfSettings.FSCTRL1,1);
halSpiWriteReg(CCxxx0_FSCTRL0, rfSettings.FSCTRL0,1);
halSpiWriteReg(CCxxx0_FREQ2, rfSettings.FREQ2,1);
halSpiWriteReg(CCxxx0_FREQ1, rfSettings.FREQ1,1);
halSpiWriteReg(CCxxx0_FREQ0, rfSettings.FREQ0,1);
halSpiWriteReg(CCxxx0_MDMCFG4, rfSettings.MDMCFG4,1);
halSpiWriteReg(CCxxx0_MDMCFG3, rfSettings.MDMCFG3,1);
halSpiWriteReg(CCxxx0_MDMCFG2, rfSettings.MDMCFG2,1);
halSpiWriteReg(CCxxx0_MDMCFG1, rfSettings.MDMCFG1,1);
halSpiWriteReg(CCxxx0_MDMCFG0, rfSettings.MDMCFG0,1);
halSpiWriteReg(CCxxx0_CHANNR, rfSettings.CHANNR,1);
halSpiWriteReg(CCxxx0_DEVIATN, rfSettings.DEVIATN,1);
halSpiWriteReg(CCxxx0_FREND1, rfSettings.FREND1,1);
halSpiWriteReg(CCxxx0_FREND0, rfSettings.FREND0,1);
halSpiWriteReg(CCxxx0_MCSM0 , rfSettings.MCSM0,1);
halSpiWriteReg(CCxxx0_FOCCFG, rfSettings.FOCCFG,1);
halSpiWriteReg(CCxxx0_BSCFG, rfSettings.BSCFG,1);
halSpiWriteReg(CCxxx0_AGCCTRL2, rfSettings.AGCCTRL2,1);
halSpiWriteReg(CCxxx0_AGCCTRL1, rfSettings.AGCCTRL1,1);
halSpiWriteReg(CCxxx0_AGCCTRL0, rfSettings.AGCCTRL0,1);
halSpiWriteReg(CCxxx0_FSCAL3, rfSettings.FSCAL3,1);
halSpiWriteReg(CCxxx0_FSCAL2, rfSettings.FSCAL2,1);
halSpiWriteReg(CCxxx0_FSCAL1, rfSettings.FSCAL1,1);
halSpiWriteReg(CCxxx0_FSCAL0, rfSettings.FSCAL0,1);
halSpiWriteReg(CCxxx0_FSTEST, rfSettings.FSTEST,1);
halSpiWriteReg(CCxxx0_TEST2, rfSettings.TEST2,1);
halSpiWriteReg(CCxxx0_TEST1, rfSettings.TEST1,1);
halSpiWriteReg(CCxxx0_TEST0, rfSettings.TEST0,1);
halSpiWriteReg(CCxxx0_IOCFG2, rfSettings.IOCFG2,1);
halSpiWriteReg(CCxxx0_IOCFG0, rfSettings.IOCFG0,1);
halSpiWriteReg(CCxxx0_PKTCTRL1, rfSettings.PKTCTRL1,1);
halSpiWriteReg(CCxxx0_PKTCTRL0, rfSettings.PKTCTRL0,1);
halSpiWriteReg(CCxxx0_ADDR, rfSettings.ADDR,1);
halSpiWriteReg(CCxxx0_PKTLEN, rfSettings.PKTLEN,1);
halSpiWriteReg(CCxxx0_FSCTRL0, rfSettings.FSCTRL2,2);
halSpiWriteReg(CCxxx0_FSCTRL1, rfSettings.FSCTRL1,2);
halSpiWriteReg(CCxxx0_FSCTRL0, rfSettings.FSCTRL0,2);
halSpiWriteReg(CCxxx0_FREQ2, rfSettings.FREQ2,2);
halSpiWriteReg(CCxxx0_FREQ1, rfSettings.FREQ1,2);
halSpiWriteReg(CCxxx0_FREQ0, rfSettings.FREQ0,2);
halSpiWriteReg(CCxxx0_MDMCFG4, rfSettings.MDMCFG4,2);
halSpiWriteReg(CCxxx0_MDMCFG3, rfSettings.MDMCFG3,2);
halSpiWriteReg(CCxxx0_MDMCFG2, rfSettings.MDMCFG2,2);
halSpiWriteReg(CCxxx0_MDMCFG1, rfSettings.MDMCFG1,2);
halSpiWriteReg(CCxxx0_MDMCFG0, rfSettings.MDMCFG0,2);
halSpiWriteReg(CCxxx0_CHANNR, rfSettings.CHANNR,2);
halSpiWriteReg(CCxxx0_DEVIATN, rfSettings.DEVIATN,2);
halSpiWriteReg(CCxxx0_FREND1, rfSettings.FREND1,2);
halSpiWriteReg(CCxxx0_FREND0, rfSettings.FREND0,2);
halSpiWriteReg(CCxxx0_MCSM0 , rfSettings.MCSM0,2);
halSpiWriteReg(CCxxx0_FOCCFG, rfSettings.FOCCFG,2);
halSpiWriteReg(CCxxx0_BSCFG, rfSettings.BSCFG,2);
halSpiWriteReg(CCxxx0_AGCCTRL2, rfSettings.AGCCTRL2,2);
halSpiWriteReg(CCxxx0_AGCCTRL1, rfSettings.AGCCTRL1,2);
halSpiWriteReg(CCxxx0_AGCCTRL0, rfSettings.AGCCTRL0,2);
halSpiWriteReg(CCxxx0_FSCAL3, rfSettings.FSCAL3,2);
halSpiWriteReg(CCxxx0_FSCAL2, rfSettings.FSCAL2,2);
halSpiWriteReg(CCxxx0_FSCAL1, rfSettings.FSCAL1,2);
halSpiWriteReg(CCxxx0_FSCAL0, rfSettings.FSCAL0,2);
halSpiWriteReg(CCxxx0_FSTEST, rfSettings.FSTEST,2);
halSpiWriteReg(CCxxx0_TEST2, rfSettings.TEST2,2);
halSpiWriteReg(CCxxx0_TEST1, rfSettings.TEST1,2);
halSpiWriteReg(CCxxx0_TEST0, rfSettings.TEST0,2);
halSpiWriteReg(CCxxx0_IOCFG2, rfSettings.IOCFG2,2);
halSpiWriteReg(CCxxx0_IOCFG0, rfSettings.IOCFG0,2);
halSpiWriteReg(CCxxx0_PKTCTRL1, rfSettings.PKTCTRL1,2);
halSpiWriteReg(CCxxx0_PKTCTRL0, rfSettings.PKTCTRL0,2);
halSpiWriteReg(CCxxx0_ADDR, rfSettings.ADDR,2);
halSpiWriteReg(CCxxx0_PKTLEN, rfSettings.PKTLEN,2);
}
//*****************************************************************************
//
// 【名称】 halRfSendPacket
// 【功能】 一数据包发送函数
// 【参数】 *txBuffer:发送指针
// size:数据长度
// ch:模块通道
// 【返回】 无
// 【说明】 无
//
//*****************************************************************************
void halRfSendPacket(unsigned char *txBuffer, unsigned char size,unsigned char ch)
{
switch (ch)
{
case 1:
halSpiWriteReg(CCxxx0_TXFIFO, size,1);
halSpiWriteBurstReg(CCxxx0_TXFIFO, txBuffer, size,1);
halSpiStrobe(CCxxx0_STX,1);
while (!(P1IN&0x01));
while (P1IN&0x01);
halSpiStrobe(CCxxx0_SFTX,1);
break;
case 2:
halSpiWriteReg(CCxxx0_TXFIFO, size,2);
halSpiWriteBurstReg(CCxxx0_TXFIFO, txBuffer, size,2);
halSpiStrobe(CCxxx0_STX,2);
while (!(P3IN&0x01));
while (P3IN&0x01);
halSpiStrobe(CCxxx0_SFTX,2);
break;
}
}
//*****************************************************************************
// |