|
|
|
@ -28,6 +28,7 @@ |
|
|
|
|
#include <Wire.h> |
|
|
|
|
#include <MIDI.h> |
|
|
|
|
#include <EEPROM.h> |
|
|
|
|
#include <SD.h> |
|
|
|
|
#include "midi_devices.hpp" |
|
|
|
|
#include "dexed.h" |
|
|
|
|
#include "dexed_sysex.h" |
|
|
|
@ -37,7 +38,6 @@ |
|
|
|
|
#include "PluginFx.h" |
|
|
|
|
#include "UI.hpp" |
|
|
|
|
#include "source_microdexed.h" |
|
|
|
|
#include <SD.h> |
|
|
|
|
|
|
|
|
|
// Audio engines
|
|
|
|
|
AudioSourceMicroDexed* MicroDexed[NUM_DEXED]; |
|
|
|
@ -217,9 +217,13 @@ uint32_t peak_l = 0; |
|
|
|
|
bool eeprom_update_flag = false; |
|
|
|
|
config_t configuration; |
|
|
|
|
uint8_t selected_dexed_instance = 0; |
|
|
|
|
const uint8_t cs_pins[] = { SDCARD_AUDIO_CS_PIN, SDCARD_TEENSY_CS_PIN }; |
|
|
|
|
/*const uint8_t cs_pins[] = { SDCARD_AUDIO_CS_PIN, SDCARD_TEENSY_CS_PIN };
|
|
|
|
|
const uint8_t mosi_pins[] = { SDCARD_AUDIO_MOSI_PIN, SDCARD_TEENSY_MOSI_PIN }; |
|
|
|
|
const uint8_t sck_pins[] = { SDCARD_AUDIO_SCK_PIN, SDCARD_TEENSY_SCK_PIN }; |
|
|
|
|
const uint8_t sck_pins[] = { SDCARD_AUDIO_SCK_PIN, SDCARD_TEENSY_SCK_PIN };*/ |
|
|
|
|
const uint8_t cs_pins[] = { SDCARD_TEENSY_CS_PIN, SDCARD_AUDIO_CS_PIN }; |
|
|
|
|
const uint8_t mosi_pins[] = { SDCARD_TEENSY_MOSI_PIN, SDCARD_AUDIO_MOSI_PIN }; |
|
|
|
|
const uint8_t sck_pins[] = { SDCARD_TEENSY_SCK_PIN, SDCARD_AUDIO_SCK_PIN }; |
|
|
|
|
char version_string[LCD_cols + 1]; |
|
|
|
|
|
|
|
|
|
#if defined(USE_FX) |
|
|
|
|
// Allocate the delay lines for chorus
|
|
|
|
@ -241,11 +245,13 @@ void setup() |
|
|
|
|
AudioNoInterrupts(); |
|
|
|
|
AudioMemory(AUDIO_MEM); |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.begin(SERIAL_SPEED); |
|
|
|
|
while (!Serial) |
|
|
|
|
{ |
|
|
|
|
yield(); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
pinMode(SDCARD_CS_PIN, OUTPUT); |
|
|
|
@ -256,13 +262,11 @@ void setup() |
|
|
|
|
setup_ui(); |
|
|
|
|
#else |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
//delay(320); // necessary, because before no serial output is done :(
|
|
|
|
|
Serial.println(F("NO LCD DISPLAY ENABLED!")); |
|
|
|
|
#endif |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
char version_string[LCD_cols + 1]; |
|
|
|
|
generate_version_string(version_string, sizeof(version_string)); |
|
|
|
|
|
|
|
|
|
Serial.println(F("MicroDexed based on https://github.com/asb2m10/dexed")); |
|
|
|
@ -384,10 +388,11 @@ void setup() |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// start SD card
|
|
|
|
|
sd_card = check_sd_cards(); |
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
change_disp_sd(false); |
|
|
|
|
#endif |
|
|
|
|
sd_card = check_sd_cards(); |
|
|
|
|
|
|
|
|
|
if (sd_card < 1) |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
@ -401,9 +406,6 @@ void setup() |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.println(F("SD card found.")); |
|
|
|
|
#endif |
|
|
|
|
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) |
|
|
|
|
{ |
|
|
|
|
// read all bank names
|
|
|
|
@ -656,6 +658,8 @@ void loop() |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
yield(); |
|
|
|
|
|
|
|
|
|
#if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) |
|
|
|
|
if (cpu_mem_millis >= SHOW_CPU_LOAD_MSEC) |
|
|
|
@ -1554,6 +1558,8 @@ uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https:/ |
|
|
|
|
void generate_version_string(char* buffer, uint8_t len) |
|
|
|
|
{ |
|
|
|
|
char tmp[3]; |
|
|
|
|
|
|
|
|
|
memset(buffer, 0, len); |
|
|
|
|
strncat(buffer, VERSION, len); |
|
|
|
|
#if defined(TEENSY3_5) |
|
|
|
|
strncat(buffer, "-3.5", 4); |
|
|
|
@ -1570,16 +1576,17 @@ void generate_version_string(char* buffer, uint8_t len) |
|
|
|
|
itoa (MAX_NOTES, tmp, 10); |
|
|
|
|
strncat(buffer, tmp, 2); |
|
|
|
|
#endif |
|
|
|
|
buffer[len - 1] = '\0'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef DISPLAY_LCD_SPI |
|
|
|
|
void change_disp_sd(bool disp) |
|
|
|
|
{ |
|
|
|
|
if (sd_card >= 0) |
|
|
|
|
if (sd_card > 0) |
|
|
|
|
{ |
|
|
|
|
digitalWrite(sd_card, disp); |
|
|
|
|
digitalWrite(U8X8_CS_PIN, !disp); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
uint8_t check_sd_cards(void) |
|
|
|
@ -1590,7 +1597,7 @@ uint8_t check_sd_cards(void) |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Checking CS pin ")); |
|
|
|
|
Serial.print(cs_pins[i]); |
|
|
|
|
Serial.print(cs_pins[i], DEC); |
|
|
|
|
Serial.println(F(" for SD card")); |
|
|
|
|
#endif |
|
|
|
|
SPI.setMOSI(mosi_pins[i]); |
|
|
|
@ -1598,6 +1605,10 @@ uint8_t check_sd_cards(void) |
|
|
|
|
|
|
|
|
|
if (SD.begin(cs_pins[i]) == true) |
|
|
|
|
{ |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Found. Using pin ")); |
|
|
|
|
Serial.println(cs_pins[i], DEC); |
|
|
|
|
#endif |
|
|
|
|
ret = cs_pins[i]; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|