1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/sx126x : Update NETOPT_RX_xx

r/NETOPT_RX_TIMEOUT/NETOPT_RX_SYMBOL_TIMEOUT
Use sx126x_symbol_to_msec() to calculate the RX timeout in ms.
This commit is contained in:
Akshai M 2021-06-30 19:50:56 +02:00
parent a3ed19e0ee
commit 8d43dbf67f
2 changed files with 8 additions and 7 deletions

View File

@ -77,7 +77,7 @@ typedef struct {
sx126x_pkt_params_lora_t pkt_params; /**< Lora packet parameters */
sx126x_mod_params_lora_t mod_params; /**< Lora modulation parameters */
uint32_t channel; /**< Current channel frequency (in Hz) */
uint32_t rx_timeout; /**< RX timeout in ms */
uint8_t rx_timeout; /**< Rx Timeout in terms of symbols */
} sx126x_t;
/**

View File

@ -288,8 +288,9 @@ static int _set_state(sx126x_t *dev, netopt_state_t state)
case NETOPT_STATE_RX:
DEBUG("[sx126x] netdev: set NETOPT_STATE_RX state\n");
sx126x_cfg_rx_boosted(dev, true);
if (dev->rx_timeout != 0) {
sx126x_set_rx(dev, dev->rx_timeout);
int _timeout = (sx126x_symbol_to_msec(dev, dev->rx_timeout));
if (_timeout != 0) {
sx126x_set_rx(dev, _timeout);
}
else {
sx126x_set_rx(dev, SX126X_RX_SINGLE_MODE);
@ -386,10 +387,10 @@ static int _set(netdev_t *netdev, netopt_t opt, const void *val, size_t len)
sx126x_set_lora_crc(dev, *((const netopt_enable_t *)val) ? true : false);
return sizeof(netopt_enable_t);
case NETOPT_RX_TIMEOUT:
assert(len <= sizeof(uint32_t));
dev->rx_timeout = *(const uint32_t *)val;
return sizeof(uint32_t);
case NETOPT_RX_SYMBOL_TIMEOUT:
assert(len <= sizeof(uint8_t));
dev->rx_timeout = *(const uint8_t *)val;
return sizeof(uint8_t);
case NETOPT_TX_POWER:
assert(len <= sizeof(int16_t));