nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
dm.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef DM_H_
8#define DM_H_
9
10#include <stdlib.h>
11
12#include <zephyr/types.h>
13#include <zephyr/kernel.h>
14#include <zephyr/bluetooth/addr.h>
15
23#ifdef __cplusplus
24extern "C" {
25#endif
26
38
47
65
67struct dm_result {
71 bool status;
72
75
77 bt_addr_le_t bt_addr;
78
81
83 union {
84 struct mcpd {
86 float ifft;
87
90
93
95 float best;
96
97#ifdef CONFIG_DM_HIGH_PRECISION_CALC
98 /* MCPD: Distance estimate based on advanced algorithms */
99 float high_precision;
100#endif
102 struct rtt {
104 float rtt;
107};
108
110struct dm_cb {
119 void (*data_ready)(struct dm_result *result);
120};
121
125 struct dm_cb *cb;
126};
127
132
134 bt_addr_le_t bt_addr;
135
139 uint32_t rng_seed;
140
143
146
149};
150
160int dm_init(struct dm_init_param *init_param);
161
171int dm_request_add(struct dm_request *req);
172
173#ifdef __cplusplus
174}
175#endif
176
181#endif /* DM_H_ */
dm_dev_role
Role definition.
Definition dm.h:28
@ DM_ROLE_REFLECTOR
Definition dm.h:36
@ DM_ROLE_NONE
Definition dm.h:30
@ DM_ROLE_INITIATOR
Definition dm.h:33
int dm_request_add(struct dm_request *req)
Add measurement request.
int dm_init(struct dm_init_param *init_param)
Initialize the DM.
dm_quality
Measurement quality definition.
Definition dm.h:49
@ DM_QUALITY_OK
Definition dm.h:51
@ DM_QUALITY_POOR
Definition dm.h:54
@ DM_QUALITY_NONE
Definition dm.h:63
@ DM_QUALITY_DO_NOT_USE
Definition dm.h:57
@ DM_QUALITY_CRC_FAIL
Definition dm.h:60
dm_ranging_mode
Ranging mode definition.
Definition dm.h:40
@ DM_RANGING_MODE_MCPD
Definition dm.h:45
@ DM_RANGING_MODE_RTT
Definition dm.h:42
void(* data_ready)(struct dm_result *result)
Data ready.
Definition dm.h:119
Event callback structure.
Definition dm.h:110
struct dm_cb * cb
Definition dm.h:125
DM initialization parameters.
Definition dm.h:123
uint32_t start_delay_us
Definition dm.h:145
bt_addr_le_t bt_addr
Definition dm.h:134
enum dm_ranging_mode ranging_mode
Definition dm.h:142
uint32_t rng_seed
Definition dm.h:139
uint32_t extra_window_time_us
Definition dm.h:148
enum dm_dev_role role
Definition dm.h:131
DM request structure.
Definition dm.h:129
float ifft
Definition dm.h:86
float best
Definition dm.h:95
enum dm_quality quality
Definition dm.h:74
struct dm_result::@178::mcpd mcpd
enum dm_ranging_mode ranging_mode
Definition dm.h:80
float phase_slope
Definition dm.h:89
bt_addr_le_t bt_addr
Definition dm.h:77
bool status
Definition dm.h:71
union dm_result::@178 dist_estimates
float rtt
Definition dm.h:104
float rssi_openspace
Definition dm.h:92
Distance Measurement result structure.
Definition dm.h:67