summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2007-11-11 03:31:24 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2007-11-11 03:31:24 +0000
commit59a2862347873c2dfcc9cd47cc788dbfef27fcf8 (patch)
treee402597970dd734f14b778bd2780dbc42a70663a /firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c
parent50a8308ded33e7ff7397f7117fe1e4f16920de3d (diff)
downloadrockbox-59a2862347873c2dfcc9cd47cc788dbfef27fcf8.tar.gz
rockbox-59a2862347873c2dfcc9cd47cc788dbfef27fcf8.zip
Show some more registers in the debug screen, fix the touchscreen when SCREEN_ROTATE is set.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15566 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c')
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c53
1 files changed, 41 insertions, 12 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c
index 837677250f..5b20300594 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c
+++ b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c
@@ -47,9 +47,13 @@ void use_calibration(bool enable)
47 using_calibration = enable; 47 using_calibration = enable;
48} 48}
49/* Jd's tests.. These will hopefully work for everyone so we dont have to 49/* Jd's tests.. These will hopefully work for everyone so we dont have to
50 create a calibration screen. and 50 * create a calibration screen.
51(0,0) = 0x00c0, 0xf40 51 * Portait:
52(480,320) = 0x0f19, 0x00fc 52 * (0,0) = 200, 3900
53 * (480,640) = 3880, 270
54 * Landscape:
55 * (0,0) = 200, 270
56 * (640,480) = 3880, 3900
53*/ 57*/
54void set_calibration_points(struct touch_calibration_point *tl, 58void set_calibration_points(struct touch_calibration_point *tl,
55 struct touch_calibration_point *br) 59 struct touch_calibration_point *br)
@@ -57,16 +61,25 @@ void set_calibration_points(struct touch_calibration_point *tl,
57 memcpy(&topleft, tl, sizeof(struct touch_calibration_point)); 61 memcpy(&topleft, tl, sizeof(struct touch_calibration_point));
58 memcpy(&bottomright, br, sizeof(struct touch_calibration_point)); 62 memcpy(&bottomright, br, sizeof(struct touch_calibration_point));
59} 63}
64
60static int touch_to_pixels(short val_x, short val_y) 65static int touch_to_pixels(short val_x, short val_y)
61{ 66{
62 short x,y; 67 short x,y;
63 int x1,x2; 68
69#ifdef SCREEN_ROTATE /* portait */
70 x=val_x;
71 y=val_y;
72#else
73 x=val_y;
74 y=val_x;
75#endif
76
64 if (!using_calibration) 77 if (!using_calibration)
65 return (val_x<<16)|val_y; 78 return (val_x<<16)|val_y;
66 x1 = topleft.val_x; x2 = bottomright.val_x; 79
67 x = (val_x-x1)*(bottomright.px_x - topleft.px_x) / (x2 - x1) + topleft.px_x; 80 x = (x-topleft.val_x)*(bottomright.px_x - topleft.px_x) / (bottomright.val_x - topleft.val_x) + topleft.px_x;
68 x1 = topleft.val_y; x2 = bottomright.val_y; 81 y = (y-topleft.val_y)*(bottomright.px_y - topleft.px_y) / (bottomright.val_y - topleft.val_y) + topleft.px_y;
69 y = (val_y-x1)*(bottomright.px_y - topleft.px_y) / (x2 - x1) + topleft.px_y; 82
70 if (x < 0) 83 if (x < 0)
71 x = 0; 84 x = 0;
72 if (y < 0) 85 if (y < 0)
@@ -79,11 +92,27 @@ void button_init_device(void)
79 touch_available = false; 92 touch_available = false;
80 /* GIO is the power button, set as input */ 93 /* GIO is the power button, set as input */
81 IO_GIO_DIR0 |= 0x01; 94 IO_GIO_DIR0 |= 0x01;
82 topleft.px_x = 0; topleft.px_y = 0; 95
83 topleft.val_x = 0x00c0; topleft.val_y = 0xf40; 96#ifdef SCREEN_ROTATE /* portait */
97 topleft.val_x = 200;
98 topleft.val_y = 3900;
99
100 bottomright.val_x = 3880;
101 bottomright.val_y = 270;
102#else /* landscape */
103 topleft.val_x = 270;
104 topleft.val_y = 200;
105
106 bottomright.val_x = 3900;
107 bottomright.val_y = 3880;
108#endif
109
110 topleft.px_x = 0;
111 topleft.px_y = 0;
84 112
85 bottomright.px_x = LCD_WIDTH; bottomright.px_y = LCD_HEIGHT; 113 bottomright.px_x = LCD_WIDTH;
86 bottomright.val_x = 0x0f19; bottomright.val_y = 0x00fc; 114 bottomright.px_y = LCD_HEIGHT;
115
87 using_calibration = true; 116 using_calibration = true;
88 117
89 /* Enable the touchscreen interrupt */ 118 /* Enable the touchscreen interrupt */