aboutsummaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-11-21 19:50:55 -0500
committerJack Humbert <jack.humb@gmail.com>2016-11-21 19:50:55 -0500
commit664c0a036b3d7c3ed39f4a7a78d97f4a9cc7d20c (patch)
treee6cb0a7fb1c5c882fe394fd251680e0c88df323c /quantum
parent27ebacb15d39046713bd87e06c1157b1ffab6aaf (diff)
downloadqmk_firmware-664c0a036b3d7c3ed39f4a7a78d97f4a9cc7d20c.tar.gz
qmk_firmware-664c0a036b3d7c3ed39f4a7a78d97f4a9cc7d20c.zip
cleaning up new code
Diffstat (limited to 'quantum')
-rwxr-xr-xquantum/light_ws2812.h2
-rw-r--r--quantum/quantum.c40
-rw-r--r--quantum/quantum.h5
3 files changed, 46 insertions, 1 deletions
diff --git a/quantum/light_ws2812.h b/quantum/light_ws2812.h
index 0bef93d5e..9498e550e 100755
--- a/quantum/light_ws2812.h
+++ b/quantum/light_ws2812.h
@@ -16,7 +16,7 @@
16#include <avr/io.h> 16#include <avr/io.h>
17#include <avr/interrupt.h> 17#include <avr/interrupt.h>
18//#include "ws2812_config.h" 18//#include "ws2812_config.h"
19#include "i2cmaster.h" 19//#include "i2cmaster.h"
20 20
21#define LIGHT_I2C 1 21#define LIGHT_I2C 1
22#define LIGHT_I2C_ADDR 0x84 22#define LIGHT_I2C_ADDR 0x84
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
808void 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
814void send_word(uint16_t number) {
815 uint8_t byte = number >> 8;
816 send_byte(byte);
817 send_byte(number & 0xFF);
818}
819
820void send_byte(uint8_t number) {
821 uint8_t nibble = number >> 4;
822 send_nibble(nibble);
823 send_nibble(number & 0xF);
824}
825
826void 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))
807void led_set_user(uint8_t usb_led) { 847void led_set_user(uint8_t usb_led) {
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 06a2e049d..3d35f11fa 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -110,6 +110,11 @@ void breathing_speed_dec(uint8_t value);
110#endif 110#endif
111 111
112#endif 112#endif
113void send_dword(uint32_t number);
114void send_word(uint16_t number);
115void send_byte(uint8_t number);
116void send_nibble(uint8_t number);
117
113 118
114void led_set_user(uint8_t usb_led); 119void led_set_user(uint8_t usb_led);
115void led_set_kb(uint8_t usb_led); 120void led_set_kb(uint8_t usb_led);