Skip to content

Commit 1d1bbf3

Browse files
fix teensy compilation error using latest board version
added midi monitore feature to MIDI support and midi example
1 parent e217fa5 commit 1d1bbf3

File tree

10 files changed

+43
-26
lines changed

10 files changed

+43
-26
lines changed

examples/ml_midi_monitor/ml_midi_monitor.ino

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
* Received short MIDI messages will be displayed and decoded
3838
*/
3939

40+
#define MIDI_MONITOR_ENABLED
41+
4042
/*
4143
* The following configuration is for the RP2040, RP2350
4244
*/
@@ -158,8 +160,6 @@ void setup(void)
158160
Serial.println("ml_midi_monitor");
159161

160162
Midi_Setup();
161-
162-
163163
}
164164

165165
void loop_1hz(void)
@@ -174,10 +174,8 @@ void loop_1hz(void)
174174

175175
void loop(void)
176176
{
177-
178177
uint32_t newCnt = millis();
179178

180-
181179
static uint32_t lastCnt = 0;
182180
static uint32_t cnt = 0;
183181
cnt += newCnt - lastCnt;
@@ -189,6 +187,4 @@ void loop(void)
189187
}
190188

191189
Midi_Process();
192-
193-
194190
}

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ML_SynthTools",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"keywords": "ML_SynthTools, Synthesizer, Filter, Audio, ESP32, ESP32S2, ESP32S3, STM32, RP2040",
55
"description": "Synthesizer Tools; contains waveform generators etc.",
66
"repository":

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=ML SynthTools
2-
version=2.0.3
2+
version=2.0.4
33
author=Marcel Licence <[email protected]>
44
maintainer=Marcel Licence <[email protected]>
55
sentence=Synthesizer Tools

src/audio_module.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ void Audio_Setup(void)
188188
}
189189
#endif
190190

191-
192191
#ifdef ESP32_AUDIO_KIT
193192
#ifdef ES8388_ENABLED
194193
ES8388_Setup();
@@ -302,10 +301,11 @@ static int16_t *queueTransmitBuffer2;
302301
void Teensy_Setup()
303302
{
304303
Serial.printf("Teensy Setup\n");
305-
Serial.printf("\tBCK: 21\n");
306-
Serial.printf("\tLRCK: 20\n");
307-
Serial.printf("\tSDOUT: 7\n");
308-
Serial.printf("AudoBlockSamples: %d\n", AUDIO_BLOCK_SAMPLES);
304+
Serial.printf("BCLK1: 21 -> connect to BCLK\n");
305+
Serial.printf("LRCLK1: 20 -> connect to WCLK/LRCLK\n");
306+
Serial.printf("OUT1A: 7 -> connect to DIN\n");
307+
Serial.printf("IN1: 8 (optional connect to DOUT)\n");
308+
309309
Midi_Setup();
310310
}
311311

@@ -393,6 +393,11 @@ void Audio_PrintStats()
393393
#endif
394394
#endif
395395

396+
void Audio_Output(const Q1_14 *mono)
397+
{
398+
Audio_Output((const int16_t *)mono, (const int16_t *)mono);
399+
}
400+
396401
void Audio_OutputMono(const int32_t *samples)
397402
{
398403
#ifdef OUTPUT_SAW_TEST

src/caps_info.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,21 @@ void CapsPrintInfo(void)
9797
#ifdef SOC_CPU_HAS_FPU
9898
Serial.printf("Cpu has FPU\n");
9999
#endif
100+
#if defined(RP2350_PSRAM_CS)
101+
Serial.printf("PSRAM Size: %d\n", rp2040.getPSRAMSize());
102+
Serial.printf(" total PSRAM heap: %d\navailable PSRAM heap: %d\n", rp2040.getTotalPSRAMHeap(), rp2040.getFreePSRAMHeap());
103+
#endif
100104
}
101105

102106
void PrintMemoryInfo(void)
103107
{
104108
#ifdef ESP32
105-
Serial.printf("ESP.getFreeHeap() %d\n", ESP.getFreeHeap());
106-
Serial.printf("ESP.getMinFreeHeap() %d\n", ESP.getMinFreeHeap());
107-
Serial.printf("ESP.getHeapSize() %d\n", ESP.getHeapSize());
108-
Serial.printf("ESP.getMaxAllocHeap() %d\n", ESP.getMaxAllocHeap());
109+
Serial.printf("ESP.getFreeHeap() %" PRIu32 "\n", ESP.getFreeHeap());
110+
Serial.printf("ESP.getMinFreeHeap() %" PRIu32 "\n", ESP.getMinFreeHeap());
111+
Serial.printf("ESP.getHeapSize() %" PRIu32 "\n", ESP.getHeapSize());
112+
Serial.printf("ESP.getMaxAllocHeap() %" PRIu32 "\n", ESP.getMaxAllocHeap());
109113

110-
Serial.printf("Total PSRAM: %d\n", ESP.getPsramSize());
111-
Serial.printf("Free PSRAM: %d\n", ESP.getFreePsram());
114+
Serial.printf("Total PSRAM: %" PRIu32 "\n", ESP.getPsramSize());
115+
Serial.printf("Free PSRAM: %" PRIu32 "\n", ESP.getFreePsram());
112116
#endif
113117
}

