explicity set DIO0 mapping, will need to be changed when DIO1+ are implemented

This commit is contained in:
Morgan 'ARR\!' Allen 2020-02-21 09:14:26 -08:00
parent 89facad220
commit 2507305ee5
2 changed files with 5 additions and 5 deletions

View file

@ -64,8 +64,8 @@
#define DEFAULT_PREAMBLE 8
#define DEFAULT_CR 5
#define DIO0_MODE_RXDONE 0xC0
#define DIO0_MODE_TXDONE 0xBF
#define DIO0_MODE_RXDONE 0x00
#define DIO0_MODE_TXDONE 0x40
#define EV_DIO0 (1 << 0)

View file

@ -143,6 +143,8 @@ void lora32_send(lora32_cfg_t *lora, uint8_t *data, uint8_t len) {
lora32_write_reg(lora, REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_TX);
lora32_write_reg(lora, REG_DIO_MAPPING_1, DIO0_MODE_TXDONE);
ESP_LOGD(TAG, "lora32_send waiting for TX to finish");
// can be made async by waiting for DIO0 and checking for IRQ_TX_DONE_MASK
@ -244,9 +246,7 @@ 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_DIO_MAPPING_1, DIO0_MODE_RXDONE);
}
lora32_write_reg(lora, REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_RX_CONTINUOUS);