#ifndef LOOKUP_TABLES_H
#define LOOKUP_TABLES_H
#include <Arduino.h>
/*
Document for value calculus:
https://docs.google.com/spreadsheets/d/1UtXzdGsx8a0OHYvLXqKkCJ48qxz2pVwkHPIFW54Rmx0/edit?usp=sharing
*/
#define ARRAY_LEN 166
#if ARRAY_LEN%2 != 0
error("ARRAY_LEN must be divisible in 2")
#endif
#define PHASE180 ARRAY_LEN/2
#if ARRAY_LEN+PHASE180 > 255
error("define other index for second PWM and remove this error")
#endif
// D(t) = (1 + sin(2*pi*60*t)) / 2
static const uint8_t D[ARRAY_LEN] PROGMEM = {
128,
132,
137,
142,
147,
151,
156,
161,
166,
170,
175,
179,
183,
188,
192,
196,
200,
204,
208,
211,
215,
219,
222,
225,
228,
231,
234,
236,
239,
241,
243,
245,
247,
248,
250,
251,
252,
253,
254,
254,
255,
255,
255,
255,
254,
254,
253,
252,
251,
250,
248,
247,
245,
243,
241,
239,
236,
234,
231,
228,
225,
222,
219,
215,
211,
208,
204,
200,
196,
192,
188,
183,
179,
175,
170,
166,
161,
156,
151,
147,
142,
137,
132,
128,
123,
118,
113,
108,
104,
99,
94,
89,
85,
80,
76,
72,
67,
63,
59,
55,
51,
47,
44,
40,
36,
33,
30,
27,
24,
21,
19,
16,
14,
12,
10,
8,
7,
5,
4,
3,
2,
1,
1,
0,
0,
0,
0,
1,
1,
2,
3,
4,
5,
7,
8,
10,
12,
14,
16,
19,
21,
24,
27,
30,
33,
36,
40,
44,
47,
51,
55,
59,
63,
67,
72,
76,
80,
85,
89,
94,
99,
104,
108,
113,
118,
123
};
#endif