Fix new keyboard task
This commit is contained in:
parent
81a2e1fc22
commit
b5c06d5459
|
|
@ -165,22 +165,25 @@ static void kbd_task(void *arg)
|
||||||
}
|
}
|
||||||
if(send_event)
|
if(send_event)
|
||||||
{
|
{
|
||||||
kbd_msg_t msg;
|
kbd_msg_t msg;
|
||||||
msg.long_press = long_press;
|
msg.long_press = long_press;
|
||||||
msg.keys = keys;
|
// OR the saved key status with the current key status
|
||||||
// Send event_t as void * message to use with OSQPost
|
// Do this because the new key status is got when the
|
||||||
event_t event;
|
// key is lifted, and does not contain the pressed key anymore
|
||||||
event.type = EVENT_KBD;
|
msg.keys = keys | prev_keys;
|
||||||
event.payload = msg.value;
|
// Send event_t as void * message to use with OSQPost
|
||||||
// Send keyboard status in queue
|
event_t event;
|
||||||
OSQPost(&ui_queue, (void *)event.value, sizeof(event_t),
|
event.type = EVENT_KBD;
|
||||||
OS_OPT_POST_FIFO + OS_OPT_POST_NO_SCHED, &os_err);
|
event.payload = msg.value;
|
||||||
|
// Send keyboard status in queue
|
||||||
|
OSQPost(&ui_queue, (void *)event.value, sizeof(event_t),
|
||||||
|
OS_OPT_POST_FIFO + OS_OPT_POST_NO_SCHED, &os_err);
|
||||||
}
|
}
|
||||||
// Save current keyboard state as previous
|
// Save current keyboard state as previous
|
||||||
prev_keys = keys;
|
prev_keys = keys;
|
||||||
}
|
}
|
||||||
// Read keyboard state at 5Hz
|
// Read keyboard state at 20Hz
|
||||||
OSTimeDlyHMSM(0u, 0u, 0u, 200u, OS_OPT_TIME_HMSM_STRICT, &os_err);
|
OSTimeDlyHMSM(0u, 0u, 0u, 50u, OS_OPT_TIME_HMSM_STRICT, &os_err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue