Skip to content

Commit

Permalink
Set_Dinsync_Clock_Low method added
Browse files Browse the repository at this point in the history
  • Loading branch information
rv0 committed Feb 27, 2019
1 parent 10e5734 commit 0e977a1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Yocto/Interruption_fonction.ino
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ void Count_96PPQN()
//////////////////////////////////////////////////////////////////////
void Count_Clock() {
if (sync_mode == MASTER || sync_mode == MIDI_SLAVE) {
if (dinsync_first_clock_timeout != 0) {
dinsync_first_clock_timeout--;
if (dinsync_clock_timeout == 0) {
Set_Dinsync_Clock_High();
}
}

if (dinsync_clock_timeout != 0) {
dinsync_clock_timeout--;
if (dinsync_clock_timeout == 0) {
Expand Down
8 changes: 6 additions & 2 deletions Yocto/Midi_Play.ino
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,14 @@ void Handle_Clock() {
Reset_Trig_Out();

if (first_play) {
delayMicroseconds(2000); // Old dinsync devices have problems if the the CLK comes too quickly after RUN.
// Old dinsync devices have problems if the the CLK comes too quickly after RUN.
// Therefor we delay it with Timer3 for 2ms.
dinsync_first_clock_timeout = 2;
}
else {
Set_Dinsync_Clock_High();
}

Set_Dinsync_Clock_High();

//bitWrite(PORTD,4,!(bitRead (PIND,4)));
//PORTB &= ~(1<<2);// met a 0 la sorti TRIG CPU
Expand Down
5 changes: 5 additions & 0 deletions Yocto/Mode_Synchro.ino
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,9 @@ void Mode_Synchro(byte mode) {
void Set_Dinsync_Clock_High() {
PORTD |= (1<<4);//met a 1 la clock DIN
dinsync_clock_timeout = 4; // 4ms clock.
}


void Set_Dinsync_Clock_Low() {
PORTD &= ~(1<<4); // Lower the clock signal.
}
2 changes: 1 addition & 1 deletion Yocto/Yocto.ino
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ volatile boolean end_mesure_flag=0;//indique qu'on est passe a la mesure suivant
volatile boolean middle_mesure_flag=0;//utiliser pour avancer au pattern suivant lors de la selection d'un block indique le milieu de la mesure

volatile unsigned int dinsync_clock_timeout=0;

volatile unsigned int dinsync_first_clock_timeout=0;
//Variable du DEBOUNCE
unsigned long millis_debounce_step_button, millis_debounce_edit_button=0;//variable pour le temps de debounce des boutons

Expand Down
1 change: 1 addition & 0 deletions yocto.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ for future versions.
void Handle_NoteOn(byte channel, byte pitch, byte velocity);
void Mode_Synchro(byte mode);
void Set_Dinsync_Clock_High();
void Set_Dinsync_Clock_Low();
void Disconnect_Callback();
void Handle_Stop();
void Handle_Clock();
Expand Down

0 comments on commit 0e977a1

Please sign in to comment.