This source file includes following definitions.
- get_usb_bit
- mykbd_task
- wrap_kbd_p1_f
- jogdial_control
- my_kbd_read_keys
- kbd_fetch_data
- get_jogdial_direction
1 #include "lolevel.h"
2 #include "platform.h"
3 #include "conf.h"
4 #include "keyboard.h"
5 #include "kbd_common.h"
6
7 long kbd_new_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
8 long kbd_prev_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
9 long kbd_mod_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
10
11 extern void _GetKbdState(long*);
12
13 int get_usb_bit()
14 {
15 long usb_physw[3];
16 usb_physw[USB_IDX] = 0;
17 _kbd_read_keys_r2(usb_physw);
18 return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ;
19 }
20
21 KeyMap keymap[] = {
22 { 0, KEY_SET ,0x00000400 },
23 { 0, KEY_DISPLAY ,0x00000800 },
24 { 0, KEY_DOWN ,0x00001000 },
25 { 0, KEY_MENU ,0x00002000 },
26 { 0, KEY_LEFT ,0x00004000 },
27 { 0, KEY_UP ,0x00040000 },
28 { 0, KEY_RIGHT ,0x00080000 },
29 { 2, KEY_POWER ,0x00000800 },
30 { 2, KEY_PLAYBACK ,0x00001000 },
31 { 2, KEY_SHOOT_FULL ,0x0000c000 },
32 { 2, KEY_SHOOT_FULL_ONLY ,0x00008000 },
33 { 2, KEY_SHOOT_HALF ,0x00004000 },
34 { 0, KEY_PRINT ,0x00800000 },
35 { 0, KEY_FLASH ,0x00400000 },
36 { 0, KEY_ERASE ,0x00020000 },
37 { 0, KEY_VIDEO ,0x00010000 },
38 { 0, KEY_ZOOM_IN ,0x00000060 },
39 { 0, KEY_ZOOM_IN ,0x00000020 },
40 { 0, KEY_ZOOM_IN ,0x00000040 },
41 { 0, KEY_ZOOM_OUT ,0x00000180 },
42 { 0, KEY_ZOOM_OUT ,0x00000080 },
43 { 0, KEY_ZOOM_OUT ,0x00000100 },
44 { 0, 0, 0 }
45 };
46
47
48 long __attribute__((naked)) wrap_kbd_p1_f();
49
50
51
52 void __attribute__((noinline))
53 mykbd_task()
54 {
55 while (physw_run){
56 _SleepTask(physw_sleep_delay);
57
58 if (wrap_kbd_p1_f() == 1){
59 _kbd_p2_f();
60 }
61 }
62 _ExitTask();
63 }
64
65 long __attribute__((naked,noinline)) wrap_kbd_p1_f()
66 {
67 asm volatile(
68 "STMFD SP!, {R1-R7,LR}\n"
69 "MOV R5, #0\n"
70
71 "BL my_kbd_read_keys\n"
72 "B _kbd_p1_f_cont\n"
73 );
74 return 0;
75 }
76
77
78 int jogdial_stopped=0;
79
80
81
82 extern short* jog_position;
83 extern short rear_dial_position;
84
85 void jogdial_control(int n)
86 {
87 if (jogdial_stopped && !n)
88 {
89
90
91 jog_position[0] = jog_position[2] = rear_dial_position;
92 }
93 jogdial_stopped = n;
94 }
95
96 void my_kbd_read_keys()
97 {
98 kbd_update_key_state();
99 kbd_update_physw_bits();
100
101
102 if (conf.zoom_assist_button_disable)
103 physw_status[0] |= 0x00010000;
104 }
105
106 void kbd_fetch_data(long *dst)
107 {
108 _GetKbdState(dst);
109 _kbd_read_keys_r2(dst);
110 }
111
112
113
114 static short new_jogdial=0, old_jogdial=0;
115
116 long get_jogdial_direction(void)
117 {
118 old_jogdial = new_jogdial;
119 new_jogdial = rear_dial_position;
120 if (old_jogdial < new_jogdial) return JOGDIAL_RIGHT;
121 else if (old_jogdial > new_jogdial) return JOGDIAL_LEFT;
122 else return 0;
123 }