diff --git a/drivers/include/sx127x.h b/drivers/include/sx127x.h index 386effcf67..bddce07705 100644 --- a/drivers/include/sx127x.h +++ b/drivers/include/sx127x.h @@ -637,7 +637,7 @@ void sx127x_set_preamble_length(sx127x_t *dev, uint16_t preamble); * @param[in] dev The sx127x device descriptor * @param[in] timeout The LoRa symbol timeout */ -void sx127x_set_symbol_timeout(sx127x_t *dev, uint8_t timeout); +void sx127x_set_symbol_timeout(sx127x_t *dev, uint16_t timeout); /** * @brief Sets the SX127X RX timeout diff --git a/drivers/sx127x/sx127x_getset.c b/drivers/sx127x/sx127x_getset.c index cc781802a5..9ec4bcd8c3 100644 --- a/drivers/sx127x/sx127x_getset.c +++ b/drivers/sx127x/sx127x_getset.c @@ -866,16 +866,16 @@ void sx127x_set_tx_timeout(sx127x_t *dev, uint32_t timeout) dev->settings.lora.tx_timeout = timeout; } -void sx127x_set_symbol_timeout(sx127x_t *dev, uint8_t timeout) +void sx127x_set_symbol_timeout(sx127x_t *dev, uint16_t timeout) { DEBUG("[sx127x] Set symbol timeout: %d\n", timeout); uint8_t config2_reg = sx127x_reg_read(dev, SX127X_REG_LR_MODEMCONFIG2); config2_reg &= SX127X_RF_LORA_MODEMCONFIG2_SYMBTIMEOUTMSB_MASK; - config2_reg |= timeout & ~SX127X_RF_LORA_MODEMCONFIG2_SYMBTIMEOUTMSB_MASK; + config2_reg |= (timeout >> 8) & ~SX127X_RF_LORA_MODEMCONFIG2_SYMBTIMEOUTMSB_MASK; sx127x_reg_write(dev, SX127X_REG_LR_MODEMCONFIG2, config2_reg); - sx127x_reg_write(dev, SX127X_REG_LR_SYMBTIMEOUTLSB, timeout); + sx127x_reg_write(dev, SX127X_REG_LR_SYMBTIMEOUTLSB, timeout & 0xFF); } bool sx127x_get_iq_invert(const sx127x_t *dev) diff --git a/drivers/sx127x/sx127x_netdev.c b/drivers/sx127x/sx127x_netdev.c index 329ca0f70d..c4d9667f24 100644 --- a/drivers/sx127x/sx127x_netdev.c +++ b/drivers/sx127x/sx127x_netdev.c @@ -444,8 +444,8 @@ static int _set(netdev_t *netdev, netopt_t opt, const void *val, size_t len) return sizeof(netopt_enable_t); case NETOPT_RX_SYMBOL_TIMEOUT: - assert(len <= sizeof(uint8_t)); - sx127x_set_symbol_timeout(dev, *((const uint8_t *)val)); + assert(len <= sizeof(uint16_t)); + sx127x_set_symbol_timeout(dev, *((const uint16_t *)val)); return sizeof(uint16_t); case NETOPT_RX_TIMEOUT: