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