root/platform/ixus105_sd1300/main.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. get_sensor_width
  2. startup
  3. get_mav
  4. get_xav
  5. get_fov
  6. get_effective_focal_length
  7. get_focal_length
  8. get_zoom_x
  9. get_vbatt_min
  10. get_vbatt_max

   1 #include "lolevel.h"
   2 #include "platform.h"
   3 #include "core.h"
   4 #include "keyboard.h"
   5 
   6 
   7 extern long link_bss_start;
   8 extern long link_bss_end;
   9 extern void boot();
  10 
  11 long get_sensor_width()
  12 {
  13     return 6160;          // 1/2.3"
  14 }
  15 
  16 void startup()
  17 {
  18     long *bss = &link_bss_start;
  19 
  20         // sanity check
  21         if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)){
  22                 started();
  23                 shutdown();
  24         }
  25 
  26         // initialize .bss senment
  27         while (bss<&link_bss_end)
  28                 *bss++ = 0;
  29 
  30 
  31         boot();
  32 }
  33 
  34 static const struct {
  35         int zp, fl;
  36 } fl_tbl[] = {
  37   {   0,   5000},
  38   {   1,   6000},
  39   {   2,   7000},
  40   {   3,   8000},
  41   {   4,   9500},
  42   {   5,   10900},
  43   {   6,   12800},
  44   {   7,   15000},
  45   {   8,   17300},
  46   {   9,   20000},
  47 };
  48 #define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
  49 // ixus105 focal lenght range 5.0 - 20 mm (35 mm equivalent: 28 - 112 mm)(1/2.3" Type CCD, Scale Factor To 35 mm Equivalent: 5.6)
  50 // 28/5*10000=56666
  51 // 112/20*10000=56666
  52 
  53 #define CF_EFL 56666
  54 
  55 const int zoom_points = NUM_FL;
  56 
  57 static const int fov_tbl[] = {63,54,48,42,36,32,27,23,20,18};
  58 static const int mav_tbl[] = {294,311,348,371,393,418,445,474,500};  // min Av 
  59 static const int xav_tbl[] = {582,599,636,659,681,706,733,762,788};  // max Av 
  60 
  61 int get_mav(int zp)
  62 {
  63  return mav_tbl[zp];
  64 }
  65 
  66 int get_xav(int zp)
  67 {
  68  return xav_tbl[zp];
  69 }
  70 
  71 int get_fov(int zp)
  72 {
  73  if (zp<0) return fov_tbl[0];
  74  else if (zp>NUM_FL-1) return fov_tbl[NUM_FL-1];
  75  else return fov_tbl[zp];
  76 }
  77 
  78 int get_effective_focal_length(int zp) {
  79     return (CF_EFL*get_focal_length(zp))/10000;
  80 }
  81 
  82 int get_focal_length(int zp) {
  83         int i;
  84 
  85         if (zp<fl_tbl[0].zp)
  86                 return fl_tbl[0].fl;
  87         else if (zp>fl_tbl[NUM_FL-1].zp)
  88                 return fl_tbl[NUM_FL-1].fl;
  89         else 
  90                 for (i=1; i<NUM_FL; ++i) {
  91                         if (zp==fl_tbl[i-1].zp) 
  92                                 return fl_tbl[i-1].fl;
  93                         else if (zp==fl_tbl[i].zp) 
  94                                 return fl_tbl[i].fl;
  95                         else if (zp<fl_tbl[i].zp)
  96                                 return fl_tbl[i-1].fl+(zp-fl_tbl[i-1].zp)*(fl_tbl[i].fl-fl_tbl[i-1].fl)/(fl_tbl[i].zp-fl_tbl[i-1].zp);
  97                 }
  98         return fl_tbl[NUM_FL-1].fl;
  99 }
 100 
 101 int get_zoom_x(int zp) {
 102         return get_focal_length(zp)*10/fl_tbl[0].fl;
 103 }
 104 
 105 long get_vbatt_min()
 106 {
 107     return 3000;
 108 }
 109 
 110 long get_vbatt_max()
 111 {
 112     return 4100;
 113 }
 114 

/* [<][>][^][v][top][bottom][index][help] */