This source file includes following definitions.
- get_vbatt_min
- get_vbatt_max
- get_effective_focal_length
- get_focal_length
- get_zoom_x
- rec_switch_state
- screen_opened
- screen_rotated
1 #include "../generic/main.c"
2
3
4 long get_vbatt_min()
5 {
6 return 3550;
7 }
8
9 long get_vbatt_max()
10 {
11 return 4110;
12 }
13
14 static const struct {
15 int zp, fl;
16 } fl_tbl[] = {
17 { 0, 6500 },
18 { 1, 6803 },
19 { 2, 6934 },
20 { 3, 7067 },
21 { 4, 7203 },
22 { 5, 7340 },
23 { 7, 7620 },
24 { 9, 7908 },
25 { 11, 8207 },
26 { 14, 8665 },
27 { 19, 9472 },
28 { 41, 13743 },
29 { 64, 20189 },
30 { 72, 23145 },
31 { 86, 29387 },
32 { 105, 40494 },
33 { 107, 41960 },
34 { 124, 65000 },
35 };
36
37 #define NUM_FL (int)(sizeof(fl_tbl)/sizeof(fl_tbl[0]))
38 #define CF_EFL 6035
39
40 const int zoom_points = 125;
41
42 int get_effective_focal_length(int zp) {
43 return (CF_EFL*get_focal_length(zp))/1000;
44 }
45
46 int get_focal_length(int zp)
47 {
48 int i;
49
50 if (zp<fl_tbl[0].zp)
51 return fl_tbl[0].fl;
52 else if (zp>fl_tbl[NUM_FL-1].zp)
53 return fl_tbl[NUM_FL-1].fl;
54 else
55 for (i=1; i<NUM_FL; ++i)
56 {
57 if (zp==fl_tbl[i-1].zp)
58 return fl_tbl[i-1].fl;
59 else if (zp==fl_tbl[i].zp)
60 return fl_tbl[i].fl;
61 else if (zp<fl_tbl[i].zp)
62 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);
63 }
64 return fl_tbl[NUM_FL-1].fl;
65 }
66
67 int get_zoom_x(int zp) {
68 return get_focal_length(zp)*10/fl_tbl[0].fl;
69 }
70
71 #if 0
72 int rec_switch_state(void) {
73
74 return (physw_status[1] & 0x08000000);
75 }
76 #endif
77
78 int screen_opened(void) {
79 return 0;
80 }
81
82 int screen_rotated(void) {
83 return 0;
84 }