testing serial uart for midi

pull/19/head
midilab 1 year ago
parent 9fa22a3210
commit 66e40ff420
  1. 27
      examples/ESP32UartMasterMidiClock/ESP32UartMasterMidiClock.ino
  2. 14
      examples/ESP32UsbMasterMidiClock/debug.cfg
  3. 19
      examples/ESP32UsbMasterMidiClock/debug_custom.json
  4. 46087
      examples/ESP32UsbMasterMidiClock/esp32.svd
  5. 26
      src/uClock.cpp

@ -1,6 +1,6 @@
/* USB MIDI Sync Box /* Uart MIDI Sync Box
* *
* This example demonstrates how to change the USB MIDI * This example demonstrates how to change the Uart MIDI
* device name on ESP32 family. * device name on ESP32 family.
* *
* This example code is in the public domain. * This example code is in the public domain.
@ -8,17 +8,15 @@
* ... * ...
* *
*/ */
//#include <Adafruit_TinyUSB.h>
//#include <MIDI.h>
//Adafruit_USBD_MIDI usb_midi;
//MIDI_CREATE_INSTANCE(Adafruit_USBD_MIDI, usb_midi, MIDI_USB);
//MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);
#include <uClock.h> #include <uClock.h>
// MIDI clock, start and stop byte definitions - based on MIDI 1.0 Standards.
#define MIDI_CLOCK 0xF8
#define MIDI_START 0xFA
#define MIDI_STOP 0xFC
// the blue led // the blue led
int LED_BUILTIN = 2; #define LED_BUILTIN 2
uint8_t bpm_blink_timer = 1; uint8_t bpm_blink_timer = 1;
void handle_bpm_led(uint32_t tick) void handle_bpm_led(uint32_t tick)
@ -38,20 +36,21 @@ void handle_bpm_led(uint32_t tick)
// Internal clock handlers // Internal clock handlers
void ClockOut96PPQN(uint32_t tick) { void ClockOut96PPQN(uint32_t tick) {
// Send MIDI_CLOCK to external gears // Send MIDI_CLOCK to external gears
//MIDI_USB.sendRealTime(midi::Clock); //Serial.write(MIDI_CLOCK);
handle_bpm_led(tick); handle_bpm_led(tick);
} }
void onClockStart() { void onClockStart() {
//MIDI_USB.sendRealTime(midi::Start); Serial.write(MIDI_START);
} }
void onClockStop() { void onClockStop() {
//MIDI_USB.sendRealTime(midi::Stop); Serial.write(MIDI_STOP);
} }
void setup() { void setup() {
//MIDI_USB.begin(MIDI_CHANNEL_OMNI); // Initialize serial communication at 31250 bits per second, the default MIDI serial speed communication:
Serial.begin(31250);
// A led to count bpms // A led to count bpms
pinMode(LED_BUILTIN, OUTPUT); pinMode(LED_BUILTIN, OUTPUT);

@ -1,14 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Example OpenOCD configuration file for ESP32-WROVER-KIT board.
#
# For example, OpenOCD can be started for ESP32 debugging on
#
# openocd -f board/esp32-wrover-kit-3.3v.cfg
#
# Source the JTAG interface configuration file
source [find interface/ftdi/esp32_devkitj_v1.cfg]
set ESP32_FLASH_VOLTAGE 3.3
# Source the ESP32 configuration file
source [find target/esp32.cfg]

@ -1,19 +0,0 @@
{
"name":"Arduino on ESP32",
"toolchainPrefix":"xtensa-esp32-elf",
"svdFile":"esp32.svd",
"request":"attach",
"postAttachCommands":[
"set remote hardware-watchpoint-limit 2",
"monitor reset halt",
"monitor gdb_sync",
"thb setup",
"c"
],
"overrideRestartCommands":[
"monitor reset halt",
"monitor gdb_sync",
"thb setup",
"c"
]
}

File diff suppressed because it is too large Load Diff

@ -27,26 +27,30 @@
*/ */
#include "uClock.h" #include "uClock.h"
//
// Timer setup for work clock // Timer setup for work clock
// //
// all non-avr timmers setup
// Teensyduino port // Teensyduino port
//
#if defined(TEENSYDUINO) #if defined(TEENSYDUINO)
IntervalTimer _uclockTimer; IntervalTimer _uclockTimer;
#endif #endif
//
// Seedstudio XIAO M0 port // Seedstudio XIAO M0 port
//
#if defined(SEEED_XIAO_M0) #if defined(SEEED_XIAO_M0)
// 24 bits timer // 24 bits timer
#include <TimerTCC0.h> #include <TimerTCC0.h>
// uses TimerTcc0 // uses TimerTcc0
// 16 bits timer // 16 bits timer
//#include <TimerTC3.h> //#include <TimerTC3.h>
// uses TimerTc3 // uses TimerTc3
#endif #endif
//
// ESP32 family // ESP32 family
//
#if defined(ARDUINO_ARCH_ESP32) || defined(ESP32) #if defined(ARDUINO_ARCH_ESP32) || defined(ESP32)
hw_timer_t * _uclockTimer = NULL; hw_timer_t * _uclockTimer = NULL;
#define TIMER_ID 0
#endif #endif
#if defined(ARDUINO_ARCH_AVR) #if defined(ARDUINO_ARCH_AVR)
@ -93,7 +97,7 @@ void uclockInitTimer()
#endif #endif
#if defined(ARDUINO_ARCH_ESP32) || defined(ESP32) #if defined(ARDUINO_ARCH_ESP32) || defined(ESP32)
_uclockTimer = timerBegin(0, 80, true); _uclockTimer = timerBegin(TIMER_ID, 80, true);
// attach to generic uclock ISR // attach to generic uclock ISR
timerAttachInterrupt(_uclockTimer, &uclockISR, true); timerAttachInterrupt(_uclockTimer, &uclockISR, true);

Loading…
Cancel
Save