CHDK_DE Vorschauversion  Trunk Rev. 5273
 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 "levent.h"
+ Include-Abhängigkeitsdiagramm für kbd_common.c:

gehe zum Quellcode dieser Datei

Funktionen

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

long kbd_get_clicked_key ( )

Definiert in Zeile 312 der Datei kbd_common.c.

313 {
314  int i;
315  for (i=0;keymap[i].hackkey;i++){
316  if (((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
317  ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0)){
318  return keymap[i].hackkey;
319  }
320  }
321  return 0;
322 }
long kbd_get_pressed_key ( )

Definiert in Zeile 301 der Datei kbd_common.c.

302 {
303  int i;
304  for (i=0;keymap[i].hackkey;i++){
305  if ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0){
306  return keymap[i].hackkey;
307  }
308  }
309  return 0;
310 }
long kbd_is_key_clicked ( long  key)

Definiert in Zeile 289 der Datei kbd_common.c.

290 {
291  int i;
292  for (i=0;keymap[i].hackkey;i++){
293  if (keymap[i].hackkey == key){
294  return ((kbd_prev_state[keymap[i].grp] & keymap[i].canonkey) != 0) &&
295  ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0);
296  }
297  }
298  return 0;
299 }
long kbd_is_key_pressed ( long  key)

Definiert in Zeile 278 der Datei kbd_common.c.

279 {
280  int i;
281  for (i=0;keymap[i].hackkey;i++){
282  if (keymap[i].hackkey == key){
283  return ((kbd_new_state[keymap[i].grp] & keymap[i].canonkey) == 0) ? 1:0;
284  }
285  }
286  return 0;
287 }
void kbd_key_press ( long  key)

Definiert in Zeile 227 der Datei kbd_common.c.

228 {
229 #ifdef KBD_SIMULATE_VIDEO_KEY
230  if (key == KEY_VIDEO && !is_video_key_pressed)
231  {
232  // TODO define for ID would be more efficient
233  PostLogicalEventToUI(levent_id_for_name("PressMovieButton"),0);
234  is_video_key_pressed = 1;
235  // TODO not clear if this should return, or set state too
236  return;
237  }
238 #endif
239  int i;
240  for (i=0;keymap[i].hackkey;i++){
241  if (keymap[i].hackkey == key){
242  kbd_mod_state[keymap[i].grp] &= ~keymap[i].canonkey;
243  return;
244  }
245  }
246 }
void kbd_key_release ( long  key)

Definiert in Zeile 248 der Datei kbd_common.c.

249 {
250 #ifdef KBD_SIMULATE_VIDEO_KEY
251  if (key == KEY_VIDEO && is_video_key_pressed)
252  {
253  PostLogicalEventToUI(levent_id_for_name("UnpressMovieButton"),0);
254  is_video_key_pressed = 0;
255  return;
256  }
257 #endif
258  int i;
259  for (i=0;keymap[i].hackkey;i++){
260  if (keymap[i].hackkey == key){
262  return;
263  }
264  }
265 }
void kbd_key_release_all ( )

Definiert in Zeile 267 der Datei kbd_common.c.

268 {
272 // touch screen virtual keys
273 #ifdef CAM_TOUCHSCREEN_UI
274  kbd_mod_state[3] |= 0xFFFFFFFF;
275 #endif
276 }
long kbd_update_key_state ( void  )

Definiert in Zeile 101 der Datei kbd_common.c.

102 {
106 
107 #ifdef CAM_TOUCHSCREEN_UI
109 #endif
110 
111  // note assumed kbd_pwr_on has been called if needed
113 
114 #ifdef CAM_HAS_GPS
115  if (gps_key_trap > 0) // check if gps code is waiting for a specific key press to cancel shutdown
116  {
118  {
120  kbd_key_press(0);
121  gps_key_trap = -1; // signal the gps task that the specified button was pressed
122  msleep(1000); // pause to allow button release so Canon f/w does not see the press
123  }
124  }
125 #endif
126 
127  long status = kbd_process();
128  if (status == 0){
129  // leave it alone...
130  physw_status[0] = kbd_new_state[0];
131  physw_status[1] = kbd_new_state[1];
132  physw_status[2] = kbd_new_state[2];
133 
134 #ifdef CAM_HAS_JOGDIAL
135  jogdial_control(0);
136 #endif
137  } else {
138  // override keys
139  // TODO doesn't handle inverted logic yet
141 
143 
145 
146 #ifdef CAM_HAS_JOGDIAL
148  jogdial_control(1);
150  }
152  jogdial_control(0);
153  }
154 #endif
155  }
156  return status;
157 }
void kbd_update_physw_bits ( void  )

Definiert in Zeile 161 der Datei kbd_common.c.

162 {
163  if (conf.remote_enable) {
164 #ifdef CAM_REMOTE_MULTICHANNEL
165  switch(conf.remote_input_channel)
166  {
167  case REMOTE_INPUT_USB:
169  break;
170  #ifdef CAM_REMOTE_HDMI_HPD
173  break;
174  #endif
175  #ifdef CAM_REMOTE_ANALOG_AV
178  break;
179  #endif
180  }
181 #else
183 #endif
184  }
185  // TODO could save the real USB bit to avoid low level calls in get_usb_bit when immediate update not needed
186  if (forced_usb_port) {
188  }
189 // microsd cams don't have a read only bit
190 #ifndef KBD_SKIP_READONLY_BIT
192 #endif
193 
194 // n and possibly other micro SD cams uses door bit for autoboot, force back to closed (?)
195 #ifdef SD_DOOR_OVERRIDE
196  physw_status[SD_DOOR_IDX] |= SD_DOOR_FLAG; // override SD card door switch
197 #endif
198 
199 #ifdef OPT_RUN_WITH_BATT_COVER_OPEN
201 #endif
202 
203 #ifdef CAM_HOTSHOE_OVERRIDE
204  if (conf.hotshoe_override == 1) {
206  } else if (conf.hotshoe_override == 2) {
208  }
209 #endif
210 }

Variablen-Dokumentation

int forced_usb_port

Definiert in Zeile 35 der Datei usb_sync.c.

long physw_status[3]