-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathutils.h
34 lines (23 loc) · 901 Bytes
/
utils.h
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
// (C) 2018-2024 by Folkert van Heusden
// Released under MIT license
#include <ArduinoJson.h>
#include <optional>
#include <stdint.h>
#include <string>
#include <vector>
void setBit(uint16_t & v, const int bit, const bool vb);
int parity(int v);
#define sign(a) ( ( (a) < 0 ) ? -1 : ( (a) > 0 ) )
std::string format(const char *const fmt, ...);
std::vector<std::string> split(std::string in, std::string splitter);
unsigned long get_ms();
uint64_t get_us();
void myusleep(uint64_t us);
std::string get_thread_name();
void set_thread_name(std::string name);
ssize_t WRITE(int fd, const char *whereto, size_t len);
ssize_t READ(int fd, char *whereto, size_t len);
void update_word(uint16_t *const w, const bool msb, const uint8_t v);
void set_nodelay(const int fd);
std::string get_endpoint_name(const int fd);
std::optional<JsonDocument> deserialize_file(const std::string & filename);