mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
examples/suit_update: make use of nanocoap_server_auto_init
This commit is contained in:
parent
597b2ad907
commit
3062d43a1d
@ -38,7 +38,7 @@ QUIET ?= 1
|
||||
#
|
||||
|
||||
USEMODULE += suit suit_transport_coap
|
||||
USEMODULE += nanocoap_resources
|
||||
USEMODULE += nanocoap_server_auto_init
|
||||
|
||||
# enable VFS transport (only works on boards with external storage)
|
||||
USEMODULE += suit_transport_vfs
|
||||
|
@ -44,13 +44,6 @@
|
||||
#include "periph/gpio.h"
|
||||
#endif
|
||||
|
||||
#define COAP_INBUF_SIZE (256U)
|
||||
|
||||
/* Extend stacksize of nanocoap server thread */
|
||||
static char _nanocoap_server_stack[THREAD_STACKSIZE_DEFAULT + THREAD_EXTRA_STACKSIZE_PRINTF];
|
||||
#define NANOCOAP_SERVER_QUEUE_SIZE (8)
|
||||
static msg_t _nanocoap_server_msg_queue[NANOCOAP_SERVER_QUEUE_SIZE];
|
||||
|
||||
#define MAIN_QUEUE_SIZE (8)
|
||||
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
|
||||
|
||||
@ -63,21 +56,6 @@ XFA(suit_storage_files_reg, 1) char* _slot1 = VFS_DEFAULT_DATA "/SLOT1.txt";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static void *_nanocoap_server_thread(void *arg)
|
||||
{
|
||||
(void)arg;
|
||||
|
||||
/* nanocoap_server uses gnrc sock which uses gnrc which needs a msg queue */
|
||||
msg_init_queue(_nanocoap_server_msg_queue, NANOCOAP_SERVER_QUEUE_SIZE);
|
||||
|
||||
/* initialize nanocoap server instance */
|
||||
uint8_t buf[COAP_INBUF_SIZE];
|
||||
sock_udp_ep_t local = { .port=COAP_PORT, .family=AF_INET6 };
|
||||
nanocoap_server(&local, buf, sizeof(buf));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* assuming that first button is always BTN0 */
|
||||
#if defined(MODULE_PERIPH_GPIO_IRQ) && defined(BTN0_PIN)
|
||||
static void cb(void *arg)
|
||||
@ -213,12 +191,6 @@ int main(void)
|
||||
/* initialize suit storage */
|
||||
suit_storage_init_all();
|
||||
|
||||
/* start nanocoap server thread */
|
||||
thread_create(_nanocoap_server_stack, sizeof(_nanocoap_server_stack),
|
||||
THREAD_PRIORITY_MAIN - 1,
|
||||
THREAD_CREATE_STACKTEST,
|
||||
_nanocoap_server_thread, NULL, "nanocoap server");
|
||||
|
||||
/* the shell contains commands that receive packets via GNRC and thus
|
||||
needs a msg queue */
|
||||
msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);
|
||||
|
Loading…
Reference in New Issue
Block a user