CHDK_DE Vorschauversion  Trunk Rev. 5707
 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  (void)state;
127  return 0;
128 #endif
129 }
long kbd_get_clicked_key ( )

Definiert in Zeile 368 der Datei kbd_common.c.

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

Definiert in Zeile 357 der Datei kbd_common.c.

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

Definiert in Zeile 345 der Datei kbd_common.c.

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

Definiert in Zeile 334 der Datei kbd_common.c.

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

Definiert in Zeile 283 der Datei kbd_common.c.

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

Definiert in Zeile 304 der Datei kbd_common.c.

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

Definiert in Zeile 323 der Datei kbd_common.c.

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

Definiert in Zeile 141 der Datei kbd_common.c.

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

Definiert in Zeile 201 der Datei kbd_common.c.

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

Variablen-Dokumentation

int forced_usb_port

Definiert in Zeile 34 der Datei usb_sync.c.

long physw_status[3]