CHDK_DE Vorschauversion  Trunk Rev. 5426
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
kbd.c-Dateireferenz
#include "stdlib.h"
#include "lolevel.h"
#include "platform.h"
#include "core.h"
#include "conf.h"
#include "keyboard.h"
#include "touchscreen.h"
#include "gui.h"
#include "gui_draw.h"
#include "gui_osd.h"
#include "gui_menu.h"
#include "gui_user_menu.h"
#include "font.h"
#include "kbd_common.h"
+ Include-Abhängigkeitsdiagramm für kbd.c:

gehe zum Quellcode dieser Datei

Makrodefinitionen

#define TS_KEY_SCRIPT_RUN   200
 
#define TS_KEY_TOGGLE_RAW   201
 
#define TS_KEY_TOGGLE_OSD   202
 
#define TS_KEY_TOGGLE_OVRD   203
 
#define TS_KEY_PLAYBACK   204
 
#define TS_KEY_POWER   205
 
#define TS_KEY_EXIT   206
 
#define TS_KEY_USER_MENU   207
 
#define TS_KEY_ZOMBIE   0xFFFE
 
#define MODE_VID   0x400
 

Funktionen

void _GetKbdState (long *)
 
int kbd_is_blocked (void)
 
int get_usb_bit ()
 
const char * gui_on_off_enum (int change, int arg)
 
const char * gui_histo_show_enum (int change, int arg)
 
const char * gui_override_disable_enum (int change, int arg)
 
static const char * ts_user_menu_enable (int change, int arg)
 
static const char * simulate_playback_press (int change, int arg)
 
static const char * simulate_power_press (int change, int arg)
 
static const char * ts_exit_alt (int change, int arg)
 
static const char * ts_run_script (int change, int arg)
 
static int is_button_displayed (int b, int guiMode, int camMode)
 
static int is_button_active (int b, int guiMode, int camMode)
 
int show_virtual_buttons ()
 
int chdk_process_touch ()
 
int ts_process_touch ()
 
void virtual_buttons ()
 
long __attribute__ ((naked))
 
void __attribute__ ((naked, noinline))
 *-------------------------------------------------------------------— Mehr ...
 
void kbd_fetch_data (long *state)
 
void my_kbd_read_keys ()
 

Variablen

long kbd_new_state [4] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }
 
long kbd_prev_state [4] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }
 
long kbd_mod_state [4] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }
 
static long touch_panel_state = 0xFFFFFFFF
 
static long touch_panel_button = 0xFFFFFFFF
 
gui_handler scriptGuiHandler
 
KeyMap keymap []
 
int redraw_buttons = 1
 

Makro-Dokumentation

#define MODE_VID   0x400

Definiert in Zeile 43 der Datei kbd.c.

#define TS_KEY_EXIT   206

Definiert in Zeile 39 der Datei kbd.c.

#define TS_KEY_PLAYBACK   204

Definiert in Zeile 37 der Datei kbd.c.

#define TS_KEY_POWER   205

Definiert in Zeile 38 der Datei kbd.c.

#define TS_KEY_SCRIPT_RUN   200

Definiert in Zeile 33 der Datei kbd.c.

#define TS_KEY_TOGGLE_OSD   202

Definiert in Zeile 35 der Datei kbd.c.

#define TS_KEY_TOGGLE_OVRD   203

Definiert in Zeile 36 der Datei kbd.c.

#define TS_KEY_TOGGLE_RAW   201

Definiert in Zeile 34 der Datei kbd.c.

#define TS_KEY_USER_MENU   207

Definiert in Zeile 40 der Datei kbd.c.

#define TS_KEY_ZOMBIE   0xFFFE

Definiert in Zeile 41 der Datei kbd.c.

Dokumentation der Funktionen

long __attribute__ ( (naked)  )

Definiert in Zeile 333 der Datei kbd.c.

337 {
338  while (physw_run) {
339  _SleepTask(physw_sleep_delay);
340 
341  if (wrap_kbd_p1_f() == 1) { // autorepeat ?
342  _kbd_p2_f();
343  }
344  }
345 }
void __attribute__ ( (naked, noinline)  )

*-------------------------------------------------------------------—

!!

IS_ERROR( hSoundHandle )

IS_ERROR( RetCode )

IS_ERROR( RetCode )

IS_ERROR( RetCode )

IS_ERROR( RetCode )

"MOV R3, #0\n" "STR R3, [R9]\n"

TODO! below is from sd400

"MOV R3, #0\n" "STR R3, [R9]\n"

TODO! below is from sd400

__MovieRecorder_c__100

__MovieRecorder_c__100

Definiert in Zeile 347 der Datei kbd.c.

348 {
349  mykbd_task_proceed();
350  _ExitTask();
351 }
void _GetKbdState ( long *  )
int chdk_process_touch ( )

Definiert in Zeile 171 der Datei kbd.c.

