From: tmk Date: Mon, 8 Dec 2014 03:22:33 +0000 (+0900) Subject: Change RN42 state display X-Git-Url: https://git.friedersdorff.com/?a=commitdiff_plain;h=160e02d06a11682d994da905adb1345bc1dde249;p=max%2Ftmk_keyboard.git Change RN42 state display --- diff --git a/keyboard/hhkb_rn42/rn42/rn42_task.c b/keyboard/hhkb_rn42/rn42/rn42_task.c index 66862686..1ad38d37 100644 --- a/keyboard/hhkb_rn42/rn42/rn42_task.c +++ b/keyboard/hhkb_rn42/rn42/rn42_task.c @@ -96,18 +96,6 @@ void rn42_task(void) battery_led(LED_CHARGER); } - static uint8_t prev_status = UNKNOWN; - if (bs != prev_status) { - prev_status = bs; - switch (bs) { - case FULL_CHARGED: xprintf("FULL_CHARGED\n"); break; - case CHARGING: xprintf("CHARGING\n"); break; - case DISCHARGING: xprintf("DISCHARGING\n"); break; - case LOW_VOLTAGE: xprintf("LOW_VOLTAGE\n"); break; - default: xprintf("UNKNOWN STATUS\n"); break; - }; - } - /* every minute */ uint32_t t = timer_read32()/1000; if (t%60 == 0) { @@ -193,15 +181,33 @@ bool command_extra(uint8_t code) print("\n----- RN-42 info -----\n"); xprintf("protocol: %s\n", (host_get_driver() == &rn42_driver) ? "RN-42" : "LUFA"); xprintf("force_usb: %X\n", force_usb); + xprintf("rn42: %s\n", rn42_rts() ? "OFF" : (rn42_linked() ? "CONN" : "ON")); xprintf("rn42_autoconnecting(): %X\n", rn42_autoconnecting()); - xprintf("rn42_linked(): %X\n", rn42_linked()); - xprintf("rn42_rts(): %X\n", rn42_rts()); xprintf("config_mode: %X\n", config_mode); - xprintf("USB_DeviceState: %X\n", USB_DeviceState); - xprintf("USB_Device_RemoteWakeupEnabled: %X\n", USB_Device_RemoteWakeupEnabled); + xprintf("USB State: %s\n", + (USB_DeviceState == DEVICE_STATE_Unattached) ? "Unattached" : + (USB_DeviceState == DEVICE_STATE_Powered) ? "Powered" : + (USB_DeviceState == DEVICE_STATE_Default) ? "Default" : + (USB_DeviceState == DEVICE_STATE_Addressed) ? "Addressed" : + (USB_DeviceState == DEVICE_STATE_Configured) ? "Configured" : + (USB_DeviceState == DEVICE_STATE_Suspended) ? "Suspended" : "?"); + xprintf("battery: "); + switch (battery_status()) { + case FULL_CHARGED: xprintf("FULL"); break; + case CHARGING: xprintf("CHARG"); break; + case DISCHARGING: xprintf("DISCHG"); break; + case LOW_VOLTAGE: xprintf("LOW"); break; + default: xprintf("?"); break; + }; + xprintf("\n"); + xprintf("RemoteWakeupEnabled: %X\n", USB_Device_RemoteWakeupEnabled); xprintf("VBUS: %X\n", USBSTA&(1<