Skip to content

Commit

Permalink
8x turbo stable on both ports simultaneously
Browse files Browse the repository at this point in the history
  • Loading branch information
jmamma committed Mar 10, 2018
1 parent 7eb1365 commit 705e252
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 32 deletions.
22 changes: 10 additions & 12 deletions avr/cores/megacommand/A4/A4Sysex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ void A4SysexListenerClass::start() {

void A4SysexListenerClass::handleByte(uint8_t byte) {

if (MidiSysex2.len == 3) {
if (byte == 0x06) {
isA4Message = true;
} else {
isA4Message = false;
}
return;
}

if (isA4Message && MidiSysex2.len == sizeof(a4_sysex_hdr)) {
msgType = byte;
switch (byte) {
Expand All @@ -47,8 +38,15 @@ void A4SysexListenerClass::handleByte(uint8_t byte) {
}

void A4SysexListenerClass::end() {
if (!isA4Message)
return;
if (MidiSysex2.data[3] == 0x06) {
isA4Message = true;
} else {
isA4Message = false;
return;
}


msgType = MidiSysex2.data[sizeof(a4_sysex_hdr)];

switch (msgType) {
//case A4_STATUS_RESPONSE_ID:
Expand Down Expand Up @@ -109,4 +107,4 @@ void A4SysexListenerClass::end() {

void A4SysexListenerClass::setup() {
MidiSysex2.addSysexListener(this);
}
}
17 changes: 6 additions & 11 deletions avr/cores/megacommand/MD/MDSysex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ void MDSysexListenerClass::start() {
}

void MDSysexListenerClass::handleByte(uint8_t byte) {
if (MidiSysex.len == 3) {
if (byte == 0x02) {
isMDMessage = true;
} else {
isMDMessage = false;
}
return;
}

if (isMDMessage && MidiSysex.len == sizeof(machinedrum_sysex_hdr)) {
msgType = byte;
switch (byte) {
Expand Down Expand Up @@ -49,9 +40,13 @@ void MDSysexListenerClass::handleByte(uint8_t byte) {
}

void MDSysexListenerClass::end() {
if (!isMDMessage)
if (MidiSysex.data[3] == 0x02) {
isMDMessage = true;
} else {
isMDMessage = false;
return;

}
msgType = MidiSysex.data[sizeof(machinedrum_sysex_hdr)];
switch (msgType) {
case MD_STATUS_RESPONSE_ID:
onStatusResponseCallbacks.call(MidiSysex.data[6], MidiSysex.data[7]);
Expand Down
4 changes: 2 additions & 2 deletions avr/cores/megacommand/Midi/MidiSysex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ void MidiSysexClass::handleByte(uint8_t byte) {
start();
}
}

/*
for (int i = 0; i < NUM_SYSEX_SLAVES; i++) {
if (isListenerActive(listeners[i])) {
listeners[i]->handleByte(byte);
}
}

*/
len++;

if (recording) {
Expand Down
10 changes: 5 additions & 5 deletions avr/cores/megacommand/MidiUart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,10 @@ uint8_t MidiUartClass::m_getc() {
return rxRb.get();
}

SIGNAL(USART1_RX_vect) {
ISR(USART1_RX_vect) {
isr_midi();
}
SIGNAL(USART2_RX_vect) {
ISR(USART2_RX_vect) {
isr_midi();
}

Expand All @@ -276,7 +276,7 @@ Midi_ = &Midi2;
MidiUart2.recvActiveSenseTimer = 0;
}
if (TIMER1_CHECK_INT()) { TCNT1 = 0; clock++; TIMER1_CLEAR_INT() }
if (TIMER2_CHECK_INT()) {TCNT2 = 0; slowclock++; TIMER2_CLEAR_INT() }
if (TIMER2_CHECK_INT()) { TCNT2 = 0; slowclock++; TIMER2_CLEAR_INT() }


// setLed();
Expand Down Expand Up @@ -374,7 +374,7 @@ MidiUart2.sendActiveSenseTimer = MidiUart2.sendActiveSenseTimeout;


#ifdef TX_IRQ
SIGNAL(USART1_UDRE_vect) {
ISR(USART1_UDRE_vect) {
//uint16_t count = 0;

isr_midi();
Expand All @@ -399,7 +399,7 @@ MidiUart.sendActiveSenseTimer = MidiUart.sendActiveSenseTimeout;
}
}

SIGNAL(USART2_UDRE_vect) {
ISR(USART2_UDRE_vect) {
isr_midi();
uint8_t c;
if (!MidiUart2.txRb.isEmpty()) {
Expand Down
4 changes: 2 additions & 2 deletions avr/cores/megacommand/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ static inline uint32_t phase_mult(uint32_t val) {
}

ISR(TIMER1_COMPA_vect) {
//ISR(TIMER1_OVF_vect) {

clock++;

Expand Down Expand Up @@ -259,7 +258,7 @@ uint16_t lastRunningStatusReset = 0;
#define OUTPUTPIN PD0

//extern uint16_t myvar;
ISR(TIMER2_COMPA_vect) {
ISR(TIMER2_COMPA_vect, ISR_NOBLOCK) {
slowclock++;
//TCNT2 = tcnt2;
// isr_midi();
Expand Down Expand Up @@ -356,6 +355,7 @@ int main(void) {
oled_display.begin();

oled_display.clearDisplay();
oled_display.invertDisplay(0);
oled_display.setRotation(2);
oled_display.setTextSize(1);
oled_display.setTextColor(WHITE, BLACK);
Expand Down

0 comments on commit 705e252

Please sign in to comment.