もちろん。各 ISR がメッセージをキューに送信するとき、それを送信した ISR を識別する何かをメッセージに入れます。次に、受信者がキューを読み取るときに、識別子に基づいて実行するアクションを決定できます。
ISR1() {
char msg[4];
msg[0] = '1'; // Identify the queue
get_3_ISR1_data_bytes(msg+1); // Get the data
q_send(msg);
}
ISR2() {
char msg[4];
msg[0] = '2'; // Identify the queue
get_3_ISR2_data_bytes(msg+1); // Get the data
q_send(msg);
}
handler() {
char *msg;
q_rcv(msg);
switch (msg[0]) {
case '1':
// Do ISR1 stuff
break;
case '2':
// Do ISR2 stuff
break;
default:
// Something unpleasant has happened
}
}
全体char
が高すぎる場合は、ISR を識別するために 1 ビット (0
またはに) を設定できます。1