simplified the input thread's internal loop
This commit is contained in:
parent
0a20f315d5
commit
969fefd0aa
|
@ -13,7 +13,7 @@ static int last_bstate = 0;
|
||||||
|
|
||||||
static void *input_thread(void *arg)
|
static void *input_thread(void *arg)
|
||||||
{
|
{
|
||||||
int st, tmp, mask;
|
int st, down, up, mask;
|
||||||
uintptr_t attr;
|
uintptr_t attr;
|
||||||
|
|
||||||
while (running)
|
while (running)
|
||||||
|
@ -22,19 +22,16 @@ static void *input_thread(void *arg)
|
||||||
st = Gpio_read_buttons();
|
st = Gpio_read_buttons();
|
||||||
if (st != last_bstate)
|
if (st != last_bstate)
|
||||||
{
|
{
|
||||||
tmp = last_bstate & ~st;
|
up = last_bstate & ~st;
|
||||||
|
down = st & ~last_bstate;
|
||||||
for (attr = 1, mask = 1; attr <= 4; attr++, mask <<= 1)
|
for (attr = 1, mask = 1; attr <= 4; attr++, mask <<= 1)
|
||||||
{
|
{
|
||||||
if (tmp & mask)
|
if (up & mask)
|
||||||
{
|
{
|
||||||
Log(LDEBUG, "posting WM_HWBUTTONUP(%d)", (int)attr);
|
Log(LDEBUG, "posting WM_HWBUTTONUP(%d)", (int)attr);
|
||||||
MqPost1(Sys_Queue, 0, WM_HWBUTTONUP, attr);
|
MqPost1(Sys_Queue, 0, WM_HWBUTTONUP, attr);
|
||||||
}
|
}
|
||||||
}
|
else if (down & mask)
|
||||||
tmp = st & ~last_bstate;
|
|
||||||
for (attr = 1, mask = 1; attr <= 4; attr++, mask <<= 1)
|
|
||||||
{
|
|
||||||
if (tmp & mask)
|
|
||||||
{
|
{
|
||||||
Log(LDEBUG, "posting WM_HWBUTTONDOWN(%d)", (int)attr);
|
Log(LDEBUG, "posting WM_HWBUTTONDOWN(%d)", (int)attr);
|
||||||
MqPost1(Sys_Queue, 0, WM_HWBUTTONDOWN, attr);
|
MqPost1(Sys_Queue, 0, WM_HWBUTTONDOWN, attr);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user