Skip to content

Commit

Permalink
Merge #19391 #19392
Browse files Browse the repository at this point in the history
19391: cord: convert to ztimer r=kaspar030 a=bergzand

### Contribution description

As the subject describes


### Testing procedure

The `examples/cord_ep` example should work as before.


### Issues/PRs references

None


19392: ztimer: Fix doc on ztimer_remove r=kaspar030 a=bergzand

### Contribution description

See the subject 


### Testing procedure

Read the modified docs


### Issues/PRs references

None

Co-authored-by: Koen Zandberg <koen@bergzand.net>
  • Loading branch information
bors[bot] and bergzand authored Mar 14, 2023
3 parents 5b61449 + 5205151 + fa0ab40 commit d15dc22
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion sys/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ endif

ifneq (,$(filter cord_ep_standalone,$(USEMODULE)))
USEMODULE += cord_ep
USEMODULE += xtimer
USEMODULE += ztimer_msec
endif

ifneq (,$(filter cord_lc,$(USEMODULE)))
Expand Down
2 changes: 1 addition & 1 deletion sys/include/ztimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ unsigned ztimer_is_set(const ztimer_clock_t *clock, const ztimer_t *timer);
/**
* @brief Remove a timer from a clock
*
* This will place @p timer in the timer targets queue for @p clock.
* This will remove @p timer from the timer targets queue for @p clock.
*
* This function does nothing if @p timer is not found in the timer queue of
* @p clock.
Expand Down
10 changes: 5 additions & 5 deletions sys/net/application_layer/cord/ep/cord_ep_standalone.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "log.h"
#include "assert.h"
#include "thread.h"
#include "xtimer.h"
#include "ztimer.h"
#include "net/cord/ep.h"
#include "net/cord/config.h"
#include "net/cord/ep_standalone.h"
Expand All @@ -38,19 +38,19 @@

#define UPDATE_TIMEOUT (0xe537)

#define TIMEOUT_US ((uint64_t)(CONFIG_CORD_UPDATE_INTERVAL * US_PER_SEC))
#define TIMEOUT_MS (CONFIG_CORD_UPDATE_INTERVAL * MS_PER_SEC)

static char _stack[STACKSIZE];

static xtimer_t _timer;
static ztimer_t _timer;
static kernel_pid_t _runner_pid;
static msg_t _msg;

static cord_ep_standalone_cb_t _cb = NULL;

static void _set_timer(void)
{
xtimer_set_msg64(&_timer, TIMEOUT_US, &_msg, _runner_pid);
ztimer_set_msg(ZTIMER_MSEC, &_timer, TIMEOUT_MS, &_msg, _runner_pid);
}

static void _notify(cord_ep_standalone_event_t event)
Expand Down Expand Up @@ -94,7 +94,7 @@ void cord_ep_standalone_run(void)
void cord_ep_standalone_signal(bool connected)
{
/* clear timer in any case */
xtimer_remove(&_timer);
ztimer_remove(ZTIMER_MSEC, &_timer);
/* reset the update timer in case a connection was established or updated */
if (connected) {
_set_timer();
Expand Down

0 comments on commit d15dc22

Please sign in to comment.