root/platform/s3is/main.c

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

DEFINITIONS

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

   1 #include "../generic/main.c"
   2 
   3 long get_vbatt_min()
   4 {
   5     return 4550;
   6 }
   7 
   8 long get_vbatt_max()
   9 {
  10     return 5150;
  11 }
  12 
  13 static const struct {
  14     int zp, fl;
  15 } fl_tbl[] = {
  16     {   0,   6000 },
  17     {  11,   6400 },
  18     {  41,  12100 },
  19     {  64,  21300 },
  20     {  86,  41600 },
  21     { 105,  61400 },
  22     { 128,  72000 },
  23 };
  24 #define NUM_FL (int)(sizeof(fl_tbl)/sizeof(fl_tbl[0]))
  25 #define CF_EFL 6000
  26 
  27 const int zoom_points = 129;
  28 
  29 int get_effective_focal_length(int zp) {
  30     return (CF_EFL*get_focal_length(zp))/1000;
  31 }
  32 
  33 int get_focal_length(int zp) {
  34     int i;
  35 
  36     if (zp<fl_tbl[0].zp)
  37         return fl_tbl[0].fl;
  38     else if (zp>fl_tbl[NUM_FL-1].zp)
  39         return fl_tbl[NUM_FL-1].fl;
  40     else 
  41         for (i=1; i<NUM_FL; ++i) {
  42            if (zp==fl_tbl[i-1].zp) 
  43                return fl_tbl[i-1].fl;
  44            else if (zp==fl_tbl[i].zp) 
  45                return fl_tbl[i].fl;
  46            else if (zp<fl_tbl[i].zp)
  47                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);
  48         }
  49     return fl_tbl[NUM_FL-1].fl;
  50 }
  51 
  52 int get_zoom_x(int zp) {
  53     return get_focal_length(zp)*10/fl_tbl[0].fl;
  54 }
  55 
  56 
  57 int screen_opened(void) {
  58 //    mode |= (physw_status[1] & 0x00000001)?0:MODE_SCREEN_OPENED;
  59         return !(physw_status[1] & 0x00000001);
  60 }
  61 
  62 int screen_rotated(void) {
  63 //    mode |= (physw_status[1] & 0x00000002)?0:MODE_SCREEN_ROTATED;
  64         return !(physw_status[1] & 0x00000002);
  65 }

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