aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hhkb/keymap.c4
-rw-r--r--key_process.c84
-rw-r--r--tmk.c17
-rw-r--r--usb.c53
-rw-r--r--usb.h10
-rw-r--r--usb_extra.c15
-rw-r--r--usb_extra.h8
7 files changed, 140 insertions, 51 deletions
diff --git a/hhkb/keymap.c b/hhkb/keymap.c
index ea8e39a93..42a830c52 100644
--- a/hhkb/keymap.c
+++ b/hhkb/keymap.c
@@ -71,7 +71,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
71 71
72 /* Layer 1: HHKB mode (HHKB Fn) 72 /* Layer 1: HHKB mode (HHKB Fn)
73 * ,-----------------------------------------------------------. 73 * ,-----------------------------------------------------------.
74 * |Pow| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del| 74 * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Ins|Del|
75 * |-----------------------------------------------------------| 75 * |-----------------------------------------------------------|
76 * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs| 76 * |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs|
77 * |-----------------------------------------------------------| 77 * |-----------------------------------------------------------|
@@ -82,7 +82,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
82 * |Gui |Alt |Space |Alt |xxx| 82 * |Gui |Alt |Space |Alt |xxx|
83 * `--------------------------------------------' 83 * `--------------------------------------------'
84 */ 84 */
85 KEYMAP(KB_PWR, KB_F1, KB_F2, KB_F3, KB_F4, KB_F5, KB_F6, KB_F7, KB_F8, KB_F9, KB_F10, KB_F11, KB_F12, KB_INS, KB_DEL, \ 85 KEYMAP(KB_ESC, KB_F1, KB_F2, KB_F3, KB_F4, KB_F5, KB_F6, KB_F7, KB_F8, KB_F9, KB_F10, KB_F11, KB_F12, KB_INS, KB_DEL, \
86 KB_CAPS,KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_PSCR,KB_SLCK,KB_BRK, KB_UP, KB_NO, KB_BSPC, \ 86 KB_CAPS,KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_PSCR,KB_SLCK,KB_BRK, KB_UP, KB_NO, KB_BSPC, \
87 KB_LCTL,KB_VOLD,KB_VOLU,KB_MUTE,KB_NO, KB_NO, KP_ASTR,KP_SLSH,KB_HOME,KB_PGUP,KB_LEFT,KB_RGHT,KB_ENT, \ 87 KB_LCTL,KB_VOLD,KB_VOLU,KB_MUTE,KB_NO, KB_NO, KP_ASTR,KP_SLSH,KB_HOME,KB_PGUP,KB_LEFT,KB_RGHT,KB_ENT, \
88 KB_LSFT,KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KP_PLUS,KP_MINS,KB_END, KB_PGDN,KB_DOWN,KB_RSFT,FN_1, \ 88 KB_LSFT,KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KP_PLUS,KP_MINS,KB_END, KB_PGDN,KB_DOWN,KB_RSFT,FN_1, \
diff --git a/key_process.c b/key_process.c
index 243f4aad8..0bd202806 100644
--- a/key_process.c
+++ b/key_process.c
@@ -10,6 +10,7 @@
10#include "usb_mouse.h" 10#include "usb_mouse.h"
11#include "usb_extra.h" 11#include "usb_extra.h"
12#include "usb_keycodes.h" 12#include "usb_keycodes.h"
13#include "usb.h"
13#include "layer.h" 14#include "layer.h"
14#include "matrix_skel.h" 15#include "matrix_skel.h"
15#include "keymap_skel.h" 16#include "keymap_skel.h"
@@ -31,7 +32,6 @@ void proc_matrix(void) {
31 static int mouse_repeat = 0; 32 static int mouse_repeat = 0;
32 33
33 bool modified = false; 34 bool modified = false;
34 //bool has_ghost = false;
35 int key_index = 0; 35 int key_index = 0;
36 uint8_t mouse_btn = 0; 36 uint8_t mouse_btn = 0;
37 int8_t mouse_x = 0; 37 int8_t mouse_x = 0;
@@ -42,7 +42,7 @@ void proc_matrix(void) {
42 42
43 matrix_scan(); 43 matrix_scan();
44 modified = matrix_is_modified(); 44 modified = matrix_is_modified();
45 45
46 if (modified) { 46 if (modified) {
47 if (debug_matrix) matrix_print(); 47 if (debug_matrix) matrix_print();
48#ifdef DEBUG_LED 48#ifdef DEBUG_LED
@@ -63,46 +63,54 @@ void proc_matrix(void) {
63 for (int col = 0; col < matrix_cols(); col++) { 63 for (int col = 0; col < matrix_cols(); col++) {
64 if (!matrix_is_on(row, col)) continue; 64 if (!matrix_is_on(row, col)) continue;
65 65
66 // TODO: clean code
66 uint8_t code = layer_get_keycode(row, col); 67 uint8_t code = layer_get_keycode(row, col);
67 if (code == KB_NO) { 68 if (code == KB_NO) {
68 // do nothing 69 // do nothing
69 } else if (IS_MOD(code)) { 70 } else if (IS_MOD(code)) {
70 usb_keyboard_mods |= MOD_BIT(code); 71 usb_keyboard_mods |= MOD_BIT(code);
72 } else if (IS_FN(code)) {
73 fn_bits |= FN_BIT(code);
71 } else if (IS_MOUSE(code)) { 74 } else if (IS_MOUSE(code)) {
72 // mouse 75 if (code == MS_UP) mouse_y -= MOUSE_MOVE_UNIT + MOUSE_MOVE_ACCEL;
73 if (code == MS_UP) 76 if (code == MS_DOWN) mouse_y += MOUSE_MOVE_UNIT + MOUSE_MOVE_ACCEL;
74 mouse_y -= MOUSE_MOVE_UNIT + MOUSE_MOVE_ACCEL; 77 if (code == MS_LEFT) mouse_x -= MOUSE_MOVE_UNIT + MOUSE_MOVE_ACCEL;
75 if (code == MS_DOWN) 78 if (code == MS_RGHT) mouse_x += MOUSE_MOVE_UNIT + MOUSE_MOVE_ACCEL;
76 mouse_y += MOUSE_MOVE_UNIT + MOUSE_MOVE_ACCEL;
77 if (code == MS_LEFT)
78 mouse_x -= MOUSE_MOVE_UNIT + MOUSE_MOVE_ACCEL;
79 if (code == MS_RIGHT)
80 mouse_x += MOUSE_MOVE_UNIT + MOUSE_MOVE_ACCEL;
81 if (code == MS_BTN1) mouse_btn |= BIT_BTN1; 79 if (code == MS_BTN1) mouse_btn |= BIT_BTN1;
82 if (code == MS_BTN2) mouse_btn |= BIT_BTN2; 80 if (code == MS_BTN2) mouse_btn |= BIT_BTN2;
83 if (code == MS_BTN3) mouse_btn |= BIT_BTN3; 81 if (code == MS_BTN3) mouse_btn |= BIT_BTN3;
84 if (code == MS_BTN4) mouse_btn |= BIT_BTN4; 82 if (code == MS_BTN4) mouse_btn |= BIT_BTN4;
85 if (code == MS_BTN5) mouse_btn |= BIT_BTN5; 83 if (code == MS_BTN5) mouse_btn |= BIT_BTN5;
86 if (code == MS_WH_UP) mouse_vwheel += 1; 84 if (code == MS_WH_U) mouse_vwheel += 1;
87 if (code == MS_WH_DOWN) mouse_vwheel -= 1; 85 if (code == MS_WH_D) mouse_vwheel -= 1;
88 if (code == MS_WH_LEFT) mouse_hwheel -= 1; 86 if (code == MS_WH_L) mouse_hwheel -= 1;
89 if (code == MS_WH_RIGHT) mouse_hwheel += 1; 87 if (code == MS_WH_R) mouse_hwheel += 1;
90 } else if (IS_FN(code)) { 88 }
91 fn_bits |= FN_BIT(code); 89
92 } else if (code == KB_MUTE) { 90 // audio control & system control
93 usb_extra_send(AUDIO_MUTE); 91 else if (code == KB_MUTE) {
94 usb_extra_send(0); 92 usb_extra_audio_send(AUDIO_MUTE);
93 usb_extra_audio_send(0);
95 _delay_ms(500); 94 _delay_ms(500);
96 } else if (code == KB_VOLU) { 95 } else if (code == KB_VOLU) {
97 usb_extra_send(AUDIO_VOL_UP); 96 usb_extra_audio_send(AUDIO_VOL_UP);
98 usb_extra_send(0); 97 usb_extra_audio_send(0);
99 _delay_ms(100); 98 _delay_ms(100);
100 } else if (code == KB_VOLD) { 99 } else if (code == KB_VOLD) {
101 usb_extra_send(AUDIO_VOL_DOWN); 100 usb_extra_audio_send(AUDIO_VOL_DOWN);
102 usb_extra_send(0); 101 usb_extra_audio_send(0);
103 _delay_ms(100); 102 _delay_ms(100);
104 } else { 103 } else if (code == KB_PWR) {
105 // normal keys 104 if (suspend && remote_wakeup) {
105 usb_remote_wakeup();
106 } else {
107 usb_extra_system_send(SYSTEM_POWER_DOWN);
108 }
109 _delay_ms(1000);
110 }
111
112 // normal keys
113 else {
106 if (key_index < 6) 114 if (key_index < 6)
107 usb_keyboard_keys[key_index] = code; 115 usb_keyboard_keys[key_index] = code;
108 key_index++; 116 key_index++;
@@ -120,6 +128,7 @@ void proc_matrix(void) {
120 128
121 layer_switching(fn_bits); 129 layer_switching(fn_bits);
122 130
131 // TODO: clean code
123 // when 4 left modifier keys down 132 // when 4 left modifier keys down
124 if (keymap_is_special_mode(fn_bits)) { 133 if (keymap_is_special_mode(fn_bits)) {
125 switch (usb_keyboard_keys[0]) { 134 switch (usb_keyboard_keys[0]) {
@@ -127,12 +136,14 @@ void proc_matrix(void) {
127 print_enable = true; 136 print_enable = true;
128 print("b: jump to bootloader\n"); 137 print("b: jump to bootloader\n");
129 print("d: debug print toggle\n"); 138 print("d: debug print toggle\n");
139 print("x: matrix debug toggle\n");
130 print("k: keyboard debug toggle\n"); 140 print("k: keyboard debug toggle\n");
131 print("m: mouse debug toggle\n"); 141 print("m: mouse debug toggle\n");
132 print("x: matrix debug toggle\n"); 142 print("p: print enable toggle\n");
133 print("v: print version\n"); 143 print("v: print version\n");
134 print("t: print timer count\n"); 144 print("t: print timer count\n");
135 print("p: print enable toggle\n"); 145 print("r: print registers\n");
146 print("ESC: power down/wake up\n");
136 _delay_ms(500); 147 _delay_ms(500);
137 print_enable = false; 148 print_enable = false;
138 break; 149 break;
@@ -219,6 +230,23 @@ void proc_matrix(void) {
219 } 230 }
220 _delay_ms(1000); 231 _delay_ms(1000);
221 break; 232 break;
233 case KB_R:
234 usb_keyboard_clear_report();
235 usb_keyboard_send();
236 print("UDIEN: "); phex(UDIEN); print("\n");
237 print("UDINT: "); phex(UDINT); print("\n");
238 _delay_ms(1000);
239 break;
240 case KB_ESC:
241 usb_keyboard_clear_report();
242 usb_keyboard_send();
243 if (suspend && remote_wakeup) {
244 usb_remote_wakeup();
245 } else {
246 usb_extra_system_send(SYSTEM_POWER_DOWN);
247 }
248 _delay_ms(1000);
249 break;
222 } 250 }
223 } 251 }
224 252
diff --git a/tmk.c b/tmk.c
index 2ad31e97d..f7042bd6f 100644
--- a/tmk.c
+++ b/tmk.c
@@ -36,6 +36,7 @@
36#include "util.h" 36#include "util.h"
37#include "controller.h" 37#include "controller.h"
38#include "timer.h" 38#include "timer.h"
39#include "jump_bootloader.h"
39 40
40 41
41#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n)) 42#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
@@ -65,14 +66,8 @@ int main(void)
65 66
66 matrix_init(); 67 matrix_init();
67 matrix_scan(); 68 matrix_scan();
68 // debug on by pressing down any 4 or more keys during boot time. 69 // bootloader comes up when any 4 or more keys are pressed at startup
69 if (matrix_key_count() >= 4) { 70 if (matrix_key_count() >= 4) {
70 print_enable = true;
71 debug_enable = true;
72 }
73
74 /* wait for debug pipe ready */
75 if (print_enable) {
76#ifdef DEBUG_LED 71#ifdef DEBUG_LED
77 for (int i = 0; i < 6; i++) { 72 for (int i = 0; i < 6; i++) {
78 DEBUG_LED_CONFIG; 73 DEBUG_LED_CONFIG;
@@ -82,11 +77,13 @@ int main(void)
82 _delay_ms(500); 77 _delay_ms(500);
83 } 78 }
84#else 79#else
85 _delay_ms(6000); 80 _delay_ms(5000);
86#endif 81#endif
82 print_enable = true;
83 print("jump to bootloader...\n");
84 _delay_ms(1000);
85 jump_bootloader(); // not return
87 } 86 }
88 // print description
89 print(STR(DESCRIPTION) "\n");
90 87
91 while (1) { 88 while (1) {
92 proc_matrix(); 89 proc_matrix();
diff --git a/usb.c b/usb.c
index 7add57daa..d3aa46e2d 100644
--- a/usb.c
+++ b/usb.c
@@ -21,6 +21,8 @@
21 * THE SOFTWARE. 21 * THE SOFTWARE.
22 */ 22 */
23 23
24#include <stdint.h>
25#include <stdbool.h>
24#include <avr/io.h> 26#include <avr/io.h>
25#include <avr/pgmspace.h> 27#include <avr/pgmspace.h>
26#include <avr/interrupt.h> 28#include <avr/interrupt.h>
@@ -82,6 +84,9 @@
82 84
83#define ENDPOINT0_SIZE 32 85#define ENDPOINT0_SIZE 32
84 86
87bool remote_wakeup = false;
88bool suspend = false;
89
85// 0:control endpoint is enabled automatically by controller. 90// 0:control endpoint is enabled automatically by controller.
86static const uint8_t PROGMEM endpoint_config_table[] = { 91static const uint8_t PROGMEM endpoint_config_table[] = {
87 // enable, UECFG0X(type, direction), UECFG1X(size, bank, allocation) 92 // enable, UECFG0X(type, direction), UECFG1X(size, bank, allocation)
@@ -250,7 +255,7 @@ static uint8_t PROGMEM debug_hid_report_desc[] = {
250 0xC0 // end collection 255 0xC0 // end collection
251}; 256};
252 257
253// audio controls(consumer page) 258// audio controls & system controls
254// http://www.microsoft.com/whdc/archive/w2kbd.mspx 259// http://www.microsoft.com/whdc/archive/w2kbd.mspx
255static uint8_t PROGMEM extra_hid_report_desc[] = { 260static uint8_t PROGMEM extra_hid_report_desc[] = {
256 0x05, 0x0c, // USAGE_PAGE (Consumer Devices) 261 0x05, 0x0c, // USAGE_PAGE (Consumer Devices)
@@ -272,6 +277,18 @@ static uint8_t PROGMEM extra_hid_report_desc[] = {
272 0x81, 0x06, // INPUT (Data,Var,Rel) 277 0x81, 0x06, // INPUT (Data,Var,Rel)
273 0x95, 0x05, // REPORT_COUNT (5) 278 0x95, 0x05, // REPORT_COUNT (5)
274 0x81, 0x07, // INPUT (Cnst,Var,Abs) 279 0x81, 0x07, // INPUT (Cnst,Var,Abs)
280 0xc0, // END_COLLECTION
281
282 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
283 0x09, 0x80, // USAGE (System Control)
284 0xa1, 0x01, // COLLECTION (Application)
285 0x85, 0x02, // REPORT_ID (2)
286 0x19, 0x81, // USAGE_MINIMUM (System Power Down)
287 0x29, 0x83, // USAGE_MAXIMUM (System Wake Up)
288 0x95, 0x03, // REPORT_COUNT (3)
289 0x81, 0x06, // INPUT (Data,Var,Rel)
290 0x95, 0x05, // REPORT_COUNT (5)
291 0x81, 0x07, // INPUT (Cnst,Var,Rel)
275 0xc0 // END_COLLECTION 292 0xc0 // END_COLLECTION
276}; 293};
277 294
@@ -289,7 +306,7 @@ static uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = {
289 4, // bNumInterfaces 306 4, // bNumInterfaces
290 1, // bConfigurationValue 307 1, // bConfigurationValue
291 0, // iConfiguration 308 0, // iConfiguration
292 0xC0, // bmAttributes 309 0xA0, // bmAttributes
293 50, // bMaxPower 310 50, // bMaxPower
294 311
295 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12 312 // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
@@ -484,7 +501,7 @@ void usb_init(void)
484 USB_CONFIG(); // start USB clock 501 USB_CONFIG(); // start USB clock
485 UDCON = 0; // enable attach resistor 502 UDCON = 0; // enable attach resistor
486 usb_configuration = 0; 503 usb_configuration = 0;
487 UDIEN = (1<<EORSTE)|(1<<SOFE); 504 UDIEN = (1<<EORSTE)|(1<<SOFE)|(1<<SUSPE);
488 sei(); 505 sei();
489} 506}
490 507
@@ -492,7 +509,12 @@ void usb_init(void)
492// number selected by the HOST 509// number selected by the HOST
493uint8_t usb_configured(void) 510uint8_t usb_configured(void)
494{ 511{
495 return usb_configuration; 512 return usb_configuration && !suspend;
513}
514
515void usb_remote_wakeup(void)
516{
517 UDCON |= (1<<RMWKUP);
496} 518}
497 519
498 520
@@ -515,6 +537,11 @@ ISR(USB_GEN_vect)
515 537
516 intbits = UDINT; 538 intbits = UDINT;
517 UDINT = 0; 539 UDINT = 0;
540 if (intbits & (1<<SUSPI)) {
541 suspend = true;
542 } else {
543 suspend = false;
544 }
518 if (intbits & (1<<EORSTI)) { 545 if (intbits & (1<<EORSTI)) {
519 UENUM = 0; 546 UENUM = 0;
520 UECONX = 1; 547 UECONX = 1;
@@ -693,9 +720,9 @@ ISR(USB_COM_vect)
693 usb_send_in(); 720 usb_send_in();
694 return; 721 return;
695 } 722 }
696 #ifdef SUPPORT_ENDPOINT_HALT 723 if (bRequest == CLEAR_FEATURE || bRequest == SET_FEATURE) {
697 if ((bRequest == CLEAR_FEATURE || bRequest == SET_FEATURE) 724#ifdef SUPPORT_ENDPOINT_HALT
698 && bmRequestType == 0x02 && wValue == 0) { 725 if (bmRequestType == 0x02 && wValue == ENDPOINT_HALT) {
699 i = wIndex & 0x7F; 726 i = wIndex & 0x7F;
700 if (i >= 1 && i <= MAX_ENDPOINT) { 727 if (i >= 1 && i <= MAX_ENDPOINT) {
701 usb_send_in(); 728 usb_send_in();
@@ -709,8 +736,18 @@ ISR(USB_COM_vect)
709 } 736 }
710 return; 737 return;
711 } 738 }
739 }
740#endif
741 if (bmRequestType == 0x00 && wValue == DEVICE_REMOTE_WAKEUP) {
742 if (bRequest == SET_FEATURE) {
743 remote_wakeup = true;
744 } else {
745 remote_wakeup = false;
746 }
747 usb_send_in();
748 return;
749 }
712 } 750 }
713 #endif
714 if (wIndex == KEYBOARD_INTERFACE) { 751 if (wIndex == KEYBOARD_INTERFACE) {
715 if (bmRequestType == 0xA1) { 752 if (bmRequestType == 0xA1) {
716 if (bRequest == HID_GET_REPORT) { 753 if (bRequest == HID_GET_REPORT) {
diff --git a/usb.h b/usb.h
index cb2f6a223..594f307db 100644
--- a/usb.h
+++ b/usb.h
@@ -2,11 +2,13 @@
2#define USB_H 1 2#define USB_H 1
3 3
4#include <stdint.h> 4#include <stdint.h>
5#include <stdbool.h>
5#include <avr/io.h> 6#include <avr/io.h>
6 7
7 8
8void usb_init(void); // initialize everything 9void usb_init(void); // initialize everything
9uint8_t usb_configured(void); // is the USB port configured 10uint8_t usb_configured(void); // is the USB port configured
11void usb_remote_wakeup(void);
10 12
11 13
12 14
@@ -78,5 +80,13 @@ uint8_t usb_configured(void); // is the USB port configured
78#define CDC_SET_LINE_CODING 0x20 80#define CDC_SET_LINE_CODING 0x20
79#define CDC_GET_LINE_CODING 0x21 81#define CDC_GET_LINE_CODING 0x21
80#define CDC_SET_CONTROL_LINE_STATE 0x22 82#define CDC_SET_CONTROL_LINE_STATE 0x22
83// HID feature selectors
84#define DEVICE_REMOTE_WAKEUP 1
85#define ENDPOINT_HALT 0
86#define TEST_MODE 2
87
88
89extern bool remote_wakeup;
90extern bool suspend;
81 91
82#endif 92#endif
diff --git a/usb_extra.c b/usb_extra.c
index 94c317d98..9bc0c3f5f 100644
--- a/usb_extra.c
+++ b/usb_extra.c
@@ -1,7 +1,8 @@
1#include <avr/interrupt.h> 1#include <avr/interrupt.h>
2#include "usb_extra.h" 2#include "usb_extra.h"
3 3
4int8_t usb_extra_send(uint8_t bits) 4
5int8_t usb_extra_send(uint8_t report_id, uint8_t bits)
5{ 6{
6 uint8_t intr_state, timeout; 7 uint8_t intr_state, timeout;
7 8
@@ -24,10 +25,20 @@ int8_t usb_extra_send(uint8_t bits)
24 UENUM = EXTRA_ENDPOINT; 25 UENUM = EXTRA_ENDPOINT;
25 } 26 }
26 27
27 UEDATX = 1; // report id 28 UEDATX = report_id;
28 UEDATX = bits; 29 UEDATX = bits;
29 30
30 UEINTX = 0x3A; 31 UEINTX = 0x3A;
31 SREG = intr_state; 32 SREG = intr_state;
32 return 0; 33 return 0;
33} 34}
35
36int8_t usb_extra_audio_send(uint8_t bits)
37{
38 return usb_extra_send(1, bits);
39}
40
41int8_t usb_extra_system_send(uint8_t bits)
42{
43 return usb_extra_send(2, bits);
44}
diff --git a/usb_extra.h b/usb_extra.h
index 499e6b2fb..202f3223b 100644
--- a/usb_extra.h
+++ b/usb_extra.h
@@ -10,11 +10,17 @@
10#define EXTRA_SIZE 2 10#define EXTRA_SIZE 2
11#define EXTRA_BUFFER EP_DOUBLE_BUFFER 11#define EXTRA_BUFFER EP_DOUBLE_BUFFER
12 12
13// http://www.microsoft.com/whdc/archive/w2kbd.mspx
13#define AUDIO_VOL_UP (1<<0) 14#define AUDIO_VOL_UP (1<<0)
14#define AUDIO_VOL_DOWN (1<<1) 15#define AUDIO_VOL_DOWN (1<<1)
15#define AUDIO_MUTE (1<<2) 16#define AUDIO_MUTE (1<<2)
16 17
18#define SYSTEM_POWER_DOWN (1<<0)
19#define SYSTEM_SLEEP (1<<1)
20#define SYSTEM_WAKE_UP (1<<2)
17 21
18int8_t usb_extra_send(uint8_t bits); 22
23int8_t usb_extra_audio_send(uint8_t bits);
24int8_t usb_extra_system_send(uint8_t bits);
19 25
20#endif 26#endif