This repository has been archived by the owner on Oct 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.h
150 lines (115 loc) · 5.76 KB
/
config.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
* Copyright (C) 2020 Patrick Pedersen
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Author: Patrick Pedersen <[email protected]>
* Description: Configuration file for the Not-so-Tiny dimmer firmware.
*
*/
#include <stdlib.h>
#include "conifg_enums.h"
#include "ws2812.h"
#include "strip.h"
#include "patch_macros.h"
//////////////////////////////
// Non-Addressable RGB Strip
//////////////////////////////
// #define STRIP_TYPE NON_ADDR
// #define NON_ADDR_STRIP_R PB0 // Red LED pin (must support PWM)
// #define NON_ADDR_STRIP_G PB1 // Green LED pin (must support PWM)
// #define NON_ADDR_STRIP_B PB4 // Blue LED pin (must support PWM)
//////////////////////////////
// WS2812
//////////////////////////////
#define STRIP_TYPE WS2812
#define WS2812_DIN 7 // WS2812 DIN pin
#define WS2812_COLOR_ORDER GRB // Order in which color should be parsed to the strip (Most WS2812 strips use BGR)
#define WS2812_RESET_TIME 50 // Time required for the WS2812 to reset
// If runtime between strip writes exceeds the
// necessary reset time, this may be set to 0
//////////////////////////////
// Potentiometer
//////////////////////////////
#define BRIGHTNESS_POT A1 // Potentiometer input analog pin
// #define INVERT_POT // Uncomment if pot is inverted
// #define ADC_AVG_SAMPLES XX // Max 255 - Number of samples used to determine the average potentiometer value.
// Increase this if the LED strip is noisy, especially at lower settings.
// Higher values will reserve more runtime
// Set to <= 1 or comment out to disable
// #define POT_LOWER_BOUND XX // Max 255 - Any potentiometer value lower or equal to the lower bound will be registered as 0
// Set to 0 or comment out to disable
// #define POT_UPPER_BOUND XX // Max 255 - Any potentiometer value lower or equal to the lower bound will be registered as 255
//////////////////////////////
// CV Input
//////////////////////////////
#define CV_INPUT A0 // CV input analog pin
//////////////////////////////
// Push Button
//////////////////////////////
#define BTN 6 // Push button pin
#define BTN_DEBOUNCE_TIME 10 // ms - Time to wait for button to debounce. Increasing this will reduce false trigger due to
// bouncing, but add a slight delay to color toggling.
// Set to 0 or comment out to disable
////////////////////////
// Patches
////////////////////////
// For a list of available patches, please refer to the
// patch_macros.h header
#define NUM_PATCHES 1 // Max 10 (To increase, add cases to update_strip() in main.c)
// Plain white
#define PATCH_0 PATCH_ANIMATION_FADE_ON_RISE(255, 0, 0, 0, 255)
// First strip half white, second off
#define PATCH_1 PATCH_DISTRIBUTE ( \
RGB_ARRAY ( \
{255, 255, 255}, \
{0, 0, 0} \
) \
)
// First strip half off, second white
#define PATCH_2 PATCH_DISTRIBUTE ( \
RGB_ARRAY ( \
{0, 0, 0}, \
{255, 255, 255} \
) \
)
// First strip half pink, second cyan
#define PATCH_3 PATCH_DISTRIBUTE ( \
RGB_ARRAY ( \
{10, 255, 202}, \
{255, 20, 127} \
) \
)
// First strip half purple, second beige
#define PATCH_4 PATCH_DISTRIBUTE ( \
RGB_ARRAY ( \
{255, 74, 33}, \
{151, 0, 255} \
) \
)
// Cyan white rain effect with potentiometer intensity control
#define PATCH_5 \
if (rand() % 2) { \
PATCH_ANIMATION_RAIN_POT_CTRL(0, 255, 255) \
} else { \
PATCH_ANIMATION_RAIN_POT_CTRL(255, 0, 255) \
} \
#define PATCH_6 PATCH_ANIMATION_OVERRIDE_ARR_POT_CTRL ( \
RGB_ARRAY ( \
{10, 255, 202}, \
{255, 20, 127} \
) \
)
// Rotating rainbow animation
#define PATCH_7 PATCH_ANIMATION_ROTATE_RAINBOW_POT_CTRL(10)
#define PATCH_8 PATCH_ANIMATION_RAINBOW_POT_CTRL
// Halves swapping with potentiometer speed control
#define PATCH_9 PATCH_ANIMATION_SWAP_POT_CTRL((uint8_t) (rand() % 256), (uint8_t) (rand() % 256), (uint8_t) (rand() % 256), 0, 0, 0)