source: branches/reyalp-ptp-live/platform/g10/lib.c @ 1728

Revision 1728, 2.5 KB checked in by reyalp, 14 months ago (diff)

untested live view bitmap + palette functions for g10 102a

  • 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// #  Index   LED
44// 1   0      Upper indicator Green
45// 2   1      Upper indicator Orange
46// 3   2      Lower indicator Yellow
47// 4   3      Power LED Green
48// 5   8      Blue print button LED
49// 6   9      AF Assist Lamp
50//     10     "
51//     11     "
52// 7   14     ISO LED
53// 8   15     EV LED
54
55void camera_set_led(int led, int state, int bright) {
56 static char led_table[8]={0,1,2,3,8,9,14,15};
57 _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state);
58}
59
60int get_flash_params_count(void){
61 return 0x78 ;          // G10 per SD990 & finsig2 - _sub_FF971C10__PropertyTableManagerCore.c__6 value at 0xff971c50 in 1.02a
62 // found in GetParameterData
63}
64
65void JogDial_CW(void){
66 _PostLogicalEventForNotPowerType(0x86E, 1);  // RotateJogDialRight (G10 1.02A table @ FFB43EEC)
67}
68
69void JogDial_CCW(void){
70 _PostLogicalEventForNotPowerType(0x86F, 1);  // RotateJogDialLeft (G10 1.02A table @ FFB43EF8)
71}
72
73// Viewport and Bitmap values that shouldn't change across firmware versions.
74// Values that may change are in lib.c for each firmware version.
75
76int vid_get_viewport_width()
77{
78        return 360 ;   //  G10
79}
80
81long vid_get_viewport_height()
82{
83   return 240;    //  G10
84}
85
86// Y multiplier for cameras with 480 pixel high viewports (CHDK code assumes 240)
87int vid_get_viewport_yscale() {
88        return 2;               // G10 viewport is 480 pixels high
89}
90
91// looks like 256 byte from sub_FF8F3270
92int vid_get_palette_type() { return 3; }
93int vid_get_palette_size() { return 256*4; }
94
Note: See TracBrowser for help on using the repository browser.