diff --git a/README.md b/README.md index d63b784..31e8e2c 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,6 @@ Returns 1 on success. ### `uint8_t lora32_data_available(lora32_cfg_t *lora)` Indicates if data is presently available. -### `uint8_t lora32_parse_packet(lora32_cfg_t *lora, uint8_t size)` - ### `void lora32_send(lora32_cfg_t *config, uint8_t *data, uint8_t len)` Transmits data over the LoRa radio. diff --git a/include/esp32-lora.h b/include/esp32-lora.h index 71b3fc5..6c75fe4 100644 --- a/include/esp32-lora.h +++ b/include/esp32-lora.h @@ -108,7 +108,6 @@ typedef struct lora32_cfg_t { lora32_cfg_t lora32_create(); uint8_t lora32_init(lora32_cfg_t *config); uint8_t lora32_data_available(lora32_cfg_t *lora); -uint8_t lora32_parse_packet(lora32_cfg_t *lora, uint8_t size); void lora32_send(lora32_cfg_t *config, uint8_t *data, uint8_t len); void lora32_set_spreadfactor(lora32_cfg_t *lora, uint8_t factor); void lora32_dump_regs(lora32_cfg_t *lora); diff --git a/main/esp32-lora.c b/main/esp32-lora.c index 44159b6..b9c522d 100644 --- a/main/esp32-lora.c +++ b/main/esp32-lora.c @@ -188,45 +188,6 @@ void lora32_set_tx_power(lora32_cfg_t *lora, uint8_t level, uint8_t output) { ESP_LOGD(TAG, "REG_PA_CONFIG: 0x%2X", lora32_read_reg(lora, REG_PA_CONFIG)); } -uint8_t lora32_parse_packet(lora32_cfg_t *lora, uint8_t size) { - uint8_t length = 0; - uint8_t irqs = lora32_read_reg(lora, REG_IRQ_FLAGS); - - if(size > 0) { - lora23_set_implicit_header(lora); - - lora32_write_reg(lora, REG_PAYLOAD_LENGTH, size & 0xFF); - } else { - lora23_set_explicit_header(lora); - } - - lora32_write_reg(lora, REG_IRQ_FLAGS, irqs); - - //ESP_LOGI(TAG, "irqs: 0x%2X", irqs); - //ESP_LOGI(TAG, "irqs: 0x%2X", lora32_read_reg(spi, REG_IRQ_FLAGS)); - - if ((irqs & IRQ_RX_DONE_MASK) && (irqs & IRQ_PAYLOAD_CRC_ERROR_MASK) == 0) { - lora->fifoIdx = 0; - - if(lora->implicitHeader) { - length = lora32_read_reg(lora, REG_PAYLOAD_LENGTH); - } else { - length = lora32_read_reg(lora, REG_RX_NB_BYTES); - } - - lora32_write_reg(lora, REG_FIFO_ADDR_PTR, lora32_read_reg(lora, REG_FIFO_RX_CURRENT_ADDR)); - - lora32_idle(lora); - } else if(lora32_read_reg(lora, REG_OP_MODE) != (MODE_LONG_RANGE_MODE | MODE_RX_SINGLE)) { - lora32_write_reg(lora, REG_FIFO_ADDR_PTR, 0); - //lora32_write_reg(lora, REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_RX_SINGLE); - } else { - //ESP_LOGI(TAG, "no irqs?"); - } - - return length; -} - uint8_t lora32_data_available(lora32_cfg_t *lora) { return lora32_read_reg(lora, REG_RX_NB_BYTES) - lora->fifoIdx; }