| 1 | #include "platform.h" |
|---|
| 2 | #include "lolevel.h" |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | void vid_bitmap_refresh() |
|---|
| 6 | { |
|---|
| 7 | extern int full_screen_refresh; |
|---|
| 8 | |
|---|
| 9 | extern void _LockAndRefresh(); // wrapper function for screen lock |
|---|
| 10 | extern void _UnlockAndRefresh(); // wrapper function for screen unlock |
|---|
| 11 | |
|---|
| 12 | full_screen_refresh |= 3; //found in ScreenUnlock |
|---|
| 13 | _LockAndRefresh(); |
|---|
| 14 | _UnlockAndRefresh(); |
|---|
| 15 | } |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | void shutdown() |
|---|
| 19 | { |
|---|
| 20 | volatile long *p = (void*)0xC022001C; |
|---|
| 21 | |
|---|
| 22 | asm( |
|---|
| 23 | "MRS R1, CPSR\n" |
|---|
| 24 | "AND R0, R1, #0x80\n" |
|---|
| 25 | "ORR R1, R1, #0x80\n" |
|---|
| 26 | "MSR CPSR_cf, R1\n" |
|---|
| 27 | :::"r1","r0"); |
|---|
| 28 | |
|---|
| 29 | *p = 0x44; // power off. |
|---|
| 30 | |
|---|
| 31 | while(1); |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | #define LED_PR 0xC0220130 |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | void debug_led(int state) |
|---|
| 38 | { |
|---|
| 39 | *(int*)LED_PR=state ? 0x46 : 0x44; |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | void camera_set_led(int led, int state, int bright) { |
|---|
| 43 | static char led_table[2]={0,9}; |
|---|
| 44 | _LEDDrive(led_table[led%sizeof(led_table)], state<=1 ? !state : state); |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | int get_flash_params_count(void){ |
|---|
| 48 | return 0xA0; //@FF1B94A8 in GetParameterData |
|---|
| 49 | } |
|---|
| 50 | |
|---|
| 51 | void JogDial_CW(void){ |
|---|
| 52 | _PostLogicalEventForNotPowerType(0x86E, 1); // @FF416880 (100c) |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | void JogDial_CCW(void){ |
|---|
| 56 | _PostLogicalEventForNotPowerType(0x86F, 1); // @FF41688C (100c) |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | // Viewport and Bitmap values that shouldn't change across firmware versions. |
|---|
| 61 | // Values that may change are in lib.c for each firmware version. |
|---|
| 62 | |
|---|
| 63 | // Physical width of viewport row in bytes |
|---|
| 64 | int vid_get_viewport_byte_width() { |
|---|
| 65 | return 960 * 6 / 4; // SX230HS - wide screen LCD is 960 pixels wide, each group of 4 pixels uses 6 bytes (UYVYYY) |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | // Y multiplier for cameras with 480 pixel high viewports (CHDK code assumes 240) |
|---|
| 69 | int vid_get_viewport_yscale() { |
|---|
| 70 | return 2; // SX230HS viewport is 480 pixels high |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | int vid_get_viewport_width() |
|---|
| 75 | { |
|---|
| 76 | // viewport width table for each image size |
|---|
| 77 | // 0 = 4:3, 1 = 16:9, 2 = 3:2, 3 = 1:1 |
|---|
| 78 | static long vp_w[4] = { 360, 480, 360, 272 }; |
|---|
| 79 | return vp_w[shooting_get_prop(PROPCASE_ASPECT_RATIO)]; |
|---|
| 80 | } |
|---|
| 81 | |
|---|
| 82 | int vid_get_viewport_display_xoffset() |
|---|
| 83 | { |
|---|
| 84 | // viewport width offset table for each image size |
|---|
| 85 | // 0 = 4:3, 1 = 16:9, 2 = 3:2, 3 = 1:1 |
|---|
| 86 | static long vp_w[4] = { 60, 0, 36, 104 }; // should all be even values for edge overlay |
|---|
| 87 | return vp_w[shooting_get_prop(PROPCASE_ASPECT_RATIO)]; |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | long vid_get_viewport_height(){ return 240; } |
|---|
| 91 | |
|---|