From 3d81d5221eac9ca9620ba9043a250dcb8371b22e Mon Sep 17 00:00:00 2001 From: tmk Date: Thu, 28 Jun 2012 20:15:56 +0900 Subject: Add consumer/system control feature to LUFA. --- common/keyboard.c | 17 +++++------------ common/mousekey.c | 4 ++-- 2 files changed, 7 insertions(+), 14 deletions(-) (limited to 'common') diff --git a/common/keyboard.c b/common/keyboard.c index 5c2643c95..25f32eb02 100644 --- a/common/keyboard.c +++ b/common/keyboard.c @@ -49,6 +49,7 @@ void keyboard_proc(void) uint8_t fn_bits = 0; #ifdef EXTRAKEY_ENABLE uint16_t consumer_code = 0; + uint16_t system_code = 0; #endif matrix_scan(); @@ -89,22 +90,13 @@ void keyboard_proc(void) #ifdef HOST_PJRC if (suspend && remote_wakeup) { usb_remote_wakeup(); - } else { - host_system_send(SYSTEM_POWER_DOWN); } -#else - host_system_send(SYSTEM_POWER_DOWN); #endif - host_system_send(0); - _delay_ms(500); + system_code = SYSTEM_POWER_DOWN; } else if (code == KB_SYSTEM_SLEEP) { - host_system_send(SYSTEM_SLEEP); - host_system_send(0); - _delay_ms(500); + system_code = SYSTEM_SLEEP; } else if (code == KB_SYSTEM_WAKE) { - host_system_send(SYSTEM_WAKE_UP); - host_system_send(0); - _delay_ms(500); + system_code = SYSTEM_WAKE_UP; } // Consumer Page else if (code == KB_AUDIO_MUTE) { @@ -173,6 +165,7 @@ void keyboard_proc(void) host_send_keyboard_report(); #ifdef EXTRAKEY_ENABLE host_consumer_send(consumer_code); + host_system_send(system_code); #endif #ifdef DEBUG_LED // LED flash for debug diff --git a/common/mousekey.c b/common/mousekey.c index 76bd0fd36..1d35355b4 100644 --- a/common/mousekey.c +++ b/common/mousekey.c @@ -121,12 +121,12 @@ void mousekey_clear_report(void) static void mousekey_debug(void) { if (!debug_mouse) return; - print("mousekey[btn|x y v h]: "); + print("mousekey [btn|x y v h]rep: ["); phex(report.buttons); print("|"); phex(report.x); print(" "); phex(report.y); print(" "); phex(report.v); print(" "); - phex(report.h); + phex(report.h); print("]"); phex(mousekey_repeat); print("\n"); } -- cgit v1.2.3