CHDK_DE Vorschauversion  Trunk Rev. 5234
 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 182 der Datei action_stack.c.

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

Definiert in Zeile 191 der Datei action_stack.c.

192 {
193  if (active_stack)
195 }
void action_push_click ( long  key)

Definiert in Zeile 301 der Datei action_stack.c.

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

Definiert in Zeile 257 der Datei action_stack.c.

258 {
259  action_push(msec);
261 }
void action_push_func ( action_func  f)

Definiert in Zeile 198 der Datei action_stack.c.

199 {
200  action_push((long)f);
202 }
void action_push_press ( long  key)

Definiert in Zeile 273 der Datei action_stack.c.

274 {
275  // WARNING stack program flow is reversed
277  action_push(key);
279 }
void action_push_release ( long  key)

Definiert in Zeile 291 der Datei action_stack.c.

292 {
293  // WARNING stack program flow is reversed
295  action_push(key);
297 }
void action_push_shoot ( int  retry)

Definiert in Zeile 407 der Datei action_stack.c.

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

Definiert in Zeile 421 der Datei action_stack.c.

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

Definiert in Zeile 63 der Datei action_stack.c.

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

Definiert in Zeile 46 der Datei action_stack.c.

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

Definiert in Zeile 144 der Datei action_stack.c.

145 {
147  while (p)
148  {
149  if (p->comp_id == comp_id)
150  {
152  return;
153  }
154  p = p->next;
155  }
156 }
void action_stack_process_all ( )

Definiert in Zeile 466 der Datei action_stack.c.

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

Definiert in Zeile 164 der Datei action_stack.c.

165 {
166  if (active_stack)
168  return 0;
169 }
void action_wait_for_click ( int  timeout)