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