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 ****************************************************************************/
29 static long last_touch
;
30 static int last_y
, last_x
;
36 } last_state
= STATE_UNKNOWN
;
40 * this writes in an interrupt-like fashion the last pixel coordinates
41 * that the user pressed on the screen */
42 JNIEXPORT
void JNICALL
43 Java_org_rockbox_RockboxFramebuffer_pixelHandler(JNIEnv
*env
, jobject
this,
48 last_touch
= current_tick
;
52 * this notifies us in an interrupt-like fashion whether the user just
53 * began or stopped the touch action */
54 JNIEXPORT
void JNICALL
55 Java_org_rockbox_RockboxFramebuffer_touchHandler(JNIEnv
*env
, jobject
this,
59 last_state
= STATE_DOWN
;
61 last_state
= STATE_UP
;
64 void button_init_device(void)
66 last_touch
= current_tick
;
69 int button_read_device(int *data
)
71 /* get grid button/coordinates based on the current touchscreen mode */
72 int btn
= touchscreen_to_pixels(last_x
, last_y
, data
);
73 if (last_state
== STATE_DOWN
)
79 *data
= last_x
= last_y
= 0;