-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdwutil.h
More file actions
41 lines (32 loc) · 1.12 KB
/
dwutil.h
File metadata and controls
41 lines (32 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* libdeca - UWB Library for Qorvo/Decawave DW3000
*
* Copyright (C) 2016 - 2024 Bruno Randolf (br@einfach.org)
*
* This source code is licensed under the GNU Lesser General Public License,
* Version 3. See the file LICENSE.txt for more details.
*/
#ifndef DECA_UTIL_H
#define DECA_UTIL_H
#include <stdint.h>
#include <inttypes.h>
#define ADDR_FMT "%04X"
#if ESP_PLATFORM || defined(__ZEPHYR__)
#define LADDR_FMT "[%016" PRIX64 "]"
#define LADDR_PAR(x) x
#else
// 64 bit printf is not available in NRF SDK
#define LADDR_FMT "[%08" PRIX32 "%08" PRIX32 "]"
#define LADDR_PAR(x) (uint32_t)(x >> 32), (uint32_t)x
#endif
#define IS_SHORT_ADDR(x) (((x) & 0xffffffffffff0000LL) == 0x0000000000000000LL)
#define ASSERT_RET(cond) \
if (!(cond)) { \
LOG_ERR("ASSERT " #cond " in %s:%d", __FILE__, __LINE__); \
return false; \
}
#ifndef CEIL_DIV
#define CEIL_DIV(A, B) (((A) + (B) - 1) / (B))
#endif
uint64_t mac_to_eui64(const uint8_t* mac);
#endif