This source file includes following definitions.
- startup
- get_effective_focal_length
- get_focal_length
- get_zoom_x
- get_vbatt_min
- get_vbatt_max
1 #include "lolevel.h"
2 #include "platform.h"
3 #include "core.h"
4 #include "keyboard.h"
5
6 extern long link_bss_start;
7 extern long link_bss_end;
8 extern void boot();
9
10
11 void startup()
12 {
13 long *bss = &link_bss_start;
14
15
16 if ((long)&link_bss_end > (MEMISOSTART + MEMISOSIZE)){
17 started();
18 shutdown();
19 }
20
21
22 while (bss<&link_bss_end)
23 *bss++ = 0;
24 boot();
25 }
26
27
28 static const struct {
29 int zp, fl;
30 } fl_tbl[] = {
31 { 0, 6000},
32 { 1, 6850},
33 { 2, 7490},
34 { 3, 8560},
35 { 4, 9640},
36 { 5, 10700},
37 { 6, 12850},
38 { 7, 14980},
39 { 8, 18190},
40 { 9, 22500},
41 };
42 #define NUM_FL (int)(sizeof(fl_tbl)/sizeof(fl_tbl[0]))
43
44
45
46
47 #define CF_EFL 46666
48
49 const int zoom_points = NUM_FL;
50
51 int get_effective_focal_length(int zp) {
52 return (CF_EFL*get_focal_length(zp))/10000;
53 }
54
55 int get_focal_length(int zp) {
56 int i;
57
58 if (zp<fl_tbl[0].zp)
59 return fl_tbl[0].fl;
60 else if (zp>fl_tbl[NUM_FL-1].zp)
61 return fl_tbl[NUM_FL-1].fl;
62 else
63 for (i=1; i<NUM_FL; ++i) {
64 if (zp==fl_tbl[i-1].zp)
65 return fl_tbl[i-1].fl;
66 else if (zp==fl_tbl[i].zp)
67 return fl_tbl[i].fl;
68 else if (zp<fl_tbl[i].zp)
69 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);
70 }
71 return fl_tbl[NUM_FL-1].fl;
72 }
73
74 int get_zoom_x(int zp) {
75 return get_focal_length(zp)*10/fl_tbl[0].fl;
76 }
77
78
79 long get_vbatt_min()
80 {
81 return 3000;
82 }
83
84 long get_vbatt_max()
85 {
86 return 4100;
87 }
88