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