-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
646 lines (553 loc) · 18.7 KB
/
main.cpp
File metadata and controls
646 lines (553 loc) · 18.7 KB
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
#include <Arduino.h>
#include <U8g2lib.h>
#include <bitset>
#include <STM32FreeRTOS.h>
#include <algorithm>
#include <ES_CAN.h>
#include <iostream>
// Define the max() macro
#define max(a, b) ((a) > (b) ? (a) : (b))
//Constants
const uint32_t interval = 100; //Display update interval
//Pin definitions
//Row select and enable
const int RA0_PIN = D3;
const int RA1_PIN = D6;
const int RA2_PIN = D12;
const int REN_PIN = A5;
//Matrix input and output
const int C0_PIN = A2;
const int C1_PIN = D9;
const int C2_PIN = A6;
const int C3_PIN = D1;
const int OUT_PIN = D11;
//Audio analogue out
const int OUTL_PIN = A4;
const int OUTR_PIN = A3;
//Joystick analogue in
const int JOYY_PIN = A0;
const int JOYX_PIN = A1;
//Output multiplexer bits
const int DEN_BIT = 3;
const int DRST_BIT = 4;
const int HKOW_BIT = 5;
const int HKOE_BIT = 6;
//Display driver object
U8G2_SSD1305_128X32_NONAME_F_HW_I2C u8g2(U8G2_R0);
//Check current step size
volatile uint32_t currentStepSize;
volatile uint8_t keyArray[7];
const int NUM_ROWS = 4; // define a constant for the number of rows
std::string keyStrArray[7];
SemaphoreHandle_t keyArrayMutex;
SemaphoreHandle_t RXMutex;
SemaphoreHandle_t CAN_TX_Semaphore;
volatile int rotationVar = 0;
volatile int octaveVar = 0;
std::string prevKnob3 = "00";
std::string prevKnob2 = "00";
int knob3Rotation = 0;
int knob2Rotation = 0;
QueueHandle_t msgInQ;
uint8_t RX_Message[8]={0};
QueueHandle_t msgOutQ;
std::string prevKeyArray[7] = {"1111", "1111", "1111", "1111", "1111", "1111", "1111"};
int OCTAVE = 4;
uint8_t GLOBAL_RX_Message[8]={0};
std::string keyStr = "0000";
// volatile uint32_t localCurrentStepSize;
const std::string keyValues[NUM_ROWS][4] = {
{"0111", "1011", "1101", "1110"},
{"0111", "1011", "1101", "1110"},
{"0111", "1011", "1101", "1110"}
};
const std::string noteNames[NUM_ROWS][4] = {
{"C4", "C#4", "D4", "D#4"},
{"E4", "F4", "F#4", "G4"},
{"G#4", "A4", "A#4", "B4"}
};
//Function to set outputs using key matrix
void setOutMuxBit(const uint8_t bitIdx, const bool value) {
digitalWrite(REN_PIN,LOW);
digitalWrite(RA0_PIN, bitIdx & 0x01);
digitalWrite(RA1_PIN, bitIdx & 0x02);
digitalWrite(RA2_PIN, bitIdx & 0x04);
digitalWrite(OUT_PIN,value);
digitalWrite(REN_PIN,HIGH);
delayMicroseconds(2);
digitalWrite(REN_PIN,LOW);
}
// Function to concatenate bits
uint8_t concatenateBits(int c0, int c1, int c2, int c3){
uint8_t result = 0;
result |= (c0 << 3);
result |= (c1 << 2);
result |= (c2 << 1);
result |= c3;
return result;
}
//Function to read the inputs from the four columns of the switch matrix (C0,1,2,3) and return the four bits concatenated together as a single byte
uint8_t readCols(){
int c0state = digitalRead(C0_PIN);
int c1state = digitalRead(C1_PIN);
int c2state = digitalRead(C2_PIN);
int c3state = digitalRead(C3_PIN);
// Call the concatenateBits() function with the read states
uint8_t cols = concatenateBits(c0state, c1state, c2state, c3state);
return cols;
}
//Select a given row of the switch matrix by setting the value of each row select address pin
void setRow(uint8_t rowIdx){
digitalWrite(REN_PIN,LOW);
digitalWrite(RA0_PIN, rowIdx & 0b001);
digitalWrite(RA1_PIN, rowIdx & 0b010);
digitalWrite(RA2_PIN, rowIdx & 0b100);
digitalWrite(REN_PIN,HIGH);
}
void decodeKnob3(){
std::string currentKnob3 = keyStrArray[3].substr(0, 2);
//Serial.println(keyStrArray[3]);
if (prevKnob3 == "00" && currentKnob3 == "01"){
rotationVar = -1;
}
else if (prevKnob3 == "01" && currentKnob3 == "00"){
rotationVar = 1;
}
else if (prevKnob3 == "10" && currentKnob3 == "11"){
rotationVar = 1;
}
else if (prevKnob3 == "11" && currentKnob3 == "10"){
rotationVar = -1;
}
else{
rotationVar = 0;
}
knob3Rotation += rotationVar;
if (knob3Rotation > 8){
knob3Rotation = 8;
}
else if (knob3Rotation < 0){
knob3Rotation = 0;
}
prevKnob3 = currentKnob3;
}
void decodeKnob2(){
std::string currentKnob2 = keyStrArray[3].substr(2, 4);
//Serial.println(keyStrArray[3]);
if (prevKnob2 == "00" && currentKnob2 == "01"){
octaveVar = -1;
}
else if (prevKnob2 == "01" && currentKnob2 == "00"){
octaveVar = 1;
}
else if (prevKnob2 == "10" && currentKnob2 == "11"){
octaveVar = 1;
}
else if (prevKnob2 == "11" && currentKnob2 == "10"){
octaveVar = -1;
}
else{
octaveVar = 0;
}
knob2Rotation += octaveVar;
if (knob2Rotation > 8){
knob2Rotation = 8;
}
else if (knob2Rotation < 0){
knob2Rotation = 0;
}
OCTAVE = knob2Rotation;
prevKnob2 = currentKnob2;
}
// const uint32_t stepSizes [] = {
// /*
// 1ull << 32 shift the value 1 to the left by 32 bits,setting the 33rd bit to 1.
// This creates a 64-bit binary number of 2ˆ32
// Using this to obtain a constant that represents one full cycle of a sine wave in the phase accumulator
// use 1ull << 32 instead of 2^32 directly to ensure that the result is a 64-bit integer with the most significant bit set to 1.
// */
// (uint32_t)((1ull << 32) * 261.63 / 22000), //C4
// (uint32_t)((1ull << 32) * 277.18 / 22000), //C#4
// (uint32_t)((1ull << 32) * 293.66 / 22000), //D4
// (uint32_t)((1ull << 32) * 311.13 / 22000), //D#4
// (uint32_t)((1ull << 32) * 329.63 / 22000), //E4
// (uint32_t)((1ull << 32) * 349.23 / 22000), //F4
// (uint32_t)((1ull << 32) * 369.99 / 22000), //F#4
// (uint32_t)((1ull << 32) * 392.00 / 22000), //G4
// (uint32_t)((1ull << 32) * 415.30 / 22000), //G#4
// (uint32_t)((1ull << 32) * 440.00 / 22000), //A4
// (uint32_t)((1ull << 32) * 466.16 / 22000), //A#4
// (uint32_t)((1ull << 32) * 493.88 / 22000), //B4
// };
const uint32_t stepSizes [] = {
51076922, //C4
54112683, //C#4
57330004, //D4
60740598, //D#4
64352275, //E4
68178701, //F4
72231588, //F#4
76528508, //G4
81077269, //G#4
85899345, //A4
91006452, //A#4
96426316, //B4
};
// const uint32_t frequencies [] = {
// 261.63, //C4
// 277.18, //C#4
// 293.66, //D4
// 311.13, //D#4
// 329.63, //E4
// 349.23, //F4
// 369.99, //F#4
// 392.00, //G4
// 415.30, //G#4
// 440.00, //A4
// 466.16, //A#4
// 493.88, //B4
// }
// uint32_t freqToStep(uint32_t freq[]){
// uint32_t average = 0;
// for (int i = 0; i < sizeof(freq)/sizeof(freq[0]); i++){
// average += freq[i];
// }
// average /= sizeof(freq)/sizeof(freq[0]);
// uint32_t stepSize = (uint32_t)((1ull << 32) * average / 22000);
// return stepSize;
// }
void sampleISR() {
static uint32_t phaseAcc = 0;
phaseAcc += currentStepSize;
int32_t Vout = (phaseAcc >> 24) - 128;
Vout = Vout >> (8 - knob3Rotation);
analogWrite(OUTR_PIN, (Vout + 128));
// Serial.println(currentStepSize);
}
// void checkKeyPress(){
// // uint8_t TX_Message[8] = {0};
// uint8_t TX_Message[8];
// TX_Message[1] = OCTAVE;
// for (int row = 0; row < NUM_ROWS ; row++){
// for (int col = 0; col < 5; col++){
// if (keyStrArray[row][col] != prevKeyArray[row][col]){
// if (prevKeyArray[row][col] == '1'){
// TX_Message[0] = 80;
// }
// else if (prevKeyArray[row][col] == '0'){
// TX_Message[0] = 82;
// }
// TX_Message[2] = row*4 + col;
// }
// }
// }
// // Serial.println(TX_Message[2]);
// std::copy(keyStrArray, keyStrArray + sizeof(keyStrArray)/sizeof(keyStrArray[0]), prevKeyArray);
// // CAN_TX(0x123, TX_Message);
// // Serial.println(TX_Message[0]);
// }
uint32_t chords(std::string keyStr){
int zeroCount = 0;
uint32_t sum = 0;
uint32_t localCurrentStepSize = 0;
for (int i = 0; i < 12; i++){
if (keyStr[i] == '0'){
zeroCount++;
localCurrentStepSize = stepSizes[i];
localCurrentStepSize = localCurrentStepSize << (OCTAVE - 4);
sum += localCurrentStepSize;
}
}
if (zeroCount != 0){
sum /= zeroCount;
}
return sum;
}
void scanKeysTask(void * pvParameters){
Serial.println("SCAN");
const TickType_t xFrequency = 20/portTICK_PERIOD_MS;
TickType_t xLastWakeTime = xTaskGetTickCount();
uint8_t TX_Message[8] = {0};
while(1){
// Serial.println("SCAN");
vTaskDelayUntil( &xLastWakeTime, xFrequency);
// const int NUM_ROWS = 3; // define a constant for the number of rows
uint32_t localCurrentStepSizeT = 0;
uint32_t localCurrentStepSizeR = 0;
uint32_t localCurrentStepSize = 0;
for (int row = 0; row < NUM_ROWS; row++){
setRow(row);
delayMicroseconds(3);
uint8_t keys = readCols();
std::bitset<4> keyBits(keys);
std::string keyString = keyBits.to_string();
keyStrArray[row] = keyString;
keyArray[row] = keys;
// for (int col = 0; col < 4; col++){
// xSemaphoreTake(keyArrayMutex, portMAX_DELAY);
// if (keyStrArray[row] == keyValues[row][col]) {
// localCurrentStepSizeT = stepSizes[row * 4 + col];
// localCurrentStepSizeT = localCurrentStepSizeT << (OCTAVE - 4);
// // if (OCTAVE < 4)
// // localCurrentStepSizeT = localCurrentStepSizeT >> (OCTAVE - 4);
// // else if (OCTAVE > 4){
// // localCurrentStepSizeT = localCurrentStepSizeT << (OCTAVE - 4);
// // }
// }
// xSemaphoreGive(keyArrayMutex);
// }
}
keyStr = keyStrArray[0]+ keyStrArray[1] + keyStrArray[2] + keyStrArray[3];
int zeroCount = 0;
uint32_t sum = 0;
for (int i = 0; i < 12; i++){
if (keyStr[i] == '0'){
zeroCount++;
localCurrentStepSizeT = stepSizes[i];
localCurrentStepSizeT = localCurrentStepSizeT << (OCTAVE - 4);
sum += localCurrentStepSizeT;
}
}
if (zeroCount != 0){
sum /= zeroCount;
}
// currentStepSize = localCurrentStepSize;
// this was checkeypress
// uint8_t TX_Message[8];
// TX_Message[1] = OCTAVE;
// for (int row = 0; row < NUM_ROWS-1 ; row++){
// for (int col = 0; col < 5; col++){
// if (keyStrArray[row][col] != prevKeyArray[row][col]){
// if (prevKeyArray[row][col] == '1'){
// TX_Message[0] = 80;
// }
// // else if (prevKeyArray[row][col] == '0'){
// // TX_Message[0] = 82;
// // }
// else if (prevKeyArray[row][col] == '0'){
// TX_Message[0] = 82;
// }
// TX_Message[2] = row*4 + col;
// }
// }
// }
// if (TX_Message[0] == 80){
// // localCurrentStepSizeT += localCurrentStepSizeT;
// // __atomic_store_n(¤tStepSize, localCurrentStepSizeT, __ATOMIC_RELAXED);
// }
// else if (TX_Message[0] == 82){
// __atomic_store_n(¤tStepSize, 0, __ATOMIC_RELAXED);
// }
xSemaphoreTake(RXMutex, portMAX_DELAY);
for (int i = 0; i < 4; i++){
// detect press messages
if (RX_Message[0] == 80){
// Serial.println("Pressed");
localCurrentStepSizeR = stepSizes[RX_Message[2]];
localCurrentStepSizeR = localCurrentStepSizeR << (RX_Message[1] - 4);
// __atomic_store_n(¤tStepSize, localCurrentStepSizeR, __ATOMIC_RELAXED);
// Serial.println(localCurrentStepSizeR);
}
// detect release messages
else if (RX_Message[0] == 82){
// currentStepSize = 0;
// localCurrentStepSize = 0;
// Serial.println("Released");
}
}
xSemaphoreGive(RXMutex);
localCurrentStepSize = (localCurrentStepSizeR + sum);
__atomic_store_n(¤tStepSize, localCurrentStepSize, __ATOMIC_RELAXED);
// if (TX_Message[0] == 82 && RX_Message[0] == 82){
// __atomic_store_n(¤tStepSize, 0, __ATOMIC_RELAXED);
// }
// Serial.println(TX_Message[2]);
std::copy(keyStrArray, keyStrArray + sizeof(keyStrArray)/sizeof(keyStrArray[0]), prevKeyArray);
// xQueueSend( msgOutQ, TX_Message, portMAX_DELAY);
// CAN_TX(0x123, TX_Message);
// Serial.println(TX_Message[0]);
decodeKnob3();
decodeKnob2();
// Serial.print("local:");
// Serial.println(TX_Message[2]);
// std::string currentKnob3 = keyStrArray[3].substr(0, 2);
// Serial.println(keyStrArray[3].substr(0,2).c_str());
// Serial.println(knob3Rotation);
}
}
void displayUpdateTask(void * pvParameters){
Serial.println("DISPLAY");
const TickType_t xFrequency = 50/portTICK_PERIOD_MS;
TickType_t xLastWakeTime = xTaskGetTickCount();
uint32_t ID = 0x123;
while(1){
// Serial.println("DISPLAY");
vTaskDelayUntil( &xLastWakeTime, xFrequency);
u8g2.clearBuffer(); // clear the internal memory
u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
// u8g2.drawStr(2,10,"Hello World!"); // write something to the internal memory
u8g2.drawStr(2,10, keyStr.c_str());
u8g2.setCursor(2,20);
xSemaphoreTake(RXMutex, portMAX_DELAY);
u8g2.print((char) RX_Message[0]);
u8g2.print(RX_Message[1]);
u8g2.print(RX_Message[2]);
xSemaphoreGive(RXMutex);
// u8g2.setCursor(2,40);
std::string vol = "Vol: " + std::to_string(knob3Rotation);
u8g2.drawStr(66,30, vol.c_str());
std::string octave = "Octave: " + std::to_string(OCTAVE);
u8g2.drawStr(2,30, octave.c_str());
// while (CAN_CheckRXLevel()){
// // CAN_RX(ID, RX_Message);
// }
// std::cout<<RX_Message[0]<<std::endl;
u8g2.sendBuffer();
}
}
void decodeTask(void * pvParameters){
Serial.println("DECODE");
uint32_t ID = 0x123;
uint32_t localCurrentStepSize;
uint8_t Local_RX_Message[8];
// Serial.println("DECODE");
while (1){
xSemaphoreTake(RXMutex, portMAX_DELAY);
xQueueReceive(msgInQ, Local_RX_Message, portMAX_DELAY);
memcpy(RX_Message, Local_RX_Message, sizeof(RX_Message));
// Serial.print("rec:");
// Serial.println(RX_Message[2]);
// mem(RX_Message, RX_Message + sizeof(RX_Message)/sizeof(RX_Message), Local_RX_Message);
xSemaphoreGive(RXMutex);
// Serial.print("Global: ");
// Serial.println(RX_Message[1]);
// xSemaphoreTake(RXMutex, portMAX_DELAY);
// for (int i = 0; i < 4; i++){
// // detect press messages
// if (RX_Message[0] == 80){
// // Serial.println("Pressed");
// localCurrentStepSize = stepSizes[RX_Message[2]] ;
// localCurrentStepSize << (RX_Message[1] - 4);
// // __atomic_store_n(¤tStepSize, localCurrentStepSize, __ATOMIC_RELAXED);
// }
// // detect release messages
// else if (RX_Message[0] == 82){
// // currentStepSize = 0;
// // Serial.println("Released");
// }
// }
// xSemaphoreGive(RXMutex);
}
}
void CAN_RX_ISR (void) {
uint8_t RX_Message_ISR[8];
uint32_t ID = 0x123;
CAN_RX(ID, RX_Message_ISR);
xQueueSendFromISR(msgInQ, RX_Message_ISR, NULL);
}
void CAN_TX_Task (void * pvParameters) {
Serial.println("CAN");
uint8_t msgOut[8];
while (1) {
xQueueReceive(msgOutQ, msgOut, portMAX_DELAY);
xSemaphoreTake(CAN_TX_Semaphore, portMAX_DELAY);
CAN_TX(0x123, msgOut);
}
}
void CAN_TX_ISR (void) {
xSemaphoreGiveFromISR(CAN_TX_Semaphore, NULL);
}
void setup() {
// put your setup code here, to run once:
msgInQ = xQueueCreate(36,8);
msgOutQ = xQueueCreate(36,8);
keyArrayMutex = xSemaphoreCreateMutex();
RXMutex = xSemaphoreCreateMutex();
CAN_TX_Semaphore = xSemaphoreCreateCounting(3,3);
//Set pin directions
pinMode(RA0_PIN, OUTPUT);
pinMode(RA1_PIN, OUTPUT);
pinMode(RA2_PIN, OUTPUT);
pinMode(REN_PIN, OUTPUT);
pinMode(OUT_PIN, OUTPUT);
pinMode(OUTL_PIN, OUTPUT);
pinMode(OUTR_PIN, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
pinMode(C0_PIN, INPUT);
pinMode(C1_PIN, INPUT);
pinMode(C2_PIN, INPUT);
pinMode(C3_PIN, INPUT);
pinMode(JOYX_PIN, INPUT);
pinMode(JOYY_PIN, INPUT);
//Initialise display
setOutMuxBit(DRST_BIT, LOW); //Assert display logic reset
delayMicroseconds(2);
setOutMuxBit(DRST_BIT, HIGH); //Release display logic reset
u8g2.begin();
setOutMuxBit(DEN_BIT, HIGH); //Enable display power supply
CAN_Init(false);
CAN_RegisterRX_ISR(CAN_RX_ISR);
// CAN_RegisterTX_ISR(CAN_TX_ISR);
setCANFilter(0x123,0x7ff);
CAN_Start();
//Initialise UART
Serial.begin(9600);
// Serial.println("Hello World");
TIM_TypeDef *Instance = TIM1;
HardwareTimer *sampleTimer = new HardwareTimer(Instance);
sampleTimer->setOverflow(22000, HERTZ_FORMAT);
sampleTimer->attachInterrupt(sampleISR);
sampleTimer->resume();
TaskHandle_t scanKeysHandle = NULL;
xTaskCreate(
scanKeysTask, /* Function that implements the task */
"scanKeys", /* Text name for the task */
64, /* Stack size in words, not bytes */
NULL, /* Parameter passed into the task */
4, /* Task priority */
&scanKeysHandle ); /* Pointer to store the task handle */
TaskHandle_t displayUpdateHandle = NULL;
xTaskCreate(
displayUpdateTask, /* Function that implements the task */
"displayUpdate", /* Text name for the task */
256, /* Stack size in words, not bytes */
NULL, /* Parameter passed into the task */
3, /* Task priority */
&displayUpdateHandle ); /* Pointer to store the task handle */
TaskHandle_t decodeHandle = NULL;
xTaskCreate(
decodeTask, /* Function that implements the task */
"decode", /* Text name for the task */
32, /* Stack size in words, not bytes */
NULL, /* Parameter passed into the task */
1, /* Task priority */
&decodeHandle ); /* Pointer to store the task handle */
TaskHandle_t CAN_TXHandle = NULL;
xTaskCreate(
CAN_TX_Task, /* Function that implements the task */
"CAN_TX", /* Text name for the task */
32, /* Stack size in words, not bytes */
NULL, /* Parameter passed into the task */
2, /* Task priority */
&CAN_TXHandle ); /* Pointer to store the task handle */
// Serial.print((uint32_t)((1ull << 32) * 261.63 / 22000)); //C4
// Serial.println((uint32_t)((1ull << 32) * 277.18 / 22000)); //C#4
// Serial.println((uint32_t)((1ull << 32) * 311.13 / 22000)); //D#4
// Serial.println((uint32_t)((1ull << 32) * 329.63 / 22000)); //E4
// Serial.println((uint32_t)((1ull << 32) * 293.66 / 22000); //D4
// Serial.println((uint32_t)((1ull << 32) * 349.23 / 22000); //F4
// Serial.println((uint32_t)((1ull << 32) * 369.99 / 22000);//F#4
// Serial.println((uint32_t)((1ull << 32) * 392.00 / 22000));//G4
// Serial.println((uint32_t)((1ull << 32) * 415.30 / 22000));//G#4
// Serial.println((uint32_t)((1ull << 32) * 440.00 / 22000)); //A4
// Serial.println((uint32_t)((1ull << 32) * 466.16 / 22000));//A#4
// Serial.println((uint32_t)((1ull << 32) * 493.88 / 22000)); //B4)
for (int i = 0; i < 11 ; i++) {
Serial.println (stepSizes[i]);
}
vTaskStartScheduler();
}
void loop() {
// Serial.println(currentStepSize);
// delay (1);
}