Rev 6 #1

Merged
oleksiy merged 37 commits from hardware-rev-4 into main 2024-08-25 12:37:13 +00:00
81 changed files with 20922 additions and 7936 deletions
Showing only changes of commit 120ef40ea1 - Show all commits

View File

@ -4,8 +4,9 @@
#include <EEPROM.h> #include <EEPROM.h>
#include <U8g2lib.h> #include <U8g2lib.h>
#include <avr/wdt.h> #include <avr/wdt.h>
#include <NeoHWSerial.h>
const char version[5] = "1.1b3"; const char version[5] = "1.1b4";
#define SCREEN_ADDRESS 0x3C #define SCREEN_ADDRESS 0x3C
@ -190,7 +191,8 @@ const uint8_t stkL[569] U8G2_FONT_SECTION("stk-l") =
void setup() { void setup() {
Serial.begin(31250); NeoSerial.begin(31250);
NeoSerial.attachInterrupt(receiveMIDI);
pinMode(ENC_BTN_PIN, INPUT_PULLUP); pinMode(ENC_BTN_PIN, INPUT_PULLUP);
pinMode(START_STOP_BTN_PIN, INPUT_PULLUP); pinMode(START_STOP_BTN_PIN, INPUT_PULLUP);
@ -220,27 +222,26 @@ void setup() {
} }
void loop() { void loop() {
if (masterClockMode == 2) { if (masterClockMode == 1 && extClockPPQN == 1) {
receiveMIDI();
} else if (masterClockMode == 1 && extClockPPQN == 1) {
calculateBPMTiming(); calculateBPMTiming();
} }
checkInputs(); checkInputs();
} }
void sendMIDIClock() { void sendMIDIClock() {
Serial.write(0xF8); NeoSerial.write(0xF8);
} }
void sendMIDIStart() { void sendMIDIStart() {
Serial.write(0xFA); NeoSerial.write(0xFA);
} }
void sendMIDIStop() { void sendMIDIStop() {
Serial.write(0xFC); NeoSerial.write(0xFC);
} }
void receiveMIDI() { void receiveMIDI() {
if (masterClockMode == 2) {
//if(Serial.available() > 0) { //if(Serial.available() > 0) {
int msg = Serial.read(); int msg = NeoSerial.read();
if (msg == 0xF8) { //Clock if (msg == 0xF8) { //Clock
MIDIClockReceived = true; MIDIClockReceived = true;
} else if (msg == 0xFC) { //stop } else if (msg == 0xFC) { //stop
@ -250,6 +251,7 @@ void receiveMIDI() {
} }
//} //}
} }
}
void clock() { void clock() {