- Added CC 123 Command to reset the NoteOn Counters
- Fixed Bug, where NoteOn Counters could be negative
This commit is contained in:
@@ -24,8 +24,8 @@
|
||||
enum PARSING_STATE_e
|
||||
{
|
||||
WAITING_FOR_COMMAND,
|
||||
WAITING_FOR_NOTE,
|
||||
WAITING_FOR_VALUE
|
||||
WAITING_FOR_DATA1,
|
||||
WAITING_FOR_DATA2
|
||||
};
|
||||
|
||||
struct PARSING_s
|
||||
@@ -33,7 +33,7 @@ struct PARSING_s
|
||||
enum PARSING_STATE_e State;
|
||||
uint8_t MIDI_Event;
|
||||
uint8_t MIDI_Channel;
|
||||
uint8_t MIDI_Note;
|
||||
uint8_t MIDI_Data1;
|
||||
};
|
||||
|
||||
volatile struct PARSING_s _Parsing;
|
||||
@@ -46,7 +46,7 @@ History_Buffer_t _MIDI_History_Buffer[RECEIVED_MIDI_HISTORY_BUFFER_SIZE];
|
||||
void Core1_MIDI_Receiver_Histroy_Update (uint8_t data);
|
||||
void Core1_MIDI_Receiver_Issue_Event_On_Off_Received(uint8_t midi_channel, uint8_t midi_event);
|
||||
void Core1_MIDI_Receiver_Issue_Data_Received (uint8_t midi_data);
|
||||
void Core1_MIDI_Receiver_Issue_Full_Note_Received (uint8_t midi_event, uint8_t midi_channel, uint8_t midi_note, uint8_t value);
|
||||
void Core1_MIDI_Receiver_Issue_Full_Event_Received (uint8_t midi_event, uint8_t midi_channel, uint8_t midi_data1, uint8_t midi_data2);
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
@@ -70,7 +70,7 @@ void Core1_MIDI_Receiver_Init(void)
|
||||
_Parsing.State = WAITING_FOR_COMMAND;
|
||||
_Parsing.MIDI_Event = MIDI_EVENT_NOTE_ON;
|
||||
_Parsing.MIDI_Channel = MIDI_CHANNEL_1;
|
||||
_Parsing.MIDI_Note = NOTE_UNDEFINED;
|
||||
_Parsing.MIDI_Data1 = NOTE_UNDEFINED;
|
||||
}
|
||||
|
||||
void Core1_MIDI_Receiver_Process(void)
|
||||
@@ -87,7 +87,7 @@ void Core1_MIDI_Receiver_Process(void)
|
||||
{
|
||||
_Parsing.MIDI_Event = MIDI_EVENT_FROM_COMMAND(Data);
|
||||
_Parsing.MIDI_Channel = MIDI_CHANNEL_FROM_COMMAND(Data);
|
||||
_Parsing.State = WAITING_FOR_NOTE;
|
||||
_Parsing.State = WAITING_FOR_DATA1;
|
||||
|
||||
Core1_MIDI_Receiver_Issue_Event_On_Off_Received(_Parsing.MIDI_Channel, _Parsing.MIDI_Event);
|
||||
break;
|
||||
@@ -96,11 +96,11 @@ void Core1_MIDI_Receiver_Process(void)
|
||||
Core1_MIDI_Receiver_Issue_Data_Received(Data);
|
||||
break;
|
||||
|
||||
case WAITING_FOR_NOTE:
|
||||
case WAITING_FOR_DATA1:
|
||||
if(IS_MIDI_DATA(Data))
|
||||
{
|
||||
_Parsing.MIDI_Note = Data;
|
||||
_Parsing.State = WAITING_FOR_VALUE;
|
||||
_Parsing.MIDI_Data1 = Data;
|
||||
_Parsing.State = WAITING_FOR_DATA2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -110,10 +110,10 @@ void Core1_MIDI_Receiver_Process(void)
|
||||
}
|
||||
break;
|
||||
|
||||
case WAITING_FOR_VALUE:
|
||||
case WAITING_FOR_DATA2:
|
||||
if(IS_MIDI_DATA(Data))
|
||||
{
|
||||
Core1_MIDI_Receiver_Issue_Full_Note_Received(_Parsing.MIDI_Event, _Parsing.MIDI_Channel, _Parsing.MIDI_Note, Data);
|
||||
Core1_MIDI_Receiver_Issue_Full_Event_Received(_Parsing.MIDI_Event, _Parsing.MIDI_Channel, _Parsing.MIDI_Data1, Data);
|
||||
}
|
||||
|
||||
// Reset State Machine and wait for next MIDI Command
|
||||
@@ -151,7 +151,12 @@ void Core1_MIDI_Receiver_Issue_Data_Received(uint8_t midi_data)
|
||||
Core1_Light_Controller_MIDI_Other_Event_Received(midi_data);
|
||||
}
|
||||
|
||||
void Core1_MIDI_Receiver_Issue_Full_Note_Received(uint8_t midi_event, uint8_t midi_channel, uint8_t midi_note, uint8_t value)
|
||||
void Core1_MIDI_Receiver_Issue_Full_Event_Received(uint8_t midi_event, uint8_t midi_channel, uint8_t midi_data1, uint8_t midi_data2)
|
||||
{
|
||||
Core1_Light_Controller_MIDI_Full_Note_Received(midi_event, midi_channel, midi_note, value);
|
||||
if(midi_event == MIDI_EVENT_CONTROL_CHANGE) {
|
||||
Core1_Light_Controller_MIDI_Full_CC_Received(midi_event, midi_channel, midi_data1, midi_data2);
|
||||
}
|
||||
else {
|
||||
Core1_Light_Controller_MIDI_Full_Note_Received(midi_event, midi_channel, midi_data1, midi_data2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user