Skip to content

Commit

Permalink
net/csma_sender: do not require xtimer
Browse files Browse the repository at this point in the history
  • Loading branch information
kfessel committed Mar 1, 2022
1 parent b781490 commit 88b4846
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion sys/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ endif

ifneq (,$(filter csma_sender,$(USEMODULE)))
USEMODULE += random
USEMODULE += xtimer
ifeq (,$(filter ztimer_usec,$(USEMODULE)))
USEMODULE += xtimer
endif
endif

ifneq (,$(filter dhcpv6_%,$(USEMODULE)))
Expand Down
7 changes: 6 additions & 1 deletion sys/net/link_layer/csma_sender/csma_sender.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@
#include <errno.h>
#include <stdbool.h>
#include <inttypes.h>
#include <kernel_defines.h>

#if IS_USED(MODULE_ZTIMER_USEC)
#include "ztimer/xtimer_compat.h"
#else
#include "xtimer.h"
#endif
#include "random.h"
#include "net/netdev.h"
#include "net/netopt.h"
Expand Down Expand Up @@ -152,7 +157,7 @@ int csma_sender_csma_ca_send(netdev_t *dev, iolist_t *iolist,

/* if we arrive here, then we must perform the CSMA/CA procedure
ourselves by software */
random_init(_xtimer_now());
random_init(xtimer_now_usec());
DEBUG("csma: Starting software CSMA/CA....\n");

int nb = 0, be = conf->min_be;
Expand Down

0 comments on commit 88b4846

Please sign in to comment.