CHDK_DE Vorschauversion  Trunk Rev. 5279
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
usb_input.c-Dateireferenz
#include "camera_info.h"
#include "stdlib.h"
#include "clock.h"
#include "conf.h"
#include "usb_remote.h"
+ Include-Abhängigkeitsdiagramm für usb_input.c:

gehe zum Quellcode dieser Datei

Makrodefinitionen

#define CA1_MAX_SHORT_PULSE_TIME   30
 
#define CA1_MAX_GAP_TIME   50
 

Funktionen

void debug_error (int)
 
void usb_one_press_switch (int usb_state)
 
void usb_two_press_switch (int usb_state)
 
void usb_ricoh_ca1_switch (int usb_state)
 
void usb_null_driver (int i)
 

Variablen

void(* usb_driver [NUM_USB_INPUT_DRV])(int)
 

Makro-Dokumentation

#define CA1_MAX_GAP_TIME   50

Definiert in Zeile 193 der Datei usb_input.c.

#define CA1_MAX_SHORT_PULSE_TIME   30

Definiert in Zeile 192 der Datei usb_input.c.

Dokumentation der Funktionen

void debug_error ( int  )

Definiert in Zeile 76 der Datei usb_remote.c.

77 {
78 }
void usb_null_driver ( int  i)

Definiert in Zeile 280 der Datei usb_input.c.

280 { return ; } ;
void usb_one_press_switch ( int  usb_state)

Definiert in Zeile 42 der Datei usb_input.c.

43 {
44  static int time_stamp = 0 ;
45  int current_time ;
46 
47  current_time = get_tick_count();
48 
49  switch( driver_state )
50  {
51  case SW_RESET :
54  break ;
55  case SW_IDLE :
57  if ( usb_state == USB_POWER_ON )
58  {
60  time_stamp = current_time ;
61  }
62  break ;
63  case SW_POWER_CONNECT :
64  if ( usb_state == USB_POWER_ON )
65  {
66  if ( current_time - time_stamp > DEBOUNCE_TIME ) // debounce
67  {
70  time_stamp = current_time ;
71  }
72  }
73  else
74  {
76  }
77  break ;
78  case SW_POWER_ON :
79  if ( usb_state != USB_POWER_ON )
80  {
81  if ( current_time - time_stamp > DEBOUNCE_TIME ) // debounce
82  {
85  time_stamp = current_time ;
86  }
87  }
88  break ;
89  case SW_POWER_DISCONNECT :
90  if ( current_time - time_stamp > FULL_PRESS_PULSE_TIME )
91  {
94  }
95  break ;
96  default :
98  break ;
99  }
100 
101 };
void usb_ricoh_ca1_switch ( int  usb_state)

Definiert in Zeile 206 der Datei usb_input.c.

207 {
208  static int time_stamp = 0 ;
209  int current_time ;
210 
211  current_time = get_tick_count() ;
212 
213  switch( driver_state )
214  {
215  case SW_RESET :
218  break ;
219  case SW_IDLE : // wait for USB power to be applied
220  if ( usb_state == USB_POWER_ON )
221  {
223  time_stamp = current_time ;
224  }
225  break ;
226  case SW_CA1_1XX : // decide between CA-1 30 mSec / 150 mSec pulse
227  if ( usb_state == USB_POWER_OFF )
228  {
230  time_stamp = current_time ;
231  }
232  else if ( current_time - time_stamp > CA1_MAX_SHORT_PULSE_TIME )
233  {
234  driver_state = SW_CA1_11 ; // we can set FULL_PRESS either here or wait for USB_POWER_OFF
235  virtual_remote_state = REMOTE_FULL_PRESS ; // note : setting FULL_PRESS here means that we can use the end of the current 150 mSec pulse for synch
236  }
237  break ;
238  case SW_CA1_10X :
239  if ( usb_state == USB_POWER_ON) // is the CA-1 30 mSec pulse followed by another one ?
240  {
242  }
243  else if ( current_time - time_stamp > CA1_MAX_GAP_TIME)
244  {
246  }
247  break ;
248  case SW_CA1_101 : // CA-1 release
249  if ( usb_state == USB_POWER_OFF ) // wait for end of pulse
250  {
253  }
254  break ;
255  case SW_CA1_100 : // CA-1 half-press
258  break ;
259  case SW_CA1_11 : // CA-1 full press
260  if ( usb_state == USB_POWER_OFF )
261  {
262  driver_state = SW_IDLE ; // this is always followed by the release pulse
263  virtual_remote_state = REMOTE_RELEASE ; // so we can set the state already here
264  }
265  break ;
266  default :
268  break ;
269  }
270 } ;
void usb_two_press_switch ( int  usb_state)

Definiert in Zeile 109 der Datei usb_input.c.

110 {
111  static int time_stamp = 0 ;
112  int current_time ;
113 
114  current_time = get_tick_count() ;
115 
116  switch( driver_state )
117  {
118  case SW_RESET :
121  break ;
122  case SW_IDLE :
123  if ( usb_state == USB_POWER_ON )
124  {
126  time_stamp = current_time ;
127  }
128  break ;
129  case SW_POWER_CONNECT :
130  if ( usb_state == USB_POWER_ON )
131  {
132  if ( current_time - time_stamp > DEBOUNCE_TIME ) // debounce
133  {
136  time_stamp = current_time ;
137  }
138  }
139  else
140  {
142  }
143  break ;
144  case SW_POWER_ON :
145  if ( usb_state == USB_POWER_OFF )
146  {
147  if ( current_time - time_stamp > DEBOUNCE_TIME ) // debounce
148  {
150  time_stamp = current_time ;
151  }
152  }
153  break ;
154  case SW_POWER_DISCONNECT :
155  if ( usb_state == USB_POWER_ON )
156  {
157  if ( current_time - time_stamp > DEBOUNCE_TIME ) // debounce
158  {
161  time_stamp = current_time ;
162  }
163  }
164  else
165  {
166  if ( current_time - time_stamp > MAX_FULL_PRESS_DELAY ) // timeout if no second press
167  {
170  }
171  }
172  break ;
173  case SW_FULL_PRESS_ACTIVE :
174  if ( usb_state == USB_POWER_OFF )
175  {
178  }
179  break ;
180  default :
182  break ;
183  }
184 } ;

Variablen-Dokumentation

void(* usb_driver[NUM_USB_INPUT_DRV])(int)