NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
heartbeat.h
1/*
2 * Copyright (c) 2020 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#include "../include/mesh/heartbeat.h"
8
9static inline uint16_t bt_mesh_hb_pwr2(uint8_t val)
10{
11 if (!val) {
12 return 0x0000;
13 } else if (val == 0xff || val == 0x11) {
14 return 0xffff;
15 } else {
16 return (1 << (val - 1));
17 }
18}
19
20static inline uint8_t bt_mesh_hb_log(uint32_t val)
21{
22 if (!val) {
23 return 0x00;
24 } else if (val == 0xffff) {
25 return 0xff;
26 } else {
27 return 32 - __builtin_clz(val);
28 }
29}
30
31void bt_mesh_hb_init(void);
32void bt_mesh_hb_start(void);
33void bt_mesh_hb_suspend(void);
34void bt_mesh_hb_resume(void);
35
36int bt_mesh_hb_recv(struct bt_mesh_net_rx *rx, struct os_mbuf *buf);
37void bt_mesh_hb_feature_changed(uint16_t features);
38
39uint8_t bt_mesh_hb_pub_set(struct bt_mesh_hb_pub *hb_pub);
40uint8_t bt_mesh_hb_sub_set(uint16_t src, uint16_t dst, uint32_t period);
41void bt_mesh_hb_sub_reset_count(void);
42void bt_mesh_hb_pub_pending_store(void);
43void bt_mesh_hb_pub_init(void);
Definition heartbeat.h:25
Definition os_mbuf.h:86