CHDK_DE Vorschauversion  Trunk Rev. 5541
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
kbd_common.c-Dateireferenz
#include "platform.h"
#include "core.h"
#include "keyboard.h"
#include "kbd_common.h"
#include "conf.h"
#include "usb_remote.h"
#include "gui_draw.h"
#include "levent.h"
+ Include-Abhängigkeitsdiagramm für kbd_common.c:

gehe zum Quellcode dieser Datei

Funktionen

int get_hdmi_hpd_physw_mod (void)
 
int get_analog_av_physw_mod (void)
 
int kbd_force_analog_av (int state)
 
long kbd_update_key_state (void)
 
void kbd_update_physw_bits (void)
 
void kbd_key_press (long key)
 
void kbd_key_release (long key)
 
void kbd_key_release_all ()
 
long kbd_is_key_pressed (long key)
 
long kbd_is_key_clicked (long key)
 
long kbd_get_pressed_key ()
 
long kbd_get_clicked_key ()
 

Variablen

long physw_status [3]
 
int forced_usb_port
 

Dokumentation der Funktionen

int get_analog_av_physw_mod ( void  )

Definiert in Zeile 105 der Datei kbd_common.c.

106 {
107 #ifdef ANALOG_AV_FLAG
108  if(!(physw_status[ANALOG_AV_IDX] & ANALOG_AV_FLAG)) {
109  return 1;
110  }
111 #endif
112  return 0;
113 }
int get_hdmi_hpd_physw_mod ( void  )

Definiert in Zeile 94 der Datei kbd_common.c.

95 {
96 #ifdef HDMI_HPD_FLAG
97  if(!(physw_status[HDMI_HPD_IDX] & HDMI_HPD_FLAG)) {
98  return 1;
99  }
100 #endif
101  return 0;
102 }
int kbd_force_analog_av ( int  state)

Definiert in Zeile 120 der Datei kbd_common.c.

121 {
122 #ifdef ANALOG_AV_FLAG
123  forced_analog_av = state;
124  return 1;
125 #else
126  return 0;
127 #endif
128 }
long kbd_get_clicked_key ( )

Definiert in Zeile 367 der Datei kbd_common.c.

368 {
369  int i;
370  for (i=0;keymap[i].hackkey;i++){
371  if (((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
372  ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0)){
373  return keymap[i].hackkey;
374  }
375  }
376  return 0;
377 }
long kbd_get_pressed_key ( )

Definiert in Zeile 356 der Datei kbd_common.c.

357 {
358  int i;
359  for (i=0;keymap[i].hackkey;i++){
360  if ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0){
361  return keymap[i].hackkey;
362  }
363  }
364  return 0;
365 }
long kbd_is_key_clicked ( long  key)

Definiert in Zeile 344 der Datei kbd_common.c.

345 {
346  int i;
347  for (i=0;keymap[i].hackkey;i++){
348  if (keymap[i].hackkey == key){
349  return ((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
350  ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0);
351  }
352  }
353  return 0;
354 }
long kbd_is_key_pressed ( long  key)

Definiert in Zeile 333 der Datei kbd_common.c.

334 {
335  int i;
336  for (i=0;keymap[i].hackkey;i++){
337  if (keymap[i].hackkey == key){
338  return ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0) ? 1:0;
339  }
340  }
341  return 0;
342 }
void kbd_key_press ( long  key)

Definiert in Zeile 282 der Datei kbd_common.c.

283 {
284 #ifdef KBD_SIMULATE_VIDEO_KEY
285  if (key == KEY_VIDEO && !is_video_key_pressed)
286  {
287  // TODO define for ID would be more efficient
288  PostLogicalEventToUI(levent_id_for_name("PressMovieButton"),0);
289  is_video_key_pressed = 1;
290  // TODO not clear if this should return, or set state too
291  return;
292  }
293 #endif
294  int i;
295  for (i=0;keymap[i].hackkey;i++){
296  if (keymap[i].hackkey == key){
297  kbd_mod_state[keymap[i].grp] &= ~keymap[i].canonkey;
298  return;
299  }
300  }
301 }
void kbd_key_release ( long  key)

Definiert in Zeile 303 der Datei kbd_common.c.

