root/platform/ixus870_sd880/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 
   7 extern long link_bss_start;
   8 extern long link_bss_end;
   9 extern void boot();
  10 
  11 
  12 void startup()
  13 {
  14         long *bss = &link_bss_start;
  15         
  16 
  17         // sanity check
  18         if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)){
  19                 started();
  20                 shutdown();
  21         }
  22 
  23         // initialize .bss senment
  24         while (bss<&link_bss_end)
  25                 *bss++ = 0;
  26 
  27         boot();
  28 }
  29 
  30 
  31 static const int fl_tbl[] = {5000, 5984, 6935, 8118, 9368, 10797, 12524, 14843, 17174, 19998};
  32 #define NUM_FL (int)(sizeof(fl_tbl)/sizeof(fl_tbl[0]))
  33 // Calculation taken from ixus980
  34 // focal length range is 5,0 - 20 mm, 28 - 112 in 35-mm equivalent.
  35 // So, CF_EFL = 28/5,0*10000=56000 or 112/20*10000=56000
  36 #define CF_EFL 56000
  37 
  38 const int zoom_points = NUM_FL;
  39 
  40 int get_effective_focal_length(int zp) {
  41         return (CF_EFL*get_focal_length(zp))/10000;
  42 }
  43 
  44 int get_focal_length(int zp) {
  45     if (zp<0) return fl_tbl[0];
  46     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1];
  47     else return fl_tbl[zp];
  48 }
  49 
  50 int get_zoom_x(int zp) {
  51     if (zp<1) return 10;
  52     else if (zp>NUM_FL-1) return fl_tbl[NUM_FL-1]*10/fl_tbl[0];
  53     else return fl_tbl[zp]*10/fl_tbl[0];
  54 }
  55 
  56 long get_vbatt_min()
  57 {
  58         return 3265; // min seen: 3205 (warning + power off)
  59                      // 3320 -> blinking icon
  60 }
  61 
  62 long get_vbatt_max()
  63 {
  64         return 4065; // max seen: 4065
  65 }
  66 

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