You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

48 lines
1001 B

#include "CFG.h"
//串口默认可更改参数
uart_param_t uart_param_def={
.baud=115200,
.parity=NO_PARITY,
};
//串口实时可更改参数
uart_param_t uart_param = {0};
//LoRa默认可更改参数
lora_param_t lora_param_def={
.preamble_len_tx = 8,
.preamble_len_rx = 8,
.sf_tx = 7,
.sf_rx = 7,
.power = 22,
.bw_tx = 0,
.bw_rx = 0,
.freq_tx = 470300000,
.freq_rx = 470300000,
.is_public_network = false,
.tx_timeout=0,
.rx_timeout=0,
};
//LoRa实时可更改参数
lora_param_t lora_param = {0};
//综合起来
//从内存获取可更改参数
void config_get_from_flash(void)
{
//读flash
//判断flash是否有数据
//是,将读到的数据赋值给实时变量
//否,将默认值赋值给实时变量,并保存flash
lora_param = lora_param_def;
uart_param = uart_param_def;
}
//恢复为默认参数
void config_set_def(void)
{
//将默认值赋值给实时变量,并保存flash
lora_param = lora_param_def;
uart_param = uart_param_def;
}