mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 10:03:50 +01:00
examples/twr_aloha: default print rng result only on initiator
This commit is contained in:
parent
f5a4a486f6
commit
a5f54b5a03
@ -149,6 +149,7 @@ static bool _complete_cb(struct uwb_dev *inst, struct uwb_mac_interface *cbs)
|
|||||||
event_post(uwb_core_get_eventq(), &_rng_listen_event.super);
|
event_post(uwb_core_get_eventq(), &_rng_listen_event.super);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get received frame */
|
/* get received frame */
|
||||||
struct uwb_rng_instance *rng = (struct uwb_rng_instance *)cbs->inst_ptr;
|
struct uwb_rng_instance *rng = (struct uwb_rng_instance *)cbs->inst_ptr;
|
||||||
|
|
||||||
@ -157,6 +158,15 @@ static bool _complete_cb(struct uwb_dev *inst, struct uwb_mac_interface *cbs)
|
|||||||
/* parse data*/
|
/* parse data*/
|
||||||
uwb_core_rng_data_t data;
|
uwb_core_rng_data_t data;
|
||||||
|
|
||||||
|
/* with ss twr, the last frame will hold the initiator as the src address,
|
||||||
|
with ds twr, it will hold the responder address */
|
||||||
|
if (IS_ACTIVE(CONFIG_TWR_PRINTF_INITIATOR_ONLY) &&
|
||||||
|
((frame->code < UWB_DATA_CODE_DS_TWR && frame->src_address != _udev->uid) ||
|
||||||
|
(frame->code >= UWB_DATA_CODE_DS_TWR && frame->dst_address != _udev->uid))) {
|
||||||
|
event_post(uwb_core_get_eventq(), &_rng_listen_event.super);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
data.src = frame->src_address;
|
data.src = frame->src_address;
|
||||||
data.dest = frame->dst_address;
|
data.dest = frame->dst_address;
|
||||||
data.time = ztimer_now(ZTIMER_MSEC);
|
data.time = ztimer_now(ZTIMER_MSEC);
|
||||||
|
|||||||
@ -41,6 +41,13 @@ extern "C" {
|
|||||||
#define CONFIG_TWR_MIN_IDLE_SLEEP_MS 20
|
#define CONFIG_TWR_MIN_IDLE_SLEEP_MS 20
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Block after a request is sent
|
||||||
|
*/
|
||||||
|
#ifndef CONFIG_TWR_PRINTF_INITIATOR_ONLY
|
||||||
|
#define CONFIG_TWR_PRINTF_INITIATOR_ONLY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief uwb rng data structure
|
* @brief uwb rng data structure
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user