172 {
173  int guiMode = camera_info.state.gui_mode;
175 
176  unsigned short tx, ty; // Touch co-ordinate
177  tx = touch_screen_x * 360 / 0x2FF ;
178  ty = touch_screen_y * 240 / 0x1FF ;
179  if (conf.rotate_osd)
180  {
181  tx = 360 - tx;
182  ty = 240 - ty;
183  }
184 
185  if ( touch_screen_active ) // Search for CHDK on screen buttons matching co-ordinate
186  {
187  int i;
188  for (i=0; keymap[i].hackkey; i++)
189  {
190  if ((tx >= keymap[i].x1) && (tx < keymap[i].x2) && (ty >= keymap[i].y1) && (ty < keymap[i].y2) && is_button_active(i,guiMode,camMode))
191  {
193  }
194  }
195 
196  // Check if menu touched
197  int mk = gui_touch_process(tx, ty);
198  if (mk != 0)
199  {
200  for (i=0; keymap[i].hackkey; i++)
201  {
202  if ((keymap[i].hackkey == mk) && is_button_active(i,camera_info.state.gui_mode,camMode))
203  {
205  }
206  }
207  }
208  }
209  else
210  {
211  touch_panel_state = touch_panel_button ; // on touch release update touch_panel_state
212  touch_panel_button = 0xFFFFFFFF ; // this means there is not key repeat function though
213  }
214  return 0;
215 }
int get_usb_bit ( )

Definiert in Zeile 25 der Datei kbd.c.

26 {
27  long usb_physw[3];
28  usb_physw[USB_IDX] = 0;
29  _kbd_read_keys_r2(usb_physw);
30  return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ;
31 }
const char* gui_histo_show_enum ( int  change,
int  arg 
)
const char* gui_on_off_enum ( int  change,
int  arg 
)
const char* gui_override_disable_enum ( int  change,
int  arg 
)
static int is_button_active ( int  b,
int  guiMode,
int  camMode 
)
static

Definiert in Zeile 160 der Datei kbd.c.

161 {
162  return is_button_displayed(b, guiMode, camMode);
163 }
static int is_button_displayed ( int  b,
int  guiMode,
int  camMode 
)
static

Definiert in Zeile 149 der Datei kbd.c.

150 {
151  return(
152  (keymap[b].grp == 3) &&
153  (guiMode >= keymap[b].min_gui_mode) &&
154  (guiMode <= keymap[b].max_gui_mode) &&
155  (camMode & keymap[b].cam_mode_mask) &&
156  ((keymap[b].conf_disable == 0) || (*keymap[b].conf_disable == 0))
157  );
158 }
void kbd_fetch_data ( long *  state)

Definiert in Zeile 365 der Datei kbd.c.

365  {
366  _GetKbdState(state);
367  _kbd_read_keys_r2(state);
368  // update virtual buttons
369  if( kbd_is_blocked() )
370  {
371  // if (sdelay > 5 )
372  // {
374  virtual_buttons();
375  kbd_new_state[3] = touch_panel_state; // Yes, use virtual button state
376  // } else sdelay++ ;
377  }
378  else
379  {
380  kbd_new_state[3] = touch_panel_state = 0xFFFFFFFF; // No, clear out virtual button state
381  }
382 }
int kbd_is_blocked ( void  )

Definiert in Zeile 60 der Datei kbd_process.c.

61 {
62  return kbd_blocked;
63 }
void my_kbd_read_keys ( )

Definiert in Zeile 384 der Datei kbd.c.

385 {
388 }
int show_virtual_buttons ( )

Definiert in Zeile 165 der Datei kbd.c.

166 {
167  extern int active_palette_buffer;
168  return((active_palette_buffer == 0x00) || (active_palette_buffer == 0x10)) ;
169 }
static const char* simulate_playback_press ( int  change,
int  arg 
)
static

Definiert in Zeile 64 der Datei kbd.c.

65 {
66  void levent_set_play(void);
67  void levent_set_record(void) ;
68  if ( change )
69  {
71  if (camMode) levent_set_play(); else levent_set_record() ;
72  }
73  return 0;
74 }
static const char* simulate_power_press ( int  change,
int  arg 
)
static

Definiert in Zeile 76 der Datei kbd.c.

77 {
78  void camera_shutdown_in_a_second(void);
79  if (change) camera_shutdown_in_a_second();
80  return 0;
81 }
static const char* ts_exit_alt ( int  change,
int  arg 
)
static

Definiert in Zeile 83 der Datei kbd.c.

84 {
85  if (change) exit_alt() ;
86  return 0;
87 }
int ts_process_touch ( )

Definiert in Zeile 217 der Datei kbd.c.

