aboutsummaryrefslogtreecommitdiff
path: root/command.c
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2011-09-17 22:39:50 +0900
committertmk <nobody@nowhere>2011-09-17 23:53:18 +0900
commite67c988824f5ec0c965beb412f8ee5953dfd3c8c (patch)
tree190543f5bddfd31a326234aad91a0a995e55863a /command.c
parentb703de7b298f8463bf4654fa3730ba1958a7fa9e (diff)
downloadqmk_firmware-e67c988824f5ec0c965beb412f8ee5953dfd3c8c.tar.gz
qmk_firmware-e67c988824f5ec0c965beb412f8ee5953dfd3c8c.zip
Added Bulegiga iWRAP support into HHKB.(Bluetooth)
Diffstat (limited to 'command.c')
-rw-r--r--command.c56
1 files changed, 42 insertions, 14 deletions
diff --git a/command.c b/command.c
index 0a07aebfc..22f25e99c 100644
--- a/command.c
+++ b/command.c
@@ -30,24 +30,49 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
30#ifdef HOST_PJRC 30#ifdef HOST_PJRC
31# include "jump_bootloader.h" 31# include "jump_bootloader.h"
32# include "usb_keyboard.h" 32# include "usb_keyboard.h"
33# ifdef USB_EXTRA_ENABLE 33# ifdef EXTRAKEY_ENABLE
34# include "usb_extra.h" 34# include "usb_extra.h"
35# endif 35# endif
36#endif 36#endif
37 37
38#ifdef HOST_VUSB
39# include "usbdrv.h"
40#endif
41
38 42
43static uint8_t command_common(void);
39static void help(void); 44static void help(void);
40static void switch_layer(uint8_t layer); 45static void switch_layer(uint8_t layer);
41 46
47static bool last_print_enable;
42 48
43uint8_t command_proc(void) 49uint8_t command_proc(void)
44{ 50{
51 uint8_t processed = 0;
52 last_print_enable = print_enable;
53
45 if (!IS_COMMAND()) 54 if (!IS_COMMAND())
46 return 0; 55 return 0;
47 56
48 uint8_t processed = 1;
49 bool last_print_enable = print_enable;
50 print_enable = true; 57 print_enable = true;
58 if (command_extra() || command_common()) {
59 processed = 1;
60 _delay_ms(500);
61 }
62 print_enable = last_print_enable;
63 return processed;
64}
65
66/* This allows to define extra commands. return 0 when not processed. */
67uint8_t command_extra(void) __attribute__ ((weak));
68uint8_t command_extra(void)
69{
70 return 0;
71}
72
73
74static uint8_t command_common(void)
75{
51 switch (host_get_first_key()) { 76 switch (host_get_first_key()) {
52 case KB_H: 77 case KB_H:
53 help(); 78 help();
@@ -123,20 +148,26 @@ uint8_t command_proc(void)
123 print("usb_keyboard_idle_config:"); phex(usb_keyboard_idle_config); print("\n"); 148 print("usb_keyboard_idle_config:"); phex(usb_keyboard_idle_config); print("\n");
124 print("usb_keyboard_idle_count:"); phex(usb_keyboard_idle_count); print("\n"); 149 print("usb_keyboard_idle_count:"); phex(usb_keyboard_idle_count); print("\n");
125#endif 150#endif
151
152#ifdef HOST_VUSB
153# if USB_COUNT_SOF
154 print("usbSofCount: "); phex(usbSofCount); print("\n");
155# endif
156#endif
126 break; 157 break;
127#ifdef USB_NKRO_ENABLE 158#ifdef NKRO_ENABLE
128 case KB_N: 159 case KB_N:
129 // send empty report before change 160 // send empty report before change
130 host_clear_keyboard_report(); 161 host_clear_keyboard_report();
131 host_send_keyboard_report(); 162 host_send_keyboard_report();
132 keyboard_nkro = !keyboard_nkro; 163 keyboard_nkro = !keyboard_nkro;
133 if (keyboard_nkro) 164 if (keyboard_nkro)
134 print("USB_NKRO: enabled\n"); 165 print("NKRO: enabled\n");
135 else 166 else
136 print("USB_NKRO: disabled\n"); 167 print("NKRO: disabled\n");
137 break; 168 break;
138#endif 169#endif
139#ifdef USB_EXTRA_ENABLE 170#ifdef EXTRAKEY_ENABLE
140 case KB_ESC: 171 case KB_ESC:
141 host_clear_keyboard_report(); 172 host_clear_keyboard_report();
142 host_send_keyboard_report(); 173 host_send_keyboard_report();
@@ -175,12 +206,9 @@ uint8_t command_proc(void)
175 switch_layer(4); 206 switch_layer(4);
176 break; 207 break;
177 default: 208 default:
178 processed = 0; 209 return 0;
179 } 210 }
180 if (processed) 211 return 1;
181 _delay_ms(500);
182 print_enable = last_print_enable;
183 return processed;
184} 212}
185 213
186static void help(void) 214static void help(void)
@@ -194,8 +222,8 @@ static void help(void)
194 print("v: print version\n"); 222 print("v: print version\n");
195 print("t: print timer count\n"); 223 print("t: print timer count\n");
196 print("s: print status\n"); 224 print("s: print status\n");
197#ifdef USB_NKRO_ENABLE 225#ifdef NKRO_ENABLE
198 print("n: toggle USB_NKRO\n"); 226 print("n: toggle NKRO\n");
199#endif 227#endif
200 print("Backspace: clear matrix\n"); 228 print("Backspace: clear matrix\n");
201 print("ESC: power down/wake up\n"); 229 print("ESC: power down/wake up\n");