From 9402c6ff33a574b3df2451c4ec1cb010e25f135c Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 23 Jan 2019 01:06:32 +0100 Subject: [PATCH] hardware::KBD4x: Disable clock division The KBD4x has a set of WS2812 LEDs, which are very picky about timing. To make them happy (even though we do not use them yet), we need to disable clock division at startup. Signed-off-by: Gergely Nagy --- src/kaleidoscope/hardware/kbdfans/KBD4x.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/kaleidoscope/hardware/kbdfans/KBD4x.h b/src/kaleidoscope/hardware/kbdfans/KBD4x.h index 85925bf9..11951015 100644 --- a/src/kaleidoscope/hardware/kbdfans/KBD4x.h +++ b/src/kaleidoscope/hardware/kbdfans/KBD4x.h @@ -54,6 +54,10 @@ class KBD4x: public kaleidoscope::hardware::ATMegaKeyboard { */ MCUCR |= (1 << JTD); MCUCR |= (1 << JTD); + + // Disable Clock division + CLKPR = (1 << CLKPCE); + CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0); } ATMEGA_KEYBOARD_CONFIG(