summaryrefslogtreecommitdiffstats
path: root/common/command.c
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2012-10-23 02:14:36 +0900
committertmk <nobody@nowhere>2012-10-23 02:14:36 +0900
commitad24858e4fec8bb9af9d89ebf42cda3fffcfdff5 (patch)
treef4efff2ef0f3b58df3aec76dd403a320c2a66c35 /common/command.c
parent0ffd4ae3a9470e4efe41880db27a6ae77ccf1ce2 (diff)
Add print utility
Diffstat (limited to 'common/command.c')
-rw-r--r--common/command.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/common/command.c b/common/command.c
index 8e2e21a707..85cc05733a 100644
--- a/common/command.c
+++ b/common/command.c
@@ -205,7 +205,7 @@ static bool command_common(uint8_t code)
print("VERSION: " STR(DEVICE_VER) "\n");
break;
case KC_T: // print timer
- print("timer: "); phex16(timer_count>>16); phex16(timer_count); print("\n");
+ pv_hex32(timer_count);
break;
case KC_P: // print toggle
if (print_enable) {
@@ -218,20 +218,20 @@ static bool command_common(uint8_t code)
break;
case KC_S:
print("\n\n----- Status -----\n");
- print("host_keyboard_leds:"); phex(host_keyboard_leds()); print("\n");
+ pv_hex8(host_keyboard_leds());
#ifdef HOST_PJRC
- print("UDCON: "); phex(UDCON); print("\n");
- print("UDIEN: "); phex(UDIEN); print("\n");
- print("UDINT: "); phex(UDINT); print("\n");
- print("usb_keyboard_leds:"); phex(usb_keyboard_leds); print("\n");
- print("usb_keyboard_protocol: "); phex(usb_keyboard_protocol); print("\n");
- print("usb_keyboard_idle_config:"); phex(usb_keyboard_idle_config); print("\n");
- print("usb_keyboard_idle_count:"); phex(usb_keyboard_idle_count); print("\n");
+ pv_hex8(UDCON);
+ pv_hex8(UDIEN);
+ pv_hex8(UDINT);
+ pv_hex8(usb_keyboard_leds);
+ pv_hex8(usb_keyboard_protocol);
+ pv_hex8(usb_keyboard_idle_config);
+ pv_hex8(usb_keyboard_idle_count);
#endif
#ifdef HOST_VUSB
# if USB_COUNT_SOF
- print("usbSofCount: "); phex(usbSofCount); print("\n");
+ pv_hex8(usbSofCount);
# endif
#endif
break;
@@ -350,6 +350,7 @@ static void mousekey_param_print(void)
print("6: mk_wheel_time_to_max: "); pdec(mk_wheel_time_to_max); print("\n");
}
+#define PRINT_SET_VAL(v) print(#v " = "); print_dec8(v); print("\n");
static void mousekey_param_inc(uint8_t param, uint8_t inc)
{
switch (param) {
@@ -358,42 +359,42 @@ static void mousekey_param_inc(uint8_t param, uint8_t inc)
mk_delay += inc;
else
mk_delay = UINT8_MAX;
- print("mk_delay = "); pdec(mk_delay); print("\n");
+ PRINT_SET_VAL(mk_delay);
break;
case 2:
if (mk_interval + inc < UINT8_MAX)
mk_interval += inc;
else
mk_interval = UINT8_MAX;
- print("mk_interval = "); pdec(mk_interval); print("\n");
+ PRINT_SET_VAL(mk_interval);
break;
case 3:
if (mk_max_speed + inc < UINT8_MAX)
mk_max_speed += inc;
else
mk_max_speed = UINT8_MAX;
- print("mk_max_speed = "); pdec(mk_max_speed); print("\n");
+ PRINT_SET_VAL(mk_max_speed);
break;
case 4:
if (mk_time_to_max + inc < UINT8_MAX)
mk_time_to_max += inc;
else
mk_time_to_max = UINT8_MAX;
- print("mk_time_to_max = "); pdec(mk_time_to_max); print("\n");
+ PRINT_SET_VAL(mk_time_to_max);
break;
case 5:
if (mk_wheel_max_speed + inc < UINT8_MAX)
mk_wheel_max_speed += inc;
else
mk_wheel_max_speed = UINT8_MAX;
- print("mk_wheel_max_speed = "); pdec(mk_wheel_max_speed); print("\n");
+ PRINT_SET_VAL(mk_wheel_max_speed);
break;
case 6:
if (mk_wheel_time_to_max + inc < UINT8_MAX)
mk_wheel_time_to_max += inc;
else
mk_wheel_time_to_max = UINT8_MAX;
- print("mk_wheel_time_to_max = "); pdec(mk_wheel_time_to_max); print("\n");
+ PRINT_SET_VAL(mk_wheel_time_to_max);
break;
}
}
@@ -406,42 +407,42 @@ static void mousekey_param_dec(uint8_t param, uint8_t dec)
mk_delay -= dec;
else
mk_delay = 0;
- print("mk_delay = "); pdec(mk_delay); print("\n");
+ PRINT_SET_VAL(mk_delay);
break;
case 2:
if (mk_interval > dec)
mk_interval -= dec;
else
mk_interval = 0;
- print("mk_interval = "); pdec(mk_interval); print("\n");
+ PRINT_SET_VAL(mk_interval);
break;
case 3:
if (mk_max_speed > dec)
mk_max_speed -= dec;
else
mk_max_speed = 0;
- print("mk_max_speed = "); pdec(mk_max_speed); print("\n");
+ PRINT_SET_VAL(mk_max_speed);
break;
case 4:
if (mk_time_to_max > dec)
mk_time_to_max -= dec;
else
mk_time_to_max = 0;
- print("mk_time_to_max = "); pdec(mk_time_to_max); print("\n");
+ PRINT_SET_VAL(mk_time_to_max);
break;
case 5:
if (mk_wheel_max_speed > dec)
mk_wheel_max_speed -= dec;
else
mk_wheel_max_speed = 0;
- print("mk_wheel_max_speed = "); pdec(mk_wheel_max_speed); print("\n");
+ PRINT_SET_VAL(mk_wheel_max_speed);
break;
case 6:
if (mk_wheel_time_to_max > dec)
mk_wheel_time_to_max -= dec;
else
mk_wheel_time_to_max = 0;
- print("mk_wheel_time_to_max = "); pdec(mk_wheel_time_to_max); print("\n");
+ PRINT_SET_VAL(mk_wheel_time_to_max);
break;
}
}
@@ -551,11 +552,11 @@ static uint8_t numkey2num(uint8_t code)
static void switch_layer(uint8_t layer)
{
- print("current_layer: "); phex(current_layer); print("\n");
- print("default_layer: "); phex(default_layer); print("\n");
+ pv_hex8(current_layer);
+ pv_hex8(default_layer);
current_layer = layer;
default_layer = layer;
- print("switch to Layer: "); phex(layer); print("\n");
+ print("switch to "); pv_hex8(layer);
}
static void clear_keyboard(void)