diff --git a/MicroDexed.ino b/MicroDexed.ino index 4a6197e..99b767b 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -92,12 +92,12 @@ AudioConnection patchCord24(stereomono1, 1, usb1, 1); #if defined(TEENSY_AUDIO_BOARD) AudioOutputI2S i2s1; AudioConnection patchCord25(stereomono1, 0, i2s1, 0); -AudioConnection patchCord26(stereomono1, 0, i2s1, 1); +AudioConnection patchCord26(stereomono1, 1, i2s1, 1); AudioControlSGTL5000 sgtl5000_1; #elif defined (I2S_AUDIO_ONLY) AudioOutputI2S i2s1; AudioConnection patchCord27(stereomono1, 0, i2s1, 0); -AudioConnection patchCord28(stereomono1, 0, i2s1, 1); +AudioConnection patchCord28(stereomono1, 1, i2s1, 1); #elif defined(TGA_AUDIO_BOARD) AudioOutputI2S i2s1; AudioConnection patchCord29(stereomono1, 0, i2s1, 0); @@ -252,7 +252,7 @@ void setup() #endif // start SD card -#ifndef __IMXRT1062__ +#ifndef TEENSY4 SPI.setMOSI(SDCARD_MOSI_PIN); SPI.setSCK(SDCARD_SCK_PIN); #endif diff --git a/config.h b/config.h index 18165e6..c42f371 100644 --- a/config.h +++ b/config.h @@ -30,6 +30,7 @@ // ATTENTION! For better latency you have to redefine AUDIO_BLOCK_SAMPLES from // 128 to 64 in /cores/teensy3/AudioStream.h +#define AUDIO_BLOCK_SAMPLES 64 // If you want to test the system with Linux and withous any keyboard and/or audio equipment, you can do the following: // 1. In Arduino-IDE enable "Tools->USB-Type->Serial + MIDI + Audio" @@ -38,6 +39,7 @@ // $ aplaymidi -p 20:0 # e.g. test.mid // $ arecord -f cd -Dhw:1,0 /tmp/bla.wav + #define VERSION "0.9.7" //************************************************************************************************* @@ -53,7 +55,8 @@ // AUDIO // If nothing is defined Teensy internal DAC is used as audio output device! -// Left and right channel audio signal is presented on pins A21 and A22.//#define AUDIO_DEVICE_USB +// Left and right channel audio signal is presented on pins A21 and A22. +//#define AUDIO_DEVICE_USB //#define TEENSY_DAC //#define TEENSY_DAC_SYMMETRIC //#define TEENSY_AUDIO_BOARD @@ -111,28 +114,37 @@ //* UI //************************************************************************************************* #define ENABLE_LCD_UI 1 +#define STANDARD_LCD_I2C +//#define OLED_SPI + + // LCD Display //I2C_DISPLAY only +#ifdef STANDARD_LCD_I2C #define LCD_I2C_ADDRESS 0x27 //#define LCD_I2C_ADDRESS 0x3f //Display size, must be set for U8X8 as well #define LCD_cols 16 #define LCD_rows 2 -//#define LCD_rows 4 +#define I2C_DISPLAY +// [I2C] SCL: Pin 19, SDA: Pin 18 (https://www.pjrc.com/teensy/td_libs_Wire.html) +//#define LCD_GFX 1 +#endif +#ifdef OLED_SPI +#define LCD_cols 16 +#define LCD_rows 4 //enable U8X8 support -//#define U8X8_DISPLAY +#define U8X8_DISPLAY //enable SPI CS switching -//#define DISPLAY_LCD_SPI -//#define U8X8_DISPLAY_CLASS U8X8_SSD1322_NHD_256X64_4W_HW_SPI +#define DISPLAY_LCD_SPI +#define U8X8_DISPLAY_CLASS U8X8_SSD1322_NHD_256X64_4W_HW_SPI //#define U8X8_DISPLAY_CLASS U8X8_SSD1306_128X64_NONAME_HW_I2C -//#define U8X8_CS_PIN 9 -//#define U8X8_DC_PIN 15 -//#define U8X8_RESET_PIN 14 -//Standard 16x2 LCD display (SPI/PCF8874) -#define I2C_DISPLAY -// [I2C] SCL: Pin 19, SDA: Pin 18 (https://www.pjrc.com/teensy/td_libs_Wire.html) -//#define LCD_GFX 1 +#define U8X8_CS_PIN 9 +#define U8X8_DC_PIN 15 +#define U8X8_RESET_PIN 14 +#endif + #define CONTROL_RATE_MS 50 #define BACK_FROM_VOLUME_MS 1000 @@ -150,15 +162,25 @@ //* HARDWARE SETTINGS //************************************************************************************************* +#if defined(__IMXRT1062__) //Teensy-4.0 +#define TEENSY4 +#endif + // Teensy Audio Shield: //#define SDCARD_CS_PIN 10 //#define SDCARD_MOSI_PIN 7 //#define SDCARD_SCK_PIN 14 #define SGTL5000_LINEOUT_LEVEL 29 +#ifndef TEENSY4 // Teensy 3.5 & 3.6 SD card #define SDCARD_CS_PIN BUILTIN_SDCARD #define SDCARD_MOSI_PIN 11 // not actually used #define SDCARD_SCK_PIN 13 // not actually used +#else +#define SDCARD_CS_PIN 10 +#define SDCARD_MOSI_PIN 11 // not actually used +#define SDCARD_SCK_PIN 13 // not actually used +#endif // Encoder with button #define ENCODER_USE_INTERRUPTS @@ -166,12 +188,15 @@ #define ENC_L_PIN_A 3 #define ENC_L_PIN_B 2 #define BUT_L_PIN 4 +#ifndef TEENSY4 #define ENC_R_PIN_A 28 #define ENC_R_PIN_B 29 #define BUT_R_PIN 30 -//#define ENC_R_PIN_A 6 -//#define ENC_R_PIN_B 5 -//#define BUT_R_PIN 8 +#else +#define ENC_R_PIN_A 6 +#define ENC_R_PIN_B 5 +#define BUT_R_PIN 8 +#endif #define BUT_DEBOUNCE_MS 20 #define LONG_BUTTON_PRESS 500