初级会员

- 积分
- 76
- 金钱
- 76
- 注册时间
- 2019-11-14
- 在线时间
- 20 小时
|
发表于 2021-6-7 17:37:29
|
显示全部楼层
本帖最后由 haozhenyu123 于 2021-6-7 17:58 编辑
void SetPacketParams(uint8_t payload_len)
{
uint8_t Opcode;
uint16_t prea_len;
uint8_t prea_len_h,prea_len_l;
check_busy();
Opcode = 0x8C;
prea_len = 8;
prea_len_h = prea_len>>8;
prea_len_l = prea_len&0xFF;
SPI_NSS(LOW);
spi_rw(Opcode);
spi_rw(prea_len_h);//PreambleLength MSB
spi_rw(prea_len_l);//PreambleLength LSB
spi_rw(0x00);//HeaderType 0:Variable,explicit 1:Fixed,implicit
//spi_rw(0x01);
spi_rw(payload_len);//PayloadLength: 0x00 to 0xFF
spi_rw(0X01);//CRCType 0:OFF 1:ON
spi_rw(0X00);//InvertIQ 0:Standard 1:Inverted
spi_rw(0XFF);//
spi_rw(0XFF);//
spi_rw(0XFF);//
SPI_NSS(HIGH);
}
咨询下,前导码长度设置为8,payload_len为什么设置为0, |
|