source: trunk/platform/g10/lib.c @ 2798

Revision 2581, 2.7 KB checked in by philmoz, 3 months ago (diff)

Motion detection updates from waterwingz:
http://chdk.setepontos.com/index.php?topic=650.msg96967#msg96967
http://chdk.setepontos.com/index.php?topic=650.msg97003#msg97003

  • Property svn:eol-style set to native
Line 
1#include "platform.h"
2#include "lolevel.h"
3
4void vid_bitmap_refresh()    // G10 : ixus980_sd990 version seems to work well
5{
6        _ScreenLock();
7    _RefreshPhysicalScreen(1);
8}
9
10
11void shutdown()    // G10 sub_FF829EC8
12{
13        volatile long *p = (void*)0xC022001C;    // G10 @ 0xFF829EE4,0xFF829EE8 & 0xFF829EEC
14       
15        asm(
16                "MRS     R1, CPSR\n"
17                "AND     R0, R1, #0x80\n"
18                "ORR     R1, R1, #0x80\n"
19                "MSR     CPSR_cf, R1\n"
20                :::"r1","r0");
21       
22        *p = 0x44;  // power off.
23       
24        while(1);
25}
26
27
28// 0xC02200D0  G10 ISO select dial LED
29// 0xC02200D4  G10 direct print button LED
30// 0xC02200D8  G10 exposure compensation dial LED
31// 0xC02200DC  G10 power LED
32// 0xC0220130  G10 Upper Indicator Orange (looks yellow if both upper indicators lit)
33// 0xC0220134  G10 Upper Indicator Green
34// 0xC0220138  G10 Lower Indicator Yellow
35#define LED_PR  0xC02200D4      //  G10 direct print button LED
36
37void debug_led(int state)
38{
39  *(int*)LED_PR=state ? 0x46 : 0x44;
40}
41
42// G10 has 8 led values - tested with uBasic  set_led n, 1   (no brightness control implemented)
43// set_led led_table  LED
44// ======= =========  =====================
45//   0         0      Upper indicator Green
46//   1         1      Upper indicator Orange
47//   2         2      Lower indicator Yellow
48//   3         3      Power LED Green
49//   4         8      Blue print button LED
50//   5         9      AF Assist Lamp (also index 9&10)
51//   6         14     ISO LED
52//   7         15     EV LED
53
54void camera_set_led(int led, int state, int bright) {
55 static char led_table[8]={0,1,2,3,8,9,14,15};
56 _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
57}
58
59int get_flash_params_count(void){
60 return 0x78 ;          // G10 per SD990 & finsig2 - _sub_FF971C10__PropertyTableManagerCore.c__6 value at 0xff971c50 in 1.02a
61 // found in GetParameterData
62}
63
64void JogDial_CW(void){
65 _PostLogicalEventForNotPowerType(0x86E, 1);  // RotateJogDialRight (G10 1.02A table @ FFB43EEC)
66}
67
68void JogDial_CCW(void){
69 _PostLogicalEventForNotPowerType(0x86F, 1);  // RotateJogDialLeft (G10 1.02A table @ FFB43EF8)
70}
71
72// Viewport and Bitmap values that shouldn't change across firmware versions.
73// Values that may change are in lib.c for each firmware version.
74
75int vid_get_viewport_width()
76{
77        return 360 ;   //  G10
78}
79
80long vid_get_viewport_height()
81{
82   return 240;    //  G10
83}
84
85// Y multiplier for cameras with 480 pixel high viewports (CHDK code assumes 240)
86int vid_get_viewport_yscale() {
87        return 2;               // G10 viewport is 480 pixels high
88}
89
90// looks like 256 byte from sub_FF8F3270
91int vid_get_palette_type() { return 3; }
92int vid_get_palette_size() { return 256*4; }
93
94// TODO actual value probably varies in some cases
95int vid_get_viewport_height_proper() { return 480; }
96int vid_get_viewport_fullscreen_height() { return 480; }
Note: See TracBrowser for help on using the repository browser.