root/platform/ixus130_sd1400/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 //#include "sd1400_debug.h"
   7 
   8 extern long link_bss_start;
   9 extern long link_bss_end;
  10 extern void boot();
  11 
  12 //#define LED 0xC0220130 // IO, green
  13 //#define DELAY 500000
  14 
  15 void startup()
  16 {
  17     long *bss = &link_bss_start;
  18 
  19     // sanity check (pointless with automemiso)
  20     if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)){
  21         started();
  22         shutdown();
  23     }
  24 
  25     // initialize .bss senment
  26     while (bss < &link_bss_end)
  27         *bss++ = 0;
  28 
  29     boot();
  30 }
  31 
  32 // Ixus130 Focal length: 5mm-20mm, 35mm equivalent 28mm-112mm, so:
  33 // CF_EFL = 28/5*10000 = 56000 or 112/20*10000 = 56000
  34 static const int fl_tbl[] = { 5000, 6400, 7400, 9000, 11200, 13000, 15600, 20000 };
  35 #define NUM_FL (int)(sizeof fl_tbl / sizeof *fl_tbl)
  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 //TODO: VBatt min/max
  57 long get_vbatt_min()
  58 {
  59     return 3425; // hnikesch on forum
  60 }
  61 
  62 long get_vbatt_max()
  63 {
  64     return 4000; // fresh off charger slightly greater
  65 }
  66 

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