summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--common.mk6
-rw-r--r--common_features.mk2
-rw-r--r--drivers/avr/analog.c (renamed from quantum/analog.c)0
-rw-r--r--drivers/avr/analog.h (renamed from quantum/analog.h)0
-rw-r--r--drivers/avr/glcdfont.c (renamed from keyboards/lets_split/common/glcdfont.c)0
-rw-r--r--drivers/avr/pro_micro.h (renamed from keyboards/atreus62/pro_micro.h)0
-rw-r--r--drivers/avr/ssd1306.c (renamed from keyboards/orthodox/ssd1306.c)191
-rw-r--r--drivers/avr/ssd1306.h93
-rw-r--r--[-rwxr-xr-x]drivers/avr/ws2812.c (renamed from quantum/light_ws2812.c)2
-rw-r--r--[-rwxr-xr-x]drivers/avr/ws2812.h (renamed from quantum/light_ws2812.h)0
-rw-r--r--drivers/ugfx/gdisp/is31fl3731c/board_is31fl3731c_template.h (renamed from keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h)3
-rw-r--r--drivers/ugfx/gdisp/is31fl3731c/driver.mk3
-rw-r--r--drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c (renamed from keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c)256
-rw-r--r--drivers/ugfx/gdisp/is31fl3731c/gdisp_lld_config.h (renamed from keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h)14
-rw-r--r--drivers/ugfx/gdisp/st7565/board_st7565_template.h (renamed from keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/board_ST7565.h)6
-rw-r--r--drivers/ugfx/gdisp/st7565/driver.mk3
-rw-r--r--drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c (renamed from keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c)42
-rw-r--r--drivers/ugfx/gdisp/st7565/gdisp_lld_config.h (renamed from keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_config.h)6
-rw-r--r--drivers/ugfx/gdisp/st7565/st7565.h (renamed from keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/st7565.h)0
-rw-r--r--keyboards/ergodox/infinity/board_is31fl3731c.h110
-rw-r--r--keyboards/ergodox/infinity/board_st7565.h113
-rw-r--r--keyboards/ergodox/infinity/config.h7
-rw-r--r--keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/driver.mk2
-rw-r--r--keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/driver.mk2
-rw-r--r--keyboards/ergodox/infinity/gfxconf.h306
-rw-r--r--keyboards/ergodox/infinity/rules.mk12
-rw-r--r--keyboards/ergodox/infinity/simple_visualizer.h4
-rw-r--r--keyboards/ergodox/infinity/visualizer.c6
-rw-r--r--keyboards/hadron/Makefile5
-rw-r--r--keyboards/hadron/config.h83
-rw-r--r--keyboards/hadron/hadron.c26
-rw-r--r--keyboards/hadron/hadron.h30
-rw-r--r--keyboards/hadron/i2c.c166
-rw-r--r--keyboards/hadron/i2c.h49
-rw-r--r--keyboards/hadron/keymaps/default/Makefile26
-rw-r--r--keyboards/hadron/keymaps/default/config.h21
-rw-r--r--keyboards/hadron/keymaps/default/keymap.c496
-rw-r--r--keyboards/hadron/keymaps/default/readme.md2
-rw-r--r--keyboards/hadron/keymaps/readme.md23
-rw-r--r--keyboards/hadron/keymaps/side_numpad/Makefile26
-rw-r--r--keyboards/hadron/keymaps/side_numpad/config.h21
-rw-r--r--keyboards/hadron/keymaps/side_numpad/keymap.c505
-rw-r--r--keyboards/hadron/keymaps/side_numpad/readme.md2
-rw-r--r--keyboards/hadron/out.txt66
-rw-r--r--keyboards/hadron/readme.md1
-rw-r--r--keyboards/hadron/rules.mk72
-rw-r--r--keyboards/hadron/ver0/Makefile3
-rw-r--r--keyboards/hadron/ver0/config.h35
-rw-r--r--keyboards/hadron/ver0/rules.mk5
-rw-r--r--keyboards/hadron/ver0/ver0.c1
-rw-r--r--keyboards/hadron/ver0/ver0.h6
-rw-r--r--keyboards/hadron/ver2/Makefile3
-rw-r--r--keyboards/hadron/ver2/config.h35
-rw-r--r--keyboards/hadron/ver2/rules.mk5
-rw-r--r--keyboards/hadron/ver2/ver2.c1
-rw-r--r--keyboards/hadron/ver2/ver2.h6
-rw-r--r--keyboards/handwired/magicforce68/README.md2
-rw-r--r--keyboards/handwired/promethium/rgbsps.c2
-rw-r--r--keyboards/handwired/promethium/rules.mk4
-rw-r--r--keyboards/lets_split/keymaps/OLED_sample/config.h1
-rw-r--r--keyboards/lets_split/keymaps/OLED_sample/keymap.c88
-rw-r--r--keyboards/lets_split/ssd1306.c470
-rw-r--r--keyboards/lets_split/ssd1306.h17
-rw-r--r--keyboards/minidox/Makefile5
-rw-r--r--keyboards/minidox/config.h74
-rw-r--r--keyboards/minidox/i2c.c162
-rw-r--r--keyboards/minidox/i2c.h31
-rw-r--r--keyboards/minidox/keymaps/default/keymap.c168
-rw-r--r--keyboards/minidox/keymaps/that_canadian/Makefile5
-rw-r--r--keyboards/minidox/keymaps/that_canadian/config.h37
-rw-r--r--keyboards/minidox/keymaps/that_canadian/keymap.c172
-rw-r--r--keyboards/minidox/matrix.c318
-rw-r--r--keyboards/minidox/minidox.c1
-rw-r--r--keyboards/minidox/minidox.h10
-rw-r--r--keyboards/minidox/pro_micro.h (renamed from keyboards/lets_split/pro_micro.h)0
-rw-r--r--keyboards/minidox/readme.md15
-rw-r--r--keyboards/minidox/rev1/Makefile3
-rw-r--r--keyboards/minidox/rev1/config.h38
-rw-r--r--keyboards/minidox/rev1/rev1.c1
-rw-r--r--keyboards/minidox/rev1/rev1.h28
-rw-r--r--keyboards/minidox/rev1/rules.mk5
-rw-r--r--keyboards/minidox/rules.mk74
-rw-r--r--keyboards/minidox/serial.c228
-rw-r--r--keyboards/minidox/serial.h26
-rw-r--r--keyboards/minidox/split_util.c80
-rw-r--r--keyboards/minidox/split_util.h22
-rw-r--r--keyboards/nyquist/pro_micro.h362
-rw-r--r--keyboards/orthodox/pro_micro.h362
-rw-r--r--keyboards/orthodox/ssd1306.h17
-rwxr-xr-xkeyboards/tada68/keymaps/maartenwut/config.h3
-rwxr-xr-xkeyboards/tada68/keymaps/maartenwut/keymap.c81
-rw-r--r--keyboards/whitefox/animations.c128
-rw-r--r--keyboards/whitefox/animations.h30
-rw-r--r--keyboards/whitefox/board_is31fl3731c.h (renamed from keyboards/whitefox/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h)3
-rw-r--r--keyboards/whitefox/config.h10
-rw-r--r--keyboards/whitefox/drivers/gdisp/IS31FL3731C/driver.mk2
-rw-r--r--keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c312
-rw-r--r--keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h36
-rw-r--r--keyboards/whitefox/gfxconf.h304
-rw-r--r--keyboards/whitefox/rules.mk7
-rw-r--r--keyboards/whitefox/visualizer.c2
-rw-r--r--lcd_backlight_keyframes.h (renamed from quantum/visualizer/lcd_backlight_keyframes.h)8
-rw-r--r--lib/lufa/Bootloaders/MassStorage/BootloaderAPITable.S204
-rw-r--r--lib/lufa/Bootloaders/MassStorage/makefile150
-rw-r--r--lib/lufa/Bootloaders/Printer/BootloaderAPITable.S182
-rw-r--r--lib/lufa/Bootloaders/Printer/makefile124
-rw-r--r--lib/lufa/LUFA/StudioIntegration/HV1/lufa_hv1_transform.xslt90
-rw-r--r--lib/lufa/LUFA/StudioIntegration/VSIX/extension.vsixmanifest64
-rw-r--r--quantum/rgblight.h2
-rw-r--r--quantum/visualizer/common_gfxconf.h325
-rw-r--r--quantum/visualizer/default_animations.c (renamed from keyboards/ergodox/infinity/animations.c)72
-rw-r--r--quantum/visualizer/default_animations.h (renamed from keyboards/ergodox/infinity/animations.h)6
-rw-r--r--quantum/visualizer/lcd_backlight_keyframes.c8
-rw-r--r--quantum/visualizer/lcd_keyframes.c4
-rw-r--r--quantum/visualizer/led_backlight_keyframes.c (renamed from quantum/visualizer/led_keyframes.c)24
-rw-r--r--quantum/visualizer/led_backlight_keyframes.h (renamed from quantum/visualizer/led_keyframes.h)22
-rw-r--r--quantum/visualizer/visualizer.c7
-rw-r--r--quantum/visualizer/visualizer.mk42
-rw-r--r--tmk_core/avr.mk34
120 files changed, 4802 insertions, 3223 deletions
diff --git a/Makefile b/Makefile
index f789409b7..b429200fe 100644
--- a/Makefile
+++ b/Makefile
@@ -483,6 +483,8 @@ define RUN_TEST
+error_occurred=0;\
$($(TEST)_COMMAND)\
if [ $$error_occurred -gt 0 ]; then $(HANDLE_ERROR); fi;
+
+
endef
# Allow specifying just the subproject, in the keyboard directory, which will compile all keymaps
diff --git a/common.mk b/common.mk
index f87c20934..5b49680ea 100644
--- a/common.mk
+++ b/common.mk
@@ -9,6 +9,9 @@ LIB_PATH = $(TOP_DIR)/lib
QUANTUM_DIR = quantum
QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR)
+DRIVER_DIR = drivers
+DRIVER_PATH = $(TOP_DIR)/$(DRIVER_DIR)
+
BUILD_DIR := $(TOP_DIR)/.build
COMMON_VPATH := $(TOP_DIR)
@@ -17,4 +20,5 @@ COMMON_VPATH += $(QUANTUM_PATH)
COMMON_VPATH += $(QUANTUM_PATH)/keymap_extras
COMMON_VPATH += $(QUANTUM_PATH)/audio
COMMON_VPATH += $(QUANTUM_PATH)/process_keycode
-COMMON_VPATH += $(QUANTUM_PATH)/api \ No newline at end of file
+COMMON_VPATH += $(QUANTUM_PATH)/api
+COMMON_VPATH += $(DRIVER_PATH) \ No newline at end of file
diff --git a/common_features.mk b/common_features.mk
index f5e7af01f..5eb56ccbf 100644
--- a/common_features.mk
+++ b/common_features.mk
@@ -87,7 +87,7 @@ endif
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
OPT_DEFS += -DRGBLIGHT_ENABLE
- SRC += $(QUANTUM_DIR)/light_ws2812.c
+ SRC += ws2812.c
SRC += $(QUANTUM_DIR)/rgblight.c
CIE1931_CURVE = yes
LED_BREATHING_TABLE = yes
diff --git a/quantum/analog.c b/drivers/avr/analog.c
index 1ec38df75..1ec38df75 100644
--- a/quantum/analog.c
+++ b/drivers/avr/analog.c
diff --git a/quantum/analog.h b/drivers/avr/analog.h
index 8d93de7dc..8d93de7dc 100644
--- a/quantum/analog.h
+++ b/drivers/avr/analog.h
diff --git a/keyboards/lets_split/common/glcdfont.c b/drivers/avr/glcdfont.c
index 6f88bd23a..6f88bd23a 100644
--- a/keyboards/lets_split/common/glcdfont.c
+++ b/drivers/avr/glcdfont.c
diff --git a/keyboards/atreus62/pro_micro.h b/drivers/avr/pro_micro.h
index f9e7ed75d..f9e7ed75d 100644
--- a/keyboards/atreus62/pro_micro.h
+++ b/drivers/avr/pro_micro.h
diff --git a/keyboards/orthodox/ssd1306.c b/drivers/avr/ssd1306.c
index 5c6dff27f..bb8938bba 100644
--- a/keyboards/orthodox/ssd1306.c
+++ b/drivers/avr/ssd1306.c
@@ -1,12 +1,10 @@
#ifdef SSD1306OLED
#include "ssd1306.h"
-#include "config.h"
#include "i2c.h"
#include <string.h>
#include "print.h"
-#include "lets_split.h"
-#include "common/glcdfont.c"
+#include "glcdfont.c"
#ifdef ADAFRUIT_BLE_ENABLE
#include "adafruit_ble.h"
#endif
@@ -14,18 +12,7 @@
#include "lufa.h"
#endif
#include "sendchar.h"
-#include "pincontrol.h"
-
-//assign the right code to your layers
-#define _BASE 0
-#define _LOWER 8
-#define _RAISE 16
-#define _FNLAYER 64
-#define _NUMLAY 128
-#define _NLOWER 136
-#define _NFNLAYER 192
-#define _MOUSECURSOR 256
-#define _ADJUST 65560
+#include "timer.h"
// Set this to 1 to help diagnose early startup problems
// when testing power-on with ble. Turn it off otherwise,
@@ -33,26 +20,6 @@
// with the matrix scan, causing keys to drop.
#define DEBUG_TO_SCREEN 0
-// Controls the SSD1306 128x32 OLED display via i2c
-
-#define i2cAddress 0x3C
-
-#define DisplayHeight 32
-#define DisplayWidth 128
-
-#define FontHeight 8
-#define FontWidth 6
-
-#define MatrixRows (DisplayHeight / FontHeight)
-#define MatrixCols (DisplayWidth / FontWidth)
-
-struct CharacterMatrix {
- uint8_t display[MatrixRows][MatrixCols];
- uint8_t *cursor;
- bool dirty;
-};
-
-static struct CharacterMatrix display;
//static uint16_t last_battery_update;
//static uint32_t vbat;
//#define BatteryUpdateInterval 10000 /* milliseconds */
@@ -62,54 +29,13 @@ static uint8_t displaying;
#endif
static uint16_t last_flush;
-enum ssd1306_cmds {
- DisplayOff = 0xAE,
- DisplayOn = 0xAF,
-
- SetContrast = 0x81,
- DisplayAllOnResume = 0xA4,
-
- DisplayAllOn = 0xA5,
- NormalDisplay = 0xA6,
- InvertDisplay = 0xA7,
- SetDisplayOffset = 0xD3,
- SetComPins = 0xda,
- SetVComDetect = 0xdb,
- SetDisplayClockDiv = 0xD5,
- SetPreCharge = 0xd9,
- SetMultiPlex = 0xa8,
- SetLowColumn = 0x00,
- SetHighColumn = 0x10,
- SetStartLine = 0x40,
-
- SetMemoryMode = 0x20,
- ColumnAddr = 0x21,
- PageAddr = 0x22,
-
- ComScanInc = 0xc0,
- ComScanDec = 0xc8,
- SegRemap = 0xa0,
- SetChargePump = 0x8d,
- ExternalVcc = 0x01,
- SwitchCapVcc = 0x02,
-
- ActivateScroll = 0x2f,
- DeActivateScroll = 0x2e,
- SetVerticalScrollArea = 0xa3,
- RightHorizontalScroll = 0x26,
- LeftHorizontalScroll = 0x27,
- VerticalAndRightHorizontalScroll = 0x29,
- VerticalAndLeftHorizontalScroll = 0x2a,
-};
-
-
// Write command sequence.
// Returns true on success.
static inline bool _send_cmd1(uint8_t cmd) {
bool res = false;
- if (i2c_start_write(i2cAddress)) {
- xprintf("failed to start write to %d\n", i2cAddress);
+ if (i2c_start_write(SSD1306_ADDRESS)) {
+ xprintf("failed to start write to %d\n", SSD1306_ADDRESS);
goto done;
}
@@ -154,8 +80,6 @@ static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) {
#define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;}
#define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;}
-static void matrix_clear(struct CharacterMatrix *matrix);
-
static void clear_display(void) {
matrix_clear(&display);
@@ -164,7 +88,7 @@ static void clear_display(void) {
send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1);
send_cmd3(ColumnAddr, 0, DisplayWidth - 1);
- if (i2c_start_write(i2cAddress)) {
+ if (i2c_start_write(SSD1306_ADDRESS)) {
goto done;
}
if (i2c_master_write(0x40)) {
@@ -210,14 +134,17 @@ bool iota_gfx_init(void) {
send_cmd2(SetChargePump, 0x14 /* Enable */);
send_cmd2(SetMemoryMode, 0 /* horizontal addressing */);
-/// Flips the display orientation 0 degrees
- send_cmd1(SegRemap | 0x1);
- send_cmd1(ComScanDec);
-/*
+#ifdef OLED_ROTATE180
// the following Flip the display orientation 180 degrees
send_cmd1(SegRemap);
send_cmd1(ComScanInc);
-// end flip */
+#endif
+#ifndef OLED_ROTATE180
+// Flips the display orientation 0 degrees
+ send_cmd1(SegRemap | 0x1);
+ send_cmd1(ComScanDec);
+#endif
+
send_cmd2(SetComPins, 0x2);
send_cmd2(SetContrast, 0x8f);
send_cmd2(SetPreCharge, 0xf1);
@@ -263,7 +190,7 @@ done:
return success;
}
-static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) {
+void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) {
*matrix->cursor = c;
++matrix->cursor;
@@ -276,7 +203,7 @@ static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) {
}
}
-static void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) {
+void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) {
matrix->dirty = true;
if (c == '\n') {
@@ -297,7 +224,7 @@ void iota_gfx_write_char(uint8_t c) {
matrix_write_char(&display, c);
}
-static void matrix_write(struct CharacterMatrix *matrix, const char *data) {
+void matrix_write(struct CharacterMatrix *matrix, const char *data) {
const char *end = data + strlen(data);
while (data < end) {
matrix_write_char(matrix, *data);
@@ -309,7 +236,7 @@ void iota_gfx_write(const char *data) {
matrix_write(&display, data);
}
-static void matrix_write_P(struct CharacterMatrix *matrix, const char *data) {
+void matrix_write_P(struct CharacterMatrix *matrix, const char *data) {
while (true) {
uint8_t c = pgm_read_byte(data);
if (c == 0) {
@@ -324,7 +251,7 @@ void iota_gfx_write_P(const char *data) {
matrix_write_P(&display, data);
}
-static void matrix_clear(struct CharacterMatrix *matrix) {
+void matrix_clear(struct CharacterMatrix *matrix) {
memset(matrix->display, ' ', sizeof(matrix->display));
matrix->cursor = &matrix->display[0][0];
matrix->dirty = true;
@@ -334,7 +261,7 @@ void iota_gfx_clear_screen(void) {
matrix_clear(&display);
}
-static void matrix_render(struct CharacterMatrix *matrix) {
+void matrix_render(struct CharacterMatrix *matrix) {
last_flush = timer_read();
iota_gfx_on();
#if DEBUG_TO_SCREEN
@@ -345,7 +272,7 @@ static void matrix_render(struct CharacterMatrix *matrix) {
send_cmd3(PageAddr, 0, MatrixRows - 1);
send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1);
- if (i2c_start_write(i2cAddress)) {
+ if (i2c_start_write(SSD1306_ADDRESS)) {
goto done;
}
if (i2c_master_write(0x40)) {
@@ -380,84 +307,12 @@ void iota_gfx_flush(void) {
matrix_render(&display);
}
-static void matrix_update(struct CharacterMatrix *dest,
- const struct CharacterMatrix *source) {
- if (memcmp(dest->display, source->display, sizeof(dest->display))) {
- memcpy(dest->display, source->display, sizeof(dest->display));
- dest->dirty = true;
- }
-}
-
-static void render_status_info(void) {
-#if DEBUG_TO_SCREEN
- if (debug_enable) {
- return;
- }
-#endif
-
- struct CharacterMatrix matrix;
-
- matrix_clear(&matrix);
- matrix_write_P(&matrix, PSTR("USB: "));
-#ifdef PROTOCOL_LUFA
- switch (USB_DeviceState) {
- case DEVICE_STATE_Unattached:
- matrix_write_P(&matrix, PSTR("Unattached"));
- break;
- case DEVICE_STATE_Suspended:
- matrix_write_P(&matrix, PSTR("Suspended"));
- break;
- case DEVICE_STATE_Configured:
- matrix_write_P(&matrix, PSTR("Connected"));
- break;
- case DEVICE_STATE_Powered:
- matrix_write_P(&matrix, PSTR("Powered"));
- break;
- case DEVICE_STATE_Default:
- matrix_write_P(&matrix, PSTR("Default"));
- break;
- case DEVICE_STATE_Addressed:
- matrix_write_P(&matrix, PSTR("Addressed"));
- break;
- default:
- matrix_write_P(&matrix, PSTR("Invalid"));
- }
-#endif
-
-// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
-
- char buf[40];
- snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
- matrix_write_P(&matrix, PSTR("\n\nLayer: "));
- switch (layer_state) {
- case _BASE:
- matrix_write_P(&matrix, PSTR("Default"));
- break;
- case _RAISE:
- matrix_write_P(&matrix, PSTR("Raise"));
- break;
- case _LOWER:
- matrix_write_P(&matrix, PSTR("Lower"));
- break;
- case _ADJUST:
- matrix_write_P(&matrix, PSTR("ADJUST"));
- break;
- default:
- matrix_write(&matrix, buf);
- }
-
- // Host Keyboard LED Status
- char led[40];
- snprintf(led, sizeof(led), "\n%s %s %s",
- (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
- (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
- (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
- matrix_write(&matrix, led);
- matrix_update(&display, &matrix);
+__attribute__ ((weak))
+void iota_gfx_task_user(void) {
}
void iota_gfx_task(void) {
- render_status_info();
+ iota_gfx_task_user();
if (display.dirty) {
iota_gfx_flush();
diff --git a/drivers/avr/ssd1306.h b/drivers/avr/ssd1306.h
new file mode 100644
index 000000000..df6a75359
--- /dev/null
+++ b/drivers/avr/ssd1306.h
@@ -0,0 +1,93 @@
+#ifndef SSD1306_H
+#define SSD1306_H
+
+#include <stdbool.h>
+#include <stdio.h>
+#include "pincontrol.h"
+#include "config.h"
+
+enum ssd1306_cmds {
+ DisplayOff = 0xAE,
+ DisplayOn = 0xAF,
+
+ SetContrast = 0x81,
+ DisplayAllOnResume = 0xA4,
+
+ DisplayAllOn = 0xA5,
+ NormalDisplay = 0xA6,
+ InvertDisplay = 0xA7,
+ SetDisplayOffset = 0xD3,
+ SetComPins = 0xda,
+ SetVComDetect = 0xdb,
+ SetDisplayClockDiv = 0xD5,
+ SetPreCharge = 0xd9,
+ SetMultiPlex = 0xa8,
+ SetLowColumn = 0x00,
+ SetHighColumn = 0x10,
+ SetStartLine = 0x40,
+
+ SetMemoryMode = 0x20,
+ ColumnAddr = 0x21,
+ PageAddr = 0x22,
+
+ ComScanInc = 0xc0,
+ ComScanDec = 0xc8,
+ SegRemap = 0xa0,
+ SetChargePump = 0x8d,
+ ExternalVcc = 0x01,
+ SwitchCapVcc = 0x02,
+
+ ActivateScroll = 0x2f,
+ DeActivateScroll = 0x2e,
+ SetVerticalScrollArea = 0xa3,
+ RightHorizontalScroll = 0x26,
+ LeftHorizontalScroll = 0x27,
+ VerticalAndRightHorizontalScroll = 0x29,
+ VerticalAndLeftHorizontalScroll = 0x2a,
+};
+
+// Controls the SSD1306 128x32 OLED display via i2c
+
+#ifndef SSD1306_ADDRESS
+#define SSD1306_ADDRESS 0x3C
+#endif
+
+#define DisplayHeight 32
+#define DisplayWidth 128
+
+#define FontHeight 8
+#define FontWidth 6
+
+#define MatrixRows (DisplayHeight / FontHeight)
+#define MatrixCols (DisplayWidth / FontWidth)
+
+struct CharacterMatrix {
+ uint8_t display[MatrixRows][MatrixCols];
+ uint8_t *cursor;
+ bool dirty;
+};
+
+struct CharacterMatrix display;
+
+bool iota_gfx_init(void);
+void iota_gfx_task(void);
+bool iota_gfx_off(void);
+bool iota_gfx_on(void);
+void iota_gfx_flush(void);
+void iota_gfx_write_char(uint8_t c);
+void iota_gfx_write(const char *data);
+void iota_gfx_write_P(const char *data);
+void iota_gfx_clear_screen(void);
+
+void iota_gfx_task_user(void);
+
+void matrix_clear(struct CharacterMatrix *matrix);
+void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c);
+void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c);
+void matrix_write(struct CharacterMatrix *matrix, const char *data);
+void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
+void matrix_render(struct CharacterMatrix *matrix);
+
+
+
+#endif
diff --git a/quantum/light_ws2812.c b/drivers/avr/ws2812.c
index 2506e3d8e..59e032bf7 100755..100644
--- a/quantum/light_ws2812.c
+++ b/drivers/avr/ws2812.c
@@ -21,7 +21,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "light_ws2812.h"
+#include "ws2812.h"
#include <avr/interrupt.h>
#include <avr/io.h>
#include <util/delay.h>
diff --git a/quantum/light_ws2812.h b/drivers/avr/ws2812.h
index 60924a0fb..60924a0fb 100755..100644
--- a/quantum/light_ws2812.h
+++ b/drivers/avr/ws2812.h
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h b/drivers/ugfx/gdisp/is31fl3731c/board_is31fl3731c_template.h
index 2ea73f1fb..f248cc25b 100644
--- a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h
+++ b/drivers/ugfx/gdisp/is31fl3731c/board_is31fl3731c_template.h
@@ -22,9 +22,6 @@ static const I2CConfig i2ccfg = {
400000 // clock speed (Hz); 400kHz max for IS31
};
-#define GDISP_SCREEN_WIDTH 7
-#define GDISP_SCREEN_HEIGHT 7
-
static const uint8_t led_mask[] = {
0xFF, 0x00, /* C1-1 -> C1-16 */
0xFF, 0x00, /* C2-1 -> C2-16 */
diff --git a/drivers/ugfx/gdisp/is31fl3731c/driver.mk b/drivers/ugfx/gdisp/is31fl3731c/driver.mk
new file mode 100644
index 000000000..4364787c9
--- /dev/null
+++ b/drivers/ugfx/gdisp/is31fl3731c/driver.mk
@@ -0,0 +1,3 @@
+GFXINC += drivers/ugfx/gdisp/is31fl3731c
+GFXSRC += drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c
+GDISP_DRIVER_LIST += GDISPVMT_IS31FL3731C_QMK \ No newline at end of file
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c b/drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c
index b4a5c84b0..917adadb8 100644
--- a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
+++ b/drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c
@@ -19,11 +19,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#if GFX_USE_GDISP
-#define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_ERGODOX
-#include "drivers/gdisp/IS31FL3731C/gdisp_lld_config.h"
+#define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_QMK
+#define GDISP_SCREEN_HEIGHT LED_HEIGHT
+#define GDISP_SCREEN_WIDTH LED_WIDTH
+
+#include "gdisp_lld_config.h"
#include "src/gdisp/gdisp_driver.h"
-#include "board_IS31FL3731C.h"
+#include "board_is31fl3731c.h"
// Can't include led_tables from here
@@ -33,27 +36,21 @@ extern const uint8_t CIE1931_CURVE[];
/* Driver local definitions. */
/*===========================================================================*/
-#ifndef GDISP_SCREEN_HEIGHT
- #define GDISP_SCREEN_HEIGHT 9
-#endif
-#ifndef GDISP_SCREEN_WIDTH
- #define GDISP_SCREEN_WIDTH 16
-#endif
#ifndef GDISP_INITIAL_CONTRAST
- #define GDISP_INITIAL_CONTRAST 0
+ #define GDISP_INITIAL_CONTRAST 0
#endif
#ifndef GDISP_INITIAL_BACKLIGHT
- #define GDISP_INITIAL_BACKLIGHT 0
+ #define GDISP_INITIAL_BACKLIGHT 0
#endif
-#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
+#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
#define IS31_ADDR_DEFAULT 0x74
-#define IS31_REG_CONFIG 0x00
+#define IS31_REG_CONFIG 0x00
// bits in reg
-#define IS31_REG_CONFIG_PICTUREMODE 0x00
-#define IS31_REG_CONFIG_AUTOPLAYMODE 0x08
+#define IS31_REG_CONFIG_PICTUREMODE 0x00
+#define IS31_REG_CONFIG_AUTOPLAYMODE 0x08
#define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18
// D2:D0 bits are starting frame for autoplay mode
@@ -100,7 +97,6 @@ extern const uint8_t CIE1931_CURVE[];
#define IS31_PWM_SIZE 0x90
#define IS31_LED_MASK_SIZE 0x12
-#define IS31_SCREEN_WIDTH 16
#define IS31
@@ -144,14 +140,14 @@ static GFXINLINE void write_ram(GDisplay *g, uint8_t page, uint16_t offset, uint
}
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
- // The private area is the display surface.
- g->priv = gfxAlloc(sizeof(PrivData));
+ // The private area is the display surface.
+ g->priv = gfxAlloc(sizeof(PrivData));
__builtin_memset(PRIV(g), 0, sizeof(PrivData));
- PRIV(g)->page = 0;
+ PRIV(g)->page = 0;
- // Initialise the board interface
- init_board(g);
- gfxSleepMilliseconds(10);
+ // Initialise the board interface
+ init_board(g);
+ gfxSleepMilliseconds(10);
// zero function page, all registers (assuming full_page is all zeroes)
write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
@@ -179,134 +175,134 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
// Finish Init
post_init_board(g);
- /* Initialise the GDISP structure */
- g->g.Width = GDISP_SCREEN_WIDTH;
- g->g.Height = GDISP_SCREEN_HEIGHT;
- g->g.Orientation = GDISP_ROTATE_0;
- g->g.Powermode = powerOff;
- g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
- g->g.Contrast = GDISP_INITIAL_CONTRAST;
- return TRUE;
+ /* Initialise the GDISP structure */
+ g->g.Width = GDISP_SCREEN_WIDTH;
+ g->g.Height = GDISP_SCREEN_HEIGHT;
+ g->g.Orientation = GDISP_ROTATE_0;
+ g->g.Powermode = powerOff;
+ g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
+ g->g.Contrast = GDISP_INITIAL_CONTRAST;
+ return TRUE;
}
#if GDISP_HARDWARE_FLUSH
- LLDSPEC void gdisp_lld_flush(GDisplay *g) {
- // Don't flush if we don't need it.
- if (!(g->flags & GDISP_FLG_NEEDFLUSH))
- return;
-
- PRIV(g)->page++;
- PRIV(g)->page %= 2;
- // TODO: some smarter algorithm for this
- // We should run only one physical page at a time
- // This way we don't need to send so much data, and
- // we could use slightly less memory
- uint8_t* src = PRIV(g)->frame_buffer;
- for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) {
- for (int x=0;x<GDISP_SCREEN_WIDTH;x++) {
- uint8_t val = (uint16_t)*src * g->g.Backlight / 100;
- PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val];
- ++src;
- }
- }
+ LLDSPEC void gdisp_lld_flush(GDisplay *g) {
+ // Don't flush if we don't need it.
+ if (!(g->flags & GDISP_FLG_NEEDFLUSH))
+ return;
+
+ PRIV(g)->page++;
+ PRIV(g)->page %= 2;
+ // TODO: some smarter algorithm for this
+ // We should run only one physical page at a time
+ // This way we don't need to send so much data, and
+ // we could use slightly less memory
+ uint8_t* src = PRIV(g)->frame_buffer;
+ for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) {
+ for (int x=0;x<GDISP_SCREEN_WIDTH;x++) {
+ uint8_t val = (uint16_t)*src * g->g.Backlight / 100;
+ PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val];
+ ++src;
+ }
+ }
write_ram(g, PRIV(g)->page, IS31_PWM_REG, IS31_PWM_SIZE);
gfxSleepMilliseconds(1);
write_register(g, IS31_FUNCTIONREG, IS31_REG_PICTDISP, PRIV(g)->page);
- g->flags &= ~GDISP_FLG_NEEDFLUSH;
- }
+ g->flags &= ~GDISP_FLG_NEEDFLUSH;
+ }
#endif
#if GDISP_HARDWARE_DRAWPIXEL
- LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
- coord_t x, y;
-
- switch(g->g.Orientation) {
- default:
- case GDISP_ROTATE_0:
- x = g->p.x;
- y = g->p.y;
- break;
- case GDISP_ROTATE_180:
- x = GDISP_SCREEN_WIDTH-1 - g->p.x;
- y = g->p.y;
- break;
- }
- PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color);
- g->flags |= GDISP_FLG_NEEDFLUSH;
- }
+ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
+ coord_t x, y;
+
+ switch(g->g.Orientation) {
+ default:
+ case GDISP_ROTATE_0:
+ x = g->p.x;
+ y = g->p.y;
+ break;
+ case GDISP_ROTATE_180:
+ x = GDISP_SCREEN_WIDTH-1 - g->p.x;
+ y = g->p.y;
+ break;
+ }
+ PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color);
+ g->flags |= GDISP_FLG_NEEDFLUSH;
+ }
#endif
#if GDISP_HARDWARE_PIXELREAD
- LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
- coord_t x, y;
-
- switch(g->g.Orientation) {
- default:
- case GDISP_ROTATE_0:
- x = g->p.x;
- y = g->p.y;
- break;
- case GDISP_ROTATE_180:
- x = GDISP_SCREEN_WIDTH-1 - g->p.x;
- y = g->p.y;
- break;
- }
- return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]);
- }
+ LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
+ coord_t x, y;
+
+ switch(g->g.Orientation) {
+ default:
+ case GDISP_ROTATE_0:
+ x = g->p.x;
+ y = g->p.y;
+ break;
+ case GDISP_ROTATE_180:
+ x = GDISP_SCREEN_WIDTH-1 - g->p.x;
+ y = g->p.y;
+ break;
+ }
+ return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]);
+ }
#endif
#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
- LLDSPEC void gdisp_lld_control(GDisplay *g) {
- switch(g->p.x) {
- case GDISP_CONTROL_POWER:
- if (g->g.Powermode == (powermode_t)g->p.ptr)
- return;
- switch((powermode_t)g->p.ptr) {
- case powerOff:
- case powerSleep:
- case powerDeepSleep:
+ LLDSPEC void gdisp_lld_control(GDisplay *g) {
+ switch(g->p.x) {
+ case GDISP_CONTROL_POWER:
+ if (g->g.Powermode == (powermode_t)g->p.ptr)
+ return;
+ switch((powermode_t)g->p.ptr) {
+ case powerOff:
+ case powerSleep:
+ case powerDeepSleep:
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
- break;
- case powerOn:
+ break;
+ case powerOn:
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON);
- break;
- default:
- return;
- }
- g->g.Powermode = (powermode_t)g->p.ptr;
- return;
-
- case GDISP_CONTROL_ORIENTATION:
- if (g->g.Orientation == (orientation_t)g->p.ptr)
- return;
- switch((orientation_t)g->p.ptr) {
- /* Rotation is handled by the drawing routines */
- case GDISP_ROTATE_0:
- case GDISP_ROTATE_180:
- g->g.Height = GDISP_SCREEN_HEIGHT;
- g->g.Width = GDISP_SCREEN_WIDTH;
- break;
- case GDISP_ROTATE_90:
- case GDISP_ROTATE_270:
- g->g.Height = GDISP_SCREEN_WIDTH;
- g->g.Width = GDISP_SCREEN_HEIGHT;
- break;
- default:
- return;
- }
- g->g.Orientation = (orientation_t)g->p.ptr;
- return;
-
- case GDISP_CONTROL_BACKLIGHT:
- if (g->g.Backlight == (unsigned)g->p.ptr)
+ break;
+ default:
+ return;
+ }
+ g->g.Powermode = (powermode_t)g->p.ptr;
+ return;
+
+ case GDISP_CONTROL_ORIENTATION:
+ if (g->g.Orientation == (orientation_t)g->p.ptr)
+ return;
+ switch((orientation_t)g->p.ptr) {
+ /* Rotation is handled by the drawing routines */
+ case GDISP_ROTATE_0:
+ case GDISP_ROTATE_180:
+ g->g.Height = GDISP_SCREEN_HEIGHT;
+ g->g.Width = GDISP_SCREEN_WIDTH;
+ break;
+ case GDISP_ROTATE_90:
+ case GDISP_ROTATE_270:
+ g->g.Height = GDISP_SCREEN_WIDTH;
+ g->g.Width = GDISP_SCREEN_HEIGHT;
+ break;
+ default:
return;
- unsigned val = (unsigned)g->p.ptr;
- g->g.Backlight = val > 100 ? 100 : val;
+ }
+ g->g.Orientation = (orientation_t)g->p.ptr;
+ return;
+
+ case GDISP_CONTROL_BACKLIGHT:
+ if (g->g.Backlight == (unsigned)g->p.ptr)
+ return;
+ unsigned val = (unsigned)g->p.ptr;
+ g->g.Backlight = val > 100 ? 100 : val;
g->flags |= GDISP_FLG_NEEDFLUSH;
- return;
- }
- }
+ return;
+ }
+ }
#endif // GDISP_NEED_CONTROL
#endif // GFX_USE_GDISP
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h b/drivers/ugfx/gdisp/is31fl3731c/gdisp_lld_config.h
index bb28ad775..588d688cf 100644
--- a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h
+++ b/drivers/ugfx/gdisp/is31fl3731c/gdisp_lld_config.h
@@ -24,13 +24,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Driver hardware support. */
/*===========================================================================*/
-#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
-#define GDISP_HARDWARE_DRAWPIXEL TRUE
-#define GDISP_HARDWARE_PIXELREAD TRUE
-#define GDISP_HARDWARE_CONTROL TRUE
+#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
+#define GDISP_HARDWARE_DRAWPIXEL TRUE
+#define GDISP_HARDWARE_PIXELREAD TRUE
+#define GDISP_HARDWARE_CONTROL TRUE
-#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256
+#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256
-#endif /* GFX_USE_GDISP */
+#endif /* GFX_USE_GDISP */
-#endif /* _GDISP_LLD_CONFIG_H */
+#endif /* _GDISP_LLD_CONFIG_H */
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/board_ST7565.h b/drivers/ugfx/gdisp/st7565/board_st7565_template.h
index 9650ffb44..9ab636c95 100644
--- a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/board_ST7565.h
+++ b/drivers/ugfx/gdisp/st7565/board_st7565_template.h
@@ -83,7 +83,7 @@ static GFXINLINE void init_board(GDisplay *g) {
}
static GFXINLINE void post_init_board(GDisplay *g) {
- (void) g;
+ (void) g;
}
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
@@ -106,8 +106,8 @@ static GFXINLINE void enter_cmd_mode(GDisplay *g) {
static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
- (void) g;
- spiSend(&SPID1, length, data);
+ (void) g;
+ spiSend(&SPID1, length, data);
}
#endif /* _GDISP_LLD_BOARD_H */
diff --git a/drivers/ugfx/gdisp/st7565/driver.mk b/drivers/ugfx/gdisp/st7565/driver.mk
new file mode 100644
index 000000000..31fc8f1c7
--- /dev/null
+++ b/drivers/ugfx/gdisp/st7565/driver.mk
@@ -0,0 +1,3 @@
+GFXINC += drivers/ugfx/gdisp/st7565
+GFXSRC += drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c
+GDISP_DRIVER_LIST += GDISPVMT_ST7565_QMK \ No newline at end of file
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c b/drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c
index b04ad0293..c38194b06 100644
--- a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c
+++ b/drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c
@@ -9,35 +9,35 @@
#if GFX_USE_GDISP
-#define GDISP_DRIVER_VMT GDISPVMT_ST7565_ERGODOX
-#include "drivers/gdisp/st7565ergodox/gdisp_lld_config.h"
+#define GDISP_DRIVER_VMT GDISPVMT_ST7565_QMK
+#include "gdisp_lld_config.h"
#include "src/gdisp/gdisp_driver.h"
-#include "board_ST7565.h"
+#include "board_st7565.h"
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
#ifndef GDISP_SCREEN_HEIGHT
-#define GDISP_SCREEN_HEIGHT 32
+#define GDISP_SCREEN_HEIGHT LCD_HEIGHT
#endif
#ifndef GDISP_SCREEN_WIDTH
-#define GDISP_SCREEN_WIDTH 128
+#define GDISP_SCREEN_WIDTH LCD_WIDTH
#endif
#ifndef GDISP_INITIAL_CONTRAST
-#define GDISP_INITIAL_CONTRAST 35
+#define GDISP_INITIAL_CONTRAST 35
#endif
#ifndef GDISP_INITIAL_BACKLIGHT
-#define GDISP_INITIAL_BACKLIGHT 100
+#define GDISP_INITIAL_BACKLIGHT 100
#endif
-#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
+#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
-#include "drivers/gdisp/st7565ergodox/st7565.h"
+#include "st7565.h"
/*===========================================================================*/
-/* Driver config defaults for backward compatibility. */
+/* Driver config defaults for backward compatibility. */
/*===========================================================================*/
#ifndef ST7565_LCD_BIAS
#define ST7565_LCD_BIAS ST7565_LCD_BIAS_7
@@ -65,7 +65,7 @@ typedef struct{
// Some common routines and macros
#define PRIV(g) ((PrivData*)g->priv)
-#define RAM(g) (PRIV(g)->ram)
+#define RAM(g) (PRIV(g)->ram)
static GFXINLINE void write_cmd(GDisplay* g, uint8_t cmd) {
PRIV(g)->data[PRIV(g)->data_pos++] = cmd;
@@ -76,15 +76,15 @@ static GFXINLINE void flush_cmd(GDisplay* g) {
PRIV(g)->data_pos = 0;
}
-#define write_cmd2(g, cmd1, cmd2) { write_cmd(g, cmd1); write_cmd(g, cmd2); }
-#define write_cmd3(g, cmd1, cmd2, cmd3) { write_cmd(g, cmd1); write_cmd(g, cmd2); write_cmd(g, cmd3); }
+#define write_cmd2(g, cmd1, cmd2) { write_cmd(g, cmd1); write_cmd(g, cmd2); }
+#define write_cmd3(g, cmd1, cmd2, cmd3) { write_cmd(g, cmd1); write_cmd(g, cmd2); write_cmd(g, cmd3); }
// Some common routines and macros
-#define delay(us) gfxSleepMicroseconds(us)
-#define delay_ms(ms) gfxSleepMilliseconds(ms)
+#define delay(us) gfxSleepMicroseconds(us)
+#define delay_ms(ms) gfxSleepMilliseconds(ms)
-#define xyaddr(x, y) ((x) + ((y)>>3)*GDISP_SCREEN_WIDTH)
-#define xybit(y) (1<<((y)&7))
+#define xyaddr(x, y) ((x) + ((y)>>3)*GDISP_SCREEN_WIDTH)
+#define xybit(y) (1<<((y)&7))
/*===========================================================================*/
/* Driver exported functions. */
@@ -150,7 +150,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
#if GDISP_HARDWARE_FLUSH
LLDSPEC void gdisp_lld_flush(GDisplay *g) {
- unsigned p;
+ unsigned p;
// Don't flush if we don't need it.
if (!(g->flags & GDISP_FLG_NEEDFLUSH))
@@ -181,7 +181,7 @@ LLDSPEC void gdisp_lld_flush(GDisplay *g) {
#if GDISP_HARDWARE_DRAWPIXEL
LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
- coord_t x, y;
+ coord_t x, y;
switch(g->g.Orientation) {
default:
@@ -212,7 +212,7 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
#if GDISP_HARDWARE_PIXELREAD
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
- coord_t x, y;
+ coord_t x, y;
switch(g->g.Orientation) {
default:
@@ -257,7 +257,7 @@ LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
else {
*dst &= ~xybit(dsty);
}
- dstx++;
+ dstx++;
srcbit++;
}
}
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_config.h b/drivers/ugfx/gdisp/st7565/gdisp_lld_config.h
index 2b66a877c..4446bd38b 100644
--- a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_config.h
+++ b/drivers/ugfx/gdisp/st7565/gdisp_lld_config.h
@@ -14,7 +14,7 @@
/* Driver hardware support. */
/*===========================================================================*/
-#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
+#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
#define GDISP_HARDWARE_DRAWPIXEL TRUE
#define GDISP_HARDWARE_PIXELREAD TRUE
#define GDISP_HARDWARE_CONTROL TRUE
@@ -22,6 +22,6 @@
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO
-#endif /* GFX_USE_GDISP */
+#endif /* GFX_USE_GDISP */
-#endif /* _GDISP_LLD_CONFIG_H */
+#endif /* _GDISP_LLD_CONFIG_H */
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/st7565.h b/drivers/ugfx/gdisp/st7565/st7565.h
index 24924ff05..24924ff05 100644
--- a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/st7565.h
+++ b/drivers/ugfx/gdisp/st7565/st7565.h
diff --git a/keyboards/ergodox/infinity/board_is31fl3731c.h b/keyboards/ergodox/infinity/board_is31fl3731c.h
new file mode 100644
index 000000000..f248cc25b
--- /dev/null
+++ b/keyboards/ergodox/infinity/board_is31fl3731c.h
@@ -0,0 +1,110 @@
+/*
+Copyright 2016 Fred Sundvik <fsundvik@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _GDISP_LLD_BOARD_H
+#define _GDISP_LLD_BOARD_H
+
+static const I2CConfig i2ccfg = {
+ 400000 // clock speed (Hz); 400kHz max for IS31
+};
+
+static const uint8_t led_mask[] = {
+ 0xFF, 0x00, /* C1-1 -> C1-16 */
+ 0xFF, 0x00, /* C2-1 -> C2-16 */
+ 0xFF, 0x00, /* C3-1 -> C3-16 */
+ 0xFF, 0x00, /* C4-1 -> C4-16 */
+ 0x3F, 0x00, /* C5-1 -> C5-16 */
+ 0x00, 0x00, /* C6-1 -> C6-16 */
+ 0x00, 0x00, /* C7-1 -> C7-16 */
+ 0x00, 0x00, /* C8-1 -> C8-16 */
+ 0x00, 0x00, /* C9-1 -> C9-16 */
+};
+
+// The address of the LED
+#define LA(c, r) (c + r * 16 )
+// Need to be an address that is not mapped, but inside the range of the controller matrix
+#define NA LA(8, 8)
+
+// The numbers in the comments are the led numbers DXX on the PCB
+// The mapping is taken from the schematic of left hand side
+static const uint8_t led_mapping[GDISP_SCREEN_HEIGHT][GDISP_SCREEN_WIDTH] = {
+// 45 44 43 42 41 40 39
+ { LA(1, 1), LA(1, 0), LA(0, 4), LA(0, 3), LA(0, 2), LA(0, 1), LA(0, 0)},
+// 52 51 50 49 48 47 46
+ { LA(2, 3), LA(2, 2), LA(2, 1), LA(2, 0), LA(1, 4), LA(1, 3), LA(1, 2) },
+// 58 57 56 55 54 53 N/A
+ { LA(3, 4), LA(3, 3), LA(3, 2), LA(3, 1), LA(3, 0), LA(2, 4), NA },
+// 67 66 65 64 63 62 61
+ { LA(5, 3), LA(5, 2), LA(5, 1), LA(5, 0), LA(4, 4), LA(4, 3), LA(4, 2) },
+// 76 75 74 73 72 60 59
+ { LA(7, 3), LA(7, 2), LA(7, 1), LA(7, 0), LA(6, 3), LA(4, 1), LA(4, 0) },
+// N/A N/A N/A N/A N/A N/A 68
+ { NA, NA, NA, NA, NA, NA, LA(5, 4) },
+// N/A N/A N/A N/A 71 70 69
+ { NA, NA, NA, NA, LA(6, 2), LA(6, 1), LA(6, 0) },
+};
+
+
+#define IS31_ADDR_DEFAULT 0x74 // AD connected to GND
+#define IS31_TIMEOUT 5000
+
+static GFXINLINE void init_board(GDisplay *g) {
+ (void) g;
+ /* I2C pins */
+ palSetPadMode(GPIOB, 0, PAL_MODE_ALTERNATIVE_2); // PTB0/I2C0/SCL
+ palSetPadMode(GPIOB, 1, PAL_MODE_ALTERNATIVE_2); // PTB1/I2C0/SDA
+ palSetPadMode(GPIOB, 16, PAL_MODE_OUTPUT_PUSHPULL);
+ palClearPad(GPIOB, 16);
+ /* start I2C */
+ i2cStart(&I2CD1, &i2ccfg);
+ // try high drive (from kiibohd)
+ I2CD1.i2c->C2 |= I2Cx_C2_HDRS;
+ // try glitch fixing (from kiibohd)
+ I2CD1.i2c->FLT = 4;
+}
+
+static GFXINLINE void post_init_board(GDisplay *g) {
+ (void) g;
+}
+
+static GFXINLINE const uint8_t* get_led_mask(GDisplay* g) {
+ (void) g;
+ return led_mask;
+}
+
+static GFXINLINE uint8_t get_led_address(GDisplay* g, uint16_t x, uint16_t y)
+{
+ (void) g;
+ return led_mapping[y][x];
+}
+
+static GFXINLINE void set_hardware_shutdown(GDisplay* g, bool shutdown) {
+ (void) g;
+ if(!shutdown) {
+ palSetPad(GPIOB, 16);
+ }
+ else {
+ palClearPad(GPIOB, 16);
+ }
+}
+
+static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
+ (void) g;
+ i2cMasterTransmitTimeout(&I2CD1, IS31_ADDR_DEFAULT, data, length, 0, 0, US2ST(IS31_TIMEOUT));
+}
+
+#endif /* _GDISP_LLD_BOARD_H */
diff --git a/keyboards/ergodox/infinity/board_st7565.h b/keyboards/ergodox/infinity/board_st7565.h
new file mode 100644
index 000000000..9ab636c95
--- /dev/null
+++ b/keyboards/ergodox/infinity/board_st7565.h
@@ -0,0 +1,113 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+#ifndef _GDISP_LLD_BOARD_H
+#define _GDISP_LLD_BOARD_H
+
+#define ST7565_LCD_BIAS ST7565_LCD_BIAS_9 // actually 6
+#define ST7565_ADC ST7565_ADC_NORMAL
+#define ST7565_COM_SCAN ST7565_COM_SCAN_DEC
+#define ST7565_PAGE_ORDER 0,1,2,3
+/*
+ * Custom page order for several LCD boards, e.g. HEM12864-99
+ * #define ST7565_PAGE_ORDER 4,5,6,7,0,1,2,3
+ */
+
+#define ST7565_GPIOPORT GPIOC
+#define ST7565_PORT PORTC
+#define ST7565_A0_PIN 7
+#define ST7565_RST_PIN 8
+#define ST7565_MOSI_PIN 6
+#define ST7565_SLCK_PIN 5
+#define ST7565_SS_PIN 4
+
+#define palSetPadModeRaw(portname, bits) \
+ ST7565_PORT->PCR[ST7565_##portname##_PIN] = bits
+
+#define palSetPadModeNamed(portname, portmode) \
+ palSetPadMode(ST7565_GPIOPORT, ST7565_##portname##_PIN, portmode)
+
+#define ST7565_SPI_MODE PORTx_PCRn_DSE | PORTx_PCRn_MUX(2)
+// DSPI Clock and Transfer Attributes
+// Frame Size: 8 bits
+// MSB First
+// CLK Low by default
+static const SPIConfig spi1config = {
+ // Operation complete callback or @p NULL.
+ .end_cb = NULL,
+ //The chip select line port - when not using pcs.
+ .ssport = ST7565_GPIOPORT,
+ // brief The chip select line pad number - when not using pcs.
+ .sspad=ST7565_SS_PIN,
+ // SPI initialization data.
+ .tar0 =
+ SPIx_CTARn_FMSZ(7) // Frame size = 8 bytes
+ | SPIx_CTARn_ASC(1) // After SCK Delay Scaler (min 50 ns) = 55.56ns
+ | SPIx_CTARn_DT(0) // Delay After Transfer Scaler (no minimum)= 27.78ns
+ | SPIx_CTARn_CSSCK(0) // PCS to SCK Delay Scaler (min 20 ns) = 27.78ns
+ | SPIx_CTARn_PBR(0) // Baud Rate Prescaler = 2
+ | SPIx_CTARn_BR(0) // Baud rate (min 50ns) = 55.56ns
+};
+
+static GFXINLINE void acquire_bus(GDisplay *g) {
+ (void) g;
+ // Only the LCD is using the SPI bus, so no need to acquire
+ // spiAcquireBus(&SPID1);
+ spiSelect(&SPID1);
+}
+
+static GFXINLINE void release_bus(GDisplay *g) {
+ (void) g;
+ // Only the LCD is using the SPI bus, so no need to release
+ //spiReleaseBus(&SPID1);
+ spiUnselect(&SPID1);
+}
+
+static GFXINLINE void init_board(GDisplay *g) {
+ (void) g;
+ palSetPadModeNamed(A0, PAL_MODE_OUTPUT_PUSHPULL);
+ palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN);
+ palSetPadModeNamed(RST, PAL_MODE_OUTPUT_PUSHPULL);
+ palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN);
+ palSetPadModeRaw(MOSI, ST7565_SPI_MODE);
+ palSetPadModeRaw(SLCK, ST7565_SPI_MODE);
+ palSetPadModeNamed(SS, PAL_MODE_OUTPUT_PUSHPULL);
+
+ spiInit();
+ spiStart(&SPID1, &spi1config);
+ release_bus(g);
+}
+
+static GFXINLINE void post_init_board(GDisplay *g) {
+ (void) g;
+}
+
+static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
+ (void) g;
+ if (state) {
+ palClearPad(ST7565_GPIOPORT, ST7565_RST_PIN);
+ }
+ else {
+ palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN);
+ }
+}
+
+static GFXINLINE void enter_data_mode(GDisplay *g) {
+ palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN);
+}
+
+static GFXINLINE void enter_cmd_mode(GDisplay *g) {
+ palClearPad(ST7565_GPIOPORT, ST7565_A0_PIN);
+}
+
+
+static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
+ (void) g;
+ spiSend(&SPID1, length, data);
+}
+
+#endif /* _GDISP_LLD_BOARD_H */
diff --git a/keyboards/ergodox/infinity/config.h b/keyboards/ergodox/infinity/config.h
index 25cc8af0f..c46edeb7b 100644
--- a/keyboards/ergodox/infinity/config.h
+++ b/keyboards/ergodox/infinity/config.h
@@ -51,16 +51,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define SERIAL_LINK_BAUD 562500
#define SERIAL_LINK_THREAD_PRIORITY (NORMALPRIO - 1)
-// The visualizer needs gfx thread priorities
-#define VISUALIZER_THREAD_PRIORITY (NORMAL_PRIORITY - 2)
#define VISUALIZER_USER_DATA_SIZE 16
-#define LCD_DISPLAY_NUMBER 0
-#define LED_DISPLAY_NUMBER 1
-
-#define LED_NUM_ROWS 7
-#define LED_NUM_COLS 7
/*
* Feature disable options
* These options are also useful to firmware size reduction.
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/driver.mk b/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/driver.mk
deleted file mode 100644
index f32d0d868..000000000
--- a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/driver.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-GFXINC += drivers/gdisp/IS31FL3731C
-GFXSRC += drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/driver.mk b/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/driver.mk
deleted file mode 100644
index 889a1a031..000000000
--- a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/driver.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-GFXINC += drivers/gdisp/st7565ergodox
-GFXSRC += drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c
diff --git a/keyboards/ergodox/infinity/gfxconf.h b/keyboards/ergodox/infinity/gfxconf.h
index 45b9f5858..ca338399d 100644
--- a/keyboards/ergodox/infinity/gfxconf.h
+++ b/keyboards/ergodox/infinity/gfxconf.h
@@ -22,310 +22,6 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-
-///////////////////////////////////////////////////////////////////////////
-// GOS - One of these must be defined, preferably in your Makefile //
-///////////////////////////////////////////////////////////////////////////
-//#define GFX_USE_OS_CHIBIOS TRUE
-//#define GFX_USE_OS_FREERTOS FALSE
-// #define GFX_FREERTOS_USE_TRACE FALSE
-//#define GFX_USE_OS_WIN32 FALSE
-//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
-//#define GFX_USE_OS_ECOS FALSE
-//#define GFX_USE_OS_RAWRTOS FALSE
-//#define GFX_USE_OS_ARDUINO FALSE
-//#define GFX_USE_OS_KEIL FALSE
-//#define GFX_USE_OS_CMSIS FALSE
-//#define GFX_USE_OS_RAW32 FALSE
-// #define INTERRUPTS_OFF() optional_code
-// #define INTERRUPTS_ON() optional_code
-// These are not defined by default for some reason
-#define GOS_NEED_X_THREADS FALSE
-#define GOS_NEED_X_HEAP FALSE
-
-// Options that (should where relevant) apply to all operating systems
- #define GFX_NO_INLINE FALSE
-// #define GFX_COMPILER GFX_COMPILER_UNKNOWN
-// #define GFX_CPU GFX_CPU_UNKNOWN
-// #define GFX_OS_HEAP_SIZE 0
-// #define GFX_OS_NO_INIT FALSE
-// #define GFX_OS_INIT_NO_WARNING FALSE
-// #define GFX_OS_PRE_INIT_FUNCTION myHardwareInitRoutine
-// #define GFX_OS_EXTRA_INIT_FUNCTION myOSInitRoutine
-// #define GFX_OS_EXTRA_DEINIT_FUNCTION myOSDeInitRoutine
-
-
-///////////////////////////////////////////////////////////////////////////
-// GDISP //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GDISP TRUE
-
-//#define GDISP_NEED_AUTOFLUSH FALSE
-//#define GDISP_NEED_TIMERFLUSH FALSE
-//#define GDISP_NEED_VALIDATION TRUE
-//#define GDISP_NEED_CLIP TRUE
-#define GDISP_NEED_CIRCLE TRUE
-#define GDISP_NEED_ELLIPSE TRUE
-#define GDISP_NEED_ARC TRUE
-#define GDISP_NEED_ARCSECTORS TRUE
-#define GDISP_NEED_CONVEX_POLYGON TRUE
-//#define GDISP_NEED_SCROLL FALSE
-#define GDISP_NEED_PIXELREAD TRUE
-#define GDISP_NEED_CONTROL TRUE
-//#define GDISP_NEED_QUERY FALSE
-//#define GDISP_NEED_MULTITHREAD FALSE
-//#define GDISP_NEED_STREAMING FALSE
-#define GDISP_NEED_TEXT TRUE
-// #define GDISP_NEED_TEXT_WORDWRAP FALSE
-// #define GDISP_NEED_ANTIALIAS FALSE
-// #define GDISP_NEED_UTF8 FALSE
- #define GDISP_NEED_TEXT_KERNING TRUE
-// #define GDISP_INCLUDE_FONT_UI1 FALSE
-// #define GDISP_INCLUDE_FONT_UI2 FALSE // The smallest preferred font.
-// #define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS20 FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE
- #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 TRUE
-// #define GDISP_INCLUDE_FONT_FIXED_10X20 FALSE
-// #define GDISP_INCLUDE_FONT_FIXED_7X14 FALSE
- #define GDISP_INCLUDE_FONT_FIXED_5X8 TRUE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS20_AA FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE
-// #define GDISP_INCLUDE_USER_FONTS FALSE
-
-//#define GDISP_NEED_IMAGE FALSE
-// #define GDISP_NEED_IMAGE_NATIVE FALSE
-// #define GDISP_NEED_IMAGE_GIF FALSE
-// #define GDISP_NEED_IMAGE_BMP FALSE
-// #define GDISP_NEED_IMAGE_BMP_1 FALSE
-// #define GDISP_NEED_IMAGE_BMP_4 FALSE
-// #define GDISP_NEED_IMAGE_BMP_4_RLE FALSE
-// #define GDISP_NEED_IMAGE_BMP_8 FALSE
-// #define GDISP_NEED_IMAGE_BMP_8_RLE FALSE
-// #define GDISP_NEED_IMAGE_BMP_16 FALSE
-// #define GDISP_NEED_IMAGE_BMP_24 FALSE
-// #define GDISP_NEED_IMAGE_BMP_32 FALSE
-// #define GDISP_NEED_IMAGE_JPG FALSE
-// #define GDISP_NEED_IMAGE_PNG FALSE
-// #define GDISP_NEED_IMAGE_ACCOUNTING FALSE
-#ifdef EMULATOR
-#define GDISP_NEED_PIXMAP TRUE
-#endif
-// #define GDISP_NEED_PIXMAP_IMAGE FALSE
-
-//#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE // If not defined the native hardware orientation is used.
-//#define GDISP_LINEBUF_SIZE 128
-//#define GDISP_STARTUP_COLOR Black
-#define GDISP_NEED_STARTUP_LOGO FALSE
-
-//#define GDISP_TOTAL_DISPLAYS 2
-
-#ifndef EMULATOR
-#define GDISP_DRIVER_LIST GDISPVMT_ST7565_ERGODOX, GDISPVMT_IS31FL3731C_ERGODOX
-#else
-#define GDISP_DRIVER_LIST GDISPVMT_EMULATOR_LCD_ERGODOX, GDISPVMT_EMULATOR_LED_ERGODOX
-#endif
-
- #ifdef GDISP_DRIVER_LIST
- // For code and speed optimization define as TRUE or FALSE if all controllers have the same capability
- #define GDISP_HARDWARE_STREAM_WRITE FALSE
- #define GDISP_HARDWARE_STREAM_READ FALSE
- #define GDISP_HARDWARE_STREAM_POS FALSE
- #define GDISP_HARDWARE_DRAWPIXEL TRUE
- #define GDISP_HARDWARE_CLEARS FALSE
- #define GDISP_HARDWARE_FILLS FALSE
- //#define GDISP_HARDWARE_BITFILLS FALSE
- #define GDISP_HARDWARE_SCROLL FALSE
- #define GDISP_HARDWARE_PIXELREAD TRUE
- #define GDISP_HARDWARE_CONTROL TRUE
- #define GDISP_HARDWARE_QUERY FALSE
- #define GDISP_HARDWARE_CLIP FALSE
-
- #define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
- #endif
-
-// The custom format is not defined for some reason, so define it as error
-// so we don't get compiler warnings
-#define GDISP_PIXELFORMAT_CUSTOM GDISP_PIXELFORMAT_ERROR
-
-#define GDISP_USE_GFXNET FALSE
-// #define GDISP_GFXNET_PORT 13001
-// #define GDISP_GFXNET_CUSTOM_LWIP_STARTUP FALSE
-// #define GDISP_DONT_WAIT_FOR_NET_DISPLAY FALSE
-// #define GDISP_GFXNET_UNSAFE_SOCKETS FALSE
-
-
-///////////////////////////////////////////////////////////////////////////
-// GWIN //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GWIN FALSE
-
-//#define GWIN_NEED_WINDOWMANAGER FALSE
-// #define GWIN_REDRAW_IMMEDIATE FALSE
-// #define GWIN_REDRAW_SINGLEOP FALSE
-// #define GWIN_NEED_FLASHING FALSE
-// #define GWIN_FLASHING_PERIOD 250
-
-//#define GWIN_NEED_CONSOLE FALSE
-// #define GWIN_CONSOLE_USE_HISTORY FALSE
-// #define GWIN_CONSOLE_HISTORY_AVERAGING FALSE
-// #define GWIN_CONSOLE_HISTORY_ATCREATE FALSE
-// #define GWIN_CONSOLE_ESCSEQ FALSE
-// #define GWIN_CONSOLE_USE_BASESTREAM FALSE
-// #define GWIN_CONSOLE_USE_FLOAT FALSE
-//#define GWIN_NEED_GRAPH FALSE
-//#define GWIN_NEED_GL3D FALSE
-
-//#define GWIN_NEED_WIDGET FALSE
-//#define GWIN_FOCUS_HIGHLIGHT_WIDTH 1
-// #define GWIN_NEED_LABEL FALSE
-// #define GWIN_LABEL_ATTRIBUTE FALSE
-// #define GWIN_NEED_BUTTON FALSE
-// #define GWIN_BUTTON_LAZY_RELEASE FALSE
-// #define GWIN_NEED_SLIDER FALSE
-// #define GWIN_SLIDER_NOSNAP FALSE
-// #define GWIN_SLIDER_DEAD_BAND 5
-// #define GWIN_SLIDER_TOGGLE_INC 20
-// #define GWIN_NEED_CHECKBOX FALSE
-// #define GWIN_NEED_IMAGE FALSE
-// #define GWIN_NEED_IMAGE_ANIMATION FALSE
-// #define GWIN_NEED_RADIO FALSE
-// #define GWIN_NEED_LIST FALSE
-// #define GWIN_NEED_LIST_IMAGES FALSE
-// #define GWIN_NEED_PROGRESSBAR FALSE
-// #define GWIN_PROGRESSBAR_AUTO FALSE
-// #define GWIN_NEED_KEYBOARD FALSE
-// #define GWIN_KEYBOARD_DEFAULT_LAYOUT VirtualKeyboard_English1
-// #define GWIN_NEED_KEYBOARD_ENGLISH1 TRUE
-// #define GWIN_NEED_TEXTEDIT FALSE
-// #define GWIN_FLAT_STYLING FALSE
-// #define GWIN_WIDGET_TAGS FALSE
-
-//#define GWIN_NEED_CONTAINERS FALSE
-// #define GWIN_NEED_CONTAINER FALSE
-// #define GWIN_NEED_FRAME FALSE
-// #define GWIN_NEED_TABSET FALSE
-// #define GWIN_TABSET_TABHEIGHT 18
-
-
-///////////////////////////////////////////////////////////////////////////
-// GEVENT //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GEVENT TRUE
-
-//#define GEVENT_ASSERT_NO_RESOURCE FALSE
-//#define GEVENT_MAXIMUM_SIZE 32
-//#define GEVENT_MAX_SOURCE_LISTENERS 32
-
-
-///////////////////////////////////////////////////////////////////////////
-// GTIMER //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GTIMER FALSE
-
-//#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY
-//#define GTIMER_THREAD_WORKAREA_SIZE 2048
-
-
-///////////////////////////////////////////////////////////////////////////
-// GQUEUE //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GQUEUE FALSE
-
-//#define GQUEUE_NEED_ASYNC FALSE
-//#define GQUEUE_NEED_GSYNC FALSE
-//#define GQUEUE_NEED_FSYNC FALSE
-//#define GQUEUE_NEED_BUFFERS FALSE
-
-///////////////////////////////////////////////////////////////////////////
-// GINPUT //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GINPUT FALSE
-
-//#define GINPUT_NEED_MOUSE FALSE
-// #define GINPUT_TOUCH_STARTRAW FALSE
-// #define GINPUT_TOUCH_NOTOUCH FALSE
-// #define GINPUT_TOUCH_NOCALIBRATE FALSE
-// #define GINPUT_TOUCH_NOCALIBRATE_GUI FALSE
-// #define GINPUT_MOUSE_POLL_PERIOD 25
-// #define GINPUT_MOUSE_CLICK_TIME 300
-// #define GINPUT_TOUCH_CXTCLICK_TIME 700
-// #define GINPUT_TOUCH_USER_CALIBRATION_LOAD FALSE
-// #define GINPUT_TOUCH_USER_CALIBRATION_SAVE FALSE
-// #define GMOUSE_DRIVER_LIST GMOUSEVMT_Win32, GMOUSEVMT_Win32
-//#define GINPUT_NEED_KEYBOARD FALSE
-// #define GINPUT_KEYBOARD_POLL_PERIOD 200
-// #define GKEYBOARD_DRIVER_LIST GKEYBOARDVMT_Win32, GKEYBOARDVMT_Win32
-// #define GKEYBOARD_LAYOUT_OFF FALSE
-// #define GKEYBOARD_LAYOUT_SCANCODE2_US FALSE
-//#define GINPUT_NEED_TOGGLE FALSE
-//#define GINPUT_NEED_DIAL FALSE
-
-
-///////////////////////////////////////////////////////////////////////////
-// GFILE //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GFILE FALSE
-
-//#define GFILE_NEED_PRINTG FALSE
-//#define GFILE_NEED_SCANG FALSE
-//#define GFILE_NEED_STRINGS FALSE
-//#define GFILE_NEED_FILELISTS FALSE
-//#define GFILE_NEED_STDIO FALSE
-//#define GFILE_NEED_NOAUTOMOUNT FALSE
-//#define GFILE_NEED_NOAUTOSYNC FALSE
-
-//#define GFILE_NEED_MEMFS FALSE
-//#define GFILE_NEED_ROMFS FALSE
-//#define GFILE_NEED_RAMFS FALSE
-//#define GFILE_NEED_FATFS FALSE
-//#define GFILE_NEED_NATIVEFS FALSE
-//#define GFILE_NEED_CHBIOSFS FALSE
-
-//#define GFILE_ALLOW_FLOATS FALSE
-//#define GFILE_ALLOW_DEVICESPECIFIC FALSE
-//#define GFILE_MAX_GFILES 3
-
-///////////////////////////////////////////////////////////////////////////
-// GADC //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GADC FALSE
-
-//#define GADC_MAX_LOWSPEED_DEVICES 4
-
-
-///////////////////////////////////////////////////////////////////////////
-// GAUDIO //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GAUDIO FALSE
-// There seems to be a bug in the ugfx code, the wrong define is used
-// So define it in order to avoid warnings
-#define GFX_USE_GAUDIN GFX_USE_GAUDIO
-// #define GAUDIO_NEED_PLAY FALSE
-// #define GAUDIO_NEED_RECORD FALSE
-
-
-///////////////////////////////////////////////////////////////////////////
-// GMISC //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GMISC TRUE
-
-//#define GMISC_NEED_ARRAYOPS FALSE
-//#define GMISC_NEED_FASTTRIG FALSE
-//#define GMISC_NEED_FIXEDTRIG FALSE
-//#define GMISC_NEED_INVSQRT FALSE
-// #define GMISC_INVSQRT_MIXED_ENDIAN FALSE
-// #define GMISC_INVSQRT_REAL_SLOW FALSE
-#define GMISC_NEED_MATRIXFLOAT2D TRUE
-#define GMISC_NEED_MATRIXFIXED2D FALSE
+#include "common_gfxconf.h"
#endif /* _GFXCONF_H */
diff --git a/keyboards/ergodox/infinity/rules.mk b/keyboards/ergodox/infinity/rules.mk
index bbb0f6efe..a341bbfce 100644
--- a/keyboards/ergodox/infinity/rules.mk
+++ b/keyboards/ergodox/infinity/rules.mk
@@ -1,7 +1,6 @@
# project specific files
SRC = matrix.c \
- led.c \
- animations.c
+ led.c
## chip/board settings
# - the next two should match the directories in
@@ -67,5 +66,10 @@ LCD_BACKLIGHT_ENABLE = yes
MIDI_ENABLE = no
RGBLIGHT_ENABLE = no
-include $(SUBPROJECT_PATH)/drivers/gdisp/st7565ergodox/driver.mk
-include $(SUBPROJECT_PATH)/drivers/gdisp/IS31FL3731C/driver.mk \ No newline at end of file
+LCD_DRIVER = st7565
+LCD_WIDTH = 128
+LCD_HEIGHT = 32
+
+LED_DRIVER = is31fl3731c
+LED_WIDTH = 7
+LED_HEIGHT = 7 \ No newline at end of file
diff --git a/keyboards/ergodox/infinity/simple_visualizer.h b/keyboards/ergodox/infinity/simple_visualizer.h
index ded8a3222..73d0e0887 100644
--- a/keyboards/ergodox/infinity/simple_visualizer.h
+++ b/keyboards/ergodox/infinity/simple_visualizer.h
@@ -34,7 +34,7 @@
#include "lcd_backlight_keyframes.h"
#include "system/serial_link.h"
#include "led.h"
-#include "animations.h"
+#include "default_animations.h"
static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF);
static const uint32_t initial_color = LCD_COLOR(0, 0, 0);
@@ -58,7 +58,7 @@ static keyframe_animation_t color_animation = {
// this prevents the color from changing when activating the layer
// momentarily
.frame_lengths = {gfxMillisecondsToTicks(200), gfxMillisecondsToTicks(500)},
- .frame_functions = {keyframe_no_operation, backlight_keyframe_animate_color},
+ .frame_functions = {keyframe_no_operation, lcd_backlight_keyframe_animate_color},
};
void initialize_user_visualizer(visualizer_state_t* state) {
diff --git a/keyboards/ergodox/infinity/visualizer.c b/keyboards/ergodox/infinity/visualizer.c
index 5b6b32007..4b16021ab 100644
--- a/keyboards/ergodox/infinity/visualizer.c
+++ b/keyboards/ergodox/infinity/visualizer.c
@@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "lcd_keyframes.h"
#include "lcd_backlight_keyframes.h"
#include "system/serial_link.h"
-#include "animations.h"
+#include "default_animations.h"
static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF);
static const uint32_t initial_color = LCD_COLOR(0, 0, 0);
@@ -79,7 +79,7 @@ static keyframe_animation_t one_led_color = {
.num_frames = 1,
.loop = false,
.frame_lengths = {gfxMillisecondsToTicks(0)},
- .frame_functions = {backlight_keyframe_set_color},
+ .frame_functions = {lcd_backlight_keyframe_set_color},
};
bool swap_led_target_color(keyframe_animation_t* animation, visualizer_state_t* state) {
@@ -94,7 +94,7 @@ static keyframe_animation_t two_led_colors = {
.num_frames = 2,
.loop = true,
.frame_lengths = {gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(0)},
- .frame_functions = {backlight_keyframe_set_color, swap_led_target_color},
+ .frame_functions = {lcd_backlight_keyframe_set_color, swap_led_target_color},
};
// The LCD animation alternates between the layer name display and a
diff --git a/keyboards/hadron/Makefile b/keyboards/hadron/Makefile
new file mode 100644
index 000000000..e0e1cc6fb
--- /dev/null
+++ b/keyboards/hadron/Makefile
@@ -0,0 +1,5 @@
+SUBPROJECT_DEFAULT = ver2
+
+ifndef MAKEFILE_INCLUDED
+ include ../../Makefile
+endif \ No newline at end of file
diff --git a/keyboards/hadron/config.h b/keyboards/hadron/config.h
new file mode 100644
index 000000000..0c19d6c79
--- /dev/null
+++ b/keyboards/hadron/config.h
@@ -0,0 +1,83 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#include "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6060
+#define MANUFACTURER ishtob
+#define PRODUCT Hadron Keyboard
+#define DESCRIPTION A cherry ML ortholinear keyboard
+
+
+
+
+//#define AUDIO_VOICES
+
+//#define BACKLIGHT_PIN B7
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* number of backlight levels */
+//#define BACKLIGHT_LEVELS 3
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCING_DELAY 5
+
+/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
+#define LOCKING_SUPPORT_ENABLE
+/* Locking resynchronize hack */
+#define LOCKING_RESYNC_ENABLE
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+/*
+ * Feature disable options
+ * These options are also useful to firmware size reduction.
+ */
+
+/* disable debug print */
+//#define NO_DEBUG
+
+/* disable print */
+//#define NO_PRINT
+
+/* disable action features */
+//#define NO_ACTION_LAYER
+//#define NO_ACTION_TAPPING
+//#define NO_ACTION_ONESHOT
+//#define NO_ACTION_MACRO
+//#define NO_ACTION_FUNCTION
+#ifdef SUBPROJECT_ver0
+ #include "ver0/config.h"
+#endif
+#ifdef SUBPROJECT_ver2
+ #include "ver2/config.h"
+#endif
+
+#endif
diff --git a/keyboards/hadron/hadron.c b/keyboards/hadron/hadron.c
new file mode 100644
index 000000000..ca5b20e89
--- /dev/null
+++ b/keyboards/hadron/hadron.c
@@ -0,0 +1,26 @@
+#include "hadron.h"
+
+
+void matrix_init_kb(void) {
+
+ matrix_init_user();
+}
+
+void matrix_scan_kb(void) {
+ // put your looping keyboard code here
+ // runs every cycle (a lot)
+ matrix_scan_user();
+}
+
+bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
+ // put your per-action keyboard code here
+ // runs for every action, just before processing by the firmware
+
+ return process_record_user(keycode, record);
+}
+
+void led_set_kb(uint8_t usb_led) {
+ // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
+
+ led_set_user(usb_led);
+} \ No newline at end of file
diff --git a/keyboards/hadron/hadron.h b/keyboards/hadron/hadron.h
new file mode 100644
index 000000000..fceae50d9
--- /dev/null
+++ b/keyboards/hadron/hadron.h
@@ -0,0 +1,30 @@
+#ifndef HADRON_H
+#define HADRON_H
+
+#ifdef SUBPROJECT_ver0
+ #include "ver0.h"
+#endif
+#ifdef SUBPROJECT_ver2
+ #include "ver2.h"
+#endif
+
+#include "quantum.h"
+
+
+#define KEYMAP( \
+ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
+ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \
+ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \
+ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \
+ K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E \
+ ) \
+{ \
+ { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, KC_NO, KC_NO, KC_NO }, \
+ { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \
+ { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \
+ { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
+ { K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E } \
+}
+
+
+#endif
diff --git a/keyboards/hadron/i2c.c b/keyboards/hadron/i2c.c
new file mode 100644
index 000000000..cd2b835d5
--- /dev/null
+++ b/keyboards/hadron/i2c.c
@@ -0,0 +1,166 @@
+#include <util/twi.h>
+#include <avr/io.h>
+#include <stdlib.h>
+#include <avr/interrupt.h>
+#include <util/twi.h>
+#include <stdbool.h>
+#include "i2c.h"
+
+#ifdef USE_I2C
+
+// Limits the amount of we wait for any one i2c transaction.
+// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
+// 9 bits, a single transaction will take around 90μs to complete.
+//
+// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit
+// poll loop takes at least 8 clock cycles to execute
+#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8
+
+#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE)
+
+volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
+
+static volatile uint8_t slave_buffer_pos;
+static volatile bool slave_has_register_set = false;
+
+// Wait for an i2c operation to finish
+inline static
+void i2c_delay(void) {
+ uint16_t lim = 0;
+ while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT)
+ lim++;
+
+ // easier way, but will wait slightly longer
+ // _delay_us(100);
+}
+
+// Setup twi to run at 100kHz
+void i2c_master_init(void) {
+ // no prescaler
+ TWSR = 0;
+ // Set TWI clock frequency to SCL_CLOCK. Need TWBR>10.
+ // Check datasheets for more info.
+ TWBR = ((F_CPU/SCL_CLOCK)-16)/2;
+}
+
+// Start a transaction with the given i2c slave address. The direction of the
+// transfer is set with I2C_READ and I2C_WRITE.
+// returns: 0 => success
+// 1 => error
+uint8_t i2c_master_start(uint8_t address) {
+ TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
+
+ i2c_delay();
+
+ // check that we started successfully
+ if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START))
+ return 1;
+
+ // send device address
+ TWDR = address;
+ TWCR = (1<<TWINT) | (1<<TWEN);
+
+ i2c_delay();
+
+ if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) )
+ return 1; // slave did not acknowledge
+ else
+ return 0; // success
+}
+
+
+// Finish the i2c transaction.
+void i2c_master_stop(void) {
+ TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
+
+ uint16_t lim = 0;
+ while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT)
+ lim++;
+}
+
+// Write one byte to the i2c slave.
+// returns 0 => slave ACK
+// 1 => slave NACK
+uint8_t i2c_master_write(uint8_t data) {
+ TWDR = data;
+ TWCR = (1<<TWINT) | (1<<TWEN);
+
+ i2c_delay();
+
+ // check if the slave acknowledged us
+ return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1;
+}
+
+// Read one byte from the i2c slave. If ack=1 the slave is acknowledged,
+// if ack=0 the acknowledge bit is not set.
+// returns: byte read from i2c device
+uint8_t i2c_master_read(int ack) {
+ TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA);
+
+ i2c_delay();
+ return TWDR;
+}
+
+void i2c_reset_state(void) {
+ TWCR = 0;
+}
+
+void i2c_slave_init(uint8_t address) {
+ TWAR = address << 0; // slave i2c address
+ // TWEN - twi enable
+ // TWEA - enable address acknowledgement
+ // TWINT - twi interrupt flag
+ // TWIE - enable the twi interrupt
+ TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN);
+}
+
+ISR(TWI_vect);
+
+ISR(TWI_vect) {
+ uint8_t ack = 1;
+ switch(TW_STATUS) {
+ case TW_SR_SLA_ACK:
+ // this device has been addressed as a slave receiver
+ slave_has_register_set = false;
+ break;
+
+ case TW_SR_DATA_ACK:
+ // this device has received data as a slave receiver
+ // The first byte that we receive in this transaction sets the location
+ // of the read/write location of the slaves memory that it exposes over
+ // i2c. After that, bytes will be written at slave_buffer_pos, incrementing
+ // slave_buffer_pos after each write.
+ if(!slave_has_register_set) {
+ slave_buffer_pos = TWDR;
+ // don't acknowledge the master if this memory loctaion is out of bounds
+ if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) {
+ ack = 0;
+ slave_buffer_pos = 0;
+ }
+ slave_has_register_set = true;
+ } else {
+ i2c_slave_buffer[slave_buffer_pos] = TWDR;
+ BUFFER_POS_INC();
+ }
+ break;
+
+ case TW_ST_SLA_ACK:
+ case TW_ST_DATA_ACK:
+ // master has addressed this device as a slave transmitter and is
+ // requesting data.
+ TWDR = i2c_slave_buffer[slave_buffer_pos];
+ BUFFER_POS_INC();
+ break;
+
+ case TW_BUS_ERROR: // something went wrong, reset twi state
+ TWCR = 0;
+ default:
+ break;
+ }
+ // Reset everything, so we are ready for the next TWI interrupt
+ TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
+}
+
+
+
+#endif
diff --git a/keyboards/hadron/i2c.h b/keyboards/hadron/i2c.h
new file mode 100644
index 000000000..2bd7f4096
--- /dev/null
+++ b/keyboards/hadron/i2c.h
@@ -0,0 +1,49 @@
+#ifndef I2C_H
+#define I2C_H
+
+#include <stdint.h>
+
+#ifndef F_CPU
+#define F_CPU 16000000UL
+#endif
+
+#define I2C_READ 1
+#define I2C_WRITE 0
+
+#define I2C_ACK 1
+#define I2C_NACK 0
+
+#define SLAVE_BUFFER_SIZE 0x10
+
+// i2c SCL clock frequency
+#define SCL_CLOCK 800000L
+
+extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
+
+void i2c_master_init(void);
+uint8_t i2c_master_start(uint8_t address);
+void i2c_master_stop(void);
+uint8_t i2c_master_write(uint8_t data);
+uint8_t i2c_master_read(int);
+void i2c_reset_state(void);
+void i2c_slave_init(uint8_t address);
+
+
+static inline unsigned char i2c_start_read(unsigned char addr) {
+ return i2c_master_start((addr << 1) | I2C_READ);
+}
+
+static inline unsigned char i2c_start_write(unsigned char addr) {
+ return i2c_master_start((addr << 1) | I2C_WRITE);
+}
+
+// from SSD1306 scrips
+extern unsigned char i2c_rep_start(unsigned char addr);
+extern void i2c_start_wait(unsigned char addr);
+extern unsigned char i2c_readAck(void);
+extern unsigned char i2c_readNak(void);
+extern unsigned char i2c_read(unsigned char ack);
+
+#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak();
+
+#endif
diff --git a/keyboards/hadron/keymaps/default/Makefile b/keyboards/hadron/keymaps/default/Makefile
new file mode 100644
index 000000000..e24ba04b5
--- /dev/null
+++ b/keyboards/hadron/keymaps/default/Makefile
@@ -0,0 +1,26 @@
+
+
+# Build Options
+# change to "no" to disable the options, or define them in the Makefile in
+# the appropriate keymap folder that will get included automatically
+#
+BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
+EXTRAKEY_ENABLE = no # Audio control and System control(+450)
+CONSOLE_ENABLE = no # Console for debug(+400)
+COMMAND_ENABLE = no # Commands for debug and configuration
+NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
+MIDI_ENABLE = no # MIDI controls
+AUDIO_ENABLE = no # Audio output on port C6
+UNICODE_ENABLE = no # Unicode
+BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
+RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
+ONEHAND_ENABLE = no # Enable one-hand typing
+
+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
+SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
+
+ifndef QUANTUM_DIR
+ include ../../../../Makefile
+endif \ No newline at end of file
diff --git a/keyboards/hadron/keymaps/default/config.h b/keyboards/hadron/keymaps/default/config.h
new file mode 100644
index 000000000..0f349ad93
--- /dev/null
+++ b/keyboards/hadron/keymaps/default/config.h
@@ -0,0 +1,21 @@
+#ifndef CONFIG_USER_H
+#define CONFIG_USER_H
+
+#include "../../config.h"
+
+#define LEADER_TIMEOUT 300
+//#define BACKLIGHT_BREATHING
+#define PREVENT_STUCK_MODIFIERS
+
+#define USE_I2C
+#define SSD1306OLED
+#define OLED_ROTATE180
+
+/* ws2812 RGB LED*/
+#define RGB_DI_PIN D4
+#define RGBLIGHT_ANIMATIONS
+#define RGBLED_NUM 14 // Number of LEDs
+#define RGBLIGHT_HUE_STEP 10
+#define RGBLIGHT_SAT_STEP 17
+
+#endif
diff --git a/keyboards/hadron/keymaps/default/keymap.c b/keyboards/hadron/keymaps/default/keymap.c
new file mode 100644
index 000000000..01cc8abab
--- /dev/null
+++ b/keyboards/hadron/keymaps/default/keymap.c
@@ -0,0 +1,496 @@
+#include "hadron.h"
+#include "bootloader.h"
+#include "action_layer.h"
+#include "eeconfig.h"
+#include "LUFA/Drivers/Peripheral/TWI.h"
+#ifdef AUDIO_ENABLE
+ #include "audio.h"
+#endif
+#ifdef USE_I2C
+#include "i2c.h"
+#endif
+#ifdef SSD1306OLED
+#include "ssd1306.h"
+#endif
+extern keymap_config_t keymap_config;
+
+//Following line allows macro to read current RGB settings
+extern rgblight_config_t rgblight_config;
+
+// Each layer gets a name for readability, which is then used in the keymap matrix below.
+// The underscores don't mean anything - you can have a layer called STUFF or any other name.
+// Layer names don't all need to be of the same length, obviously, and you can also skip them
+// entirely and just use numbers.
+#define _QWERTY 0
+#define _COLEMAK 1
+#define _DVORAK 2
+#define _LOWER 3
+#define _RAISE 4
+#define _MOUSECURSOR 8
+#define _ADJUST 16
+
+enum preonic_keycodes {
+ QWERTY = SAFE_RANGE,
+ COLEMAK,
+ DVORAK,
+ LOWER,
+ RAISE,
+ BACKLIT,
+ RGBLED_TOGGLE,
+ RGBLED_STEP_MODE,
+ RGBLED_INCREASE_HUE,
+ RGBLED_DECREASE_HUE,
+ RGBLED_INCREASE_SAT,
+ RGBLED_DECREASE_SAT,
+ RGBLED_INCREASE_VAL,
+ RGBLED_DECREASE_VAL,
+};
+
+enum macro_keycodes {
+ KC_DEMOMACRO,
+};
+
+// Fillers to make layering more clear
+#define _______ KC_TRNS
+#define XXXXXXX KC_NO
+// Custom macros
+#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl
+#define CTL_TTAB CTL_T(KC_TAB) // Tap for Esc, hold for Ctrl
+#define CTL_ENT CTL_T(KC_ENT) // Tap for Enter, hold for Ctrl
+#define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift
+// Requires KC_TRNS/_______ for the trigger key in the destination layer
+#define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor
+#define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise
+#define DEMOMACRO M(KC_DEMOMACRO) // Sample for macros
+
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+/* Qwerty
+ * ,------+------+------+------+------+------------------------------------------------.
+ * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | DEL |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
+ * | Tab | Q | W | E | R | T | 7 | 8 | 9 | Y | U | I | O | P | Bksp |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | CAPS | A | S | D | F | G | 4 | 5 | 6 | H | J | K | L | ;/Nav| ' |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | Shift| Z | X | C | V | B | 1 | 2 | 3 | N | M | , | . | / |Ctl/Et|
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right |
+ * `--------------------------------------------------------------------------------------------------------'
+ */
+[_QWERTY] = KEYMAP(
+ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_P7, KC_P8, KC_P9, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_P4, KC_P5, KC_P6, KC_H, KC_J, KC_K, KC_L,LT_MC(KC_SCLN), KC_QUOT, \
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P1, KC_P2, KC_P3, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, CTL_ENT, \
+ KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT,KC_DOWN, KC_UP, KC_RGHT \
+),
+
+/* Colemak
+ * ,------+------+------+------+------+------------------------------------------------.
+ * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | 0 | - |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
+ * | Tab | Q | W | F | P | G | 7 | 8 | 9 | J | L | U | Y | ; | Bksp |
+ * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
+ * | CAPS | A | R | S | T | D | 4 | 5 | 6 | H | N | E | I | O | ' |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | Shift| Z | X | C | V | B | 1 | 2 | 3 | K | M | , | . | / |Ctl/Et|
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right |
+ * `--------------------------------------------------------------------------------------------------------'
+ */
+[_COLEMAK] = KEYMAP(
+ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\
+ KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_P7, KC_P8, KC_P9, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
+ KC_LCTRL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_P4, KC_P5, KC_P6, KC_H, KC_N, KC_E, KC_I, LT_MC(KC_O), KC_QUOT, \
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P1, KC_P2, KC_P3, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, CTL_ENT, \
+ KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
+ ),
+
+/* Dvorak
+ * ,------+------+------+------+------+------------------------------------------------.
+ * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
+ * | Tab | " | , | . | P | Y | 7 | 8 | 9 | F | G | C | R | L | Bksp |
+ * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
+ * | Esc | A | O | E | U | I | 4 | 5 | 6 | D | H | T | N | S | / |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | Shift| ; | Q | J | K | X | 1 | 2 | 3 | B | M | W | V | Z |Ctl/Et|
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right |
+ * `--------------------------------------------------------------------------------------------------------'
+ */
+[_DVORAK] = KEYMAP(
+ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\
+ KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_P7, KC_P8, KC_P9, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \
+ KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_P4, KC_P5, KC_P6, KC_D, KC_H, KC_T, KC_N, LT_MC(KC_S), KC_SLSH, \
+ KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_P1, KC_P2, KC_P3, KC_B, KC_M, KC_W, KC_V, KC_Z, CTL_ENT, \
+ KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
+),
+
+/* Lower
+ * ,------+------+------+------+------+------------------------------------------------.
+ * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
+ * | ~ | ! | @ | # | $ | % | | | | ^ | & | * | ( | ) | Del |
+ * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
+ * | | F1 | F2 | F3 | F4 | F5 | | | | F6 | _ | + | { | } | | |
+ * |------+------+------+------+------+------|------+------+------+------+------+------+------+------+------|
+ * | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO ~ |ISO | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | | | | Next | Vol- | Vol+ | Play |
+ * `--------------------------------------------------------------------------------------------------------'
+ */
+[_LOWER] = KEYMAP(
+ KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \
+ KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \
+ _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_PIPE, \
+ _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12,S(KC_NUHS),S(KC_NUBS),_______,_______, _______, \
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
+),
+
+/* Raise
+ * ,------+------+------+------+------+------------------------------------------------.
+ * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
+ * | ` | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | Del |
+ * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
+ * | Del | F1 | F2 | F3 | F4 | F5 | | | | F6 | - | = | [ | ] | \ |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO # |ISO / | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | | | | Next | Vol- | Vol+ | Play |
+ * `--------------------------------------------------------------------------------------------------------'
+ */
+[_RAISE] = KEYMAP(
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
+ KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
+ _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \
+ _______, _______, _______, _______, _______, KC_SPC, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
+),
+
+/* Mouse Layer (semi-col)
+ * ,------+------+------+------+------+------------------------------------------------.
+ * | ACCL0| ACCL1| ACCL2| | | | | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
+ * | | | | | | | | | Home | Wh_Up| WHL_L| M_Up | WHL_R| Macro| |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | End | Wh_Dn| M_Lft| M_Dn | M_Rt | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | | BTN2 | BTN3 | BTN4 | BTN5 | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | BTN1 | | | | BTN1 | | | | | |
+ * `--------------------------------------------------------------------------------------------------------'
+ */
+
+[_MOUSECURSOR] = KEYMAP(
+ KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
+ _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_WH_L, KC_MS_U, KC_WH_R,DEMOMACRO,_______, \
+ _______, _______, _______, _______, _______, _______, _______, _______, KC_END , KC_PGDN, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, \
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5, _______, _______, \
+ _______, _______, _______, _______, _______, KC_BTN1, _______, _______, _______, KC_BTN1, _______, _______, _______, _______, _______ \
+),
+
+/* Adjust (Lower + Raise)
+ * ,------+------+------+------+------+------------------------------------------------.
+ * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
+ * | Reset|RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | | | | Del |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | |Aud on|Audoff|AGnorm| | | |AGswap|Qwerty|Colemk| | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | |Voice-|Voice+|Mus on|Musoff| | | | | | | | BL + |BL ST |BL TG |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | | | | | | | |
+ * `--------------------------------------------------------------------------------------------------------'
+ */
+[_ADJUST] = KEYMAP(
+ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
+ RESET, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \
+ _______, _______, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, \
+ _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, \
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______\
+)
+
+
+
+};
+
+
+#ifdef AUDIO_ENABLE
+
+float tone_startup[][2] = SONG(STARTUP_SOUND);
+float tone_qwerty[][2] = SONG(QWERTY_SOUND);
+float tone_dvorak[][2] = SONG(DVORAK_SOUND);
+float tone_colemak[][2] = SONG(COLEMAK_SOUND);
+float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
+float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
+#endif
+
+// define variables for reactive RGB
+bool RGB_INIT = false;
+bool TOG_STATUS = false;
+int RGB_current_mode;
+
+
+
+void persistant_default_layer_set(uint16_t default_layer) {
+ eeconfig_update_default_layer(default_layer);
+ default_layer_set(default_layer);
+}
+
+void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
+ if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
+ rgblight_mode(RGB_current_mode);
+ layer_on(layer3);
+ } else {
+ layer_off(layer3);
+ }
+}
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case QWERTY:
+ if (record->event.pressed) {
+ #ifdef AUDIO_ENABLE
+ PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
+ #endif
+ persistant_default_layer_set(1UL<<_QWERTY);
+ }
+ return false;
+ break;
+ case COLEMAK:
+ if (record->event.pressed) {
+ #ifdef AUDIO_ENABLE
+ PLAY_NOTE_ARRAY(tone_colemak, false, 0);
+ #endif
+ persistant_default_layer_set(1UL<<_COLEMAK);
+ }
+ return false;
+ break;
+ case LOWER:
+ if (record->event.pressed) {
+ //not sure how to have keyboard check mode and set it to a variable, so my work around
+ //uses another variable that would be set to true after the first time a reactive key is pressed.
+ if (RGB_INIT) {} else {
+ RGB_current_mode = rgblight_config.mode;
+ RGB_INIT = true;
+ }
+ if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
+ } else {
+ TOG_STATUS = !TOG_STATUS;
+ rgblight_mode(16);
+ }
+ layer_on(_LOWER);
+ update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
+ } else {
+ rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
+ TOG_STATUS = false;
+ layer_off(_LOWER);
+ update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
+ }
+ return false;
+ break;
+ case RAISE:
+ if (record->event.pressed) {
+ //not sure how to have keyboard check mode and set it to a variable, so my work around
+ //uses another variable that would be set to true after the first time a reactive key is pressed.
+ if (RGB_INIT) {} else {
+ RGB_current_mode = rgblight_config.mode;
+ RGB_INIT = true;
+ }
+ if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
+ } else {
+ TOG_STATUS = !TOG_STATUS;
+ rgblight_mode(15);
+ }
+ layer_on(_RAISE);
+ update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
+ } else {
+ rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
+ layer_off(_RAISE);
+ TOG_STATUS = false;
+ update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
+ }
+ return false;
+ break;
+ case BACKLIT:
+ if (record->event.pressed) {
+ register_code(KC_RSFT);
+ #ifdef BACKLIGHT_ENABLE
+ backlight_step();
+ #endif
+ } else {
+ unregister_code(KC_RSFT);
+ }
+ return false;
+ break;
+ case RGB_MOD:
+ //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
+ if (record->event.pressed) {
+ rgblight_mode(RGB_current_mode);
+ rgblight_step();
+ RGB_current_mode = rgblight_config.mode;
+ }
+ return false;
+ break;
+ }
+ return true;
+}
+
+void matrix_init_user(void) {
+ #ifdef USE_I2C
+ i2c_master_init();
+ #ifdef SSD1306OLED
+ // calls code for the SSD1306 OLED
+ _delay_ms(400);
+ TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
+ iota_gfx_init(); // turns on the display
+ #endif
+ #endif
+ #ifdef AUDIO_ENABLE
+ startup_user();
+ #endif
+}
+
+void matrix_scan_user(void) {
+ #ifdef SSD1306OLED
+ iota_gfx_task(); // this is what updates the display continuously
+ #endif
+}
+
+#ifdef AUDIO_ENABLE
+
+void startup_user()
+{
+ _delay_ms(20); // gets rid of tick
+ PLAY_NOTE_ARRAY(tone_startup, false, 0);
+}
+
+void shutdown_user()
+{cc
+ PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
+ _delay_ms(150);
+ stop_all_notes();
+}
+
+void music_on_user(void)
+{
+ music_scale_user();
+}
+
+void music_scale_user(void)
+{
+ PLAY_NOTE_ARRAY(music_scale, false, 0);
+}
+
+#endif
+
+/*
+ * Macro definition
+ */
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ if (!eeconfig_is_enabled()) {
+ eeconfig_init();
+ }
+
+ switch (id) {
+ case KC_DEMOMACRO:
+ if (record->event.pressed){
+ return MACRO (I(1), T(H),T(E),T(L), T(L), T(O), T(SPACE), T(W), T(O), T(R), T(L), T(D), END);
+ }
+ }
+
+ return MACRO_NONE;
+}
+
+void matrix_update(struct CharacterMatrix *dest,
+ const struct CharacterMatrix *source) {
+ if (memcmp(dest->display, source->display, sizeof(dest->display))) {
+ memcpy(dest->display, source->display, sizeof(dest->display));
+ dest->dirty = true;
+ }
+}
+
+//assign the right code to your layers for OLED display
+#define L_BASE 0
+#define L_LOWER 8
+#define L_RAISE 16
+#define L_FNLAYER 64
+#define L_NUMLAY 128
+#define L_NLOWER 136
+#define L_NFNLAYER 192
+#define L_MOUSECURSOR 256
+#define L_ADJUST 65560
+
+void iota_gfx_task_user(void) {
+#if DEBUG_TO_SCREEN
+ if (debug_enable) {
+ return;
+ }
+#endif
+
+ struct CharacterMatrix matrix;
+
+ matrix_clear(&matrix);
+ matrix_write_P(&matrix, PSTR("USB: "));
+#ifdef PROTOCOL_LUFA
+ switch (USB_DeviceState) {
+ case DEVICE_STATE_Unattached:
+ matrix_write_P(&matrix, PSTR("Unattached"));
+ break;
+ case DEVICE_STATE_Suspended:
+ matrix_write_P(&matrix, PSTR("Suspended"));
+ break;
+ case DEVICE_STATE_Configured:
+ matrix_write_P(&matrix, PSTR("Connected"));
+ break;
+ case DEVICE_STATE_Powered:
+ matrix_write_P(&matrix, PSTR("Powered"));
+ break;
+ case DEVICE_STATE_Default:
+ matrix_write_P(&matrix, PSTR("Default"));
+ break;
+ case DEVICE_STATE_Addressed:
+ matrix_write_P(&matrix, PSTR("Addressed"));
+ break;
+ default:
+ matrix_write_P(&matrix, PSTR("Invalid"));
+ }
+#endif
+
+// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
+
+ char buf[40];
+ snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
+ matrix_write_P(&matrix, PSTR("\n\nLayer: "));
+ switch (layer_state) {
+ case L_BASE:
+ matrix_write_P(&matrix, PSTR("Default"));
+ break;
+ case L_RAISE:
+ matrix_write_P(&matrix, PSTR("Raise"));
+ break;
+ case L_LOWER:
+ matrix_write_P(&matrix, PSTR("Lower"));
+ break;
+ case L_ADJUST:
+ matrix_write_P(&matrix, PSTR("ADJUST"));
+ break;
+ default:
+ matrix_write(&matrix, buf);
+ }
+
+ // Host Keyboard LED Status
+ char led[40];
+ snprintf(led, sizeof(led), "\n%s %s %s",
+ (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
+ (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
+ (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
+ matrix_write(&matrix, led);
+ matrix_update(&display, &matrix);
+}
+
diff --git a/keyboards/hadron/keymaps/default/readme.md b/keyboards/hadron/keymaps/default/readme.md
new file mode 100644
index 000000000..de9680b49
--- /dev/null
+++ b/keyboards/hadron/keymaps/default/readme.md
@@ -0,0 +1,2 @@
+# The Default Planck Layout
+
diff --git a/keyboards/hadron/keymaps/readme.md b/keyboards/hadron/keymaps/readme.md
new file mode 100644
index 000000000..54fb5f6d9
--- /dev/null
+++ b/keyboards/hadron/keymaps/readme.md
@@ -0,0 +1,23 @@
+# How to add your own keymap
+
+Folders can be named however you'd like (will be approved upon merging), or should follow the format with a preceding `_`:
+
+ _[ISO 3166-1 alpha-2 code*]_[layout variant]_[layout name/author]
+
+\* See full list: https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements
+
+and contain the following files:
+
+* `keymap.c`
+* `readme.md` *recommended*
+* `config.h` *optional*, found automatically when compiling
+* `Makefile` *optional*, found automatically when compling
+
+When adding your keymap to this list, keep it organised alphabetically (select list, edit->sort lines), and use this format:
+
+ * **folder_name** description
+
+# List of Planck keymaps
+
+* **default** default Planck layout
+* **cbbrowne** cbbrowne's Planck layout \ No newline at end of file
diff --git a/keyboards/hadron/keymaps/side_numpad/Makefile b/keyboards/hadron/keymaps/side_numpad/Makefile
new file mode 100644
index 000000000..5cdc186cd
--- /dev/null
+++ b/keyboards/hadron/keymaps/side_numpad/Makefile
@@ -0,0 +1,26 @@
+
+
+# Build Options
+# change to "no" to disable the options, or define them in the Makefile in
+# the appropriate keymap folder that will get included automatically
+#
+BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
+EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
+CONSOLE_ENABLE = no # Console for debug(+400)
+COMMAND_ENABLE = no # Commands for debug and configuration
+NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
+MIDI_ENABLE = yes # MIDI controls
+AUDIO_ENABLE = no # Audio output on port C6
+UNICODE_ENABLE = no # Unicode
+BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
+RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
+ONEHAND_ENABLE = no # Enable one-hand typing
+
+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
+SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
+
+ifndef QUANTUM_DIR
+ include ../../../../Makefile
+endif \ No newline at end of file
diff --git a/keyboards/hadron/keymaps/side_numpad/config.h b/keyboards/hadron/keymaps/side_numpad/config.h
new file mode 100644
index 000000000..0f349ad93
--- /dev/null
+++ b/keyboards/hadron/keymaps/side_numpad/config.h
@@ -0,0 +1,21 @@
+#ifndef CONFIG_USER_H
+#define CONFIG_USER_H
+
+#include "../../config.h"
+
+#define LEADER_TIMEOUT 300
+//#define BACKLIGHT_BREATHING
+#define PREVENT_STUCK_MODIFIERS
+
+#define USE_I2C
+#define SSD1306OLED
+#define OLED_ROTATE180
+
+/* ws2812 RGB LED*/
+#define RGB_DI_PIN D4
+#define RGBLIGHT_ANIMATIONS
+#define RGBLED_NUM 14 // Number of LEDs
+#define RGBLIGHT_HUE_STEP 10
+#define RGBLIGHT_SAT_STEP 17
+
+#endif
diff --git a/keyboards/hadron/keymaps/side_numpad/keymap.c b/keyboards/hadron/keymaps/side_numpad/keymap.c
new file mode 100644
index 000000000..a5ccfd022
--- /dev/null
+++ b/keyboards/hadron/keymaps/side_numpad/keymap.c
@@ -0,0 +1,505 @@
+#include "hadron.h"
+#include "bootloader.h"
+#include "action_layer.h"
+#include "eeconfig.h"
+#include "LUFA/Drivers/Peripheral/TWI.h"
+#ifdef AUDIO_ENABLE
+ #include "audio.h"
+#endif
+#ifdef USE_I2C
+#include "i2c.h"
+#endif
+#ifdef SSD1306OLED
+#include "ssd1306.h"
+#endif
+extern keymap_config_t keymap_config;
+
+//Following line allows macro to read current RGB settings
+extern rgblight_config_t rgblight_config;
+
+// Each layer gets a name for readability, which is then used in the keymap matrix below.
+// The underscores don't mean anything - you can have a layer called STUFF or any other name.
+// Layer names don't all need to be of the same length, obviously, and you can also skip them
+// entirely and just use numbers.
+#define _QWERTY 0
+#define _LOWER 3
+#define _RAISE 4
+#define _FNLAYER 6
+#define _NUMLAY 7
+#define _MOUSECURSOR 8
+#define _ADJUST 16
+
+enum preonic_keycodes {
+ QWERTY = SAFE_RANGE,
+ COLEMAK,
+ DVORAK,
+ LOWER,
+ RAISE,
+ BACKLIT,
+ RGBLED_TOGGLE,
+ RGBLED_STEP_MODE,
+ RGBLED_INCREASE_HUE,
+ RGBLED_DECREASE_HUE,
+ RGBLED_INCREASE_SAT,
+ RGBLED_DECREASE_SAT,
+ RGBLED_INCREASE_VAL,
+ RGBLED_DECREASE_VAL,
+};
+
+enum macro_keycodes {
+ KC_DEMOMACRO,
+};
+
+// Fillers to make layering more clear
+#define _______ KC_TRNS
+#define XXXXXXX KC_NO
+// Custom macros
+#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl
+#define CTL_TTAB CTL_T(KC_TAB) // Tap for Esc, hold for Ctrl
+#define CTL_ENT CTL_T(KC_ENT) // Tap for Enter, hold for Ctrl
+#define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift
+// Requires KC_TRNS/_______ for the trigger key in the destination layer
+#define LT_FN(kc) LT(_FNLAYER, kc) // L-ayer T-ap Function Layer
+#define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor
+#define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise
+#define TG_NUMLAY TG(_NUMLAY) //Toggle for layer _NUMLAY
+#define DEMOMACRO M(KC_DEMOMACRO) // My login macros
+
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+/* Qwerty
+ * ,------+------+------+------+------+------------------------------------------------.
+ * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
+ * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | 7 | 8 | 9 |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | CAPS | A | S | D | F | G | H | J | K | L | ; |Enter | 4 | 5 | 6 |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | Shift| Z | X | C | V | B | N | M | , | . | / | = | 1 | 2 | 3 |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | ~ | Ctrl | Alt | GUI |Lower |Space |Space |Raise | RAlt | Ins | Del |NumLay| 0 | . | ENT |
+ * `--------------------------------------------------------------------------------------------------------'
+ */
+[_QWERTY] = KEYMAP(
+ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,\
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, KC_P7, KC_P8, KC_P9, \
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, LT_MC(KC_SCLN), CTL_ENT, KC_P4, KC_P5, KC_P6, \
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_EQL, KC_P1, KC_P2, KC_P3, \
+ KC_GRV, KC_RCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_RALT, KC_INS, KC_DEL, TG_NUMLAY, KC_P0, KC_PDOT, KC_PENT \
+),
+
+/* Lower
+ * ,-----------------------------------------------------------------------------------.
+ * | | | | | | | | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
+ * | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | ~ | \ | | | |
+ * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
+ * | CAPS | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | [ | ] | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | Next | Vol- | Vol+ | Play | | | |
+ * `--------------------------------------------------------------------------------------------------------'
+ */
+[_LOWER] = KEYMAP(
+ KC_ESC, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
+ KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_GRV, KC_BSLS, _______, _______, _______, \
+ KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_EQL, KC_LBRC, KC_RBRC, KC_PIPE, _______, _______, _______, \
+ _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_LCBR, KC_RCBR, _______, _______, _______, _______, \
+ _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, _______, _______\
+),
+
+/* Raise
+ * ,-----------------------------------------------------------------------------------.
+ * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
+ * | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | ~ | \ | | | |
+ * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
+ * | | A | Up | D | PrSc | | 4 | 5 | 6 | * | : | ' | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | Lt | Dn | Rt | Mute | | 1 | 2 | 3 | Up | / | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | |Space | 0 | | Left | Down | Right| | | | |
+ * `--------------------------------------------------------------------------------------------------------'
+ */
+[_RAISE] = KEYMAP(
+ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
+ KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_PLUS, KC_BSLS, _______, _______, _______, \
+ _______, KC_A, KC_UP, KC_D, KC_PSCR, _______, KC_4, KC_5, KC_6, KC_PAST, KC_COLN, KC_QUOT, _______, _______, _______, \
+ _______, KC_LEFT, KC_DOWN, KC_RIGHT, KC__MUTE, _______, KC_1, KC_2, KC_3, KC_UP, KC_SLSH, _______, _______, _______, _______, \
+ _______, _______, _______, _______, _______, KC_SPC, KC_0, _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, _______, _______ \
+),
+
+/* FN layer on Esc key
+ * ,-----------------------------------------------------------------------------------.
+ * | | | | | | | | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
+ * | | ! | @ | # | $ | % | ^ | & | * | ( | ) | + | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | F1 | F2 | F3 | F4 | F5 | F6 | _ | = | [ | ] | ' | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | { | } | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | Next | Vol- | Vol+ | Play | | | |
+ * `--------------------------------------------------------------------------------------------------------'
+ */
+[_FNLAYER] = KEYMAP(
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\
+ _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PLUS, _______, _______, _______, \
+ _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_EQL, KC_LBRC, KC_RBRC, KC_QUOT, _______, _______, _______, \
+ _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS), S(KC_NUBS), KC_LCBR, KC_RCBR, _______, _______, _______, _______, \
+ _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, _______, _______ \
+),
+
+/* Num Layer
+ * ,-----------------------------------------------------------------------------------.
+ * | | | | | | | | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
+ * | | | | | | | | | | | | | F7 | F8 | F9 |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | | | | | F4 | F5 | F6 |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | | | | | | Up | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | | | | Exit | Left | Down | Rght |
+ * `--------------------------------------------------------------------------------------------------------'
+ */
+[_NUMLAY] = KEYMAP(
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_HOME, KC_PGUP, \
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, \
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PMNS, KC_UP, KC_PPLS, \
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT \
+),
+
+/* Mouse Layer (semi-col)
+ * ,-----------------------------------------------------------------------------------.
+ * | |ACCL0| ACCL1| ACCL2 | | | | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
+ * | | | | | | Home | Wh_Up| WHL_L| M_Up | WHL_R| | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | End | Wh_Dn| M_Lft| M_Dn | M_Rt | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | BTN2 | BTN3 | BTN4 | BTN5 | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | BTN1 | | | | BTN1 | | | | | |
+ * `--------------------------------------------------------------------------------------------------------'
+ */
+
+[_MOUSECURSOR] = KEYMAP(
+ _______, KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______,\
+ _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_WH_L, KC_MS_U, KC_WH_R, DEMOMACRO, _______, _______, _______, _______, \
+ _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_END , KC_PGDN, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, _______, _______, _______, \
+ _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5, _______, _______, _______, _______, _______, \
+ _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, _______, _______, _______ \
+),
+
+/* Adjust (Lower + Raise)
+
+ * ,-----------------------------------------------------------------------------------.
+ * | Reset| | | | | | | | | VolD | VolU | Mute |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
+ * | |RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | Del | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty| | | | | | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | BL + |BL ST |BLSTEP| BL TG| | | |
+ * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
+ * | | | | | | | | | | | | | | | |
+ * `--------------------------------------------------------------------------------------------------------'
+ */
+[_ADJUST] = KEYMAP(
+ RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_VOLD, KC_VOLU, KC_MUTE, \
+ _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, KC_DEL, _______, _______, _______, \
+ _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______, _______, _______, _______, \
+ _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, _______, _______, _______, \
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
+)
+
+
+
+};
+
+
+#ifdef AUDIO_ENABLE
+
+float tone_startup[][2] = SONG(STARTUP_SOUND);
+float tone_qwerty[][2] = SONG(QWERTY_SOUND);
+float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
+float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
+#endif
+
+// define variables for reactive RGB
+bool RGB_INIT = false;
+bool TOG_STATUS = false;
+bool NUMLAY_STATUS = false;
+int RGB_current_mode;
+
+
+
+void persistant_default_layer_set(uint16_t default_layer) {
+ eeconfig_update_default_layer(default_layer);
+ default_layer_set(default_layer);
+}
+
+void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
+ if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
+ rgblight_mode(RGB_current_mode);
+ layer_on(layer3);
+ } else {
+ layer_off(layer3);
+ }
+}
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case QWERTY:
+ if (record->event.pressed) {
+ #ifdef AUDIO_ENABLE
+ PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
+ #endif
+ persistant_default_layer_set(1UL<<_QWERTY);
+ }
+ return false;
+ break;
+ case LOWER:
+ if (record->event.pressed) {
+ //not sure how to have keyboard check mode and set it to a variable, so my work around
+ //uses another variable that would be set to true after the first time a reactive key is pressed.
+ if (RGB_INIT) {} else {
+ RGB_current_mode = rgblight_config.mode;
+ RGB_INIT = true;
+ }
+ if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
+ } else {
+ TOG_STATUS = !TOG_STATUS;
+ rgblight_mode(16);
+ }
+ layer_on(_LOWER);
+ update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
+ } else {
+ rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
+ TOG_STATUS = false;
+ layer_off(_LOWER);
+ update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
+ }
+ return false;
+ break;
+ case RAISE:
+ if (record->event.pressed) {
+ //not sure how to have keyboard check mode and set it to a variable, so my work around
+ //uses another variable that would be set to true after the first time a reactive key is pressed.
+ if (RGB_INIT) {} else {
+ RGB_current_mode = rgblight_config.mode;
+ RGB_INIT = true;
+ }
+ if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
+ } else {
+ TOG_STATUS = !TOG_STATUS;
+ rgblight_mode(15);
+ }
+ layer_on(_RAISE);
+ update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
+ } else {
+ rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
+ layer_off(_RAISE);
+ TOG_STATUS = false;
+ update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
+ }
+ return false;
+ break;
+ case BACKLIT:
+ if (record->event.pressed) {
+ register_code(KC_RSFT);
+ #ifdef BACKLIGHT_ENABLE
+ backlight_step();
+ #endif
+ } else {
+ unregister_code(KC_RSFT);
+ }
+ return false;
+ break;
+ //my attempt for RGB layer lock indication via changing the mode, still have to figure out how to not have other keypress not override this mode
+ case TG_NUMLAY:
+ if (record->event.pressed) {
+ if (RGB_INIT) {} else {
+ RGB_current_mode = rgblight_config.mode;
+ RGB_INIT = true;
+ }
+ NUMLAY_STATUS = !NUMLAY_STATUS;
+ if (NUMLAY_STATUS) {
+ rgblight_mode(4);
+ layer_on(_NUMLAY);
+ } else {
+ rgblight_mode(RGB_current_mode);
+ layer_off(_NUMLAY); }
+ }
+ return false;
+ break;
+ case RGB_MOD:
+ //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
+ if (record->event.pressed) {
+ rgblight_mode(RGB_current_mode);
+ rgblight_step();
+ RGB_current_mode = rgblight_config.mode;
+ }
+ return false;
+ break;
+ }
+ return true;
+}
+
+void matrix_init_user(void) {
+ #ifdef USE_I2C
+ i2c_master_init();
+ #ifdef SSD1306OLED
+ // calls code for the SSD1306 OLED
+ _delay_ms(400);
+ TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
+ iota_gfx_init(); // turns on the display
+ #endif
+ #endif
+ #ifdef AUDIO_ENABLE
+ startup_user();
+ #endif
+}
+
+void matrix_scan_user(void) {
+ #ifdef SSD1306OLED
+ iota_gfx_task(); // this is what updates the display continuously
+ #endif
+}
+
+#ifdef AUDIO_ENABLE
+
+void startup_user()
+{
+ _delay_ms(20); // gets rid of tick
+ PLAY_NOTE_ARRAY(tone_startup, false, 0);
+}
+
+void shutdown_user()
+{cc
+ PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
+ _delay_ms(150);
+ stop_all_notes();
+}
+
+void music_on_user(void)
+{
+ music_scale_user();
+}
+
+void music_scale_user(void)
+{
+ PLAY_NOTE_ARRAY(music_scale, false, 0);
+}
+
+#endif
+
+/*
+ * Macro definition
+ */
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ if (!eeconfig_is_enabled()) {
+ eeconfig_init();
+ }
+
+ switch (id) {
+ case KC_DEMOMACRO:
+ if (record->event.pressed){
+ return MACRO (I(1), T(H),T(E),T(L), T(L), T(O), T(SPACE), T(W), T(O), T(R), T(L), T(D), END);
+ }
+ }
+
+ return MACRO_NONE;
+}
+
+void matrix_update(struct CharacterMatrix *dest,
+ const struct CharacterMatrix *source) {
+ if (memcmp(dest->display, source->display, sizeof(dest->display))) {
+ memcpy(dest->display, source->display, sizeof(dest->display));
+ dest->dirty = true;
+ }
+}
+
+//assign the right code to your layers for OLED display
+#define L_BASE 0
+#define L_LOWER 8
+#define L_RAISE 16
+#define L_FNLAYER 64
+#define L_NUMLAY 128
+#define L_NLOWER 136
+#define L_NFNLAYER 192
+#define L_MOUSECURSOR 256
+#define L_ADJUST 65560
+
+void iota_gfx_task_user(void) {
+#if DEBUG_TO_SCREEN
+ if (debug_enable) {
+ return;
+ }
+#endif
+
+ struct CharacterMatrix matrix;
+
+ matrix_clear(&matrix);
+ matrix_write_P(&matrix, PSTR("USB: "));
+#ifdef PROTOCOL_LUFA
+ switch (USB_DeviceState) {
+ case DEVICE_STATE_Unattached:
+ matrix_write_P(&matrix, PSTR("Unattached"));
+ break;
+ case DEVICE_STATE_Suspended:
+ matrix_write_P(&matrix, PSTR("Suspended"));
+ break;
+ case DEVICE_STATE_Configured:
+ matrix_write_P(&matrix, PSTR("Connected"));
+ break;
+ case DEVICE_STATE_Powered:
+ matrix_write_P(&matrix, PSTR("Powered"));
+ break;
+ case DEVICE_STATE_Default:
+ matrix_write_P(&matrix, PSTR("Default"));
+ break;
+ case DEVICE_STATE_Addressed:
+ matrix_write_P(&matrix, PSTR("Addressed"));
+ break;
+ default:
+ matrix_write_P(&matrix, PSTR("Invalid"));
+ }
+#endif
+
+// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
+
+ char buf[40];
+ snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
+ matrix_write_P(&matrix, PSTR("\n\nLayer: "));
+ switch (layer_state) {
+ case L_BASE:
+ matrix_write_P(&matrix, PSTR("Default"));
+ break;
+ case L_RAISE:
+ matrix_write_P(&matrix, PSTR("Raise"));
+ break;
+ case L_LOWER:
+ matrix_write_P(&matrix, PSTR("Lower"));
+ break;
+ case L_ADJUST:
+ matrix_write_P(&matrix, PSTR("ADJUST"));
+ break;
+ default:
+ matrix_write(&matrix, buf);
+ }
+
+ // Host Keyboard LED Status
+ char led[40];
+ snprintf(led, sizeof(led), "\n%s %s %s",
+ (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
+ (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
+ (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
+ matrix_write(&matrix, led);
+ matrix_update(&display, &matrix);
+}
diff --git a/keyboards/hadron/keymaps/side_numpad/readme.md b/keyboards/hadron/keymaps/side_numpad/readme.md
new file mode 100644
index 000000000..de9680b49
--- /dev/null
+++ b/keyboards/hadron/keymaps/side_numpad/readme.md
@@ -0,0 +1,2 @@
+# The Default Planck Layout
+
diff --git a/keyboards/hadron/out.txt b/keyboards/hadron/out.txt
new file mode 100644
index 000000000..644a6a777
--- /dev/null
+++ b/keyboards/hadron/out.txt
@@ -0,0 +1,66 @@
+-------- begin --------
+avr-gcc.exe (AVR_8_bit_GNU_Toolchain_3.5.0_1662) 4.9.2
+Copyright (C) 2014 Free Software Foundation, Inc.
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+Compiling: ../../keyboards/planck/planck.c [OK]
+Compiling: ../../keyboards/planck/keymaps/experimental/keymap.c [WARNINGS]
+ |
+ | ../../keyboards/planck/keymaps/experimental/keymap.c: In function 'action_get_macro':
+ | ../../keyboards/planck/keymaps/experimental/keymap.c:227:17: warning: implicit declaration of function 'breathing_speed_set' [-Wimplicit-function-declaration]
+ | breathing_speed_set(2);
+ | ^
+ | ../../keyboards/planck/keymaps/experimental/keymap.c:228:17: warning: implicit declaration of function 'breathing_pulse' [-Wimplicit-function-declaration]
+ | breathing_pulse();
+ | ^
+ |
+Compiling: ../../quantum/quantum.c [OK]
+Compiling: ../../quantum/keymap.c [OK]
+Compiling: ../../quantum/keycode_config.c [OK]
+Compiling: ../../quantum/matrix.c [OK]
+Compiling: ../../quantum/audio/audio.c [OK]
+Compiling: ../../quantum/audio/voices.c [OK]
+Compiling: ../../quantum/audio/luts.c [OK]
+Compiling: ../../tmk_core/protocol/lufa/lufa.c [OK]
+Compiling: ../../tmk_core/protocol/lufa/descriptor.c [OK]
+Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Class/Common/HIDParser.c [OK]
+Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c [OK]
+Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c [OK]
+Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c [OK]
+Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c [OK]
+Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c [OK]
+Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c [OK]
+Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c [OK]
+Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c [OK]
+Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/ConfigDescriptors.c [OK]
+Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/DeviceStandardReq.c [OK]
+Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/Events.c [OK]
+Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/HostStandardReq.c [OK]
+Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/USBTask.c [OK]
+Compiling: ../../tmk_core/common/host.c [OK]
+Compiling: ../../tmk_core/common/keyboard.c [OK]
+Compiling: ../../tmk_core/common/action.c [OK]
+Compiling: ../../tmk_core/common/action_tapping.c [OK]
+Compiling: ../../tmk_core/common/action_macro.c [OK]
+Compiling: ../../tmk_core/common/action_layer.c [OK]
+Compiling: ../../tmk_core/common/action_util.c [OK]
+Compiling: ../../tmk_core/common/print.c [OK]
+Compiling: ../../tmk_core/common/debug.c [OK]
+Compiling: ../../tmk_core/common/util.c [OK]
+Compiling: ../../tmk_core/common/avr/suspend.c [OK]
+Assembling: ../../tmk_core/common/avr/xprintf.S [OK]
+Compiling: ../../tmk_core/common/avr/timer.c [OK]
+Compiling: ../../tmk_core/common/avr/bootloader.c [OK]
+Compiling: ../../tmk_core/common/magic.c [OK]
+Compiling: ../../tmk_core/common/avr/eeconfig.c [OK]
+Compiling: ../../tmk_core/common/mousekey.c [OK]
+Compiling: ../../tmk_core/common/command.c [OK]
+Compiling: ../../tmk_core/common/backlight.c [OK]
+Linking: .build/planck_experimental.elf [ERRORS]
+ |
+ | .build/obj_planck_experimental/keyboards/planck/keymaps/experimental/keymap.o: In function `action_get_macro':
+ | C:\Users\Fred Wales\Documents\Programming\qmk_firmware\keyboards\planck/../../keyboards/planck/keymaps/experimental/keymap.c:240: undefined reference to `breathing_speed_set'
+ | C:\Users\Fred Wales\Documents\Programming\qmk_firmware\keyboards\planck/../../keyboards/planck/keymaps/experimental/keymap.c:241: undefined reference to `breathing_pulse'
+ | collect2.exe: error: ld returned 1 exit status
+ |
diff --git a/keyboards/hadron/readme.md b/keyboards/hadron/readme.md
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/keyboards/hadron/readme.md
@@ -0,0 +1 @@
+
diff --git a/keyboards/hadron/rules.mk b/keyboards/hadron/rules.mk
new file mode 100644
index 000000000..78f86f982
--- /dev/null
+++ b/keyboards/hadron/rules.mk
@@ -0,0 +1,72 @@
+# MCU name
+#MCU = at90usb1287
+MCU = atmega32u4
+
+# Processor frequency.
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
+# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+# automatically to create a 32-bit value in your source code.
+#
+# This will be an integer division of F_USB below, as it is sourced by
+# F_USB after it has run through any CPU prescalers. Note that this value
+# does not *change* the processor frequency - it should merely be updated to
+# reflect the processor speed set externally so that the code can use accurate
+# software delays.
+F_CPU = 16000000
+
+#
+# LUFA specific
+#
+# Target architecture (see library "Board Types" documentation).
+ARCH = AVR8
+
+# Input clock frequency.
+# This will define a symbol, F_USB, in all source code files equal to the
+# input clock frequency (before any prescaling is performed) in Hz. This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_USB = $(F_CPU)
+
+# Interrupt driven control endpoint task(+60)
+OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
+
+
+# Boot Section Size in *bytes*
+# Teensy halfKay 512
+# Teensy++ halfKay 1024
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+# USBaspLoader 2048
+OPT_DEFS += -DBOOTLOADER_SIZE=512
+
+# Build Options
+# change to "no" to disable the options, or define them in the Makefile in
+# the appropriate keymap folder that will get included automatically
+#
+BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE ?= no # Mouse keys(+4700)
+EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
+CONSOLE_ENABLE ?= no # Console for debug(+400)
+COMMAND_ENABLE ?= no # Commands for debug and configuration
+NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality
+MIDI_ENABLE ?= no # MIDI controls
+AUDIO_ENABLE ?= no # Audio output on port C6
+UNICODE_ENABLE ?= no # Unicode
+BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
+RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight.
+API_SYSEX_ENABLE = yes
+
+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
+SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
+
+SRC = i2c.c \
+ ssd1306.c
+
diff --git a/keyboards/hadron/ver0/Makefile b/keyboards/hadron/ver0/Makefile
new file mode 100644
index 000000000..191c6bb66
--- /dev/null
+++ b/keyboards/hadron/ver0/Makefile
@@ -0,0 +1,3 @@
+ifndef MAKEFILE_INCLUDED
+ include ../../../Makefile
+endif \ No newline at end of file
diff --git a/keyboards/hadron/ver0/config.h b/keyboards/hadron/ver0/config.h
new file mode 100644
index 000000000..039d4f1c7
--- /dev/null
+++ b/keyboards/hadron/ver0/config.h
@@ -0,0 +1,35 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef VER0_CONFIG_H
+#define VER0_CONFIG_H
+
+#include "../config.h"
+
+/* USB Device descriptor parameter */
+#define DEVICE_VER 0x0001
+
+/* key matrix size */
+#define MATRIX_ROWS 5
+#define MATRIX_COLS 15
+
+/* Hadron Ver0 PCB default pin-out */
+#define MATRIX_ROW_PINS { D7, E6, B4, B5, B6 }
+#define MATRIX_COL_PINS { F6, F7, C6, C7, F5, F4, F1, F0, D2, D3, D5, B3, B2, B1, B0 }
+#define UNUSED_PINS
+
+
+#endif
diff --git a/keyboards/hadron/ver0/rules.mk b/keyboards/hadron/ver0/rules.mk
new file mode 100644
index 000000000..0f9667a8a
--- /dev/null
+++ b/keyboards/hadron/ver0/rules.mk
@@ -0,0 +1,5 @@
+#AUDIO_ENABLE ?= yes # Audio output on port C6
+
+ifndef QUANTUM_DIR
+ include ../../../Makefile
+endif \ No newline at end of file
diff --git a/keyboards/hadron/ver0/ver0.c b/keyboards/hadron/ver0/ver0.c
new file mode 100644
index 000000000..acb3a9105
--- /dev/null
+++ b/keyboards/hadron/ver0/ver0.c
@@ -0,0 +1 @@
+#include "ver0.h" \ No newline at end of file
diff --git a/keyboards/hadron/ver0/ver0.h b/keyboards/hadron/ver0/ver0.h
new file mode 100644
index 000000000..5710af322
--- /dev/null
+++ b/keyboards/hadron/ver0/ver0.h
@@ -0,0 +1,6 @@
+#ifndef VER0_H
+#define VER0_H
+
+#include "../hadron.h"
+
+#endif \ No newline at end of file
diff --git a/keyboards/hadron/ver2/Makefile b/keyboards/hadron/ver2/Makefile
new file mode 100644
index 000000000..191c6bb66
--- /dev/null
+++ b/keyboards/hadron/ver2/Makefile
@@ -0,0 +1,3 @@
+ifndef MAKEFILE_INCLUDED
+ include ../../../Makefile
+endif \ No newline at end of file
diff --git a/keyboards/hadron/ver2/config.h b/keyboards/hadron/ver2/config.h
new file mode 100644
index 000000000..71a0ab5b3
--- /dev/null
+++ b/keyboards/hadron/ver2/config.h
@@ -0,0 +1,35 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef VER2_CONFIG_H
+#define VER2_CONFIG_H
+
+#include "../config.h"
+
+/* USB Device descriptor parameter */
+#define DEVICE_VER 0x0002
+
+/* key matrix size */
+#define MATRIX_ROWS 5
+#define MATRIX_COLS 15
+
+/* Hadron Ver0 PCB default pin-out */
+#define MATRIX_ROW_PINS { D7, E6, B4, B5, B6 }
+#define MATRIX_COL_PINS { F6, F7, D6, C7, F5, F4, F1, F0, D2, D3, D5, B3, B2, B1, B0 }
+#define UNUSED_PINS
+
+
+#endif
diff --git a/keyboards/hadron/ver2/rules.mk b/keyboards/hadron/ver2/rules.mk
new file mode 100644
index 000000000..0f9667a8a
--- /dev/null
+++ b/keyboards/hadron/ver2/rules.mk
@@ -0,0 +1,5 @@
+#AUDIO_ENABLE ?= yes # Audio output on port C6
+
+ifndef QUANTUM_DIR
+ include ../../../Makefile
+endif \ No newline at end of file
diff --git a/keyboards/hadron/ver2/ver2.c b/keyboards/hadron/ver2/ver2.c
new file mode 100644
index 000000000..bc0917746
--- /dev/null
+++ b/keyboards/hadron/ver2/ver2.c
@@ -0,0 +1 @@
+#include "ver2.h" \ No newline at end of file
diff --git a/keyboards/hadron/ver2/ver2.h b/keyboards/hadron/ver2/ver2.h
new file mode 100644
index 000000000..54e141ffa
--- /dev/null
+++ b/keyboards/hadron/ver2/ver2.h
@@ -0,0 +1,6 @@
+#ifndef VER2_H
+#define VER2_H
+
+#include "../hadron.h"
+
+#endif \ No newline at end of file
diff --git a/keyboards/handwired/magicforce68/README.md b/keyboards/handwired/magicforce68/README.md
index 2877169ef..a0de66069 100644
--- a/keyboards/handwired/magicforce68/README.md
+++ b/keyboards/handwired/magicforce68/README.md
@@ -5,7 +5,7 @@ This firmware is for a Magicforce 68 that's had its PCB removed and is handwired
## Wiring Layout
-![Wiring Layout](http://imgur.com/NmTCv5u)
+![Wiring Layout](http://i.imgur.com/NmTCv5u.png)
## Pinout
diff --git a/keyboards/handwired/promethium/rgbsps.c b/keyboards/handwired/promethium/rgbsps.c
index f30badd35..84fac1ae1 100644
--- a/keyboards/handwired/promethium/rgbsps.c
+++ b/keyboards/handwired/promethium/rgbsps.c
@@ -1,4 +1,4 @@
-#include "light_ws2812.h"
+#include "ws2812.h"
#include "rgbsps.h"
struct cRGB led[RGBSPS_NUM];
diff --git a/keyboards/handwired/promethium/rules.mk b/keyboards/handwired/promethium/rules.mk
index 6fa45b42b..69903dceb 100644
--- a/keyboards/handwired/promethium/rules.mk
+++ b/keyboards/handwired/promethium/rules.mk
@@ -72,7 +72,7 @@ BLUETOOTH = AdafruitBLE
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
-SRC += $(QUANTUM_DIR)/light_ws2812.c
+SRC += ws2812.c
SRC += rgbsps.c
-SRC += $(QUANTUM_DIR)/analog.c
+SRC += analog.c
SRC += matrix.c
diff --git a/keyboards/lets_split/keymaps/OLED_sample/config.h b/keyboards/lets_split/keymaps/OLED_sample/config.h
index c7cbc9372..57ed7d763 100644
--- a/keyboards/lets_split/keymaps/OLED_sample/config.h
+++ b/keyboards/lets_split/keymaps/OLED_sample/config.h
@@ -36,6 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define FLIP_HALF
#define SSD1306OLED
+//#define OLED_ROTATE180
#define PREVENT_STUCK_MODIFIERS
diff --git a/keyboards/lets_split/keymaps/OLED_sample/keymap.c b/keyboards/lets_split/keymaps/OLED_sample/keymap.c
index 5dbab5332..9553309f8 100644
--- a/keyboards/lets_split/keymaps/OLED_sample/keymap.c
+++ b/keyboards/lets_split/keymaps/OLED_sample/keymap.c
@@ -357,3 +357,91 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
return MACRO_NONE;
}
+
+
+void matrix_update(struct CharacterMatrix *dest,
+ const struct CharacterMatrix *source) {
+ if (memcmp(dest->display, source->display, sizeof(dest->display))) {
+ memcpy(dest->display, source->display, sizeof(dest->display));
+ dest->dirty = true;
+ }
+}
+
+//assign the right code to your layers for OLED display
+#define L_BASE 0
+#define L_LOWER 8
+#define L_RAISE 16
+#define L_FNLAYER 64
+#define L_NUMLAY 128
+#define L_NLOWER 136
+#define L_NFNLAYER 192
+#define L_MOUSECURSOR 256
+#define L_ADJUST 65560
+
+void iota_gfx_task_user(void) {
+#if DEBUG_TO_SCREEN
+ if (debug_enable) {
+ return;
+ }
+#endif
+
+ struct CharacterMatrix matrix;
+
+ matrix_clear(&matrix);
+ matrix_write_P(&matrix, PSTR("USB: "));
+#ifdef PROTOCOL_LUFA
+ switch (USB_DeviceState) {
+ case DEVICE_STATE_Unattached:
+ matrix_write_P(&matrix, PSTR("Unattached"));
+ break;
+ case DEVICE_STATE_Suspended:
+ matrix_write_P(&matrix, PSTR("Suspended"));
+ break;
+ case DEVICE_STATE_Configured:
+ matrix_write_P(&matrix, PSTR("Connected"));
+ break;
+ case DEVICE_STATE_Powered:
+ matrix_write_P(&matrix, PSTR("Powered"));
+ break;
+ case DEVICE_STATE_Default:
+ matrix_write_P(&matrix, PSTR("Default"));
+ break;
+ case DEVICE_STATE_Addressed:
+ matrix_write_P(&matrix, PSTR("Addressed"));
+ break;
+ default:
+ matrix_write_P(&matrix, PSTR("Invalid"));
+ }
+#endif
+
+// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
+
+ char buf[40];
+ snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
+ matrix_write_P(&matrix, PSTR("\n\nLayer: "));
+ switch (layer_state) {
+ case L_BASE:
+ matrix_write_P(&matrix, PSTR("Default"));
+ break;
+ case L_RAISE:
+ matrix_write_P(&matrix, PSTR("Raise"));
+ break;
+ case L_LOWER:
+ matrix_write_P(&matrix, PSTR("Lower"));
+ break;
+ case L_ADJUST:
+ matrix_write_P(&matrix, PSTR("ADJUST"));
+ break;
+ default:
+ matrix_write(&matrix, buf);
+ }
+
+ // Host Keyboard LED Status
+ char led[40];
+ snprintf(led, sizeof(led), "\n%s %s %s",
+ (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
+ (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
+ (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
+ matrix_write(&matrix, led);
+ matrix_update(&display, &matrix);
+} \ No newline at end of file
diff --git a/keyboards/lets_split/ssd1306.c b/keyboards/lets_split/ssd1306.c
deleted file mode 100644
index 5c6dff27f..000000000
--- a/keyboards/lets_split/ssd1306.c
+++ /dev/null
@@ -1,470 +0,0 @@
-#ifdef SSD1306OLED
-
-#include "ssd1306.h"
-#include "config.h"
-#include "i2c.h"
-#include <string.h>
-#include "print.h"
-#include "lets_split.h"
-#include "common/glcdfont.c"
-#ifdef ADAFRUIT_BLE_ENABLE
-#include "adafruit_ble.h"
-#endif
-#ifdef PROTOCOL_LUFA
-#include "lufa.h"
-#endif
-#include "sendchar.h"
-#include "pincontrol.h"
-
-//assign the right code to your layers
-#define _BASE 0
-#define _LOWER 8
-#define _RAISE 16
-#define _FNLAYER 64
-#define _NUMLAY 128
-#define _NLOWER 136
-#define _NFNLAYER 192
-#define _MOUSECURSOR 256
-#define _ADJUST 65560
-
-// Set this to 1 to help diagnose early startup problems
-// when testing power-on with ble. Turn it off otherwise,
-// as the latency of printing most of the debug info messes
-// with the matrix scan, causing keys to drop.
-#define DEBUG_TO_SCREEN 0
-
-// Controls the SSD1306 128x32 OLED display via i2c
-
-#define i2cAddress 0x3C
-
-#define DisplayHeight 32
-#define DisplayWidth 128
-
-#define FontHeight 8
-#define FontWidth 6
-
-#define MatrixRows (DisplayHeight / FontHeight)
-#define MatrixCols (DisplayWidth / FontWidth)
-
-struct CharacterMatrix {
- uint8_t display[MatrixRows][MatrixCols];
- uint8_t *cursor;
- bool dirty;
-};
-
-static struct CharacterMatrix display;
-//static uint16_t last_battery_update;
-//static uint32_t vbat;
-//#define BatteryUpdateInterval 10000 /* milliseconds */
-#define ScreenOffInterval 300000 /* milliseconds */
-#if DEBUG_TO_SCREEN
-static uint8_t displaying;
-#endif
-static uint16_t last_flush;
-
-enum ssd1306_cmds {
- DisplayOff = 0xAE,
- DisplayOn = 0xAF,
-
- SetContrast = 0x81,
- DisplayAllOnResume = 0xA4,
-
- DisplayAllOn = 0xA5,
- NormalDisplay = 0xA6,
- InvertDisplay = 0xA7,
- SetDisplayOffset = 0xD3,
- SetComPins = 0xda,
- SetVComDetect = 0xdb,
- SetDisplayClockDiv = 0xD5,
- SetPreCharge = 0xd9,
- SetMultiPlex = 0xa8,
- SetLowColumn = 0x00,
- SetHighColumn = 0x10,
- SetStartLine = 0x40,
-
- SetMemoryMode = 0x20,
- ColumnAddr = 0x21,
- PageAddr = 0x22,
-
- ComScanInc = 0xc0,
- ComScanDec = 0xc8,
- SegRemap = 0xa0,
- SetChargePump = 0x8d,
- ExternalVcc = 0x01,
- SwitchCapVcc = 0x02,
-
- ActivateScroll = 0x2f,
- DeActivateScroll = 0x2e,
- SetVerticalScrollArea = 0xa3,
- RightHorizontalScroll = 0x26,
- LeftHorizontalScroll = 0x27,
- VerticalAndRightHorizontalScroll = 0x29,
- VerticalAndLeftHorizontalScroll = 0x2a,
-};
-
-
-// Write command sequence.
-// Returns true on success.
-static inline bool _send_cmd1(uint8_t cmd) {
- bool res = false;
-
- if (i2c_start_write(i2cAddress)) {
- xprintf("failed to start write to %d\n", i2cAddress);
- goto done;
- }
-
- if (i2c_master_write(0x0 /* command byte follows */)) {
- print("failed to write control byte\n");
-
- goto done;
- }
-
- if (i2c_master_write(cmd)) {
- xprintf("failed to write command %d\n", cmd);
- goto done;
- }
- res = true;
-done:
- i2c_master_stop();
- return res;
-}
-
-// Write 2-byte command sequence.
-// Returns true on success
-static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) {
- if (!_send_cmd1(cmd)) {
- return false;
- }
- return _send_cmd1(opr);
-}
-
-// Write 3-byte command sequence.
-// Returns true on success
-static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) {
- if (!_send_cmd1(cmd)) {
- return false;
- }
- if (!_send_cmd1(opr1)) {
- return false;
- }
- return _send_cmd1(opr2);
-}
-
-#define send_cmd1(c) if (!_send_cmd1(c)) {goto done;}
-#define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;}
-#define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;}
-
-static void matrix_clear(struct CharacterMatrix *matrix);
-
-static void clear_display(void) {
- matrix_clear(&display);
-
- // Clear all of the display bits (there can be random noise
- // in the RAM on startup)
- send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1);
- send_cmd3(ColumnAddr, 0, DisplayWidth - 1);
-
- if (i2c_start_write(i2cAddress)) {
- goto done;
- }
- if (i2c_master_write(0x40)) {
- // Data mode
- goto done;
- }
- for (uint8_t row = 0; row < MatrixRows; ++row) {
- for (uint8_t col = 0; col < DisplayWidth; ++col) {
- i2c_master_write(0);
- }
- }
-
- display.dirty = false;
-
-done:
- i2c_master_stop();
-}
-
-#if DEBUG_TO_SCREEN
-#undef sendchar
-static int8_t capture_sendchar(uint8_t c) {
- sendchar(c);
- iota_gfx_write_char(c);
-
- if (!displaying) {
- iota_gfx_flush();
- }
- return 0;
-}
-#endif
-
-bool iota_gfx_init(void) {
- bool success = false;
-
- send_cmd1(DisplayOff);
- send_cmd2(SetDisplayClockDiv, 0x80);
- send_cmd2(SetMultiPlex, DisplayHeight - 1);
-
- send_cmd2(SetDisplayOffset, 0);
-
-
- send_cmd1(SetStartLine | 0x0);
- send_cmd2(SetChargePump, 0x14 /* Enable */);
- send_cmd2(SetMemoryMode, 0 /* horizontal addressing */);
-
-/// Flips the display orientation 0 degrees
- send_cmd1(SegRemap | 0x1);
- send_cmd1(ComScanDec);
-/*
-// the following Flip the display orientation 180 degrees
- send_cmd1(SegRemap);
- send_cmd1(ComScanInc);
-// end flip */
- send_cmd2(SetComPins, 0x2);
- send_cmd2(SetContrast, 0x8f);
- send_cmd2(SetPreCharge, 0xf1);
- send_cmd2(SetVComDetect, 0x40);
- send_cmd1(DisplayAllOnResume);
- send_cmd1(NormalDisplay);
- send_cmd1(DeActivateScroll);
- send_cmd1(DisplayOn);
-
- send_cmd2(SetContrast, 0); // Dim
-
- clear_display();
-
- success = true;
-
- iota_gfx_flush();
-
-#if DEBUG_TO_SCREEN
- print_set_sendchar(capture_sendchar);
-#endif
-
-done:
- return success;
-}
-
-bool iota_gfx_off(void) {
- bool success = false;
-
- send_cmd1(DisplayOff);
- success = true;
-
-done:
- return success;
-}
-
-bool iota_gfx_on(void) {
- bool success = false;
-
- send_cmd1(DisplayOn);
- success = true;
-
-done:
- return success;
-}
-
-static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) {
- *matrix->cursor = c;
- ++matrix->cursor;
-
- if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) {
- // We went off the end; scroll the display upwards by one line
- memmove(&matrix->display[0], &matrix->display[1],
- MatrixCols * (MatrixRows - 1));
- matrix->cursor = &matrix->display[MatrixRows - 1][0];
- memset(matrix->cursor, ' ', MatrixCols);
- }
-}
-
-static void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) {
- matrix->dirty = true;
-
- if (c == '\n') {
- // Clear to end of line from the cursor and then move to the
- // start of the next line
- uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols;
-
- while (cursor_col++ < MatrixCols) {
- matrix_write_char_inner(matrix, ' ');
- }
- return;
- }
-
- matrix_write_char_inner(matrix, c);
-}
-
-void iota_gfx_write_char(uint8_t c) {
- matrix_write_char(&display, c);
-}
-
-static void matrix_write(struct CharacterMatrix *matrix, const char *data) {
- const char *end = data + strlen(data);
- while (data < end) {
- matrix_write_char(matrix, *data);
- ++data;
- }
-}
-
-void iota_gfx_write(const char *data) {
- matrix_write(&display, data);
-}
-
-static void matrix_write_P(struct CharacterMatrix *matrix, const char *data) {
- while (true) {
- uint8_t c = pgm_read_byte(data);
- if (c == 0) {
- return;
- }
- matrix_write_char(matrix, c);
- ++data;
- }
-}
-
-void iota_gfx_write_P(const char *data) {
- matrix_write_P(&display, data);
-}
-
-static void matrix_clear(struct CharacterMatrix *matrix) {
- memset(matrix->display, ' ', sizeof(matrix->display));
- matrix->cursor = &matrix->display[0][0];
- matrix->dirty = true;
-}
-
-void iota_gfx_clear_screen(void) {
- matrix_clear(&display);
-}
-
-static void matrix_render(struct CharacterMatrix *matrix) {
- last_flush = timer_read();
- iota_gfx_on();
-#if DEBUG_TO_SCREEN
- ++displaying;
-#endif
-
- // Move to the home position
- send_cmd3(PageAddr, 0, MatrixRows - 1);
- send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1);
-
- if (i2c_start_write(i2cAddress)) {
- goto done;
- }
- if (i2c_master_write(0x40)) {
- // Data mode
- goto done;
- }
-
- for (uint8_t row = 0; row < MatrixRows; ++row) {
- for (uint8_t col = 0; col < MatrixCols; ++col) {
- const uint8_t *glyph = font + (matrix->display[row][col] * (FontWidth - 1));
-
- for (uint8_t glyphCol = 0; glyphCol < FontWidth - 1; ++glyphCol) {
- uint8_t colBits = pgm_read_byte(glyph + glyphCol);
- i2c_master_write(colBits);
- }
-
- // 1 column of space between chars (it's not included in the glyph)
- i2c_master_write(0);
- }
- }
-
- matrix->dirty = false;
-
-done:
- i2c_master_stop();
-#if DEBUG_TO_SCREEN
- --displaying;
-#endif
-}
-
-void iota_gfx_flush(void) {
- matrix_render(&display);
-}
-
-static void matrix_update(struct CharacterMatrix *dest,
- const struct CharacterMatrix *source) {
- if (memcmp(dest->display, source->display, sizeof(dest->display))) {
- memcpy(dest->display, source->display, sizeof(dest->display));
- dest->dirty = true;
- }
-}
-
-static void render_status_info(void) {
-#if DEBUG_TO_SCREEN
- if (debug_enable) {
- return;
- }
-#endif
-
- struct CharacterMatrix matrix;
-
- matrix_clear(&matrix);
- matrix_write_P(&matrix, PSTR("USB: "));
-#ifdef PROTOCOL_LUFA
- switch (USB_DeviceState) {
- case DEVICE_STATE_Unattached:
- matrix_write_P(&matrix, PSTR("Unattached"));
- break;
- case DEVICE_STATE_Suspended:
- matrix_write_P(&matrix, PSTR("Suspended"));
- break;
- case DEVICE_STATE_Configured:
- matrix_write_P(&matrix, PSTR("Connected"));
- break;
- case DEVICE_STATE_Powered:
- matrix_write_P(&matrix, PSTR("Powered"));
- break;
- case DEVICE_STATE_Default:
- matrix_write_P(&matrix, PSTR("Default"));
- break;
- case DEVICE_STATE_Addressed:
- matrix_write_P(&matrix, PSTR("Addressed"));
- break;
- default:
- matrix_write_P(&matrix, PSTR("Invalid"));
- }
-#endif
-
-// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
-
- char buf[40];
- snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
- matrix_write_P(&matrix, PSTR("\n\nLayer: "));
- switch (layer_state) {
- case _BASE:
- matrix_write_P(&matrix, PSTR("Default"));
- break;
- case _RAISE:
- matrix_write_P(&matrix, PSTR("Raise"));
- break;
- case _LOWER:
- matrix_write_P(&matrix, PSTR("Lower"));
- break;
- case _ADJUST:
- matrix_write_P(&matrix, PSTR("ADJUST"));
- break;
- default:
- matrix_write(&matrix, buf);
- }
-
- // Host Keyboard LED Status
- char led[40];
- snprintf(led, sizeof(led), "\n%s %s %s",
- (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
- (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
- (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
- matrix_write(&matrix, led);
- matrix_update(&display, &matrix);
-}
-
-void iota_gfx_task(void) {
- render_status_info();
-
- if (display.dirty) {
- iota_gfx_flush();
- }
-
- if (timer_elapsed(last_flush) > ScreenOffInterval) {
- iota_gfx_off();
- }
-}
-#endif
diff --git a/keyboards/lets_split/ssd1306.h b/keyboards/lets_split/ssd1306.h
deleted file mode 100644
index b0c74f987..000000000
--- a/keyboards/lets_split/ssd1306.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef SSD1306_H
-#define SSD1306_H
-
-#include <stdbool.h>
-#include <stdio.h>
-
-bool iota_gfx_init(void);
-void iota_gfx_task(void);
-bool iota_gfx_off(void);
-bool iota_gfx_on(void);
-void iota_gfx_flush(void);
-void iota_gfx_write_char(uint8_t c);
-void iota_gfx_write(const char *data);
-void iota_gfx_write_P(const char *data);
-void iota_gfx_clear_screen(void);
-
-#endif
diff --git a/keyboards/minidox/Makefile b/keyboards/minidox/Makefile
new file mode 100644
index 000000000..30b43c4ea
--- /dev/null
+++ b/keyboards/minidox/Makefile
@@ -0,0 +1,5 @@
+SUBPROJECT_DEFAULT = rev1
+
+ifndef MAKEFILE_INCLUDED
+ include ../../Makefile
+endif \ No newline at end of file
diff --git a/keyboards/minidox/config.h b/keyboards/minidox/config.h
new file mode 100644
index 000000000..306a486cb
--- /dev/null
+++ b/keyboards/minidox/config.h
@@ -0,0 +1,74 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#include "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x3060
+#define MANUFACTURER That-Canadian
+#define PRODUCT MiniDox
+#define DESCRIPTION A compact version of the Ergo Dox
+
+/* key matrix size */
+// Rows are doubled-up
+#define MATRIX_ROWS 8
+#define MATRIX_COLS 5
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+/* define if matrix has ghost */
+//#define MATRIX_HAS_GHOST
+
+/* number of backlight levels */
+// #define BACKLIGHT_LEVELS 3
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCING_DELAY 5
+
+/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
+#define LOCKING_SUPPORT_ENABLE
+/* Locking resynchronize hack */
+#define LOCKING_RESYNC_ENABLE
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+/* disable debug print */
+//#define NO_DEBUG
+
+/* disable print */
+//#define NO_PRINT
+
+/* disable action features */
+//#define NO_ACTION_LAYER
+//#define NO_ACTION_TAPPING
+//#define NO_ACTION_ONESHOT
+//#define NO_ACTION_MACRO
+//#define NO_ACTION_FUNCTION
+
+#ifdef SUBPROJECT_rev1
+ #include "rev1/config.h"
+#endif
+
+#endif
diff --git a/keyboards/minidox/i2c.c b/keyboards/minidox/i2c.c
new file mode 100644
index 000000000..084c890c4
--- /dev/null
+++ b/keyboards/minidox/i2c.c
@@ -0,0 +1,162 @@
+#include <util/twi.h>
+#include <avr/io.h>
+#include <stdlib.h>
+#include <avr/interrupt.h>
+#include <util/twi.h>
+#include <stdbool.h>
+#include "i2c.h"
+
+#ifdef USE_I2C
+
+// Limits the amount of we wait for any one i2c transaction.
+// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
+// 9 bits, a single transaction will take around 90μs to complete.
+//
+// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit
+// poll loop takes at least 8 clock cycles to execute
+#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8
+
+#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE)
+
+volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
+
+static volatile uint8_t slave_buffer_pos;
+static volatile bool slave_has_register_set = false;
+
+// Wait for an i2c operation to finish
+inline static
+void i2c_delay(void) {
+ uint16_t lim = 0;
+ while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT)
+ lim++;
+
+ // easier way, but will wait slightly longer
+ // _delay_us(100);
+}
+
+// Setup twi to run at 100kHz
+void i2c_master_init(void) {
+ // no prescaler
+ TWSR = 0;
+ // Set TWI clock frequency to SCL_CLOCK. Need TWBR>10.
+ // Check datasheets for more info.
+ TWBR = ((F_CPU/SCL_CLOCK)-16)/2;
+}
+
+// Start a transaction with the given i2c slave address. The direction of the
+// transfer is set with I2C_READ and I2C_WRITE.
+// returns: 0 => success
+// 1 => error
+uint8_t i2c_master_start(uint8_t address) {
+ TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA);
+
+ i2c_delay();
+
+ // check that we started successfully
+ if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START))
+ return 1;
+
+ TWDR = address;
+ TWCR = (1<<TWINT) | (1<<TWEN);
+
+ i2c_delay();
+
+ if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) )
+ return 1; // slave did not acknowledge
+ else
+ return 0; // success
+}
+
+
+// Finish the i2c transaction.
+void i2c_master_stop(void) {
+ TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
+
+ uint16_t lim = 0;
+ while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT)
+ lim++;
+}
+
+// Write one byte to the i2c slave.
+// returns 0 => slave ACK
+// 1 => slave NACK
+uint8_t i2c_master_write(uint8_t data) {
+ TWDR = data;
+ TWCR = (1<<TWINT) | (1<<TWEN);
+
+ i2c_delay();
+
+ // check if the slave acknowledged us
+ return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1;
+}
+
+// Read one byte from the i2c slave. If ack=1 the slave is acknowledged,
+// if ack=0 the acknowledge bit is not set.
+// returns: byte read from i2c device
+uint8_t i2c_master_read(int ack) {
+ TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA);
+
+ i2c_delay();
+ return TWDR;
+}
+
+void i2c_reset_state(void) {
+ TWCR = 0;
+}
+
+void i2c_slave_init(uint8_t address) {
+ TWAR = address << 0; // slave i2c address
+ // TWEN - twi enable
+ // TWEA - enable address acknowledgement
+ // TWINT - twi interrupt flag
+ // TWIE - enable the twi interrupt
+ TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN);
+}
+
+ISR(TWI_vect);
+
+ISR(TWI_vect) {
+ uint8_t ack = 1;
+ switch(TW_STATUS) {
+ case TW_SR_SLA_ACK:
+ // this device has been addressed as a slave receiver
+ slave_has_register_set = false;
+ break;
+
+ case TW_SR_DATA_ACK:
+ // this device has received data as a slave receiver
+ // The first byte that we receive in this transaction sets the location
+ // of the read/write location of the slaves memory that it exposes over
+ // i2c. After that, bytes will be written at slave_buffer_pos, incrementing
+ // slave_buffer_pos after each write.
+ if(!slave_has_register_set) {
+ slave_buffer_pos = TWDR;
+ // don't acknowledge the master if this memory loctaion is out of bounds
+ if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) {
+ ack = 0;
+ slave_buffer_pos = 0;
+ }
+ slave_has_register_set = true;
+ } else {
+ i2c_slave_buffer[slave_buffer_pos] = TWDR;
+ BUFFER_POS_INC();
+ }
+ break;
+
+ case TW_ST_SLA_ACK:
+ case TW_ST_DATA_ACK:
+ // master has addressed this device as a slave transmitter and is
+ // requesting data.
+ TWDR = i2c_slave_buffer[slave_buffer_pos];
+ BUFFER_POS_INC();
+ break;
+
+ case TW_BUS_ERROR: // something went wrong, reset twi state
+ TWCR = 0;
+ default:
+ break;
+ }
+ // Reset everything, so we are ready for the next TWI interrupt
+ TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
+}
+#endif
diff --git a/keyboards/minidox/i2c.h b/keyboards/minidox/i2c.h
new file mode 100644
index 000000000..08ce4b009
--- /dev/null
+++ b/keyboards/minidox/i2c.h
@@ -0,0 +1,31 @@
+#ifndef I2C_H
+#define I2C_H
+
+#include <stdint.h>
+
+#ifndef F_CPU
+#define F_CPU 16000000UL
+#endif
+
+#define I2C_READ 1
+#define I2C_WRITE 0
+
+#define I2C_ACK 1
+#define I2C_NACK 0
+
+#define SLAVE_BUFFER_SIZE 0x10
+
+// i2c SCL clock frequency
+#define SCL_CLOCK 100000L
+
+extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
+
+void i2c_master_init(void);
+uint8_t i2c_master_start(uint8_t address);
+void i2c_master_stop(void);
+uint8_t i2c_master_write(uint8_t data);
+uint8_t i2c_master_read(int);
+void i2c_reset_state(void);
+void i2c_slave_init(uint8_t address);
+
+#endif
diff --git a/keyboards/minidox/keymaps/default/keymap.c b/keyboards/minidox/keymaps/default/keymap.c
new file mode 100644
index 000000000..3fa20e1eb
--- /dev/null
+++ b/keyboards/minidox/keymaps/default/keymap.c
@@ -0,0 +1,168 @@
+#include "minidox.h"
+#include "action_layer.h"
+#include "eeconfig.h"
+
+extern keymap_config_t keymap_config;
+
+// Each layer gets a name for readability, which is then used in the keymap matrix below.
+// The underscores don't mean anything - you can have a layer called STUFF or any other name.
+// Layer names don't all need to be of the same length, obviously, and you can also skip them
+// entirely and just use numbers.
+#define _QWERTY 0
+#define _LOWER 1
+#define _RAISE 2
+#define _ADJUST 16
+
+enum custom_keycodes {
+ QWERTY = SAFE_RANGE,
+ LOWER,
+ RAISE,
+ ADJUST,
+};
+
+// Fillers to make layering more clear
+#define _______ KC_TRNS
+#define XXXXXXX KC_NO
+
+// Defines for task manager and such
+#define CALTDEL LCTL(LALT(KC_DEL))
+#define TSKMGR LCTL(LSFT(KC_ESC))
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+/* Qwerty
+ *
+ * ,----------------------------------. ,----------------------------------.
+ * | Q | W | E | R | T | | Y | U | I | O | P |
+ * |------+------+------+------+------| |------+------+------+------+------|
+ * | A | S | D | F | G | | H | J | K | L | ; |
+ * |------+------+------+------+------| |------+------+------+------+------|
+ * | Z | X | C | V | B | | N | M | , | . | / |
+ * `----------------------------------' `----------------------------------'
+ * ,--------------------. ,------,-------------.
+ * | Ctrl | LOWER| | | | RAISE| Shift|
+ * `-------------| Space| |BckSpc|------+------.
+ * | | | |
+ * `------' `------'
+ */
+[_QWERTY] = KEYMAP( \
+ KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \
+ KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, \
+ KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, \
+ KC_LCTL, LOWER, KC_SPC, KC_BSPC, RAISE, OSM(MOD_LSFT) \
+),
+
+/* Raise
+ *
+ * ,----------------------------------. ,----------------------------------.
+ * | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 |
+ * |------+------+------+------+------| |------+------+------+------+------|
+ * | Tab | Left | Down | Up | Right| | | - | = | [ | ] |
+ * |------+------+------+------+------| |------+------+------+------+------|
+ * | Ctrl| ` | GUI | Alt | | | | | | \ | ' |
+ * `----------------------------------' `----------------------------------'
+ * ,--------------------. ,------,-------------.
+ * | | LOWER| | | | RAISE| |
+ * `-------------| | | |------+------.
+ * | | | |
+ * `------' `------'
+ */
+[_RAISE] = KEYMAP( \
+ KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, \
+ KC_TAB, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, \
+ KC_LCTL, KC_GRV, KC_LGUI, KC_LALT, _______, _______, _______, _______, KC_BSLS, KC_QUOT, \
+ _______, _______, _______, _______, _______, _______ \
+),
+
+/* Lower
+ *
+ * ,----------------------------------. ,----------------------------------.
+ * | ! | @ | # | $ | % | | ^ | & | * | ( | ) |
+ * |------+------+------+------+------| |------+------+------+------+------|
+ * | Esc | | | | | | | _ | + | { | } |
+ * |------+------+------+------+------| |------+------+------+------+------|
+ * | Caps| ~ | | | | | | | | | | " |
+ * `----------------------------------' `----------------------------------'
+ * ,--------------------. ,------,-------------.
+ * | | LOWER| | | | RAISE| Del |
+ * `-------------| | | Enter|------+------.
+ * | | | |
+ * `------' `------'
+ */
+[_LOWER] = KEYMAP( \
+ KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, \
+ KC_ESC, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, \
+ KC_CAPS, KC_TILD, _______, _______, _______, _______, _______, _______, KC_PIPE, KC_DQT, \
+ _______, _______, _______, KC_ENT, _______, KC_DEL \
+),
+
+/* Adjust (Lower + Raise)
+ *
+ * ,----------------------------------. ,----------------------------------.
+ * | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 |
+ * |------+------+------+------+------| |------+------+------+------+------|
+ * | F11 | F12 | | | | | | | |Taskmg|caltde|
+ * |------+------+------+------+------| |------+------+------+------+------|
+ * | Reset| | | | | | | | | | |
+ * `----------------------------------' `----------------------------------'
+ * ,--------------------. ,------,-------------.
+ * | | LOWER| | | | RAISE| |
+ * `-------------| | | |------+------.
+ * | | | |
+ * `------' `------'
+ */
+[_ADJUST] = KEYMAP( \
+ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, \
+ KC_F11, KC_F12, _______, _______, _______, _______, _______, _______, TSKMGR, CALTDEL, \
+ RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
+ _______, _______, _______, _______, _______, _______ \
+)
+};
+
+void persistant_default_layer_set(uint16_t default_layer) {
+ eeconfig_update_default_layer(default_layer);
+ default_layer_set(default_layer);
+}
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case QWERTY:
+ if (record->event.pressed) {
+ #ifdef AUDIO_ENABLE
+ PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
+ #endif
+ persistant_default_layer_set(1UL<<_QWERTY);
+ }
+ return false;
+ break;
+ case LOWER:
+ if (record->event.pressed) {
+ layer_on(_LOWER);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ } else {
+ layer_off(_LOWER);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ }
+ return false;
+ break;
+ case RAISE:
+ if (record->event.pressed) {
+ layer_on(_RAISE);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ } else {
+ layer_off(_RAISE);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ }
+ return false;
+ break;
+ case ADJUST:
+ if (record->event.pressed) {
+ layer_on(_ADJUST);
+ } else {
+ layer_off(_ADJUST);
+ }
+ return false;
+ break;
+ }
+ return true;
+} \ No newline at end of file
diff --git a/keyboards/minidox/keymaps/that_canadian/Makefile b/keyboards/minidox/keymaps/that_canadian/Makefile
new file mode 100644
index 000000000..52ef1ad3e
--- /dev/null
+++ b/keyboards/minidox/keymaps/that_canadian/Makefile
@@ -0,0 +1,5 @@
+RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
+
+ifndef QUANTUM_DIR
+ include ../../../../Makefile
+endif
diff --git a/keyboards/minidox/keymaps/that_canadian/config.h b/keyboards/minidox/keymaps/that_canadian/config.h
new file mode 100644
index 000000000..7a8193e08
--- /dev/null
+++ b/keyboards/minidox/keymaps/that_canadian/config.h
@@ -0,0 +1,37 @@
+/*
+This is the c configuration file for the keymap
+
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+Copyright 2015 Jack Humbert
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef CONFIG_USER_H
+#define CONFIG_USER_H
+
+#include "../../config.h"
+
+#define USE_SERIAL
+
+/* ws2812 RGB LED */
+#define RGB_DI_PIN D7
+#define RGBLIGHT_TIMER
+#define RGBLED_NUM 4 // Number of LEDs
+#define RGBLIGHT_ANIMATIONS
+#define RGBLIGHT_HUE_STEP 10
+#define RGBLIGHT_SAT_STEP 17
+#define RGBLIGHT_VAL_STEP 17
+
+#endif \ No newline at end of file
diff --git a/keyboards/minidox/keymaps/that_canadian/keymap.c b/keyboards/minidox/keymaps/that_canadian/keymap.c
new file mode 100644
index 000000000..da9905346
--- /dev/null
+++ b/keyboards/minidox/keymaps/that_canadian/keymap.c
@@ -0,0 +1,172 @@
+#include "minidox.h"
+#include "action_layer.h"
+#include "eeconfig.h"
+
+extern keymap_config_t keymap_config;
+
+// Each layer gets a name for readability, which is then used in the keymap matrix below.
+// The underscores don't mean anything - you can have a layer called STUFF or any other name.
+// Layer names don't all need to be of the same length, obviously, and you can also skip them
+// entirely and just use numbers.
+#define _QWERTY 0
+#define _LOWER 1
+#define _RAISE 2
+#define _ADJUST 16
+
+enum custom_keycodes {
+ QWERTY = SAFE_RANGE,
+ LOWER,
+ RAISE,
+ ADJUST,
+};
+
+// Fillers to make layering more clear
+#define _______ KC_TRNS
+#define XXXXXXX KC_NO
+
+// Defines for task manager and such
+#define CALTDEL LCTL(LALT(KC_DEL))
+#define TSKMGR LCTL(LSFT(KC_ESC))
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+/* Qwerty
+ *
+ * ,----------------------------------. ,----------------------------------.
+ * | Q | W | E | R | T | | Y | U | I | O | P |
+ * |------+------+------+------+------| |------+------+------+------+------|
+ * | A | S | D | F | G | | H | J | K | L | ; |
+ * |------+------+------+------+------| |------+------+------+------+------|
+ * | Z | X | C | V | B | | N | M | , | . | / |
+ * `----------------------------------' `----------------------------------'
+ * ,--------------------. ,------,-------------.
+ * | Ctrl | LOWER| | | | RAISE| Shift|
+ * `-------------| Space| |BckSpc|------+------.
+ * | | | |
+ * `------' `------'
+ */
+[_QWERTY] = KEYMAP( \
+ KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \
+ KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, \
+ KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, \
+ KC_LCTL, LOWER, KC_SPC, KC_BSPC, RAISE, OSM(MOD_LSFT) \
+),
+
+/* Raise
+ *
+ * ,----------------------------------. ,----------------------------------.
+ * | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 |
+ * |------+------+------+------+------| |------+------+------+------+------|
+ * | Tab | Left | Down | Up | Right| | | - | = | [ | ] |
+ * |------+------+------+------+------| |------+------+------+------+------|
+ * | Ctrl| ` | GUI | Alt | | | | | | \ | ' |
+ * `----------------------------------' `----------------------------------'
+ * ,--------------------. ,------,-------------.
+ * | | LOWER| | | | RAISE| |
+ * `-------------| | | |------+------.
+ * | | | |
+ * `------' `------'
+ */
+[_RAISE] = KEYMAP( \
+ KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, \
+ KC_TAB, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, \
+ KC_LCTL, KC_GRV, KC_LGUI, KC_LALT, _______, _______, _______, _______, KC_BSLS, KC_QUOT, \
+ _______, _______, _______, _______, _______, _______ \
+),
+
+/* Lower
+ *
+ * ,----------------------------------. ,----------------------------------.
+ * | ! | @ | # | $ | % | | ^ | & | * | ( | ) |
+ * |------+------+------+------+------| |------+------+------+------+------|
+ * | Esc | | | | | | | _ | + | { | } |
+ * |------+------+------+------+------| |------+------+------+------+------|
+ * | Caps| ~ | | | | | | | | | | " |
+ * `----------------------------------' `----------------------------------'
+ * ,--------------------. ,------,-------------.
+ * | | LOWER| | | | RAISE| Del |
+ * `-------------| | | Enter|------+------.
+ * | | | |
+ * `------' `------'
+ */
+[_LOWER] = KEYMAP( \
+ KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, \
+ KC_ESC, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, \
+ KC_CAPS, KC_TILD, _______, _______, _______, _______, _______, _______, KC_PIPE, KC_DQT, \
+ _______, _______, _______, KC_ENT, _______, KC_DEL \
+),
+
+/* Adjust (Lower + Raise)
+ *
+ * ,----------------------------------. ,----------------------------------.
+ * | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | Up | F9 | F10 |
+ * |------+------+------+------+------| |------+------+------+------+------|
+ * | F11 | F12 | | | | | | Left | Down |Right |caltde|
+ * |------+------+------+------+------| |------+------+------+------+------|
+ * | Reset| | | | | | | | F8 |Taskmg| |
+ * `----------------------------------' `----------------------------------'
+ * ,--------------------. ,------,-------------.
+ * | | LOWER| | | | RAISE| |
+ * `-------------| | | |------+------.
+ * | | | |
+ * `------' `------'
+ */
+[_ADJUST] = KEYMAP( \
+ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_UP, KC_F9, KC_F10, \
+ KC_F11, KC_F12, _______, RGB_SAI, RGB_SAD, _______, KC_LEFT, KC_DOWN, KC_RGHT, CALTDEL, \
+ RESET, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_VAI, RGB_VAD, KC_F8, TSKMGR, _______, \
+ _______, _______, _______, _______, _______, _______ \
+)
+};
+
+#ifdef AUDIO_ENABLE
+float tone_qwerty[][2] = SONG(QWERTY_SOUND);
+#endif
+
+void persistant_default_layer_set(uint16_t default_layer) {
+ eeconfig_update_default_layer(default_layer);
+ default_layer_set(default_layer);
+}
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case QWERTY:
+ if (record->event.pressed) {
+ #ifdef AUDIO_ENABLE
+ PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
+ #endif
+ persistant_default_layer_set(1UL<<_QWERTY);
+ }
+ return false;
+ break;
+ case LOWER:
+ if (record->event.pressed) {
+ layer_on(_LOWER);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ } else {
+ layer_off(_LOWER);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ }
+ return false;
+ break;
+ case RAISE:
+ if (record->event.pressed) {
+ layer_on(_RAISE);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ } else {
+ layer_off(_RAISE);
+ update_tri_layer(_LOWER, _RAISE, _ADJUST);
+ }
+ return false;
+ break;
+ case ADJUST:
+ if (record->event.pressed) {
+ layer_on(_ADJUST);
+ } else {
+ layer_off(_ADJUST);
+ }
+ return false;
+ break;
+ }
+ return true;
+} \ No newline at end of file
diff --git a/keyboards/minidox/matrix.c b/keyboards/minidox/matrix.c
new file mode 100644
index 000000000..138969004
--- /dev/null
+++ b/keyboards/minidox/matrix.c
@@ -0,0 +1,318 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ * scan matrix
+ */
+#include <stdint.h>
+#include <stdbool.h>
+#include <avr/io.h>
+#include <avr/wdt.h>
+#include <avr/interrupt.h>
+#include <util/delay.h>
+#include "print.h"
+#include "debug.h"
+#include "util.h"
+#include "matrix.h"
+#include "split_util.h"
+#include "pro_micro.h"
+#include "config.h"
+
+#ifdef USE_I2C
+# include "i2c.h"
+#else // USE_SERIAL
+# include "serial.h"
+#endif
+
+#ifndef DEBOUNCE
+# define DEBOUNCE 5
+#endif
+
+#define ERROR_DISCONNECT_COUNT 5
+
+static uint8_t debouncing = DEBOUNCE;
+static const int ROWS_PER_HAND = MATRIX_ROWS/2;
+static uint8_t error_count = 0;
+
+static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
+static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
+
+/* matrix state(1:on, 0:off) */
+static matrix_row_t matrix[MATRIX_ROWS];
+static matrix_row_t matrix_debouncing[MATRIX_ROWS];
+
+static matrix_row_t read_cols(void);
+static void init_cols(void);
+static void unselect_rows(void);
+static void select_row(uint8_t row);
+
+__attribute__ ((weak))
+void matrix_init_quantum(void) {
+ matrix_init_kb();
+}
+
+__attribute__ ((weak))
+void matrix_scan_quantum(void) {
+ matrix_scan_kb();
+}
+
+__attribute__ ((weak))
+void matrix_init_kb(void) {
+ matrix_init_user();
+}
+
+__attribute__ ((weak))
+void matrix_scan_kb(void) {
+ matrix_scan_user();
+}
+
+__attribute__ ((weak))
+void matrix_init_user(void) {
+}
+
+__attribute__ ((weak))
+void matrix_scan_user(void) {
+}
+
+inline
+uint8_t matrix_rows(void)
+{
+ return MATRIX_ROWS;
+}
+
+inline
+uint8_t matrix_cols(void)
+{
+ return MATRIX_COLS;
+}
+
+void matrix_init(void)
+{
+ debug_enable = true;
+ debug_matrix = true;
+ debug_mouse = true;
+ // initialize row and col
+ unselect_rows();
+ init_cols();
+
+ TX_RX_LED_INIT;
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ matrix_debouncing[i] = 0;
+ }
+
+ matrix_init_quantum();
+}
+
+uint8_t _matrix_scan(void)
+{
+ // Right hand is stored after the left in the matirx so, we need to offset it
+ int offset = isLeftHand ? 0 : (ROWS_PER_HAND);
+
+ for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
+ select_row(i);
+ _delay_us(30); // without this wait read unstable value.
+ matrix_row_t cols = read_cols();
+ if (matrix_debouncing[i+offset] != cols) {
+ matrix_debouncing[i+offset] = cols;
+ debouncing = DEBOUNCE;
+ }
+ unselect_rows();
+ }
+
+ if (debouncing) {
+ if (--debouncing) {
+ _delay_ms(1);
+ } else {
+ for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
+ matrix[i+offset] = matrix_debouncing[i+offset];
+ }
+ }
+ }
+
+ return 1;
+}
+
+#ifdef USE_I2C
+
+// Get rows from other half over i2c
+int i2c_transaction(void) {
+ int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
+
+ int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE);
+ if (err) goto i2c_error;
+
+ // start of matrix stored at 0x00
+ err = i2c_master_write(0x00);
+ if (err) goto i2c_error;
+
+ // Start read
+ err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
+ if (err) goto i2c_error;
+
+ if (!err) {
+ int i;
+ for (i = 0; i < ROWS_PER_HAND-1; ++i) {
+ matrix[slaveOffset+i] = i2c_master_read(I2C_ACK);
+ }
+ matrix[slaveOffset+i] = i2c_master_read(I2C_NACK);
+ i2c_master_stop();
+ } else {
+i2c_error: // the cable is disconnceted, or something else went wrong
+ i2c_reset_state();
+ return err;
+ }
+
+ return 0;
+}
+
+#else // USE_SERIAL
+
+int serial_transaction(void) {
+ int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
+
+ if (serial_update_buffers()) {
+ return 1;
+ }
+
+ for (int i = 0; i < ROWS_PER_HAND; ++i) {
+ matrix[slaveOffset+i] = serial_slave_buffer[i];
+ }
+ return 0;
+}
+#endif
+
+uint8_t matrix_scan(void)
+{
+ int ret = _matrix_scan();
+
+
+
+#ifdef USE_I2C
+ if( i2c_transaction() ) {
+#else // USE_SERIAL
+ if( serial_transaction() ) {
+#endif
+ // turn on the indicator led when halves are disconnected
+ TXLED1;
+
+ error_count++;
+
+ if (error_count > ERROR_DISCONNECT_COUNT) {
+ // reset other half if disconnected
+ int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
+ for (int i = 0; i < ROWS_PER_HAND; ++i) {
+ matrix[slaveOffset+i] = 0;
+ }
+ }
+ } else {
+ // turn off the indicator led on no error
+ TXLED0;
+ error_count = 0;
+ }
+
+ matrix_scan_quantum();
+
+ return ret;
+}
+
+void matrix_slave_scan(void) {
+ _matrix_scan();
+
+ int offset = (isLeftHand) ? 0 : (MATRIX_ROWS / 2);
+
+#ifdef USE_I2C
+ for (int i = 0; i < ROWS_PER_HAND; ++i) {
+ /* i2c_slave_buffer[i] = matrix[offset+i]; */
+ i2c_slave_buffer[i] = matrix[offset+i];
+ }
+#else // USE_SERIAL
+ for (int i = 0; i < ROWS_PER_HAND; ++i) {
+ serial_slave_buffer[i] = matrix[offset+i];
+ }
+#endif
+}
+
+bool matrix_is_modified(void)
+{
+ if (debouncing) return false;
+ return true;
+}
+
+inline
+bool matrix_is_on(uint8_t row, uint8_t col)
+{
+ return (matrix[row] & ((matrix_row_t)1<<col));
+}
+
+inline
+matrix_row_t matrix_get_row(uint8_t row)
+{
+ return matrix[row];
+}
+
+void matrix_print(void)
+{
+ print("\nr/c 0123456789ABCDEF\n");
+ for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
+ phex(row); print(": ");
+ pbin_reverse16(matrix_get_row(row));
+ print("\n");
+ }
+}
+
+uint8_t matrix_key_count(void)
+{
+ uint8_t count = 0;
+ for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
+ count += bitpop16(matrix[i]);
+ }
+ return count;
+}
+
+static void init_cols(void)
+{
+ for(int x = 0; x < MATRIX_COLS; x++) {
+ _SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF);
+ _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF);
+ }
+}
+
+static matrix_row_t read_cols(void)
+{
+ matrix_row_t result = 0;
+ for(int x = 0; x < MATRIX_COLS; x++) {
+ result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x);
+ }
+ return result;
+}
+
+static void unselect_rows(void)
+{
+ for(int x = 0; x < ROWS_PER_HAND; x++) {
+ _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF);
+ _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF);
+ }
+}
+
+static void select_row(uint8_t row)
+{
+ _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF);
+ _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF);
+}
diff --git a/keyboards/minidox/minidox.c b/keyboards/minidox/minidox.c
new file mode 100644
index 000000000..b4bffbb3e
--- /dev/null
+++ b/keyboards/minidox/minidox.c
@@ -0,0 +1 @@
+#include "minidox.h" \ No newline at end of file
diff --git a/keyboards/minidox/minidox.h b/keyboards/minidox/minidox.h
new file mode 100644
index 000000000..479c7aec7
--- /dev/null
+++ b/keyboards/minidox/minidox.h
@@ -0,0 +1,10 @@
+#ifndef MINIDOX_H
+#define MINIDOX_H
+
+#ifdef SUBPROJECT_rev1
+ #include "rev1.h"
+#endif
+
+#include "quantum.h"
+
+#endif \ No newline at end of file
diff --git a/keyboards/lets_split/pro_micro.h b/keyboards/minidox/pro_micro.h
index f9e7ed75d..f9e7ed75d 100644
--- a/keyboards/lets_split/pro_micro.h
+++ b/keyboards/minidox/pro_micro.h
diff --git a/keyboards/minidox/readme.md b/keyboards/minidox/readme.md
new file mode 100644
index 000000000..f6227386d
--- /dev/null
+++ b/keyboards/minidox/readme.md
@@ -0,0 +1,15 @@
+ECO
+===
+
+![MimiDox](http://i.imgur.com/iWb3yO0.jpg)
+
+A compact version of the ErgoDox
+
+Keyboard Maintainer: That-Canadian
+Hardware Supported: MiniDox PCB rev1 Pro Micro
+
+Make example for this keyboard (after setting up your build environment):
+
+ make minidox-rev1-default
+
+See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.
diff --git a/keyboards/minidox/rev1/Makefile b/keyboards/minidox/rev1/Makefile
new file mode 100644
index 000000000..4e2a6f00f
--- /dev/null
+++ b/keyboards/minidox/rev1/Makefile
@@ -0,0 +1,3 @@
+ifndef MAKEFILE_INCLUDED
+ include ../../Makefile
+endif \ No newline at end of file
diff --git a/keyboards/minidox/rev1/config.h b/keyboards/minidox/rev1/config.h
new file mode 100644
index 000000000..a858a5b90
--- /dev/null
+++ b/keyboards/minidox/rev1/config.h
@@ -0,0 +1,38 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef REV1_CONFIG_H
+#define REV1_CONFIG_H
+
+#include "../config.h"
+
+#define DEVICE_VER 0x0001
+
+// wiring of each half
+#define MATRIX_ROW_PINS { B2, B6, B4, B5 }
+#define MATRIX_COL_PINS { F4, D3, D2, D1, D4 }
+
+#define CATERINA_BOOTLOADER
+
+#define USE_SERIAL
+
+// #define EE_HANDS
+
+#define I2C_MASTER_LEFT
+//#define I2C_MASTER_RIGHT
+
+#endif
diff --git a/keyboards/minidox/rev1/rev1.c b/keyboards/minidox/rev1/rev1.c
new file mode 100644
index 000000000..72b473933
--- /dev/null
+++ b/keyboards/minidox/rev1/rev1.c
@@ -0,0 +1 @@
+#include "minidox.h"
diff --git a/keyboards/minidox/rev1/rev1.h b/keyboards/minidox/rev1/rev1.h
new file mode 100644
index 000000000..379dbf64a
--- /dev/null
+++ b/keyboards/minidox/rev1/rev1.h
@@ -0,0 +1,28 @@
+#ifndef REV1_H
+#define REV1_H
+
+#include "../minidox.h"
+
+//void promicro_bootloader_jmp(bool program);
+#include "quantum.h"
+
+//void promicro_bootloader_jmp(bool program);
+
+#define KEYMAP( \
+ k01, k02, k03, k04, k05, k45, k44, k43, k42, k41, \
+ k11, k12, k13, k14, k15, k55, k54, k53, k52, k51, \
+ k21, k22, k23, k24, k25, k65, k64, k63, k62, k61, \
+ k33, k34, k35, k75, k74, k73 \
+ ) \
+ { \
+ { k01, k02, k03, k04, k05 }, \
+ { k11, k12, k13, k14, k15 }, \
+ { k21, k22, k23, k24, k25 }, \
+ { KC_NO, KC_NO, k33, k34, k35 }, \
+ { k41, k42, k43, k44, k45 }, \
+ { k51, k52, k53, k54, k55 }, \
+ { k61, k62, k63, k64, k65 }, \
+ { KC_NO, KC_NO, k73, k74, k75 } \
+ }
+
+#endif \ No newline at end of file
diff --git a/keyboards/minidox/rev1/rules.mk b/keyboards/minidox/rev1/rules.mk
new file mode 100644
index 000000000..a0825b4ef
--- /dev/null
+++ b/keyboards/minidox/rev1/rules.mk
@@ -0,0 +1,5 @@
+BACKLIGHT_ENABLE = no
+
+ifndef QUANTUM_DIR
+ include ../../../Makefile
+endif \ No newline at end of file
diff --git a/keyboards/minidox/rules.mk b/keyboards/minidox/rules.mk
new file mode 100644
index 000000000..539456ae0
--- /dev/null
+++ b/keyboards/minidox/rules.mk
@@ -0,0 +1,74 @@
+SRC += matrix.c \
+ i2c.c \
+ split_util.c \
+ serial.c
+
+# MCU name
+#MCU = at90usb1287
+MCU = atmega32u4
+
+# Processor frequency.
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
+# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+# automatically to create a 32-bit value in your source code.
+#
+# This will be an integer division of F_USB below, as it is sourced by
+# F_USB after it has run through any CPU prescalers. Note that this value
+# does not *change* the processor frequency - it should merely be updated to
+# reflect the processor speed set externally so that the code can use accurate
+# software delays.
+F_CPU = 16000000
+
+#
+# LUFA specific
+#
+# Target architecture (see library "Board Types" documentation).
+ARCH = AVR8
+
+# Input clock frequency.
+# This will define a symbol, F_USB, in all source code files equal to the
+# input clock frequency (before any prescaling is performed) in Hz. This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_USB = $(F_CPU)
+
+# Interrupt driven control endpoint task(+60)
+OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
+
+
+# Boot Section Size in *bytes*
+# Teensy halfKay 512
+# Teensy++ halfKay 1024
+# Atmel DFU loader 4096
+# LUFA bootloader 4096
+# USBaspLoader 2048
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+# Build Options
+# change to "no" to disable the options, or define them in the Makefile in
+# the appropriate keymap folder that will get included automatically
+#
+BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
+EXTRAKEY_ENABLE ?= no # Audio control and System control(+450)
+CONSOLE_ENABLE ?= no # Console for debug(+400)
+COMMAND_ENABLE ?= yes # Commands for debug and configuration
+NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality
+MIDI_ENABLE ?= no # MIDI controls
+AUDIO_ENABLE ?= no # Audio output on port C6
+UNICODE_ENABLE ?= no # Unicode
+BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
+RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
+USE_I2C ?= no
+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
+SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
+
+CUSTOM_MATRIX = yes
diff --git a/keyboards/minidox/serial.c b/keyboards/minidox/serial.c
new file mode 100644
index 000000000..6faed09ce
--- /dev/null
+++ b/keyboards/minidox/serial.c
@@ -0,0 +1,228 @@
+/*
+ * WARNING: be careful changing this code, it is very timing dependent
+ */
+
+#ifndef F_CPU
+#define F_CPU 16000000
+#endif
+
+#include <avr/io.h>
+#include <avr/interrupt.h>
+#include <util/delay.h>
+#include <stdbool.h>
+#include "serial.h"
+
+#ifdef USE_SERIAL
+
+// Serial pulse period in microseconds. Its probably a bad idea to lower this
+// value.
+#define SERIAL_DELAY 24
+
+uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
+uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
+
+#define SLAVE_DATA_CORRUPT (1<<0)
+volatile uint8_t status = 0;
+
+inline static
+void serial_delay(void) {
+ _delay_us(SERIAL_DELAY);
+}
+
+inline static
+void serial_output(void) {
+ SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
+}
+
+// make the serial pin an input with pull-up resistor
+inline static
+void serial_input(void) {
+ SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK;
+ SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
+}
+
+inline static
+uint8_t serial_read_pin(void) {
+ return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
+}
+
+inline static
+void serial_low(void) {
+ SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
+}
+
+inline static
+void serial_high(void) {
+ SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
+}
+
+void serial_master_init(void) {
+ serial_output();
+ serial_high();
+}
+
+void serial_slave_init(void) {
+ serial_input();
+
+ // Enable INT0
+ EIMSK |= _BV(INT0);
+ // Trigger on falling edge of INT0
+ EICRA &= ~(_BV(ISC00) | _BV(ISC01));
+}
+
+// Used by the master to synchronize timing with the slave.
+static
+void sync_recv(void) {
+ serial_input();
+ // This shouldn't hang if the slave disconnects because the
+ // serial line will float to high if the slave does disconnect.
+ while (!serial_read_pin());
+ serial_delay();
+}
+
+// Used by the slave to send a synchronization signal to the master.
+static
+void sync_send(void) {
+ serial_output();
+
+ serial_low();
+ serial_delay();
+
+ serial_high();
+}
+
+// Reads a byte from the serial line
+static
+uint8_t serial_read_byte(void) {
+ uint8_t byte = 0;
+ serial_input();
+ for ( uint8_t i = 0; i < 8; ++i) {
+ byte = (byte << 1) | serial_read_pin();
+ serial_delay();
+ _delay_us(1);
+ }
+
+ return byte;
+}
+
+// Sends a byte with MSB ordering
+static
+void serial_write_byte(uint8_t data) {
+ uint8_t b = 8;
+ serial_output();
+ while( b-- ) {
+ if(data & (1 << b)) {
+ serial_high();
+ } else {
+ serial_low();
+ }
+ serial_delay();
+ }
+}
+
+// interrupt handle to be used by the slave device
+ISR(SERIAL_PIN_INTERRUPT) {
+ sync_send();
+
+ uint8_t checksum = 0;
+ for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
+ serial_write_byte(serial_slave_buffer[i]);
+ sync_send();
+ checksum += serial_slave_buffer[i];
+ }
+ serial_write_byte(checksum);
+ sync_send();
+
+ // wait for the sync to finish sending
+ serial_delay();
+
+ // read the middle of pulses
+ _delay_us(SERIAL_DELAY/2);
+
+ uint8_t checksum_computed = 0;
+ for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
+ serial_master_buffer[i] = serial_read_byte();
+ sync_send();
+ checksum_computed += serial_master_buffer[i];
+ }
+ uint8_t checksum_received = serial_read_byte();
+ sync_send();
+
+ serial_input(); // end transaction
+
+ if ( checksum_computed != checksum_received ) {
+ status |= SLAVE_DATA_CORRUPT;
+ } else {
+ status &= ~SLAVE_DATA_CORRUPT;
+ }
+}
+
+inline
+bool serial_slave_DATA_CORRUPT(void) {
+ return status & SLAVE_DATA_CORRUPT;
+}
+
+// Copies the serial_slave_buffer to the master and sends the
+// serial_master_buffer to the slave.
+//
+// Returns:
+// 0 => no error
+// 1 => slave did not respond
+int serial_update_buffers(void) {
+ // this code is very time dependent, so we need to disable interrupts
+ cli();
+
+ // signal to the slave that we want to start a transaction
+ serial_output();
+ serial_low();
+ _delay_us(1);
+
+ // wait for the slaves response
+ serial_input();
+ serial_high();
+ _delay_us(SERIAL_DELAY);
+
+ // check if the slave is present
+ if (serial_read_pin()) {
+ // slave failed to pull the line low, assume not present
+ sei();
+ return 1;
+ }
+
+ // if the slave is present syncronize with it
+ sync_recv();
+
+ uint8_t checksum_computed = 0;
+ // receive data from the slave
+ for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
+ serial_slave_buffer[i] = serial_read_byte();
+ sync_recv();
+ checksum_computed += serial_slave_buffer[i];
+ }
+ uint8_t checksum_received = serial_read_byte();
+ sync_recv();
+
+ if (checksum_computed != checksum_received) {
+ sei();
+ return 1;
+ }
+
+ uint8_t checksum = 0;
+ // send data to the slave
+ for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
+ serial_write_byte(serial_master_buffer[i]);
+ sync_recv();
+ checksum += serial_master_buffer[i];
+ }
+ serial_write_byte(checksum);
+ sync_recv();
+
+ // always, release the line when not in use
+ serial_output();
+ serial_high();
+
+ sei();
+ return 0;
+}
+
+#endif
diff --git a/keyboards/minidox/serial.h b/keyboards/minidox/serial.h
new file mode 100644
index 000000000..15fe4db7b
--- /dev/null
+++ b/keyboards/minidox/serial.h
@@ -0,0 +1,26 @@
+#ifndef MY_SERIAL_H
+#define MY_SERIAL_H
+
+#include "config.h"
+#include <stdbool.h>
+
+/* TODO: some defines for interrupt setup */
+#define SERIAL_PIN_DDR DDRD
+#define SERIAL_PIN_PORT PORTD
+#define SERIAL_PIN_INPUT PIND
+#define SERIAL_PIN_MASK _BV(PD0)
+#define SERIAL_PIN_INTERRUPT INT0_vect
+
+#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
+#define SERIAL_MASTER_BUFFER_LENGTH 1
+
+// Buffers for master - slave communication
+extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
+extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
+
+void serial_master_init(void);
+void serial_slave_init(void);
+int serial_update_buffers(void);
+bool serial_slave_data_corrupt(void);
+
+#endif
diff --git a/keyboards/minidox/split_util.c b/keyboards/minidox/split_util.c
new file mode 100644
index 000000000..461921798
--- /dev/null
+++ b/keyboards/minidox/split_util.c
@@ -0,0 +1,80 @@
+#include <avr/io.h>
+#include <avr/wdt.h>
+#include <avr/power.h>
+#include <avr/interrupt.h>
+#include <util/delay.h>
+#include <avr/eeprom.h>
+#include "split_util.h"
+#include "matrix.h"
+#include "keyboard.h"
+#include "config.h"
+
+#ifdef USE_I2C
+# include "i2c.h"
+#else
+# include "serial.h"
+#endif
+
+volatile bool isLeftHand = true;
+
+static void setup_handedness(void) {
+ #ifdef EE_HANDS
+ isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
+ #else
+ #ifdef I2C_MASTER_RIGHT
+ isLeftHand = !has_usb();
+ #else
+ isLeftHand = has_usb();
+ #endif
+ #endif
+}
+
+static void keyboard_master_setup(void) {
+#ifdef USE_I2C
+ i2c_master_init();
+#else
+ serial_master_init();
+#endif
+}
+
+static void keyboard_slave_setup(void) {
+#ifdef USE_I2C
+ i2c_slave_init(SLAVE_I2C_ADDRESS);
+#else
+ serial_slave_init();
+#endif
+}
+
+bool has_usb(void) {
+ USBCON |= (1 << OTGPADE); //enables VBUS pad
+ _delay_us(5);
+ return (USBSTA & (1<<VBUS)); //checks state of VBUS
+}
+
+void split_keyboard_setup(void) {
+ setup_handedness();
+
+ if (has_usb()) {
+ keyboard_master_setup();
+ } else {
+ keyboard_slave_setup();
+ }
+ sei();
+}
+
+void keyboard_slave_loop(void) {
+ matrix_init();
+
+ while (1) {
+ matrix_slave_scan();
+ }
+}
+
+// this code runs before the usb and keyboard is initialized
+void matrix_setup(void) {
+ split_keyboard_setup();
+
+ if (!has_usb()) {
+ keyboard_slave_loop();
+ }
+}
diff --git a/keyboards/minidox/split_util.h b/keyboards/minidox/split_util.h
new file mode 100644
index 000000000..6b896679c
--- /dev/null
+++ b/keyboards/minidox/split_util.h
@@ -0,0 +1,22 @@
+#ifndef SPLIT_KEYBOARD_UTIL_H
+#define SPLIT_KEYBOARD_UTIL_H
+
+#include <stdbool.h>
+
+#ifdef EE_HANDS
+ #define EECONFIG_BOOTMAGIC_END (uint8_t *)10
+ #define EECONFIG_HANDEDNESS EECONFIG_BOOTMAGIC_END
+#endif
+
+#define SLAVE_I2C_ADDRESS 0x32
+
+extern volatile bool isLeftHand;
+
+// slave version of matix scan, defined in matrix.c
+void matrix_slave_scan(void);
+
+void split_keyboard_setup(void);
+bool has_usb(void);
+void keyboard_slave_loop(void);
+
+#endif
diff --git a/keyboards/nyquist/pro_micro.h b/keyboards/nyquist/pro_micro.h
deleted file mode 100644
index f9e7ed75d..000000000
--- a/keyboards/nyquist/pro_micro.h
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- pins_arduino.h - Pin definition functions for Arduino
- Part of Arduino - http://www.arduino.cc/
-
- Copyright (c) 2007 David A. Mellis
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- Boston, MA 02111-1307 USA
-
- $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $
-*/
-
-#ifndef Pins_Arduino_h
-#define Pins_Arduino_h
-
-#include <avr/pgmspace.h>
-
-// Workaround for wrong definitions in "iom32u4.h".
-// This should be fixed in the AVR toolchain.
-#undef UHCON
-#undef UHINT
-#undef UHIEN
-#undef UHADDR
-#undef UHFNUM
-#undef UHFNUML
-#undef UHFNUMH
-#undef UHFLEN
-#undef UPINRQX
-#undef UPINTX
-#undef UPNUM
-#undef UPRST
-#undef UPCONX
-#undef UPCFG0X
-#undef UPCFG1X
-#undef UPSTAX
-#undef UPCFG2X
-#undef UPIENX
-#undef UPDATX
-#undef TCCR2A
-#undef WGM20
-#undef WGM21
-#undef COM2B0
-#undef COM2B1
-#undef COM2A0
-#undef COM2A1
-#undef TCCR2B
-#undef CS20
-#undef CS21
-#undef CS22
-#undef WGM22
-#undef FOC2B
-#undef FOC2A
-#undef TCNT2
-#undef TCNT2_0
-#undef TCNT2_1
-#undef TCNT2_2
-#undef TCNT2_3
-#undef TCNT2_4
-#undef TCNT2_5
-#undef TCNT2_6
-#undef TCNT2_7
-#undef OCR2A
-#undef OCR2_0
-#undef OCR2_1
-#undef OCR2_2
-#undef OCR2_3
-#undef OCR2_4
-#undef OCR2_5
-#undef OCR2_6
-#undef OCR2_7
-#undef OCR2B
-#undef OCR2_0
-#undef OCR2_1
-#undef OCR2_2
-#undef OCR2_3
-#undef OCR2_4
-#undef OCR2_5
-#undef OCR2_6
-#undef OCR2_7
-
-#define NUM_DIGITAL_PINS 30
-#define NUM_ANALOG_INPUTS 12
-
-#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0)
-#define TXLED0 PORTD |= (1<<5)
-#define TXLED1 PORTD &= ~(1<<5)
-#define RXLED0 PORTB |= (1<<0)
-#define RXLED1 PORTB &= ~(1<<0)
-
-static const uint8_t SDA = 2;
-static const uint8_t SCL = 3;
-#define LED_BUILTIN 13
-
-// Map SPI port to 'new' pins D14..D17
-static const uint8_t SS = 17;
-static const uint8_t MOSI = 16;
-static const uint8_t MISO = 14;
-static const uint8_t SCK = 15;
-
-// Mapping of analog pins as digital I/O
-// A6-A11 share with digital pins
-static const uint8_t ADC0 = 18;
-static const uint8_t ADC1 = 19;
-static const uint8_t ADC2 = 20;
-static const uint8_t ADC3 = 21;
-static const uint8_t ADC4 = 22;
-static const uint8_t ADC5 = 23;
-static const uint8_t ADC6 = 24; // D4
-static const uint8_t ADC7 = 25; // D6
-static const uint8_t ADC8 = 26; // D8
-static const uint8_t ADC9 = 27; // D9
-static const uint8_t ADC10 = 28; // D10
-static const uint8_t ADC11 = 29; // D12
-
-#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0))
-#define digitalPinToPCICRbit(p) 0
-#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0))
-#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4))))))
-
-// __AVR_ATmega32U4__ has an unusual mapping of pins to channels
-extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
-#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) )
-
-#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
-
-#ifdef ARDUINO_MAIN
-
-// On the Arduino board, digital pins are also used
-// for the analog output (software PWM). Analog input
-// pins are a separate set.
-
-// ATMEL ATMEGA32U4 / ARDUINO LEONARDO
-//
-// D0 PD2 RXD1/INT2
-// D1 PD3 TXD1/INT3
-// D2 PD1 SDA SDA/INT1
-// D3# PD0 PWM8/SCL OC0B/SCL/INT0
-// D4 A6 PD4 ADC8
-// D5# PC6 ??? OC3A/#OC4A
-// D6# A7 PD7 FastPWM #OC4D/ADC10
-// D7 PE6 INT6/AIN0
-//
-// D8 A8 PB4 ADC11/PCINT4
-// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5
-// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6
-// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7
-// D12 A11 PD6 T1/#OC4D/ADC9
-// D13# PC7 PWM10 CLK0/OC4A
-//
-// A0 D18 PF7 ADC7
-// A1 D19 PF6 ADC6
-// A2 D20 PF5 ADC5
-// A3 D21 PF4 ADC4
-// A4 D22 PF1 ADC1
-// A5 D23 PF0 ADC0
-//
-// New pins D14..D17 to map SPI port to digital pins
-//
-// MISO D14 PB3 MISO,PCINT3
-// SCK D15 PB1 SCK,PCINT1
-// MOSI D16 PB2 MOSI,PCINT2
-// SS D17 PB0 RXLED,SS/PCINT0
-//
-// Connected LEDs on board for TX and RX
-// TXLED D24 PD5 XCK1
-// RXLED D17 PB0
-// HWB PE2 HWB
-
-// these arrays map port names (e.g. port B) to the
-// appropriate addresses for various functions (e.g. reading
-// and writing)
-const uint16_t PROGMEM port_to_mode_PGM[] = {
- NOT_A_PORT,
- NOT_A_PORT,
- (uint16_t) &DDRB,
- (uint16_t) &DDRC,
- (uint16_t) &DDRD,
- (uint16_t) &DDRE,
- (uint16_t) &DDRF,
-};
-
-const uint16_t PROGMEM port_to_output_PGM[] = {
- NOT_A_PORT,
- NOT_A_PORT,
- (uint16_t) &PORTB,
- (uint16_t) &PORTC,
- (uint16_t) &PORTD,
- (uint16_t) &PORTE,
- (uint16_t) &PORTF,
-};
-
-const uint16_t PROGMEM port_to_input_PGM[] = {
- NOT_A_PORT,
- NOT_A_PORT,
- (uint16_t) &PINB,
- (uint16_t) &PINC,
- (uint16_t) &PIND,
- (uint16_t) &PINE,
- (uint16_t) &PINF,
-};
-
-const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
- PD, // D0 - PD2
- PD, // D1 - PD3
- PD, // D2 - PD1
- PD, // D3 - PD0
- PD, // D4 - PD4
- PC, // D5 - PC6
- PD, // D6 - PD7
- PE, // D7 - PE6
-
- PB, // D8 - PB4
- PB, // D9 - PB5
- PB, // D10 - PB6
- PB, // D11 - PB7
- PD, // D12 - PD6
- PC, // D13 - PC7
-
- PB, // D14 - MISO - PB3
- PB, // D15 - SCK - PB1
- PB, // D16 - MOSI - PB2
- PB, // D17 - SS - PB0
-
- PF, // D18 - A0 - PF7
- PF, // D19 - A1 - PF6
- PF, // D20 - A2 - PF5
- PF, // D21 - A3 - PF4
- PF, // D22 - A4 - PF1
- PF, // D23 - A5 - PF0
-
- PD, // D24 - PD5
- PD, // D25 / D6 - A7 - PD7
- PB, // D26 / D8 - A8 - PB4
- PB, // D27 / D9 - A9 - PB5
- PB, // D28 / D10 - A10 - PB6
- PD, // D29 / D12 - A11 - PD6
-};
-
-const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
- _BV(2), // D0 - PD2
- _BV(3), // D1 - PD3
- _BV(1), // D2 - PD1
- _BV(0), // D3 - PD0
- _BV(4), // D4 - PD4
- _BV(6), // D5 - PC6
- _BV(7), // D6 - PD7
- _BV(6), // D7 - PE6
-
- _BV(4), // D8 - PB4
- _BV(5), // D9 - PB5
- _BV(6), // D10 - PB6
- _BV(7), // D11 - PB7
- _BV(6), // D12 - PD6
- _BV(7), // D13 - PC7
-
- _BV(3), // D14 - MISO - PB3
- _BV(1), // D15 - SCK - PB1
- _BV(2), // D16 - MOSI - PB2
- _BV(0), // D17 - SS - PB0
-
- _BV(7), // D18 - A0 - PF7
- _BV(6), // D19 - A1 - PF6
- _BV(5), // D20 - A2 - PF5
- _BV(4), // D21 - A3 - PF4
- _BV(1), // D22 - A4 - PF1
- _BV(0), // D23 - A5 - PF0
-
- _BV(5), // D24 - PD5
- _BV(7), // D25 / D6 - A7 - PD7
- _BV(4), // D26 / D8 - A8 - PB4
- _BV(5), // D27 / D9 - A9 - PB5
- _BV(6), // D28 / D10 - A10 - PB6
- _BV(6), // D29 / D12 - A11 - PD6
-};
-
-const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- TIMER0B, /* 3 */
- NOT_ON_TIMER,
- TIMER3A, /* 5 */
- TIMER4D, /* 6 */
- NOT_ON_TIMER,
-
- NOT_ON_TIMER,
- TIMER1A, /* 9 */
- TIMER1B, /* 10 */
- TIMER0A, /* 11 */
-
- NOT_ON_TIMER,
- TIMER4A, /* 13 */
-
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
-
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
-};
-
-const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {
- 7, // A0 PF7 ADC7
- 6, // A1 PF6 ADC6
- 5, // A2 PF5 ADC5
- 4, // A3 PF4 ADC4
- 1, // A4 PF1 ADC1
- 0, // A5 PF0 ADC0
- 8, // A6 D4 PD4 ADC8
- 10, // A7 D6 PD7 ADC10
- 11, // A8 D8 PB4 ADC11
- 12, // A9 D9 PB5 ADC12
- 13, // A10 D10 PB6 ADC13
- 9 // A11 D12 PD6 ADC9
-};
-
-#endif /* ARDUINO_MAIN */
-
-// These serial port names are intended to allow libraries and architecture-neutral
-// sketches to automatically default to the correct port name for a particular type
-// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
-// the first hardware serial port whose RX/TX pins are not dedicated to another use.
-//
-// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
-//
-// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
-//
-// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
-//
-// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
-//
-// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
-// pins are NOT connected to anything by default.
-#define SERIAL_PORT_MONITOR Serial
-#define SERIAL_PORT_USBVIRTUAL Serial
-#define SERIAL_PORT_HARDWARE Serial1
-#define SERIAL_PORT_HARDWARE_OPEN Serial1
-
-#endif /* Pins_Arduino_h */
diff --git a/keyboards/orthodox/pro_micro.h b/keyboards/orthodox/pro_micro.h
deleted file mode 100644
index f9e7ed75d..000000000
--- a/keyboards/orthodox/pro_micro.h
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- pins_arduino.h - Pin definition functions for Arduino
- Part of Arduino - http://www.arduino.cc/
-
- Copyright (c) 2007 David A. Mellis
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General
- Public License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- Boston, MA 02111-1307 USA
-
- $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $
-*/
-
-#ifndef Pins_Arduino_h
-#define Pins_Arduino_h
-
-#include <avr/pgmspace.h>
-
-// Workaround for wrong definitions in "iom32u4.h".
-// This should be fixed in the AVR toolchain.
-#undef UHCON
-#undef UHINT
-#undef UHIEN
-#undef UHADDR
-#undef UHFNUM
-#undef UHFNUML
-#undef UHFNUMH
-#undef UHFLEN
-#undef UPINRQX
-#undef UPINTX
-#undef UPNUM
-#undef UPRST
-#undef UPCONX
-#undef UPCFG0X
-#undef UPCFG1X
-#undef UPSTAX
-#undef UPCFG2X
-#undef UPIENX
-#undef UPDATX
-#undef TCCR2A
-#undef WGM20
-#undef WGM21
-#undef COM2B0
-#undef COM2B1
-#undef COM2A0
-#undef COM2A1
-#undef TCCR2B
-#undef CS20
-#undef CS21
-#undef CS22
-#undef WGM22
-#undef FOC2B
-#undef FOC2A
-#undef TCNT2
-#undef TCNT2_0
-#undef TCNT2_1
-#undef TCNT2_2
-#undef TCNT2_3
-#undef TCNT2_4
-#undef TCNT2_5
-#undef TCNT2_6
-#undef TCNT2_7
-#undef OCR2A
-#undef OCR2_0
-#undef OCR2_1
-#undef OCR2_2
-#undef OCR2_3
-#undef OCR2_4
-#undef OCR2_5
-#undef OCR2_6
-#undef OCR2_7
-#undef OCR2B
-#undef OCR2_0
-#undef OCR2_1
-#undef OCR2_2
-#undef OCR2_3
-#undef OCR2_4
-#undef OCR2_5
-#undef OCR2_6
-#undef OCR2_7
-
-#define NUM_DIGITAL_PINS 30
-#define NUM_ANALOG_INPUTS 12
-
-#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0)
-#define TXLED0 PORTD |= (1<<5)
-#define TXLED1 PORTD &= ~(1<<5)
-#define RXLED0 PORTB |= (1<<0)
-#define RXLED1 PORTB &= ~(1<<0)
-
-static const uint8_t SDA = 2;
-static const uint8_t SCL = 3;
-#define LED_BUILTIN 13
-
-// Map SPI port to 'new' pins D14..D17
-static const uint8_t SS = 17;
-static const uint8_t MOSI = 16;
-static const uint8_t MISO = 14;
-static const uint8_t SCK = 15;
-
-// Mapping of analog pins as digital I/O
-// A6-A11 share with digital pins
-static const uint8_t ADC0 = 18;
-static const uint8_t ADC1 = 19;
-static const uint8_t ADC2 = 20;
-static const uint8_t ADC3 = 21;
-static const uint8_t ADC4 = 22;
-static const uint8_t ADC5 = 23;
-static const uint8_t ADC6 = 24; // D4
-static const uint8_t ADC7 = 25; // D6
-static const uint8_t ADC8 = 26; // D8
-static const uint8_t ADC9 = 27; // D9
-static const uint8_t ADC10 = 28; // D10
-static const uint8_t ADC11 = 29; // D12
-
-#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0))
-#define digitalPinToPCICRbit(p) 0
-#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0))
-#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4))))))
-
-// __AVR_ATmega32U4__ has an unusual mapping of pins to channels
-extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
-#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) )
-
-#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
-
-#ifdef ARDUINO_MAIN
-
-// On the Arduino board, digital pins are also used
-// for the analog output (software PWM). Analog input
-// pins are a separate set.
-
-// ATMEL ATMEGA32U4 / ARDUINO LEONARDO
-//
-// D0 PD2 RXD1/INT2
-// D1 PD3 TXD1/INT3
-// D2 PD1 SDA SDA/INT1
-// D3# PD0 PWM8/SCL OC0B/SCL/INT0
-// D4 A6 PD4 ADC8
-// D5# PC6 ??? OC3A/#OC4A
-// D6# A7 PD7 FastPWM #OC4D/ADC10
-// D7 PE6 INT6/AIN0
-//
-// D8 A8 PB4 ADC11/PCINT4
-// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5
-// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6
-// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7
-// D12 A11 PD6 T1/#OC4D/ADC9
-// D13# PC7 PWM10 CLK0/OC4A
-//
-// A0 D18 PF7 ADC7
-// A1 D19 PF6 ADC6
-// A2 D20 PF5 ADC5
-// A3 D21 PF4 ADC4
-// A4 D22 PF1 ADC1
-// A5 D23 PF0 ADC0
-//
-// New pins D14..D17 to map SPI port to digital pins
-//
-// MISO D14 PB3 MISO,PCINT3
-// SCK D15 PB1 SCK,PCINT1
-// MOSI D16 PB2 MOSI,PCINT2
-// SS D17 PB0 RXLED,SS/PCINT0
-//
-// Connected LEDs on board for TX and RX
-// TXLED D24 PD5 XCK1
-// RXLED D17 PB0
-// HWB PE2 HWB
-
-// these arrays map port names (e.g. port B) to the
-// appropriate addresses for various functions (e.g. reading
-// and writing)
-const uint16_t PROGMEM port_to_mode_PGM[] = {
- NOT_A_PORT,
- NOT_A_PORT,
- (uint16_t) &DDRB,
- (uint16_t) &DDRC,
- (uint16_t) &DDRD,
- (uint16_t) &DDRE,
- (uint16_t) &DDRF,
-};
-
-const uint16_t PROGMEM port_to_output_PGM[] = {
- NOT_A_PORT,
- NOT_A_PORT,
- (uint16_t) &PORTB,
- (uint16_t) &PORTC,
- (uint16_t) &PORTD,
- (uint16_t) &PORTE,
- (uint16_t) &PORTF,
-};
-
-const uint16_t PROGMEM port_to_input_PGM[] = {
- NOT_A_PORT,
- NOT_A_PORT,
- (uint16_t) &PINB,
- (uint16_t) &PINC,
- (uint16_t) &PIND,
- (uint16_t) &PINE,
- (uint16_t) &PINF,
-};
-
-const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
- PD, // D0 - PD2
- PD, // D1 - PD3
- PD, // D2 - PD1
- PD, // D3 - PD0
- PD, // D4 - PD4
- PC, // D5 - PC6
- PD, // D6 - PD7
- PE, // D7 - PE6
-
- PB, // D8 - PB4
- PB, // D9 - PB5
- PB, // D10 - PB6
- PB, // D11 - PB7
- PD, // D12 - PD6
- PC, // D13 - PC7
-
- PB, // D14 - MISO - PB3
- PB, // D15 - SCK - PB1
- PB, // D16 - MOSI - PB2
- PB, // D17 - SS - PB0
-
- PF, // D18 - A0 - PF7
- PF, // D19 - A1 - PF6
- PF, // D20 - A2 - PF5
- PF, // D21 - A3 - PF4
- PF, // D22 - A4 - PF1
- PF, // D23 - A5 - PF0
-
- PD, // D24 - PD5
- PD, // D25 / D6 - A7 - PD7
- PB, // D26 / D8 - A8 - PB4
- PB, // D27 / D9 - A9 - PB5
- PB, // D28 / D10 - A10 - PB6
- PD, // D29 / D12 - A11 - PD6
-};
-
-const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
- _BV(2), // D0 - PD2
- _BV(3), // D1 - PD3
- _BV(1), // D2 - PD1
- _BV(0), // D3 - PD0
- _BV(4), // D4 - PD4
- _BV(6), // D5 - PC6
- _BV(7), // D6 - PD7
- _BV(6), // D7 - PE6
-
- _BV(4), // D8 - PB4
- _BV(5), // D9 - PB5
- _BV(6), // D10 - PB6
- _BV(7), // D11 - PB7
- _BV(6), // D12 - PD6
- _BV(7), // D13 - PC7
-
- _BV(3), // D14 - MISO - PB3
- _BV(1), // D15 - SCK - PB1
- _BV(2), // D16 - MOSI - PB2
- _BV(0), // D17 - SS - PB0
-
- _BV(7), // D18 - A0 - PF7
- _BV(6), // D19 - A1 - PF6
- _BV(5), // D20 - A2 - PF5
- _BV(4), // D21 - A3 - PF4
- _BV(1), // D22 - A4 - PF1
- _BV(0), // D23 - A5 - PF0
-
- _BV(5), // D24 - PD5
- _BV(7), // D25 / D6 - A7 - PD7
- _BV(4), // D26 / D8 - A8 - PB4
- _BV(5), // D27 / D9 - A9 - PB5
- _BV(6), // D28 / D10 - A10 - PB6
- _BV(6), // D29 / D12 - A11 - PD6
-};
-
-const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- TIMER0B, /* 3 */
- NOT_ON_TIMER,
- TIMER3A, /* 5 */
- TIMER4D, /* 6 */
- NOT_ON_TIMER,
-
- NOT_ON_TIMER,
- TIMER1A, /* 9 */
- TIMER1B, /* 10 */
- TIMER0A, /* 11 */
-
- NOT_ON_TIMER,
- TIMER4A, /* 13 */
-
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
-
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
- NOT_ON_TIMER,
-};
-
-const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {
- 7, // A0 PF7 ADC7
- 6, // A1 PF6 ADC6
- 5, // A2 PF5 ADC5
- 4, // A3 PF4 ADC4
- 1, // A4 PF1 ADC1
- 0, // A5 PF0 ADC0
- 8, // A6 D4 PD4 ADC8
- 10, // A7 D6 PD7 ADC10
- 11, // A8 D8 PB4 ADC11
- 12, // A9 D9 PB5 ADC12
- 13, // A10 D10 PB6 ADC13
- 9 // A11 D12 PD6 ADC9
-};
-
-#endif /* ARDUINO_MAIN */
-
-// These serial port names are intended to allow libraries and architecture-neutral
-// sketches to automatically default to the correct port name for a particular type
-// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
-// the first hardware serial port whose RX/TX pins are not dedicated to another use.
-//
-// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
-//
-// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
-//
-// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
-//
-// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
-//
-// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
-// pins are NOT connected to anything by default.
-#define SERIAL_PORT_MONITOR Serial
-#define SERIAL_PORT_USBVIRTUAL Serial
-#define SERIAL_PORT_HARDWARE Serial1
-#define SERIAL_PORT_HARDWARE_OPEN Serial1
-
-#endif /* Pins_Arduino_h */
diff --git a/keyboards/orthodox/ssd1306.h b/keyboards/orthodox/ssd1306.h
deleted file mode 100644
index b0c74f987..000000000
--- a/keyboards/orthodox/ssd1306.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef SSD1306_H
-#define SSD1306_H
-
-#include <stdbool.h>
-#include <stdio.h>
-
-bool iota_gfx_init(void);
-void iota_gfx_task(void);
-bool iota_gfx_off(void);
-bool iota_gfx_on(void);
-void iota_gfx_flush(void);
-void iota_gfx_write_char(uint8_t c);
-void iota_gfx_write(const char *data);
-void iota_gfx_write_P(const char *data);
-void iota_gfx_clear_screen(void);
-
-#endif
diff --git a/keyboards/tada68/keymaps/maartenwut/config.h b/keyboards/tada68/keymaps/maartenwut/config.h
new file mode 100755
index 000000000..7d81548b7
--- /dev/null
+++ b/keyboards/tada68/keymaps/maartenwut/config.h
@@ -0,0 +1,3 @@
+#include "../../config.h"
+
+#define BACKLIGHT_BREATHING \ No newline at end of file
diff --git a/keyboards/tada68/keymaps/maartenwut/keymap.c b/keyboards/tada68/keymaps/maartenwut/keymap.c
index ce3800c49..d1e63a6b3 100755
--- a/keyboards/tada68/keymaps/maartenwut/keymap.c
+++ b/keyboards/tada68/keymaps/maartenwut/keymap.c
@@ -5,10 +5,11 @@
#include "command.h"
#define _MA 0
-#define _FL 1
-#define _AR 2
-#define _LO 3
-#define _UL 4
+#define _GA 1
+#define _FL 2
+#define _AR 3
+#define _LO 4
+#define _UL 5
#define TRNS KC_TRNS
#define trigger_time 400
@@ -29,6 +30,15 @@
#define LSHIFT OSM(MOD_LSFT)
#define SPACE LT(_AR, KC_SPC)
+#define MACRO_BREATH_TOGGLE 13
+#define MACRO_BREATH_SPEED_INC 14
+#define MACRO_BREATH_SPEED_DEC 15
+#define MACRO_BREATH_DEFAULT 16
+#define M_BRTOG M(MACRO_BREATH_TOGGLE)
+#define M_BSPDU M(MACRO_BREATH_SPEED_INC)
+#define M_BSPDD M(MACRO_BREATH_SPEED_DEC)
+#define M_BDFLT M(MACRO_BREATH_DEFAULT)
+
static uint16_t key_timer;
enum emoticons {
@@ -57,28 +67,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, \
LSHIFT, END_HOME, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, \
KC_LCTL, KC_LGUI, KC_LALT, SPACE, KC_RALT, KC_RCTRL, MO(_FL), KC_LEFT, KC_DOWN, KC_RGHT),
-
+
/* Keymap _FL: Function Layer
* ,----------------------------------------------------------------.
- * |~` | F1|F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12| |Prsc|
+ * |~` | F1|F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Reset |Prsc|
* |----------------------------------------------------------------|
* | |MbL|MsU|MbR| | | | | | | | | | |_LO |
* |----------------------------------------------------------------|
- * | |MsL|MsD|MsR| | | | | | | | | |Hme |
+ * | |MsL|MsD|MsR| |_GA| | | | | | | |Hme |
* |----------------------------------------------------------------|
- * | | | | | | | | | |VoU|VoD|Mut| |MwU|End |
+ * | | |BL-|BL+|BL |BR-|BR+|BR | |VoU|VoD|Mut| |MwU|End |
* |----------------------------------------------------------------|
* | | | | | | | |MwL|MwD|MwR |
* `----------------------------------------------------------------'
*/
[_FL] = KEYMAP_ANSI(
- KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, TRNS, KC_PSCR, \
+ KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, RESET, KC_PSCR, \
TRNS, KC_BTN1, KC_MS_U, KC_BTN2, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TO(_LO), \
- TRNS, KC_MS_L, KC_MS_D, KC_MS_R, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_HOME, \
- TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_VOLD, KC_VOLU, KC_MUTE, TRNS, KC_WH_U, KC_END, \
+ TRNS, KC_MS_L, KC_MS_D, KC_MS_R, TRNS, TG(_GA), TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_HOME, \
+ TRNS, TRNS, BL_DEC, BL_INC, BL_TOGG, M_BSPDD, M_BSPDU, M_BRTOG, TRNS, KC_VOLD, KC_VOLU, KC_MUTE, TRNS, KC_WH_U, KC_END, \
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_WH_L, KC_WH_D, KC_WH_R),
- /* Keymap _UL: Unlock layer
+ /* Keymap _AR: Arrow layer
* ,----------------------------------------------------------------.
* | | | | | | | | | | | | | | | |
* |----------------------------------------------------------------|
@@ -95,9 +105,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
LENNY, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
DWNHRT, TRNS, TRNS, TRNS, TRNS, TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, TRNS, TRNS, TRNS, TRNS, \
- SHRUG, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
+ SHRUG, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS),
+ /* Keymap _GA: Game layer
+ * ,----------------------------------------------------------------.
+ * |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |P/P |
+ * |----------------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |Del |
+ * |----------------------------------------------------------------|
+ * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return |PgUp|
+ * |----------------------------------------------------------------|
+ * |Shft|End| Z| X| C| V| B| N| M| ,| .| /|Shift | Up|PgDn|
+ * |----------------------------------------------------------------|
+ * |Ctrl|Win |Alt | Space |Alt|Ctrl| FN|Lef|Dow|Rig |
+ * `----------------------------------------------------------------'
+ */
+[_GA] = KEYMAP_ANSI(
+ KC_ESC, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, KC_BSPC, KC_MPLY, \
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, \
+ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, \
+ KC_LSFT, END_HOME, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, \
+ KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTRL, MO(_FL), KC_LEFT, KC_DOWN, KC_RGHT),
+
/* Keymap _UL: Unlock layer
* ,----------------------------------------------------------------.
* | | | | | | | | | | | | | | | |
@@ -378,6 +408,29 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
}
}
break;
+ case MACRO_BREATH_TOGGLE:
+ if (record->event.pressed) {
+ breathing_toggle();
+ }
+ break;
+
+ case MACRO_BREATH_SPEED_INC:
+ if (record->event.pressed) {
+ breathing_speed_inc(1);
+ }
+ break;
+
+ case MACRO_BREATH_SPEED_DEC:
+ if (record->event.pressed) {
+ breathing_speed_dec(1);
+ }
+ break;
+
+ case MACRO_BREATH_DEFAULT:
+ if (record->event.pressed) {
+ breathing_defaults();
+ }
+ break;
}
return MACRO_NONE;
-}; \ No newline at end of file
+};
diff --git a/keyboards/whitefox/animations.c b/keyboards/whitefox/animations.c
deleted file mode 100644
index ed1d75efb..000000000
--- a/keyboards/whitefox/animations.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* Copyright 2017 Fred Sundvik
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#if defined(VISUALIZER_ENABLE)
-
-#include "animations.h"
-#include "visualizer.h"
-
-#ifdef BACKLIGHT_ENABLE
-#include "led_keyframes.h"
-#endif
-
-#include "visualizer_keyframes.h"
-
-
-#if defined(LCD_ENABLE) || defined(LCD_BACKLIGHT_ENABLE) || defined(BACKLIGHT_ENABLE)
-
-static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
-#ifdef BACKLIGHT_ENABLE
- led_keyframe_enable(animation, state);
-#endif
- return false;
-}
-
-static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
-#ifdef BACKLIGHT_ENABLE
- led_keyframe_disable(animation, state);
-#endif
- return false;
-}
-
-static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) {
- bool ret = false;
-#ifdef BACKLIGHT_ENABLE
- ret |= led_keyframe_fade_in_all(animation, state);
-#endif
- return ret;
-}
-
-static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) {
- bool ret = false;
-#ifdef BACKLIGHT_ENABLE
- ret |= led_keyframe_fade_out_all(animation, state);
-#endif
- return ret;
-}
-
-
-// Don't worry, if the startup animation is long, you can use the keyboard like normal
-// during that time
-keyframe_animation_t default_startup_animation = {
- .num_frames = 2,
- .loop = false,
- .frame_lengths = {0, gfxMillisecondsToTicks(5000)},
- .frame_functions = {
- keyframe_enable,
- keyframe_fade_in,
- },
-};
-
-keyframe_animation_t default_suspend_animation = {
- .num_frames = 2,
- .loop = false,
- .frame_lengths = {gfxMillisecondsToTicks(1000), 0},
- .frame_functions = {
- keyframe_fade_out,
- keyframe_disable,
- },
-};
-#endif
-
-#if defined(BACKLIGHT_ENABLE)
-#define CROSSFADE_TIME 1000
-#define GRADIENT_TIME 3000
-
-keyframe_animation_t led_test_animation = {
- .num_frames = 14,
- .loop = true,
- .frame_lengths = {
- gfxMillisecondsToTicks(1000), // fade in
- gfxMillisecondsToTicks(1000), // no op (leds on)
- gfxMillisecondsToTicks(1000), // fade out
- gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
- gfxMillisecondsToTicks(GRADIENT_TIME), // left to rigt (outside in)
- gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
- gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom
- 0, // mirror leds
- gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
- gfxMillisecondsToTicks(GRADIENT_TIME), // left_to_right (mirrored, so inside out)
- gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
- gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom
- 0, // normal leds
- gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade
-
- },
- .frame_functions = {
- led_keyframe_fade_in_all,
- keyframe_no_operation,
- led_keyframe_fade_out_all,
- led_keyframe_crossfade,
- led_keyframe_left_to_right_gradient,
- led_keyframe_crossfade,
- led_keyframe_top_to_bottom_gradient,
- led_keyframe_mirror_orientation,
- led_keyframe_crossfade,
- led_keyframe_left_to_right_gradient,
- led_keyframe_crossfade,
- led_keyframe_top_to_bottom_gradient,
- led_keyframe_normal_orientation,
- led_keyframe_crossfade,
- },
-};
-#endif
-
-#endif
diff --git a/keyboards/whitefox/animations.h b/keyboards/whitefox/animations.h
deleted file mode 100644
index 6d8b9830d..000000000
--- a/keyboards/whitefox/animations.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright 2017 Fred Sundvik
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_
-#define KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_
-
-#include "visualizer.h"
-
-// You can use these default animations, but of course you can also write your own custom ones instead
-extern keyframe_animation_t default_startup_animation;
-extern keyframe_animation_t default_suspend_animation;
-
-// An animation for testing and demonstrating the led support, should probably not be used for real world
-// cases
-extern keyframe_animation_t led_test_animation;
-
-#endif /* KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ */
diff --git a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h b/keyboards/whitefox/board_is31fl3731c.h
index 3dc5327a5..dea643f10 100644
--- a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/board_IS31FL3731C.h
+++ b/keyboards/whitefox/board_is31fl3731c.h
@@ -22,9 +22,6 @@ static const I2CConfig i2ccfg = {
400000 // clock speed (Hz); 400kHz max for IS31
};
-#define GDISP_SCREEN_WIDTH 16
-#define GDISP_SCREEN_HEIGHT 5
-
static const uint8_t led_mask[] = {
0xFF, 0x00, /* C1-1 -> C1-16 */
0xFF, 0x00, /* C2-1 -> C2-16 */
diff --git a/keyboards/whitefox/config.h b/keyboards/whitefox/config.h
index 08de9b9aa..dc33a7ce5 100644
--- a/keyboards/whitefox/config.h
+++ b/keyboards/whitefox/config.h
@@ -81,12 +81,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
-#endif
-
-// The visualizer needs gfx thread priorities
-#define LED_DISPLAY_NUMBER 0
-
-#define LED_NUM_ROWS 5
-#define LED_NUM_COLS 16
-
-#define VISUALIZER_THREAD_PRIORITY (NORMAL_PRIORITY - 2)
+#endif \ No newline at end of file
diff --git a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/driver.mk b/keyboards/whitefox/drivers/gdisp/IS31FL3731C/driver.mk
deleted file mode 100644
index f32d0d868..000000000
--- a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/driver.mk
+++ /dev/null
@@ -1,2 +0,0 @@
-GFXINC += drivers/gdisp/IS31FL3731C
-GFXSRC += drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
diff --git a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c b/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
deleted file mode 100644
index c807cbd1e..000000000
--- a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
-Copyright 2016 Fred Sundvik <fsundvik@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "gfx.h"
-
-#if GFX_USE_GDISP
-
-#define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_WHITEFOX
-#include "drivers/gdisp/IS31FL3731C/gdisp_lld_config.h"
-#include "src/gdisp/gdisp_driver.h"
-
-#include "board_IS31FL3731C.h"
-
-
-// Can't include led_tables from here
-extern const uint8_t CIE1931_CURVE[];
-
-/*===========================================================================*/
-/* Driver local definitions. */
-/*===========================================================================*/
-
-#ifndef GDISP_SCREEN_HEIGHT
- #define GDISP_SCREEN_HEIGHT 9
-#endif
-#ifndef GDISP_SCREEN_WIDTH
- #define GDISP_SCREEN_WIDTH 16
-#endif
-#ifndef GDISP_INITIAL_CONTRAST
- #define GDISP_INITIAL_CONTRAST 0
-#endif
-#ifndef GDISP_INITIAL_BACKLIGHT
- #define GDISP_INITIAL_BACKLIGHT 0
-#endif
-
-#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
-
-#define IS31_ADDR_DEFAULT 0x74
-
-#define IS31_REG_CONFIG 0x00
-// bits in reg
-#define IS31_REG_CONFIG_PICTUREMODE 0x00
-#define IS31_REG_CONFIG_AUTOPLAYMODE 0x08
-#define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18
-// D2:D0 bits are starting frame for autoplay mode
-
-#define IS31_REG_PICTDISP 0x01 // D2:D0 frame select for picture mode
-
-#define IS31_REG_AUTOPLAYCTRL1 0x02
-// D6:D4 number of loops (000=infty)
-// D2:D0 number of frames to be used
-
-#define IS31_REG_AUTOPLAYCTRL2 0x03 // D5:D0 delay time (*11ms)
-
-#define IS31_REG_DISPLAYOPT 0x05
-#define IS31_REG_DISPLAYOPT_INTENSITY_SAME 0x20 // same intensity for all frames
-#define IS31_REG_DISPLAYOPT_BLINK_ENABLE 0x8
-// D2:D0 bits blink period time (*0.27s)
-
-#define IS31_REG_AUDIOSYNC 0x06
-#define IS31_REG_AUDIOSYNC_ENABLE 0x1
-
-#define IS31_REG_FRAMESTATE 0x07
-
-#define IS31_REG_BREATHCTRL1 0x08
-// D6:D4 fade out time (26ms*2^i)
-// D2:D0 fade in time (26ms*2^i)
-
-#define IS31_REG_BREATHCTRL2 0x09
-#define IS31_REG_BREATHCTRL2_ENABLE 0x10
-// D2:D0 extinguish time (3.5ms*2^i)
-
-#define IS31_REG_SHUTDOWN 0x0A
-#define IS31_REG_SHUTDOWN_OFF 0x0
-#define IS31_REG_SHUTDOWN_ON 0x1
-
-#define IS31_REG_AGCCTRL 0x0B
-#define IS31_REG_ADCRATE 0x0C
-
-#define IS31_COMMANDREGISTER 0xFD
-#define IS31_FUNCTIONREG 0x0B // helpfully called 'page nine'
-#define IS31_FUNCTIONREG_SIZE 0xD
-
-#define IS31_FRAME_SIZE 0xB4
-
-#define IS31_PWM_REG 0x24
-#define IS31_PWM_SIZE 0x90
-
-#define IS31_LED_MASK_SIZE 0x12
-#define IS31_SCREEN_WIDTH 16
-
-#define IS31
-
-/*===========================================================================*/
-/* Driver local functions. */
-/*===========================================================================*/
-
-typedef struct{
- uint8_t write_buffer_offset;
- uint8_t write_buffer[IS31_FRAME_SIZE];
- uint8_t frame_buffer[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH];
- uint8_t page;
-}__attribute__((__packed__)) PrivData;
-
-// Some common routines and macros
-#define PRIV(g) ((PrivData*)g->priv)
-
-/*===========================================================================*/
-/* Driver exported functions. */
-/*===========================================================================*/
-
-static GFXINLINE void write_page(GDisplay* g, uint8_t page) {
- uint8_t tx[2] __attribute__((aligned(2)));
- tx[0] = IS31_COMMANDREGISTER;
- tx[1] = page;
- write_data(g, tx, 2);
-}
-
-static GFXINLINE void write_register(GDisplay* g, uint8_t page, uint8_t reg, uint8_t data) {
- uint8_t tx[2] __attribute__((aligned(2)));
- tx[0] = reg;
- tx[1] = data;
- write_page(g, page);
- write_data(g, tx, 2);
-}
-
-static GFXINLINE void write_ram(GDisplay *g, uint8_t page, uint16_t offset, uint16_t length) {
- PRIV(g)->write_buffer_offset = offset;
- write_page(g, page);
- write_data(g, (uint8_t*)PRIV(g), length + 1);
-}
-
-LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
- // The private area is the display surface.
- g->priv = gfxAlloc(sizeof(PrivData));
- __builtin_memset(PRIV(g), 0, sizeof(PrivData));
- PRIV(g)->page = 0;
-
- // Initialise the board interface
- init_board(g);
- gfxSleepMilliseconds(10);
-
- // zero function page, all registers (assuming full_page is all zeroes)
- write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
- set_hardware_shutdown(g, false);
- gfxSleepMilliseconds(10);
- // software shutdown
- write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
- gfxSleepMilliseconds(10);
- // zero function page, all registers
- write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
- gfxSleepMilliseconds(10);
-
-
- // zero all LED registers on all 8 pages, and enable the mask
- __builtin_memcpy(PRIV(g)->write_buffer, get_led_mask(g), IS31_LED_MASK_SIZE);
- for(uint8_t i=0; i<8; i++) {
- write_ram(g, i, 0, IS31_FRAME_SIZE);
- gfxSleepMilliseconds(1);
- }
-
- // software shutdown disable (i.e. turn stuff on)
- write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
- gfxSleepMilliseconds(10);
-
- // Finish Init
- post_init_board(g);
-
- /* Initialise the GDISP structure */
- g->g.Width = GDISP_SCREEN_WIDTH;
- g->g.Height = GDISP_SCREEN_HEIGHT;
- g->g.Orientation = GDISP_ROTATE_0;
- g->g.Powermode = powerOff;
- g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
- g->g.Contrast = GDISP_INITIAL_CONTRAST;
- return TRUE;
-}
-
-#if GDISP_HARDWARE_FLUSH
- LLDSPEC void gdisp_lld_flush(GDisplay *g) {
- // Don't flush if we don't need it.
- if (!(g->flags & GDISP_FLG_NEEDFLUSH))
- return;
-
- PRIV(g)->page++;
- PRIV(g)->page %= 2;
- // TODO: some smarter algorithm for this
- // We should run only one physical page at a time
- // This way we don't need to send so much data, and
- // we could use slightly less memory
- uint8_t* src = PRIV(g)->frame_buffer;
- for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) {
- for (int x=0;x<GDISP_SCREEN_WIDTH;x++) {
- uint8_t val = (uint16_t)*src * g->g.Backlight / 100;
- PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val];
- ++src;
- }
- }
- write_ram(g, PRIV(g)->page, IS31_PWM_REG, IS31_PWM_SIZE);
- gfxSleepMilliseconds(1);
- write_register(g, IS31_FUNCTIONREG, IS31_REG_PICTDISP, PRIV(g)->page);
-
- g->flags &= ~GDISP_FLG_NEEDFLUSH;
- }
-#endif
-
-#if GDISP_HARDWARE_DRAWPIXEL
- LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
- coord_t x, y;
-
- switch(g->g.Orientation) {
- default:
- case GDISP_ROTATE_0:
- x = g->p.x;
- y = g->p.y;
- break;
- case GDISP_ROTATE_180:
- x = GDISP_SCREEN_WIDTH-1 - g->p.x;
- y = g->p.y;
- break;
- }
- PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color);
- g->flags |= GDISP_FLG_NEEDFLUSH;
- }
-#endif
-
-#if GDISP_HARDWARE_PIXELREAD
- LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
- coord_t x, y;
-
- switch(g->g.Orientation) {
- default:
- case GDISP_ROTATE_0:
- x = g->p.x;
- y = g->p.y;
- break;
- case GDISP_ROTATE_180:
- x = GDISP_SCREEN_WIDTH-1 - g->p.x;
- y = g->p.y;
- break;
- }
- return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]);
- }
-#endif
-
-#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
- LLDSPEC void gdisp_lld_control(GDisplay *g) {
- switch(g->p.x) {
- case GDISP_CONTROL_POWER:
- if (g->g.Powermode == (powermode_t)g->p.ptr)
- return;
- switch((powermode_t)g->p.ptr) {
- case powerOff:
- case powerSleep:
- case powerDeepSleep:
- write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
- break;
- case powerOn:
- write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON);
- break;
- default:
- return;
- }
- g->g.Powermode = (powermode_t)g->p.ptr;
- return;
-
- case GDISP_CONTROL_ORIENTATION:
- if (g->g.Orientation == (orientation_t)g->p.ptr)
- return;
- switch((orientation_t)g->p.ptr) {
- /* Rotation is handled by the drawing routines */
- case GDISP_ROTATE_0:
- case GDISP_ROTATE_180:
- g->g.Height = GDISP_SCREEN_HEIGHT;
- g->g.Width = GDISP_SCREEN_WIDTH;
- break;
- case GDISP_ROTATE_90:
- case GDISP_ROTATE_270:
- g->g.Height = GDISP_SCREEN_WIDTH;
- g->g.Width = GDISP_SCREEN_HEIGHT;
- break;
- default:
- return;
- }
- g->g.Orientation = (orientation_t)g->p.ptr;
- return;
-
- case GDISP_CONTROL_BACKLIGHT:
- if (g->g.Backlight == (unsigned)g->p.ptr)
- return;
- unsigned val = (unsigned)g->p.ptr;
- g->g.Backlight = val > 100 ? 100 : val;
- g->flags |= GDISP_FLG_NEEDFLUSH;
- return;
- }
- }
-#endif // GDISP_NEED_CONTROL
-
-#endif // GFX_USE_GDISP
diff --git a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h b/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h
deleted file mode 100644
index bb28ad775..000000000
--- a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_lld_config.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-Copyright 2016 Fred Sundvik <fsundvik@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _GDISP_LLD_CONFIG_H
-#define _GDISP_LLD_CONFIG_H
-
-#if GFX_USE_GDISP
-
-/*===========================================================================*/
-/* Driver hardware support. */
-/*===========================================================================*/
-
-#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
-#define GDISP_HARDWARE_DRAWPIXEL TRUE
-#define GDISP_HARDWARE_PIXELREAD TRUE
-#define GDISP_HARDWARE_CONTROL TRUE
-
-#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256
-
-#endif /* GFX_USE_GDISP */
-
-#endif /* _GDISP_LLD_CONFIG_H */
diff --git a/keyboards/whitefox/gfxconf.h b/keyboards/whitefox/gfxconf.h
index 890317a0f..ca338399d 100644
--- a/keyboards/whitefox/gfxconf.h
+++ b/keyboards/whitefox/gfxconf.h
@@ -22,308 +22,6 @@
#ifndef _GFXCONF_H
#define _GFXCONF_H
-
-///////////////////////////////////////////////////////////////////////////
-// GOS - One of these must be defined, preferably in your Makefile //
-///////////////////////////////////////////////////////////////////////////
-//#define GFX_USE_OS_CHIBIOS TRUE
-//#define GFX_USE_OS_FREERTOS FALSE
-// #define GFX_FREERTOS_USE_TRACE FALSE
-//#define GFX_USE_OS_WIN32 FALSE
-//#define GFX_USE_OS_LINUX FALSE
-//#define GFX_USE_OS_OSX FALSE
-//#define GFX_USE_OS_ECOS FALSE
-//#define GFX_USE_OS_RAWRTOS FALSE
-//#define GFX_USE_OS_ARDUINO FALSE
-//#define GFX_USE_OS_KEIL FALSE
-//#define GFX_USE_OS_CMSIS FALSE
-//#define GFX_USE_OS_RAW32 FALSE
-// #define INTERRUPTS_OFF() optional_code
-// #define INTERRUPTS_ON() optional_code
-// These are not defined by default for some reason
-#define GOS_NEED_X_THREADS FALSE
-#define GOS_NEED_X_HEAP FALSE
-
-// Options that (should where relevant) apply to all operating systems
- #define GFX_NO_INLINE FALSE
-// #define GFX_COMPILER GFX_COMPILER_UNKNOWN
-// #define GFX_CPU GFX_CPU_UNKNOWN
-// #define GFX_OS_HEAP_SIZE 0
-// #define GFX_OS_NO_INIT FALSE
-// #define GFX_OS_INIT_NO_WARNING FALSE
-// #define GFX_OS_PRE_INIT_FUNCTION myHardwareInitRoutine
-// #define GFX_OS_EXTRA_INIT_FUNCTION myOSInitRoutine
-// #define GFX_OS_EXTRA_DEINIT_FUNCTION myOSDeInitRoutine
-
-
-///////////////////////////////////////////////////////////////////////////
-// GDISP //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GDISP TRUE
-
-//#define GDISP_NEED_AUTOFLUSH FALSE
-//#define GDISP_NEED_TIMERFLUSH FALSE
-//#define GDISP_NEED_VALIDATION TRUE
-//#define GDISP_NEED_CLIP TRUE
-#define GDISP_NEED_CIRCLE TRUE
-#define GDISP_NEED_ELLIPSE TRUE
-#define GDISP_NEED_ARC TRUE
-#define GDISP_NEED_ARCSECTORS TRUE
-#define GDISP_NEED_CONVEX_POLYGON TRUE
-//#define GDISP_NEED_SCROLL FALSE
-#define GDISP_NEED_PIXELREAD TRUE
-#define GDISP_NEED_CONTROL TRUE
-//#define GDISP_NEED_QUERY FALSE
-//#define GDISP_NEED_MULTITHREAD FALSE
-//#define GDISP_NEED_STREAMING FALSE
-#define GDISP_NEED_TEXT TRUE
-// #define GDISP_NEED_TEXT_WORDWRAP FALSE
-// #define GDISP_NEED_ANTIALIAS FALSE
-// #define GDISP_NEED_UTF8 FALSE
- #define GDISP_NEED_TEXT_KERNING TRUE
-// #define GDISP_INCLUDE_FONT_UI1 FALSE
-// #define GDISP_INCLUDE_FONT_UI2 FALSE // The smallest preferred font.
-// #define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS20 FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE
- #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 TRUE
-// #define GDISP_INCLUDE_FONT_FIXED_10X20 FALSE
-// #define GDISP_INCLUDE_FONT_FIXED_7X14 FALSE
- #define GDISP_INCLUDE_FONT_FIXED_5X8 TRUE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS20_AA FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE
-// #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE
-// #define GDISP_INCLUDE_USER_FONTS FALSE
-
-//#define GDISP_NEED_IMAGE FALSE
-// #define GDISP_NEED_IMAGE_NATIVE FALSE
-// #define GDISP_NEED_IMAGE_GIF FALSE
-// #define GDISP_NEED_IMAGE_BMP FALSE
-// #define GDISP_NEED_IMAGE_BMP_1 FALSE
-// #define GDISP_NEED_IMAGE_BMP_4 FALSE
-// #define GDISP_NEED_IMAGE_BMP_4_RLE FALSE
-// #define GDISP_NEED_IMAGE_BMP_8 FALSE
-// #define GDISP_NEED_IMAGE_BMP_8_RLE FALSE
-// #define GDISP_NEED_IMAGE_BMP_16 FALSE
-// #define GDISP_NEED_IMAGE_BMP_24 FALSE
-// #define GDISP_NEED_IMAGE_BMP_32 FALSE
-// #define GDISP_NEED_IMAGE_JPG FALSE
-// #define GDISP_NEED_IMAGE_PNG FALSE
-// #define GDISP_NEED_IMAGE_ACCOUNTING FALSE
-#ifdef EMULATOR
-#define GDISP_NEED_PIXMAP TRUE
-#endif
-// #define GDISP_NEED_PIXMAP_IMAGE FALSE
-
-//#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE // If not defined the native hardware orientation is used.
-//#define GDISP_LINEBUF_SIZE 128
-//#define GDISP_STARTUP_COLOR Black
-#define GDISP_NEED_STARTUP_LOGO FALSE
-
-//#define GDISP_TOTAL_DISPLAYS 2
-
-#ifndef EMULATOR
-#define GDISP_DRIVER_LIST GDISPVMT_IS31FL3731C_WHITEFOX
-#endif
-
- #ifdef GDISP_DRIVER_LIST
- // For code and speed optimization define as TRUE or FALSE if all controllers have the same capability
- #define GDISP_HARDWARE_STREAM_WRITE FALSE
- #define GDISP_HARDWARE_STREAM_READ FALSE
- #define GDISP_HARDWARE_STREAM_POS FALSE
- #define GDISP_HARDWARE_DRAWPIXEL TRUE
- #define GDISP_HARDWARE_CLEARS FALSE
- #define GDISP_HARDWARE_FILLS FALSE
- //#define GDISP_HARDWARE_BITFILLS FALSE
- #define GDISP_HARDWARE_SCROLL FALSE
- #define GDISP_HARDWARE_PIXELREAD TRUE
- #define GDISP_HARDWARE_CONTROL TRUE
- #define GDISP_HARDWARE_QUERY FALSE
- #define GDISP_HARDWARE_CLIP FALSE
-
- #define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
- #endif
-
-// The custom format is not defined for some reason, so define it as error
-// so we don't get compiler warnings
-#define GDISP_PIXELFORMAT_CUSTOM GDISP_PIXELFORMAT_ERROR
-
-#define GDISP_USE_GFXNET FALSE
-// #define GDISP_GFXNET_PORT 13001
-// #define GDISP_GFXNET_CUSTOM_LWIP_STARTUP FALSE
-// #define GDISP_DONT_WAIT_FOR_NET_DISPLAY FALSE
-// #define GDISP_GFXNET_UNSAFE_SOCKETS FALSE
-
-
-///////////////////////////////////////////////////////////////////////////
-// GWIN //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GWIN FALSE
-
-//#define GWIN_NEED_WINDOWMANAGER FALSE
-// #define GWIN_REDRAW_IMMEDIATE FALSE
-// #define GWIN_REDRAW_SINGLEOP FALSE
-// #define GWIN_NEED_FLASHING FALSE
-// #define GWIN_FLASHING_PERIOD 250
-
-//#define GWIN_NEED_CONSOLE FALSE
-// #define GWIN_CONSOLE_USE_HISTORY FALSE
-// #define GWIN_CONSOLE_HISTORY_AVERAGING FALSE
-// #define GWIN_CONSOLE_HISTORY_ATCREATE FALSE
-// #define GWIN_CONSOLE_ESCSEQ FALSE
-// #define GWIN_CONSOLE_USE_BASESTREAM FALSE
-// #define GWIN_CONSOLE_USE_FLOAT FALSE
-//#define GWIN_NEED_GRAPH FALSE
-//#define GWIN_NEED_GL3D FALSE
-
-//#define GWIN_NEED_WIDGET FALSE
-//#define GWIN_FOCUS_HIGHLIGHT_WIDTH 1
-// #define GWIN_NEED_LABEL FALSE
-// #define GWIN_LABEL_ATTRIBUTE FALSE
-// #define GWIN_NEED_BUTTON FALSE
-// #define GWIN_BUTTON_LAZY_RELEASE FALSE
-// #define GWIN_NEED_SLIDER FALSE
-// #define GWIN_SLIDER_NOSNAP FALSE
-// #define GWIN_SLIDER_DEAD_BAND 5
-// #define GWIN_SLIDER_TOGGLE_INC 20
-// #define GWIN_NEED_CHECKBOX FALSE
-// #define GWIN_NEED_IMAGE FALSE
-// #define GWIN_NEED_IMAGE_ANIMATION FALSE
-// #define GWIN_NEED_RADIO FALSE
-// #define GWIN_NEED_LIST FALSE
-// #define GWIN_NEED_LIST_IMAGES FALSE
-// #define GWIN_NEED_PROGRESSBAR FALSE
-// #define GWIN_PROGRESSBAR_AUTO FALSE
-// #define GWIN_NEED_KEYBOARD FALSE
-// #define GWIN_KEYBOARD_DEFAULT_LAYOUT VirtualKeyboard_English1
-// #define GWIN_NEED_KEYBOARD_ENGLISH1 TRUE
-// #define GWIN_NEED_TEXTEDIT FALSE
-// #define GWIN_FLAT_STYLING FALSE
-// #define GWIN_WIDGET_TAGS FALSE
-
-//#define GWIN_NEED_CONTAINERS FALSE
-// #define GWIN_NEED_CONTAINER FALSE
-// #define GWIN_NEED_FRAME FALSE
-// #define GWIN_NEED_TABSET FALSE
-// #define GWIN_TABSET_TABHEIGHT 18
-
-
-///////////////////////////////////////////////////////////////////////////
-// GEVENT //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GEVENT TRUE
-
-//#define GEVENT_ASSERT_NO_RESOURCE FALSE
-//#define GEVENT_MAXIMUM_SIZE 32
-//#define GEVENT_MAX_SOURCE_LISTENERS 32
-
-
-///////////////////////////////////////////////////////////////////////////
-// GTIMER //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GTIMER FALSE
-
-//#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY
-//#define GTIMER_THREAD_WORKAREA_SIZE 2048
-
-
-///////////////////////////////////////////////////////////////////////////
-// GQUEUE //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GQUEUE FALSE
-
-//#define GQUEUE_NEED_ASYNC FALSE
-//#define GQUEUE_NEED_GSYNC FALSE
-//#define GQUEUE_NEED_FSYNC FALSE
-//#define GQUEUE_NEED_BUFFERS FALSE
-
-///////////////////////////////////////////////////////////////////////////
-// GINPUT //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GINPUT FALSE
-
-//#define GINPUT_NEED_MOUSE FALSE
-// #define GINPUT_TOUCH_STARTRAW FALSE
-// #define GINPUT_TOUCH_NOTOUCH FALSE
-// #define GINPUT_TOUCH_NOCALIBRATE FALSE
-// #define GINPUT_TOUCH_NOCALIBRATE_GUI FALSE
-// #define GINPUT_MOUSE_POLL_PERIOD 25
-// #define GINPUT_MOUSE_CLICK_TIME 300
-// #define GINPUT_TOUCH_CXTCLICK_TIME 700
-// #define GINPUT_TOUCH_USER_CALIBRATION_LOAD FALSE
-// #define GINPUT_TOUCH_USER_CALIBRATION_SAVE FALSE
-// #define GMOUSE_DRIVER_LIST GMOUSEVMT_Win32, GMOUSEVMT_Win32
-//#define GINPUT_NEED_KEYBOARD FALSE
-// #define GINPUT_KEYBOARD_POLL_PERIOD 200
-// #define GKEYBOARD_DRIVER_LIST GKEYBOARDVMT_Win32, GKEYBOARDVMT_Win32
-// #define GKEYBOARD_LAYOUT_OFF FALSE
-// #define GKEYBOARD_LAYOUT_SCANCODE2_US FALSE
-//#define GINPUT_NEED_TOGGLE FALSE
-//#define GINPUT_NEED_DIAL FALSE
-
-
-///////////////////////////////////////////////////////////////////////////
-// GFILE //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GFILE FALSE
-
-//#define GFILE_NEED_PRINTG FALSE
-//#define GFILE_NEED_SCANG FALSE
-//#define GFILE_NEED_STRINGS FALSE
-//#define GFILE_NEED_FILELISTS FALSE
-//#define GFILE_NEED_STDIO FALSE
-//#define GFILE_NEED_NOAUTOMOUNT FALSE
-//#define GFILE_NEED_NOAUTOSYNC FALSE
-
-//#define GFILE_NEED_MEMFS FALSE
-//#define GFILE_NEED_ROMFS FALSE
-//#define GFILE_NEED_RAMFS FALSE
-//#define GFILE_NEED_FATFS FALSE
-//#define GFILE_NEED_NATIVEFS FALSE
-//#define GFILE_NEED_CHBIOSFS FALSE
-
-//#define GFILE_ALLOW_FLOATS FALSE
-//#define GFILE_ALLOW_DEVICESPECIFIC FALSE
-//#define GFILE_MAX_GFILES 3
-
-///////////////////////////////////////////////////////////////////////////
-// GADC //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GADC FALSE
-
-//#define GADC_MAX_LOWSPEED_DEVICES 4
-
-
-///////////////////////////////////////////////////////////////////////////
-// GAUDIO //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GAUDIO FALSE
-// There seems to be a bug in the ugfx code, the wrong define is used
-// So define it in order to avoid warnings
-#define GFX_USE_GAUDIN GFX_USE_GAUDIO
-// #define GAUDIO_NEED_PLAY FALSE
-// #define GAUDIO_NEED_RECORD FALSE
-
-
-///////////////////////////////////////////////////////////////////////////
-// GMISC //
-///////////////////////////////////////////////////////////////////////////
-#define GFX_USE_GMISC TRUE
-
-//#define GMISC_NEED_ARRAYOPS FALSE
-//#define GMISC_NEED_FASTTRIG FALSE
-//#define GMISC_NEED_FIXEDTRIG FALSE
-//#define GMISC_NEED_INVSQRT FALSE
-// #define GMISC_INVSQRT_MIXED_ENDIAN FALSE
-// #define GMISC_INVSQRT_REAL_SLOW FALSE
-#define GMISC_NEED_MATRIXFLOAT2D TRUE
-#define GMISC_NEED_MATRIXFIXED2D FALSE
+#include "common_gfxconf.h"
#endif /* _GFXCONF_H */
diff --git a/keyboards/whitefox/rules.mk b/keyboards/whitefox/rules.mk
index fb34dbb9a..32273e08a 100644
--- a/keyboards/whitefox/rules.mk
+++ b/keyboards/whitefox/rules.mk
@@ -1,7 +1,6 @@
# project specific files
SRC = matrix.c \
- led.c \
- animations.c
+ led.c
## chip/board settings
# - the next two should match the directories in
@@ -70,4 +69,6 @@ CUSTOM_MATRIX = yes # Custom matrix file
BACKLIGHT_ENABLE = yes
VISUALIZER_ENABLE = yes
-include $(KEYBOARD_PATH)/drivers/gdisp/IS31FL3731C/driver.mk
+LED_DRIVER = is31fl3731c
+LED_WIDTH = 16
+LED_HEIGHT = 5 \ No newline at end of file
diff --git a/keyboards/whitefox/visualizer.c b/keyboards/whitefox/visualizer.c
index 167e0ec4d..e5bafcbe9 100644
--- a/keyboards/whitefox/visualizer.c
+++ b/keyboards/whitefox/visualizer.c
@@ -20,7 +20,7 @@
#include "visualizer.h"
#include "visualizer_keyframes.h"
#include "led.h"
-#include "animations.h"
+#include "default_animations.h"
static bool initial_update = true;
diff --git a/quantum/visualizer/lcd_backlight_keyframes.h b/lcd_backlight_keyframes.h
index e1c125cf9..bde118449 100644
--- a/quantum/visualizer/lcd_backlight_keyframes.h
+++ b/lcd_backlight_keyframes.h
@@ -20,11 +20,11 @@
#include "visualizer.h"
// Animates the LCD backlight color between the current color and the target color (of the state)
-bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state);
+bool lcd_backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state);
// Sets the backlight color to the target color
-bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state);
+bool lcd_backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state);
-bool backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
-bool backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
+bool lcd_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
+bool lcd_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
#endif /* QUANTUM_VISUALIZER_LCD_BACKLIGHT_KEYFRAMES_H_ */
diff --git a/lib/lufa/Bootloaders/MassStorage/BootloaderAPITable.S b/lib/lufa/Bootloaders/MassStorage/BootloaderAPITable.S
index 30165700d..44eb15ea9 100644
--- a/lib/lufa/Bootloaders/MassStorage/BootloaderAPITable.S
+++ b/lib/lufa/Bootloaders/MassStorage/BootloaderAPITable.S
@@ -1,102 +1,102 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2017.
-
- dean [at] fourwalledcubicle [dot] com
- www.lufa-lib.org
-*/
-
-/*
- Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaims all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-#if AUX_BOOT_SECTION_SIZE > 0
-#warning Using a AUX bootloader section in addition to the defined bootloader space (see documentation).
-
-; Trampoline to jump over the AUX bootloader section to the start of the bootloader,
-; on devices where an AUX bootloader section is used.
-.section .boot_aux_trampoline, "ax"
-.global Boot_AUX_Trampoline
-Boot_AUX_Trampoline:
- jmp BOOT_START_ADDR
-#endif
-
-; Trampolines to actual API implementations if the target address is outside the
-; range of a rjmp instruction (can happen with large bootloader sections)
-.section .apitable_trampolines, "ax"
-.global BootloaderAPI_Trampolines
-BootloaderAPI_Trampolines:
-
- BootloaderAPI_ErasePage_Trampoline:
- jmp BootloaderAPI_ErasePage
- BootloaderAPI_WritePage_Trampoline:
- jmp BootloaderAPI_WritePage
- BootloaderAPI_FillWord_Trampoline:
- jmp BootloaderAPI_FillWord
- BootloaderAPI_ReadSignature_Trampoline:
- jmp BootloaderAPI_ReadSignature
- BootloaderAPI_ReadFuse_Trampoline:
- jmp BootloaderAPI_ReadFuse
- BootloaderAPI_ReadLock_Trampoline:
- jmp BootloaderAPI_ReadLock
- BootloaderAPI_WriteLock_Trampoline:
- jmp BootloaderAPI_WriteLock
- BootloaderAPI_UNUSED1:
- ret
- BootloaderAPI_UNUSED2:
- ret
- BootloaderAPI_UNUSED3:
- ret
- BootloaderAPI_UNUSED4:
- ret
- BootloaderAPI_UNUSED5:
- ret
-
-
-
-; API function jump table
-.section .apitable_jumptable, "ax"
-.global BootloaderAPI_JumpTable
-BootloaderAPI_JumpTable:
-
- rjmp BootloaderAPI_ErasePage_Trampoline
- rjmp BootloaderAPI_WritePage_Trampoline
- rjmp BootloaderAPI_FillWord_Trampoline
- rjmp BootloaderAPI_ReadSignature_Trampoline
- rjmp BootloaderAPI_ReadFuse_Trampoline
- rjmp BootloaderAPI_ReadLock_Trampoline
- rjmp BootloaderAPI_WriteLock_Trampoline
- rjmp BootloaderAPI_UNUSED1 ; UNUSED ENTRY 1
- rjmp BootloaderAPI_UNUSED2 ; UNUSED ENTRY 2
- rjmp BootloaderAPI_UNUSED3 ; UNUSED ENTRY 3
- rjmp BootloaderAPI_UNUSED4 ; UNUSED ENTRY 4
- rjmp BootloaderAPI_UNUSED5 ; UNUSED ENTRY 5
-
-
-
-; Bootloader table signatures and information
-.section .apitable_signatures, "ax"
-.global BootloaderAPI_Signatures
-BootloaderAPI_Signatures:
-
- .long BOOT_START_ADDR ; Start address of the bootloader
- .word 0xDF30 ; Signature for the MS class bootloader, V1
- .word 0xDCFB ; Signature for a LUFA class bootloader
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2017.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaims all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#if AUX_BOOT_SECTION_SIZE > 0
+#warning Using a AUX bootloader section in addition to the defined bootloader space (see documentation).
+
+; Trampoline to jump over the AUX bootloader section to the start of the bootloader,
+; on devices where an AUX bootloader section is used.
+.section .boot_aux_trampoline, "ax"
+.global Boot_AUX_Trampoline
+Boot_AUX_Trampoline:
+ jmp BOOT_START_ADDR
+#endif
+
+; Trampolines to actual API implementations if the target address is outside the
+; range of a rjmp instruction (can happen with large bootloader sections)
+.section .apitable_trampolines, "ax"
+.global BootloaderAPI_Trampolines
+BootloaderAPI_Trampolines:
+
+ BootloaderAPI_ErasePage_Trampoline:
+ jmp BootloaderAPI_ErasePage
+ BootloaderAPI_WritePage_Trampoline:
+ jmp BootloaderAPI_WritePage
+ BootloaderAPI_FillWord_Trampoline:
+ jmp BootloaderAPI_FillWord
+ BootloaderAPI_ReadSignature_Trampoline:
+ jmp BootloaderAPI_ReadSignature
+ BootloaderAPI_ReadFuse_Trampoline:
+ jmp BootloaderAPI_ReadFuse
+ BootloaderAPI_ReadLock_Trampoline:
+ jmp BootloaderAPI_ReadLock
+ BootloaderAPI_WriteLock_Trampoline:
+ jmp BootloaderAPI_WriteLock
+ BootloaderAPI_UNUSED1:
+ ret
+ BootloaderAPI_UNUSED2:
+ ret
+ BootloaderAPI_UNUSED3:
+ ret
+ BootloaderAPI_UNUSED4:
+ ret
+ BootloaderAPI_UNUSED5:
+ ret
+
+
+
+; API function jump table
+.section .apitable_jumptable, "ax"
+.global BootloaderAPI_JumpTable
+BootloaderAPI_JumpTable:
+
+ rjmp BootloaderAPI_ErasePage_Trampoline
+ rjmp BootloaderAPI_WritePage_Trampoline
+ rjmp BootloaderAPI_FillWord_Trampoline
+ rjmp BootloaderAPI_ReadSignature_Trampoline
+ rjmp BootloaderAPI_ReadFuse_Trampoline
+ rjmp BootloaderAPI_ReadLock_Trampoline
+ rjmp BootloaderAPI_WriteLock_Trampoline
+ rjmp BootloaderAPI_UNUSED1 ; UNUSED ENTRY 1
+ rjmp BootloaderAPI_UNUSED2 ; UNUSED ENTRY 2
+ rjmp BootloaderAPI_UNUSED3 ; UNUSED ENTRY 3
+ rjmp BootloaderAPI_UNUSED4 ; UNUSED ENTRY 4
+ rjmp BootloaderAPI_UNUSED5 ; UNUSED ENTRY 5
+
+
+
+; Bootloader table signatures and information
+.section .apitable_signatures, "ax"
+.global BootloaderAPI_Signatures
+BootloaderAPI_Signatures:
+
+ .long BOOT_START_ADDR ; Start address of the bootloader
+ .word 0xDF30 ; Signature for the MS class bootloader, V1
+ .word 0xDCFB ; Signature for a LUFA class bootloader
diff --git a/lib/lufa/Bootloaders/MassStorage/makefile b/lib/lufa/Bootloaders/MassStorage/makefile
index 7f0ec82a7..f3948e754 100644
--- a/lib/lufa/Bootloaders/MassStorage/makefile
+++ b/lib/lufa/Bootloaders/MassStorage/makefile
@@ -1,75 +1,75 @@
-#
-# LUFA Library
-# Copyright (C) Dean Camera, 2017.
-#
-# dean [at] fourwalledcubicle [dot] com
-# www.lufa-lib.org
-#
-# --------------------------------------
-# LUFA Project Makefile.
-# --------------------------------------
-
-# Run "make help" for target help.
-
-MCU = at90usb1287
-ARCH = AVR8
-BOARD = USBKEY
-F_CPU = 8000000
-F_USB = $(F_CPU)
-OPTIMIZATION = s
-TARGET = BootloaderMassStorage
-SRC = $(TARGET).c Descriptors.c BootloaderAPI.c BootloaderAPITable.S Lib/SCSI.c Lib/VirtualFAT.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)
-LUFA_PATH = ../../LUFA
-CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=$(BOOT_START_OFFSET)
-LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET) $(BOOT_API_LD_FLAGS)
-
-# Flash size and bootloader section sizes of the target, in KB. These must
-# match the target's total FLASH size and the bootloader size set in the
-# device's fuses.
-FLASH_SIZE_KB = 128
-BOOT_SECTION_SIZE_KB = 8
-
-# Bootloader address calculation formulas
-# Do not modify these macros, but rather modify the dependent values above.
-CALC_ADDRESS_IN_HEX = $(shell printf "0x%X" $$(( $(1) )) )
-BOOT_START_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024 )
-BOOT_SEC_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) * 1024) - ($(strip $(1))) )
-
-# Bootloader linker section flags for relocating the API table sections to
-# known FLASH addresses - these should not normally be user-edited.
-BOOT_SECTION_LD_FLAG = -Wl,--section-start=$(strip $(1))=$(call BOOT_SEC_OFFSET, $(3)) -Wl,--undefined=$(strip $(2))
-BOOT_API_LD_FLAGS = $(call BOOT_SECTION_LD_FLAG, .apitable_trampolines, BootloaderAPI_Trampolines, 96)
-BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_jumptable, BootloaderAPI_JumpTable, 32)
-BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_signatures, BootloaderAPI_Signatures, 8)
-
-# Check if the bootloader needs an AUX section, located before the real bootloader section to store some of the
-# bootloader code. This is required for 32KB and smaller devices, where the actual bootloader is 6KB but the maximum
-# bootloader section size is 4KB. The actual usable application space will be reduced by 6KB for these devices.
-ifeq ($(BOOT_SECTION_SIZE_KB),8)
- CC_FLAGS += -DAUX_BOOT_SECTION_SIZE=0
-else
- AUX_BOOT_SECTION_SIZE_KB = (6 - $(BOOT_SECTION_SIZE_KB))
-
- CC_FLAGS += -DAUX_BOOT_SECTION_SIZE='($(AUX_BOOT_SECTION_SIZE_KB) * 1024)'
- LD_FLAGS += -Wl,--section-start=.boot_aux=$(call BOOT_SEC_OFFSET, (($(BOOT_SECTION_SIZE_KB) + $(AUX_BOOT_SECTION_SIZE_KB)) * 1024 - 16))
- LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .boot_aux_trampoline, Boot_AUX_Trampoline, ($(BOOT_SECTION_SIZE_KB) + $(AUX_BOOT_SECTION_SIZE_KB)) * 1024)
-endif
-
-# Default target
-all:
-
-# Include LUFA-specific DMBS extension modules
-DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA
-include $(DMBS_LUFA_PATH)/lufa-sources.mk
-include $(DMBS_LUFA_PATH)/lufa-gcc.mk
-
-# Include common DMBS build system modules
-DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
-include $(DMBS_PATH)/core.mk
-include $(DMBS_PATH)/cppcheck.mk
-include $(DMBS_PATH)/doxygen.mk
-include $(DMBS_PATH)/dfu.mk
-include $(DMBS_PATH)/gcc.mk
-include $(DMBS_PATH)/hid.mk
-include $(DMBS_PATH)/avrdude.mk
-include $(DMBS_PATH)/atprogram.mk
+#
+# LUFA Library
+# Copyright (C) Dean Camera, 2017.
+#
+# dean [at] fourwalledcubicle [dot] com
+# www.lufa-lib.org
+#
+# --------------------------------------
+# LUFA Project Makefile.
+# --------------------------------------
+
+# Run "make help" for target help.
+
+MCU = at90usb1287
+ARCH = AVR8
+BOARD = USBKEY
+F_CPU = 8000000
+F_USB = $(F_CPU)
+OPTIMIZATION = s
+TARGET = BootloaderMassStorage
+SRC = $(TARGET).c Descriptors.c BootloaderAPI.c BootloaderAPITable.S Lib/SCSI.c Lib/VirtualFAT.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)
+LUFA_PATH = ../../LUFA
+CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=$(BOOT_START_OFFSET)
+LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET) $(BOOT_API_LD_FLAGS)
+
+# Flash size and bootloader section sizes of the target, in KB. These must
+# match the target's total FLASH size and the bootloader size set in the
+# device's fuses.
+FLASH_SIZE_KB = 128
+BOOT_SECTION_SIZE_KB = 8
+
+# Bootloader address calculation formulas
+# Do not modify these macros, but rather modify the dependent values above.
+CALC_ADDRESS_IN_HEX = $(shell printf "0x%X" $$(( $(1) )) )
+BOOT_START_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024 )
+BOOT_SEC_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) * 1024) - ($(strip $(1))) )
+
+# Bootloader linker section flags for relocating the API table sections to
+# known FLASH addresses - these should not normally be user-edited.
+BOOT_SECTION_LD_FLAG = -Wl,--section-start=$(strip $(1))=$(call BOOT_SEC_OFFSET, $(3)) -Wl,--undefined=$(strip $(2))
+BOOT_API_LD_FLAGS = $(call BOOT_SECTION_LD_FLAG, .apitable_trampolines, BootloaderAPI_Trampolines, 96)
+BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_jumptable, BootloaderAPI_JumpTable, 32)
+BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_signatures, BootloaderAPI_Signatures, 8)
+
+# Check if the bootloader needs an AUX section, located before the real bootloader section to store some of the
+# bootloader code. This is required for 32KB and smaller devices, where the actual bootloader is 6KB but the maximum
+# bootloader section size is 4KB. The actual usable application space will be reduced by 6KB for these devices.
+ifeq ($(BOOT_SECTION_SIZE_KB),8)
+ CC_FLAGS += -DAUX_BOOT_SECTION_SIZE=0
+else
+ AUX_BOOT_SECTION_SIZE_KB = (6 - $(BOOT_SECTION_SIZE_KB))
+
+ CC_FLAGS += -DAUX_BOOT_SECTION_SIZE='($(AUX_BOOT_SECTION_SIZE_KB) * 1024)'
+ LD_FLAGS += -Wl,--section-start=.boot_aux=$(call BOOT_SEC_OFFSET, (($(BOOT_SECTION_SIZE_KB) + $(AUX_BOOT_SECTION_SIZE_KB)) * 1024 - 16))
+ LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .boot_aux_trampoline, Boot_AUX_Trampoline, ($(BOOT_SECTION_SIZE_KB) + $(AUX_BOOT_SECTION_SIZE_KB)) * 1024)
+endif
+
+# Default target
+all:
+
+# Include LUFA-specific DMBS extension modules
+DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA
+include $(DMBS_LUFA_PATH)/lufa-sources.mk
+include $(DMBS_LUFA_PATH)/lufa-gcc.mk
+
+# Include common DMBS build system modules
+DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
+include $(DMBS_PATH)/core.mk
+include $(DMBS_PATH)/cppcheck.mk
+include $(DMBS_PATH)/doxygen.mk
+include $(DMBS_PATH)/dfu.mk
+include $(DMBS_PATH)/gcc.mk
+include $(DMBS_PATH)/hid.mk
+include $(DMBS_PATH)/avrdude.mk
+include $(DMBS_PATH)/atprogram.mk
diff --git a/lib/lufa/Bootloaders/Printer/BootloaderAPITable.S b/lib/lufa/Bootloaders/Printer/BootloaderAPITable.S
index 76f37bf49..d8358c31c 100644
--- a/lib/lufa/Bootloaders/Printer/BootloaderAPITable.S
+++ b/lib/lufa/Bootloaders/Printer/BootloaderAPITable.S
@@ -1,91 +1,91 @@
-/*
- LUFA Library
- Copyright (C) Dean Camera, 2017.
-
- dean [at] fourwalledcubicle [dot] com
- www.lufa-lib.org
-*/
-
-/*
- Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaims all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-; Trampolines to actual API implementations if the target address is outside the
-; range of a rjmp instruction (can happen with large bootloader sections)
-.section .apitable_trampolines, "ax"
-.global BootloaderAPI_Trampolines
-BootloaderAPI_Trampolines:
-
- BootloaderAPI_ErasePage_Trampoline:
- jmp BootloaderAPI_ErasePage
- BootloaderAPI_WritePage_Trampoline:
- jmp BootloaderAPI_WritePage
- BootloaderAPI_FillWord_Trampoline:
- jmp BootloaderAPI_FillWord
- BootloaderAPI_ReadSignature_Trampoline:
- jmp BootloaderAPI_ReadSignature
- BootloaderAPI_ReadFuse_Trampoline:
- jmp BootloaderAPI_ReadFuse
- BootloaderAPI_ReadLock_Trampoline:
- jmp BootloaderAPI_ReadLock
- BootloaderAPI_WriteLock_Trampoline:
- jmp BootloaderAPI_WriteLock
- BootloaderAPI_UNUSED1:
- ret
- BootloaderAPI_UNUSED2:
- ret
- BootloaderAPI_UNUSED3:
- ret
- BootloaderAPI_UNUSED4:
- ret
- BootloaderAPI_UNUSED5:
- ret
-
-
-
-; API function jump table
-.section .apitable_jumptable, "ax"
-.global BootloaderAPI_JumpTable
-BootloaderAPI_JumpTable:
-
- rjmp BootloaderAPI_ErasePage_Trampoline
- rjmp BootloaderAPI_WritePage_Trampoline
- rjmp BootloaderAPI_FillWord_Trampoline
- rjmp BootloaderAPI_ReadSignature_Trampoline
- rjmp BootloaderAPI_ReadFuse_Trampoline
- rjmp BootloaderAPI_ReadLock_Trampoline
- rjmp BootloaderAPI_WriteLock_Trampoline
- rjmp BootloaderAPI_UNUSED1 ; UNUSED ENTRY 1
- rjmp BootloaderAPI_UNUSED2 ; UNUSED ENTRY 2
- rjmp BootloaderAPI_UNUSED3 ; UNUSED ENTRY 3
- rjmp BootloaderAPI_UNUSED4 ; UNUSED ENTRY 4
- rjmp BootloaderAPI_UNUSED5 ; UNUSED ENTRY 5
-
-
-
-; Bootloader table signatures and information
-.section .apitable_signatures, "ax"
-.global BootloaderAPI_Signatures
-BootloaderAPI_Signatures:
-
- .long BOOT_START_ADDR ; Start address of the bootloader
- .word 0xDF20 ; Signature for the Printer class bootloader
- .word 0xDCFB ; Signature for a LUFA class bootloader
+/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2017.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that the above copyright notice appear in
+ all copies and that both that the copyright notice and this
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
+ software without specific, written prior permission.
+
+ The author disclaims all warranties with regard to this
+ software, including all implied warranties of merchantability
+ and fitness. In no event shall the author be liable for any
+ special, indirect or consequential damages or any damages
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+; Trampolines to actual API implementations if the target address is outside the
+; range of a rjmp instruction (can happen with large bootloader sections)
+.section .apitable_trampolines, "ax"
+.global BootloaderAPI_Trampolines
+BootloaderAPI_Trampolines:
+
+ BootloaderAPI_ErasePage_Trampoline:
+ jmp BootloaderAPI_ErasePage
+ BootloaderAPI_WritePage_Trampoline:
+ jmp BootloaderAPI_WritePage
+ BootloaderAPI_FillWord_Trampoline:
+ jmp BootloaderAPI_FillWord
+ BootloaderAPI_ReadSignature_Trampoline:
+ jmp BootloaderAPI_ReadSignature
+ BootloaderAPI_ReadFuse_Trampoline:
+ jmp BootloaderAPI_ReadFuse
+ BootloaderAPI_ReadLock_Trampoline:
+ jmp BootloaderAPI_ReadLock
+ BootloaderAPI_WriteLock_Trampoline:
+ jmp BootloaderAPI_WriteLock
+ BootloaderAPI_UNUSED1:
+ ret
+ BootloaderAPI_UNUSED2:
+ ret
+ BootloaderAPI_UNUSED3:
+ ret
+ BootloaderAPI_UNUSED4:
+ ret
+ BootloaderAPI_UNUSED5:
+ ret
+
+
+
+; API function jump table
+.section .apitable_jumptable, "ax"
+.global BootloaderAPI_JumpTable
+BootloaderAPI_JumpTable:
+
+ rjmp BootloaderAPI_ErasePage_Trampoline
+ rjmp BootloaderAPI_WritePage_Trampoline
+ rjmp BootloaderAPI_FillWord_Trampoline
+ rjmp BootloaderAPI_ReadSignature_Trampoline
+ rjmp BootloaderAPI_ReadFuse_Trampoline
+ rjmp BootloaderAPI_ReadLock_Trampoline
+ rjmp BootloaderAPI_WriteLock_Trampoline
+ rjmp BootloaderAPI_UNUSED1 ; UNUSED ENTRY 1
+ rjmp BootloaderAPI_UNUSED2 ; UNUSED ENTRY 2
+ rjmp BootloaderAPI_UNUSED3 ; UNUSED ENTRY 3
+ rjmp BootloaderAPI_UNUSED4 ; UNUSED ENTRY 4
+ rjmp BootloaderAPI_UNUSED5 ; UNUSED ENTRY 5
+
+
+
+; Bootloader table signatures and information
+.section .apitable_signatures, "ax"
+.global BootloaderAPI_Signatures
+BootloaderAPI_Signatures:
+
+ .long BOOT_START_ADDR ; Start address of the bootloader
+ .word 0xDF20 ; Signature for the Printer class bootloader
+ .word 0xDCFB ; Signature for a LUFA class bootloader
diff --git a/lib/lufa/Bootloaders/Printer/makefile b/lib/lufa/Bootloaders/Printer/makefile
index 2c8582ca2..1de35bba0 100644
--- a/lib/lufa/Bootloaders/Printer/makefile
+++ b/lib/lufa/Bootloaders/Printer/makefile
@@ -1,62 +1,62 @@
-#
-# LUFA Library
-# Copyright (C) Dean Camera, 2017.
-#
-# dean [at] fourwalledcubicle [dot] com
-# www.lufa-lib.org
-#
-# --------------------------------------
-# LUFA Project Makefile.
-# --------------------------------------
-
-# Run "make help" for target help.
-
-MCU = at90usb1287
-ARCH = AVR8
-BOARD = USBKEY
-F_CPU = 8000000
-F_USB = $(F_CPU)
-OPTIMIZATION = s
-TARGET = BootloaderPrinter
-SRC = $(TARGET).c Descriptors.c BootloaderAPI.c BootloaderAPITable.S $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)
-LUFA_PATH = ../../LUFA
-CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=$(BOOT_START_OFFSET)
-LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET) $(BOOT_API_LD_FLAGS)
-
-# Flash size and bootloader section sizes of the target, in KB. These must
-# match the target's total FLASH size and the bootloader size set in the
-# device's fuses.
-FLASH_SIZE_KB = 128
-BOOT_SECTION_SIZE_KB = 8
-
-# Bootloader address calculation formulas
-# Do not modify these macros, but rather modify the dependent values above.
-CALC_ADDRESS_IN_HEX = $(shell printf "0x%X" $$(( $(1) )) )
-BOOT_START_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024 )
-BOOT_SEC_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) * 1024) - ($(strip $(1))) )
-
-# Bootloader linker section flags for relocating the API table sections to
-# known FLASH addresses - these should not normally be user-edited.
-BOOT_SECTION_LD_FLAG = -Wl,--section-start=$(strip $(1))=$(call BOOT_SEC_OFFSET, $(3)) -Wl,--undefined=$(strip $(2))
-BOOT_API_LD_FLAGS = $(call BOOT_SECTION_LD_FLAG, .apitable_trampolines, BootloaderAPI_Trampolines, 96)
-BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_jumptable, BootloaderAPI_JumpTable, 32)
-BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_signatures, BootloaderAPI_Signatures, 8)
-
-# Default target
-all:
-
-# Include LUFA-specific DMBS extension modules
-DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA
-include $(DMBS_LUFA_PATH)/lufa-sources.mk
-include $(DMBS_LUFA_PATH)/lufa-gcc.mk
-
-# Include common DMBS build system modules
-DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
-include $(DMBS_PATH)/core.mk
-include $(DMBS_PATH)/cppcheck.mk
-include $(DMBS_PATH)/doxygen.mk
-include $(DMBS_PATH)/dfu.mk
-include $(DMBS_PATH)/gcc.mk
-include $(DMBS_PATH)/hid.mk
-include $(DMBS_PATH)/avrdude.mk
-include $(DMBS_PATH)/atprogram.mk
+#
+# LUFA Library
+# Copyright (C) Dean Camera, 2017.
+#
+# dean [at] fourwalledcubicle [dot] com
+# www.lufa-lib.org
+#
+# --------------------------------------
+# LUFA Project Makefile.
+# --------------------------------------
+
+# Run "make help" for target help.
+
+MCU = at90usb1287
+ARCH = AVR8
+BOARD = USBKEY
+F_CPU = 8000000
+F_USB = $(F_CPU)
+OPTIMIZATION = s
+TARGET = BootloaderPrinter
+SRC = $(TARGET).c Descriptors.c BootloaderAPI.c BootloaderAPITable.S $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)
+LUFA_PATH = ../../LUFA
+CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=$(BOOT_START_OFFSET)
+LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET) $(BOOT_API_LD_FLAGS)
+
+# Flash size and bootloader section sizes of the target, in KB. These must
+# match the target's total FLASH size and the bootloader size set in the
+# device's fuses.
+FLASH_SIZE_KB = 128
+BOOT_SECTION_SIZE_KB = 8
+
+# Bootloader address calculation formulas
+# Do not modify these macros, but rather modify the dependent values above.
+CALC_ADDRESS_IN_HEX = $(shell printf "0x%X" $$(( $(1) )) )
+BOOT_START_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024 )
+BOOT_SEC_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) * 1024) - ($(strip $(1))) )
+
+# Bootloader linker section flags for relocating the API table sections to
+# known FLASH addresses - these should not normally be user-edited.
+BOOT_SECTION_LD_FLAG = -Wl,--section-start=$(strip $(1))=$(call BOOT_SEC_OFFSET, $(3)) -Wl,--undefined=$(strip $(2))
+BOOT_API_LD_FLAGS = $(call BOOT_SECTION_LD_FLAG, .apitable_trampolines, BootloaderAPI_Trampolines, 96)
+BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_jumptable, BootloaderAPI_JumpTable, 32)
+BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_signatures, BootloaderAPI_Signatures, 8)
+
+# Default target
+all:
+
+# Include LUFA-specific DMBS extension modules
+DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA
+include $(DMBS_LUFA_PATH)/lufa-sources.mk
+include $(DMBS_LUFA_PATH)/lufa-gcc.mk
+
+# Include common DMBS build system modules
+DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS
+include $(DMBS_PATH)/core.mk
+include $(DMBS_PATH)/cppcheck.mk
+include $(DMBS_PATH)/doxygen.mk
+include $(DMBS_PATH)/dfu.mk
+include $(DMBS_PATH)/gcc.mk
+include $(DMBS_PATH)/hid.mk
+include $(DMBS_PATH)/avrdude.mk
+include $(DMBS_PATH)/atprogram.mk
diff --git a/lib/lufa/LUFA/StudioIntegration/HV1/lufa_hv1_transform.xslt b/lib/lufa/LUFA/StudioIntegration/HV1/lufa_hv1_transform.xslt
index e7e230166..e7b57ab64 100644
--- a/lib/lufa/LUFA/StudioIntegration/HV1/lufa_hv1_transform.xslt
+++ b/lib/lufa/LUFA/StudioIntegration/HV1/lufa_hv1_transform.xslt
@@ -1,45 +1,45 @@
-<!--
- LUFA Library
- Copyright (C) Dean Camera, 2017.
-
- dean [at] fourwalledcubicle [dot] com
- www.lufa-lib.org
--->
-
-<!-- Docbook XML to Microsoft Help Viewer 1.0 transform file -->
-
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
- <xsl:import href="../Docbook/mshelp/docbook.xsl"/>
-
- <xsl:output method="xml" indent="no"/>
-
- <xsl:template match="emphasis[@role = 'keyword' or @role = 'keywordtype' or @role = 'keywordflow']">
- <span class="hl-keyword" style="color: #0079C1">
- <xsl:apply-templates/>
- </span>
- </xsl:template>
-
- <xsl:template match="emphasis[@role = 'stringliteral' or @role = 'charliteral']">
- <span class="hl-string" style="color: #800000">
- <xsl:apply-templates/>
- </span>
- </xsl:template>
-
- <xsl:template match="emphasis[@role = 'comment']">
- <em class="hl-comment" style="color: #008000">
- <xsl:apply-templates/>
- </em>
- </xsl:template>
-
- <xsl:template match="emphasis[@role = 'preprocessor']">
- <span class="hl-preprocessor" style="color: #A000A0">
- <xsl:apply-templates/>
- </span>
- </xsl:template>
-
- <xsl:template match="emphasis[@role = 'normal' and ancestor::programlisting]">
- <xsl:apply-templates />
- </xsl:template>
-
-</xsl:stylesheet>
+<!--
+ LUFA Library
+ Copyright (C) Dean Camera, 2017.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+-->
+
+<!-- Docbook XML to Microsoft Help Viewer 1.0 transform file -->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+ <xsl:import href="../Docbook/mshelp/docbook.xsl"/>
+
+ <xsl:output method="xml" indent="no"/>
+
+ <xsl:template match="emphasis[@role = 'keyword' or @role = 'keywordtype' or @role = 'keywordflow']">
+ <span class="hl-keyword" style="color: #0079C1">
+ <xsl:apply-templates/>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="emphasis[@role = 'stringliteral' or @role = 'charliteral']">
+ <span class="hl-string" style="color: #800000">
+ <xsl:apply-templates/>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="emphasis[@role = 'comment']">
+ <em class="hl-comment" style="color: #008000">
+ <xsl:apply-templates/>
+ </em>
+ </xsl:template>
+
+ <xsl:template match="emphasis[@role = 'preprocessor']">
+ <span class="hl-preprocessor" style="color: #A000A0">
+ <xsl:apply-templates/>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="emphasis[@role = 'normal' and ancestor::programlisting]">
+ <xsl:apply-templates />
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/lib/lufa/LUFA/StudioIntegration/VSIX/extension.vsixmanifest b/lib/lufa/LUFA/StudioIntegration/VSIX/extension.vsixmanifest
index f155618b7..a1901cb56 100644
--- a/lib/lufa/LUFA/StudioIntegration/VSIX/extension.vsixmanifest
+++ b/lib/lufa/LUFA/StudioIntegration/VSIX/extension.vsixmanifest
@@ -1,32 +1,32 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<Vsix xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010">
- <Identifier Id="FourWalledCubicle.LUFA.0e160d5c-e331-48d9-850b-e0387912171b">
- <Name>LUFA Library</Name>
- <Author>Dean Camera</Author>
- <Version>0</Version>
- <MoreInfoUrl>http://www.lufa-lib.org</MoreInfoUrl>
- <Description xml:space="preserve">LUFA, the Lightweight USB Framework for AVRs.</Description>
-
- <License>License.txt</License>
- <Icon>LUFA_thumb.png</Icon>
- <PreviewImage>LUFA.png</PreviewImage>
-
- <SupportedProducts>
- <IsolatedShell Version="7.0">AtmelStudio</IsolatedShell>
- </SupportedProducts>
-
- <SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.5"/>
- <Locale>1033</Locale>
-
- <AllUsers>false</AllUsers>
- </Identifier>
-
- <References/>
-
- <Content>
- <VsPackage>LUFA.pkgdef</VsPackage>
- <CustomExtension Type="MSHelp">helpcontentsetup.msha</CustomExtension>
- <CustomExtension Type="asf-manifest">asf-manifest.xml</CustomExtension>
- </Content>
-</Vsix>
+<?xml version="1.0" encoding="utf-8"?>
+
+<Vsix xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010">
+ <Identifier Id="FourWalledCubicle.LUFA.0e160d5c-e331-48d9-850b-e0387912171b">
+ <Name>LUFA Library</Name>
+ <Author>Dean Camera</Author>
+ <Version>0</Version>
+ <MoreInfoUrl>http://www.lufa-lib.org</MoreInfoUrl>
+ <Description xml:space="preserve">LUFA, the Lightweight USB Framework for AVRs.</Description>
+
+ <License>License.txt</License>
+ <Icon>LUFA_thumb.png</Icon>
+ <PreviewImage>LUFA.png</PreviewImage>
+
+ <SupportedProducts>
+ <IsolatedShell Version="7.0">AtmelStudio</IsolatedShell>
+ </SupportedProducts>
+
+ <SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.5"/>
+ <Locale>1033</Locale>
+
+ <AllUsers>false</AllUsers>
+ </Identifier>
+
+ <References/>
+
+ <Content>
+ <VsPackage>LUFA.pkgdef</VsPackage>
+ <CustomExtension Type="MSHelp">helpcontentsetup.msha</CustomExtension>
+ <CustomExtension Type="asf-manifest">asf-manifest.xml</CustomExtension>
+ </Content>
+</Vsix>
diff --git a/quantum/rgblight.h b/quantum/rgblight.h
index 92130192c..8fea96a9e 100644
--- a/quantum/rgblight.h
+++ b/quantum/rgblight.h
@@ -61,7 +61,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "eeconfig.h"
-#include "light_ws2812.h"
+#include "ws2812.h"
extern LED_TYPE led[RGBLED_NUM];
diff --git a/quantum/visualizer/common_gfxconf.h b/quantum/visualizer/common_gfxconf.h
new file mode 100644
index 000000000..eb705b188
--- /dev/null
+++ b/quantum/visualizer/common_gfxconf.h
@@ -0,0 +1,325 @@
+/**
+ * This file has a different license to the rest of the uGFX system.
+ * You can copy, modify and distribute this file as you see fit.
+ * You do not need to publish your source modifications to this file.
+ * The only thing you are not permitted to do is to relicense it
+ * under a different license.
+ */
+
+/**
+ * Copy this file into your project directory and rename it as gfxconf.h
+ * Edit your copy to turn on the uGFX features you want to use.
+ * The values below are the defaults.
+ *
+ * Only remove the comments from lines where you want to change the
+ * default value. This allows definitions to be included from
+ * driver makefiles when required and provides the best future
+ * compatibility for your project.
+ *
+ * Please use spaces instead of tabs in this file.
+ */
+
+#ifndef COMMON_GFXCONF_H
+#define COMMON_GFXCONF_H
+
+
+///////////////////////////////////////////////////////////////////////////
+// GOS - One of these must be defined, preferably in your Makefile //
+///////////////////////////////////////////////////////////////////////////
+//#define GFX_USE_OS_CHIBIOS TRUE
+//#define GFX_USE_OS_FREERTOS FALSE
+// #define GFX_FREERTOS_USE_TRACE FALSE
+//#define GFX_USE_OS_WIN32 FALSE
+//#define GFX_USE_OS_LINUX FALSE
+//#define GFX_USE_OS_OSX FALSE
+//#define GFX_USE_OS_ECOS FALSE
+//#define GFX_USE_OS_RAWRTOS FALSE
+//#define GFX_USE_OS_ARDUINO FALSE
+//#define GFX_USE_OS_KEIL FALSE
+//#define GFX_USE_OS_CMSIS FALSE
+//#define GFX_USE_OS_RAW32 FALSE
+// #define INTERRUPTS_OFF() optional_code
+// #define INTERRUPTS_ON() optional_code
+// These are not defined by default for some reason
+#define GOS_NEED_X_THREADS FALSE
+#define GOS_NEED_X_HEAP FALSE
+
+// Options that (should where relevant) apply to all operating systems
+ #define GFX_NO_INLINE FALSE
+// #define GFX_COMPILER GFX_COMPILER_UNKNOWN
+// #define GFX_CPU GFX_CPU_UNKNOWN
+// #define GFX_OS_HEAP_SIZE 0
+// #define GFX_OS_NO_INIT FALSE
+// #define GFX_OS_INIT_NO_WARNING FALSE
+// #define GFX_OS_PRE_INIT_FUNCTION myHardwareInitRoutine
+// #define GFX_OS_EXTRA_INIT_FUNCTION myOSInitRoutine
+// #define GFX_OS_EXTRA_DEINIT_FUNCTION myOSDeInitRoutine
+
+
+///////////////////////////////////////////////////////////////////////////
+// GDISP //
+///////////////////////////////////////////////////////////////////////////
+#define GFX_USE_GDISP TRUE
+
+//#define GDISP_NEED_AUTOFLUSH FALSE
+//#define GDISP_NEED_TIMERFLUSH FALSE
+//#define GDISP_NEED_VALIDATION TRUE
+//#define GDISP_NEED_CLIP TRUE
+#define GDISP_NEED_CIRCLE TRUE
+#define GDISP_NEED_ELLIPSE TRUE
+#define GDISP_NEED_ARC TRUE
+#define GDISP_NEED_ARCSECTORS TRUE
+#define GDISP_NEED_CONVEX_POLYGON TRUE
+//#define GDISP_NEED_SCROLL FALSE
+#define GDISP_NEED_PIXELREAD TRUE
+#define GDISP_NEED_CONTROL TRUE
+//#define GDISP_NEED_QUERY FALSE
+//#define GDISP_NEED_MULTITHREAD FALSE
+//#define GDISP_NEED_STREAMING FALSE
+#define GDISP_NEED_TEXT TRUE
+// #define GDISP_NEED_TEXT_WORDWRAP FALSE
+// #define GDISP_NEED_ANTIALIAS FALSE
+// #define GDISP_NEED_UTF8 FALSE
+ #define GDISP_NEED_TEXT_KERNING TRUE
+// #define GDISP_INCLUDE_FONT_UI1 FALSE
+// #define GDISP_INCLUDE_FONT_UI2 FALSE // The smallest preferred font.
+// #define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
+// #define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE
+// #define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE
+// #define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE
+// #define GDISP_INCLUDE_FONT_DEJAVUSANS20 FALSE
+// #define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE
+// #define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE
+ #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 TRUE
+// #define GDISP_INCLUDE_FONT_FIXED_10X20 FALSE
+// #define GDISP_INCLUDE_FONT_FIXED_7X14 FALSE
+ #define GDISP_INCLUDE_FONT_FIXED_5X8 TRUE
+// #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE
+// #define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE
+// #define GDISP_INCLUDE_FONT_DEJAVUSANS20_AA FALSE
+// #define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE
+// #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE
+// #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE
+// #define GDISP_INCLUDE_USER_FONTS FALSE
+
+//#define GDISP_NEED_IMAGE FALSE
+// #define GDISP_NEED_IMAGE_NATIVE FALSE
+// #define GDISP_NEED_IMAGE_GIF FALSE
+// #define GDISP_NEED_IMAGE_BMP FALSE
+// #define GDISP_NEED_IMAGE_BMP_1 FALSE
+// #define GDISP_NEED_IMAGE_BMP_4 FALSE
+// #define GDISP_NEED_IMAGE_BMP_4_RLE FALSE
+// #define GDISP_NEED_IMAGE_BMP_8 FALSE
+// #define GDISP_NEED_IMAGE_BMP_8_RLE FALSE
+// #define GDISP_NEED_IMAGE_BMP_16 FALSE
+// #define GDISP_NEED_IMAGE_BMP_24 FALSE
+// #define GDISP_NEED_IMAGE_BMP_32 FALSE
+// #define GDISP_NEED_IMAGE_JPG FALSE
+// #define GDISP_NEED_IMAGE_PNG FALSE
+// #define GDISP_NEED_IMAGE_ACCOUNTING FALSE
+#ifdef EMULATOR
+#define GDISP_NEED_PIXMAP TRUE
+#endif
+// #define GDISP_NEED_PIXMAP_IMAGE FALSE
+
+//#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE // If not defined the native hardware orientation is used.
+//#define GDISP_LINEBUF_SIZE 128
+//#define GDISP_STARTUP_COLOR Black
+#define GDISP_NEED_STARTUP_LOGO FALSE
+
+//#define GDISP_TOTAL_DISPLAYS 2
+
+ #ifdef GDISP_DRIVER_LIST
+ // For code and speed optimization define as TRUE or FALSE if all controllers have the same capability
+ #define GDISP_HARDWARE_STREAM_WRITE FALSE
+ #define GDISP_HARDWARE_STREAM_READ FALSE
+ #define GDISP_HARDWARE_STREAM_POS FALSE
+ #define GDISP_HARDWARE_DRAWPIXEL TRUE
+ #define GDISP_HARDWARE_CLEARS FALSE
+ #define GDISP_HARDWARE_FILLS FALSE
+ //#define GDISP_HARDWARE_BITFILLS FALSE
+ #define GDISP_HARDWARE_SCROLL FALSE
+ #define GDISP_HARDWARE_PIXELREAD TRUE
+ #define GDISP_HARDWARE_CONTROL TRUE
+ #define GDISP_HARDWARE_QUERY FALSE
+ #define GDISP_HARDWARE_CLIP FALSE
+
+ #define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
+ #endif
+
+// The custom format is not defined for some reason, so define it as error
+// so we don't get compiler warnings
+#define GDISP_PIXELFORMAT_CUSTOM GDISP_PIXELFORMAT_ERROR
+
+#define GDISP_USE_GFXNET FALSE
+// #define GDISP_GFXNET_PORT 13001
+// #define GDISP_GFXNET_CUSTOM_LWIP_STARTUP FALSE
+// #define GDISP_DONT_WAIT_FOR_NET_DISPLAY FALSE
+// #define GDISP_GFXNET_UNSAFE_SOCKETS FALSE
+
+
+///////////////////////////////////////////////////////////////////////////
+// GWIN //
+///////////////////////////////////////////////////////////////////////////
+#define GFX_USE_GWIN FALSE
+
+//#define GWIN_NEED_WINDOWMANAGER FALSE
+// #define GWIN_REDRAW_IMMEDIATE FALSE
+// #define GWIN_REDRAW_SINGLEOP FALSE
+// #define GWIN_NEED_FLASHING FALSE
+// #define GWIN_FLASHING_PERIOD 250
+
+//#define GWIN_NEED_CONSOLE FALSE
+// #define GWIN_CONSOLE_USE_HISTORY FALSE
+// #define GWIN_CONSOLE_HISTORY_AVERAGING FALSE
+// #define GWIN_CONSOLE_HISTORY_ATCREATE FALSE
+// #define GWIN_CONSOLE_ESCSEQ FALSE
+// #define GWIN_CONSOLE_USE_BASESTREAM FALSE
+// #define GWIN_CONSOLE_USE_FLOAT FALSE
+//#define GWIN_NEED_GRAPH FALSE
+//#define GWIN_NEED_GL3D FALSE
+
+//#define GWIN_NEED_WIDGET FALSE
+//#define GWIN_FOCUS_HIGHLIGHT_WIDTH 1
+// #define GWIN_NEED_LABEL FALSE
+// #define GWIN_LABEL_ATTRIBUTE FALSE
+// #define GWIN_NEED_BUTTON FALSE
+// #define GWIN_BUTTON_LAZY_RELEASE FALSE
+// #define GWIN_NEED_SLIDER FALSE
+// #define GWIN_SLIDER_NOSNAP FALSE
+// #define GWIN_SLIDER_DEAD_BAND 5
+// #define GWIN_SLIDER_TOGGLE_INC 20
+// #define GWIN_NEED_CHECKBOX FALSE
+// #define GWIN_NEED_IMAGE FALSE
+// #define GWIN_NEED_IMAGE_ANIMATION FALSE
+// #define GWIN_NEED_RADIO FALSE
+// #define GWIN_NEED_LIST FALSE
+// #define GWIN_NEED_LIST_IMAGES FALSE
+// #define GWIN_NEED_PROGRESSBAR FALSE
+// #define GWIN_PROGRESSBAR_AUTO FALSE
+// #define GWIN_NEED_KEYBOARD FALSE
+// #define GWIN_KEYBOARD_DEFAULT_LAYOUT VirtualKeyboard_English1
+// #define GWIN_NEED_KEYBOARD_ENGLISH1 TRUE
+// #define GWIN_NEED_TEXTEDIT FALSE
+// #define GWIN_FLAT_STYLING FALSE
+// #define GWIN_WIDGET_TAGS FALSE
+
+//#define GWIN_NEED_CONTAINERS FALSE
+// #define GWIN_NEED_CONTAINER FALSE
+// #define GWIN_NEED_FRAME FALSE
+// #define GWIN_NEED_TABSET FALSE
+// #define GWIN_TABSET_TABHEIGHT 18
+
+
+///////////////////////////////////////////////////////////////////////////
+// GEVENT //
+///////////////////////////////////////////////////////////////////////////
+#define GFX_USE_GEVENT TRUE
+
+//#define GEVENT_ASSERT_NO_RESOURCE FALSE
+//#define GEVENT_MAXIMUM_SIZE 32
+//#define GEVENT_MAX_SOURCE_LISTENERS 32
+
+
+///////////////////////////////////////////////////////////////////////////
+// GTIMER //
+///////////////////////////////////////////////////////////////////////////
+#define GFX_USE_GTIMER FALSE
+
+//#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY
+//#define GTIMER_THREAD_WORKAREA_SIZE 2048
+
+
+///////////////////////////////////////////////////////////////////////////
+// GQUEUE //
+///////////////////////////////////////////////////////////////////////////
+#define GFX_USE_GQUEUE FALSE
+
+//#define GQUEUE_NEED_ASYNC FALSE
+//#define GQUEUE_NEED_GSYNC FALSE
+//#define GQUEUE_NEED_FSYNC FALSE
+//#define GQUEUE_NEED_BUFFERS FALSE
+
+///////////////////////////////////////////////////////////////////////////
+// GINPUT //
+///////////////////////////////////////////////////////////////////////////
+#define GFX_USE_GINPUT FALSE
+
+//#define GINPUT_NEED_MOUSE FALSE
+// #define GINPUT_TOUCH_STARTRAW FALSE
+// #define GINPUT_TOUCH_NOTOUCH FALSE
+// #define GINPUT_TOUCH_NOCALIBRATE FALSE
+// #define GINPUT_TOUCH_NOCALIBRATE_GUI FALSE
+// #define GINPUT_MOUSE_POLL_PERIOD 25
+// #define GINPUT_MOUSE_CLICK_TIME 300
+// #define GINPUT_TOUCH_CXTCLICK_TIME 700
+// #define GINPUT_TOUCH_USER_CALIBRATION_LOAD FALSE
+// #define GINPUT_TOUCH_USER_CALIBRATION_SAVE FALSE
+// #define GMOUSE_DRIVER_LIST GMOUSEVMT_Win32, GMOUSEVMT_Win32
+//#define GINPUT_NEED_KEYBOARD FALSE
+// #define GINPUT_KEYBOARD_POLL_PERIOD 200
+// #define GKEYBOARD_DRIVER_LIST GKEYBOARDVMT_Win32, GKEYBOARDVMT_Win32
+// #define GKEYBOARD_LAYOUT_OFF FALSE
+// #define GKEYBOARD_LAYOUT_SCANCODE2_US FALSE
+//#define GINPUT_NEED_TOGGLE FALSE
+//#define GINPUT_NEED_DIAL FALSE
+
+
+///////////////////////////////////////////////////////////////////////////
+// GFILE //
+///////////////////////////////////////////////////////////////////////////
+#define GFX_USE_GFILE FALSE
+
+//#define GFILE_NEED_PRINTG FALSE
+//#define GFILE_NEED_SCANG FALSE
+//#define GFILE_NEED_STRINGS FALSE
+//#define GFILE_NEED_FILELISTS FALSE
+//#define GFILE_NEED_STDIO FALSE
+//#define GFILE_NEED_NOAUTOMOUNT FALSE
+//#define GFILE_NEED_NOAUTOSYNC FALSE
+
+//#define GFILE_NEED_MEMFS FALSE
+//#define GFILE_NEED_ROMFS FALSE
+//#define GFILE_NEED_RAMFS FALSE
+//#define GFILE_NEED_FATFS FALSE
+//#define GFILE_NEED_NATIVEFS FALSE
+//#define GFILE_NEED_CHBIOSFS FALSE
+
+//#define GFILE_ALLOW_FLOATS FALSE
+//#define GFILE_ALLOW_DEVICESPECIFIC FALSE
+//#define GFILE_MAX_GFILES 3
+
+///////////////////////////////////////////////////////////////////////////
+// GADC //
+///////////////////////////////////////////////////////////////////////////
+#define GFX_USE_GADC FALSE
+
+//#define GADC_MAX_LOWSPEED_DEVICES 4
+
+
+///////////////////////////////////////////////////////////////////////////
+// GAUDIO //
+///////////////////////////////////////////////////////////////////////////
+#define GFX_USE_GAUDIO FALSE
+// There seems to be a bug in the ugfx code, the wrong define is used
+// So define it in order to avoid warnings
+#define GFX_USE_GAUDIN GFX_USE_GAUDIO
+// #define GAUDIO_NEED_PLAY FALSE
+// #define GAUDIO_NEED_RECORD FALSE
+
+
+///////////////////////////////////////////////////////////////////////////
+// GMISC //
+///////////////////////////////////////////////////////////////////////////
+#define GFX_USE_GMISC TRUE
+
+//#define GMISC_NEED_ARRAYOPS FALSE
+//#define GMISC_NEED_FASTTRIG FALSE
+//#define GMISC_NEED_FIXEDTRIG FALSE
+//#define GMISC_NEED_INVSQRT FALSE
+// #define GMISC_INVSQRT_MIXED_ENDIAN FALSE
+// #define GMISC_INVSQRT_REAL_SLOW FALSE
+#define GMISC_NEED_MATRIXFLOAT2D TRUE
+#define GMISC_NEED_MATRIXFIXED2D FALSE
+
+#endif /* COMMON_GFXCONF_H */
diff --git a/keyboards/ergodox/infinity/animations.c b/quantum/visualizer/default_animations.c
index ebc08fde3..2d0327372 100644
--- a/keyboards/ergodox/infinity/animations.c
+++ b/quantum/visualizer/default_animations.c
@@ -16,7 +16,7 @@
#if defined(VISUALIZER_ENABLE)
-#include "animations.h"
+#include "default_animations.h"
#include "visualizer.h"
#ifdef LCD_ENABLE
#include "lcd_keyframes.h"
@@ -26,7 +26,7 @@
#endif
#ifdef BACKLIGHT_ENABLE
-#include "led_keyframes.h"
+#include "led_backlight_keyframes.h"
#endif
#include "visualizer_keyframes.h"
@@ -39,10 +39,10 @@ static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t*
lcd_keyframe_enable(animation, state);
#endif
#ifdef LCD_BACKLIGHT_ENABLE
- backlight_keyframe_enable(animation, state);
+ lcd_backlight_keyframe_enable(animation, state);
#endif
#ifdef BACKLIGHT_ENABLE
- led_keyframe_enable(animation, state);
+ led_backlight_keyframe_enable(animation, state);
#endif
return false;
}
@@ -52,10 +52,10 @@ static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t
lcd_keyframe_disable(animation, state);
#endif
#ifdef LCD_BACKLIGHT_ENABLE
- backlight_keyframe_disable(animation, state);
+ lcd_backlight_keyframe_disable(animation, state);
#endif
#ifdef BACKLIGHT_ENABLE
- led_keyframe_disable(animation, state);
+ led_backlight_keyframe_disable(animation, state);
#endif
return false;
}
@@ -63,10 +63,10 @@ static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t
static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) {
bool ret = false;
#ifdef LCD_BACKLIGHT_ENABLE
- ret |= backlight_keyframe_animate_color(animation, state);
+ ret |= lcd_backlight_keyframe_animate_color(animation, state);
#endif
#ifdef BACKLIGHT_ENABLE
- ret |= led_keyframe_fade_in_all(animation, state);
+ ret |= led_backlight_keyframe_fade_in_all(animation, state);
#endif
return ret;
}
@@ -74,10 +74,10 @@ static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t
static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) {
bool ret = false;
#ifdef LCD_BACKLIGHT_ENABLE
- ret |= backlight_keyframe_animate_color(animation, state);
+ ret |= lcd_backlight_keyframe_animate_color(animation, state);
#endif
#ifdef BACKLIGHT_ENABLE
- ret |= led_keyframe_fade_out_all(animation, state);
+ ret |= led_backlight_keyframe_fade_out_all(animation, state);
#endif
return ret;
}
@@ -86,22 +86,44 @@ static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_
// Don't worry, if the startup animation is long, you can use the keyboard like normal
// during that time
keyframe_animation_t default_startup_animation = {
+#if LCD_ENABLE
.num_frames = 3,
+#else
+ .num_frames = 2,
+#endif
.loop = false,
- .frame_lengths = {0, 0, gfxMillisecondsToTicks(5000)},
+ .frame_lengths = {
+ 0,
+#if LCD_ENABLE
+ 0,
+#endif
+ gfxMillisecondsToTicks(5000)},
.frame_functions = {
keyframe_enable,
+#if LCD_ENABLE
lcd_keyframe_draw_logo,
+#endif
keyframe_fade_in,
},
};
keyframe_animation_t default_suspend_animation = {
+#if LCD_ENABLE
.num_frames = 3,
+#else
+ .num_frames = 2,
+#endif
.loop = false,
- .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0},
+ .frame_lengths = {
+#if LCD_ENABLE
+ 0,
+#endif
+ gfxMillisecondsToTicks(1000),
+ 0},
.frame_functions = {
+#if LCD_ENABLE
lcd_keyframe_display_layer_text,
+#endif
keyframe_fade_out,
keyframe_disable,
},
@@ -133,20 +155,20 @@ keyframe_animation_t led_test_animation = {
},
.frame_functions = {
- led_keyframe_fade_in_all,
+ led_backlight_keyframe_fade_in_all,
keyframe_no_operation,
- led_keyframe_fade_out_all,
- led_keyframe_crossfade,
- led_keyframe_left_to_right_gradient,
- led_keyframe_crossfade,
- led_keyframe_top_to_bottom_gradient,
- led_keyframe_mirror_orientation,
- led_keyframe_crossfade,
- led_keyframe_left_to_right_gradient,
- led_keyframe_crossfade,
- led_keyframe_top_to_bottom_gradient,
- led_keyframe_normal_orientation,
- led_keyframe_crossfade,
+ led_backlight_keyframe_fade_out_all,
+ led_backlight_keyframe_crossfade,
+ led_backlight_keyframe_left_to_right_gradient,
+ led_backlight_keyframe_crossfade,
+ led_backlight_keyframe_top_to_bottom_gradient,
+ led_backlight_keyframe_mirror_orientation,
+ led_backlight_keyframe_crossfade,
+ led_backlight_keyframe_left_to_right_gradient,
+ led_backlight_keyframe_crossfade,
+ led_backlight_keyframe_top_to_bottom_gradient,
+ led_backlight_keyframe_normal_orientation,
+ led_backlight_keyframe_crossfade,
},
};
#endif
diff --git a/keyboards/ergodox/infinity/animations.h b/quantum/visualizer/default_animations.h
index 6d8b9830d..51320b8b8 100644
--- a/keyboards/ergodox/infinity/animations.h
+++ b/quantum/visualizer/default_animations.h
@@ -14,8 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_
-#define KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_
+#ifndef DEFAULT_ANIMATIONS_H_
+#define DEFAULT_ANIMATIONS_H_
#include "visualizer.h"
@@ -27,4 +27,4 @@ extern keyframe_animation_t default_suspend_animation;
// cases
extern keyframe_animation_t led_test_animation;
-#endif /* KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ */
+#endif /* DEFAULT_ANIMATIONS_H_ */
diff --git a/quantum/visualizer/lcd_backlight_keyframes.c b/quantum/visualizer/lcd_backlight_keyframes.c
index 8436d4e3d..8c402baf6 100644
--- a/quantum/visualizer/lcd_backlight_keyframes.c
+++ b/quantum/visualizer/lcd_backlight_keyframes.c
@@ -16,7 +16,7 @@
#include "lcd_backlight_keyframes.h"
-bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state) {
+bool lcd_backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state) {
int frame_length = animation->frame_lengths[animation->current_frame];
int current_pos = frame_length - animation->time_left_in_frame;
uint8_t t_h = LCD_HUE(state->target_lcd_color);
@@ -49,7 +49,7 @@ bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualize
return true;
}
-bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state) {
+bool lcd_backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
state->prev_lcd_color = state->target_lcd_color;
state->current_lcd_color = state->target_lcd_color;
@@ -60,14 +60,14 @@ bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_st
return false;
}
-bool backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
+bool lcd_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
lcd_backlight_hal_color(0, 0, 0);
return false;
}
-bool backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
+bool lcd_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
lcd_backlight_color(LCD_HUE(state->current_lcd_color),
diff --git a/quantum/visualizer/lcd_keyframes.c b/quantum/visualizer/lcd_keyframes.c
index 82e4184d2..75eb45700 100644
--- a/quantum/visualizer/lcd_keyframes.c
+++ b/quantum/visualizer/lcd_keyframes.c
@@ -166,8 +166,8 @@ bool lcd_keyframe_draw_logo(keyframe_animation_t* animation, visualizer_state_t*
// or state structs, here we use the image
//gdispGBlitArea is a tricky function to use since it supports blitting part of the image
- // if you have full screen image, then just use 128 and 32 for both source and target dimensions
- gdispGBlitArea(GDISP, 0, 0, 128, 32, 0, 0, 128, (pixel_t*)resource_lcd_logo);
+ // if you have full screen image, then just use LCD_WIDTH and LCD_HEIGHT for both source and target dimensions
+ gdispGBlitArea(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, 0, 0, LCD_WIDTH, (pixel_t*)resource_lcd_logo);
return false;
}
diff --git a/quantum/visualizer/led_keyframes.c b/quantum/visualizer/led_backlight_keyframes.c
index 7e6e5d1ab..eb3f5561d 100644
--- a/quantum/visualizer/led_keyframes.c
+++ b/quantum/visualizer/led_backlight_keyframes.c
@@ -23,7 +23,7 @@ SOFTWARE.
*/
#include "gfx.h"
#include "math.h"
-#include "led_keyframes.h"
+#include "led_backlight_keyframes.h"
static uint8_t fade_led_color(keyframe_animation_t* animation, int from, int to) {
int frame_length = animation->frame_lengths[animation->current_frame];
@@ -41,8 +41,8 @@ static void keyframe_fade_all_leds_from_to(keyframe_animation_t* animation, uint
}
// TODO: Should be customizable per keyboard
-#define NUM_ROWS LED_NUM_ROWS
-#define NUM_COLS LED_NUM_COLS
+#define NUM_ROWS LED_HEIGHT
+#define NUM_COLS LED_WIDTH
static uint8_t crossfade_start_frame[NUM_ROWS][NUM_COLS];
static uint8_t crossfade_end_frame[NUM_ROWS][NUM_COLS];
@@ -55,19 +55,19 @@ static uint8_t compute_gradient_color(float t, float index, float num) {
return (uint8_t)(255.0f * v);
}
-bool led_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state) {
+bool led_backlight_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
keyframe_fade_all_leds_from_to(animation, 0, 255);
return true;
}
-bool led_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state) {
+bool led_backlight_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
keyframe_fade_all_leds_from_to(animation, 255, 0);
return true;
}
-bool led_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state) {
+bool led_backlight_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
float frame_length = animation->frame_lengths[animation->current_frame];
float current_pos = frame_length - animation->time_left_in_frame;
@@ -79,7 +79,7 @@ bool led_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visual
return true;
}
-bool led_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state) {
+bool led_backlight_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
float frame_length = animation->frame_lengths[animation->current_frame];
float current_pos = frame_length - animation->time_left_in_frame;
@@ -98,7 +98,7 @@ static void copy_current_led_state(uint8_t* dest) {
}
}
}
-bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state) {
+bool led_backlight_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
if (animation->first_update_of_frame) {
copy_current_led_state(&crossfade_start_frame[0][0]);
@@ -114,28 +114,28 @@ bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t*
return true;
}
-bool led_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state) {
+bool led_backlight_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
(void)animation;
gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_180);
return false;
}
-bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state) {
+bool led_backlight_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
(void)animation;
gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_0);
return false;
}
-bool led_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
+bool led_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
(void)animation;
gdispGSetPowerMode(LED_DISPLAY, powerOff);
return false;
}
-bool led_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
+bool led_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
(void)animation;
gdispGSetPowerMode(LED_DISPLAY, powerOn);
diff --git a/quantum/visualizer/led_keyframes.h b/quantum/visualizer/led_backlight_keyframes.h
index a59a4f37d..487151013 100644
--- a/quantum/visualizer/led_keyframes.h
+++ b/quantum/visualizer/led_backlight_keyframes.h
@@ -22,21 +22,21 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
-#ifndef LED_KEYFRAMES_H
-#define LED_KEYFRAMES_H
+#ifndef LED_BACKLIGHT_KEYFRAMES_H
+#define LED_BACKLIGHT_KEYFRAMES_H
#include "visualizer.h"
-bool led_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state);
-bool led_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state);
-bool led_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state);
-bool led_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state);
-bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state);
-bool led_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state);
-bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state);
+bool led_backlight_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state);
+bool led_backlight_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state);
+bool led_backlight_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state);
+bool led_backlight_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state);
+bool led_backlight_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state);
+bool led_backlight_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state);
+bool led_backlight_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state);
-bool led_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
-bool led_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
+bool led_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
+bool led_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
extern keyframe_animation_t led_test_animation;
diff --git a/quantum/visualizer/visualizer.c b/quantum/visualizer/visualizer.c
index cc99d1e3b..5b4d8d603 100644
--- a/quantum/visualizer/visualizer.c
+++ b/quantum/visualizer/visualizer.c
@@ -52,7 +52,8 @@ SOFTWARE.
// Define this in config.h
#ifndef VISUALIZER_THREAD_PRIORITY
-#define "Visualizer thread priority not defined"
+// The visualizer needs gfx thread priorities
+#define VISUALIZER_THREAD_PRIORITY (NORMAL_PRIORITY - 2)
#endif
static visualizer_keyboard_status_t current_status = {
@@ -255,6 +256,9 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) {
.mods = 0xFF,
.leds = 0xFFFFFFFF,
.suspended = false,
+ #ifdef BACKLIGHT_ENABLE
+ .backlight_level = 0,
+ #endif
#ifdef VISUALIZER_USER_DATA_SIZE
.user_data = {0},
#endif
@@ -299,6 +303,7 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) {
else {
gdispGSetPowerMode(LED_DISPLAY, powerOff);
}
+ state.status.backlight_level = current_status.backlight_level;
}
#endif
if (visualizer_enabled) {
diff --git a/quantum/visualizer/visualizer.mk b/quantum/visualizer/visualizer.mk
index 0f7d8636c..102d23b7e 100644
--- a/quantum/visualizer/visualizer.mk
+++ b/quantum/visualizer/visualizer.mk
@@ -20,6 +20,30 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
+define ADD_DRIVER
+ $(1)_DRIVER:=$(strip $($(1)_DRIVER))
+ $(1)_WIDTH:=$(strip $($(1)_WIDTH))
+ $(1)_HEIGHT:=$(strip $($(1)_HEIGHT))
+ ifeq ($($(1)_DRIVER),)
+ $$(error $(1)_DRIVER is not defined)
+ endif
+ ifeq ($($(1)_WIDTH),)
+ $$(error $(1)_WIDTH is not defined)
+ endif
+ ifeq ($($(1)_HEIGHT),)
+ $$(error $(1)_HEIGHT is not defined)
+ endif
+ OPT_DEFS+=-D$(1)_WIDTH=$($(1)_WIDTH)
+ OPT_DEFS+=-D$(1)_HEIGHT=$($(1)_HEIGHT)
+ GFXDEFS+=-D$(1)_WIDTH=$($(1)_WIDTH)
+ GFXDEFS+=-D$(1)_HEIGHT=$($(1)_HEIGHT)
+ $(1)_DISPLAY_NUMBER:=$$(words $$(GDISP_DRIVER_LIST))
+ OPT_DEFS+=-D$(1)_DISPLAY_NUMBER=$$($(1)_DISPLAY_NUMBER)
+ include $(TOP_DIR)/drivers/ugfx/gdisp/$($(1)_DRIVER)/driver.mk
+endef
+
+GDISP_DRIVER_LIST:=
+
SRC += $(VISUALIZER_DIR)/visualizer.c \
$(VISUALIZER_DIR)/visualizer_keyframes.c
EXTRAINCDIRS += $(GFXINC) $(VISUALIZER_DIR)
@@ -40,16 +64,32 @@ SRC += $(VISUALIZER_DIR)/lcd_backlight_keyframes.c
# Note, that the linker will strip out any resources that are not actually in use
SRC += $(VISUALIZER_DIR)/resources/lcd_logo.c
OPT_DEFS += -DLCD_BACKLIGHT_ENABLE
+$(eval $(call ADD_DRIVER,LCD))
endif
ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
-SRC += $(VISUALIZER_DIR)/led_keyframes.c
+SRC += $(VISUALIZER_DIR)/led_backlight_keyframes.c
+$(eval $(call ADD_DRIVER,LED))
endif
+SRC += $(VISUALIZER_DIR)/default_animations.c
+
include $(GFXLIB)/gfx.mk
+# For the common_gfxconf.h
+GFXINC += quantum/visualizer
+
GFXSRC := $(patsubst $(TOP_DIR)/%,%,$(GFXSRC))
GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS)))
+GDISP_LIST_COMMA=,
+GDISP_LIST_EMPTY=
+GDISP_LIST_SPACE=$(GDISP_LIST_EMPTY) $(GDISP_LIST_EMPTY)
+
+GDISP_DRIVER_LIST := $(strip $(GDISP_DRIVER_LIST))
+GDISP_DRIVER_LIST := $(subst $(GDISP_LIST_SPACE),$(GDISP_LIST_COMMA),$(GDISP_DRIVER_LIST))
+
+GFXDEFS +=-DGDISP_DRIVER_LIST="$(GDISP_DRIVER_LIST)"
+
ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","")
SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c
else
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk
index ccecdb192..4af34ba57 100644
--- a/tmk_core/avr.mk
+++ b/tmk_core/avr.mk
@@ -12,7 +12,7 @@ HEX = $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature
EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT)
BIN =
-
+COMMON_VPATH += $(DRIVER_PATH)/avr
COMPILEFLAGS += -funsigned-char
COMPILEFLAGS += -funsigned-bitfields
@@ -87,11 +87,13 @@ DEBUG_PORT = 4242
DEBUG_HOST = localhost
#============================================================================
-# Autodecct teensy loader
-ifneq (, $(shell which teensy-loader-cli 2>/dev/null))
- TEENSY_LOADER_CLI ?= teensy-loader-cli
-else
- TEENSY_LOADER_CLI ?= teensy_loader_cli
+# Autodetect teensy loader
+ifndef TEENSY_LOADER_CLI
+ ifneq (, $(shell which teensy-loader-cli 2>/dev/null))
+ TEENSY_LOADER_CLI ?= teensy-loader-cli
+ else
+ TEENSY_LOADER_CLI ?= teensy_loader_cli
+ endif
endif
# Program the device.
@@ -115,11 +117,11 @@ dfu: $(BUILD_DIR)/$(TARGET).hex sizeafter
echo "Error: Bootloader not found. Trying again in 5s." ;\
sleep 5 ;\
done
-ifneq (, $(findstring 0.7, $(shell $(DFU_PROGRAMMER) --version 2>&1)))
- $(DFU_PROGRAMMER) $(MCU) erase --force
-else
- $(DFU_PROGRAMMER) $(MCU) erase
-endif
+ if $(DFU_PROGRAMMER) --version 2>&1 | grep -q 0.7 ; then\
+ $(DFU_PROGRAMMER) $(MCU) erase --force;\
+ else\
+ $(DFU_PROGRAMMER) $(MCU) erase;\
+ fi
$(DFU_PROGRAMMER) $(MCU) flash $(BUILD_DIR)/$(TARGET).hex
$(DFU_PROGRAMMER) $(MCU) reset
@@ -135,11 +137,11 @@ flip-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
$(REMOVE) $(BUILD_DIR)/$(TARGET)eep.hex
dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
-ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1)))
- $(DFU_PROGRAMMER) $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep
-else
- $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep
-endif
+ if $(DFU_PROGRAMMER) --version 2>&1 | grep -q 0.7 ; then\
+ $(DFU_PROGRAMMER) $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep;\
+ else\
+ $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep;\
+ fi
$(DFU_PROGRAMMER) $(MCU) reset
# Convert hex to bin.