move DIO mapping into receive enable

This commit is contained in:
Morgan 'ARR\!' Allen 2020-02-21 08:55:23 -08:00
parent 1e1c34bac8
commit 9bb9eb0a41
2 changed files with 9 additions and 0 deletions

View File

@ -64,6 +64,9 @@
#define DEFAULT_PREAMBLE 8
#define DEFAULT_CR 5
#define DIO0_MODE_RXDONE 0xC0
#define DIO0_MODE_TXDONE 0xBF
#define EV_DIO0 (1 << 0)
enum freq {

View File

@ -243,6 +243,12 @@ void lora32_set_spreadfactor(lora32_cfg_t *lora, uint8_t factor) {
void lora32_enable_continuous_rx(lora32_cfg_t *lora) {
ESP_LOGD(TAG, "enabling continuous receive");
if(lora->receive != NULL) {
uint8_t reg_mapping_1 = lora32_read_reg(lora, REG_DIO_MAPPING_1);
lora32_write_reg(lora, REG_DIO_MAPPING_1, (reg_mapping_1 ^ DIO0_MODE_RXDONE));
}
lora32_write_reg(lora, REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_RX_CONTINUOUS);
}