sx126x_set_cad_params()函数具体内容
时间: 2023-07-07 14:42:00 浏览: 92
SX126X_CAD(1.3OLED)_190401.zip
5星 · 资源好评率100%
以下是Semtech公司sx126x芯片驱动库中sx126x_set_cad_params()函数的具体内容:
```
void sx126x_set_cad_params( sx126x_t* sx126x, const uint8_t cad_symbol_num,
const sx126x_cad_detect_t cad_detect_mode,
const sx126x_cad_symbol_duration_t cad_symbol_duration )
{
uint8_t buf[3];
buf[0] = ( uint8_t )cad_symbol_num;
buf[1] = ( uint8_t )cad_detect_mode;
buf[2] = ( uint8_t )cad_symbol_duration;
sx126x_write_command( sx126x, SX126X_CMD_SET_CAD_PARAMS, buf, 3 );
}
```
该函数首先将CAD参数cad_symbol_num、cad_detect_mode和cad_symbol_duration打包成一个3字节的数组buf,并调用sx126x_write_command()函数向芯片发送SX126X_CMD_SET_CAD_PARAMS命令,将CAD参数写入芯片的寄存器中。
需要注意的是,在使用sx126x_set_cad_params()函数之前,需要首先初始化sx126x的SPI接口,并通过sx126x_init()函数初始化sx126x芯片。除此之外,还需要包含sx126x.h头文件。
阅读全文