CHDK_DE Vorschauversion  Trunk Rev. 5456
 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)
 
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 }
long kbd_get_clicked_key ( )

Definiert in Zeile 345 der Datei kbd_common.c.

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

Definiert in Zeile 334 der Datei kbd_common.c.

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

Definiert in Zeile 322 der Datei kbd_common.c.

323 {
324  int i;
325  for (i=0;keymap[i].hackkey;i++){
326  if (keymap[i].hackkey == key){
327  return ((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
328  ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0);
329  }
330  }
331  return 0;
332 }
long kbd_is_key_pressed ( long  key)

Definiert in Zeile 311 der Datei kbd_common.c.

312 {
313  int i;
314  for (i=0;keymap[i].hackkey;i++){
315  if (keymap[i].hackkey == key){
316  return ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0) ? 1:0;
317  }
318  }
319  return 0;
320 }
void kbd_key_press ( long  key)

Definiert in Zeile 260 der Datei kbd_common.c.

261 {
262 #ifdef KBD_SIMULATE_VIDEO_KEY
263  if (key == KEY_VIDEO && !is_video_key_pressed)
264  {
265  // TODO define for ID would be more efficient
266  PostLogicalEventToUI(levent_id_for_name("PressMovieButton"),0);
267  is_video_key_pressed = 1;
268  // TODO not clear if this should return, or set state too
269  return;
270  }
271 #endif
272  int i;
273  for (i=0;keymap[i].hackkey;i++){
274  if (keymap[i].hackkey == key){
275  kbd_mod_state[keymap[i].grp] &= ~keymap[i].canonkey;
276  return;
277  }
278  }
279 }
void kbd_key_release ( long  key)

Definiert in Zeile 281 der Datei kbd_common.c.

282 {
283 #ifdef KBD_SIMULATE_VIDEO_KEY
284  if (key == KEY_VIDEO && is_video_key_pressed)
285  {
286  PostLogicalEventToUI(levent_id_for_name("UnpressMovieButton"),0);
287  is_video_key_pressed = 0;
288  return;
289  }
290 #endif
291  int i;
292  for (i=0;keymap[i].hackkey;i++){
293  if (keymap[i].hackkey == key){
295  return;
296  }
297  }
298 }
void kbd_key_release_all ( )

Definiert in Zeile 300 der Datei kbd_common.c.

301 {
305 // touch screen virtual keys
306 #ifdef CAM_TOUCHSCREEN_UI
307  kbd_mod_state[3] |= 0xFFFFFFFF;
308 #endif
309 }
long kbd_update_key_state ( void  )

Definiert in Zeile 125 der Datei kbd_common.c.

126 {
130 
131 #ifdef CAM_TOUCHSCREEN_UI
133 #endif
134 
135  // note assumed kbd_pwr_on has been called if needed
137 
138 #ifdef CAM_HAS_GPS
139  if (gps_key_trap > 0) // check if gps code is waiting for a specific key press to cancel shutdown
140  {
142  {
144  kbd_key_press(0);
145  gps_key_trap = -1; // signal the gps task that the specified button was pressed
146  msleep(1000); // pause to allow button release so Canon f/w does not see the press
147  }
148  }
149 #endif
150 
151  long status = kbd_process();
152  if (status == 0){
153  // leave it alone...
154  physw_status[0] = kbd_new_state[0];
155  physw_status[1] = kbd_new_state[1];
156  physw_status[2] = kbd_new_state[2];
157 
158 #ifdef CAM_HAS_JOGDIAL
159  jogdial_control(0);
160 #endif
161  } else {
162  // override keys
163  // TODO doesn't handle inverted logic yet
165 
167 
169 
170 #ifdef CAM_HAS_JOGDIAL
172  jogdial_control(1);
174  }
176  jogdial_control(0);
177  }
178 #endif
179  }
180  return status;
181 }
void kbd_update_physw_bits ( void  )

Definiert in Zeile 185 der Datei kbd_common.c.

186 {
187  if (conf.remote_enable) {
188 #ifdef CAM_REMOTE_MULTICHANNEL
189  switch(conf.remote_input_channel)
190  {
191  case REMOTE_INPUT_USB:
193  break;
194  #ifdef CAM_REMOTE_HDMI_HPD
197  break;
198  #endif
199  #ifdef CAM_REMOTE_ANALOG_AV
202  break;
203  #endif
204  }
205 #else
207 #endif
208  }
209  // TODO could save the real USB bit to avoid low level calls in get_usb_bit when immediate update not needed
210  if (forced_usb_port) {
212  }
213 // workaround for crashes switching between analog AV out and native display
214 #ifdef ANALOG_AV_FLAG
215  static long prev_analog_av_state = 0; // default to not present
216  long new_analog_av_state = get_analog_av_physw_mod();
217  if(new_analog_av_state != prev_analog_av_state) {
218  draw_suspend(1000);
219  prev_analog_av_state = new_analog_av_state;
220  }
221 #endif
222 // microsd cams don't have a read only bit
223 #ifndef KBD_SKIP_READONLY_BIT
225 #endif
226 
227 // n and possibly other micro SD cams uses door bit for autoboot, force back to closed (?)
228 #ifdef SD_DOOR_OVERRIDE
229  physw_status[SD_DOOR_IDX] |= SD_DOOR_FLAG; // override SD card door switch
230 #endif
231 
232 #ifdef OPT_RUN_WITH_BATT_COVER_OPEN
234 #endif
235 
236 #ifdef CAM_HOTSHOE_OVERRIDE
237  if (conf.hotshoe_override == 1) {
239  } else if (conf.hotshoe_override == 2) {
241  }
242 #endif
243 }

Variablen-Dokumentation

int forced_usb_port

Definiert in Zeile 35 der Datei usb_sync.c.

long physw_status[3]