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

Definiert in Zeile 778 der Datei motion_detector.c.

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

Definiert in Zeile 767 der Datei motion_detector.c.

768 {
769  if ((column<1 || column > motion_detector.columns) ||
770  (row<1 || row > motion_detector.rows))
771  {
772  return 0;
773  }
774 
775  return motion_detector.prev[ MD_XY2IDX(column-1,row-1) ]/motion_detector.points ;
776 }
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 307 der Datei wrappers.c.

308 {
309  return _VbattGet();
310 }
void ubasic_camera_get_raw ( )
int ubasic_camera_script_autostart ( )