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