Added I2rCS LCD library.

Added parts of additional MIDI ports - not readyyet.
chorus
Holger Wirtz 6 years ago
parent 63f42d7036
commit ac681b452d
  1. 88
      LiquidCrystalPlus_I2C.h
  2. 49
      MicroMDAPiano.ino
  3. 4
      config.h

@ -0,0 +1,88 @@
/*
MicroDexed
MicroDexed is a port of the Dexed sound engine
(https://github.com/asb2m10/dexed) for the Teensy-3.5/3.6 with audio shield.
Dexed ist heavily based on https://github.com/google/music-synthesizer-for-android
(c)2018 H. Wirtz <wirtz@parasitstudio.de>
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <LiquidCrystal_I2C.h> // https://www.arduinolibraries.info/libraries/liquid-crystal-i2-c
#ifndef LIQUIDCRYSTALPLUS_I2C_H_INCLUDED
#define LIQUIDCRYSTALPLUS_I2C_H_INCLUDED
#define STRING_BUF_SIZE 21
class LiquidCrystalPlus_I2C : public LiquidCrystal_I2C
{
public:
using LiquidCrystal_I2C::LiquidCrystal_I2C;
void show(uint8_t y, uint8_t x, uint8_t fs, char *str)
{
_show(y, x, fs, str, false, false);
}
void show(uint8_t y, uint8_t x, uint8_t fs, long num)
{
char _buf10[STRING_BUF_SIZE];
_show(y, x, fs, itoa(num, _buf10, 10), true, true);
}
private:
void _show(uint8_t pos_y, uint8_t pos_x, uint8_t field_size, char *str, bool justify_right, bool fill_zero)
{
{
char tmp[STRING_BUF_SIZE];
char *s = tmp;
uint8_t l = strlen(str);
memset(tmp, 0, sizeof(tmp));
if (fill_zero == true)
memset(tmp, '0', field_size);
else
memset(tmp, 0x20, field_size - 1); // blank
if (l > field_size)
l = field_size;
if (justify_right == true)
s += field_size - l;
strncpy(s, str, l);
setCursor(pos_x, pos_y);
print(tmp);
#ifdef DEBUG
Serial.print(pos_y, DEC);
Serial.print(F("/"));
Serial.print(pos_x, DEC);
Serial.print(F(": ["));
Serial.print(tmp);
Serial.println(F("]"));
#endif
}
}
};
#endif

@ -1,3 +1,28 @@
/*
MicroMDAEPiano
MicroDexed is a port of the Dexed sound engine
(https://github.com/asb2m10/dexed) for the Teensy-3.5/3.6 with audio shield.
Dexed ist heavily based on https://github.com/google/music-synthesizer-for-android
(c)2018 H. Wirtz <wirtz@parasitstudio.de>
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, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include <Audio.h> #include <Audio.h>
#include <Wire.h> #include <Wire.h>
#include <SPI.h> #include <SPI.h>
@ -7,14 +32,16 @@
#include <limits.h> #include <limits.h>
#include "mdaEPiano.h" #include "mdaEPiano.h"
#include "mdaEPianoData.h" #include "mdaEPianoData.h"
#include "config.h" #if defined(USBCON)
#include <midi_UsbTransport.h>
#endif
#ifdef USE_ONBOARD_USB_HOST #ifdef USE_ONBOARD_USB_HOST
#include <USBHost_t36.h> #include <USBHost_t36.h>
#endif #endif
#ifndef MASTER_KEY_MIDI // selecting sounds by encoder, button and display #ifndef MASTER_KEY_MIDI // selecting sounds by encoder, button and display
#include <Bounce.h> #include <Bounce.h>
#include <Encoder.h> #include <Encoder.h>
#include <LiquidCrystalPlus_I2C.h> #include "LiquidCrystalPlus_I2C.h"
#endif #endif
#ifndef MASTER_KEY_MIDI #ifndef MASTER_KEY_MIDI
@ -82,6 +109,12 @@ MIDI_CREATE_INSTANCE(HardwareSerial, MIDI_DEVICE, midi_serial);
USBHost usb_host; USBHost usb_host;
MIDIDevice midi_usb(usb_host); MIDIDevice midi_usb(usb_host);
#endif #endif
#if defined(USBCON)
static const unsigned sUsbTransportBufferSize = 16;
typedef midi::UsbTransport<sUsbTransportBufferSize> UsbTransport;
UsbTransport sUsbTransport;
MIDI_CREATE_INSTANCE(UsbTransport, sUsbTransport, midi_onboard_usb);
#endif
#ifdef TEST_NOTE #ifdef TEST_NOTE
IntervalTimer sched_note_on; IntervalTimer sched_note_on;
@ -102,8 +135,8 @@ void setup()
lcd.noAutoscroll(); lcd.noAutoscroll();
lcd.clear(); lcd.clear();
lcd.display(); lcd.display();
lcd.show(0, 0, 20, "MicroDexed"); lcd.show(0, 0, 20, "MicroMDAEPiano");
lcd.show(1, 0, 16, "(c)parasiTstudio");
enc1.write(INITIAL_ENC1_VALUE); enc1.write(INITIAL_ENC1_VALUE);
#endif #endif
@ -123,11 +156,19 @@ void setup()
// start up USB host // start up USB host
#ifdef USE_ONBOARD_USB_HOST #ifdef USE_ONBOARD_USB_HOST
usb_host.begin(); usb_host.begin();
Serial.println(F("USB-MIDI enabled."));
#endif
// check for onboard USB-MIDI
#if defined(USBCON)
midi_onboard_usb.begin();
Serial.println(F("Onboard USB-MIDI enabled."));
#endif #endif
#ifdef MIDI_DEVICE #ifdef MIDI_DEVICE
// Start serial MIDI // Start serial MIDI
midi_serial.begin(DEFAULT_MIDI_CHANNEL); midi_serial.begin(DEFAULT_MIDI_CHANNEL);
Serial.println(F("Serial MIDI enabled"));
#endif #endif
// start audio card // start audio card

@ -44,9 +44,11 @@
#else #else
#define NVOICES 16 // Yes #define NVOICES 16 // Yes
#endif #endif
#define USBCON 1 // enabling onboard MIDI via programing connector
#define MIDI_MERGE_THRU 1
// Master key handling (comment for disabling) // Master key handling (comment for disabling)
#define MASTER_KEY_MIDI MIDI_C7 //#define MASTER_KEY_MIDI MIDI_C7
#define MASTER_NUM1 MIDI_C2 #define MASTER_NUM1 MIDI_C2
// Debug output // Debug output

Loading…
Cancel
Save