-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.h
220 lines (194 loc) · 8.54 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
String version = "0.9";
unsigned long LCDLastUpdated=0;
// LCD - using a sainSmart i2c LCD connected to 20/21 of my MEGA
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
// ShiftMatrixPWM handles the led matrix and connects to a group of 3 daisy chained 74hc595's to control RGB (columns) and a seperate 74hc595 (rows)
//Data pin is MOSI (atmega168/328: pin 11. Mega: 51)
//Clock pin is SCK (atmega168/328: pin 13. Mega: 52)
const int ShiftMatrixPWM_columnLatchPin=49;
const int ShiftMatrixPWM_rowDataPin=A15;
const int ShiftMatrixPWM_rowClockPin=A14;
const int ShiftMatrixPWM_rowLatchPin=A13;
const bool ShiftMatrixPWM_invertColumnOutputs = 0; // if invertColumnOutputs is 1, outputs will be active low. Usefull for common anode RGB led's.
const bool ShiftMatrixPWM_invertRowOutputs = 1; // if invertOutputs is 1, outputs will be active low. Used for PNP transistors.
unsigned char maxBrightness = 10;
unsigned char pwmFrequency = 60;
int numColumnRegisters = 3;
int numRows=4;
int numColumns = numColumnRegisters*8;
int numOutputs = numColumns*numRows;
int lastRow = 0;
int lastCol = 0;
// button -> tick mapping
boolean buttonMapping[4][8] =
{
{31,30,29,28,27,24,25,26},
{7,6,5,4,3,0,1,2},
{15,14,13,12,11,8,9,10},
{23,22,21,20,19,16,17,18},
};
// The key matrix connect to 74hc164 / 165 to shift in / out keys
const int keypadOutputClockPin=A9;
const int keypadOutputDataPin=A8;
// shiftout
int ploadPin = A11; // Connects to Parallel load pin the 165
int dataPin = A10; // Connects to the Q7 pin the 165
int clockPin = A12; // Connects to the Clock pin the 165
// navigation keys
int navploadPin = 26; // Connects to Parallel load pin the 165
int navdataPin = 22; // Connects to the Q7 pin the 165
int navclockPin = 24; // Connects to the Clock pin the 165
int encoderMapping[9][3] = {
// byte array row, then the actual bit (0,1) number position for that encoder
{0,2,3}, // ENC 1
{1,4,5}, // ENC 2
{2,7,6}, // ENC 3
{2,2,3}, // ENC 4
{0,5,6}, // ENC 5
{0,0,1}, // ENC 6
{1,1,2}, // ENC 7
{2,3,4}, // ENC 8
{3,1,2}, // ENC 9 - pattern knob
};
int encoderButtonMapping[9] = {
0, // ENC_B 1
9, // ENC_B 2
15, // ENC_B 3
23, // ENC_B 4
8, // ENC_B 5
0, // ENC_B 6
12, // ENC_B 7
20, // ENC_B 8
31 // ENC_B 9
};
int navButtonMapping[8] = {
27, // up
25, // down
28, // left
26, // right
25, // center
};
// Clock and Counter - all the bits the sequencer uses to track position / time / etc
int channels = 15;
int updateMatrix = 1;
int updateLCD = 1;
byte oldNavKeyValues[]={255,255,255,255};
byte newNavKeyValues[]={255,255,255,255};
unsigned long UILastUpdated=0;
unsigned long startTime = 0;
int gate[] = { 41,39,37, 35, 33, 31,29,27 };
// Default Song Data
boolean patternData[][5][32] =
{
{
{
1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0 }
, // Note on / off
{
C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3 }
, // Note Number
{
127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }
, // Velocity
{ 10 } // config - first is patch number
}
,
{
{
1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0 }
, // Note on / off
{
C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3 }
, // Note Number
{
127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }
, // Velocity
{
0 } // config
}
,
{
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
, // Note on / off
{
C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3 }
, // Note Number
{
127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }
, // Velocity
{
0 } // config
}
,
{
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
, // Note on / off
{
C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3 }
, // Note Number
{
127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }
, // Velocity
{
0 } // config
}
,
{
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
, // Note on / off
{
C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3 }
, // Note Number
{
127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }
, // Velocity
{
0 } // config
}
,
{
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
, // Note on / off
{
C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3 }
, // Note Number
{
127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }
, // Velocity
{
0 } // config
}
,
{
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
, // Note on / off
{
C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3 }
, // Note Number
{
127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }
, // Velocity
{
0 } // config
}
,
{
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
, // Note on / off
{
C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3, C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3,C+oct3 }
, // Note Number
{
127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127 }
, // Velocity
{
0 } // config
}
,
};