add get packet RSSI and current RSSI
This commit is contained in:
parent
d7db736937
commit
985939ea80
2 changed files with 13 additions and 1 deletions
|
@ -23,7 +23,7 @@
|
|||
#define REG_IRQ_FLAGS 0x12
|
||||
#define REG_RX_NB_BYTES 0x13
|
||||
#define REG_PKT_RSSI_VALUE 0x1a
|
||||
#define REG_PKT_SNR_VALUE 0x1b
|
||||
#define REG_RSSI_VALUE 0x1b
|
||||
#define REG_MODEM_CONFIG_1 0x1d
|
||||
#define REG_MODEM_CONFIG_2 0x1e
|
||||
#define REG_PREAMBLE_MSB 0x20
|
||||
|
@ -142,6 +142,8 @@ typedef struct lora32_cfg_t {
|
|||
uint8_t lora32_spi_init(lora32_cfg_t *config);
|
||||
uint8_t lora32_init(lora32_cfg_t *config);
|
||||
uint8_t lora32_data_available(lora32_cfg_t *lora);
|
||||
int16_t lora32_get_packet_rssi(lora32_cfg_t *lora);
|
||||
int16_t lora32_get_rssi(lora32_cfg_t *lora);
|
||||
|
||||
double lora32_calc_datarate(lora32_cfg_t *lora);
|
||||
void lora32_dump_regs(lora32_cfg_t *lora);
|
||||
|
|
|
@ -298,6 +298,16 @@ void lora32_enable_cad(lora32_cfg_t *lora) {
|
|||
lora32_write_reg(lora, REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_CAD_DETECT);
|
||||
}
|
||||
|
||||
int16_t lora32_get_rssi(lora32_cfg_t *lora) {
|
||||
// TODO support LF output constant of -164
|
||||
return -157 + lora32_read_reg(lora, REG_RSSI_VALUE);
|
||||
}
|
||||
|
||||
int16_t lora32_get_packet_rssi(lora32_cfg_t *lora) {
|
||||
// TODO support LF output constant of -164
|
||||
return -157 + lora32_read_reg(lora, REG_PKT_RSSI_VALUE);
|
||||
}
|
||||
|
||||
long lora32_get_bandwidth(lora32_cfg_t *lora) {
|
||||
uint8_t bw = (lora32_read_reg(lora, REG_MODEM_CONFIG_1) >> 4);
|
||||
ESP_LOGI(TAG, "lora32_get_bandwidth: %d", bw);
|
||||
|
|
Loading…
Reference in a new issue