1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (c) 2010 Thomas Martitz
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
30 extern jclass Framebuffer_class;
31 extern jobject Framebuffer_instance;
35 static long last_touch
;
36 static int last_y
, last_x
;
41 } last_state
= STATE_UNKNOWN
;
43 JNIEXPORT
void JNICALL
Java_org_rockbox_RockboxFramebuffer_pixelHandler(JNIEnv
*env
, jobject
this, int x
, int y
)
46 LOG("%s(): %d:%d\n", __func__, x, y);
50 last_touch
= current_tick
;
53 JNIEXPORT
void JNICALL
Java_org_rockbox_RockboxFramebuffer_touchHandler(JNIEnv
*env
, jobject
this, int down
)
56 last_state
= STATE_DOWN
;
58 last_state
= STATE_UP
;
61 void button_init_device(void)
63 last_touch
= current_tick
;
66 int button_read_device(int *data
)
68 int btn
= touchscreen_to_pixels(last_x
, last_y
, data
);
69 if (last_state
== STATE_DOWN
)
75 *data
= last_x
= last_y
= 0;