aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortmk <hasu@tmk-kbd.com>2015-09-20 10:33:25 +0900
committertmk <hasu@tmk-kbd.com>2015-09-20 10:33:25 +0900
commit9b99f8f8649c25b5efa92c9fd49b7f4c0ce60a76 (patch)
treef265d98f713200aab011418a4702793cd0faedac
parent6147f5705ad2c5195a6363b4a1469230b424e489 (diff)
downloadqmk_firmware-9b99f8f8649c25b5efa92c9fd49b7f4c0ce60a76.tar.gz
qmk_firmware-9b99f8f8649c25b5efa92c9fd49b7f4c0ce60a76.zip
next_usb: Fix next_kbd_set_leds()
-rw-r--r--tmk_core/protocol/next_kbd.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/tmk_core/protocol/next_kbd.c b/tmk_core/protocol/next_kbd.c
index a5a07a7a8..fa3034b3f 100644
--- a/tmk_core/protocol/next_kbd.c
+++ b/tmk_core/protocol/next_kbd.c
@@ -59,10 +59,16 @@ static inline void query(void);
59static inline void reset(void); 59static inline void reset(void);
60static inline uint32_t response(void); 60static inline uint32_t response(void);
61 61
62#define out_hi_delay(intervals) do { out_hi(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0); 62/* The keyboard sends signal with 50us pulse width on OUT line
63#define out_lo_delay(intervals) do { out_lo(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0); 63 * while it seems to miss the 50us pulse on In line.
64#define query_delay(intervals) do { query(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0); 64 * next_kbd_set_leds() often fails to sync LED status with 50us
65#define reset_delay(intervals) do { reset(); _delay_us(NEXT_KBD_TIMING * intervals); } while (0); 65 * but it works well with 51us(+1us) on TMK converter(ATMeaga32u2) at least.
66 * TODO: test on Teensy and Pro Micro configuration
67 */
68#define out_hi_delay(intervals) do { out_hi(); _delay_us((NEXT_KBD_TIMING+1) * intervals); } while (0);
69#define out_lo_delay(intervals) do { out_lo(); _delay_us((NEXT_KBD_TIMING+1) * intervals); } while (0);
70#define query_delay(intervals) do { query(); _delay_us((NEXT_KBD_TIMING+1) * intervals); } while (0);
71#define reset_delay(intervals) do { reset(); _delay_us((NEXT_KBD_TIMING+1) * intervals); } while (0);
66 72
67void next_kbd_init(void) 73void next_kbd_init(void)
68{ 74{
@@ -79,6 +85,7 @@ void next_kbd_init(void)
79 85
80void next_kbd_set_leds(bool left, bool right) 86void next_kbd_set_leds(bool left, bool right)
81{ 87{
88 cli();
82 out_lo_delay(9); 89 out_lo_delay(9);
83 90
84 out_hi_delay(3); 91 out_hi_delay(3);
@@ -98,6 +105,7 @@ void next_kbd_set_leds(bool left, bool right)
98 105
99 out_lo_delay(7); 106 out_lo_delay(7);
100 out_hi(); 107 out_hi();
108 sei();
101} 109}
102 110
103#define NEXT_KBD_READ (NEXT_KBD_IN_PIN&(1<<NEXT_KBD_IN_BIT)) 111#define NEXT_KBD_READ (NEXT_KBD_IN_PIN&(1<<NEXT_KBD_IN_BIT))