CHDK_DE Vorschauversion  Trunk Rev. 5830
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
usb_input.c-Dateireferenz
#include "camera_info.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 (__attribute__((unused)) int i)
 

Variablen

void(* usb_driver [NUM_USB_INPUT_DRV])(int)
 

Makro-Dokumentation

#define CA1_MAX_GAP_TIME   50

Definiert in Zeile 192 der Datei usb_input.c.

#define CA1_MAX_SHORT_PULSE_TIME   30

Definiert in Zeile 191 der Datei usb_input.c.

Dokumentation der Funktionen

void debug_error ( int  )
void usb_null_driver ( __attribute__((unused)) int  i)

Definiert in Zeile 279 der Datei usb_input.c.

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

Definiert in Zeile 41 der Datei usb_input.c.

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

Definiert in Zeile 205 der Datei usb_input.c.

206 {
207  static int time_stamp = 0 ;
208  int current_time ;
209 
210  current_time = get_tick_count() ;
211 
212  switch( driver_state )
213  {
214  case SW_RESET :
217  break ;
218  case SW_IDLE : // wait for USB power to be applied
219  if ( usb_state == USB_POWER_ON )
220  {
222  time_stamp = current_time ;
223  }
224  break ;
225  case SW_CA1_1XX : // decide between CA-1 30 mSec / 150 mSec pulse
226  if ( usb_state == USB_POWER_OFF )
227  {
229  time_stamp = current_time ;
230  }
231  else if ( current_time - time_stamp > CA1_MAX_SHORT_PULSE_TIME )
232  {
233  driver_state = SW_CA1_11 ; // we can set FULL_PRESS either here or wait for USB_POWER_OFF
234  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
235  }
236  break ;
237  case SW_CA1_10X :
238  if ( usb_state == USB_POWER_ON) // is the CA-1 30 mSec pulse followed by another one ?
239  {
241  }
242  else if ( current_time - time_stamp > CA1_MAX_GAP_TIME)
243  {
245  }
246  break ;
247  case SW_CA1_101 : // CA-1 release
248  if ( usb_state == USB_POWER_OFF ) // wait for end of pulse
249  {
252  }
253  break ;
254  case SW_CA1_100 : // CA-1 half-press
257  break ;
258  case SW_CA1_11 : // CA-1 full press
259  if ( usb_state == USB_POWER_OFF )
260  {
261  driver_state = SW_IDLE ; // this is always followed by the release pulse
262  virtual_remote_state = REMOTE_RELEASE ; // so we can set the state already here
263  }
264  break ;
265  default :
267  break ;
268  }
269 } ;
void usb_two_press_switch ( int  usb_state)

Definiert in Zeile 108 der Datei usb_input.c.

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

Variablen-Dokumentation

void(* usb_driver[NUM_USB_INPUT_DRV])(int)