218 {
219  int rv = 0, i;
220 
221  if (touch_panel_state != 0xFFFFFFFF)
222  {
223  int guiMode = camera_info.state.gui_mode;
225 
226  for (i=0; keymap[i].hackkey; i++)
227  {
228  if (is_button_active(i, guiMode, camMode))
229  {
230  if (kbd_is_key_clicked(keymap[i].hackkey))
231  {
232  if (keymap[i].chg_val)
233  {
234  keymap[i].chg_val(1,(int)keymap[i].conf_val);
235  rv = keymap[i].redraw & 1;
236  }
237  if (keymap[i].redraw & 2) redraw_buttons = 1;
238  }
239  }
240  }
241  }
242  return rv;
243 }
static const char* ts_run_script ( int  change,
int  arg 
)
static

Definiert in Zeile 89 der Datei kbd.c.

90 {
91  if (change)
92  {
93  kbd_new_state[2]=kbd_new_state[2]&0xFFFFFFC0 ;
94  }
95  return 0;
96 }
static const char* ts_user_menu_enable ( int  change,
int  arg 
)
static

Definiert in Zeile 50 der Datei kbd.c.

51 {
52  extern void gui_menu_init();
54  extern int gui_user_menu_flag ;
55  if ( change )
56  {
58  gui_user_menu_flag = 0;
60  }
61  return 0;
62 }
void virtual_buttons ( )

Definiert in Zeile 248 der Datei kbd.c.

249 {
250  int guiMode = camera_info.state.gui_mode;
251  char buf[30];
252 
253  //if(menu_key_index == -1)
254  //{
255  // int i;
256  // for (i=0; keymap[i].hackkey != KEY_MENU; i++);
257  // menu_key_index = i;
258  //}
259 
260  if (redraw_buttons)
261  {
262  int i, x1, y1, x2, y2, ofst;
264 
265  twoColors c1 = MAKE_COLOR(COLOR_RED_DK,COLOR_WHITE); // ALT exit button
266  twoColors c2 = MAKE_COLOR(COLOR_WHITE, COLOR_BLUE_DK); // Right side keys
267  twoColors c3 = MAKE_COLOR(COLOR_WHITE, COLOR_RED_DK); // Left side keys
268  twoColors c4 = MAKE_COLOR(COLOR_GREY_DK_TRANS, COLOR_WHITE); // Semi-transparent keys
269 
270  for (i=0; keymap[i].hackkey; i++)
271  {
272  if (is_button_displayed(i, guiMode, camMode) && keymap[i].nm)
273  {
274  x1 = keymap[i].x1;
275  x2 = keymap[i].x2;
276  y1 = keymap[i].y1;
277  y2 = keymap[i].y2;
278 
279  twoColors clr = c3;
280  if ( guiMode == GUI_MODE_SCRIPT ) clr = c4 ;
281  else
282  {
283  if (keymap[i].hackkey == TS_KEY_EXIT) clr = c1;
284  else
285  {
286  if ((x1 >180) || (*keymap[i].conf_val)) clr=c2;
287  }
288  }
289  ofst = 16;
290 
292 
293  if (keymap[i].hackkey == KEY_UP)
294  {
295  rbf_draw_symbol(x1+12, y1+15, 0x53, clr);
296  }
297  else if (keymap[i].hackkey == KEY_RIGHT)
298  {
299  rbf_draw_symbol(x1+12, y1+15, 0x52, clr);
300  }
301  else if (keymap[i].hackkey == KEY_LEFT)
302  {
303  rbf_draw_symbol(x1+12, y1+15, 0x51, clr);
304  }
305  else if (keymap[i].hackkey == KEY_DOWN)
306  {
307  rbf_draw_symbol(x1+12, y1+15, 0x54, clr);
308  }
309  else
310  {
311  if (keymap[i].conf_val && keymap[i].chg_val)
312  {
313  ofst = 7;
314  strcpy(buf,(char*)keymap[i].chg_val(0,(int)keymap[i].conf_val));
315  buf[3] = 0;
316  draw_string(x1+4, y1+25, buf, c3);
317  }
318  else if (keymap[i].nm2)
319  {
320  ofst = 7;
321  draw_string(x1+4, y1+25, keymap[i].nm2, clr);
322  }
323  draw_string(x1+4, y1+ofst, keymap[i].nm, clr);
324  }
325  }
326  }
327  }
328 
329  redraw_buttons = 0;
330 }

Variablen-Dokumentation

long kbd_mod_state[4] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }

Definiert in Zeile 18 der Datei kbd.c.

long kbd_new_state[4] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }

Definiert in Zeile 16 der Datei kbd.c.

long kbd_prev_state[4] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }

Definiert in Zeile 17 der Datei kbd.c.

KeyMap keymap[]

Definiert in Zeile 98 der Datei kbd.c.

int redraw_buttons = 1

Definiert in Zeile 245 der Datei kbd.c.

gui_handler scriptGuiHandler

Definiert in Zeile 211 der Datei script.c.

long touch_panel_button = 0xFFFFFFFF
static

Definiert in Zeile 20 der Datei kbd.c.

long touch_panel_state = 0xFFFFFFFF
static

Definiert in Zeile 19 der Datei kbd.c.