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 ****************************************************************************/
28 #include "touchscreen.h"
30 static long last_touch
;
31 static int last_y
, last_x
;
37 } last_state
= STATE_UNKNOWN
;
41 * this writes in an interrupt-like fashion the last pixel coordinates
42 * that the user pressed on the screen */
43 JNIEXPORT
void JNICALL
44 Java_org_rockbox_RockboxFramebuffer_pixelHandler(JNIEnv
*env
, jobject
this,
51 last_touch
= current_tick
;
55 * this notifies us in an interrupt-like fashion whether the user just
56 * began or stopped the touch action */
57 JNIEXPORT
void JNICALL
58 Java_org_rockbox_RockboxFramebuffer_touchHandler(JNIEnv
*env
, jobject
this,
64 last_state
= STATE_DOWN
;
66 last_state
= STATE_UP
;
69 void button_init_device(void)
71 last_touch
= current_tick
;
74 int button_read_device(int *data
)
76 /* get grid button/coordinates based on the current touchscreen mode */
77 int btn
= touchscreen_to_pixels(last_x
, last_y
, data
);
78 if (last_state
== STATE_DOWN
)
84 *data
= last_x
= last_y
= 0;