aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/rgblight_breathing_table_calc.c49
1 files changed, 0 insertions, 49 deletions
diff --git a/util/rgblight_breathing_table_calc.c b/util/rgblight_breathing_table_calc.c
deleted file mode 100644
index fc4d49ea5..000000000
--- a/util/rgblight_breathing_table_calc.c
+++ /dev/null
@@ -1,49 +0,0 @@
1//
2// calculate rgblight_effect_breathe_table[] values
3//
4// this is host program for quantum/rgblight.c:void rgblight_effect_breathing();
5//
6// example:
7// $ edit util/rgblight_breathing_table_calc.c
8// $ cc -o util/rgblight_breathing_table_calc util/rgblight_breathing_table_calc.c
9// $ ./util/rgblight_breathing_table_calc > keyboards/KEYBOARD_NAME/keymaps/KEYMAP_NAME/rgblight_breathe_table.h
10//
11#include <stdio.h>
12#include <math.h>
13#include <stdint.h>
14
15/// customize breeathing effect part ///////////////////////////
16#define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
17#define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
18////////////////////////////////////////////////////////////////
19
20int main(void) {
21 int pos, step;
22 int table[256];
23 for (pos = 0; pos < 256; pos ++ ) {
24 table[pos] = (uint8_t)(
25 (exp(sin((pos/255.0)*M_PI))- RGBLIGHT_EFFECT_BREATHE_CENTER/M_E)
26 * (RGBLIGHT_EFFECT_BREATHE_MAX/(M_E-1/M_E))
27 );
28 }
29 printf("#ifndef RGBLIGHT_EFFECT_BREATHE_TABLE\n");
30 printf("#define RGBLIGHT_EFFECT_BREATHE_TABLE\n\n");
31 printf("const uint8_t rgblight_effect_breathe_table[] PROGMEM = {\n");
32 printf(" /* #define RGBLIGHT_EFFECT_BREATHE_CENTER %.2f */\n", RGBLIGHT_EFFECT_BREATHE_CENTER);
33 printf(" /* #define RGBLIGHT_EFFECT_BREATHE_MAX %d */\n", RGBLIGHT_EFFECT_BREATHE_MAX);
34
35 for (int s = 0, step = (1<<s); s < 3 ; s += 1, step = (1<<s) ) {
36 printf("\n #if RGBLIGHT_BREATHE_TABLE_SIZE == %d\n",
37 s == 0 ? 256:(s== 1 ? 128: 64));
38 for (pos = 0; pos < 256; pos += step ) {
39 printf(" 0x%x%s", table[pos], (pos+step)>=256?"":"," );
40 if ((pos+step) % 8 == 0)
41 printf("\n");
42 }
43 printf(" #endif /* %d bytes table */\n", s == 0 ? 256:(s== 1 ? 128: 64));
44 }
45 printf("};\n");
46 printf("\nstatic const int table_scale = 256/sizeof(rgblight_effect_breathe_table);\n");
47 printf("\n#endif /* RGBLIGHT_EFFECT_BREATHE_TABLE */\n");
48 return 0;
49}