diff options
Diffstat (limited to 'quantum/quantum.c')
| -rw-r--r-- | quantum/quantum.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c index 9fd9a6ef7..8b2fefef6 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -802,6 +802,46 @@ void backlight_set(uint8_t level) | |||
| 802 | #endif // backlight | 802 | #endif // backlight |
| 803 | 803 | ||
| 804 | 804 | ||
| 805 | // Functions for spitting out values | ||
| 806 | // | ||
| 807 | |||
| 808 | void send_dword(uint32_t number) { // this might not actually work | ||
| 809 | uint16_t word = (number >> 16); | ||
| 810 | send_word(word); | ||
| 811 | send_word(number & 0xFFFFUL); | ||
| 812 | } | ||
| 813 | |||
| 814 | void send_word(uint16_t number) { | ||
| 815 | uint8_t byte = number >> 8; | ||
| 816 | send_byte(byte); | ||
| 817 | send_byte(number & 0xFF); | ||
| 818 | } | ||
| 819 | |||
| 820 | void send_byte(uint8_t number) { | ||
| 821 | uint8_t nibble = number >> 4; | ||
| 822 | send_nibble(nibble); | ||
| 823 | send_nibble(number & 0xF); | ||
| 824 | } | ||
| 825 | |||
| 826 | void send_nibble(uint8_t number) { | ||
| 827 | switch (number) { | ||
| 828 | case 0: | ||
| 829 | register_code(KC_0); | ||
| 830 | unregister_code(KC_0); | ||
| 831 | break; | ||
| 832 | case 1 ... 9: | ||
| 833 | register_code(KC_1 + (number - 1)); | ||
| 834 | unregister_code(KC_1 + (number - 1)); | ||
| 835 | break; | ||
| 836 | case 0xA ... 0xF: | ||
| 837 | register_code(KC_A + (number - 0xA)); | ||
| 838 | unregister_code(KC_A + (number - 0xA)); | ||
| 839 | break; | ||
| 840 | } | ||
| 841 | } | ||
| 842 | |||
| 843 | |||
| 844 | |||
| 805 | 845 | ||
| 806 | __attribute__ ((weak)) | 846 | __attribute__ ((weak)) |
| 807 | void led_set_user(uint8_t usb_led) { | 847 | void led_set_user(uint8_t usb_led) { |
