root/platform/s90/main.c

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

DEFINITIONS

This source file includes following definitions.
  1. startup
  2. get_effective_focal_length
  3. get_focal_length
  4. get_zoom_x
  5. get_vbatt_min
  6. get_vbatt_max

   1 #include "lolevel.h"
   2 #include "platform.h"
   3 #include "core.h"
   4 #include "keyboard.h"
   5  
   6 extern long link_bss_start;
   7 extern long link_bss_end;
   8 extern void boot();
   9 
  10 
  11 void startup()
  12 {
  13     long *bss = &link_bss_start;
  14 
  15     // sanity check
  16     if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)){
  17         started();
  18         shutdown();
  19     }
  20 
  21     // initialize .bss senment
  22     while (bss<&link_bss_end)
  23         *bss++ = 0;
  24     boot();
  25 }
  26 
  27 //zoom position is get_parameter_data(87)
  28 static const struct {
  29         int zp, fl;
  30 } fl_tbl[] = {
  31   {   0,   6000},
  32   {   1,   6850},
  33   {   2,   7490},
  34   {   3,   8560},
  35   {   4,   9640},
  36   {   5,   10700},
  37   {   6,   12850},
  38   {   7,   14980},
  39   {   8,   18190},
  40   {   9,   22500},
  41 };
  42 #define NUM_FL (int)(sizeof(fl_tbl)/sizeof(fl_tbl[0]))
  43 // S90 focal lenght range 6.0 - 22.5 mm (35 mm equivalent: 28 - 105 mm)(1/1.7" Type CCD, Scale Factor To 35 mm Equivalent: 4.6)
  44 // 28/6,0*10000=46666
  45 // 105/22,5*10000=46666
  46 
  47 #define CF_EFL 46666
  48 
  49 const int zoom_points = NUM_FL;
  50 
  51 int get_effective_focal_length(int zp) {
  52     return (CF_EFL*get_focal_length(zp))/10000;
  53 }
  54 
  55 int get_focal_length(int zp) {
  56         int i;
  57 
  58         if (zp<fl_tbl[0].zp)
  59                 return fl_tbl[0].fl;
  60         else if (zp>fl_tbl[NUM_FL-1].zp)
  61                 return fl_tbl[NUM_FL-1].fl;
  62         else 
  63                 for (i=1; i<NUM_FL; ++i) {
  64                         if (zp==fl_tbl[i-1].zp) 
  65                                 return fl_tbl[i-1].fl;
  66                         else if (zp==fl_tbl[i].zp) 
  67                                 return fl_tbl[i].fl;
  68                         else if (zp<fl_tbl[i].zp)
  69                                 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);
  70                 }
  71         return fl_tbl[NUM_FL-1].fl;
  72 }
  73 
  74 int get_zoom_x(int zp) {
  75         return get_focal_length(zp)*10/fl_tbl[0].fl;
  76 }
  77 
  78 
  79 long get_vbatt_min()
  80 {
  81     return 3000;
  82 }
  83 
  84 long get_vbatt_max()
  85 {
  86     return 4100;
  87 }
  88 

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