RTOS - expected on different data in the queue

I am programming a board from TI, and I would like to somehow have two different ISR posts in the task message queue. This part works great. However, on the receiving side, is there any reasonable way for the task to postpone its turn and perform another operation on the data on the basis of which the ISR is located?

Basically, I have the task of updating the LCD, which displays information from my motors. However, if I have an engine ISR sensor and a button, click ISR, which send various information for updating, can this be done in one queue?

+3
source share
1 answer

. 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 , ( 0 1), ISR.

+3

All Articles