1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 Björn Stenberg
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 ****************************************************************************/
25 #include "backlight.h"
32 #include "mp3_playback.h"
41 #include "powermgmt.h"
50 #include "statusbar.h"
51 #include "screen_access.h"
59 #if (CONFIG_STORAGE & STORAGE_MMC)
62 #if CONFIG_CODEC == SWCODEC
66 /* only used in set_time screen */
67 #if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
68 static int clamp_value_wrap(int value
, int max
, int min
)
78 #if (CONFIG_STORAGE & STORAGE_MMC)
79 int mmc_remove_request(void)
81 struct queue_event ev
;
84 screens
[i
].clear_display();
85 splash(0, ID2P(LANG_REMOVE_MMC
));
89 queue_wait_w_tmo(&button_queue
, &ev
, HZ
/2);
92 case SYS_HOTSWAP_EXTRACTED
:
93 return SYS_HOTSWAP_EXTRACTED
;
95 case SYS_USB_DISCONNECTED
:
96 return SYS_USB_DISCONNECTED
;
102 /* the charging screen is only used for archos targets */
103 #if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING) && defined(CPU_SH)
105 #ifdef HAVE_LCD_BITMAP
106 static void charging_display_info(bool animate
)
108 unsigned char charging_logo
[36];
109 const int pox_x
= (LCD_WIDTH
- sizeof(charging_logo
)) / 2;
110 const int pox_y
= 32;
111 static unsigned phase
= 3;
114 #ifdef NEED_ATA_POWER_BATT_MEASURE
115 if (ide_powered()) /* FM and V2 can only measure when ATA power is on */
118 int battv
= battery_voltage();
119 lcd_putsf(0, 7, " Batt: %d.%02dV %d%% ", battv
/ 1000,
120 (battv
% 1000) / 10, battery_level());
123 #ifdef ARCHOS_RECORDER
124 lcd_puts(0, 2, "Charge mode:");
127 if (charge_state
== CHARGING
)
128 s
= str(LANG_BATTERY_CHARGE
);
129 else if (charge_state
== TOPOFF
)
130 s
= str(LANG_BATTERY_TOPOFF_CHARGE
);
131 else if (charge_state
== TRICKLE
)
132 s
= str(LANG_BATTERY_TRICKLE_CHARGE
);
137 if (!charger_enabled())
139 #endif /* ARCHOS_RECORDER */
142 memset(charging_logo
+3, 0x00, 32);
143 charging_logo
[0] = 0x3C;
144 charging_logo
[1] = 0x24;
145 charging_logo
[2] = charging_logo
[35] = 0xFF;
148 { /* draw the outline */
150 lcd_mono_bitmap(charging_logo
, pox_x
, pox_y
+ 8,
151 sizeof(charging_logo
), 8);
152 lcd_set_drawmode(DRMODE_FG
);
154 charging_logo
[0] = charging_logo
[1] = 0x00;
155 memset(charging_logo
+2, 0x80, 34);
156 lcd_mono_bitmap(charging_logo
, pox_x
, pox_y
, sizeof(charging_logo
), 8);
158 memset(charging_logo
+2, 0x01, 34);
159 lcd_mono_bitmap(charging_logo
, pox_x
, pox_y
+ 16,
160 sizeof(charging_logo
), 8);
161 lcd_set_drawmode(DRMODE_SOLID
);
164 { /* animate the middle part */
165 for (i
= 3; i
<MIN(sizeof(charging_logo
)-1, phase
); i
++)
167 if ((i
-phase
) % 8 == 0)
168 { /* draw a "bubble" here */
170 bitpos
= (phase
+ i
/8) % 15; /* "bounce" effect */
172 bitpos
= 14 - bitpos
;
173 charging_logo
[i
] = BIT_N(bitpos
);
176 lcd_mono_bitmap(charging_logo
, pox_x
, pox_y
+ 8,
177 sizeof(charging_logo
), 8);
182 #else /* not HAVE_LCD_BITMAP */
184 static unsigned long logo_chars
[4];
185 static const unsigned char logo_pattern
[] = {
186 0x07, 0x04, 0x1c, 0x14, 0x1c, 0x04, 0x07, 0, /* char 1 */
187 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0, /* char 2 */
188 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0, /* char 3 */
189 0x1f, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1f, 0, /* char 4 */
192 static void logo_lock_patterns(bool on
)
198 for (i
= 0; i
< 4; i
++)
199 logo_chars
[i
] = lcd_get_locked_pattern();
203 for (i
= 0; i
< 4; i
++)
204 lcd_unlock_pattern(logo_chars
[i
]);
208 static void charging_display_info(bool animate
)
212 static unsigned phase
= 3;
215 battv
= battery_voltage();
216 lcd_putsf(4, 1, " %d.%02dV", battv
/ 1000, (battv
% 1000) / 10);
218 memcpy(buf
, logo_pattern
, 32); /* copy logo patterns */
220 if (!animate
) /* build the screen */
222 lcd_double_height(false);
223 lcd_puts(0, 0, "[Charging]");
224 for (i
= 0; i
< 4; i
++)
225 lcd_putc(i
, 1, logo_chars
[i
]);
227 else /* animate the logo */
229 for (i
= 3; i
< MIN(19, phase
); i
++)
231 if ((i
- phase
) % 5 == 0)
232 { /* draw a "bubble" here */
233 ypos
= (phase
+ i
/5) % 9; /* "bounce" effect */
236 buf
[5 - ypos
+ 8 * (i
/5)] |= 0x10u
>> (i
%5);
242 for (i
= 0; i
< 4; i
++)
243 lcd_define_pattern(logo_chars
[i
], buf
+ 8 * i
);
247 #endif /* (not) HAVE_LCD_BITMAP */
249 /* blocks while charging, returns on event:
250 1 if charger cable was removed
251 2 if Off/Stop key was pressed
252 3 if On key was pressed
253 4 if USB was connected */
255 int charging_screen(void)
260 ide_power_enable(false); /* power down the disk, else would be spinning */
263 backlight_set_timeout(global_settings
.backlight_timeout
);
264 #ifdef HAVE_REMOTE_LCD
265 remote_backlight_set_timeout(global_settings
.remote_backlight_timeout
);
267 backlight_set_timeout_plugged(global_settings
.backlight_timeout_plugged
);
269 #ifdef HAVE_LCD_CHARCELLS
270 logo_lock_patterns(true);
272 charging_display_info(false);
276 gui_syncstatusbar_draw(&statusbars
, false);
277 charging_display_info(true);
278 button
= get_action(CONTEXT_STD
,HZ
/3);
279 if (button
== ACTION_STD_OK
)
281 else if (usb_detect() == USB_INSERTED
)
283 else if (!charger_inserted())
287 #ifdef HAVE_LCD_CHARCELLS
288 logo_lock_patterns(false);
292 #endif /* CONFIG_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING && defined(CPU_SH) */
295 void charging_splash(void)
297 splash(2*HZ
, str(LANG_BATTERY_CHARGE
));
298 button_clear_queue();
303 #if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
305 /* little helper function for voice output */
306 static void say_time(int cursorpos
, const struct tm
*tm
)
311 if (!global_settings
.talk_menu
)
329 value
= tm
->tm_year
+ 1900;
336 if (cursorpos
== 4) /* month */
337 talk_id(LANG_MONTH_JANUARY
+ tm
->tm_mon
, false);
339 talk_value(value
, unit
, false);
346 #define SEPARATOR ":"
349 #define IDX_MINUTES 1
350 #define IDX_SECONDS 2
356 #define OFF_MINUTES 3
357 #define OFF_SECONDS 6
361 bool set_time_screen(const char* title
, struct tm
*tm
)
365 unsigned int statusbar_height
= 0;
366 unsigned char offsets_ptr
[] =
367 { OFF_HOURS
, OFF_MINUTES
, OFF_SECONDS
, OFF_YEAR
, 0, OFF_DAY
};
371 offsets_ptr
[IDX_HOURS
] = OFF_SECONDS
;
372 offsets_ptr
[IDX_SECONDS
] = OFF_HOURS
;
373 offsets_ptr
[IDX_YEAR
] = OFF_DAY
;
374 offsets_ptr
[IDX_DAY
] = OFF_YEAR
;
377 if(global_settings
.statusbar
)
378 statusbar_height
= STATUSBAR_HEIGHT
;
380 /* speak selection when screen is entered */
381 say_time(cursorpos
, tm
);
385 unsigned int i
, s
, realyear
, min
, max
;
386 unsigned char *ptr
[6];
387 unsigned char buffer
[20];
389 static unsigned char daysinmonth
[] =
390 {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
392 /* for easy acess in the drawing loop */
393 for (i
= 0; i
< 6; i
++)
394 ptr
[i
] = buffer
+ offsets_ptr
[i
];
395 ptr
[IDX_MONTH
] = str(LANG_MONTH_JANUARY
+ tm
->tm_mon
); /* month name */
397 /* calculate the number of days in febuary */
398 realyear
= tm
->tm_year
+ 1900;
399 if((realyear
% 4 == 0 && !(realyear
% 100 == 0)) || realyear
% 400 == 0)
404 /* fix day if month or year changed */
405 if (tm
->tm_mday
> daysinmonth
[tm
->tm_mon
])
406 tm
->tm_mday
= daysinmonth
[tm
->tm_mon
];
408 /* calculate day of week */
411 /* put all the numbers we want from the tm struct into
412 an easily printable buffer */
413 snprintf(buffer
, sizeof(buffer
),
414 "%02d " "%02d " "%02d " "%04d " "%02d",
415 tm
->tm_hour
, tm
->tm_min
, tm
->tm_sec
,
416 tm
->tm_year
+1900, tm
->tm_mday
);
418 /* convert spaces in the buffer to '\0' to make it possible to work
419 directly on the buffer */
420 for(i
=0; i
< sizeof(buffer
); i
++)
429 unsigned int separator_width
, weekday_width
;
430 unsigned int j
, width
, prev_line_height
;
431 struct viewport viewports
[NB_SCREENS
];
432 /* 6 possible cursor possitions, 2 values stored for each: x, y */
433 unsigned int cursor
[6][2];
434 struct viewport
*vp
= &viewports
[s
];
435 struct screen
*screen
= &screens
[s
];
436 static unsigned char rtl_idx
[] =
437 { IDX_SECONDS
, IDX_MINUTES
, IDX_HOURS
, IDX_DAY
, IDX_MONTH
, IDX_YEAR
};
439 viewport_set_defaults(vp
, s
);
440 screen
->set_viewport(vp
);
441 nb_lines
= viewport_get_nb_lines(vp
);
443 /* minimum lines needed is 2 + title line */
446 vp
->font
= FONT_SYSFIXED
;
447 nb_lines
= viewport_get_nb_lines(vp
);
450 /* recalculate the positions and offsets */
452 screen
->getstringsize(title
, NULL
, &prev_line_height
);
454 prev_line_height
= 0;
456 screen
->getstringsize(SEPARATOR
, &separator_width
, NULL
);
459 screen
->getstringsize(str(LANG_WEEKDAY_SUNDAY
+ tm
->tm_wday
),
460 &weekday_width
, NULL
);
461 screen
->getstringsize(" ", &separator_width
, NULL
);
463 for(i
=0, j
=0; i
< 6; i
++)
465 if(i
==3) /* second row */
467 j
= weekday_width
+ separator_width
;
468 prev_line_height
*= 2;
470 screen
->getstringsize(ptr
[i
], &width
, NULL
);
471 cursor
[i
][INDEX_Y
] = prev_line_height
+ statusbar_height
;
472 cursor
[i
][INDEX_X
] = j
;
473 j
+= width
+ separator_width
;
476 /* draw the screen */
477 screen
->set_viewport(vp
);
478 screen
->clear_viewport();
479 /* display the screen title */
480 screen
->puts_scroll(0, 0, title
);
482 /* these are not selectable, so we draw them outside the loop */
483 /* name of the week day */
484 screen
->putsxy(0, cursor
[3][INDEX_Y
],
485 str(LANG_WEEKDAY_SUNDAY
+ tm
->tm_wday
));
487 pos
= lang_is_rtl() ? rtl_idx
[cursorpos
] : cursorpos
;
488 /* draw the selected item with drawmode set to
489 DRMODE_SOLID|DRMODE_INVERSEVID, all other selectable
490 items with drawmode DRMODE_SOLID */
494 vp
->drawmode
= (DRMODE_SOLID
|DRMODE_INVERSEVID
);
496 screen
->putsxy(cursor
[i
][INDEX_X
],
497 cursor
[i
][INDEX_Y
], ptr
[i
]);
499 vp
->drawmode
= DRMODE_SOLID
;
501 screen
->putsxy(cursor
[i
/4 +1][INDEX_X
] - separator_width
,
502 cursor
[0][INDEX_Y
], SEPARATOR
);
505 /* print help text */
507 screen
->puts(0, 4, str(LANG_TIME_SET_BUTTON
));
509 screen
->puts(0, 5, str(LANG_TIME_REVERT
));
510 screen
->update_viewport();
511 screen
->set_viewport(NULL
);
514 /* set the most common numbers */
517 /* calculate the minimum and maximum for the number under cursor */
521 valptr
= &tm
->tm_hour
;
524 valptr
= &tm
->tm_min
;
527 valptr
= &tm
->tm_sec
;
532 valptr
= &tm
->tm_year
;
536 valptr
= &tm
->tm_mon
;
540 max
= daysinmonth
[tm
->tm_mon
];
541 valptr
= &tm
->tm_mday
;
545 #ifdef HAVE_TOUCHSCREEN
546 enum touchscreen_mode old_mode
= touchscreen_get_mode();
548 touchscreen_set_mode(TOUCHSCREEN_BUTTON
);
550 button
= get_action(CONTEXT_SETTINGS_TIME
, TIMEOUT_BLOCK
);
551 #ifdef HAVE_TOUCHSCREEN
552 touchscreen_set_mode(old_mode
);
555 case ACTION_STD_PREV
:
556 cursorpos
= clamp_value_wrap(--cursorpos
, 5, 0);
557 say_time(cursorpos
, tm
);
559 case ACTION_STD_NEXT
:
560 cursorpos
= clamp_value_wrap(++cursorpos
, 5, 0);
561 say_time(cursorpos
, tm
);
563 case ACTION_SETTINGS_INC
:
564 case ACTION_SETTINGS_INCREPEAT
:
565 *valptr
= clamp_value_wrap(++(*valptr
), max
, min
);
566 say_time(cursorpos
, tm
);
568 case ACTION_SETTINGS_DEC
:
569 case ACTION_SETTINGS_DECREPEAT
:
570 *valptr
= clamp_value_wrap(--(*valptr
), max
, min
);
571 say_time(cursorpos
, tm
);
578 case ACTION_STD_CANCEL
:
584 if (default_event_handler(button
) == SYS_USB_CONNECTED
)
591 #endif /* defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) */
593 #if (CONFIG_KEYPAD == RECORDER_PAD) && !defined(HAVE_SW_POWEROFF)
594 bool shutdown_screen(void)
598 long time_entered
= current_tick
;
602 splash(0, str(LANG_CONFIRM_SHUTDOWN
));
604 while(!done
&& TIME_BEFORE(current_tick
,time_entered
+HZ
*2))
606 button
= get_action(CONTEXT_STD
,HZ
);
609 case ACTION_STD_CANCEL
:
613 /* do nothing here, because ACTION_NONE might be caused
614 * by timeout or button release. In case of timeout the loop
615 * is terminated by TIME_BEFORE */
620 if(default_event_handler(button
) == SYS_USB_CONNECTED
)
630 static const int id3_headers
[]=
635 LANG_ID3_ALBUMARTIST
,
646 #if CONFIG_CODEC == SWCODEC
653 struct id3view_info
{
654 struct mp3entry
* id3
;
656 int info_id
[ARRAYLEN(id3_headers
)];
659 static const char* id3_get_info(int selected_item
, void* data
,
660 char *buffer
, size_t buffer_len
)
662 struct id3view_info
*info
= (struct id3view_info
*)data
;
663 struct mp3entry
* id3
=info
->id3
;
664 int info_no
=selected_item
/2;
665 if(!(selected_item
%2))
667 return(str(id3_headers
[info
->info_id
[info_no
]]));
673 switch(info
->info_id
[info_no
])
675 case 0:/*LANG_ID3_TITLE*/
678 case 1:/*LANG_ID3_ARTIST*/
681 case 2:/*LANG_ID3_ALBUM*/
684 case 3:/*LANG_ID3_ALBUMARTIST*/
685 val
=id3
->albumartist
;
687 case 4:/*LANG_ID3_GROUPING*/
690 case 5:/*LANG_ID3_DISCNUM*/
691 if (id3
->disc_string
)
692 val
= id3
->disc_string
;
693 else if (id3
->discnum
)
695 snprintf(buffer
, buffer_len
, "%d", id3
->discnum
);
699 case 6:/*LANG_ID3_TRACKNUM*/
700 if (id3
->track_string
)
701 val
= id3
->track_string
;
702 else if (id3
->tracknum
)
704 snprintf(buffer
, buffer_len
, "%d", id3
->tracknum
);
708 case 7:/*LANG_ID3_COMMENT*/
711 case 8:/*LANG_ID3_GENRE*/
712 val
= id3
->genre_string
;
714 case 9:/*LANG_ID3_YEAR*/
715 if (id3
->year_string
)
716 val
= id3
->year_string
;
719 snprintf(buffer
, buffer_len
, "%d", id3
->year
);
723 case 10:/*LANG_ID3_LENGTH*/
724 format_time(buffer
, buffer_len
, id3
->length
);
727 case 11:/*LANG_ID3_PLAYLIST*/
728 snprintf(buffer
, buffer_len
, "%d/%d",
729 playlist_get_display_index(), playlist_amount());
732 case 12:/*LANG_ID3_BITRATE*/
733 snprintf(buffer
, buffer_len
, "%d kbps%s", id3
->bitrate
,
734 id3
->vbr
? str(LANG_ID3_VBR
) : (const unsigned char*) "");
737 case 13:/*LANG_ID3_FREQUENCY*/
738 snprintf(buffer
, buffer_len
, "%ld Hz", id3
->frequency
);
741 #if CONFIG_CODEC == SWCODEC
742 case 14:/*LANG_ID3_TRACK_GAIN*/
743 val
=id3
->track_gain_string
;
745 case 15:/*LANG_ID3_ALBUM_GAIN*/
746 val
=id3
->album_gain_string
;
748 case 16:/*LANG_ID3_PATH*/
750 case 14:/*LANG_ID3_PATH*/
755 return val
&& *val
? val
: NULL
;
759 bool browse_id3(void)
761 struct gui_synclist id3_lists
;
762 struct mp3entry
* id3
= audio_current_track();
765 struct id3view_info info
;
768 for (i
= 0; i
< ARRAYLEN(id3_headers
); i
++)
772 if (id3_get_info((i
*2)+1, &info
, temp
, 8) != NULL
)
773 info
.info_id
[info
.count
++] = i
;
776 gui_synclist_init(&id3_lists
, &id3_get_info
, &info
, true, 2, NULL
);
777 gui_synclist_set_nb_items(&id3_lists
, info
.count
*2);
778 gui_synclist_draw(&id3_lists
);
780 key
= get_action(CONTEXT_LIST
,HZ
/2);
781 if(key
!=ACTION_NONE
&& key
!=ACTION_UNKNOWN
782 && !gui_synclist_do_button(&id3_lists
, &key
,LIST_WRAP_UNLESS_HELD
))
784 return(default_event_handler(key
) == SYS_USB_CONNECTED
);
789 static const char* runtime_get_data(int selected_item
, void* data
,
790 char* buffer
, size_t buffer_len
)
794 switch (selected_item
)
796 case 0: return str(LANG_RUNNING_TIME
);
797 case 1: t
= global_status
.runtime
; break;
798 case 2: return str(LANG_TOP_TIME
);
799 case 3: t
= global_status
.topruntime
; break;
804 snprintf(buffer
, buffer_len
, "%dh %dm %ds",
805 t
/ 3600, (t
% 3600) / 60, t
% 60);
809 static int runtime_speak_data(int selected_item
, void* data
)
813 (selected_item
< 2) ? LANG_RUNNING_TIME
: LANG_TOP_TIME
,
814 TALK_ID((selected_item
< 2) ? global_status
.runtime
815 : global_status
.topruntime
, UNIT_TIME
));
820 bool view_runtime(void)
822 static const char *lines
[]={ID2P(LANG_CLEAR_TIME
)};
823 static const struct text_message message
={lines
, 1};
825 struct gui_synclist lists
;
827 gui_synclist_init(&lists
, runtime_get_data
, NULL
, false, 2, NULL
);
828 #if !defined(HAVE_LCD_CHARCELLS)
829 gui_synclist_set_title(&lists
, str(LANG_RUNNING_TIME
), NOICON
);
831 gui_synclist_set_title(&lists
, NULL
, NOICON
);
833 if(global_settings
.talk_menu
)
834 gui_synclist_set_voice_callback(&lists
, runtime_speak_data
);
835 gui_synclist_set_icon_callback(&lists
, NULL
);
836 gui_synclist_set_nb_items(&lists
, 4);
837 gui_synclist_speak_item(&lists
);
841 if (charger_inserted())
843 global_status
.runtime
= 0;
848 global_status
.runtime
+= ((current_tick
- lasttime
) / HZ
);
850 lasttime
= current_tick
;
851 gui_synclist_draw(&lists
);
852 list_do_action(CONTEXT_STD
, HZ
,
853 &lists
, &action
, LIST_WRAP_UNLESS_HELD
);
854 if(action
== ACTION_STD_CANCEL
)
856 if(action
== ACTION_STD_OK
) {
857 if(gui_syncyesno_run(&message
, NULL
, NULL
)==YESNO_YES
)
859 if (!(gui_synclist_get_sel_pos(&lists
)/2))
860 global_status
.runtime
= 0;
862 global_status
.topruntime
= 0;
863 gui_synclist_speak_item(&lists
);
866 if(default_event_handler(action
) == SYS_USB_CONNECTED
)
872 #ifdef HAVE_TOUCHSCREEN
873 static int get_sample(struct touchscreen_calibration
*cal
, int x
, int y
, int i
,
874 struct screen
* screen
)
880 screen
->drawline(x
- 10, y
, x
- 2, y
);
881 screen
->drawline(x
+ 2, y
, x
+ 10, y
);
882 screen
->drawline(x
, y
- 10, x
, y
- 2);
883 screen
->drawline(x
, y
+ 2, x
, y
+ 10);
886 /* Wait for a touchscreen press */
889 action
= get_action(CONTEXT_STD
, TIMEOUT_BLOCK
);
890 if(action
== ACTION_TOUCHSCREEN
)
892 if(action_get_touchscreen_press(&ts_x
, &ts_y
) == BUTTON_REL
)
895 else if(action
== ACTION_STD_CANCEL
)
910 short points
[3][2] = {
911 {LCD_WIDTH
/10, LCD_HEIGHT
/10},
912 {7*LCD_WIDTH
/8, LCD_HEIGHT
/2},
913 {LCD_WIDTH
/2, 7*LCD_HEIGHT
/8}
915 struct screen
* screen
= &screens
[SCREEN_MAIN
];
916 enum touchscreen_mode old_mode
= touchscreen_get_mode();
917 struct touchscreen_calibration cal
;
919 int statusbar
= global_settings
.statusbar
; /* hide the statusbar */
920 global_settings
.statusbar
= STATUSBAR_OFF
;
922 touchscreen_disable_mapping(); /* set raw mode */
923 touchscreen_set_mode(TOUCHSCREEN_POINT
);
926 screen
->clear_display();
928 if(get_sample(&cal
, points
[i
][0], points
[i
][1], i
, screen
))
936 touchscreen_calibrate(&cal
);
938 touchscreen_reset_mapping();
939 memcpy(&global_settings
.ts_calibration_data
, &calibration_parameters
, sizeof(struct touchscreen_parameter
));
940 touchscreen_set_mode(old_mode
);
941 global_settings
.statusbar
= statusbar
;
946 int reset_mapping(void)
948 touchscreen_reset_mapping();
949 memcpy(&global_settings
.ts_calibration_data
, &calibration_parameters
, sizeof(struct touchscreen_parameter
));