///////////////////////////////////////////////////////////////// const RF_SETTINGS rfSettings = { 0x00, 0x08, // FSCTRL1 Frequency synthesizer control. 0x00, // FSCTRL0 Frequency synthesizer control. 0x10, // FREQ2 Frequency control word, high byte. 0xA7, // FREQ1 Frequency control word, middle byte. 0x62, // FREQ0 Frequency control word, low byte. 0x5B, // MDMCFG4 Modem configuration. 0xF8, // MDMCFG3 Modem configuration. 0x03, // MDMCFG2 Modem configuration. 0x22, // MDMCFG1 Modem configuration. 0xF8, // MDMCFG0 Modem configuration. 0x00, // CHANNR Channel number. 0x47, // DEVIATN Modem deviation setting (when FSK modulation is enabled). 0xB6, // FREND1 Front end RX configuration. 0x10, // FREND0 Front end RX configuration. 0x18, // MCSM0 Main Radio Control State Machine configuration. 0x1D, // FOCCFG Frequency Offset Compensation Configuration. 0x1C, // BSCFG Bit synchronization Configuration. 0xC7, // AGCCTRL2 AGC control. 0x00, // AGCCTRL1 AGC control. 0xB2, // AGCCTRL0 AGC control. 0xEA, // FSCAL3 Frequency synthesizer calibration. 0x2A, // FSCAL2 Frequency synthesizer calibration. 0x00, // FSCAL1 Frequency synthesizer calibration. 0x11, // FSCAL0 Frequency synthesizer calibration. 0x59, // FSTEST Frequency synthesizer calibration. 0x81, // TEST2 Various test settings. 0x35, // TEST1 Various test settings. 0x09, // TEST0 Various test settings. 0x0B, // IOCFG2 GDO2 output pin configuration. 0x06, // IOCFG0D GDO0 output pin configuration. Refer to SmartRF?Studio User Manual for detailed pseudo register explanation. 0x06, // PKTCTRL1 Packet automation control.第3位置1:数据加载状态值和CRC。第1、2位分别为: /* 0 (00) 无地址检查 1 (01) 地址检查,无广播 2 (10) 地址检查,0(0x00)广播 3 (11) 地址检查,0(0x00)和255(0xFF)广播 */ 0x45, // PKTCTRL0 Packet automation control.第7位置1:开启数据白化。第3位置1:开启CRC校验。第1、2位分别为: /* 0(00) 固定长度数据包,在PKTLEN寄存器中配置长度 1(01) 可变长度数据包,通过同步词汇后的第一个位配置数据包长度 2(10) 启用无限长度数据包 3(11) 保留 */ 0x00, // ADDR Device address.---- 设备地址 0xFF // PKTLEN Packet length.当固定长度数据包启用时表明数据包的长度。若使用可变长度数据包,这个值表示允许的最大长度数据包。 };
源工程下载请点击。注:处理器STM32!