Compare commits
2 commits
985939ea80
...
150a23dbaf
Author | SHA1 | Date | |
---|---|---|---|
|
150a23dbaf | ||
|
19a233de27 |
2 changed files with 5 additions and 3 deletions
|
@ -103,7 +103,6 @@ typedef struct {
|
||||||
} lora32_handle_t;
|
} lora32_handle_t;
|
||||||
|
|
||||||
typedef struct lora32_cfg_t {
|
typedef struct lora32_cfg_t {
|
||||||
char *name;
|
|
||||||
uint8_t nss;
|
uint8_t nss;
|
||||||
uint8_t cipo;
|
uint8_t cipo;
|
||||||
uint8_t copi;
|
uint8_t copi;
|
||||||
|
@ -157,6 +156,7 @@ void lora32_send(lora32_cfg_t *config, uint8_t *data, uint8_t len);
|
||||||
void lora32_set_bandwidth(lora32_cfg_t *lora, uint8_t bw);
|
void lora32_set_bandwidth(lora32_cfg_t *lora, uint8_t bw);
|
||||||
void lora32_set_coding_rate(lora32_cfg_t *lora, uint8_t cr);
|
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_set_spreadfactor(lora32_cfg_t *lora, uint8_t factor);
|
||||||
|
uint8_t lora32_get_spreadfactor(lora32_cfg_t *lora);
|
||||||
void lora32_read_data(lora32_cfg_t *lora, uint8_t *data);
|
void lora32_read_data(lora32_cfg_t *lora, uint8_t *data);
|
||||||
void lora32_sleep(lora32_cfg_t *lora);
|
void lora32_sleep(lora32_cfg_t *lora);
|
||||||
void lora32_standby(lora32_cfg_t *lora);
|
void lora32_standby(lora32_cfg_t *lora);
|
||||||
|
|
|
@ -240,7 +240,7 @@ void lora32_toggle_reset(lora32_cfg_t *config) {
|
||||||
vTaskDelay(100 / portTICK_PERIOD_MS); // 5ms before available
|
vTaskDelay(100 / portTICK_PERIOD_MS); // 5ms before available
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t lora32_get_spreadingfactor(lora32_cfg_t *lora) {
|
uint8_t lora32_get_spreadfactor(lora32_cfg_t *lora) {
|
||||||
return (lora32_read_reg(lora, REG_MODEM_CONFIG_2) >> 4);
|
return (lora32_read_reg(lora, REG_MODEM_CONFIG_2) >> 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,6 +260,8 @@ void lora32_set_spreadfactor(lora32_cfg_t *lora, uint8_t factor) {
|
||||||
ESP_LOGI(TAG, "lora32_set_spreadfactor: %d", factor);
|
ESP_LOGI(TAG, "lora32_set_spreadfactor: %d", factor);
|
||||||
|
|
||||||
lora32_write_reg(lora, REG_MODEM_CONFIG_2, (lora32_read_reg(lora, REG_MODEM_CONFIG_2) & 0x0F) | ((factor << 4) & 0xF0));
|
lora32_write_reg(lora, REG_MODEM_CONFIG_2, (lora32_read_reg(lora, REG_MODEM_CONFIG_2) & 0x0F) | ((factor << 4) & 0xF0));
|
||||||
|
|
||||||
|
lora->spreadingFactor = factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lora32_enable_single_rx(lora32_cfg_t *lora) {
|
void lora32_enable_single_rx(lora32_cfg_t *lora) {
|
||||||
|
@ -320,7 +322,7 @@ long lora32_get_bandwidth(lora32_cfg_t *lora) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void lora32_set_ldo_flag(lora32_cfg_t *lora) {
|
void lora32_set_ldo_flag(lora32_cfg_t *lora) {
|
||||||
long symbolDuration = 1000 / (lora32_get_bandwidth(lora) / (1L << lora32_get_spreadingfactor(lora)));
|
long symbolDuration = 1000 / (lora32_get_bandwidth(lora) / (1L << lora32_get_spreadfactor(lora)));
|
||||||
|
|
||||||
ESP_LOGI(TAG, "symbolDuration: %ld", symbolDuration);
|
ESP_LOGI(TAG, "symbolDuration: %ld", symbolDuration);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue