source: branches/release-1_0/platform/sx40hs/main.c @ 1770

Revision 1770, 1.4 KB checked in by philmoz, 14 months ago (diff)

Merge CHDK-DE revision 975 into CHDK.

  • 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
6
7extern long link_bss_start;
8extern long link_bss_end;
9extern void boot();
10
11
12void startup()
13{
14        long *bss = &link_bss_start;
15        long *ptr;
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
30int screen_opened(void) {
31        return (physw_status[2] & 0x00000400);
32}
33
34int screen_rotated(void) {
35        return !(physw_status[2] & 0x00000100);
36}
37
38// Focus length table in firmware @ 0xfff4a7b4
39#define NUM_FL      201 // 0 - 200, entries in firmware
40#define NUM_DATA    1   // 1 int value each entry
41extern int focus_len_table[NUM_FL*NUM_DATA];
42
43// Conversion factor lens FL --> 35mm equiv
44// lens      35mm     CF
45// ----      ----     --
46// 4.3       24       ( 24/  4.3) * 43 = 240  (min FL)
47// 150.5     840      (840/150.5) * 43 = 240  (max FL)
48#define CF_EFL      240
49#define CF_EFL_DIV  43
50
51const int zoom_points = NUM_FL;
52
53int get_effective_focal_length(int zp) {
54    return (CF_EFL*get_focal_length(zp))/CF_EFL_DIV;
55}
56
57int get_focal_length(int zp) {
58    if (zp < 0) zp = 0;
59    else if (zp >= NUM_FL) zp = NUM_FL-1;
60    return focus_len_table[zp*NUM_DATA];
61}
62
63int get_zoom_x(int zp) {
64    return get_focal_length(zp)*10/focus_len_table[0];
65}
66
67long get_vbatt_min()
68{
69        return 6450;
70}
71
72long get_vbatt_max()
73{
74        return 8300;
75}
76
Note: See TracBrowser for help on using the repository browser.