mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 06:23:53 +01:00
sys/suit_transport_coap: convert to ztimer_msec, rm unused deadline_fns
This commit is contained in:
parent
5fe9e9e2ab
commit
ddbf64ccca
@ -817,7 +817,7 @@ endif
|
||||
|
||||
ifneq (,$(filter suit_transport_coap, $(USEMODULE)))
|
||||
USEMODULE += nanocoap_sock
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer_msec
|
||||
USEMODULE += sock_util
|
||||
endif
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
#include "net/nanocoap_sock.h"
|
||||
#include "thread.h"
|
||||
#include "periph/pm.h"
|
||||
#include "xtimer.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
#include "suit/transport/coap.h"
|
||||
#include "net/sock/util.h"
|
||||
@ -112,27 +112,6 @@ ssize_t coap_subtree_handler(coap_pkt_t *pkt, uint8_t *buf, size_t len,
|
||||
subtree->resources_numof);
|
||||
}
|
||||
|
||||
static inline uint32_t _now(void)
|
||||
{
|
||||
return xtimer_now_usec();
|
||||
}
|
||||
|
||||
static inline uint32_t deadline_from_interval(int32_t interval)
|
||||
{
|
||||
assert(interval >= 0);
|
||||
return _now() + (uint32_t)interval;
|
||||
}
|
||||
|
||||
static inline uint32_t deadline_left(uint32_t deadline)
|
||||
{
|
||||
int32_t left = (int32_t)(deadline - _now());
|
||||
|
||||
if (left < 0) {
|
||||
left = 0;
|
||||
}
|
||||
return left;
|
||||
}
|
||||
|
||||
static void _suit_handle_url(const char *url, coap_blksize_t blksize, void *work_buf)
|
||||
{
|
||||
LOG_INFO("suit_coap: downloading \"%s\"\n", url);
|
||||
@ -161,7 +140,7 @@ static void _suit_handle_url(const char *url, coap_blksize_t blksize, void *work
|
||||
const riotboot_hdr_t *hdr = riotboot_slot_get_hdr(
|
||||
riotboot_slot_other());
|
||||
riotboot_hdr_print(hdr);
|
||||
xtimer_sleep(1);
|
||||
ztimer_sleep(ZTIMER_MSEC, 1 * MS_PER_SEC);
|
||||
|
||||
if (riotboot_hdr_validate(hdr) == 0) {
|
||||
LOG_INFO("suit_coap: rebooting...\n");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user