BlueSync - BLE Time Sync for Zephyr
High-precision time synchronization for BLE Mesh networks
Loading...
Searching...
No Matches
bluesync_bitfields.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 Tobias Moullet
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * File: bluesync_bitfields.h
17 * Description: Bitfield file to keep in touch which timeslot is received
18 *
19 * Project: BlueSync - BLE Time Sync for Zephyr
20 * Repository: https://github.com/Tobi15/zephyr-bluesync-ble
21 */
22
23
24#ifndef ZEPHYR_BLUESYNC_SRC_BLUESYNC_BITFIELDS_H_
25#define ZEPHYR_BLUESYNC_SRC_BLUESYNC_BITFIELDS_H_
26
27#include "bluesync.h"
28
36bool is_bit_set(uint8_t *bitfield, size_t bit_index);
37
44void set_bit(uint8_t *bitfield, size_t bit_index);
45
56void bitwise_and_bitfields(uint8_t *result, const bluesync_timestamps_t *rcv, const bluesync_timestamps_t *local, size_t num_bytes);
57
67size_t count_set_bits(uint8_t *bitfield, size_t num_bytes);
68#endif /* ZEPHYR_BLUESYNC_SRC_BLUESYNC_BITFIELDS_H_ */
void bitwise_and_bitfields(uint8_t *result, const bluesync_timestamps_t *rcv, const bluesync_timestamps_t *local, size_t num_bytes)
Perform a bitwise AND between two bitfields and store the result.
size_t count_set_bits(uint8_t *bitfield, size_t num_bytes)
Count the number of bits set to 1 in a bitfield.
void set_bit(uint8_t *bitfield, size_t bit_index)
Set a specific bit in the bitfield.
bool is_bit_set(uint8_t *bitfield, size_t bit_index)
Check if a specific bit is set in the bitfield.
static struct local_time local
Definition local_time.c:53