source: trunk/platform/g11/main.c @ 1376

Revision 1376, 1.8 KB checked in by philmoz, 19 months ago (diff)

Cleanup SVN properties using reyalp's platprops.bash script (part 3).

  • Property svn:eol-style set to native
Line 
1#include "lolevel.h"
2#include "platform.h"
3#include "core.h"
4#include "keyboard.h"
5 
6extern long link_bss_start;
7extern long link_bss_end;
8extern void boot();
9
10
11void startup()
12{
13    long *bss = &link_bss_start;
14    long *ptr;
15
16    // sanity check
17    if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)){
18        started();
19        shutdown();
20    }
21
22    // initialize .bss senment
23    while (bss<&link_bss_end)
24        *bss++ = 0;
25    boot();
26}
27
28//zoom position is get_parameter_data(87)
29static const struct {
30        int zp, fl;
31} fl_tbl[] = {
32  {   0,   6100},
33  {   1,   6800},
34  {   2,   7400},
35  {   3,   8100},
36  {   4,   8900},
37  {   5,   9800},
38  {   6,   10800},
39  {   7,   12100},
40  {   8,   13800},
41  {   9,   15700},
42  {  10,   18100},
43  {  11,   21500},
44  {  12,   25000},
45  {  13,   30500},
46};
47
48#define NUM_FL (sizeof(fl_tbl)/sizeof(fl_tbl[0]))
49// G11 focal lenght range 6.1 - 30.5 mm (35 mm equivalent: 27.8 - 139.1 mm)(1/1.7" Type CCD, Scale Factor To 35 mm Equivalent: 4.6)
50// 27,8/6,1*10000=45574
51// 139,1/30,5*10000=45607
52#define CF_EFL 45574
53
54const int zoom_points = NUM_FL;
55
56int get_effective_focal_length(int zp) {
57    return (CF_EFL*get_focal_length(zp))/10000;
58}
59
60int get_focal_length(int zp) {
61        int i;
62
63        if (zp<fl_tbl[0].zp)
64                return fl_tbl[0].fl;
65        else if (zp>fl_tbl[NUM_FL-1].zp)
66                return fl_tbl[NUM_FL-1].fl;
67        else
68                for (i=1; i<NUM_FL; ++i) {
69                        if (zp==fl_tbl[i-1].zp)
70                                return fl_tbl[i-1].fl;
71                        else if (zp==fl_tbl[i].zp)
72                                return fl_tbl[i].fl;
73                        else if (zp<fl_tbl[i].zp)
74                                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);
75                }
76        return fl_tbl[NUM_FL-1].fl;
77}
78
79int get_zoom_x(int zp) {
80        return get_focal_length(zp)*10/fl_tbl[0].fl;
81}
82
83
84long get_vbatt_min()
85{
86    return 6600; /* G11 shuts down after reaching 6,6V*/
87}
88
89long get_vbatt_max()
90{
91    return 8100;
92}
93
Note: See TracBrowser for help on using the repository browser.