add long missing set bandwidth function
This commit is contained in:
parent
8a172eac86
commit
862d8eeadd
2 changed files with 10 additions and 1 deletions
|
@ -81,7 +81,7 @@ enum freq {
|
|||
} lora32_freq;
|
||||
|
||||
enum bandwidth {
|
||||
B78, B104, B156, B208, B3125, B417, B625, B125, B250
|
||||
B78, B104, B156, B208, B3125, B417, B625, B125, B250, B500
|
||||
};
|
||||
|
||||
const long long frequencies[3];
|
||||
|
@ -130,6 +130,7 @@ void lora32_dump_regs(lora32_cfg_t *lora);
|
|||
void lora32_enable_continuous_rx(lora32_cfg_t *lora);
|
||||
void lora32_enable_cad(lora32_cfg_t *lora);
|
||||
void lora32_send(lora32_cfg_t *config, uint8_t *data, uint8_t len);
|
||||
void lora32_set_bandwidth(lora32_cfg_t *lora, enum bandwidth bw);
|
||||
void lora32_set_coding_rate(lora32_cfg_t *lora, uint8_t cr);
|
||||
void lora32_set_spreadfactor(lora32_cfg_t *lora, uint8_t factor);
|
||||
void lora32_read_data(lora32_cfg_t *lora, uint8_t *data);
|
||||
|
|
|
@ -262,6 +262,14 @@ void lora32_enable_cad(lora32_cfg_t *lora) {
|
|||
lora32_write_reg(lora, REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_CAD_DETECT);
|
||||
}
|
||||
|
||||
void lora32_set_bandwidth(lora32_cfg_t *lora, enum bandwidth bw) {
|
||||
uint8_t modem_config_1 = lora32_read_reg(lora, REG_MODEM_CONFIG_1);
|
||||
|
||||
ESP_LOGI(TAG, "lora32_set_bandwidth: %d", bw);
|
||||
|
||||
lora32_write_reg(lora, REG_MODEM_CONFIG_1, (modem_config_1 & 0x0F) | (bw << 4));
|
||||
}
|
||||
|
||||
void lora32_set_coding_rate(lora32_cfg_t *lora, uint8_t cr) {
|
||||
if(cr < 5) cr = 5;
|
||||
else if(cr > 8) cr = 8;
|
||||
|
|
Loading…
Reference in a new issue