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