libCATS
Loading...
Searching...
No Matches
util.h
Go to the documentation of this file.
1
6#ifndef CATS_UTIL_H
7#define CATS_UTIL_H
8
9#include <stdint.h>
10
11#define GET_BIT(byte, bit) (((byte) & (1 << (7-(bit)))) != 0)
12#define SET_BIT(byte, bit) (byte |= 1 << 7-bit)
13#define CLEAR_BIT(byte, bit) (byte &= ~(1 << 7-bit))
14#define FLIP_BIT(byte, bit) (byte ^= (1 << (7 - bit)))
15
16uint16_t float32_to_float16(float value);
17float float16_to_float32(uint16_t value);
18
19int32_t lat_to_int32(double lat);
20int32_t lon_to_int32(double lon);
21double int32_to_lat(int32_t lat);
22double int32_to_lon(int32_t lon);
23
24int16_t lat_to_int16(double lat);
25int16_t lon_to_int16(double lon);
26double int16_to_lat(int16_t lat);
27double int16_to_lon(int16_t lon);
28
29uint8_t cats_rssi_encode(float rssi);
30float cats_rssi_decode(uint8_t rssi);
31
32#endif // CATS_UTIL_H