Skip to content

Commit

Permalink
drivers/at86rf215: use non-blocking send if gnrc_netif_pktq is active
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Oct 24, 2020
1 parent 60b5a6b commit b543a34
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions drivers/at86rf215/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ FEATURES_REQUIRED += periph_gpio
FEATURES_REQUIRED += periph_gpio_irq
FEATURES_REQUIRED += periph_spi

ifeq (,$(filter gnrc_netif_pktq,$(USEMODULE)))
USEMODULE += at86rf215_blocking_send
endif

USEMODULE += xtimer
USEMODULE += netif
USEMODULE += ieee802154
Expand Down
11 changes: 10 additions & 1 deletion drivers/at86rf215/at86rf215.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ static void _block_while_busy(at86rf215_t *dev)

static void at86rf215_block_while_busy(at86rf215_t *dev)
{
if (!IS_ACTIVE(MODULE_AT86RF215_BLOCKING_SEND)) {
return;
}

if (_tx_ongoing(dev)) {
DEBUG("[at86rf215] Block while TXing\n");
_block_while_busy(dev);
Expand All @@ -266,7 +270,12 @@ int at86rf215_tx_prepare(at86rf215_t *dev)
return -EAGAIN;
}

at86rf215_block_while_busy(dev);
if (!IS_ACTIVE(MODULE_AT86RF215_BLOCKING_SEND) && _tx_ongoing(dev)) {
return -EBUSY;
} else {
at86rf215_block_while_busy(dev);
}

dev->tx_frame_len = IEEE802154_FCS_LEN;

return 0;
Expand Down

0 comments on commit b543a34

Please sign in to comment.