src/es8388.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ void ES8388_Setup()
394394
Serial.printf("Connect to ES8388 codec...\n");
395395
Serial.printf(" SDA: %d\n ", ES8388_PIN_SDA);
396396
Serial.printf(" SCL: %d\n", ES8388_PIN_SCL);
397-
Serial.printf(" freq: %d\n", i2c_freq);
397+
Serial.printf(" freq: %" PRIu32 "\n", i2c_freq);
398398

399399
while (not ES8388_begin(ES8388_PIN_SDA, ES8388_PIN_SCL, i2c_freq))
400400
{

src/fs/fs_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454

5555
#include <FS.h>
56-
#if (defined ARDUINO_RUNNING_CORE) || (defined ARDUINO_RASPBERRY_PI_PICO) || (defined ARDUINO_ARCH_RP2040) || (defined ESP8266) /* tested with arduino esp32 core version 2.0.2 */
56+
#if defined(ARDUINO_RUNNING_CORE) || defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_ARCH_RP2040) || defined(ESP8266) /* tested with arduino esp32 core version 2.0.2 */
5757
#include <LittleFS.h> /* Using library LittleFS at version 2.0.0 from https://github.com/espressif/arduino-esp32 */
5858
#else
5959
#include <LITTLEFS.h> /* Using library LittleFS_esp32 at version 1.0.6 from https://github.com/lorol/LITTLEFS */

src/fs/fs_teensy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ uint32_t getFileFromIdx(File dir, int numTabs, uint32_t idx, char *filename, cha
141141

142142
bool getFileFromIdx(uint32_t idx, char *filename, char *filter)
143143
{
144-
File dir = SD.open("/", "r");
144+
File dir = SD.open("/", FILE_READ);
145145
char filename_clean[64];
146146

147147
bool result = getFileFromIdx(dir, 0, idx, filename_clean, filter) == 0 ? true : false;

src/midi_interface.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ void Midi_HandleShortMsgEx(uint8_t *data, uint8_t cable __attribute__((unused)))
7373
void Midi_SendShortMessage(uint8_t *msg);
7474
#ifndef ARDUINO_SEEED_XIAO_M0
7575
#ifndef SWAP_SERIAL
76+
#ifdef MIDI_TX2_PIN
77+
void Midi_SendShortMessage(uint8_t *msg);
7678
void Midi_SendRaw(uint8_t *msg);
77-
#endif
79+
#endif /* MIDI_TX2_PIN */
7880
#endif
7981
#endif
8082

@@ -136,7 +138,7 @@ struct midi_port_s
136138
uint8_t inMsgIndex ;
137139
};
138140

139-
#ifdef ARDUINO_DAISY_SEED
141+
#if (defined ARDUINO_DAISY_SEED) || (defined STM32H7xx)
140142
HardwareSerial Serial2(USART1);
141143
#endif
142144

@@ -567,16 +569,21 @@ void Midi_Setup()
567569
Serial2.begin(MIDI_SERIAL2_BAUDRATE);
568570
#endif /* MIDI_TX2_PIN */
569571

570-
#else /* MIDI_RX2_PIN */
572+
#else /* ARDUINO_ARCH_RP2040 */
573+
574+
#ifdef MIDI_RX2_PIN
571575
#ifdef MIDI_TX2_PIN
572576
Serial.printf("Setup Serial2 with %d baud with rx: %s%d and tx %s%d\n", MIDI_SERIAL2_BAUDRATE, PIN_CAPTION, MIDI_RX2_PIN, PIN_CAPTION, MIDI_TX2_PIN);
573577
Serial2.setTX(MIDI_TX2_PIN);
574578
#else /* MIDI_TX2_PIN */
575579
Serial.printf("Setup Serial2 with %d baud with rx: %s%d\n", MIDI_SERIAL2_BAUDRATE, PIN_CAPTION, MIDI_RX2_PIN);
576580
#endif /* MIDI_TX2_PIN */
577581
Serial2.setRX(MIDI_RX2_PIN);
578-
Serial2.begin(MIDI_SERIAL2_BAUDRATE);
582+
#else
583+
Serial.printf("Setup Serial2 with %d baud with rx: Serial2.rx\n", MIDI_SERIAL2_BAUDRATE, PIN_CAPTION);
579584
#endif /* MIDI_RX2_PIN */
585+
Serial2.begin(MIDI_SERIAL2_BAUDRATE);
586+
#endif /* ARDUINO_ARCH_RP2040 */
580587

581588
MidiPort2.serial = &Serial2;
582589
Midi_PortSetup(&MidiPort2);

src/ml_inline.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
* @brief This file includes all required header for inline build
3737
*/
3838

39+
#if !defined(ML_SYNTH_INLINE_DECLARATION) && !defined(ML_SYNTH_INLINE_DEFINITION)
40+
#define ML_SYNTH_INLINE_DECLARATION
41+
#define ML_SYNTH_INLINE_DEFINITION
42+
#endif
43+
3944
#include <audio_module.h>
4045
#include <blink.h>
4146
#include <es8388.h>

0 commit comments

Comments
 (0)