CHDK_DE Vorschauversion  Trunk Rev. 6014
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
action_stack.h-Dateireferenz
+ Dieser Graph zeigt, welche Datei direkt oder indirekt diese Datei enthält:

gehe zum Quellcode dieser Datei

Typdefinitionen

typedef int(* action_func )(void)
 
typedef unsigned long AS_ID
 

Funktionen

int action_stack_AS_SHOOT (void)
 
AS_ID action_stack_create (action_func proc_func)
 
long action_top (int n)
 
void action_push (long p)
 
void action_push_delay (long msec)
 
void action_push_press (long key)
 
void action_push_release (long key)
 
void action_push_click (long key)
 
void action_push_shoot (int retry)
 
long action_pop_func (int nParam)
 
void action_push_func (action_func f)
 
void action_wait_for_click (int timeout)
 
void action_stack_process_all ()
 
int action_stack_is_finished (AS_ID comp_id)
 
void action_stack_kill (AS_ID comp_id)
 

Dokumentation der benutzerdefinierten Typen

typedef int(* action_func)(void)

Definiert in Zeile 10 der Datei action_stack.h.

typedef unsigned long AS_ID

Definiert in Zeile 13 der Datei action_stack.h.

Dokumentation der Funktionen

long action_pop_func ( int  nParam)

Definiert in Zeile 181 der Datei action_stack.c.

182 {
183  for (; nParam >= 0; nParam--)
184  action_pop();
185  return action_pop(); // Return function pointer / last parameter
186 }
void action_push ( long  p)

Definiert in Zeile 190 der Datei action_stack.c.

191 {
192  if (active_stack)
194 }
void action_push_click ( long  key)

Definiert in Zeile 300 der Datei action_stack.c.

301 {
302  // WARNING stack program flow is reversed
305 }
void action_push_delay ( long  msec)

Definiert in Zeile 256 der Datei action_stack.c.

257 {
258  action_push(msec);
260 }
void action_push_func ( action_func  f)

Definiert in Zeile 197 der Datei action_stack.c.

198 {
199  action_push((long)f);
201 }
void action_push_press ( long  key)

Definiert in Zeile 272 der Datei action_stack.c.

273 {
274  // WARNING stack program flow is reversed
276  action_push(key);
278 }
void action_push_release ( long  key)

Definiert in Zeile 290 der Datei action_stack.c.

291 {
292  // WARNING stack program flow is reversed
294  action_push(key);
296 }
void action_push_shoot ( int  retry)

Definiert in Zeile 406 der Datei action_stack.c.

407 {
408  // Init shooting state
410 
411  // Wait for camera ready to shoot or timeout
412  action_push(retry);
413  action_push(get_tick_count() + 5000);
415 
416  // Half press shutter
418 }
int action_stack_AS_SHOOT ( void  )

Definiert in Zeile 420 der Datei action_stack.c.

421 {
422  // Remove this action from stack
423  action_pop_func(0);
424 
425  // Push the shoot actions (with retry on shoot failure)
427 
428  return 1;
429 }
AS_ID action_stack_create ( action_func  proc_func)

Definiert in Zeile 62 der Datei action_stack.c.

63 {
64  // Cap the maximum number of action_stacks
66  return -1;
67 
68  // Initialize new action stack
69  action_stack_t* stack = 0;
70  if (free_stacks)
71  {
72  // Reuse previous memory block
73  stack = free_stacks;
75  }
76  else
77  {
78  // Get a new block
79  stack = (action_stack_t*)malloc(sizeof(action_stack_t));
80  }
81  memset(stack,0,sizeof(action_stack_t));
82 
83  // Insert at start of list - stacks execute in order of most recent creation
84  stack->next = action_stacks;
85  action_stacks = stack;
86 
87  // Initialize id & processing function
88  stack->comp_id = task_comp_id;
89  stack->stack[0] = (long)proc_func;
90  stack->stack[1] = AS_FUNC_ENTRY; // Can't use action_push_func as active_stack not set
91  stack->stack_ptr = 1;
92 
93  ++num_stacks;
94 
95  // Increment task_comp_id
96  // For this to clash with a running stack you would need to leave one running
97  // while 4 billion more were created - highly unlikely.
98  ++task_comp_id;
99  // Reset just in case it wraps around to 'finished' value
100  if (task_comp_id == 0) task_comp_id = 1;
101 
102  return stack->comp_id;
103 }
int action_stack_is_finished ( AS_ID  comp_id)

Definiert in Zeile 45 der Datei action_stack.c.

46 {
48  while (p)
49  {
50  if (p->comp_id == comp_id)
51  return 0;
52  p = p->next;
53  }
54 
55  return 1;
56 }
void action_stack_kill ( AS_ID  comp_id)

Definiert in Zeile 143 der Datei action_stack.c.

144 {
146  while (p)
147  {
148  if (p->comp_id == comp_id)
149  {
151  return;
152  }
153  p = p->next;
154  }
155 }
void action_stack_process_all ( )

Definiert in Zeile 465 der Datei action_stack.c.

466 {
468 
469  while (active_stack)
470  {
471  // Save the next stack in case the current one ends and
472  // releases it's stack during execution
474 
475  // Process stack functions
477 
478  active_stack = next;
479  }
480 }
long action_top ( int  n)

Definiert in Zeile 163 der Datei action_stack.c.

164 {
165  if (active_stack)
167  return 0;
168 }
void action_wait_for_click ( int  timeout)

Definiert in Zeile 49 der Datei camera_functions.c.

50 {
51  printf("*** wait_click %d ***\n", t);
52 }