CHDK_DE Vorschauversion  Trunk Rev. 5272
 Alle Datenstrukturen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
camera_functions.h-Dateireferenz

gehe zum Quellcode dieser Datei

Funktionen

int script_key_is_clicked (int keyid)
 
int script_key_is_pressed (int keyid)
 
int camera_is_pressed (int i)
 
int camera_is_clicked (int i)
 
void camera_sleep (long v)
 
void camera_shoot ()
 
int md_detect_motion (void)
 
int md_get_cell_diff (int column, int row)
 
int md_get_cell_val (int column, int row)
 
int md_init_motion_detector ()
 
void camera_set_raw (int mode)
 
void ubasic_camera_get_raw ()
 
void camera_set_nr (int to)
 
int camera_get_nr ()
 
void shooting_set_prop (int id, int v)
 
int shooting_get_prop (int id)
 
long stat_get_vbatt ()
 
void camera_set_led (int led, int state, int bright)
 
int ubasic_camera_script_autostart ()
 
int get_usb_power (int edge)
 
void camera_set_script_autostart (int state)
 
void exit_alt ()
 

Dokumentation der Funktionen

int camera_get_nr ( )
int camera_is_clicked ( int  i)
int camera_is_pressed ( int  i)
void camera_set_led ( int  led,
int  state,
int  bright 
)

Definiert in Zeile 44 der Datei lib.c.

44  {
45  struct led_control led_c;
46  char convert_table[11]={0,1,2,3,0,2,3,1,8,10,10}; // s3 to a710 (and a720) convert table
47 
48  //char convert_table[6]={0,1,2,3,8,10}; // Test a720, values 0-5 are valid
49 
50  // 0 gr
51  // 1 red
52  // 2 yel
53  // 3 pw
54  // 8 dp
55  // 9 af
56 
57  led_c.led_num=convert_table[led%11];
58  led_c.action=state<=1 ? !state : state;
59  led_c.brightness=bright;
60  led_c.blink_count=255;
61  _PostLEDMessage(&led_c);
62 }
void camera_set_nr ( int  to)
void camera_set_raw ( int  mode)
void camera_set_script_autostart ( int  state)
void camera_shoot ( )
void camera_sleep ( long  v)
void exit_alt ( )

Definiert in Zeile 72 der Datei kbd_process.c.

73 {
74  kbd_blocked = 0;
76 }
int get_usb_power ( int  edge)

Definiert in Zeile 332 der Datei usb_remote.c.

333 {
334  int x = 0;
335 
336  switch( mode)
337  {
338  case SINGLE_PULSE :
339  x = usb_power;
340  usb_power = 0;
341  break ;
342  case USB_STATE :
343  x=usb_state;
344  break ;
345  case BUFFERED_PULSE :
346  if ( usb_buffer_out != usb_buffer_in )
347  {
349  x = *usb_buffer_out ;
350  }
351  break ;
352  case PULSE_COUNT :
353  x = usb_count;
354  usb_count = 0;
355  break ;
356  case LM_PULSE_COUNT :
359  break ;
360  case HPTIMER_ERROR_COUNT :
363  break ;
364  }
365  return x;
366 }
static int md_detect_motion ( void  )

Definiert in Zeile 602 der Datei motion_detector.c.

