mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #17264 from fjmolinas/pr_pkg_uwb_core_fixes
pkg/uwb-core: multiple cleanups
This commit is contained in:
commit
0149a860c9
@ -227,20 +227,11 @@ void init_ranging(void)
|
||||
(uint16_t)ceilf(uwb_dwt_usecs_to_usecs(rng->config.
|
||||
tx_holdoff_delay)));
|
||||
|
||||
if (IS_USED(MODULE_UWB_CORE_TWR_SS_ACK)) {
|
||||
uwb_set_autoack(udev, true);
|
||||
uwb_set_autoack_delay(udev, 12);
|
||||
}
|
||||
|
||||
dpl_callout_init(&_rng_req_callout, dpl_eventq_dflt_get(),
|
||||
uwb_ev_cb, rng);
|
||||
dpl_callout_reset(&_rng_req_callout, RANGE_REQUEST_T_MS);
|
||||
dpl_event_init(&_slot_event, _slot_complete_cb, rng);
|
||||
|
||||
/* Apply config */
|
||||
uwb_mac_config(udev, NULL);
|
||||
uwb_txrf_config(udev, &udev->config.txrf);
|
||||
|
||||
if ((udev->role & UWB_ROLE_ANCHOR)) {
|
||||
printf("Node role: ANCHOR \n");
|
||||
udev->my_short_address = ANCHOR_ADDRESS;
|
||||
|
@ -74,6 +74,10 @@ config MODULE_UWB-CORE_UWBCFG
|
||||
bool "uwb-core configuration module"
|
||||
select MODULE_UWB-CORE_CONFIG
|
||||
|
||||
config MODULE_UWB-CORE_EVENT_THREAD
|
||||
bool "Use event-thread loop as uwb-core's event loop"
|
||||
select MODULE_UWB-CORE_CONFIG
|
||||
|
||||
config MODULE_UWB-CORE_CONFIG
|
||||
bool
|
||||
|
||||
|
@ -30,6 +30,10 @@ ifneq (,$(filter uwb-core_dpl,$(USEMODULE)))
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter uwb-core_event_thread,$(USEMODULE)))
|
||||
USEMODULE += event_thread
|
||||
endif
|
||||
|
||||
# Some stdlib functions used by the pkg are not in avr-gcc
|
||||
FEATURES_BLACKLIST += arch_avr8
|
||||
# uwb-core has specific compilation sources when compiling kernel
|
||||
|
@ -19,43 +19,37 @@
|
||||
|
||||
#include "thread.h"
|
||||
#include "event.h"
|
||||
#include "event/callback.h"
|
||||
#include "uwb_core.h"
|
||||
|
||||
#include "os/os_cputime.h"
|
||||
#include "hal/hal_timer.h"
|
||||
|
||||
#ifndef UWB_CORE_STACKSIZE
|
||||
#define UWB_CORE_STACKSIZE (THREAD_STACKSIZE_LARGE)
|
||||
#endif
|
||||
#ifndef UWB_CORE_PRIO
|
||||
#define UWB_CORE_PRIO (THREAD_PRIORITY_MAIN - 5)
|
||||
#endif
|
||||
|
||||
static char _stack_uwb_core[UWB_CORE_STACKSIZE];
|
||||
|
||||
#if !IS_USED(MODULE_UWB_CORE_EVENT_THREAD)
|
||||
static event_queue_t _queue;
|
||||
|
||||
static char _stack_uwb_core[UWB_CORE_STACKSIZE];
|
||||
static void *_uwb_core_thread(void *arg)
|
||||
{
|
||||
(void)arg;
|
||||
|
||||
event_queue_init(&_queue);
|
||||
event_loop(&_queue);
|
||||
/* never reached */
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
event_queue_t *uwb_core_get_eventq(void)
|
||||
{
|
||||
#if !IS_USED(MODULE_UWB_CORE_EVENT_THREAD)
|
||||
return &_queue;
|
||||
#else
|
||||
return UWB_CORE_EVENT_THREAD_QUEUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void uwb_core_riot_init(void)
|
||||
{
|
||||
#if !IS_USED(MODULE_UWB_CORE_EVENT_THREAD)
|
||||
thread_create(_stack_uwb_core, sizeof(_stack_uwb_core),
|
||||
UWB_CORE_PRIO,
|
||||
THREAD_CREATE_STACKTEST,
|
||||
_uwb_core_thread, NULL,
|
||||
"uwb_core");
|
||||
"uwb_core_event");
|
||||
#endif
|
||||
}
|
||||
|
@ -47,25 +47,28 @@ void uwb_core_init(void)
|
||||
uwb_dw1000_setup(&dev, (void *) &dw1000_params[0]);
|
||||
/* this will start a thread handling dw1000 device */
|
||||
uwb_dw1000_config_and_start(&dev);
|
||||
/* apply default configuration */
|
||||
uwb_mac_config(&dev.uwb_dev, NULL);
|
||||
uwb_txrf_config(&dev.uwb_dev, &dev.uwb_dev.config.txrf);
|
||||
|
||||
/* init uwb pkg's */
|
||||
#if IS_USED(MODULE_UWB_CORE_RNG)
|
||||
extern void uwb_rng_pkg_init(void);
|
||||
uwb_rng_pkg_init();
|
||||
#endif
|
||||
|
||||
/* uwb configuration module */
|
||||
#if IS_USED(MODULE_UWB_CORE_UWBCFG)
|
||||
extern int uwbcfg_pkg_init(void);
|
||||
uwbcfg_pkg_init();
|
||||
#endif
|
||||
|
||||
/* ranging algorithms */
|
||||
#if IS_USED(MODULE_UWB_CORE_TWR_SS)
|
||||
twr_ss_pkg_init();
|
||||
#endif
|
||||
#if IS_USED(MODULE_UWB_CORE_TWR_SS_ACK)
|
||||
twr_ss_ack_pkg_init();
|
||||
uwb_set_autoack(&dev.uwb_dev, true);
|
||||
uwb_set_autoack_delay(&dev.uwb_dev, 12);
|
||||
#endif
|
||||
#if IS_USED(MODULE_UWB_CORE_TWR_SS_EXT)
|
||||
twr_ss_ext_pkg_init();
|
||||
|
@ -21,23 +21,33 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "event.h"
|
||||
#if IS_USED(MODULE_UWB_CORE_EVENT_THREAD)
|
||||
#include "event/thread"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Priority used for
|
||||
* @brief The event queue if uwb_core_event_thread is used
|
||||
*/
|
||||
#ifndef UWB_CORE__PRIO
|
||||
#define UWB_CORE__PRIO (THREAD_PRIORITY_MAIN - 2)
|
||||
#ifndef UWB_CORE_EVENT_THREAD_QUEUE
|
||||
#define UWB_CORE_EVENT_THREAD_QUEUE EVENT_PRIO_MEDIUM
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Stacksize used for
|
||||
* @brief Priority used for uwb-core event queue
|
||||
*/
|
||||
#ifndef UWB_CORE__STACKSIZE
|
||||
#define UWB_CORE__STACKSIZE (THREAD_STACKSIZE_DEFAULT)
|
||||
#ifndef UWB_CORE_PRIO
|
||||
#define UWB_CORE_PRIO (THREAD_PRIORITY_MAIN - 2)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Stacksize used for uwb-core event queue
|
||||
*/
|
||||
#ifndef UWB_CORE_STACKSIZE
|
||||
#define UWB_CORE_STACKSIZE (THREAD_STACKSIZE_LARGE)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -48,8 +58,8 @@ void uwb_core_riot_init(void);
|
||||
/**
|
||||
* @brief Retrieves the default event queue.
|
||||
*
|
||||
* As there is no default event queue in RIOT, uwb-core will start and
|
||||
* handle a default event queue.
|
||||
* if uwb_core_event_thread is used then the event_thread module queue will be
|
||||
* used. Otherwise uwb-core will start and handle its own event queue.
|
||||
*
|
||||
* @return the default event queue.
|
||||
*/
|
||||
|
@ -199,10 +199,11 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Default MAC FrameFilter (0x0000 = no filter)
|
||||
* @brief Default MAC FrameFilter (0x00ff = frame filtering enabled, all frames
|
||||
* matching PANID and destination address accepted)
|
||||
*/
|
||||
#ifndef DW1000_FRAME_FILTER_DEFAULT
|
||||
#define DW1000_FRAME_FILTER_DEFAULT 0x0000
|
||||
#define DW1000_FRAME_FILTER_DEFAULT 0x00ff
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user