FluxSand 1.0
FluxSand - Interactive Digital Hourglass
Loading...
Searching...
No Matches
bsp.hpp
1#pragma once
2
3#include <fcntl.h>
4#include <gpiod.h>
5#include <linux/spi/spidev.h>
6#include <sys/ioctl.h>
7#include <unistd.h>
8
9#include <chrono>
10#include <cmath>
11#include <cstdarg>
12#include <cstdint>
13#include <cstdio>
14#include <cstdlib>
15#include <cstring>
16#include <format>
17#include <iostream>
18#include <string>
19#include <thread>
20#include <type_traits>
21
22#ifndef M_PI
23#define M_PI 3.14159265358979323846f
24#endif
25
26#ifndef M_2PI
27#define M_2PI 6.28318530717958647692f
28#endif
29
30#ifndef M_1G
31#define M_1G 9.80665f
32#endif
33
34#ifndef GRAVITY
35#define GRAVITY 9.84f
36#endif
37
38#ifndef MAX
39#define MAX(a, b) ((a) > (b) ? (a) : (b))
40#endif
41
42#ifndef MIN
43#define MIN(a, b) ((a) < (b) ? (a) : (b))
44#endif
45
46#ifndef DEF2STR
47#define TO_STR(_arg) #_arg
48#define DEF2STR(_arg) TO_STR(_arg)
49#endif
50
51#ifndef UNUSED
52#define UNUSED(_x) ((void)(_x))
53#endif
54
55#ifndef OFFSET_OF
56#define OFFSET_OF(type, member) ((size_t)&((type *)0)->member)
57#endif
58
59#ifndef MEMBER_SIZE_OF
60#define MEMBER_SIZE_OF(type, member) \
61 (sizeof(std::remove_pointer_t<decltype(&((type *)0)->member)>))
62#endif
63
64#define CONTAINER_OF(ptr, type, member) \
65 ((type *)((char *)(ptr) - OFFSET_OF(type, member)))