603 {
604  int idx, tick, rv;
605  int val, cy, cv, cu;
606 
607  register int col, row, x, y;
608 
609  if(!md_running())
610  {
611  return 0;
612  }
613 
614  tick = get_tick_count();
615  rv = 1;
616 
617 #ifdef OPT_MD_DEBUG
618  if(motion_detector.comp_calls_cnt < MD_REC_CALLS_CNT)
619  {
620  motion_detector.comp_calls[motion_detector.comp_calls_cnt]=tick;
621  }
622  motion_detector.comp_calls_cnt++;
623 #endif
624 
626  {
629  return 0;
630  }
631 
633  {
634  // wait for the next time
635  return 1;
636  }
637 
639 
641  if (!img) return 0;
642 
643 #ifdef OPT_MD_DEBUG
644  if(motion_detector.comp_calls_cnt==50 && (motion_detector.parameters & MD_MAKE_RAM_DUMP_FILE) != 0 )
645  {
646  mx_dump_memory((char*)img);
647  }
648 #endif
649 
651 
652  img += vid_get_viewport_image_offset(); // offset into viewport for when image size != viewport size (e.g. 16:9 image on 4:3 LCD)
653 
654  int vp_bw = vid_get_viewport_byte_width();
655  int vp_h = vid_get_viewport_height_proper();
656 
657 #ifdef THUMB_FW
658  int vp_w = vid_get_viewport_width_proper();
661 #else
662  int vp_w = vid_get_viewport_width_proper() / 2; // Row width in 3 byte units (half UYVYYY block)
665 #endif
666 
668 
669  for (idx=0, row=0; row < motion_detector.rows; row++)
670  {
671  // Calc img y start and end offsets (use same height for all cells so 'points' is consistent)
672  y_start = ((row * vp_h) / motion_detector.rows) * vp_bw;
673  y_end = y_start + ((vp_h / motion_detector.rows) * vp_bw);
674 
675  for (col=0; col < motion_detector.columns; col++, idx++)
676  {
677  int in_clipping_region=0;
678 
683  {
684  in_clipping_region=1;
685  }
686 
687  int curr = 0;
688  int diff = 0;
689 
690  if (
692  (motion_detector.clipping_region_mode==MD_REGION_EXCLUDE && in_clipping_region==0) ||
693  (motion_detector.clipping_region_mode==MD_REGION_INCLUDE && in_clipping_region==1)
694  )
695  {
696  // Calc img x start and end offsets (use same width for all cells so 'points' is consistent)
697 #ifdef THUMB_FW
698  x_start = ((col * vp_w) / motion_detector.columns) * 2;
699  x_end = x_start + ((vp_w / motion_detector.columns) * 2);
700 #else
701  x_start = ((col * vp_w) / motion_detector.columns) * 3;
702  x_end = x_start + ((vp_w / motion_detector.columns) * 3);
703 #endif
704 
705  // Do mode check and call function to do inner loops for mode
706  // See comments above on mode calulations
708  {
709  case MD_MEASURE_MODE_Y:
710  curr += md_measure_y();
711  break;
712  case MD_MEASURE_MODE_U:
713  curr += md_measure_u();
714  break;
715  case MD_MEASURE_MODE_V:
716  curr += md_measure_v();
717  break;
718  case MD_MEASURE_MODE_R:
719  curr += md_measure_r();
720  break;
721  case MD_MEASURE_MODE_G:
722  curr += md_measure_g();
723  break;
724  case MD_MEASURE_MODE_B:
725  curr += md_measure_b();
726  break;
727  }
728 
729  diff = (curr - motion_detector.prev[idx]) / motion_detector.points;
730  if (diff < 0) diff = -diff;
731  if ((diff > motion_detector.threshold) &&
733  {
735  }
736  }
737 
738  motion_detector.diff[idx] = diff;
739  motion_detector.prev[idx] = curr;
740  }
741  }
742 
744  {
748  }
749  else if ( motion_detector.detected_cells > 0 )
750  {
752  {
755 
757  {
758  //make shoot
760  }
761  rv = 0;
762  }
763  }
764 
765  return rv;
766 }
int md_get_cell_diff ( int  column,
int  row 
)

Definiert in Zeile 779 der Datei motion_detector.c.

780 {
781  if ((column<1 || column > motion_detector.columns) ||
782  (row<1 || row > motion_detector.rows))
783  {
784  return 0;
785  }
786 
787  return motion_detector.diff[ MD_XY2IDX(column-1,row-1) ];
788 }
int md_get_cell_val ( int  column,
int  row 
)

Definiert in Zeile 768 der Datei motion_detector.c.

769 {
770  if ((column<1 || column > motion_detector.columns) ||
771  (row<1 || row > motion_detector.rows))
772  {
773  return 0;
774  }
775 
776  return motion_detector.prev[ MD_XY2IDX(column-1,row-1) ]/motion_detector.points ;
777 }
int md_init_motion_detector ( )
int script_key_is_clicked ( int  keyid)
int script_key_is_pressed ( int  keyid)
int shooting_get_prop ( int  id)

Definiert in Zeile 60 der Datei shooting.c.

61 {
62  short vv;
63  get_property_case(id, &vv, sizeof(vv));
64  return vv;
65 }
void shooting_set_prop ( int  id,
int  v 
)

Definiert in Zeile 74 der Datei shooting.c.

75 {
76  short vv = v;
77  set_property_case(id, &vv, sizeof(vv));
78  return;
79 }
long stat_get_vbatt ( )

Definiert in Zeile 287 der Datei wrappers.c.

288 {
289  return _VbattGet();
290 }
void ubasic_camera_get_raw ( )
int ubasic_camera_script_autostart ( )