304 {
305 #ifdef KBD_SIMULATE_VIDEO_KEY
306  if (key == KEY_VIDEO && is_video_key_pressed)
307  {
308  PostLogicalEventToUI(levent_id_for_name("UnpressMovieButton"),0);
309  is_video_key_pressed = 0;
310  return;
311  }
312 #endif
313  int i;
314  for (i=0;keymap[i].hackkey;i++){
315  if (keymap[i].hackkey == key){
317  return;
318  }
319  }
320 }
void kbd_key_release_all ( )

Definiert in Zeile 322 der Datei kbd_common.c.

323 {
327 // touch screen virtual keys
328 #ifdef CAM_TOUCHSCREEN_UI
329  kbd_mod_state[3] |= 0xFFFFFFFF;
330 #endif
331 }
long kbd_update_key_state ( void  )

Definiert in Zeile 140 der Datei kbd_common.c.

141 {
145 
146 #ifdef CAM_TOUCHSCREEN_UI
148 #endif
149 
150  // note assumed kbd_pwr_on has been called if needed
152 
153 #ifdef CAM_HAS_GPS
154  if (gps_key_trap > 0) // check if gps code is waiting for a specific key press to cancel shutdown
155  {
157  {
159  kbd_key_press(0);
160  gps_key_trap = -1; // signal the gps task that the specified button was pressed
161  msleep(1000); // pause to allow button release so Canon f/w does not see the press
162  }
163  }
164 #endif
165 
166  long status = kbd_process();
167  if (status == 0){
168  // leave it alone...
169  physw_status[0] = kbd_new_state[0];
170  physw_status[1] = kbd_new_state[1];
171  physw_status[2] = kbd_new_state[2];
172 
173 #ifdef CAM_HAS_JOGDIAL
174  jogdial_control(0);
175 #endif
176  } else {
177  // override keys
178  // TODO doesn't handle inverted logic yet
180 
182 
184 
185 #ifdef CAM_HAS_JOGDIAL
187  jogdial_control(1);
189  }
191  jogdial_control(0);
192  }
193 #endif
194  }
195  return status;
196 }
void kbd_update_physw_bits ( void  )

Definiert in Zeile 200 der Datei kbd_common.c.

201 {
202  if (conf.remote_enable) {
203 #ifdef CAM_REMOTE_MULTICHANNEL
204  switch(conf.remote_input_channel)
205  {
206  case REMOTE_INPUT_USB:
208  break;
209  #ifdef CAM_REMOTE_HDMI_HPD
212  break;
213  #endif
214  #ifdef CAM_REMOTE_ANALOG_AV
217  break;
218  #endif
219  }
220 #else
222 #endif
223  }
224  // TODO could save the real USB bit to avoid low level calls in get_usb_bit when immediate update not needed
225  if (forced_usb_port) {
227  }
228 #ifdef ANALOG_AV_FLAG
229  // 1 force on, 2 = force off, other = don't touch
230  if (forced_analog_av == 1) {
232  } else if(forced_analog_av == 2) {
234  }
235 
236 // workaround for crashes switching between analog AV out and native display
237  static long prev_analog_av_state = 0; // default to not present
238  long new_analog_av_state = get_analog_av_physw_mod();
239  if(new_analog_av_state != prev_analog_av_state) {
240  draw_suspend(1000);
241  prev_analog_av_state = new_analog_av_state;
242  }
243 #endif
244 // microsd cams don't have a read only bit
245 #ifndef KBD_SKIP_READONLY_BIT
247 #endif
248 
249 // n and possibly other micro SD cams uses door bit for autoboot, force back to closed (?)
250 #ifdef SD_DOOR_OVERRIDE
251  physw_status[SD_DOOR_IDX] |= SD_DOOR_FLAG; // override SD card door switch
252 #endif
253 
254 #ifdef OPT_RUN_WITH_BATT_COVER_OPEN
256 #endif
257 
258 #ifdef CAM_HOTSHOE_OVERRIDE
259  if (conf.hotshoe_override == 1) {
261  } else if (conf.hotshoe_override == 2) {
263  }
264 #endif
265 }

Variablen-Dokumentation

int forced_usb_port

Definiert in Zeile 35 der Datei usb_sync.c.

long physw_status[3]