diff options
120 files changed, 4802 insertions, 3223 deletions
| @@ -483,6 +483,8 @@ define RUN_TEST | |||
| 483 | +error_occurred=0;\ | 483 | +error_occurred=0;\ |
| 484 | $($(TEST)_COMMAND)\ | 484 | $($(TEST)_COMMAND)\ |
| 485 | if [ $$error_occurred -gt 0 ]; then $(HANDLE_ERROR); fi; | 485 | if [ $$error_occurred -gt 0 ]; then $(HANDLE_ERROR); fi; |
| 486 | |||
| 487 | |||
| 486 | endef | 488 | endef |
| 487 | 489 | ||
| 488 | # Allow specifying just the subproject, in the keyboard directory, which will compile all keymaps | 490 | # Allow specifying just the subproject, in the keyboard directory, which will compile all keymaps |
| @@ -9,6 +9,9 @@ LIB_PATH = $(TOP_DIR)/lib | |||
| 9 | QUANTUM_DIR = quantum | 9 | QUANTUM_DIR = quantum |
| 10 | QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR) | 10 | QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR) |
| 11 | 11 | ||
| 12 | DRIVER_DIR = drivers | ||
| 13 | DRIVER_PATH = $(TOP_DIR)/$(DRIVER_DIR) | ||
| 14 | |||
| 12 | BUILD_DIR := $(TOP_DIR)/.build | 15 | BUILD_DIR := $(TOP_DIR)/.build |
| 13 | 16 | ||
| 14 | COMMON_VPATH := $(TOP_DIR) | 17 | COMMON_VPATH := $(TOP_DIR) |
| @@ -17,4 +20,5 @@ COMMON_VPATH += $(QUANTUM_PATH) | |||
| 17 | COMMON_VPATH += $(QUANTUM_PATH)/keymap_extras | 20 | COMMON_VPATH += $(QUANTUM_PATH)/keymap_extras |
| 18 | COMMON_VPATH += $(QUANTUM_PATH)/audio | 21 | COMMON_VPATH += $(QUANTUM_PATH)/audio |
| 19 | COMMON_VPATH += $(QUANTUM_PATH)/process_keycode | 22 | COMMON_VPATH += $(QUANTUM_PATH)/process_keycode |
| 20 | COMMON_VPATH += $(QUANTUM_PATH)/api \ No newline at end of file | 23 | COMMON_VPATH += $(QUANTUM_PATH)/api |
| 24 | 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 | |||
| 87 | 87 | ||
| 88 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) | 88 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) |
| 89 | OPT_DEFS += -DRGBLIGHT_ENABLE | 89 | OPT_DEFS += -DRGBLIGHT_ENABLE |
| 90 | SRC += $(QUANTUM_DIR)/light_ws2812.c | 90 | SRC += ws2812.c |
| 91 | SRC += $(QUANTUM_DIR)/rgblight.c | 91 | SRC += $(QUANTUM_DIR)/rgblight.c |
| 92 | CIE1931_CURVE = yes | 92 | CIE1931_CURVE = yes |
| 93 | LED_BREATHING_TABLE = yes | 93 | 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 @@ | |||
| 1 | #ifdef SSD1306OLED | 1 | #ifdef SSD1306OLED |
| 2 | 2 | ||
| 3 | #include "ssd1306.h" | 3 | #include "ssd1306.h" |
| 4 | #include "config.h" | ||
| 5 | #include "i2c.h" | 4 | #include "i2c.h" |
| 6 | #include <string.h> | 5 | #include <string.h> |
| 7 | #include "print.h" | 6 | #include "print.h" |
| 8 | #include "lets_split.h" | 7 | #include "glcdfont.c" |
| 9 | #include "common/glcdfont.c" | ||
| 10 | #ifdef ADAFRUIT_BLE_ENABLE | 8 | #ifdef ADAFRUIT_BLE_ENABLE |
| 11 | #include "adafruit_ble.h" | 9 | #include "adafruit_ble.h" |
| 12 | #endif | 10 | #endif |
| @@ -14,18 +12,7 @@ | |||
| 14 | #include "lufa.h" | 12 | #include "lufa.h" |
| 15 | #endif | 13 | #endif |
| 16 | #include "sendchar.h" | 14 | #include "sendchar.h" |
| 17 | #include "pincontrol.h" | 15 | #include "timer.h" |
| 18 | |||
| 19 | //assign the right code to your layers | ||
| 20 | #define _BASE 0 | ||
| 21 | #define _LOWER 8 | ||
| 22 | #define _RAISE 16 | ||
| 23 | #define _FNLAYER 64 | ||
| 24 | #define _NUMLAY 128 | ||
| 25 | #define _NLOWER 136 | ||
| 26 | #define _NFNLAYER 192 | ||
| 27 | #define _MOUSECURSOR 256 | ||
| 28 | #define _ADJUST 65560 | ||
| 29 | 16 | ||
| 30 | // Set this to 1 to help diagnose early startup problems | 17 | // Set this to 1 to help diagnose early startup problems |
| 31 | // when testing power-on with ble. Turn it off otherwise, | 18 | // when testing power-on with ble. Turn it off otherwise, |
| @@ -33,26 +20,6 @@ | |||
| 33 | // with the matrix scan, causing keys to drop. | 20 | // with the matrix scan, causing keys to drop. |
| 34 | #define DEBUG_TO_SCREEN 0 | 21 | #define DEBUG_TO_SCREEN 0 |
| 35 | 22 | ||
| 36 | // Controls the SSD1306 128x32 OLED display via i2c | ||
| 37 | |||
| 38 | #define i2cAddress 0x3C | ||
| 39 | |||
| 40 | #define DisplayHeight 32 | ||
| 41 | #define DisplayWidth 128 | ||
| 42 | |||
| 43 | #define FontHeight 8 | ||
| 44 | #define FontWidth 6 | ||
| 45 | |||
| 46 | #define MatrixRows (DisplayHeight / FontHeight) | ||
| 47 | #define MatrixCols (DisplayWidth / FontWidth) | ||
| 48 | |||
| 49 | struct CharacterMatrix { | ||
| 50 | uint8_t display[MatrixRows][MatrixCols]; | ||
| 51 | uint8_t *cursor; | ||
| 52 | bool dirty; | ||
| 53 | }; | ||
| 54 | |||
| 55 | static struct CharacterMatrix display; | ||
| 56 | //static uint16_t last_battery_update; | 23 | //static uint16_t last_battery_update; |
| 57 | //static uint32_t vbat; | 24 | //static uint32_t vbat; |
| 58 | //#define BatteryUpdateInterval 10000 /* milliseconds */ | 25 | //#define BatteryUpdateInterval 10000 /* milliseconds */ |
| @@ -62,54 +29,13 @@ static uint8_t displaying; | |||
| 62 | #endif | 29 | #endif |
| 63 | static uint16_t last_flush; | 30 | static uint16_t last_flush; |
| 64 | 31 | ||
| 65 | enum ssd1306_cmds { | ||
| 66 | DisplayOff = 0xAE, | ||
| 67 | DisplayOn = 0xAF, | ||
| 68 | |||
| 69 | SetContrast = 0x81, | ||
| 70 | DisplayAllOnResume = 0xA4, | ||
| 71 | |||
| 72 | DisplayAllOn = 0xA5, | ||
| 73 | NormalDisplay = 0xA6, | ||
| 74 | InvertDisplay = 0xA7, | ||
| 75 | SetDisplayOffset = 0xD3, | ||
| 76 | SetComPins = 0xda, | ||
| 77 | SetVComDetect = 0xdb, | ||
| 78 | SetDisplayClockDiv = 0xD5, | ||
| 79 | SetPreCharge = 0xd9, | ||
| 80 | SetMultiPlex = 0xa8, | ||
| 81 | SetLowColumn = 0x00, | ||
| 82 | SetHighColumn = 0x10, | ||
| 83 | SetStartLine = 0x40, | ||
| 84 | |||
| 85 | SetMemoryMode = 0x20, | ||
| 86 | ColumnAddr = 0x21, | ||
| 87 | PageAddr = 0x22, | ||
| 88 | |||
| 89 | ComScanInc = 0xc0, | ||
| 90 | ComScanDec = 0xc8, | ||
| 91 | SegRemap = 0xa0, | ||
| 92 | SetChargePump = 0x8d, | ||
| 93 | ExternalVcc = 0x01, | ||
| 94 | SwitchCapVcc = 0x02, | ||
| 95 | |||
| 96 | ActivateScroll = 0x2f, | ||
| 97 | DeActivateScroll = 0x2e, | ||
| 98 | SetVerticalScrollArea = 0xa3, | ||
| 99 | RightHorizontalScroll = 0x26, | ||
| 100 | LeftHorizontalScroll = 0x27, | ||
| 101 | VerticalAndRightHorizontalScroll = 0x29, | ||
| 102 | VerticalAndLeftHorizontalScroll = 0x2a, | ||
| 103 | }; | ||
| 104 | |||
| 105 | |||
| 106 | // Write command sequence. | 32 | // Write command sequence. |
| 107 | // Returns true on success. | 33 | // Returns true on success. |
| 108 | static inline bool _send_cmd1(uint8_t cmd) { | 34 | static inline bool _send_cmd1(uint8_t cmd) { |
| 109 | bool res = false; | 35 | bool res = false; |
| 110 | 36 | ||
| 111 | if (i2c_start_write(i2cAddress)) { | 37 | if (i2c_start_write(SSD1306_ADDRESS)) { |
| 112 | xprintf("failed to start write to %d\n", i2cAddress); | 38 | xprintf("failed to start write to %d\n", SSD1306_ADDRESS); |
| 113 | goto done; | 39 | goto done; |
| 114 | } | 40 | } |
| 115 | 41 | ||
| @@ -154,8 +80,6 @@ static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) { | |||
| 154 | #define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} | 80 | #define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} |
| 155 | #define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} | 81 | #define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} |
| 156 | 82 | ||
| 157 | static void matrix_clear(struct CharacterMatrix *matrix); | ||
| 158 | |||
| 159 | static void clear_display(void) { | 83 | static void clear_display(void) { |
| 160 | matrix_clear(&display); | 84 | matrix_clear(&display); |
| 161 | 85 | ||
| @@ -164,7 +88,7 @@ static void clear_display(void) { | |||
| 164 | send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1); | 88 | send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1); |
| 165 | send_cmd3(ColumnAddr, 0, DisplayWidth - 1); | 89 | send_cmd3(ColumnAddr, 0, DisplayWidth - 1); |
| 166 | 90 | ||
| 167 | if (i2c_start_write(i2cAddress)) { | 91 | if (i2c_start_write(SSD1306_ADDRESS)) { |
| 168 | goto done; | 92 | goto done; |
| 169 | } | 93 | } |
| 170 | if (i2c_master_write(0x40)) { | 94 | if (i2c_master_write(0x40)) { |
| @@ -210,14 +134,17 @@ bool iota_gfx_init(void) { | |||
| 210 | send_cmd2(SetChargePump, 0x14 /* Enable */); | 134 | send_cmd2(SetChargePump, 0x14 /* Enable */); |
| 211 | send_cmd2(SetMemoryMode, 0 /* horizontal addressing */); | 135 | send_cmd2(SetMemoryMode, 0 /* horizontal addressing */); |
| 212 | 136 | ||
| 213 | /// Flips the display orientation 0 degrees | 137 | #ifdef OLED_ROTATE180 |
| 214 | send_cmd1(SegRemap | 0x1); | ||
| 215 | send_cmd1(ComScanDec); | ||
| 216 | /* | ||
| 217 | // the following Flip the display orientation 180 degrees | 138 | // the following Flip the display orientation 180 degrees |
| 218 | send_cmd1(SegRemap); | 139 | send_cmd1(SegRemap); |
| 219 | send_cmd1(ComScanInc); | 140 | send_cmd1(ComScanInc); |
| 220 | // end flip */ | 141 | #endif |
| 142 | #ifndef OLED_ROTATE180 | ||
| 143 | // Flips the display orientation 0 degrees | ||
| 144 | send_cmd1(SegRemap | 0x1); | ||
| 145 | send_cmd1(ComScanDec); | ||
| 146 | #endif | ||
| 147 | |||
| 221 | send_cmd2(SetComPins, 0x2); | 148 | send_cmd2(SetComPins, 0x2); |
| 222 | send_cmd2(SetContrast, 0x8f); | 149 | send_cmd2(SetContrast, 0x8f); |
| 223 | send_cmd2(SetPreCharge, 0xf1); | 150 | send_cmd2(SetPreCharge, 0xf1); |
| @@ -263,7 +190,7 @@ done: | |||
| 263 | return success; | 190 | return success; |
| 264 | } | 191 | } |
| 265 | 192 | ||
| 266 | static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { | 193 | void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { |
| 267 | *matrix->cursor = c; | 194 | *matrix->cursor = c; |
| 268 | ++matrix->cursor; | 195 | ++matrix->cursor; |
| 269 | 196 | ||
| @@ -276,7 +203,7 @@ static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { | |||
| 276 | } | 203 | } |
| 277 | } | 204 | } |
| 278 | 205 | ||
| 279 | static void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { | 206 | void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { |
| 280 | matrix->dirty = true; | 207 | matrix->dirty = true; |
| 281 | 208 | ||
| 282 | if (c == '\n') { | 209 | if (c == '\n') { |
| @@ -297,7 +224,7 @@ void iota_gfx_write_char(uint8_t c) { | |||
| 297 | matrix_write_char(&display, c); | 224 | matrix_write_char(&display, c); |
| 298 | } | 225 | } |
| 299 | 226 | ||
| 300 | static void matrix_write(struct CharacterMatrix *matrix, const char *data) { | 227 | void matrix_write(struct CharacterMatrix *matrix, const char *data) { |
| 301 | const char *end = data + strlen(data); | 228 | const char *end = data + strlen(data); |
| 302 | while (data < end) { | 229 | while (data < end) { |
| 303 | matrix_write_char(matrix, *data); | 230 | matrix_write_char(matrix, *data); |
| @@ -309,7 +236,7 @@ void iota_gfx_write(const char *data) { | |||
| 309 | matrix_write(&display, data); | 236 | matrix_write(&display, data); |
| 310 | } | 237 | } |
| 311 | 238 | ||
| 312 | static void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { | 239 | void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { |
| 313 | while (true) { | 240 | while (true) { |
| 314 | uint8_t c = pgm_read_byte(data); | 241 | uint8_t c = pgm_read_byte(data); |
| 315 | if (c == 0) { | 242 | if (c == 0) { |
| @@ -324,7 +251,7 @@ void iota_gfx_write_P(const char *data) { | |||
| 324 | matrix_write_P(&display, data); | 251 | matrix_write_P(&display, data); |
| 325 | } | 252 | } |
| 326 | 253 | ||
| 327 | static void matrix_clear(struct CharacterMatrix *matrix) { | 254 | void matrix_clear(struct CharacterMatrix *matrix) { |
| 328 | memset(matrix->display, ' ', sizeof(matrix->display)); | 255 | memset(matrix->display, ' ', sizeof(matrix->display)); |
| 329 | matrix->cursor = &matrix->display[0][0]; | 256 | matrix->cursor = &matrix->display[0][0]; |
| 330 | matrix->dirty = true; | 257 | matrix->dirty = true; |
| @@ -334,7 +261,7 @@ void iota_gfx_clear_screen(void) { | |||
| 334 | matrix_clear(&display); | 261 | matrix_clear(&display); |
| 335 | } | 262 | } |
| 336 | 263 | ||
| 337 | static void matrix_render(struct CharacterMatrix *matrix) { | 264 | void matrix_render(struct CharacterMatrix *matrix) { |
| 338 | last_flush = timer_read(); | 265 | last_flush = timer_read(); |
| 339 | iota_gfx_on(); | 266 | iota_gfx_on(); |
| 340 | #if DEBUG_TO_SCREEN | 267 | #if DEBUG_TO_SCREEN |
| @@ -345,7 +272,7 @@ static void matrix_render(struct CharacterMatrix *matrix) { | |||
| 345 | send_cmd3(PageAddr, 0, MatrixRows - 1); | 272 | send_cmd3(PageAddr, 0, MatrixRows - 1); |
| 346 | send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1); | 273 | send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1); |
| 347 | 274 | ||
| 348 | if (i2c_start_write(i2cAddress)) { | 275 | if (i2c_start_write(SSD1306_ADDRESS)) { |
| 349 | goto done; | 276 | goto done; |
| 350 | } | 277 | } |
| 351 | if (i2c_master_write(0x40)) { | 278 | if (i2c_master_write(0x40)) { |
| @@ -380,84 +307,12 @@ void iota_gfx_flush(void) { | |||
| 380 | matrix_render(&display); | 307 | matrix_render(&display); |
| 381 | } | 308 | } |
| 382 | 309 | ||
| 383 | static void matrix_update(struct CharacterMatrix *dest, | 310 | __attribute__ ((weak)) |
| 384 | const struct CharacterMatrix *source) { | 311 | void iota_gfx_task_user(void) { |
| 385 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
| 386 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
| 387 | dest->dirty = true; | ||
| 388 | } | ||
| 389 | } | ||
| 390 | |||
| 391 | static void render_status_info(void) { | ||
| 392 | #if DEBUG_TO_SCREEN | ||
| 393 | if (debug_enable) { | ||
| 394 | return; | ||
| 395 | } | ||
| 396 | #endif | ||
| 397 | |||
| 398 | struct CharacterMatrix matrix; | ||
| 399 | |||
| 400 | matrix_clear(&matrix); | ||
| 401 | matrix_write_P(&matrix, PSTR("USB: ")); | ||
| 402 | #ifdef PROTOCOL_LUFA | ||
| 403 | switch (USB_DeviceState) { | ||
| 404 | case DEVICE_STATE_Unattached: | ||
| 405 | matrix_write_P(&matrix, PSTR("Unattached")); | ||
| 406 | break; | ||
| 407 | case DEVICE_STATE_Suspended: | ||
| 408 | matrix_write_P(&matrix, PSTR("Suspended")); | ||
| 409 | break; | ||
| 410 | case DEVICE_STATE_Configured: | ||
| 411 | matrix_write_P(&matrix, PSTR("Connected")); | ||
| 412 | break; | ||
| 413 | case DEVICE_STATE_Powered: | ||
| 414 | matrix_write_P(&matrix, PSTR("Powered")); | ||
| 415 | break; | ||
| 416 | case DEVICE_STATE_Default: | ||
| 417 | matrix_write_P(&matrix, PSTR("Default")); | ||
| 418 | break; | ||
| 419 | case DEVICE_STATE_Addressed: | ||
| 420 | matrix_write_P(&matrix, PSTR("Addressed")); | ||
| 421 | break; | ||
| 422 | default: | ||
| 423 | matrix_write_P(&matrix, PSTR("Invalid")); | ||
| 424 | } | ||
| 425 | #endif | ||
| 426 | |||
| 427 | // 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 | ||
| 428 | |||
| 429 | char buf[40]; | ||
| 430 | snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); | ||
| 431 | matrix_write_P(&matrix, PSTR("\n\nLayer: ")); | ||
| 432 | switch (layer_state) { | ||
| 433 | case _BASE: | ||
| 434 | matrix_write_P(&matrix, PSTR("Default")); | ||
| 435 | break; | ||
| 436 | case _RAISE: | ||
| 437 | matrix_write_P(&matrix, PSTR("Raise")); | ||
| 438 | break; | ||
| 439 | case _LOWER: | ||
| 440 | matrix_write_P(&matrix, PSTR("Lower")); | ||
| 441 | break; | ||
| 442 | case _ADJUST: | ||
| 443 | matrix_write_P(&matrix, PSTR("ADJUST")); | ||
| 444 | break; | ||
| 445 | default: | ||
| 446 | matrix_write(&matrix, buf); | ||
| 447 | } | ||
| 448 | |||
| 449 | // Host Keyboard LED Status | ||
| 450 | char led[40]; | ||
| 451 | snprintf(led, sizeof(led), "\n%s %s %s", | ||
| 452 | (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", | ||
| 453 | (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", | ||
| 454 | (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); | ||
| 455 | matrix_write(&matrix, led); | ||
| 456 | matrix_update(&display, &matrix); | ||
| 457 | } | 312 | } |
| 458 | 313 | ||
| 459 | void iota_gfx_task(void) { | 314 | void iota_gfx_task(void) { |
| 460 | render_status_info(); | 315 | iota_gfx_task_user(); |
| 461 | 316 | ||
| 462 | if (display.dirty) { | 317 | if (display.dirty) { |
| 463 | iota_gfx_flush(); | 318 | 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 @@ | |||
| 1 | #ifndef SSD1306_H | ||
| 2 | #define SSD1306_H | ||
| 3 | |||
| 4 | #include <stdbool.h> | ||
| 5 | #include <stdio.h> | ||
| 6 | #include "pincontrol.h" | ||
| 7 | #include "config.h" | ||
| 8 | |||
| 9 | enum ssd1306_cmds { | ||
| 10 | DisplayOff = 0xAE, | ||
| 11 | DisplayOn = 0xAF, | ||
| 12 | |||
| 13 | SetContrast = 0x81, | ||
| 14 | DisplayAllOnResume = 0xA4, | ||
| 15 | |||
| 16 | DisplayAllOn = 0xA5, | ||
| 17 | NormalDisplay = 0xA6, | ||
| 18 | InvertDisplay = 0xA7, | ||
| 19 | SetDisplayOffset = 0xD3, | ||
| 20 | SetComPins = 0xda, | ||
| 21 | SetVComDetect = 0xdb, | ||
| 22 | SetDisplayClockDiv = 0xD5, | ||
| 23 | SetPreCharge = 0xd9, | ||
| 24 | SetMultiPlex = 0xa8, | ||
| 25 | SetLowColumn = 0x00, | ||
| 26 | SetHighColumn = 0x10, | ||
| 27 | SetStartLine = 0x40, | ||
| 28 | |||
| 29 | SetMemoryMode = 0x20, | ||
| 30 | ColumnAddr = 0x21, | ||
| 31 | PageAddr = 0x22, | ||
| 32 | |||
| 33 | ComScanInc = 0xc0, | ||
| 34 | ComScanDec = 0xc8, | ||
| 35 | SegRemap = 0xa0, | ||
| 36 | SetChargePump = 0x8d, | ||
| 37 | ExternalVcc = 0x01, | ||
| 38 | SwitchCapVcc = 0x02, | ||
| 39 | |||
| 40 | ActivateScroll = 0x2f, | ||
| 41 | DeActivateScroll = 0x2e, | ||
| 42 | SetVerticalScrollArea = 0xa3, | ||
| 43 | RightHorizontalScroll = 0x26, | ||
| 44 | LeftHorizontalScroll = 0x27, | ||
| 45 | VerticalAndRightHorizontalScroll = 0x29, | ||
| 46 | VerticalAndLeftHorizontalScroll = 0x2a, | ||
| 47 | }; | ||
| 48 | |||
| 49 | // Controls the SSD1306 128x32 OLED display via i2c | ||
| 50 | |||
| 51 | #ifndef SSD1306_ADDRESS | ||
| 52 | #define SSD1306_ADDRESS 0x3C | ||
| 53 | #endif | ||
| 54 | |||
| 55 | #define DisplayHeight 32 | ||
| 56 | #define DisplayWidth 128 | ||
| 57 | |||
| 58 | #define FontHeight 8 | ||
| 59 | #define FontWidth 6 | ||
| 60 | |||
| 61 | #define MatrixRows (DisplayHeight / FontHeight) | ||
| 62 | #define MatrixCols (DisplayWidth / FontWidth) | ||
| 63 | |||
| 64 | struct CharacterMatrix { | ||
| 65 | uint8_t display[MatrixRows][MatrixCols]; | ||
| 66 | uint8_t *cursor; | ||
| 67 | bool dirty; | ||
| 68 | }; | ||
| 69 | |||
| 70 | struct CharacterMatrix display; | ||
| 71 | |||
| 72 | bool iota_gfx_init(void); | ||
| 73 | void iota_gfx_task(void); | ||
| 74 | bool iota_gfx_off(void); | ||
| 75 | bool iota_gfx_on(void); | ||
| 76 | void iota_gfx_flush(void); | ||
| 77 | void iota_gfx_write_char(uint8_t c); | ||
| 78 | void iota_gfx_write(const char *data); | ||
| 79 | void iota_gfx_write_P(const char *data); | ||
| 80 | void iota_gfx_clear_screen(void); | ||
| 81 | |||
| 82 | void iota_gfx_task_user(void); | ||
| 83 | |||
| 84 | void matrix_clear(struct CharacterMatrix *matrix); | ||
| 85 | void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c); | ||
| 86 | void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c); | ||
| 87 | void matrix_write(struct CharacterMatrix *matrix, const char *data); | ||
| 88 | void matrix_write_P(struct CharacterMatrix *matrix, const char *data); | ||
| 89 | void matrix_render(struct CharacterMatrix *matrix); | ||
| 90 | |||
| 91 | |||
| 92 | |||
| 93 | #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 @@ | |||
| 21 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 21 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | #include "light_ws2812.h" | 24 | #include "ws2812.h" |
| 25 | #include <avr/interrupt.h> | 25 | #include <avr/interrupt.h> |
| 26 | #include <avr/io.h> | 26 | #include <avr/io.h> |
| 27 | #include <util/delay.h> | 27 | #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 = { | |||
| 22 | 400000 // clock speed (Hz); 400kHz max for IS31 | 22 | 400000 // clock speed (Hz); 400kHz max for IS31 |
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | #define GDISP_SCREEN_WIDTH 7 | ||
| 26 | #define GDISP_SCREEN_HEIGHT 7 | ||
| 27 | |||
| 28 | static const uint8_t led_mask[] = { | 25 | static const uint8_t led_mask[] = { |
| 29 | 0xFF, 0x00, /* C1-1 -> C1-16 */ | 26 | 0xFF, 0x00, /* C1-1 -> C1-16 */ |
| 30 | 0xFF, 0x00, /* C2-1 -> C2-16 */ | 27 | 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 @@ | |||
| 1 | GFXINC += drivers/ugfx/gdisp/is31fl3731c | ||
| 2 | GFXSRC += drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c | ||
| 3 | GDISP_DRIVER_LIST += GDISPVMT_IS31FL3731C_QMK \ No newline at end of file | ||
diff --git a/keyboards/whitefox/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c b/drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c index c807cbd1e..917adadb8 100644 --- a/keyboards/whitefox/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/>. | |||
| 19 | 19 | ||
| 20 | #if GFX_USE_GDISP | 20 | #if GFX_USE_GDISP |
| 21 | 21 | ||
| 22 | #define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_WHITEFOX | 22 | #define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_QMK |
| 23 | #include "drivers/gdisp/IS31FL3731C/gdisp_lld_config.h" | 23 | #define GDISP_SCREEN_HEIGHT LED_HEIGHT |
| 24 | #define GDISP_SCREEN_WIDTH LED_WIDTH | ||
| 25 | |||
| 26 | #include "gdisp_lld_config.h" | ||
| 24 | #include "src/gdisp/gdisp_driver.h" | 27 | #include "src/gdisp/gdisp_driver.h" |
| 25 | 28 | ||
| 26 | #include "board_IS31FL3731C.h" | 29 | #include "board_is31fl3731c.h" |
| 27 | 30 | ||
| 28 | 31 | ||
| 29 | // Can't include led_tables from here | 32 | // Can't include led_tables from here |
| @@ -33,27 +36,21 @@ extern const uint8_t CIE1931_CURVE[]; | |||
| 33 | /* Driver local definitions. */ | 36 | /* Driver local definitions. */ |
| 34 | /*===========================================================================*/ | 37 | /*===========================================================================*/ |
| 35 | 38 | ||
| 36 | #ifndef GDISP_SCREEN_HEIGHT | ||
| 37 | #define GDISP_SCREEN_HEIGHT 9 | ||
| 38 | #endif | ||
| 39 | #ifndef GDISP_SCREEN_WIDTH | ||
| 40 | #define GDISP_SCREEN_WIDTH 16 | ||
| 41 | #endif | ||
| 42 | #ifndef GDISP_INITIAL_CONTRAST | 39 | #ifndef GDISP_INITIAL_CONTRAST |
| 43 | #define GDISP_INITIAL_CONTRAST 0 | 40 | #define GDISP_INITIAL_CONTRAST 0 |
| 44 | #endif | 41 | #endif |
| 45 | #ifndef GDISP_INITIAL_BACKLIGHT | 42 | #ifndef GDISP_INITIAL_BACKLIGHT |
| 46 | #define GDISP_INITIAL_BACKLIGHT 0 | 43 | #define GDISP_INITIAL_BACKLIGHT 0 |
| 47 | #endif | 44 | #endif |
| 48 | 45 | ||
| 49 | #define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0) | 46 | #define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0) |
| 50 | 47 | ||
| 51 | #define IS31_ADDR_DEFAULT 0x74 | 48 | #define IS31_ADDR_DEFAULT 0x74 |
| 52 | 49 | ||
| 53 | #define IS31_REG_CONFIG 0x00 | 50 | #define IS31_REG_CONFIG 0x00 |
| 54 | // bits in reg | 51 | // bits in reg |
| 55 | #define IS31_REG_CONFIG_PICTUREMODE 0x00 | 52 | #define IS31_REG_CONFIG_PICTUREMODE 0x00 |
| 56 | #define IS31_REG_CONFIG_AUTOPLAYMODE 0x08 | 53 | #define IS31_REG_CONFIG_AUTOPLAYMODE 0x08 |
| 57 | #define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18 | 54 | #define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18 |
| 58 | // D2:D0 bits are starting frame for autoplay mode | 55 | // D2:D0 bits are starting frame for autoplay mode |
| 59 | 56 | ||
| @@ -100,7 +97,6 @@ extern const uint8_t CIE1931_CURVE[]; | |||
| 100 | #define IS31_PWM_SIZE 0x90 | 97 | #define IS31_PWM_SIZE 0x90 |
| 101 | 98 | ||
| 102 | #define IS31_LED_MASK_SIZE 0x12 | 99 | #define IS31_LED_MASK_SIZE 0x12 |
| 103 | #define IS31_SCREEN_WIDTH 16 | ||
| 104 | 100 | ||
| 105 | #define IS31 | 101 | #define IS31 |
| 106 | 102 | ||
| @@ -144,14 +140,14 @@ static GFXINLINE void write_ram(GDisplay *g, uint8_t page, uint16_t offset, uint | |||
| 144 | } | 140 | } |
| 145 | 141 | ||
| 146 | LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { | 142 | LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { |
| 147 | // The private area is the display surface. | 143 | // The private area is the display surface. |
| 148 | g->priv = gfxAlloc(sizeof(PrivData)); | 144 | g->priv = gfxAlloc(sizeof(PrivData)); |
| 149 | __builtin_memset(PRIV(g), 0, sizeof(PrivData)); | 145 | __builtin_memset(PRIV(g), 0, sizeof(PrivData)); |
| 150 | PRIV(g)->page = 0; | 146 | PRIV(g)->page = 0; |
| 151 | 147 | ||
| 152 | // Initialise the board interface | 148 | // Initialise the board interface |
| 153 | init_board(g); | 149 | init_board(g); |
| 154 | gfxSleepMilliseconds(10); | 150 | gfxSleepMilliseconds(10); |
| 155 | 151 | ||
| 156 | // zero function page, all registers (assuming full_page is all zeroes) | 152 | // zero function page, all registers (assuming full_page is all zeroes) |
| 157 | write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE); | 153 | write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE); |
| @@ -179,134 +175,134 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { | |||
| 179 | // Finish Init | 175 | // Finish Init |
| 180 | post_init_board(g); | 176 | post_init_board(g); |
| 181 | 177 | ||
| 182 | /* Initialise the GDISP structure */ | 178 | /* Initialise the GDISP structure */ |
| 183 | g->g.Width = GDISP_SCREEN_WIDTH; | 179 | g->g.Width = GDISP_SCREEN_WIDTH; |
| 184 | g->g.Height = GDISP_SCREEN_HEIGHT; | 180 | g->g.Height = GDISP_SCREEN_HEIGHT; |
| 185 | g->g.Orientation = GDISP_ROTATE_0; | 181 | g->g.Orientation = GDISP_ROTATE_0; |
| 186 | g->g.Powermode = powerOff; | 182 | g->g.Powermode = powerOff; |
| 187 | g->g.Backlight = GDISP_INITIAL_BACKLIGHT; | 183 | g->g.Backlight = GDISP_INITIAL_BACKLIGHT; |
| 188 | g->g.Contrast = GDISP_INITIAL_CONTRAST; | 184 | g->g.Contrast = GDISP_INITIAL_CONTRAST; |
| 189 | return TRUE; | 185 | return TRUE; |
| 190 | } | 186 | } |
| 191 | 187 | ||
| 192 | #if GDISP_HARDWARE_FLUSH | 188 | #if GDISP_HARDWARE_FLUSH |
| 193 | LLDSPEC void gdisp_lld_flush(GDisplay *g) { | 189 | LLDSPEC void gdisp_lld_flush(GDisplay *g) { |
| 194 | // Don't flush if we don't need it. | 190 | // Don't flush if we don't need it. |
| 195 | if (!(g->flags & GDISP_FLG_NEEDFLUSH)) | 191 | if (!(g->flags & GDISP_FLG_NEEDFLUSH)) |
| 196 | return; | 192 | return; |
| 197 | 193 | ||
| 198 | PRIV(g)->page++; | 194 | PRIV(g)->page++; |
| 199 | PRIV(g)->page %= 2; | 195 | PRIV(g)->page %= 2; |
| 200 | // TODO: some smarter algorithm for this | 196 | // TODO: some smarter algorithm for this |
| 201 | // We should run only one physical page at a time | 197 | // We should run only one physical page at a time |
| 202 | // This way we don't need to send so much data, and | 198 | // This way we don't need to send so much data, and |
| 203 | // we could use slightly less memory | 199 | // we could use slightly less memory |
| 204 | uint8_t* src = PRIV(g)->frame_buffer; | 200 | uint8_t* src = PRIV(g)->frame_buffer; |
| 205 | for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) { | 201 | for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) { |
| 206 | for (int x=0;x<GDISP_SCREEN_WIDTH;x++) { | 202 | for (int x=0;x<GDISP_SCREEN_WIDTH;x++) { |
| 207 | uint8_t val = (uint16_t)*src * g->g.Backlight / 100; | 203 | uint8_t val = (uint16_t)*src * g->g.Backlight / 100; |
| 208 | PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val]; | 204 | PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val]; |
| 209 | ++src; | 205 | ++src; |
| 210 | } | 206 | } |
| 211 | } | 207 | } |
| 212 | write_ram(g, PRIV(g)->page, IS31_PWM_REG, IS31_PWM_SIZE); | 208 | write_ram(g, PRIV(g)->page, IS31_PWM_REG, IS31_PWM_SIZE); |
| 213 | gfxSleepMilliseconds(1); | 209 | gfxSleepMilliseconds(1); |
| 214 | write_register(g, IS31_FUNCTIONREG, IS31_REG_PICTDISP, PRIV(g)->page); | 210 | write_register(g, IS31_FUNCTIONREG, IS31_REG_PICTDISP, PRIV(g)->page); |
| 215 | 211 | ||
| 216 | g->flags &= ~GDISP_FLG_NEEDFLUSH; | 212 | g->flags &= ~GDISP_FLG_NEEDFLUSH; |
| 217 | } | 213 | } |
| 218 | #endif | 214 | #endif |
| 219 | 215 | ||
| 220 | #if GDISP_HARDWARE_DRAWPIXEL | 216 | #if GDISP_HARDWARE_DRAWPIXEL |
| 221 | LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) { | 217 | LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) { |
| 222 | coord_t x, y; | 218 | coord_t x, y; |
| 223 | 219 | ||
| 224 | switch(g->g.Orientation) { | 220 | switch(g->g.Orientation) { |
| 225 | default: | 221 | default: |
| 226 | case GDISP_ROTATE_0: | 222 | case GDISP_ROTATE_0: |
| 227 | x = g->p.x; | 223 | x = g->p.x; |
| 228 | y = g->p.y; | 224 | y = g->p.y; |
| 229 | break; | 225 | break; |
| 230 | case GDISP_ROTATE_180: | 226 | case GDISP_ROTATE_180: |
| 231 | x = GDISP_SCREEN_WIDTH-1 - g->p.x; | 227 | x = GDISP_SCREEN_WIDTH-1 - g->p.x; |
| 232 | y = g->p.y; | 228 | y = g->p.y; |
| 233 | break; | 229 | break; |
| 234 | } | 230 | } |
| 235 | PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color); | 231 | PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color); |
| 236 | g->flags |= GDISP_FLG_NEEDFLUSH; | 232 | g->flags |= GDISP_FLG_NEEDFLUSH; |
| 237 | } | 233 | } |
| 238 | #endif | 234 | #endif |
| 239 | 235 | ||
| 240 | #if GDISP_HARDWARE_PIXELREAD | 236 | #if GDISP_HARDWARE_PIXELREAD |
| 241 | LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { | 237 | LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { |
| 242 | coord_t x, y; | 238 | coord_t x, y; |
| 243 | 239 | ||
| 244 | switch(g->g.Orientation) { | 240 | switch(g->g.Orientation) { |
| 245 | default: | 241 | default: |
| 246 | case GDISP_ROTATE_0: | 242 | case GDISP_ROTATE_0: |
| 247 | x = g->p.x; | 243 | x = g->p.x; |
| 248 | y = g->p.y; | 244 | y = g->p.y; |
| 249 | break; | 245 | break; |
| 250 | case GDISP_ROTATE_180: | 246 | case GDISP_ROTATE_180: |
| 251 | x = GDISP_SCREEN_WIDTH-1 - g->p.x; | 247 | x = GDISP_SCREEN_WIDTH-1 - g->p.x; |
| 252 | y = g->p.y; | 248 | y = g->p.y; |
| 253 | break; | 249 | break; |
| 254 | } | 250 | } |
| 255 | return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]); | 251 | return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]); |
| 256 | } | 252 | } |
| 257 | #endif | 253 | #endif |
| 258 | 254 | ||
| 259 | #if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL | 255 | #if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL |
| 260 | LLDSPEC void gdisp_lld_control(GDisplay *g) { | 256 | LLDSPEC void gdisp_lld_control(GDisplay *g) { |
| 261 | switch(g->p.x) { | 257 | switch(g->p.x) { |
| 262 | case GDISP_CONTROL_POWER: | 258 | case GDISP_CONTROL_POWER: |
| 263 | if (g->g.Powermode == (powermode_t)g->p.ptr) | 259 | if (g->g.Powermode == (powermode_t)g->p.ptr) |
| 264 | return; | 260 | return; |
| 265 | switch((powermode_t)g->p.ptr) { | 261 | switch((powermode_t)g->p.ptr) { |
| 266 | case powerOff: | 262 | case powerOff: |
| 267 | case powerSleep: | 263 | case powerSleep: |
| 268 | case powerDeepSleep: | 264 | case powerDeepSleep: |
| 269 | write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF); | 265 | write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF); |
| 270 | break; | 266 | break; |
| 271 | case powerOn: | 267 | case powerOn: |
| 272 | write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON); | 268 | write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON); |
| 273 | break; | 269 | break; |
| 274 | default: | 270 | default: |
| 275 | return; | 271 | return; |
| 276 | } | 272 | } |
| 277 | g->g.Powermode = (powermode_t)g->p.ptr; | 273 | g->g.Powermode = (powermode_t)g->p.ptr; |
| 278 | return; | 274 | return; |
| 279 | 275 | ||
| 280 | case GDISP_CONTROL_ORIENTATION: | 276 | case GDISP_CONTROL_ORIENTATION: |
| 281 | if (g->g.Orientation == (orientation_t)g->p.ptr) | 277 | if (g->g.Orientation == (orientation_t)g->p.ptr) |
| 282 | return; | 278 | return; |
| 283 | switch((orientation_t)g->p.ptr) { | 279 | switch((orientation_t)g->p.ptr) { |
| 284 | /* Rotation is handled by the drawing routines */ | 280 | /* Rotation is handled by the drawing routines */ |
| 285 | case GDISP_ROTATE_0: | 281 | case GDISP_ROTATE_0: |
| 286 | case GDISP_ROTATE_180: | 282 | case GDISP_ROTATE_180: |
| 287 | g->g.Height = GDISP_SCREEN_HEIGHT; | 283 | g->g.Height = GDISP_SCREEN_HEIGHT; |
| 288 | g->g.Width = GDISP_SCREEN_WIDTH; | 284 | g->g.Width = GDISP_SCREEN_WIDTH; |
| 289 | break; | 285 | break; |
| 290 | case GDISP_ROTATE_90: | 286 | case GDISP_ROTATE_90: |
| 291 | case GDISP_ROTATE_270: | 287 | case GDISP_ROTATE_270: |
| 292 | g->g.Height = GDISP_SCREEN_WIDTH; | 288 | g->g.Height = GDISP_SCREEN_WIDTH; |
| 293 | g->g.Width = GDISP_SCREEN_HEIGHT; | 289 | g->g.Width = GDISP_SCREEN_HEIGHT; |
| 294 | break; | 290 | break; |
| 295 | default: | 291 | default: |
| 296 | return; | ||
| 297 | } | ||
| 298 | g->g.Orientation = (orientation_t)g->p.ptr; | ||
| 299 | return; | ||
| 300 | |||
| 301 | case GDISP_CONTROL_BACKLIGHT: | ||
| 302 | if (g->g.Backlight == (unsigned)g->p.ptr) | ||
| 303 | return; | 292 | return; |
| 304 | unsigned val = (unsigned)g->p.ptr; | 293 | } |
| 305 | g->g.Backlight = val > 100 ? 100 : val; | 294 | g->g.Orientation = (orientation_t)g->p.ptr; |
| 295 | return; | ||
| 296 | |||
| 297 | case GDISP_CONTROL_BACKLIGHT: | ||
| 298 | if (g->g.Backlight == (unsigned)g->p.ptr) | ||
| 299 | return; | ||
| 300 | unsigned val = (unsigned)g->p.ptr; | ||
| 301 | g->g.Backlight = val > 100 ? 100 : val; | ||
| 306 | g->flags |= GDISP_FLG_NEEDFLUSH; | 302 | g->flags |= GDISP_FLG_NEEDFLUSH; |
| 307 | return; | 303 | return; |
| 308 | } | 304 | } |
| 309 | } | 305 | } |
| 310 | #endif // GDISP_NEED_CONTROL | 306 | #endif // GDISP_NEED_CONTROL |
| 311 | 307 | ||
| 312 | #endif // GFX_USE_GDISP | 308 | #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/>. | |||
| 24 | /* Driver hardware support. */ | 24 | /* Driver hardware support. */ |
| 25 | /*===========================================================================*/ | 25 | /*===========================================================================*/ |
| 26 | 26 | ||
| 27 | #define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing | 27 | #define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing |
| 28 | #define GDISP_HARDWARE_DRAWPIXEL TRUE | 28 | #define GDISP_HARDWARE_DRAWPIXEL TRUE |
| 29 | #define GDISP_HARDWARE_PIXELREAD TRUE | 29 | #define GDISP_HARDWARE_PIXELREAD TRUE |
| 30 | #define GDISP_HARDWARE_CONTROL TRUE | 30 | #define GDISP_HARDWARE_CONTROL TRUE |
| 31 | 31 | ||
| 32 | #define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256 | 32 | #define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256 |
| 33 | 33 | ||
| 34 | #endif /* GFX_USE_GDISP */ | 34 | #endif /* GFX_USE_GDISP */ |
| 35 | 35 | ||
| 36 | #endif /* _GDISP_LLD_CONFIG_H */ | 36 | #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) { | |||
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | static GFXINLINE void post_init_board(GDisplay *g) { | 85 | static GFXINLINE void post_init_board(GDisplay *g) { |
| 86 | (void) g; | 86 | (void) g; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { | 89 | static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { |
| @@ -106,8 +106,8 @@ static GFXINLINE void enter_cmd_mode(GDisplay *g) { | |||
| 106 | 106 | ||
| 107 | 107 | ||
| 108 | static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) { | 108 | static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) { |
| 109 | (void) g; | 109 | (void) g; |
| 110 | spiSend(&SPID1, length, data); | 110 | spiSend(&SPID1, length, data); |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | #endif /* _GDISP_LLD_BOARD_H */ | 113 | #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 @@ | |||
| 1 | GFXINC += drivers/ugfx/gdisp/st7565 | ||
| 2 | GFXSRC += drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c | ||
| 3 | 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 @@ | |||
| 9 | 9 | ||
| 10 | #if GFX_USE_GDISP | 10 | #if GFX_USE_GDISP |
| 11 | 11 | ||
| 12 | #define GDISP_DRIVER_VMT GDISPVMT_ST7565_ERGODOX | 12 | #define GDISP_DRIVER_VMT GDISPVMT_ST7565_QMK |
| 13 | #include "drivers/gdisp/st7565ergodox/gdisp_lld_config.h" | 13 | #include "gdisp_lld_config.h" |
| 14 | #include "src/gdisp/gdisp_driver.h" | 14 | #include "src/gdisp/gdisp_driver.h" |
| 15 | 15 | ||
| 16 | #include "board_ST7565.h" | 16 | #include "board_st7565.h" |
| 17 | 17 | ||
| 18 | /*===========================================================================*/ | 18 | /*===========================================================================*/ |
| 19 | /* Driver local definitions. */ | 19 | /* Driver local definitions. */ |
| 20 | /*===========================================================================*/ | 20 | /*===========================================================================*/ |
| 21 | 21 | ||
| 22 | #ifndef GDISP_SCREEN_HEIGHT | 22 | #ifndef GDISP_SCREEN_HEIGHT |
| 23 | #define GDISP_SCREEN_HEIGHT 32 | 23 | #define GDISP_SCREEN_HEIGHT LCD_HEIGHT |
| 24 | #endif | 24 | #endif |
| 25 | #ifndef GDISP_SCREEN_WIDTH | 25 | #ifndef GDISP_SCREEN_WIDTH |
| 26 | #define GDISP_SCREEN_WIDTH 128 | 26 | #define GDISP_SCREEN_WIDTH LCD_WIDTH |
| 27 | #endif | 27 | #endif |
| 28 | #ifndef GDISP_INITIAL_CONTRAST | 28 | #ifndef GDISP_INITIAL_CONTRAST |
| 29 | #define GDISP_INITIAL_CONTRAST 35 | 29 | #define GDISP_INITIAL_CONTRAST 35 |
| 30 | #endif | 30 | #endif |
| 31 | #ifndef GDISP_INITIAL_BACKLIGHT | 31 | #ifndef GDISP_INITIAL_BACKLIGHT |
| 32 | #define GDISP_INITIAL_BACKLIGHT 100 | 32 | #define GDISP_INITIAL_BACKLIGHT 100 |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | #define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0) | 35 | #define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0) |
| 36 | 36 | ||
| 37 | #include "drivers/gdisp/st7565ergodox/st7565.h" | 37 | #include "st7565.h" |
| 38 | 38 | ||
| 39 | /*===========================================================================*/ | 39 | /*===========================================================================*/ |
| 40 | /* Driver config defaults for backward compatibility. */ | 40 | /* Driver config defaults for backward compatibility. */ |
| 41 | /*===========================================================================*/ | 41 | /*===========================================================================*/ |
| 42 | #ifndef ST7565_LCD_BIAS | 42 | #ifndef ST7565_LCD_BIAS |
| 43 | #define ST7565_LCD_BIAS ST7565_LCD_BIAS_7 | 43 | #define ST7565_LCD_BIAS ST7565_LCD_BIAS_7 |
| @@ -65,7 +65,7 @@ typedef struct{ | |||
| 65 | 65 | ||
| 66 | // Some common routines and macros | 66 | // Some common routines and macros |
| 67 | #define PRIV(g) ((PrivData*)g->priv) | 67 | #define PRIV(g) ((PrivData*)g->priv) |
| 68 | #define RAM(g) (PRIV(g)->ram) | 68 | #define RAM(g) (PRIV(g)->ram) |
| 69 | 69 | ||
| 70 | static GFXINLINE void write_cmd(GDisplay* g, uint8_t cmd) { | 70 | static GFXINLINE void write_cmd(GDisplay* g, uint8_t cmd) { |
| 71 | PRIV(g)->data[PRIV(g)->data_pos++] = cmd; | 71 | PRIV(g)->data[PRIV(g)->data_pos++] = cmd; |
| @@ -76,15 +76,15 @@ static GFXINLINE void flush_cmd(GDisplay* g) { | |||
| 76 | PRIV(g)->data_pos = 0; | 76 | PRIV(g)->data_pos = 0; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | #define write_cmd2(g, cmd1, cmd2) { write_cmd(g, cmd1); write_cmd(g, cmd2); } | 79 | #define write_cmd2(g, cmd1, cmd2) { write_cmd(g, cmd1); write_cmd(g, cmd2); } |
| 80 | #define write_cmd3(g, cmd1, cmd2, cmd3) { write_cmd(g, cmd1); write_cmd(g, cmd2); write_cmd(g, cmd3); } | 80 | #define write_cmd3(g, cmd1, cmd2, cmd3) { write_cmd(g, cmd1); write_cmd(g, cmd2); write_cmd(g, cmd3); } |
| 81 | 81 | ||
| 82 | // Some common routines and macros | 82 | // Some common routines and macros |
| 83 | #define delay(us) gfxSleepMicroseconds(us) | 83 | #define delay(us) gfxSleepMicroseconds(us) |
| 84 | #define delay_ms(ms) gfxSleepMilliseconds(ms) | 84 | #define delay_ms(ms) gfxSleepMilliseconds(ms) |
| 85 | 85 | ||
| 86 | #define xyaddr(x, y) ((x) + ((y)>>3)*GDISP_SCREEN_WIDTH) | 86 | #define xyaddr(x, y) ((x) + ((y)>>3)*GDISP_SCREEN_WIDTH) |
| 87 | #define xybit(y) (1<<((y)&7)) | 87 | #define xybit(y) (1<<((y)&7)) |
| 88 | 88 | ||
| 89 | /*===========================================================================*/ | 89 | /*===========================================================================*/ |
| 90 | /* Driver exported functions. */ | 90 | /* Driver exported functions. */ |
| @@ -150,7 +150,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { | |||
| 150 | 150 | ||
| 151 | #if GDISP_HARDWARE_FLUSH | 151 | #if GDISP_HARDWARE_FLUSH |
| 152 | LLDSPEC void gdisp_lld_flush(GDisplay *g) { | 152 | LLDSPEC void gdisp_lld_flush(GDisplay *g) { |
| 153 | unsigned p; | 153 | unsigned p; |
| 154 | 154 | ||
| 155 | // Don't flush if we don't need it. | 155 | // Don't flush if we don't need it. |
| 156 | if (!(g->flags & GDISP_FLG_NEEDFLUSH)) | 156 | if (!(g->flags & GDISP_FLG_NEEDFLUSH)) |
| @@ -181,7 +181,7 @@ LLDSPEC void gdisp_lld_flush(GDisplay *g) { | |||
| 181 | 181 | ||
| 182 | #if GDISP_HARDWARE_DRAWPIXEL | 182 | #if GDISP_HARDWARE_DRAWPIXEL |
| 183 | LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) { | 183 | LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) { |
| 184 | coord_t x, y; | 184 | coord_t x, y; |
| 185 | 185 | ||
| 186 | switch(g->g.Orientation) { | 186 | switch(g->g.Orientation) { |
| 187 | default: | 187 | default: |
| @@ -212,7 +212,7 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) { | |||
| 212 | 212 | ||
| 213 | #if GDISP_HARDWARE_PIXELREAD | 213 | #if GDISP_HARDWARE_PIXELREAD |
| 214 | LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { | 214 | LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { |
| 215 | coord_t x, y; | 215 | coord_t x, y; |
| 216 | 216 | ||
| 217 | switch(g->g.Orientation) { | 217 | switch(g->g.Orientation) { |
| 218 | default: | 218 | default: |
| @@ -257,7 +257,7 @@ LLDSPEC void gdisp_lld_blit_area(GDisplay *g) { | |||
| 257 | else { | 257 | else { |
| 258 | *dst &= ~xybit(dsty); | 258 | *dst &= ~xybit(dsty); |
| 259 | } | 259 | } |
| 260 | dstx++; | 260 | dstx++; |
| 261 | srcbit++; | 261 | srcbit++; |
| 262 | } | 262 | } |
| 263 | } | 263 | } |
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 @@ | |||
| 14 | /* Driver hardware support. */ | 14 | /* Driver hardware support. */ |
| 15 | /*===========================================================================*/ | 15 | /*===========================================================================*/ |
| 16 | 16 | ||
| 17 | #define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing | 17 | #define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing |
| 18 | #define GDISP_HARDWARE_DRAWPIXEL TRUE | 18 | #define GDISP_HARDWARE_DRAWPIXEL TRUE |
| 19 | #define GDISP_HARDWARE_PIXELREAD TRUE | 19 | #define GDISP_HARDWARE_PIXELREAD TRUE |
| 20 | #define GDISP_HARDWARE_CONTROL TRUE | 20 | #define GDISP_HARDWARE_CONTROL TRUE |
| @@ -22,6 +22,6 @@ | |||
| 22 | 22 | ||
| 23 | #define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO | 23 | #define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO |
| 24 | 24 | ||
| 25 | #endif /* GFX_USE_GDISP */ | 25 | #endif /* GFX_USE_GDISP */ |
| 26 | 26 | ||
| 27 | #endif /* _GDISP_LLD_CONFIG_H */ | 27 | #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/animations.h b/keyboards/ergodox/infinity/animations.h deleted file mode 100644 index 6d8b9830d..000000000 --- a/keyboards/ergodox/infinity/animations.h +++ /dev/null | |||
| @@ -1,30 +0,0 @@ | |||
| 1 | /* Copyright 2017 Fred Sundvik | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ | ||
| 18 | #define KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ | ||
| 19 | |||
| 20 | #include "visualizer.h" | ||
| 21 | |||
| 22 | // You can use these default animations, but of course you can also write your own custom ones instead | ||
| 23 | extern keyframe_animation_t default_startup_animation; | ||
| 24 | extern keyframe_animation_t default_suspend_animation; | ||
| 25 | |||
| 26 | // An animation for testing and demonstrating the led support, should probably not be used for real world | ||
| 27 | // cases | ||
| 28 | extern keyframe_animation_t led_test_animation; | ||
| 29 | |||
| 30 | #endif /* KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_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 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2016 Fred Sundvik <fsundvik@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef _GDISP_LLD_BOARD_H | ||
| 19 | #define _GDISP_LLD_BOARD_H | ||
| 20 | |||
| 21 | static const I2CConfig i2ccfg = { | ||
| 22 | 400000 // clock speed (Hz); 400kHz max for IS31 | ||
| 23 | }; | ||
| 24 | |||
| 25 | static const uint8_t led_mask[] = { | ||
| 26 | 0xFF, 0x00, /* C1-1 -> C1-16 */ | ||
| 27 | 0xFF, 0x00, /* C2-1 -> C2-16 */ | ||
| 28 | 0xFF, 0x00, /* C3-1 -> C3-16 */ | ||
| 29 | 0xFF, 0x00, /* C4-1 -> C4-16 */ | ||
| 30 | 0x3F, 0x00, /* C5-1 -> C5-16 */ | ||
| 31 | 0x00, 0x00, /* C6-1 -> C6-16 */ | ||
| 32 | 0x00, 0x00, /* C7-1 -> C7-16 */ | ||
| 33 | 0x00, 0x00, /* C8-1 -> C8-16 */ | ||
| 34 | 0x00, 0x00, /* C9-1 -> C9-16 */ | ||
| 35 | }; | ||
| 36 | |||
| 37 | // The address of the LED | ||
| 38 | #define LA(c, r) (c + r * 16 ) | ||
| 39 | // Need to be an address that is not mapped, but inside the range of the controller matrix | ||
| 40 | #define NA LA(8, 8) | ||
| 41 | |||
| 42 | // The numbers in the comments are the led numbers DXX on the PCB | ||
| 43 | // The mapping is taken from the schematic of left hand side | ||
| 44 | static const uint8_t led_mapping[GDISP_SCREEN_HEIGHT][GDISP_SCREEN_WIDTH] = { | ||
| 45 | // 45 44 43 42 41 40 39 | ||
| 46 | { LA(1, 1), LA(1, 0), LA(0, 4), LA(0, 3), LA(0, 2), LA(0, 1), LA(0, 0)}, | ||
| 47 | // 52 51 50 49 48 47 46 | ||
| 48 | { LA(2, 3), LA(2, 2), LA(2, 1), LA(2, 0), LA(1, 4), LA(1, 3), LA(1, 2) }, | ||
| 49 | // 58 57 56 55 54 53 N/A | ||
| 50 | { LA(3, 4), LA(3, 3), LA(3, 2), LA(3, 1), LA(3, 0), LA(2, 4), NA }, | ||
| 51 | // 67 66 65 64 63 62 61 | ||
| 52 | { LA(5, 3), LA(5, 2), LA(5, 1), LA(5, 0), LA(4, 4), LA(4, 3), LA(4, 2) }, | ||
| 53 | // 76 75 74 73 72 60 59 | ||
| 54 | { LA(7, 3), LA(7, 2), LA(7, 1), LA(7, 0), LA(6, 3), LA(4, 1), LA(4, 0) }, | ||
| 55 | // N/A N/A N/A N/A N/A N/A 68 | ||
| 56 | { NA, NA, NA, NA, NA, NA, LA(5, 4) }, | ||
| 57 | // N/A N/A N/A N/A 71 70 69 | ||
| 58 | { NA, NA, NA, NA, LA(6, 2), LA(6, 1), LA(6, 0) }, | ||
| 59 | }; | ||
| 60 | |||
| 61 | |||
| 62 | #define IS31_ADDR_DEFAULT 0x74 // AD connected to GND | ||
| 63 | #define IS31_TIMEOUT 5000 | ||
| 64 | |||
| 65 | static GFXINLINE void init_board(GDisplay *g) { | ||
| 66 | (void) g; | ||
| 67 | /* I2C pins */ | ||
| 68 | palSetPadMode(GPIOB, 0, PAL_MODE_ALTERNATIVE_2); // PTB0/I2C0/SCL | ||
| 69 | palSetPadMode(GPIOB, 1, PAL_MODE_ALTERNATIVE_2); // PTB1/I2C0/SDA | ||
| 70 | palSetPadMode(GPIOB, 16, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 71 | palClearPad(GPIOB, 16); | ||
| 72 | /* start I2C */ | ||
| 73 | i2cStart(&I2CD1, &i2ccfg); | ||
| 74 | // try high drive (from kiibohd) | ||
| 75 | I2CD1.i2c->C2 |= I2Cx_C2_HDRS; | ||
| 76 | // try glitch fixing (from kiibohd) | ||
| 77 | I2CD1.i2c->FLT = 4; | ||
| 78 | } | ||
| 79 | |||
| 80 | static GFXINLINE void post_init_board(GDisplay *g) { | ||
| 81 | (void) g; | ||
| 82 | } | ||
| 83 | |||
| 84 | static GFXINLINE const uint8_t* get_led_mask(GDisplay* g) { | ||
| 85 | (void) g; | ||
| 86 | return led_mask; | ||
| 87 | } | ||
| 88 | |||
| 89 | static GFXINLINE uint8_t get_led_address(GDisplay* g, uint16_t x, uint16_t y) | ||
| 90 | { | ||
| 91 | (void) g; | ||
| 92 | return led_mapping[y][x]; | ||
| 93 | } | ||
| 94 | |||
| 95 | static GFXINLINE void set_hardware_shutdown(GDisplay* g, bool shutdown) { | ||
| 96 | (void) g; | ||
| 97 | if(!shutdown) { | ||
| 98 | palSetPad(GPIOB, 16); | ||
| 99 | } | ||
| 100 | else { | ||
| 101 | palClearPad(GPIOB, 16); | ||
| 102 | } | ||
| 103 | } | ||
| 104 | |||
| 105 | static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) { | ||
| 106 | (void) g; | ||
| 107 | i2cMasterTransmitTimeout(&I2CD1, IS31_ADDR_DEFAULT, data, length, 0, 0, US2ST(IS31_TIMEOUT)); | ||
| 108 | } | ||
| 109 | |||
| 110 | #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 @@ | |||
| 1 | /* | ||
| 2 | * This file is subject to the terms of the GFX License. If a copy of | ||
| 3 | * the license was not distributed with this file, you can obtain one at: | ||
| 4 | * | ||
| 5 | * http://ugfx.org/license.html | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef _GDISP_LLD_BOARD_H | ||
| 9 | #define _GDISP_LLD_BOARD_H | ||
| 10 | |||
| 11 | #define ST7565_LCD_BIAS ST7565_LCD_BIAS_9 // actually 6 | ||
| 12 | #define ST7565_ADC ST7565_ADC_NORMAL | ||
| 13 | #define ST7565_COM_SCAN ST7565_COM_SCAN_DEC | ||
| 14 | #define ST7565_PAGE_ORDER 0,1,2,3 | ||
| 15 | /* | ||
| 16 | * Custom page order for several LCD boards, e.g. HEM12864-99 | ||
| 17 | * #define ST7565_PAGE_ORDER 4,5,6,7,0,1,2,3 | ||
| 18 | */ | ||
| 19 | |||
| 20 | #define ST7565_GPIOPORT GPIOC | ||
| 21 | #define ST7565_PORT PORTC | ||
| 22 | #define ST7565_A0_PIN 7 | ||
| 23 | #define ST7565_RST_PIN 8 | ||
| 24 | #define ST7565_MOSI_PIN 6 | ||
| 25 | #define ST7565_SLCK_PIN 5 | ||
| 26 | #define ST7565_SS_PIN 4 | ||
| 27 | |||
| 28 | #define palSetPadModeRaw(portname, bits) \ | ||
| 29 | ST7565_PORT->PCR[ST7565_##portname##_PIN] = bits | ||
| 30 | |||
| 31 | #define palSetPadModeNamed(portname, portmode) \ | ||
| 32 | palSetPadMode(ST7565_GPIOPORT, ST7565_##portname##_PIN, portmode) | ||
| 33 | |||
| 34 | #define ST7565_SPI_MODE PORTx_PCRn_DSE | PORTx_PCRn_MUX(2) | ||
| 35 | // DSPI Clock and Transfer Attributes | ||
| 36 | // Frame Size: 8 bits | ||
| 37 | // MSB First | ||
| 38 | // CLK Low by default | ||
| 39 | static const SPIConfig spi1config = { | ||
| 40 | // Operation complete callback or @p NULL. | ||
| 41 | .end_cb = NULL, | ||
| 42 | //The chip select line port - when not using pcs. | ||
| 43 | .ssport = ST7565_GPIOPORT, | ||
| 44 | // brief The chip select line pad number - when not using pcs. | ||
| 45 | .sspad=ST7565_SS_PIN, | ||
| 46 | // SPI initialization data. | ||
| 47 | .tar0 = | ||
| 48 | SPIx_CTARn_FMSZ(7) // Frame size = 8 bytes | ||
| 49 | | SPIx_CTARn_ASC(1) // After SCK Delay Scaler (min 50 ns) = 55.56ns | ||
| 50 | | SPIx_CTARn_DT(0) // Delay After Transfer Scaler (no minimum)= 27.78ns | ||
| 51 | | SPIx_CTARn_CSSCK(0) // PCS to SCK Delay Scaler (min 20 ns) = 27.78ns | ||
| 52 | | SPIx_CTARn_PBR(0) // Baud Rate Prescaler = 2 | ||
| 53 | | SPIx_CTARn_BR(0) // Baud rate (min 50ns) = 55.56ns | ||
| 54 | }; | ||
| 55 | |||
| 56 | static GFXINLINE void acquire_bus(GDisplay *g) { | ||
| 57 | (void) g; | ||
| 58 | // Only the LCD is using the SPI bus, so no need to acquire | ||
| 59 | // spiAcquireBus(&SPID1); | ||
| 60 | spiSelect(&SPID1); | ||
| 61 | } | ||
| 62 | |||
| 63 | static GFXINLINE void release_bus(GDisplay *g) { | ||
| 64 | (void) g; | ||
| 65 | // Only the LCD is using the SPI bus, so no need to release | ||
| 66 | //spiReleaseBus(&SPID1); | ||
| 67 | spiUnselect(&SPID1); | ||
| 68 | } | ||
| 69 | |||
| 70 | static GFXINLINE void init_board(GDisplay *g) { | ||
| 71 | (void) g; | ||
| 72 | palSetPadModeNamed(A0, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 73 | palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN); | ||
| 74 | palSetPadModeNamed(RST, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 75 | palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN); | ||
| 76 | palSetPadModeRaw(MOSI, ST7565_SPI_MODE); | ||
| 77 | palSetPadModeRaw(SLCK, ST7565_SPI_MODE); | ||
| 78 | palSetPadModeNamed(SS, PAL_MODE_OUTPUT_PUSHPULL); | ||
| 79 | |||
| 80 | spiInit(); | ||
| 81 | spiStart(&SPID1, &spi1config); | ||
| 82 | release_bus(g); | ||
| 83 | } | ||
| 84 | |||
| 85 | static GFXINLINE void post_init_board(GDisplay *g) { | ||
| 86 | (void) g; | ||
| 87 | } | ||
| 88 | |||
| 89 | static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { | ||
| 90 | (void) g; | ||
| 91 | if (state) { | ||
| 92 | palClearPad(ST7565_GPIOPORT, ST7565_RST_PIN); | ||
| 93 | } | ||
| 94 | else { | ||
| 95 | palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN); | ||
| 96 | } | ||
| 97 | } | ||
| 98 | |||
| 99 | static GFXINLINE void enter_data_mode(GDisplay *g) { | ||
| 100 | palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN); | ||
| 101 | } | ||
| 102 | |||
| 103 | static GFXINLINE void enter_cmd_mode(GDisplay *g) { | ||
| 104 | palClearPad(ST7565_GPIOPORT, ST7565_A0_PIN); | ||
| 105 | } | ||
| 106 | |||
| 107 | |||
| 108 | static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) { | ||
| 109 | (void) g; | ||
| 110 | spiSend(&SPID1, length, data); | ||
| 111 | } | ||
| 112 | |||
| 113 | #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/>. | |||
| 51 | 51 | ||
| 52 | #define SERIAL_LINK_BAUD 562500 | 52 | #define SERIAL_LINK_BAUD 562500 |
| 53 | #define SERIAL_LINK_THREAD_PRIORITY (NORMALPRIO - 1) | 53 | #define SERIAL_LINK_THREAD_PRIORITY (NORMALPRIO - 1) |
| 54 | // The visualizer needs gfx thread priorities | ||
| 55 | #define VISUALIZER_THREAD_PRIORITY (NORMAL_PRIORITY - 2) | ||
| 56 | 54 | ||
| 57 | #define VISUALIZER_USER_DATA_SIZE 16 | 55 | #define VISUALIZER_USER_DATA_SIZE 16 |
| 58 | 56 | ||
| 59 | #define LCD_DISPLAY_NUMBER 0 | ||
| 60 | #define LED_DISPLAY_NUMBER 1 | ||
| 61 | |||
| 62 | #define LED_NUM_ROWS 7 | ||
| 63 | #define LED_NUM_COLS 7 | ||
| 64 | /* | 57 | /* |
| 65 | * Feature disable options | 58 | * Feature disable options |
| 66 | * These options are also useful to firmware size reduction. | 59 | * 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 @@ | |||
| 1 | GFXINC += drivers/gdisp/IS31FL3731C | ||
| 2 | GFXSRC += drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c | ||
diff --git a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c b/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c deleted file mode 100644 index b4a5c84b0..000000000 --- a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c +++ /dev/null | |||
| @@ -1,312 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2016 Fred Sundvik <fsundvik@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "gfx.h" | ||
| 19 | |||
| 20 | #if GFX_USE_GDISP | ||
| 21 | |||
| 22 | #define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_ERGODOX | ||
| 23 | #include "drivers/gdisp/IS31FL3731C/gdisp_lld_config.h" | ||
| 24 | #include "src/gdisp/gdisp_driver.h" | ||
| 25 | |||
| 26 | #include "board_IS31FL3731C.h" | ||
| 27 | |||
| 28 | |||
| 29 | // Can't include led_tables from here | ||
| 30 | extern const uint8_t CIE1931_CURVE[]; | ||
| 31 | |||
| 32 | /*===========================================================================*/ | ||
| 33 | /* Driver local definitions. */ | ||
| 34 | /*===========================================================================*/ | ||
| 35 | |||
| 36 | #ifndef GDISP_SCREEN_HEIGHT | ||
| 37 | #define GDISP_SCREEN_HEIGHT 9 | ||
| 38 | #endif | ||
| 39 | #ifndef GDISP_SCREEN_WIDTH | ||
| 40 | #define GDISP_SCREEN_WIDTH 16 | ||
| 41 | #endif | ||
| 42 | #ifndef GDISP_INITIAL_CONTRAST | ||
| 43 | #define GDISP_INITIAL_CONTRAST 0 | ||
| 44 | #endif | ||
| 45 | #ifndef GDISP_INITIAL_BACKLIGHT | ||
| 46 | #define GDISP_INITIAL_BACKLIGHT 0 | ||
| 47 | #endif | ||
| 48 | |||
| 49 | #define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0) | ||
| 50 | |||
| 51 | #define IS31_ADDR_DEFAULT 0x74 | ||
| 52 | |||
| 53 | #define IS31_REG_CONFIG 0x00 | ||
| 54 | // bits in reg | ||
| 55 | #define IS31_REG_CONFIG_PICTUREMODE 0x00 | ||
| 56 | #define IS31_REG_CONFIG_AUTOPLAYMODE 0x08 | ||
| 57 | #define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18 | ||
| 58 | // D2:D0 bits are starting frame for autoplay mode | ||
| 59 | |||
| 60 | #define IS31_REG_PICTDISP 0x01 // D2:D0 frame select for picture mode | ||
| 61 | |||
| 62 | #define IS31_REG_AUTOPLAYCTRL1 0x02 | ||
| 63 | // D6:D4 number of loops (000=infty) | ||
| 64 | // D2:D0 number of frames to be used | ||
| 65 | |||
| 66 | #define IS31_REG_AUTOPLAYCTRL2 0x03 // D5:D0 delay time (*11ms) | ||
| 67 | |||
| 68 | #define IS31_REG_DISPLAYOPT 0x05 | ||
| 69 | #define IS31_REG_DISPLAYOPT_INTENSITY_SAME 0x20 // same intensity for all frames | ||
| 70 | #define IS31_REG_DISPLAYOPT_BLINK_ENABLE 0x8 | ||
| 71 | // D2:D0 bits blink period time (*0.27s) | ||
| 72 | |||
| 73 | #define IS31_REG_AUDIOSYNC 0x06 | ||
| 74 | #define IS31_REG_AUDIOSYNC_ENABLE 0x1 | ||
| 75 | |||
| 76 | #define IS31_REG_FRAMESTATE 0x07 | ||
| 77 | |||
| 78 | #define IS31_REG_BREATHCTRL1 0x08 | ||
| 79 | // D6:D4 fade out time (26ms*2^i) | ||
| 80 | // D2:D0 fade in time (26ms*2^i) | ||
| 81 | |||
| 82 | #define IS31_REG_BREATHCTRL2 0x09 | ||
| 83 | #define IS31_REG_BREATHCTRL2_ENABLE 0x10 | ||
| 84 | // D2:D0 extinguish time (3.5ms*2^i) | ||
| 85 | |||
| 86 | #define IS31_REG_SHUTDOWN 0x0A | ||
| 87 | #define IS31_REG_SHUTDOWN_OFF 0x0 | ||
| 88 | #define IS31_REG_SHUTDOWN_ON 0x1 | ||
| 89 | |||
| 90 | #define IS31_REG_AGCCTRL 0x0B | ||
| 91 | #define IS31_REG_ADCRATE 0x0C | ||
| 92 | |||
| 93 | #define IS31_COMMANDREGISTER 0xFD | ||
| 94 | #define IS31_FUNCTIONREG 0x0B // helpfully called 'page nine' | ||
| 95 | #define IS31_FUNCTIONREG_SIZE 0xD | ||
| 96 | |||
| 97 | #define IS31_FRAME_SIZE 0xB4 | ||
| 98 | |||
| 99 | #define IS31_PWM_REG 0x24 | ||
| 100 | #define IS31_PWM_SIZE 0x90 | ||
| 101 | |||
| 102 | #define IS31_LED_MASK_SIZE 0x12 | ||
| 103 | #define IS31_SCREEN_WIDTH 16 | ||
| 104 | |||
| 105 | #define IS31 | ||
| 106 | |||
| 107 | /*===========================================================================*/ | ||
| 108 | /* Driver local functions. */ | ||
| 109 | /*===========================================================================*/ | ||
| 110 | |||
| 111 | typedef struct{ | ||
| 112 | uint8_t write_buffer_offset; | ||
| 113 | uint8_t write_buffer[IS31_FRAME_SIZE]; | ||
| 114 | uint8_t frame_buffer[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH]; | ||
| 115 | uint8_t page; | ||
| 116 | }__attribute__((__packed__)) PrivData; | ||
| 117 | |||
| 118 | // Some common routines and macros | ||
| 119 | #define PRIV(g) ((PrivData*)g->priv) | ||
| 120 | |||
| 121 | /*===========================================================================*/ | ||
| 122 | /* Driver exported functions. */ | ||
| 123 | /*===========================================================================*/ | ||
| 124 | |||
| 125 | static GFXINLINE void write_page(GDisplay* g, uint8_t page) { | ||
| 126 | uint8_t tx[2] __attribute__((aligned(2))); | ||
| 127 | tx[0] = IS31_COMMANDREGISTER; | ||
| 128 | tx[1] = page; | ||
| 129 | write_data(g, tx, 2); | ||
| 130 | } | ||
| 131 | |||
| 132 | static GFXINLINE void write_register(GDisplay* g, uint8_t page, uint8_t reg, uint8_t data) { | ||
| 133 | uint8_t tx[2] __attribute__((aligned(2))); | ||
| 134 | tx[0] = reg; | ||
| 135 | tx[1] = data; | ||
| 136 | write_page(g, page); | ||
| 137 | write_data(g, tx, 2); | ||
| 138 | } | ||
| 139 | |||
| 140 | static GFXINLINE void write_ram(GDisplay *g, uint8_t page, uint16_t offset, uint16_t length) { | ||
| 141 | PRIV(g)->write_buffer_offset = offset; | ||
| 142 | write_page(g, page); | ||
| 143 | write_data(g, (uint8_t*)PRIV(g), length + 1); | ||
| 144 | } | ||
| 145 | |||
| 146 | LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { | ||
| 147 | // The private area is the display surface. | ||
| 148 | g->priv = gfxAlloc(sizeof(PrivData)); | ||
| 149 | __builtin_memset(PRIV(g), 0, sizeof(PrivData)); | ||
| 150 | PRIV(g)->page = 0; | ||
| 151 | |||
| 152 | // Initialise the board interface | ||
| 153 | init_board(g); | ||
| 154 | gfxSleepMilliseconds(10); | ||
| 155 | |||
| 156 | // zero function page, all registers (assuming full_page is all zeroes) | ||
| 157 | write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE); | ||
| 158 | set_hardware_shutdown(g, false); | ||
| 159 | gfxSleepMilliseconds(10); | ||
| 160 | // software shutdown | ||
| 161 | write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF); | ||
| 162 | gfxSleepMilliseconds(10); | ||
| 163 | // zero function page, all registers | ||
| 164 | write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE); | ||
| 165 | gfxSleepMilliseconds(10); | ||
| 166 | |||
| 167 | |||
| 168 | // zero all LED registers on all 8 pages, and enable the mask | ||
| 169 | __builtin_memcpy(PRIV(g)->write_buffer, get_led_mask(g), IS31_LED_MASK_SIZE); | ||
| 170 | for(uint8_t i=0; i<8; i++) { | ||
| 171 | write_ram(g, i, 0, IS31_FRAME_SIZE); | ||
| 172 | gfxSleepMilliseconds(1); | ||
| 173 | } | ||
| 174 | |||
| 175 | // software shutdown disable (i.e. turn stuff on) | ||
| 176 | write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF); | ||
| 177 | gfxSleepMilliseconds(10); | ||
| 178 | |||
| 179 | // Finish Init | ||
| 180 | post_init_board(g); | ||
| 181 | |||
| 182 | /* Initialise the GDISP structure */ | ||
| 183 | g->g.Width = GDISP_SCREEN_WIDTH; | ||
| 184 | g->g.Height = GDISP_SCREEN_HEIGHT; | ||
| 185 | g->g.Orientation = GDISP_ROTATE_0; | ||
| 186 | g->g.Powermode = powerOff; | ||
| 187 | g->g.Backlight = GDISP_INITIAL_BACKLIGHT; | ||
| 188 | g->g.Contrast = GDISP_INITIAL_CONTRAST; | ||
| 189 | return TRUE; | ||
| 190 | } | ||
| 191 | |||
| 192 | #if GDISP_HARDWARE_FLUSH | ||
| 193 | LLDSPEC void gdisp_lld_flush(GDisplay *g) { | ||
| 194 | // Don't flush if we don't need it. | ||
| 195 | if (!(g->flags & GDISP_FLG_NEEDFLUSH)) | ||
| 196 | return; | ||
| 197 | |||
| 198 | PRIV(g)->page++; | ||
| 199 | PRIV(g)->page %= 2; | ||
| 200 | // TODO: some smarter algorithm for this | ||
| 201 | // We should run only one physical page at a time | ||
| 202 | // This way we don't need to send so much data, and | ||
| 203 | // we could use slightly less memory | ||
| 204 | uint8_t* src = PRIV(g)->frame_buffer; | ||
| 205 | for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) { | ||
| 206 | for (int x=0;x<GDISP_SCREEN_WIDTH;x++) { | ||
| 207 | uint8_t val = (uint16_t)*src * g->g.Backlight / 100; | ||
| 208 | PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val]; | ||
| 209 | ++src; | ||
| 210 | } | ||
| 211 | } | ||
| 212 | write_ram(g, PRIV(g)->page, IS31_PWM_REG, IS31_PWM_SIZE); | ||
| 213 | gfxSleepMilliseconds(1); | ||
| 214 | write_register(g, IS31_FUNCTIONREG, IS31_REG_PICTDISP, PRIV(g)->page); | ||
| 215 | |||
| 216 | g->flags &= ~GDISP_FLG_NEEDFLUSH; | ||
| 217 | } | ||
| 218 | #endif | ||
| 219 | |||
| 220 | #if GDISP_HARDWARE_DRAWPIXEL | ||
| 221 | LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) { | ||
| 222 | coord_t x, y; | ||
| 223 | |||
| 224 | switch(g->g.Orientation) { | ||
| 225 | default: | ||
| 226 | case GDISP_ROTATE_0: | ||
| 227 | x = g->p.x; | ||
| 228 | y = g->p.y; | ||
| 229 | break; | ||
| 230 | case GDISP_ROTATE_180: | ||
| 231 | x = GDISP_SCREEN_WIDTH-1 - g->p.x; | ||
| 232 | y = g->p.y; | ||
| 233 | break; | ||
| 234 | } | ||
| 235 | PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color); | ||
| 236 | g->flags |= GDISP_FLG_NEEDFLUSH; | ||
| 237 | } | ||
| 238 | #endif | ||
| 239 | |||
| 240 | #if GDISP_HARDWARE_PIXELREAD | ||
| 241 | LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { | ||
| 242 | coord_t x, y; | ||
| 243 | |||
| 244 | switch(g->g.Orientation) { | ||
| 245 | default: | ||
| 246 | case GDISP_ROTATE_0: | ||
| 247 | x = g->p.x; | ||
| 248 | y = g->p.y; | ||
| 249 | break; | ||
| 250 | case GDISP_ROTATE_180: | ||
| 251 | x = GDISP_SCREEN_WIDTH-1 - g->p.x; | ||
| 252 | y = g->p.y; | ||
| 253 | break; | ||
| 254 | } | ||
| 255 | return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]); | ||
| 256 | } | ||
| 257 | #endif | ||
| 258 | |||
| 259 | #if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL | ||
| 260 | LLDSPEC void gdisp_lld_control(GDisplay *g) { | ||
| 261 | switch(g->p.x) { | ||
| 262 | case GDISP_CONTROL_POWER: | ||
| 263 | if (g->g.Powermode == (powermode_t)g->p.ptr) | ||
| 264 | return; | ||
| 265 | switch((powermode_t)g->p.ptr) { | ||
| 266 | case powerOff: | ||
| 267 | case powerSleep: | ||
| 268 | case powerDeepSleep: | ||
| 269 | write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF); | ||
| 270 | break; | ||
| 271 | case powerOn: | ||
| 272 | write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON); | ||
| 273 | break; | ||
| 274 | default: | ||
| 275 | return; | ||
| 276 | } | ||
| 277 | g->g.Powermode = (powermode_t)g->p.ptr; | ||
| 278 | return; | ||
| 279 | |||
| 280 | case GDISP_CONTROL_ORIENTATION: | ||
| 281 | if (g->g.Orientation == (orientation_t)g->p.ptr) | ||
| 282 | return; | ||
| 283 | switch((orientation_t)g->p.ptr) { | ||
| 284 | /* Rotation is handled by the drawing routines */ | ||
| 285 | case GDISP_ROTATE_0: | ||
| 286 | case GDISP_ROTATE_180: | ||
| 287 | g->g.Height = GDISP_SCREEN_HEIGHT; | ||
| 288 | g->g.Width = GDISP_SCREEN_WIDTH; | ||
| 289 | break; | ||
| 290 | case GDISP_ROTATE_90: | ||
| 291 | case GDISP_ROTATE_270: | ||
| 292 | g->g.Height = GDISP_SCREEN_WIDTH; | ||
| 293 | g->g.Width = GDISP_SCREEN_HEIGHT; | ||
| 294 | break; | ||
| 295 | default: | ||
| 296 | return; | ||
| 297 | } | ||
| 298 | g->g.Orientation = (orientation_t)g->p.ptr; | ||
| 299 | return; | ||
| 300 | |||
| 301 | case GDISP_CONTROL_BACKLIGHT: | ||
| 302 | if (g->g.Backlight == (unsigned)g->p.ptr) | ||
| 303 | return; | ||
| 304 | unsigned val = (unsigned)g->p.ptr; | ||
| 305 | g->g.Backlight = val > 100 ? 100 : val; | ||
| 306 | g->flags |= GDISP_FLG_NEEDFLUSH; | ||
| 307 | return; | ||
| 308 | } | ||
| 309 | } | ||
| 310 | #endif // GDISP_NEED_CONTROL | ||
| 311 | |||
| 312 | #endif // GFX_USE_GDISP | ||
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 @@ | |||
| 1 | GFXINC += drivers/gdisp/st7565ergodox | ||
| 2 | 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 @@ | |||
| 22 | #ifndef _GFXCONF_H | 22 | #ifndef _GFXCONF_H |
| 23 | #define _GFXCONF_H | 23 | #define _GFXCONF_H |
| 24 | 24 | ||
| 25 | 25 | #include "common_gfxconf.h" | |
| 26 | /////////////////////////////////////////////////////////////////////////// | ||
| 27 | // GOS - One of these must be defined, preferably in your Makefile // | ||
| 28 | /////////////////////////////////////////////////////////////////////////// | ||
| 29 | //#define GFX_USE_OS_CHIBIOS TRUE | ||
| 30 | //#define GFX_USE_OS_FREERTOS FALSE | ||
| 31 | // #define GFX_FREERTOS_USE_TRACE FALSE | ||
| 32 | //#define GFX_USE_OS_WIN32 FALSE | ||
| 33 | //#define GFX_USE_OS_LINUX FALSE | ||
| 34 | //#define GFX_USE_OS_OSX FALSE | ||
| 35 | //#define GFX_USE_OS_ECOS FALSE | ||
| 36 | //#define GFX_USE_OS_RAWRTOS FALSE | ||
| 37 | //#define GFX_USE_OS_ARDUINO FALSE | ||
| 38 | //#define GFX_USE_OS_KEIL FALSE | ||
| 39 | //#define GFX_USE_OS_CMSIS FALSE | ||
| 40 | //#define GFX_USE_OS_RAW32 FALSE | ||
| 41 | // #define INTERRUPTS_OFF() optional_code | ||
| 42 | // #define INTERRUPTS_ON() optional_code | ||
| 43 | // These are not defined by default for some reason | ||
| 44 | #define GOS_NEED_X_THREADS FALSE | ||
| 45 | #define GOS_NEED_X_HEAP FALSE | ||
| 46 | |||
| 47 | // Options that (should where relevant) apply to all operating systems | ||
| 48 | #define GFX_NO_INLINE FALSE | ||
| 49 | // #define GFX_COMPILER GFX_COMPILER_UNKNOWN | ||
| 50 | // #define GFX_CPU GFX_CPU_UNKNOWN | ||
| 51 | // #define GFX_OS_HEAP_SIZE 0 | ||
| 52 | // #define GFX_OS_NO_INIT FALSE | ||
| 53 | // #define GFX_OS_INIT_NO_WARNING FALSE | ||
| 54 | // #define GFX_OS_PRE_INIT_FUNCTION myHardwareInitRoutine | ||
| 55 | // #define GFX_OS_EXTRA_INIT_FUNCTION myOSInitRoutine | ||
| 56 | // #define GFX_OS_EXTRA_DEINIT_FUNCTION myOSDeInitRoutine | ||
| 57 | |||
| 58 | |||
| 59 | /////////////////////////////////////////////////////////////////////////// | ||
| 60 | // GDISP // | ||
| 61 | /////////////////////////////////////////////////////////////////////////// | ||
| 62 | #define GFX_USE_GDISP TRUE | ||
| 63 | |||
| 64 | //#define GDISP_NEED_AUTOFLUSH FALSE | ||
| 65 | //#define GDISP_NEED_TIMERFLUSH FALSE | ||
| 66 | //#define GDISP_NEED_VALIDATION TRUE | ||
| 67 | //#define GDISP_NEED_CLIP TRUE | ||
| 68 | #define GDISP_NEED_CIRCLE TRUE | ||
| 69 | #define GDISP_NEED_ELLIPSE TRUE | ||
| 70 | #define GDISP_NEED_ARC TRUE | ||
| 71 | #define GDISP_NEED_ARCSECTORS TRUE | ||
| 72 | #define GDISP_NEED_CONVEX_POLYGON TRUE | ||
| 73 | //#define GDISP_NEED_SCROLL FALSE | ||
| 74 | #define GDISP_NEED_PIXELREAD TRUE | ||
| 75 | #define GDISP_NEED_CONTROL TRUE | ||
| 76 | //#define GDISP_NEED_QUERY FALSE | ||
| 77 | //#define GDISP_NEED_MULTITHREAD FALSE | ||
| 78 | //#define GDISP_NEED_STREAMING FALSE | ||
| 79 | #define GDISP_NEED_TEXT TRUE | ||
| 80 | // #define GDISP_NEED_TEXT_WORDWRAP FALSE | ||
| 81 | // #define GDISP_NEED_ANTIALIAS FALSE | ||
| 82 | // #define GDISP_NEED_UTF8 FALSE | ||
| 83 | #define GDISP_NEED_TEXT_KERNING TRUE | ||
| 84 | // #define GDISP_INCLUDE_FONT_UI1 FALSE | ||
| 85 | // #define GDISP_INCLUDE_FONT_UI2 FALSE // The smallest preferred font. | ||
| 86 | // #define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE | ||
| 87 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE | ||
| 88 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE | ||
| 89 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE | ||
| 90 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS20 FALSE | ||
| 91 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE | ||
| 92 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE | ||
| 93 | #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 TRUE | ||
| 94 | // #define GDISP_INCLUDE_FONT_FIXED_10X20 FALSE | ||
| 95 | // #define GDISP_INCLUDE_FONT_FIXED_7X14 FALSE | ||
| 96 | #define GDISP_INCLUDE_FONT_FIXED_5X8 TRUE | ||
| 97 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE | ||
| 98 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE | ||
| 99 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS20_AA FALSE | ||
| 100 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE | ||
| 101 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE | ||
| 102 | // #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE | ||
| 103 | // #define GDISP_INCLUDE_USER_FONTS FALSE | ||
| 104 | |||
| 105 | //#define GDISP_NEED_IMAGE FALSE | ||
| 106 | // #define GDISP_NEED_IMAGE_NATIVE FALSE | ||
| 107 | // #define GDISP_NEED_IMAGE_GIF FALSE | ||
| 108 | // #define GDISP_NEED_IMAGE_BMP FALSE | ||
| 109 | // #define GDISP_NEED_IMAGE_BMP_1 FALSE | ||
| 110 | // #define GDISP_NEED_IMAGE_BMP_4 FALSE | ||
| 111 | // #define GDISP_NEED_IMAGE_BMP_4_RLE FALSE | ||
| 112 | // #define GDISP_NEED_IMAGE_BMP_8 FALSE | ||
| 113 | // #define GDISP_NEED_IMAGE_BMP_8_RLE FALSE | ||
| 114 | // #define GDISP_NEED_IMAGE_BMP_16 FALSE | ||
| 115 | // #define GDISP_NEED_IMAGE_BMP_24 FALSE | ||
| 116 | // #define GDISP_NEED_IMAGE_BMP_32 FALSE | ||
| 117 | // #define GDISP_NEED_IMAGE_JPG FALSE | ||
| 118 | // #define GDISP_NEED_IMAGE_PNG FALSE | ||
| 119 | // #define GDISP_NEED_IMAGE_ACCOUNTING FALSE | ||
| 120 | #ifdef EMULATOR | ||
| 121 | #define GDISP_NEED_PIXMAP TRUE | ||
| 122 | #endif | ||
| 123 | // #define GDISP_NEED_PIXMAP_IMAGE FALSE | ||
| 124 | |||
| 125 | //#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE // If not defined the native hardware orientation is used. | ||
| 126 | //#define GDISP_LINEBUF_SIZE 128 | ||
| 127 | //#define GDISP_STARTUP_COLOR Black | ||
| 128 | #define GDISP_NEED_STARTUP_LOGO FALSE | ||
| 129 | |||
| 130 | //#define GDISP_TOTAL_DISPLAYS 2 | ||
| 131 | |||
| 132 | #ifndef EMULATOR | ||
| 133 | #define GDISP_DRIVER_LIST GDISPVMT_ST7565_ERGODOX, GDISPVMT_IS31FL3731C_ERGODOX | ||
| 134 | #else | ||
| 135 | #define GDISP_DRIVER_LIST GDISPVMT_EMULATOR_LCD_ERGODOX, GDISPVMT_EMULATOR_LED_ERGODOX | ||
| 136 | #endif | ||
| 137 | |||
| 138 | #ifdef GDISP_DRIVER_LIST | ||
| 139 | // For code and speed optimization define as TRUE or FALSE if all controllers have the same capability | ||
| 140 | #define GDISP_HARDWARE_STREAM_WRITE FALSE | ||
| 141 | #define GDISP_HARDWARE_STREAM_READ FALSE | ||
| 142 | #define GDISP_HARDWARE_STREAM_POS FALSE | ||
| 143 | #define GDISP_HARDWARE_DRAWPIXEL TRUE | ||
| 144 | #define GDISP_HARDWARE_CLEARS FALSE | ||
| 145 | #define GDISP_HARDWARE_FILLS FALSE | ||
| 146 | //#define GDISP_HARDWARE_BITFILLS FALSE | ||
| 147 | #define GDISP_HARDWARE_SCROLL FALSE | ||
| 148 | #define GDISP_HARDWARE_PIXELREAD TRUE | ||
| 149 | #define GDISP_HARDWARE_CONTROL TRUE | ||
| 150 | #define GDISP_HARDWARE_QUERY FALSE | ||
| 151 | #define GDISP_HARDWARE_CLIP FALSE | ||
| 152 | |||
| 153 | #define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888 | ||
| 154 | #endif | ||
| 155 | |||
| 156 | // The custom format is not defined for some reason, so define it as error | ||
| 157 | // so we don't get compiler warnings | ||
| 158 | #define GDISP_PIXELFORMAT_CUSTOM GDISP_PIXELFORMAT_ERROR | ||
| 159 | |||
| 160 | #define GDISP_USE_GFXNET FALSE | ||
| 161 | // #define GDISP_GFXNET_PORT 13001 | ||
| 162 | // #define GDISP_GFXNET_CUSTOM_LWIP_STARTUP FALSE | ||
| 163 | // #define GDISP_DONT_WAIT_FOR_NET_DISPLAY FALSE | ||
| 164 | // #define GDISP_GFXNET_UNSAFE_SOCKETS FALSE | ||
| 165 | |||
| 166 | |||
| 167 | /////////////////////////////////////////////////////////////////////////// | ||
| 168 | // GWIN // | ||
| 169 | /////////////////////////////////////////////////////////////////////////// | ||
| 170 | #define GFX_USE_GWIN FALSE | ||
| 171 | |||
| 172 | //#define GWIN_NEED_WINDOWMANAGER FALSE | ||
| 173 | // #define GWIN_REDRAW_IMMEDIATE FALSE | ||
| 174 | // #define GWIN_REDRAW_SINGLEOP FALSE | ||
| 175 | // #define GWIN_NEED_FLASHING FALSE | ||
| 176 | // #define GWIN_FLASHING_PERIOD 250 | ||
| 177 | |||
| 178 | //#define GWIN_NEED_CONSOLE FALSE | ||
| 179 | // #define GWIN_CONSOLE_USE_HISTORY FALSE | ||
| 180 | // #define GWIN_CONSOLE_HISTORY_AVERAGING FALSE | ||
| 181 | // #define GWIN_CONSOLE_HISTORY_ATCREATE FALSE | ||
| 182 | // #define GWIN_CONSOLE_ESCSEQ FALSE | ||
| 183 | // #define GWIN_CONSOLE_USE_BASESTREAM FALSE | ||
| 184 | // #define GWIN_CONSOLE_USE_FLOAT FALSE | ||
| 185 | //#define GWIN_NEED_GRAPH FALSE | ||
| 186 | //#define GWIN_NEED_GL3D FALSE | ||
| 187 | |||
| 188 | //#define GWIN_NEED_WIDGET FALSE | ||
| 189 | //#define GWIN_FOCUS_HIGHLIGHT_WIDTH 1 | ||
| 190 | // #define GWIN_NEED_LABEL FALSE | ||
| 191 | // #define GWIN_LABEL_ATTRIBUTE FALSE | ||
| 192 | // #define GWIN_NEED_BUTTON FALSE | ||
| 193 | // #define GWIN_BUTTON_LAZY_RELEASE FALSE | ||
| 194 | // #define GWIN_NEED_SLIDER FALSE | ||
| 195 | // #define GWIN_SLIDER_NOSNAP FALSE | ||
| 196 | // #define GWIN_SLIDER_DEAD_BAND 5 | ||
| 197 | // #define GWIN_SLIDER_TOGGLE_INC 20 | ||
| 198 | // #define GWIN_NEED_CHECKBOX FALSE | ||
| 199 | // #define GWIN_NEED_IMAGE FALSE | ||
| 200 | // #define GWIN_NEED_IMAGE_ANIMATION FALSE | ||
| 201 | // #define GWIN_NEED_RADIO FALSE | ||
| 202 | // #define GWIN_NEED_LIST FALSE | ||
| 203 | // #define GWIN_NEED_LIST_IMAGES FALSE | ||
| 204 | // #define GWIN_NEED_PROGRESSBAR FALSE | ||
| 205 | // #define GWIN_PROGRESSBAR_AUTO FALSE | ||
| 206 | // #define GWIN_NEED_KEYBOARD FALSE | ||
| 207 | // #define GWIN_KEYBOARD_DEFAULT_LAYOUT VirtualKeyboard_English1 | ||
| 208 | // #define GWIN_NEED_KEYBOARD_ENGLISH1 TRUE | ||
| 209 | // #define GWIN_NEED_TEXTEDIT FALSE | ||
| 210 | // #define GWIN_FLAT_STYLING FALSE | ||
| 211 | // #define GWIN_WIDGET_TAGS FALSE | ||
| 212 | |||
| 213 | //#define GWIN_NEED_CONTAINERS FALSE | ||
| 214 | // #define GWIN_NEED_CONTAINER FALSE | ||
| 215 | // #define GWIN_NEED_FRAME FALSE | ||
| 216 | // #define GWIN_NEED_TABSET FALSE | ||
| 217 | // #define GWIN_TABSET_TABHEIGHT 18 | ||
| 218 | |||
| 219 | |||
| 220 | /////////////////////////////////////////////////////////////////////////// | ||
| 221 | // GEVENT // | ||
| 222 | /////////////////////////////////////////////////////////////////////////// | ||
| 223 | #define GFX_USE_GEVENT TRUE | ||
| 224 | |||
| 225 | //#define GEVENT_ASSERT_NO_RESOURCE FALSE | ||
| 226 | //#define GEVENT_MAXIMUM_SIZE 32 | ||
| 227 | //#define GEVENT_MAX_SOURCE_LISTENERS 32 | ||
| 228 | |||
| 229 | |||
| 230 | /////////////////////////////////////////////////////////////////////////// | ||
| 231 | // GTIMER // | ||
| 232 | /////////////////////////////////////////////////////////////////////////// | ||
| 233 | #define GFX_USE_GTIMER FALSE | ||
| 234 | |||
| 235 | //#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY | ||
| 236 | //#define GTIMER_THREAD_WORKAREA_SIZE 2048 | ||
| 237 | |||
| 238 | |||
| 239 | /////////////////////////////////////////////////////////////////////////// | ||
| 240 | // GQUEUE // | ||
| 241 | /////////////////////////////////////////////////////////////////////////// | ||
| 242 | #define GFX_USE_GQUEUE FALSE | ||
| 243 | |||
| 244 | //#define GQUEUE_NEED_ASYNC FALSE | ||
| 245 | //#define GQUEUE_NEED_GSYNC FALSE | ||
| 246 | //#define GQUEUE_NEED_FSYNC FALSE | ||
| 247 | //#define GQUEUE_NEED_BUFFERS FALSE | ||
| 248 | |||
| 249 | /////////////////////////////////////////////////////////////////////////// | ||
| 250 | // GINPUT // | ||
| 251 | /////////////////////////////////////////////////////////////////////////// | ||
| 252 | #define GFX_USE_GINPUT FALSE | ||
| 253 | |||
| 254 | //#define GINPUT_NEED_MOUSE FALSE | ||
| 255 | // #define GINPUT_TOUCH_STARTRAW FALSE | ||
| 256 | // #define GINPUT_TOUCH_NOTOUCH FALSE | ||
| 257 | // #define GINPUT_TOUCH_NOCALIBRATE FALSE | ||
| 258 | // #define GINPUT_TOUCH_NOCALIBRATE_GUI FALSE | ||
| 259 | // #define GINPUT_MOUSE_POLL_PERIOD 25 | ||
| 260 | // #define GINPUT_MOUSE_CLICK_TIME 300 | ||
| 261 | // #define GINPUT_TOUCH_CXTCLICK_TIME 700 | ||
| 262 | // #define GINPUT_TOUCH_USER_CALIBRATION_LOAD FALSE | ||
| 263 | // #define GINPUT_TOUCH_USER_CALIBRATION_SAVE FALSE | ||
| 264 | // #define GMOUSE_DRIVER_LIST GMOUSEVMT_Win32, GMOUSEVMT_Win32 | ||
| 265 | //#define GINPUT_NEED_KEYBOARD FALSE | ||
| 266 | // #define GINPUT_KEYBOARD_POLL_PERIOD 200 | ||
| 267 | // #define GKEYBOARD_DRIVER_LIST GKEYBOARDVMT_Win32, GKEYBOARDVMT_Win32 | ||
| 268 | // #define GKEYBOARD_LAYOUT_OFF FALSE | ||
| 269 | // #define GKEYBOARD_LAYOUT_SCANCODE2_US FALSE | ||
| 270 | //#define GINPUT_NEED_TOGGLE FALSE | ||
| 271 | //#define GINPUT_NEED_DIAL FALSE | ||
| 272 | |||
| 273 | |||
| 274 | /////////////////////////////////////////////////////////////////////////// | ||
| 275 | // GFILE // | ||
| 276 | /////////////////////////////////////////////////////////////////////////// | ||
| 277 | #define GFX_USE_GFILE FALSE | ||
| 278 | |||
| 279 | //#define GFILE_NEED_PRINTG FALSE | ||
| 280 | //#define GFILE_NEED_SCANG FALSE | ||
| 281 | //#define GFILE_NEED_STRINGS FALSE | ||
| 282 | //#define GFILE_NEED_FILELISTS FALSE | ||
| 283 | //#define GFILE_NEED_STDIO FALSE | ||
| 284 | //#define GFILE_NEED_NOAUTOMOUNT FALSE | ||
| 285 | //#define GFILE_NEED_NOAUTOSYNC FALSE | ||
| 286 | |||
| 287 | //#define GFILE_NEED_MEMFS FALSE | ||
| 288 | //#define GFILE_NEED_ROMFS FALSE | ||
| 289 | //#define GFILE_NEED_RAMFS FALSE | ||
| 290 | //#define GFILE_NEED_FATFS FALSE | ||
| 291 | //#define GFILE_NEED_NATIVEFS FALSE | ||
| 292 | //#define GFILE_NEED_CHBIOSFS FALSE | ||
| 293 | |||
| 294 | //#define GFILE_ALLOW_FLOATS FALSE | ||
| 295 | //#define GFILE_ALLOW_DEVICESPECIFIC FALSE | ||
| 296 | //#define GFILE_MAX_GFILES 3 | ||
| 297 | |||
| 298 | /////////////////////////////////////////////////////////////////////////// | ||
| 299 | // GADC // | ||
| 300 | /////////////////////////////////////////////////////////////////////////// | ||
| 301 | #define GFX_USE_GADC FALSE | ||
| 302 | |||
| 303 | //#define GADC_MAX_LOWSPEED_DEVICES 4 | ||
| 304 | |||
| 305 | |||
| 306 | /////////////////////////////////////////////////////////////////////////// | ||
| 307 | // GAUDIO // | ||
| 308 | /////////////////////////////////////////////////////////////////////////// | ||
| 309 | #define GFX_USE_GAUDIO FALSE | ||
| 310 | // There seems to be a bug in the ugfx code, the wrong define is used | ||
| 311 | // So define it in order to avoid warnings | ||
| 312 | #define GFX_USE_GAUDIN GFX_USE_GAUDIO | ||
| 313 | // #define GAUDIO_NEED_PLAY FALSE | ||
| 314 | // #define GAUDIO_NEED_RECORD FALSE | ||
| 315 | |||
| 316 | |||
| 317 | /////////////////////////////////////////////////////////////////////////// | ||
| 318 | // GMISC // | ||
| 319 | /////////////////////////////////////////////////////////////////////////// | ||
| 320 | #define GFX_USE_GMISC TRUE | ||
| 321 | |||
| 322 | //#define GMISC_NEED_ARRAYOPS FALSE | ||
| 323 | //#define GMISC_NEED_FASTTRIG FALSE | ||
| 324 | //#define GMISC_NEED_FIXEDTRIG FALSE | ||
| 325 | //#define GMISC_NEED_INVSQRT FALSE | ||
| 326 | // #define GMISC_INVSQRT_MIXED_ENDIAN FALSE | ||
| 327 | // #define GMISC_INVSQRT_REAL_SLOW FALSE | ||
| 328 | #define GMISC_NEED_MATRIXFLOAT2D TRUE | ||
| 329 | #define GMISC_NEED_MATRIXFIXED2D FALSE | ||
| 330 | 26 | ||
| 331 | #endif /* _GFXCONF_H */ | 27 | #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 @@ | |||
| 1 | # project specific files | 1 | # project specific files |
| 2 | SRC = matrix.c \ | 2 | SRC = matrix.c \ |
| 3 | led.c \ | 3 | led.c |
| 4 | animations.c | ||
| 5 | 4 | ||
| 6 | ## chip/board settings | 5 | ## chip/board settings |
| 7 | # - the next two should match the directories in | 6 | # - the next two should match the directories in |
| @@ -67,5 +66,10 @@ LCD_BACKLIGHT_ENABLE = yes | |||
| 67 | MIDI_ENABLE = no | 66 | MIDI_ENABLE = no |
| 68 | RGBLIGHT_ENABLE = no | 67 | RGBLIGHT_ENABLE = no |
| 69 | 68 | ||
| 70 | include $(SUBPROJECT_PATH)/drivers/gdisp/st7565ergodox/driver.mk | 69 | LCD_DRIVER = st7565 |
| 71 | include $(SUBPROJECT_PATH)/drivers/gdisp/IS31FL3731C/driver.mk \ No newline at end of file | 70 | LCD_WIDTH = 128 |
| 71 | LCD_HEIGHT = 32 | ||
| 72 | |||
| 73 | LED_DRIVER = is31fl3731c | ||
| 74 | LED_WIDTH = 7 | ||
| 75 | 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 @@ | |||
| 34 | #include "lcd_backlight_keyframes.h" | 34 | #include "lcd_backlight_keyframes.h" |
| 35 | #include "system/serial_link.h" | 35 | #include "system/serial_link.h" |
| 36 | #include "led.h" | 36 | #include "led.h" |
| 37 | #include "animations.h" | 37 | #include "default_animations.h" |
| 38 | 38 | ||
| 39 | static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); | 39 | static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); |
| 40 | static const uint32_t initial_color = LCD_COLOR(0, 0, 0); | 40 | static const uint32_t initial_color = LCD_COLOR(0, 0, 0); |
| @@ -58,7 +58,7 @@ static keyframe_animation_t color_animation = { | |||
| 58 | // this prevents the color from changing when activating the layer | 58 | // this prevents the color from changing when activating the layer |
| 59 | // momentarily | 59 | // momentarily |
| 60 | .frame_lengths = {gfxMillisecondsToTicks(200), gfxMillisecondsToTicks(500)}, | 60 | .frame_lengths = {gfxMillisecondsToTicks(200), gfxMillisecondsToTicks(500)}, |
| 61 | .frame_functions = {keyframe_no_operation, backlight_keyframe_animate_color}, | 61 | .frame_functions = {keyframe_no_operation, lcd_backlight_keyframe_animate_color}, |
| 62 | }; | 62 | }; |
| 63 | 63 | ||
| 64 | void initialize_user_visualizer(visualizer_state_t* state) { | 64 | 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/>. | |||
| 31 | #include "lcd_keyframes.h" | 31 | #include "lcd_keyframes.h" |
| 32 | #include "lcd_backlight_keyframes.h" | 32 | #include "lcd_backlight_keyframes.h" |
| 33 | #include "system/serial_link.h" | 33 | #include "system/serial_link.h" |
| 34 | #include "animations.h" | 34 | #include "default_animations.h" |
| 35 | 35 | ||
| 36 | static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); | 36 | static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); |
| 37 | static const uint32_t initial_color = LCD_COLOR(0, 0, 0); | 37 | static const uint32_t initial_color = LCD_COLOR(0, 0, 0); |
| @@ -79,7 +79,7 @@ static keyframe_animation_t one_led_color = { | |||
| 79 | .num_frames = 1, | 79 | .num_frames = 1, |
| 80 | .loop = false, | 80 | .loop = false, |
| 81 | .frame_lengths = {gfxMillisecondsToTicks(0)}, | 81 | .frame_lengths = {gfxMillisecondsToTicks(0)}, |
| 82 | .frame_functions = {backlight_keyframe_set_color}, | 82 | .frame_functions = {lcd_backlight_keyframe_set_color}, |
| 83 | }; | 83 | }; |
| 84 | 84 | ||
| 85 | bool swap_led_target_color(keyframe_animation_t* animation, visualizer_state_t* state) { | 85 | bool swap_led_target_color(keyframe_animation_t* animation, visualizer_state_t* state) { |
| @@ -94,7 +94,7 @@ static keyframe_animation_t two_led_colors = { | |||
| 94 | .num_frames = 2, | 94 | .num_frames = 2, |
| 95 | .loop = true, | 95 | .loop = true, |
| 96 | .frame_lengths = {gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(0)}, | 96 | .frame_lengths = {gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(0)}, |
| 97 | .frame_functions = {backlight_keyframe_set_color, swap_led_target_color}, | 97 | .frame_functions = {lcd_backlight_keyframe_set_color, swap_led_target_color}, |
| 98 | }; | 98 | }; |
| 99 | 99 | ||
| 100 | // The LCD animation alternates between the layer name display and a | 100 | // 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 @@ | |||
| 1 | SUBPROJECT_DEFAULT = ver2 | ||
| 2 | |||
| 3 | ifndef MAKEFILE_INCLUDED | ||
| 4 | include ../../Makefile | ||
| 5 | 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 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef CONFIG_H | ||
| 19 | #define CONFIG_H | ||
| 20 | |||
| 21 | #include "config_common.h" | ||
| 22 | |||
| 23 | /* USB Device descriptor parameter */ | ||
| 24 | #define VENDOR_ID 0xFEED | ||
| 25 | #define PRODUCT_ID 0x6060 | ||
| 26 | #define MANUFACTURER ishtob | ||
| 27 | #define PRODUCT Hadron Keyboard | ||
| 28 | #define DESCRIPTION A cherry ML ortholinear keyboard | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | //#define AUDIO_VOICES | ||
| 34 | |||
| 35 | //#define BACKLIGHT_PIN B7 | ||
| 36 | |||
| 37 | /* COL2ROW or ROW2COL */ | ||
| 38 | #define DIODE_DIRECTION COL2ROW | ||
| 39 | |||
| 40 | /* define if matrix has ghost */ | ||
| 41 | //#define MATRIX_HAS_GHOST | ||
| 42 | |||
| 43 | /* number of backlight levels */ | ||
| 44 | //#define BACKLIGHT_LEVELS 3 | ||
| 45 | |||
| 46 | /* Set 0 if debouncing isn't needed */ | ||
| 47 | #define DEBOUNCING_DELAY 5 | ||
| 48 | |||
| 49 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
| 50 | #define LOCKING_SUPPORT_ENABLE | ||
| 51 | /* Locking resynchronize hack */ | ||
| 52 | #define LOCKING_RESYNC_ENABLE | ||
| 53 | |||
| 54 | /* key combination for command */ | ||
| 55 | #define IS_COMMAND() ( \ | ||
| 56 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
| 57 | ) | ||
| 58 | |||
| 59 | /* | ||
| 60 | * Feature disable options | ||
| 61 | * These options are also useful to firmware size reduction. | ||
| 62 | */ | ||
| 63 | |||
| 64 | /* disable debug print */ | ||
| 65 | //#define NO_DEBUG | ||
| 66 | |||
| 67 | /* disable print */ | ||
| 68 | //#define NO_PRINT | ||
| 69 | |||
| 70 | /* disable action features */ | ||
| 71 | //#define NO_ACTION_LAYER | ||
| 72 | //#define NO_ACTION_TAPPING | ||
| 73 | //#define NO_ACTION_ONESHOT | ||
| 74 | //#define NO_ACTION_MACRO | ||
| 75 | //#define NO_ACTION_FUNCTION | ||
| 76 | #ifdef SUBPROJECT_ver0 | ||
| 77 | #include "ver0/config.h" | ||
| 78 | #endif | ||
| 79 | #ifdef SUBPROJECT_ver2 | ||
| 80 | #include "ver2/config.h" | ||
| 81 | #endif | ||
| 82 | |||
| 83 | #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 @@ | |||
| 1 | #include "hadron.h" | ||
| 2 | |||
| 3 | |||
| 4 | void matrix_init_kb(void) { | ||
| 5 | |||
| 6 | matrix_init_user(); | ||
| 7 | } | ||
| 8 | |||
| 9 | void matrix_scan_kb(void) { | ||
| 10 | // put your looping keyboard code here | ||
| 11 | // runs every cycle (a lot) | ||
| 12 | matrix_scan_user(); | ||
| 13 | } | ||
| 14 | |||
| 15 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 16 | // put your per-action keyboard code here | ||
| 17 | // runs for every action, just before processing by the firmware | ||
| 18 | |||
| 19 | return process_record_user(keycode, record); | ||
| 20 | } | ||
| 21 | |||
| 22 | void led_set_kb(uint8_t usb_led) { | ||
| 23 | // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here | ||
| 24 | |||
| 25 | led_set_user(usb_led); | ||
| 26 | } \ 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 @@ | |||
| 1 | #ifndef HADRON_H | ||
| 2 | #define HADRON_H | ||
| 3 | |||
| 4 | #ifdef SUBPROJECT_ver0 | ||
| 5 | #include "ver0.h" | ||
| 6 | #endif | ||
| 7 | #ifdef SUBPROJECT_ver2 | ||
| 8 | #include "ver2.h" | ||
| 9 | #endif | ||
| 10 | |||
| 11 | #include "quantum.h" | ||
| 12 | |||
| 13 | |||
| 14 | #define KEYMAP( \ | ||
| 15 | K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ | ||
| 16 | K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ | ||
| 17 | K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \ | ||
| 18 | K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \ | ||
| 19 | K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E \ | ||
| 20 | ) \ | ||
| 21 | { \ | ||
| 22 | { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, KC_NO, KC_NO, KC_NO }, \ | ||
| 23 | { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \ | ||
| 24 | { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \ | ||
| 25 | { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \ | ||
| 26 | { K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E } \ | ||
| 27 | } | ||
| 28 | |||
| 29 | |||
| 30 | #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 @@ | |||
| 1 | #include <util/twi.h> | ||
| 2 | #include <avr/io.h> | ||
| 3 | #include <stdlib.h> | ||
| 4 | #include <avr/interrupt.h> | ||
| 5 | #include <util/twi.h> | ||
| 6 | #include <stdbool.h> | ||
| 7 | #include "i2c.h" | ||
| 8 | |||
| 9 | #ifdef USE_I2C | ||
| 10 | |||
| 11 | // Limits the amount of we wait for any one i2c transaction. | ||
| 12 | // Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is | ||
| 13 | // 9 bits, a single transaction will take around 90μs to complete. | ||
| 14 | // | ||
| 15 | // (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit | ||
| 16 | // poll loop takes at least 8 clock cycles to execute | ||
| 17 | #define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 | ||
| 18 | |||
| 19 | #define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) | ||
| 20 | |||
| 21 | volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; | ||
| 22 | |||
| 23 | static volatile uint8_t slave_buffer_pos; | ||
| 24 | static volatile bool slave_has_register_set = false; | ||
| 25 | |||
| 26 | // Wait for an i2c operation to finish | ||
| 27 | inline static | ||
| 28 | void i2c_delay(void) { | ||
| 29 | uint16_t lim = 0; | ||
| 30 | while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT) | ||
| 31 | lim++; | ||
| 32 | |||
| 33 | // easier way, but will wait slightly longer | ||
| 34 | // _delay_us(100); | ||
| 35 | } | ||
| 36 | |||
| 37 | // Setup twi to run at 100kHz | ||
| 38 | void i2c_master_init(void) { | ||
| 39 | // no prescaler | ||
| 40 | TWSR = 0; | ||
| 41 | // Set TWI clock frequency to SCL_CLOCK. Need TWBR>10. | ||
| 42 | // Check datasheets for more info. | ||
| 43 | TWBR = ((F_CPU/SCL_CLOCK)-16)/2; | ||
| 44 | } | ||
| 45 | |||
| 46 | // Start a transaction with the given i2c slave address. The direction of the | ||
| 47 | // transfer is set with I2C_READ and I2C_WRITE. | ||
| 48 | // returns: 0 => success | ||
| 49 | // 1 => error | ||
| 50 | uint8_t i2c_master_start(uint8_t address) { | ||
| 51 | TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN); | ||
| 52 | |||
| 53 | i2c_delay(); | ||
| 54 | |||
| 55 | // check that we started successfully | ||
| 56 | if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START)) | ||
| 57 | return 1; | ||
| 58 | |||
| 59 | // send device address | ||
| 60 | TWDR = address; | ||
| 61 | TWCR = (1<<TWINT) | (1<<TWEN); | ||
| 62 | |||
| 63 | i2c_delay(); | ||
| 64 | |||
| 65 | if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) ) | ||
| 66 | return 1; // slave did not acknowledge | ||
| 67 | else | ||
| 68 | return 0; // success | ||
| 69 | } | ||
| 70 | |||
| 71 | |||
| 72 | // Finish the i2c transaction. | ||
| 73 | void i2c_master_stop(void) { | ||
| 74 | TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); | ||
| 75 | |||
| 76 | uint16_t lim = 0; | ||
| 77 | while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT) | ||
| 78 | lim++; | ||
| 79 | } | ||
| 80 | |||
| 81 | // Write one byte to the i2c slave. | ||
| 82 | // returns 0 => slave ACK | ||
| 83 | // 1 => slave NACK | ||
| 84 | uint8_t i2c_master_write(uint8_t data) { | ||
| 85 | TWDR = data; | ||
| 86 | TWCR = (1<<TWINT) | (1<<TWEN); | ||
| 87 | |||
| 88 | i2c_delay(); | ||
| 89 | |||
| 90 | // check if the slave acknowledged us | ||
| 91 | return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1; | ||
| 92 | } | ||
| 93 | |||
| 94 | // Read one byte from the i2c slave. If ack=1 the slave is acknowledged, | ||
| 95 | // if ack=0 the acknowledge bit is not set. | ||
| 96 | // returns: byte read from i2c device | ||
| 97 | uint8_t i2c_master_read(int ack) { | ||
| 98 | TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA); | ||
| 99 | |||
| 100 | i2c_delay(); | ||
| 101 | return TWDR; | ||
| 102 | } | ||
| 103 | |||
| 104 | void i2c_reset_state(void) { | ||
| 105 | TWCR = 0; | ||
| 106 | } | ||
| 107 | |||
| 108 | void i2c_slave_init(uint8_t address) { | ||
| 109 | TWAR = address << 0; // slave i2c address | ||
| 110 | // TWEN - twi enable | ||
| 111 | // TWEA - enable address acknowledgement | ||
| 112 | // TWINT - twi interrupt flag | ||
| 113 | // TWIE - enable the twi interrupt | ||
| 114 | TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN); | ||
| 115 | } | ||
| 116 | |||
| 117 | ISR(TWI_vect); | ||
| 118 | |||
| 119 | ISR(TWI_vect) { | ||
| 120 | uint8_t ack = 1; | ||
| 121 | switch(TW_STATUS) { | ||
| 122 | case TW_SR_SLA_ACK: | ||
| 123 | // this device has been addressed as a slave receiver | ||
| 124 | slave_has_register_set = false; | ||
| 125 | break; | ||
| 126 | |||
| 127 | case TW_SR_DATA_ACK: | ||
| 128 | // this device has received data as a slave receiver | ||
| 129 | // The first byte that we receive in this transaction sets the location | ||
| 130 | // of the read/write location of the slaves memory that it exposes over | ||
| 131 | // i2c. After that, bytes will be written at slave_buffer_pos, incrementing | ||
| 132 | // slave_buffer_pos after each write. | ||
| 133 | if(!slave_has_register_set) { | ||
| 134 | slave_buffer_pos = TWDR; | ||
| 135 | // don't acknowledge the master if this memory loctaion is out of bounds | ||
| 136 | if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) { | ||
| 137 | ack = 0; | ||
| 138 | slave_buffer_pos = 0; | ||
| 139 | } | ||
| 140 | slave_has_register_set = true; | ||
| 141 | } else { | ||
| 142 | i2c_slave_buffer[slave_buffer_pos] = TWDR; | ||
| 143 | BUFFER_POS_INC(); | ||
| 144 | } | ||
| 145 | break; | ||
| 146 | |||
| 147 | case TW_ST_SLA_ACK: | ||
| 148 | case TW_ST_DATA_ACK: | ||
| 149 | // master has addressed this device as a slave transmitter and is | ||
| 150 | // requesting data. | ||
| 151 | TWDR = i2c_slave_buffer[slave_buffer_pos]; | ||
| 152 | BUFFER_POS_INC(); | ||
| 153 | break; | ||
| 154 | |||
| 155 | case TW_BUS_ERROR: // something went wrong, reset twi state | ||
| 156 | TWCR = 0; | ||
| 157 | default: | ||
| 158 | break; | ||
| 159 | } | ||
| 160 | // Reset everything, so we are ready for the next TWI interrupt | ||
| 161 | TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN); | ||
| 162 | } | ||
| 163 | |||
| 164 | |||
| 165 | |||
| 166 | #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 @@ | |||
| 1 | #ifndef I2C_H | ||
| 2 | #define I2C_H | ||
| 3 | |||
| 4 | #include <stdint.h> | ||
| 5 | |||
| 6 | #ifndef F_CPU | ||
| 7 | #define F_CPU 16000000UL | ||
| 8 | #endif | ||
| 9 | |||
| 10 | #define I2C_READ 1 | ||
| 11 | #define I2C_WRITE 0 | ||
| 12 | |||
| 13 | #define I2C_ACK 1 | ||
| 14 | #define I2C_NACK 0 | ||
| 15 | |||
| 16 | #define SLAVE_BUFFER_SIZE 0x10 | ||
| 17 | |||
| 18 | // i2c SCL clock frequency | ||
| 19 | #define SCL_CLOCK 800000L | ||
| 20 | |||
| 21 | extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; | ||
| 22 | |||
| 23 | void i2c_master_init(void); | ||
| 24 | uint8_t i2c_master_start(uint8_t address); | ||
| 25 | void i2c_master_stop(void); | ||
| 26 | uint8_t i2c_master_write(uint8_t data); | ||
| 27 | uint8_t i2c_master_read(int); | ||
| 28 | void i2c_reset_state(void); | ||
| 29 | void i2c_slave_init(uint8_t address); | ||
| 30 | |||
| 31 | |||
| 32 | static inline unsigned char i2c_start_read(unsigned char addr) { | ||
| 33 | return i2c_master_start((addr << 1) | I2C_READ); | ||
| 34 | } | ||
| 35 | |||
| 36 | static inline unsigned char i2c_start_write(unsigned char addr) { | ||
| 37 | return i2c_master_start((addr << 1) | I2C_WRITE); | ||
| 38 | } | ||
| 39 | |||
| 40 | // from SSD1306 scrips | ||
| 41 | extern unsigned char i2c_rep_start(unsigned char addr); | ||
| 42 | extern void i2c_start_wait(unsigned char addr); | ||
| 43 | extern unsigned char i2c_readAck(void); | ||
| 44 | extern unsigned char i2c_readNak(void); | ||
| 45 | extern unsigned char i2c_read(unsigned char ack); | ||
| 46 | |||
| 47 | #define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); | ||
| 48 | |||
| 49 | #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 @@ | |||
| 1 | |||
| 2 | |||
| 3 | # Build Options | ||
| 4 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 5 | # the appropriate keymap folder that will get included automatically | ||
| 6 | # | ||
| 7 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
| 8 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | ||
| 9 | EXTRAKEY_ENABLE = no # Audio control and System control(+450) | ||
| 10 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
| 11 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 12 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 13 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 14 | MIDI_ENABLE = no # MIDI controls | ||
| 15 | AUDIO_ENABLE = no # Audio output on port C6 | ||
| 16 | UNICODE_ENABLE = no # Unicode | ||
| 17 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 18 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 19 | ONEHAND_ENABLE = no # Enable one-hand typing | ||
| 20 | |||
| 21 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 22 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 23 | |||
| 24 | ifndef QUANTUM_DIR | ||
| 25 | include ../../../../Makefile | ||
| 26 | 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 @@ | |||
| 1 | #ifndef CONFIG_USER_H | ||
| 2 | #define CONFIG_USER_H | ||
| 3 | |||
| 4 | #include "../../config.h" | ||
| 5 | |||
| 6 | #define LEADER_TIMEOUT 300 | ||
| 7 | //#define BACKLIGHT_BREATHING | ||
| 8 | #define PREVENT_STUCK_MODIFIERS | ||
| 9 | |||
| 10 | #define USE_I2C | ||
| 11 | #define SSD1306OLED | ||
| 12 | #define OLED_ROTATE180 | ||
| 13 | |||
| 14 | /* ws2812 RGB LED*/ | ||
| 15 | #define RGB_DI_PIN D4 | ||
| 16 | #define RGBLIGHT_ANIMATIONS | ||
| 17 | #define RGBLED_NUM 14 // Number of LEDs | ||
| 18 | #define RGBLIGHT_HUE_STEP 10 | ||
| 19 | #define RGBLIGHT_SAT_STEP 17 | ||
| 20 | |||
| 21 | #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 @@ | |||
| 1 | #include "hadron.h" | ||
| 2 | #include "bootloader.h" | ||
| 3 | #include "action_layer.h" | ||
| 4 | #include "eeconfig.h" | ||
| 5 | #include "LUFA/Drivers/Peripheral/TWI.h" | ||
| 6 | #ifdef AUDIO_ENABLE | ||
| 7 | #include "audio.h" | ||
| 8 | #endif | ||
| 9 | #ifdef USE_I2C | ||
| 10 | #include "i2c.h" | ||
| 11 | #endif | ||
| 12 | #ifdef SSD1306OLED | ||
| 13 | #include "ssd1306.h" | ||
| 14 | #endif | ||
| 15 | extern keymap_config_t keymap_config; | ||
| 16 | |||
| 17 | //Following line allows macro to read current RGB settings | ||
| 18 | extern rgblight_config_t rgblight_config; | ||
| 19 | |||
| 20 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
| 21 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
| 22 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
| 23 | // entirely and just use numbers. | ||
| 24 | #define _QWERTY 0 | ||
| 25 | #define _COLEMAK 1 | ||
| 26 | #define _DVORAK 2 | ||
| 27 | #define _LOWER 3 | ||
| 28 | #define _RAISE 4 | ||
| 29 | #define _MOUSECURSOR 8 | ||
| 30 | #define _ADJUST 16 | ||
| 31 | |||
| 32 | enum preonic_keycodes { | ||
| 33 | QWERTY = SAFE_RANGE, | ||
| 34 | COLEMAK, | ||
| 35 | DVORAK, | ||
| 36 | LOWER, | ||
| 37 | RAISE, | ||
| 38 | BACKLIT, | ||
| 39 | RGBLED_TOGGLE, | ||
| 40 | RGBLED_STEP_MODE, | ||
| 41 | RGBLED_INCREASE_HUE, | ||
| 42 | RGBLED_DECREASE_HUE, | ||
| 43 | RGBLED_INCREASE_SAT, | ||
| 44 | RGBLED_DECREASE_SAT, | ||
| 45 | RGBLED_INCREASE_VAL, | ||
| 46 | RGBLED_DECREASE_VAL, | ||
| 47 | }; | ||
| 48 | |||
| 49 | enum macro_keycodes { | ||
| 50 | KC_DEMOMACRO, | ||
| 51 | }; | ||
| 52 | |||
| 53 | // Fillers to make layering more clear | ||
| 54 | #define _______ KC_TRNS | ||
| 55 | #define XXXXXXX KC_NO | ||
| 56 | // Custom macros | ||
| 57 | #define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl | ||
| 58 | #define CTL_TTAB CTL_T(KC_TAB) // Tap for Esc, hold for Ctrl | ||
| 59 | #define CTL_ENT CTL_T(KC_ENT) // Tap for Enter, hold for Ctrl | ||
| 60 | #define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift | ||
| 61 | // Requires KC_TRNS/_______ for the trigger key in the destination layer | ||
| 62 | #define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor | ||
| 63 | #define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise | ||
| 64 | #define DEMOMACRO M(KC_DEMOMACRO) // Sample for macros | ||
| 65 | |||
| 66 | |||
| 67 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 68 | |||
| 69 | /* Qwerty | ||
| 70 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 71 | * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | DEL | | ||
| 72 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 73 | * | Tab | Q | W | E | R | T | 7 | 8 | 9 | Y | U | I | O | P | Bksp | | ||
| 74 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 75 | * | CAPS | A | S | D | F | G | 4 | 5 | 6 | H | J | K | L | ;/Nav| ' | | ||
| 76 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 77 | * | Shift| Z | X | C | V | B | 1 | 2 | 3 | N | M | , | . | / |Ctl/Et| | ||
| 78 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 79 | * | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right | | ||
| 80 | * `--------------------------------------------------------------------------------------------------------' | ||
| 81 | */ | ||
| 82 | [_QWERTY] = KEYMAP( | ||
| 83 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\ | ||
| 84 | 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, \ | ||
| 85 | 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, \ | ||
| 86 | 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, \ | ||
| 87 | 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 \ | ||
| 88 | ), | ||
| 89 | |||
| 90 | /* Colemak | ||
| 91 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 92 | * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | 0 | - | | ||
| 93 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 94 | * | Tab | Q | W | F | P | G | 7 | 8 | 9 | J | L | U | Y | ; | Bksp | | ||
| 95 | * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| | ||
| 96 | * | CAPS | A | R | S | T | D | 4 | 5 | 6 | H | N | E | I | O | ' | | ||
| 97 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 98 | * | Shift| Z | X | C | V | B | 1 | 2 | 3 | K | M | , | . | / |Ctl/Et| | ||
| 99 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 100 | * | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right | | ||
| 101 | * `--------------------------------------------------------------------------------------------------------' | ||
| 102 | */ | ||
| 103 | [_COLEMAK] = KEYMAP( | ||
| 104 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\ | ||
| 105 | 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, \ | ||
| 106 | 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, \ | ||
| 107 | 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, \ | ||
| 108 | 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 \ | ||
| 109 | ), | ||
| 110 | |||
| 111 | /* Dvorak | ||
| 112 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 113 | * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | | ||
| 114 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 115 | * | Tab | " | , | . | P | Y | 7 | 8 | 9 | F | G | C | R | L | Bksp | | ||
| 116 | * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| | ||
| 117 | * | Esc | A | O | E | U | I | 4 | 5 | 6 | D | H | T | N | S | / | | ||
| 118 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 119 | * | Shift| ; | Q | J | K | X | 1 | 2 | 3 | B | M | W | V | Z |Ctl/Et| | ||
| 120 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 121 | * | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right | | ||
| 122 | * `--------------------------------------------------------------------------------------------------------' | ||
| 123 | */ | ||
| 124 | [_DVORAK] = KEYMAP( | ||
| 125 | KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\ | ||
| 126 | 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, \ | ||
| 127 | 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, \ | ||
| 128 | 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, \ | ||
| 129 | 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 \ | ||
| 130 | ), | ||
| 131 | |||
| 132 | /* Lower | ||
| 133 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 134 | * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | | ||
| 135 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 136 | * | ~ | ! | @ | # | $ | % | | | | ^ | & | * | ( | ) | Del | | ||
| 137 | * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| | ||
| 138 | * | | F1 | F2 | F3 | F4 | F5 | | | | F6 | _ | + | { | } | | | | ||
| 139 | * |------+------+------+------+------+------|------+------+------+------+------+------+------+------+------| | ||
| 140 | * | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO ~ |ISO | | | | | | ||
| 141 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 142 | * | | | | | | | | | | | | Next | Vol- | Vol+ | Play | | ||
| 143 | * `--------------------------------------------------------------------------------------------------------' | ||
| 144 | */ | ||
| 145 | [_LOWER] = KEYMAP( | ||
| 146 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ | ||
| 147 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ | ||
| 148 | _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_PIPE, \ | ||
| 149 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12,S(KC_NUHS),S(KC_NUBS),_______,_______, _______, \ | ||
| 150 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ | ||
| 151 | ), | ||
| 152 | |||
| 153 | /* Raise | ||
| 154 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 155 | * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | | ||
| 156 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 157 | * | ` | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | Del | | ||
| 158 | * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| | ||
| 159 | * | Del | F1 | F2 | F3 | F4 | F5 | | | | F6 | - | = | [ | ] | \ | | ||
| 160 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 161 | * | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO # |ISO / | | | | | ||
| 162 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 163 | * | | | | | | | | | | | | Next | Vol- | Vol+ | Play | | ||
| 164 | * `--------------------------------------------------------------------------------------------------------' | ||
| 165 | */ | ||
| 166 | [_RAISE] = KEYMAP( | ||
| 167 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ | ||
| 168 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ | ||
| 169 | KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ | ||
| 170 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ | ||
| 171 | _______, _______, _______, _______, _______, KC_SPC, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ | ||
| 172 | ), | ||
| 173 | |||
| 174 | /* Mouse Layer (semi-col) | ||
| 175 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 176 | * | ACCL0| ACCL1| ACCL2| | | | | | | | | | | ||
| 177 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 178 | * | | | | | | | | | Home | Wh_Up| WHL_L| M_Up | WHL_R| Macro| | | ||
| 179 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 180 | * | | | | | | | | | End | Wh_Dn| M_Lft| M_Dn | M_Rt | | | | ||
| 181 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 182 | * | | | | | | | | | | BTN2 | BTN3 | BTN4 | BTN5 | | | | ||
| 183 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 184 | * | | | | | | BTN1 | | | | BTN1 | | | | | | | ||
| 185 | * `--------------------------------------------------------------------------------------------------------' | ||
| 186 | */ | ||
| 187 | |||
| 188 | [_MOUSECURSOR] = KEYMAP( | ||
| 189 | KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
| 190 | _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_WH_L, KC_MS_U, KC_WH_R,DEMOMACRO,_______, \ | ||
| 191 | _______, _______, _______, _______, _______, _______, _______, _______, KC_END , KC_PGDN, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, \ | ||
| 192 | _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5, _______, _______, \ | ||
| 193 | _______, _______, _______, _______, _______, KC_BTN1, _______, _______, _______, KC_BTN1, _______, _______, _______, _______, _______ \ | ||
| 194 | ), | ||
| 195 | |||
| 196 | /* Adjust (Lower + Raise) | ||
| 197 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 198 | * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | | ||
| 199 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 200 | * | Reset|RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | | | | Del | | ||
| 201 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 202 | * | | | |Aud on|Audoff|AGnorm| | | |AGswap|Qwerty|Colemk| | | | | ||
| 203 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 204 | * | |Voice-|Voice+|Mus on|Musoff| | | | | | | | BL + |BL ST |BL TG | | ||
| 205 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 206 | * | | | | | | | | | | | | | | | | | ||
| 207 | * `--------------------------------------------------------------------------------------------------------' | ||
| 208 | */ | ||
| 209 | [_ADJUST] = KEYMAP( | ||
| 210 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ | ||
| 211 | RESET, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \ | ||
| 212 | _______, _______, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, \ | ||
| 213 | _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, \ | ||
| 214 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______\ | ||
| 215 | ) | ||
| 216 | |||
| 217 | |||
| 218 | |||
| 219 | }; | ||
| 220 | |||
| 221 | |||
| 222 | #ifdef AUDIO_ENABLE | ||
| 223 | |||
| 224 | float tone_startup[][2] = SONG(STARTUP_SOUND); | ||
| 225 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
| 226 | float tone_dvorak[][2] = SONG(DVORAK_SOUND); | ||
| 227 | float tone_colemak[][2] = SONG(COLEMAK_SOUND); | ||
| 228 | float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); | ||
| 229 | float tone_goodbye[][2] = SONG(GOODBYE_SOUND); | ||
| 230 | #endif | ||
| 231 | |||
| 232 | // define variables for reactive RGB | ||
| 233 | bool RGB_INIT = false; | ||
| 234 | bool TOG_STATUS = false; | ||
| 235 | int RGB_current_mode; | ||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | void persistant_default_layer_set(uint16_t default_layer) { | ||
| 240 | eeconfig_update_default_layer(default_layer); | ||
| 241 | default_layer_set(default_layer); | ||
| 242 | } | ||
| 243 | |||
| 244 | void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { | ||
| 245 | if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { | ||
| 246 | rgblight_mode(RGB_current_mode); | ||
| 247 | layer_on(layer3); | ||
| 248 | } else { | ||
| 249 | layer_off(layer3); | ||
| 250 | } | ||
| 251 | } | ||
| 252 | |||
| 253 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 254 | switch (keycode) { | ||
| 255 | case QWERTY: | ||
| 256 | if (record->event.pressed) { | ||
| 257 | #ifdef AUDIO_ENABLE | ||
| 258 | PLAY_NOTE_ARRAY(tone_qwerty, false, 0); | ||
| 259 | #endif | ||
| 260 | persistant_default_layer_set(1UL<<_QWERTY); | ||
| 261 | } | ||
| 262 | return false; | ||
| 263 | break; | ||
| 264 | case COLEMAK: | ||
| 265 | if (record->event.pressed) { | ||
| 266 | #ifdef AUDIO_ENABLE | ||
| 267 | PLAY_NOTE_ARRAY(tone_colemak, false, 0); | ||
| 268 | #endif | ||
| 269 | persistant_default_layer_set(1UL<<_COLEMAK); | ||
| 270 | } | ||
| 271 | return false; | ||
| 272 | break; | ||
| 273 | case LOWER: | ||
| 274 | if (record->event.pressed) { | ||
| 275 | //not sure how to have keyboard check mode and set it to a variable, so my work around | ||
| 276 | //uses another variable that would be set to true after the first time a reactive key is pressed. | ||
| 277 | if (RGB_INIT) {} else { | ||
| 278 | RGB_current_mode = rgblight_config.mode; | ||
| 279 | RGB_INIT = true; | ||
| 280 | } | ||
| 281 | if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false | ||
| 282 | } else { | ||
| 283 | TOG_STATUS = !TOG_STATUS; | ||
| 284 | rgblight_mode(16); | ||
| 285 | } | ||
| 286 | layer_on(_LOWER); | ||
| 287 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 288 | } else { | ||
| 289 | rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change | ||
| 290 | TOG_STATUS = false; | ||
| 291 | layer_off(_LOWER); | ||
| 292 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 293 | } | ||
| 294 | return false; | ||
| 295 | break; | ||
| 296 | case RAISE: | ||
| 297 | if (record->event.pressed) { | ||
| 298 | //not sure how to have keyboard check mode and set it to a variable, so my work around | ||
| 299 | //uses another variable that would be set to true after the first time a reactive key is pressed. | ||
| 300 | if (RGB_INIT) {} else { | ||
| 301 | RGB_current_mode = rgblight_config.mode; | ||
| 302 | RGB_INIT = true; | ||
| 303 | } | ||
| 304 | if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false | ||
| 305 | } else { | ||
| 306 | TOG_STATUS = !TOG_STATUS; | ||
| 307 | rgblight_mode(15); | ||
| 308 | } | ||
| 309 | layer_on(_RAISE); | ||
| 310 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 311 | } else { | ||
| 312 | rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change | ||
| 313 | layer_off(_RAISE); | ||
| 314 | TOG_STATUS = false; | ||
| 315 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 316 | } | ||
| 317 | return false; | ||
| 318 | break; | ||
| 319 | case BACKLIT: | ||
| 320 | if (record->event.pressed) { | ||
| 321 | register_code(KC_RSFT); | ||
| 322 | #ifdef BACKLIGHT_ENABLE | ||
| 323 | backlight_step(); | ||
| 324 | #endif | ||
| 325 | } else { | ||
| 326 | unregister_code(KC_RSFT); | ||
| 327 | } | ||
| 328 | return false; | ||
| 329 | break; | ||
| 330 | case RGB_MOD: | ||
| 331 | //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 | ||
| 332 | if (record->event.pressed) { | ||
| 333 | rgblight_mode(RGB_current_mode); | ||
| 334 | rgblight_step(); | ||
| 335 | RGB_current_mode = rgblight_config.mode; | ||
| 336 | } | ||
| 337 | return false; | ||
| 338 | break; | ||
| 339 | } | ||
| 340 | return true; | ||
| 341 | } | ||
| 342 | |||
| 343 | void matrix_init_user(void) { | ||
| 344 | #ifdef USE_I2C | ||
| 345 | i2c_master_init(); | ||
| 346 | #ifdef SSD1306OLED | ||
| 347 | // calls code for the SSD1306 OLED | ||
| 348 | _delay_ms(400); | ||
| 349 | TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); | ||
| 350 | iota_gfx_init(); // turns on the display | ||
| 351 | #endif | ||
| 352 | #endif | ||
| 353 | #ifdef AUDIO_ENABLE | ||
| 354 | startup_user(); | ||
| 355 | #endif | ||
| 356 | } | ||
| 357 | |||
| 358 | void matrix_scan_user(void) { | ||
| 359 | #ifdef SSD1306OLED | ||
| 360 | iota_gfx_task(); // this is what updates the display continuously | ||
| 361 | #endif | ||
| 362 | } | ||
| 363 | |||
| 364 | #ifdef AUDIO_ENABLE | ||
| 365 | |||
| 366 | void startup_user() | ||
| 367 | { | ||
| 368 | _delay_ms(20); // gets rid of tick | ||
| 369 | PLAY_NOTE_ARRAY(tone_startup, false, 0); | ||
| 370 | } | ||
| 371 | |||
| 372 | void shutdown_user() | ||
| 373 | {cc | ||
| 374 | PLAY_NOTE_ARRAY(tone_goodbye, false, 0); | ||
| 375 | _delay_ms(150); | ||
| 376 | stop_all_notes(); | ||
| 377 | } | ||
| 378 | |||
| 379 | void music_on_user(void) | ||
| 380 | { | ||
| 381 | music_scale_user(); | ||
| 382 | } | ||
| 383 | |||
| 384 | void music_scale_user(void) | ||
| 385 | { | ||
| 386 | PLAY_NOTE_ARRAY(music_scale, false, 0); | ||
| 387 | } | ||
| 388 | |||
| 389 | #endif | ||
| 390 | |||
| 391 | /* | ||
| 392 | * Macro definition | ||
| 393 | */ | ||
| 394 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | ||
| 395 | { | ||
| 396 | if (!eeconfig_is_enabled()) { | ||
| 397 | eeconfig_init(); | ||
| 398 | } | ||
| 399 | |||
| 400 | switch (id) { | ||
| 401 | case KC_DEMOMACRO: | ||
| 402 | if (record->event.pressed){ | ||
| 403 | 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); | ||
| 404 | } | ||
| 405 | } | ||
| 406 | |||
| 407 | return MACRO_NONE; | ||
| 408 | } | ||
| 409 | |||
| 410 | void matrix_update(struct CharacterMatrix *dest, | ||
| 411 | const struct CharacterMatrix *source) { | ||
| 412 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
| 413 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
| 414 | dest->dirty = true; | ||
| 415 | } | ||
| 416 | } | ||
| 417 | |||
| 418 | //assign the right code to your layers for OLED display | ||
| 419 | #define L_BASE 0 | ||
| 420 | #define L_LOWER 8 | ||
| 421 | #define L_RAISE 16 | ||
| 422 | #define L_FNLAYER 64 | ||
| 423 | #define L_NUMLAY 128 | ||
| 424 | #define L_NLOWER 136 | ||
| 425 | #define L_NFNLAYER 192 | ||
| 426 | #define L_MOUSECURSOR 256 | ||
| 427 | #define L_ADJUST 65560 | ||
| 428 | |||
| 429 | void iota_gfx_task_user(void) { | ||
| 430 | #if DEBUG_TO_SCREEN | ||
| 431 | if (debug_enable) { | ||
| 432 | return; | ||
| 433 | } | ||
| 434 | #endif | ||
| 435 | |||
| 436 | struct CharacterMatrix matrix; | ||
| 437 | |||
| 438 | matrix_clear(&matrix); | ||
| 439 | matrix_write_P(&matrix, PSTR("USB: ")); | ||
| 440 | #ifdef PROTOCOL_LUFA | ||
| 441 | switch (USB_DeviceState) { | ||
| 442 | case DEVICE_STATE_Unattached: | ||
| 443 | matrix_write_P(&matrix, PSTR("Unattached")); | ||
| 444 | break; | ||
| 445 | case DEVICE_STATE_Suspended: | ||
| 446 | matrix_write_P(&matrix, PSTR("Suspended")); | ||
| 447 | break; | ||
| 448 | case DEVICE_STATE_Configured: | ||
| 449 | matrix_write_P(&matrix, PSTR("Connected")); | ||
| 450 | break; | ||
| 451 | case DEVICE_STATE_Powered: | ||
| 452 | matrix_write_P(&matrix, PSTR("Powered")); | ||
| 453 | break; | ||
| 454 | case DEVICE_STATE_Default: | ||
| 455 | matrix_write_P(&matrix, PSTR("Default")); | ||
| 456 | break; | ||
| 457 | case DEVICE_STATE_Addressed: | ||
| 458 | matrix_write_P(&matrix, PSTR("Addressed")); | ||
| 459 | break; | ||
| 460 | default: | ||
| 461 | matrix_write_P(&matrix, PSTR("Invalid")); | ||
| 462 | } | ||
| 463 | #endif | ||
| 464 | |||
| 465 | // 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 | ||
| 466 | |||
| 467 | char buf[40]; | ||
| 468 | snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); | ||
| 469 | matrix_write_P(&matrix, PSTR("\n\nLayer: ")); | ||
| 470 | switch (layer_state) { | ||
| 471 | case L_BASE: | ||
| 472 | matrix_write_P(&matrix, PSTR("Default")); | ||
| 473 | break; | ||
| 474 | case L_RAISE: | ||
| 475 | matrix_write_P(&matrix, PSTR("Raise")); | ||
| 476 | break; | ||
| 477 | case L_LOWER: | ||
| 478 | matrix_write_P(&matrix, PSTR("Lower")); | ||
| 479 | break; | ||
| 480 | case L_ADJUST: | ||
| 481 | matrix_write_P(&matrix, PSTR("ADJUST")); | ||
| 482 | break; | ||
| 483 | default: | ||
| 484 | matrix_write(&matrix, buf); | ||
| 485 | } | ||
| 486 | |||
| 487 | // Host Keyboard LED Status | ||
| 488 | char led[40]; | ||
| 489 | snprintf(led, sizeof(led), "\n%s %s %s", | ||
| 490 | (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", | ||
| 491 | (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", | ||
| 492 | (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); | ||
| 493 | matrix_write(&matrix, led); | ||
| 494 | matrix_update(&display, &matrix); | ||
| 495 | } | ||
| 496 | |||
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 @@ | |||
| 1 | # The Default Planck Layout | ||
| 2 | |||
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 @@ | |||
| 1 | # How to add your own keymap | ||
| 2 | |||
| 3 | Folders can be named however you'd like (will be approved upon merging), or should follow the format with a preceding `_`: | ||
| 4 | |||
| 5 | _[ISO 3166-1 alpha-2 code*]_[layout variant]_[layout name/author] | ||
| 6 | |||
| 7 | \* See full list: https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements | ||
| 8 | |||
| 9 | and contain the following files: | ||
| 10 | |||
| 11 | * `keymap.c` | ||
| 12 | * `readme.md` *recommended* | ||
| 13 | * `config.h` *optional*, found automatically when compiling | ||
| 14 | * `Makefile` *optional*, found automatically when compling | ||
| 15 | |||
| 16 | When adding your keymap to this list, keep it organised alphabetically (select list, edit->sort lines), and use this format: | ||
| 17 | |||
| 18 | * **folder_name** description | ||
| 19 | |||
| 20 | # List of Planck keymaps | ||
| 21 | |||
| 22 | * **default** default Planck layout | ||
| 23 | * **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 @@ | |||
| 1 | |||
| 2 | |||
| 3 | # Build Options | ||
| 4 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 5 | # the appropriate keymap folder that will get included automatically | ||
| 6 | # | ||
| 7 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) | ||
| 8 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | ||
| 9 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
| 10 | CONSOLE_ENABLE = no # Console for debug(+400) | ||
| 11 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 12 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 13 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 14 | MIDI_ENABLE = yes # MIDI controls | ||
| 15 | AUDIO_ENABLE = no # Audio output on port C6 | ||
| 16 | UNICODE_ENABLE = no # Unicode | ||
| 17 | BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 18 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 19 | ONEHAND_ENABLE = no # Enable one-hand typing | ||
| 20 | |||
| 21 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 22 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 23 | |||
| 24 | ifndef QUANTUM_DIR | ||
| 25 | include ../../../../Makefile | ||
| 26 | 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 @@ | |||
| 1 | #ifndef CONFIG_USER_H | ||
| 2 | #define CONFIG_USER_H | ||
| 3 | |||
| 4 | #include "../../config.h" | ||
| 5 | |||
| 6 | #define LEADER_TIMEOUT 300 | ||
| 7 | //#define BACKLIGHT_BREATHING | ||
| 8 | #define PREVENT_STUCK_MODIFIERS | ||
| 9 | |||
| 10 | #define USE_I2C | ||
| 11 | #define SSD1306OLED | ||
| 12 | #define OLED_ROTATE180 | ||
| 13 | |||
| 14 | /* ws2812 RGB LED*/ | ||
| 15 | #define RGB_DI_PIN D4 | ||
| 16 | #define RGBLIGHT_ANIMATIONS | ||
| 17 | #define RGBLED_NUM 14 // Number of LEDs | ||
| 18 | #define RGBLIGHT_HUE_STEP 10 | ||
| 19 | #define RGBLIGHT_SAT_STEP 17 | ||
| 20 | |||
| 21 | #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 @@ | |||
| 1 | #include "hadron.h" | ||
| 2 | #include "bootloader.h" | ||
| 3 | #include "action_layer.h" | ||
| 4 | #include "eeconfig.h" | ||
| 5 | #include "LUFA/Drivers/Peripheral/TWI.h" | ||
| 6 | #ifdef AUDIO_ENABLE | ||
| 7 | #include "audio.h" | ||
| 8 | #endif | ||
| 9 | #ifdef USE_I2C | ||
| 10 | #include "i2c.h" | ||
| 11 | #endif | ||
| 12 | #ifdef SSD1306OLED | ||
| 13 | #include "ssd1306.h" | ||
| 14 | #endif | ||
| 15 | extern keymap_config_t keymap_config; | ||
| 16 | |||
| 17 | //Following line allows macro to read current RGB settings | ||
| 18 | extern rgblight_config_t rgblight_config; | ||
| 19 | |||
| 20 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
| 21 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
| 22 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
| 23 | // entirely and just use numbers. | ||
| 24 | #define _QWERTY 0 | ||
| 25 | #define _LOWER 3 | ||
| 26 | #define _RAISE 4 | ||
| 27 | #define _FNLAYER 6 | ||
| 28 | #define _NUMLAY 7 | ||
| 29 | #define _MOUSECURSOR 8 | ||
| 30 | #define _ADJUST 16 | ||
| 31 | |||
| 32 | enum preonic_keycodes { | ||
| 33 | QWERTY = SAFE_RANGE, | ||
| 34 | COLEMAK, | ||
| 35 | DVORAK, | ||
| 36 | LOWER, | ||
| 37 | RAISE, | ||
| 38 | BACKLIT, | ||
| 39 | RGBLED_TOGGLE, | ||
| 40 | RGBLED_STEP_MODE, | ||
| 41 | RGBLED_INCREASE_HUE, | ||
| 42 | RGBLED_DECREASE_HUE, | ||
| 43 | RGBLED_INCREASE_SAT, | ||
| 44 | RGBLED_DECREASE_SAT, | ||
| 45 | RGBLED_INCREASE_VAL, | ||
| 46 | RGBLED_DECREASE_VAL, | ||
| 47 | }; | ||
| 48 | |||
| 49 | enum macro_keycodes { | ||
| 50 | KC_DEMOMACRO, | ||
| 51 | }; | ||
| 52 | |||
| 53 | // Fillers to make layering more clear | ||
| 54 | #define _______ KC_TRNS | ||
| 55 | #define XXXXXXX KC_NO | ||
| 56 | // Custom macros | ||
| 57 | #define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl | ||
| 58 | #define CTL_TTAB CTL_T(KC_TAB) // Tap for Esc, hold for Ctrl | ||
| 59 | #define CTL_ENT CTL_T(KC_ENT) // Tap for Enter, hold for Ctrl | ||
| 60 | #define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift | ||
| 61 | // Requires KC_TRNS/_______ for the trigger key in the destination layer | ||
| 62 | #define LT_FN(kc) LT(_FNLAYER, kc) // L-ayer T-ap Function Layer | ||
| 63 | #define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor | ||
| 64 | #define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise | ||
| 65 | #define TG_NUMLAY TG(_NUMLAY) //Toggle for layer _NUMLAY | ||
| 66 | #define DEMOMACRO M(KC_DEMOMACRO) // My login macros | ||
| 67 | |||
| 68 | |||
| 69 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 70 | |||
| 71 | /* Qwerty | ||
| 72 | * ,------+------+------+------+------+------------------------------------------------. | ||
| 73 | * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | | ||
| 74 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 75 | * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | 7 | 8 | 9 | | ||
| 76 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 77 | * | CAPS | A | S | D | F | G | H | J | K | L | ; |Enter | 4 | 5 | 6 | | ||
| 78 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 79 | * | Shift| Z | X | C | V | B | N | M | , | . | / | = | 1 | 2 | 3 | | ||
| 80 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 81 | * | ~ | Ctrl | Alt | GUI |Lower |Space |Space |Raise | RAlt | Ins | Del |NumLay| 0 | . | ENT | | ||
| 82 | * `--------------------------------------------------------------------------------------------------------' | ||
| 83 | */ | ||
| 84 | [_QWERTY] = KEYMAP( | ||
| 85 | KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,\ | ||
| 86 | 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, \ | ||
| 87 | 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, \ | ||
| 88 | 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, \ | ||
| 89 | 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 \ | ||
| 90 | ), | ||
| 91 | |||
| 92 | /* Lower | ||
| 93 | * ,-----------------------------------------------------------------------------------. | ||
| 94 | * | | | | | | | | | | | | | | ||
| 95 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 96 | * | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | ~ | \ | | | | | ||
| 97 | * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| | ||
| 98 | * | CAPS | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | | | | | ||
| 99 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 100 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | [ | ] | | | | | | ||
| 101 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 102 | * | | | | | | | | | Next | Vol- | Vol+ | Play | | | | | ||
| 103 | * `--------------------------------------------------------------------------------------------------------' | ||
| 104 | */ | ||
| 105 | [_LOWER] = KEYMAP( | ||
| 106 | KC_ESC, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ | ||
| 107 | KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_GRV, KC_BSLS, _______, _______, _______, \ | ||
| 108 | KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_EQL, KC_LBRC, KC_RBRC, KC_PIPE, _______, _______, _______, \ | ||
| 109 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_LCBR, KC_RCBR, _______, _______, _______, _______, \ | ||
| 110 | _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, _______, _______\ | ||
| 111 | ), | ||
| 112 | |||
| 113 | /* Raise | ||
| 114 | * ,-----------------------------------------------------------------------------------. | ||
| 115 | * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | | ||
| 116 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 117 | * | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | ~ | \ | | | | | ||
| 118 | * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| | ||
| 119 | * | | A | Up | D | PrSc | | 4 | 5 | 6 | * | : | ' | | | | | ||
| 120 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 121 | * | | Lt | Dn | Rt | Mute | | 1 | 2 | 3 | Up | / | | | | | | ||
| 122 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 123 | * | | | | | |Space | 0 | | Left | Down | Right| | | | | | ||
| 124 | * `--------------------------------------------------------------------------------------------------------' | ||
| 125 | */ | ||
| 126 | [_RAISE] = KEYMAP( | ||
| 127 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ | ||
| 128 | KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_PLUS, KC_BSLS, _______, _______, _______, \ | ||
| 129 | _______, KC_A, KC_UP, KC_D, KC_PSCR, _______, KC_4, KC_5, KC_6, KC_PAST, KC_COLN, KC_QUOT, _______, _______, _______, \ | ||
| 130 | _______, KC_LEFT, KC_DOWN, KC_RIGHT, KC__MUTE, _______, KC_1, KC_2, KC_3, KC_UP, KC_SLSH, _______, _______, _______, _______, \ | ||
| 131 | _______, _______, _______, _______, _______, KC_SPC, KC_0, _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, _______, _______ \ | ||
| 132 | ), | ||
| 133 | |||
| 134 | /* FN layer on Esc key | ||
| 135 | * ,-----------------------------------------------------------------------------------. | ||
| 136 | * | | | | | | | | | | | | | | ||
| 137 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 138 | * | | ! | @ | # | $ | % | ^ | & | * | ( | ) | + | | | | | ||
| 139 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 140 | * | | F1 | F2 | F3 | F4 | F5 | F6 | _ | = | [ | ] | ' | | | | | ||
| 141 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 142 | * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | { | } | | | | | | ||
| 143 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 144 | * | | | | | | | | | Next | Vol- | Vol+ | Play | | | | | ||
| 145 | * `--------------------------------------------------------------------------------------------------------' | ||
| 146 | */ | ||
| 147 | [_FNLAYER] = KEYMAP( | ||
| 148 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\ | ||
| 149 | _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PLUS, _______, _______, _______, \ | ||
| 150 | _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_EQL, KC_LBRC, KC_RBRC, KC_QUOT, _______, _______, _______, \ | ||
| 151 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS), S(KC_NUBS), KC_LCBR, KC_RCBR, _______, _______, _______, _______, \ | ||
| 152 | _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, _______, _______ \ | ||
| 153 | ), | ||
| 154 | |||
| 155 | /* Num Layer | ||
| 156 | * ,-----------------------------------------------------------------------------------. | ||
| 157 | * | | | | | | | | | | | | | | ||
| 158 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 159 | * | | | | | | | | | | | | | F7 | F8 | F9 | | ||
| 160 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 161 | * | | | | | | | | | | | | | F4 | F5 | F6 | | ||
| 162 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 163 | * | | | | | | | | | | | | | | Up | | | ||
| 164 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 165 | * | | | | | | | | | | | | Exit | Left | Down | Rght | | ||
| 166 | * `--------------------------------------------------------------------------------------------------------' | ||
| 167 | */ | ||
| 168 | [_NUMLAY] = KEYMAP( | ||
| 169 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\ | ||
| 170 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_HOME, KC_PGUP, \ | ||
| 171 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, \ | ||
| 172 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PMNS, KC_UP, KC_PPLS, \ | ||
| 173 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT \ | ||
| 174 | ), | ||
| 175 | |||
| 176 | /* Mouse Layer (semi-col) | ||
| 177 | * ,-----------------------------------------------------------------------------------. | ||
| 178 | * | |ACCL0| ACCL1| ACCL2 | | | | | | | | | | ||
| 179 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 180 | * | | | | | | Home | Wh_Up| WHL_L| M_Up | WHL_R| | | | | | | ||
| 181 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 182 | * | | | | | | End | Wh_Dn| M_Lft| M_Dn | M_Rt | | | | | | | ||
| 183 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 184 | * | | | | | | | BTN2 | BTN3 | BTN4 | BTN5 | | | | | | | ||
| 185 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 186 | * | | | | | | BTN1 | | | | BTN1 | | | | | | | ||
| 187 | * `--------------------------------------------------------------------------------------------------------' | ||
| 188 | */ | ||
| 189 | |||
| 190 | [_MOUSECURSOR] = KEYMAP( | ||
| 191 | _______, KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______,\ | ||
| 192 | _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_WH_L, KC_MS_U, KC_WH_R, DEMOMACRO, _______, _______, _______, _______, \ | ||
| 193 | _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_END , KC_PGDN, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, _______, _______, _______, \ | ||
| 194 | _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5, _______, _______, _______, _______, _______, \ | ||
| 195 | _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, _______, _______, _______ \ | ||
| 196 | ), | ||
| 197 | |||
| 198 | /* Adjust (Lower + Raise) | ||
| 199 | |||
| 200 | * ,-----------------------------------------------------------------------------------. | ||
| 201 | * | Reset| | | | | | | | | VolD | VolU | Mute | | ||
| 202 | * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. | ||
| 203 | * | |RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | Del | | | | | ||
| 204 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 205 | * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty| | | | | | | | | ||
| 206 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 207 | * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | BL + |BL ST |BLSTEP| BL TG| | | | | ||
| 208 | * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 209 | * | | | | | | | | | | | | | | | | | ||
| 210 | * `--------------------------------------------------------------------------------------------------------' | ||
| 211 | */ | ||
| 212 | [_ADJUST] = KEYMAP( | ||
| 213 | RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_VOLD, KC_VOLU, KC_MUTE, \ | ||
| 214 | _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, KC_DEL, _______, _______, _______, \ | ||
| 215 | _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______, _______, _______, _______, \ | ||
| 216 | _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, _______, _______, _______, \ | ||
| 217 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ | ||
| 218 | ) | ||
| 219 | |||
| 220 | |||
| 221 | |||
| 222 | }; | ||
| 223 | |||
| 224 | |||
| 225 | #ifdef AUDIO_ENABLE | ||
| 226 | |||
| 227 | float tone_startup[][2] = SONG(STARTUP_SOUND); | ||
| 228 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
| 229 | float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); | ||
| 230 | float tone_goodbye[][2] = SONG(GOODBYE_SOUND); | ||
| 231 | #endif | ||
| 232 | |||
| 233 | // define variables for reactive RGB | ||
| 234 | bool RGB_INIT = false; | ||
| 235 | bool TOG_STATUS = false; | ||
| 236 | bool NUMLAY_STATUS = false; | ||
| 237 | int RGB_current_mode; | ||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | void persistant_default_layer_set(uint16_t default_layer) { | ||
| 242 | eeconfig_update_default_layer(default_layer); | ||
| 243 | default_layer_set(default_layer); | ||
| 244 | } | ||
| 245 | |||
| 246 | void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { | ||
| 247 | if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { | ||
| 248 | rgblight_mode(RGB_current_mode); | ||
| 249 | layer_on(layer3); | ||
| 250 | } else { | ||
| 251 | layer_off(layer3); | ||
| 252 | } | ||
| 253 | } | ||
| 254 | |||
| 255 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 256 | switch (keycode) { | ||
| 257 | case QWERTY: | ||
| 258 | if (record->event.pressed) { | ||
| 259 | #ifdef AUDIO_ENABLE | ||
| 260 | PLAY_NOTE_ARRAY(tone_qwerty, false, 0); | ||
| 261 | #endif | ||
| 262 | persistant_default_layer_set(1UL<<_QWERTY); | ||
| 263 | } | ||
| 264 | return false; | ||
| 265 | break; | ||
| 266 | case LOWER: | ||
| 267 | if (record->event.pressed) { | ||
| 268 | //not sure how to have keyboard check mode and set it to a variable, so my work around | ||
| 269 | //uses another variable that would be set to true after the first time a reactive key is pressed. | ||
| 270 | if (RGB_INIT) {} else { | ||
| 271 | RGB_current_mode = rgblight_config.mode; | ||
| 272 | RGB_INIT = true; | ||
| 273 | } | ||
| 274 | if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false | ||
| 275 | } else { | ||
| 276 | TOG_STATUS = !TOG_STATUS; | ||
| 277 | rgblight_mode(16); | ||
| 278 | } | ||
| 279 | layer_on(_LOWER); | ||
| 280 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 281 | } else { | ||
| 282 | rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change | ||
| 283 | TOG_STATUS = false; | ||
| 284 | layer_off(_LOWER); | ||
| 285 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 286 | } | ||
| 287 | return false; | ||
| 288 | break; | ||
| 289 | case RAISE: | ||
| 290 | if (record->event.pressed) { | ||
| 291 | //not sure how to have keyboard check mode and set it to a variable, so my work around | ||
| 292 | //uses another variable that would be set to true after the first time a reactive key is pressed. | ||
| 293 | if (RGB_INIT) {} else { | ||
| 294 | RGB_current_mode = rgblight_config.mode; | ||
| 295 | RGB_INIT = true; | ||
| 296 | } | ||
| 297 | if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false | ||
| 298 | } else { | ||
| 299 | TOG_STATUS = !TOG_STATUS; | ||
| 300 | rgblight_mode(15); | ||
| 301 | } | ||
| 302 | layer_on(_RAISE); | ||
| 303 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 304 | } else { | ||
| 305 | rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change | ||
| 306 | layer_off(_RAISE); | ||
| 307 | TOG_STATUS = false; | ||
| 308 | update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); | ||
| 309 | } | ||
| 310 | return false; | ||
| 311 | break; | ||
| 312 | case BACKLIT: | ||
| 313 | if (record->event.pressed) { | ||
| 314 | register_code(KC_RSFT); | ||
| 315 | #ifdef BACKLIGHT_ENABLE | ||
| 316 | backlight_step(); | ||
| 317 | #endif | ||
| 318 | } else { | ||
| 319 | unregister_code(KC_RSFT); | ||
| 320 | } | ||
| 321 | return false; | ||
| 322 | break; | ||
| 323 | //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 | ||
| 324 | case TG_NUMLAY: | ||
| 325 | if (record->event.pressed) { | ||
| 326 | if (RGB_INIT) {} else { | ||
| 327 | RGB_current_mode = rgblight_config.mode; | ||
| 328 | RGB_INIT = true; | ||
| 329 | } | ||
| 330 | NUMLAY_STATUS = !NUMLAY_STATUS; | ||
| 331 | if (NUMLAY_STATUS) { | ||
| 332 | rgblight_mode(4); | ||
| 333 | layer_on(_NUMLAY); | ||
| 334 | } else { | ||
| 335 | rgblight_mode(RGB_current_mode); | ||
| 336 | layer_off(_NUMLAY); } | ||
| 337 | } | ||
| 338 | return false; | ||
| 339 | break; | ||
| 340 | case RGB_MOD: | ||
| 341 | //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 | ||
| 342 | if (record->event.pressed) { | ||
| 343 | rgblight_mode(RGB_current_mode); | ||
| 344 | rgblight_step(); | ||
| 345 | RGB_current_mode = rgblight_config.mode; | ||
| 346 | } | ||
| 347 | return false; | ||
| 348 | break; | ||
| 349 | } | ||
| 350 | return true; | ||
| 351 | } | ||
| 352 | |||
| 353 | void matrix_init_user(void) { | ||
| 354 | #ifdef USE_I2C | ||
| 355 | i2c_master_init(); | ||
| 356 | #ifdef SSD1306OLED | ||
| 357 | // calls code for the SSD1306 OLED | ||
| 358 | _delay_ms(400); | ||
| 359 | TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); | ||
| 360 | iota_gfx_init(); // turns on the display | ||
| 361 | #endif | ||
| 362 | #endif | ||
| 363 | #ifdef AUDIO_ENABLE | ||
| 364 | startup_user(); | ||
| 365 | #endif | ||
| 366 | } | ||
| 367 | |||
| 368 | void matrix_scan_user(void) { | ||
| 369 | #ifdef SSD1306OLED | ||
| 370 | iota_gfx_task(); // this is what updates the display continuously | ||
| 371 | #endif | ||
| 372 | } | ||
| 373 | |||
| 374 | #ifdef AUDIO_ENABLE | ||
| 375 | |||
| 376 | void startup_user() | ||
| 377 | { | ||
| 378 | _delay_ms(20); // gets rid of tick | ||
| 379 | PLAY_NOTE_ARRAY(tone_startup, false, 0); | ||
| 380 | } | ||
| 381 | |||
| 382 | void shutdown_user() | ||
| 383 | {cc | ||
| 384 | PLAY_NOTE_ARRAY(tone_goodbye, false, 0); | ||
| 385 | _delay_ms(150); | ||
| 386 | stop_all_notes(); | ||
| 387 | } | ||
| 388 | |||
| 389 | void music_on_user(void) | ||
| 390 | { | ||
| 391 | music_scale_user(); | ||
| 392 | } | ||
| 393 | |||
| 394 | void music_scale_user(void) | ||
| 395 | { | ||
| 396 | PLAY_NOTE_ARRAY(music_scale, false, 0); | ||
| 397 | } | ||
| 398 | |||
| 399 | #endif | ||
| 400 | |||
| 401 | /* | ||
| 402 | * Macro definition | ||
| 403 | */ | ||
| 404 | const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | ||
| 405 | { | ||
| 406 | if (!eeconfig_is_enabled()) { | ||
| 407 | eeconfig_init(); | ||
| 408 | } | ||
| 409 | |||
| 410 | switch (id) { | ||
| 411 | case KC_DEMOMACRO: | ||
| 412 | if (record->event.pressed){ | ||
| 413 | 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); | ||
| 414 | } | ||
| 415 | } | ||
| 416 | |||
| 417 | return MACRO_NONE; | ||
| 418 | } | ||
| 419 | |||
| 420 | void matrix_update(struct CharacterMatrix *dest, | ||
| 421 | const struct CharacterMatrix *source) { | ||
| 422 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
| 423 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
| 424 | dest->dirty = true; | ||
| 425 | } | ||
| 426 | } | ||
| 427 | |||
| 428 | //assign the right code to your layers for OLED display | ||
| 429 | #define L_BASE 0 | ||
| 430 | #define L_LOWER 8 | ||
| 431 | #define L_RAISE 16 | ||
| 432 | #define L_FNLAYER 64 | ||
| 433 | #define L_NUMLAY 128 | ||
| 434 | #define L_NLOWER 136 | ||
| 435 | #define L_NFNLAYER 192 | ||
| 436 | #define L_MOUSECURSOR 256 | ||
| 437 | #define L_ADJUST 65560 | ||
| 438 | |||
| 439 | void iota_gfx_task_user(void) { | ||
| 440 | #if DEBUG_TO_SCREEN | ||
| 441 | if (debug_enable) { | ||
| 442 | return; | ||
| 443 | } | ||
| 444 | #endif | ||
| 445 | |||
| 446 | struct CharacterMatrix matrix; | ||
| 447 | |||
| 448 | matrix_clear(&matrix); | ||
| 449 | matrix_write_P(&matrix, PSTR("USB: ")); | ||
| 450 | #ifdef PROTOCOL_LUFA | ||
| 451 | switch (USB_DeviceState) { | ||
| 452 | case DEVICE_STATE_Unattached: | ||
| 453 | matrix_write_P(&matrix, PSTR("Unattached")); | ||
| 454 | break; | ||
| 455 | case DEVICE_STATE_Suspended: | ||
| 456 | matrix_write_P(&matrix, PSTR("Suspended")); | ||
| 457 | break; | ||
| 458 | case DEVICE_STATE_Configured: | ||
| 459 | matrix_write_P(&matrix, PSTR("Connected")); | ||
| 460 | break; | ||
| 461 | case DEVICE_STATE_Powered: | ||
| 462 | matrix_write_P(&matrix, PSTR("Powered")); | ||
| 463 | break; | ||
| 464 | case DEVICE_STATE_Default: | ||
| 465 | matrix_write_P(&matrix, PSTR("Default")); | ||
| 466 | break; | ||
| 467 | case DEVICE_STATE_Addressed: | ||
| 468 | matrix_write_P(&matrix, PSTR("Addressed")); | ||
| 469 | break; | ||
| 470 | default: | ||
| 471 | matrix_write_P(&matrix, PSTR("Invalid")); | ||
| 472 | } | ||
| 473 | #endif | ||
| 474 | |||
| 475 | // 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 | ||
| 476 | |||
| 477 | char buf[40]; | ||
| 478 | snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); | ||
| 479 | matrix_write_P(&matrix, PSTR("\n\nLayer: ")); | ||
| 480 | switch (layer_state) { | ||
| 481 | case L_BASE: | ||
| 482 | matrix_write_P(&matrix, PSTR("Default")); | ||
| 483 | break; | ||
| 484 | case L_RAISE: | ||
| 485 | matrix_write_P(&matrix, PSTR("Raise")); | ||
| 486 | break; | ||
| 487 | case L_LOWER: | ||
| 488 | matrix_write_P(&matrix, PSTR("Lower")); | ||
| 489 | break; | ||
| 490 | case L_ADJUST: | ||
| 491 | matrix_write_P(&matrix, PSTR("ADJUST")); | ||
| 492 | break; | ||
| 493 | default: | ||
| 494 | matrix_write(&matrix, buf); | ||
| 495 | } | ||
| 496 | |||
| 497 | // Host Keyboard LED Status | ||
| 498 | char led[40]; | ||
| 499 | snprintf(led, sizeof(led), "\n%s %s %s", | ||
| 500 | (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", | ||
| 501 | (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", | ||
| 502 | (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); | ||
| 503 | matrix_write(&matrix, led); | ||
| 504 | matrix_update(&display, &matrix); | ||
| 505 | } | ||
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 @@ | |||
| 1 | # The Default Planck Layout | ||
| 2 | |||
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 @@ | |||
| 1 | -------- begin -------- | ||
| 2 | avr-gcc.exe (AVR_8_bit_GNU_Toolchain_3.5.0_1662) 4.9.2 | ||
| 3 | Copyright (C) 2014 Free Software Foundation, Inc. | ||
| 4 | This is free software; see the source for copying conditions. There is NO | ||
| 5 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 6 | |||
| 7 | Compiling: ../../keyboards/planck/planck.c [32;01m[OK][0m | ||
| 8 | Compiling: ../../keyboards/planck/keymaps/experimental/keymap.c [33;01m[WARNINGS][0m | ||
| 9 | | | ||
| 10 | | ../../keyboards/planck/keymaps/experimental/keymap.c: In function 'action_get_macro': | ||
| 11 | | ../../keyboards/planck/keymaps/experimental/keymap.c:227:17: warning: implicit declaration of function 'breathing_speed_set' [-Wimplicit-function-declaration] | ||
| 12 | | breathing_speed_set(2); | ||
| 13 | | ^ | ||
| 14 | | ../../keyboards/planck/keymaps/experimental/keymap.c:228:17: warning: implicit declaration of function 'breathing_pulse' [-Wimplicit-function-declaration] | ||
| 15 | | breathing_pulse(); | ||
| 16 | | ^ | ||
| 17 | | | ||
| 18 | Compiling: ../../quantum/quantum.c [32;01m[OK][0m | ||
| 19 | Compiling: ../../quantum/keymap.c [32;01m[OK][0m | ||
| 20 | Compiling: ../../quantum/keycode_config.c [32;01m[OK][0m | ||
| 21 | Compiling: ../../quantum/matrix.c [32;01m[OK][0m | ||
| 22 | Compiling: ../../quantum/audio/audio.c [32;01m[OK][0m | ||
| 23 | Compiling: ../../quantum/audio/voices.c [32;01m[OK][0m | ||
| 24 | Compiling: ../../quantum/audio/luts.c [32;01m[OK][0m | ||
| 25 | Compiling: ../../tmk_core/protocol/lufa/lufa.c [32;01m[OK][0m | ||
| 26 | Compiling: ../../tmk_core/protocol/lufa/descriptor.c [32;01m[OK][0m | ||
| 27 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Class/Common/HIDParser.c [32;01m[OK][0m | ||
| 28 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c [32;01m[OK][0m | ||
| 29 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c [32;01m[OK][0m | ||
| 30 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c [32;01m[OK][0m | ||
| 31 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c [32;01m[OK][0m | ||
| 32 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c [32;01m[OK][0m | ||
| 33 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c [32;01m[OK][0m | ||
| 34 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c [32;01m[OK][0m | ||
| 35 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c [32;01m[OK][0m | ||
| 36 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/ConfigDescriptors.c [32;01m[OK][0m | ||
| 37 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/DeviceStandardReq.c [32;01m[OK][0m | ||
| 38 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/Events.c [32;01m[OK][0m | ||
| 39 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/HostStandardReq.c [32;01m[OK][0m | ||
| 40 | Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/USBTask.c [32;01m[OK][0m | ||
| 41 | Compiling: ../../tmk_core/common/host.c [32;01m[OK][0m | ||
| 42 | Compiling: ../../tmk_core/common/keyboard.c [32;01m[OK][0m | ||
| 43 | Compiling: ../../tmk_core/common/action.c [32;01m[OK][0m | ||
| 44 | Compiling: ../../tmk_core/common/action_tapping.c [32;01m[OK][0m | ||
| 45 | Compiling: ../../tmk_core/common/action_macro.c [32;01m[OK][0m | ||
| 46 | Compiling: ../../tmk_core/common/action_layer.c [32;01m[OK][0m | ||
| 47 | Compiling: ../../tmk_core/common/action_util.c [32;01m[OK][0m | ||
| 48 | Compiling: ../../tmk_core/common/print.c [32;01m[OK][0m | ||
| 49 | Compiling: ../../tmk_core/common/debug.c [32;01m[OK][0m | ||
| 50 | Compiling: ../../tmk_core/common/util.c [32;01m[OK][0m | ||
| 51 | Compiling: ../../tmk_core/common/avr/suspend.c [32;01m[OK][0m | ||
| 52 | Assembling: ../../tmk_core/common/avr/xprintf.S [32;01m[OK][0m | ||
| 53 | Compiling: ../../tmk_core/common/avr/timer.c [32;01m[OK][0m | ||
| 54 | Compiling: ../../tmk_core/common/avr/bootloader.c [32;01m[OK][0m | ||
| 55 | Compiling: ../../tmk_core/common/magic.c [32;01m[OK][0m | ||
| 56 | Compiling: ../../tmk_core/common/avr/eeconfig.c [32;01m[OK][0m | ||
| 57 | Compiling: ../../tmk_core/common/mousekey.c [32;01m[OK][0m | ||
| 58 | Compiling: ../../tmk_core/common/command.c [32;01m[OK][0m | ||
| 59 | Compiling: ../../tmk_core/common/backlight.c [32;01m[OK][0m | ||
| 60 | Linking: .build/planck_experimental.elf [31;01m[ERRORS][0m | ||
| 61 | | | ||
| 62 | | .build/obj_planck_experimental/keyboards/planck/keymaps/experimental/keymap.o: In function `action_get_macro': | ||
| 63 | | C:\Users\Fred Wales\Documents\Programming\qmk_firmware\keyboards\planck/../../keyboards/planck/keymaps/experimental/keymap.c:240: undefined reference to `breathing_speed_set' | ||
| 64 | | C:\Users\Fred Wales\Documents\Programming\qmk_firmware\keyboards\planck/../../keyboards/planck/keymaps/experimental/keymap.c:241: undefined reference to `breathing_pulse' | ||
| 65 | | collect2.exe: error: ld returned 1 exit status | ||
| 66 | | | ||
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 @@ | |||
| 1 | # MCU name | ||
| 2 | #MCU = at90usb1287 | ||
| 3 | MCU = atmega32u4 | ||
| 4 | |||
| 5 | # Processor frequency. | ||
| 6 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
| 7 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
| 8 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
| 9 | # automatically to create a 32-bit value in your source code. | ||
| 10 | # | ||
| 11 | # This will be an integer division of F_USB below, as it is sourced by | ||
| 12 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
| 13 | # does not *change* the processor frequency - it should merely be updated to | ||
| 14 | # reflect the processor speed set externally so that the code can use accurate | ||
| 15 | # software delays. | ||
| 16 | F_CPU = 16000000 | ||
| 17 | |||
| 18 | # | ||
| 19 | # LUFA specific | ||
| 20 | # | ||
| 21 | # Target architecture (see library "Board Types" documentation). | ||
| 22 | ARCH = AVR8 | ||
| 23 | |||
| 24 | # Input clock frequency. | ||
| 25 | # This will define a symbol, F_USB, in all source code files equal to the | ||
| 26 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
| 27 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
| 28 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
| 29 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
| 30 | # at the end, this will be done automatically to create a 32-bit value in your | ||
| 31 | # source code. | ||
| 32 | # | ||
| 33 | # If no clock division is performed on the input clock inside the AVR (via the | ||
| 34 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
| 35 | F_USB = $(F_CPU) | ||
| 36 | |||
| 37 | # Interrupt driven control endpoint task(+60) | ||
| 38 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
| 39 | |||
| 40 | |||
| 41 | # Boot Section Size in *bytes* | ||
| 42 | # Teensy halfKay 512 | ||
| 43 | # Teensy++ halfKay 1024 | ||
| 44 | # Atmel DFU loader 4096 | ||
| 45 | # LUFA bootloader 4096 | ||
| 46 | # USBaspLoader 2048 | ||
| 47 | OPT_DEFS += -DBOOTLOADER_SIZE=512 | ||
| 48 | |||
| 49 | # Build Options | ||
| 50 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 51 | # the appropriate keymap folder that will get included automatically | ||
| 52 | # | ||
| 53 | BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) | ||
| 54 | MOUSEKEY_ENABLE ?= no # Mouse keys(+4700) | ||
| 55 | EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) | ||
| 56 | CONSOLE_ENABLE ?= no # Console for debug(+400) | ||
| 57 | COMMAND_ENABLE ?= no # Commands for debug and configuration | ||
| 58 | NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 59 | BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality | ||
| 60 | MIDI_ENABLE ?= no # MIDI controls | ||
| 61 | AUDIO_ENABLE ?= no # Audio output on port C6 | ||
| 62 | UNICODE_ENABLE ?= no # Unicode | ||
| 63 | BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 64 | RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. | ||
| 65 | API_SYSEX_ENABLE = yes | ||
| 66 | |||
| 67 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 68 | SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend | ||
| 69 | |||
| 70 | SRC = i2c.c \ | ||
| 71 | ssd1306.c | ||
| 72 | |||
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 @@ | |||
| 1 | ifndef MAKEFILE_INCLUDED | ||
| 2 | include ../../../Makefile | ||
| 3 | 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 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | #ifndef VER0_CONFIG_H | ||
| 18 | #define VER0_CONFIG_H | ||
| 19 | |||
| 20 | #include "../config.h" | ||
| 21 | |||
| 22 | /* USB Device descriptor parameter */ | ||
| 23 | #define DEVICE_VER 0x0001 | ||
| 24 | |||
| 25 | /* key matrix size */ | ||
| 26 | #define MATRIX_ROWS 5 | ||
| 27 | #define MATRIX_COLS 15 | ||
| 28 | |||
| 29 | /* Hadron Ver0 PCB default pin-out */ | ||
| 30 | #define MATRIX_ROW_PINS { D7, E6, B4, B5, B6 } | ||
| 31 | #define MATRIX_COL_PINS { F6, F7, C6, C7, F5, F4, F1, F0, D2, D3, D5, B3, B2, B1, B0 } | ||
| 32 | #define UNUSED_PINS | ||
| 33 | |||
| 34 | |||
| 35 | #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 @@ | |||
| 1 | #AUDIO_ENABLE ?= yes # Audio output on port C6 | ||
| 2 | |||
| 3 | ifndef QUANTUM_DIR | ||
| 4 | include ../../../Makefile | ||
| 5 | 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 @@ | |||
| 1 | #ifndef VER0_H | ||
| 2 | #define VER0_H | ||
| 3 | |||
| 4 | #include "../hadron.h" | ||
| 5 | |||
| 6 | #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 @@ | |||
| 1 | ifndef MAKEFILE_INCLUDED | ||
| 2 | include ../../../Makefile | ||
| 3 | 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 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | #ifndef VER2_CONFIG_H | ||
| 18 | #define VER2_CONFIG_H | ||
| 19 | |||
| 20 | #include "../config.h" | ||
| 21 | |||
| 22 | /* USB Device descriptor parameter */ | ||
| 23 | #define DEVICE_VER 0x0002 | ||
| 24 | |||
| 25 | /* key matrix size */ | ||
| 26 | #define MATRIX_ROWS 5 | ||
| 27 | #define MATRIX_COLS 15 | ||
| 28 | |||
| 29 | /* Hadron Ver0 PCB default pin-out */ | ||
| 30 | #define MATRIX_ROW_PINS { D7, E6, B4, B5, B6 } | ||
| 31 | #define MATRIX_COL_PINS { F6, F7, D6, C7, F5, F4, F1, F0, D2, D3, D5, B3, B2, B1, B0 } | ||
| 32 | #define UNUSED_PINS | ||
| 33 | |||
| 34 | |||
| 35 | #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 @@ | |||
| 1 | #AUDIO_ENABLE ?= yes # Audio output on port C6 | ||
| 2 | |||
| 3 | ifndef QUANTUM_DIR | ||
| 4 | include ../../../Makefile | ||
| 5 | 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 @@ | |||
| 1 | #ifndef VER2_H | ||
| 2 | #define VER2_H | ||
| 3 | |||
| 4 | #include "../hadron.h" | ||
| 5 | |||
| 6 | #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 | |||
| 5 | 5 | ||
| 6 | ## Wiring Layout | 6 | ## Wiring Layout |
| 7 | 7 | ||
| 8 |  | 8 |  |
| 9 | 9 | ||
| 10 | ## Pinout | 10 | ## Pinout |
| 11 | 11 | ||
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 @@ | |||
| 1 | #include "light_ws2812.h" | 1 | #include "ws2812.h" |
| 2 | #include "rgbsps.h" | 2 | #include "rgbsps.h" |
| 3 | 3 | ||
| 4 | struct cRGB led[RGBSPS_NUM]; | 4 | 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 | |||
| 72 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | 72 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE |
| 73 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | 73 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend |
| 74 | 74 | ||
| 75 | SRC += $(QUANTUM_DIR)/light_ws2812.c | 75 | SRC += ws2812.c |
| 76 | SRC += rgbsps.c | 76 | SRC += rgbsps.c |
| 77 | SRC += $(QUANTUM_DIR)/analog.c | 77 | SRC += analog.c |
| 78 | SRC += matrix.c | 78 | 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/>. | |||
| 36 | #define FLIP_HALF | 36 | #define FLIP_HALF |
| 37 | 37 | ||
| 38 | #define SSD1306OLED | 38 | #define SSD1306OLED |
| 39 | //#define OLED_ROTATE180 | ||
| 39 | 40 | ||
| 40 | 41 | ||
| 41 | #define PREVENT_STUCK_MODIFIERS | 42 | #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) | |||
| 357 | 357 | ||
| 358 | return MACRO_NONE; | 358 | return MACRO_NONE; |
| 359 | } | 359 | } |
| 360 | |||
| 361 | |||
| 362 | void matrix_update(struct CharacterMatrix *dest, | ||
| 363 | const struct CharacterMatrix *source) { | ||
| 364 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
| 365 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
| 366 | dest->dirty = true; | ||
| 367 | } | ||
| 368 | } | ||
| 369 | |||
| 370 | //assign the right code to your layers for OLED display | ||
| 371 | #define L_BASE 0 | ||
| 372 | #define L_LOWER 8 | ||
| 373 | #define L_RAISE 16 | ||
| 374 | #define L_FNLAYER 64 | ||
| 375 | #define L_NUMLAY 128 | ||
| 376 | #define L_NLOWER 136 | ||
| 377 | #define L_NFNLAYER 192 | ||
| 378 | #define L_MOUSECURSOR 256 | ||
| 379 | #define L_ADJUST 65560 | ||
| 380 | |||
| 381 | void iota_gfx_task_user(void) { | ||
| 382 | #if DEBUG_TO_SCREEN | ||
| 383 | if (debug_enable) { | ||
| 384 | return; | ||
| 385 | } | ||
| 386 | #endif | ||
| 387 | |||
| 388 | struct CharacterMatrix matrix; | ||
| 389 | |||
| 390 | matrix_clear(&matrix); | ||
| 391 | matrix_write_P(&matrix, PSTR("USB: ")); | ||
| 392 | #ifdef PROTOCOL_LUFA | ||
| 393 | switch (USB_DeviceState) { | ||
| 394 | case DEVICE_STATE_Unattached: | ||
| 395 | matrix_write_P(&matrix, PSTR("Unattached")); | ||
| 396 | break; | ||
| 397 | case DEVICE_STATE_Suspended: | ||
| 398 | matrix_write_P(&matrix, PSTR("Suspended")); | ||
| 399 | break; | ||
| 400 | case DEVICE_STATE_Configured: | ||
| 401 | matrix_write_P(&matrix, PSTR("Connected")); | ||
| 402 | break; | ||
| 403 | case DEVICE_STATE_Powered: | ||
| 404 | matrix_write_P(&matrix, PSTR("Powered")); | ||
| 405 | break; | ||
| 406 | case DEVICE_STATE_Default: | ||
| 407 | matrix_write_P(&matrix, PSTR("Default")); | ||
| 408 | break; | ||
| 409 | case DEVICE_STATE_Addressed: | ||
| 410 | matrix_write_P(&matrix, PSTR("Addressed")); | ||
| 411 | break; | ||
| 412 | default: | ||
| 413 | matrix_write_P(&matrix, PSTR("Invalid")); | ||
| 414 | } | ||
| 415 | #endif | ||
| 416 | |||
| 417 | // 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 | ||
| 418 | |||
| 419 | char buf[40]; | ||
| 420 | snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); | ||
| 421 | matrix_write_P(&matrix, PSTR("\n\nLayer: ")); | ||
| 422 | switch (layer_state) { | ||
| 423 | case L_BASE: | ||
| 424 | matrix_write_P(&matrix, PSTR("Default")); | ||
| 425 | break; | ||
| 426 | case L_RAISE: | ||
| 427 | matrix_write_P(&matrix, PSTR("Raise")); | ||
| 428 | break; | ||
| 429 | case L_LOWER: | ||
| 430 | matrix_write_P(&matrix, PSTR("Lower")); | ||
| 431 | break; | ||
| 432 | case L_ADJUST: | ||
| 433 | matrix_write_P(&matrix, PSTR("ADJUST")); | ||
| 434 | break; | ||
| 435 | default: | ||
| 436 | matrix_write(&matrix, buf); | ||
| 437 | } | ||
| 438 | |||
| 439 | // Host Keyboard LED Status | ||
| 440 | char led[40]; | ||
| 441 | snprintf(led, sizeof(led), "\n%s %s %s", | ||
| 442 | (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", | ||
| 443 | (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", | ||
| 444 | (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); | ||
| 445 | matrix_write(&matrix, led); | ||
| 446 | matrix_update(&display, &matrix); | ||
| 447 | } \ 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 @@ | |||
| 1 | #ifdef SSD1306OLED | ||
| 2 | |||
| 3 | #include "ssd1306.h" | ||
| 4 | #include "config.h" | ||
| 5 | #include "i2c.h" | ||
| 6 | #include <string.h> | ||
| 7 | #include "print.h" | ||
| 8 | #include "lets_split.h" | ||
| 9 | #include "common/glcdfont.c" | ||
| 10 | #ifdef ADAFRUIT_BLE_ENABLE | ||
| 11 | #include "adafruit_ble.h" | ||
| 12 | #endif | ||
| 13 | #ifdef PROTOCOL_LUFA | ||
| 14 | #include "lufa.h" | ||
| 15 | #endif | ||
| 16 | #include "sendchar.h" | ||
| 17 | #include "pincontrol.h" | ||
| 18 | |||
| 19 | //assign the right code to your layers | ||
| 20 | #define _BASE 0 | ||
| 21 | #define _LOWER 8 | ||
| 22 | #define _RAISE 16 | ||
| 23 | #define _FNLAYER 64 | ||
| 24 | #define _NUMLAY 128 | ||
| 25 | #define _NLOWER 136 | ||
| 26 | #define _NFNLAYER 192 | ||
| 27 | #define _MOUSECURSOR 256 | ||
| 28 | #define _ADJUST 65560 | ||
| 29 | |||
| 30 | // Set this to 1 to help diagnose early startup problems | ||
| 31 | // when testing power-on with ble. Turn it off otherwise, | ||
| 32 | // as the latency of printing most of the debug info messes | ||
| 33 | // with the matrix scan, causing keys to drop. | ||
| 34 | #define DEBUG_TO_SCREEN 0 | ||
| 35 | |||
| 36 | // Controls the SSD1306 128x32 OLED display via i2c | ||
| 37 | |||
| 38 | #define i2cAddress 0x3C | ||
| 39 | |||
| 40 | #define DisplayHeight 32 | ||
| 41 | #define DisplayWidth 128 | ||
| 42 | |||
| 43 | #define FontHeight 8 | ||
| 44 | #define FontWidth 6 | ||
| 45 | |||
| 46 | #define MatrixRows (DisplayHeight / FontHeight) | ||
| 47 | #define MatrixCols (DisplayWidth / FontWidth) | ||
| 48 | |||
| 49 | struct CharacterMatrix { | ||
| 50 | uint8_t display[MatrixRows][MatrixCols]; | ||
| 51 | uint8_t *cursor; | ||
| 52 | bool dirty; | ||
| 53 | }; | ||
| 54 | |||
| 55 | static struct CharacterMatrix display; | ||
| 56 | //static uint16_t last_battery_update; | ||
| 57 | //static uint32_t vbat; | ||
| 58 | //#define BatteryUpdateInterval 10000 /* milliseconds */ | ||
| 59 | #define ScreenOffInterval 300000 /* milliseconds */ | ||
| 60 | #if DEBUG_TO_SCREEN | ||
| 61 | static uint8_t displaying; | ||
| 62 | #endif | ||
| 63 | static uint16_t last_flush; | ||
| 64 | |||
| 65 | enum ssd1306_cmds { | ||
| 66 | DisplayOff = 0xAE, | ||
| 67 | DisplayOn = 0xAF, | ||
| 68 | |||
| 69 | SetContrast = 0x81, | ||
| 70 | DisplayAllOnResume = 0xA4, | ||
| 71 | |||
| 72 | DisplayAllOn = 0xA5, | ||
| 73 | NormalDisplay = 0xA6, | ||
| 74 | InvertDisplay = 0xA7, | ||
| 75 | SetDisplayOffset = 0xD3, | ||
| 76 | SetComPins = 0xda, | ||
| 77 | SetVComDetect = 0xdb, | ||
| 78 | SetDisplayClockDiv = 0xD5, | ||
| 79 | SetPreCharge = 0xd9, | ||
| 80 | SetMultiPlex = 0xa8, | ||
| 81 | SetLowColumn = 0x00, | ||
| 82 | SetHighColumn = 0x10, | ||
| 83 | SetStartLine = 0x40, | ||
| 84 | |||
| 85 | SetMemoryMode = 0x20, | ||
| 86 | ColumnAddr = 0x21, | ||
| 87 | PageAddr = 0x22, | ||
| 88 | |||
| 89 | ComScanInc = 0xc0, | ||
| 90 | ComScanDec = 0xc8, | ||
| 91 | SegRemap = 0xa0, | ||
| 92 | SetChargePump = 0x8d, | ||
| 93 | ExternalVcc = 0x01, | ||
| 94 | SwitchCapVcc = 0x02, | ||
| 95 | |||
| 96 | ActivateScroll = 0x2f, | ||
| 97 | DeActivateScroll = 0x2e, | ||
| 98 | SetVerticalScrollArea = 0xa3, | ||
| 99 | RightHorizontalScroll = 0x26, | ||
| 100 | LeftHorizontalScroll = 0x27, | ||
| 101 | VerticalAndRightHorizontalScroll = 0x29, | ||
| 102 | VerticalAndLeftHorizontalScroll = 0x2a, | ||
| 103 | }; | ||
| 104 | |||
| 105 | |||
| 106 | // Write command sequence. | ||
| 107 | // Returns true on success. | ||
| 108 | static inline bool _send_cmd1(uint8_t cmd) { | ||
| 109 | bool res = false; | ||
| 110 | |||
| 111 | if (i2c_start_write(i2cAddress)) { | ||
| 112 | xprintf("failed to start write to %d\n", i2cAddress); | ||
| 113 | goto done; | ||
| 114 | } | ||
| 115 | |||
| 116 | if (i2c_master_write(0x0 /* command byte follows */)) { | ||
| 117 | print("failed to write control byte\n"); | ||
| 118 | |||
| 119 | goto done; | ||
| 120 | } | ||
| 121 | |||
| 122 | if (i2c_master_write(cmd)) { | ||
| 123 | xprintf("failed to write command %d\n", cmd); | ||
| 124 | goto done; | ||
| 125 | } | ||
| 126 | res = true; | ||
| 127 | done: | ||
| 128 | i2c_master_stop(); | ||
| 129 | return res; | ||
| 130 | } | ||
| 131 | |||
| 132 | // Write 2-byte command sequence. | ||
| 133 | // Returns true on success | ||
| 134 | static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) { | ||
| 135 | if (!_send_cmd1(cmd)) { | ||
| 136 | return false; | ||
| 137 | } | ||
| 138 | return _send_cmd1(opr); | ||
| 139 | } | ||
| 140 | |||
| 141 | // Write 3-byte command sequence. | ||
| 142 | // Returns true on success | ||
| 143 | static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) { | ||
| 144 | if (!_send_cmd1(cmd)) { | ||
| 145 | return false; | ||
| 146 | } | ||
| 147 | if (!_send_cmd1(opr1)) { | ||
| 148 | return false; | ||
| 149 | } | ||
| 150 | return _send_cmd1(opr2); | ||
| 151 | } | ||
| 152 | |||
| 153 | #define send_cmd1(c) if (!_send_cmd1(c)) {goto done;} | ||
| 154 | #define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} | ||
| 155 | #define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} | ||
| 156 | |||
| 157 | static void matrix_clear(struct CharacterMatrix *matrix); | ||
| 158 | |||
| 159 | static void clear_display(void) { | ||
| 160 | matrix_clear(&display); | ||
| 161 | |||
| 162 | // Clear all of the display bits (there can be random noise | ||
| 163 | // in the RAM on startup) | ||
| 164 | send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1); | ||
| 165 | send_cmd3(ColumnAddr, 0, DisplayWidth - 1); | ||
| 166 | |||
| 167 | if (i2c_start_write(i2cAddress)) { | ||
| 168 | goto done; | ||
| 169 | } | ||
| 170 | if (i2c_master_write(0x40)) { | ||
| 171 | // Data mode | ||
| 172 | goto done; | ||
| 173 | } | ||
| 174 | for (uint8_t row = 0; row < MatrixRows; ++row) { | ||
| 175 | for (uint8_t col = 0; col < DisplayWidth; ++col) { | ||
| 176 | i2c_master_write(0); | ||
| 177 | } | ||
| 178 | } | ||
| 179 | |||
| 180 | display.dirty = false; | ||
| 181 | |||
| 182 | done: | ||
| 183 | i2c_master_stop(); | ||
| 184 | } | ||
| 185 | |||
| 186 | #if DEBUG_TO_SCREEN | ||
| 187 | #undef sendchar | ||
| 188 | static int8_t capture_sendchar(uint8_t c) { | ||
| 189 | sendchar(c); | ||
| 190 | iota_gfx_write_char(c); | ||
| 191 | |||
| 192 | if (!displaying) { | ||
| 193 | iota_gfx_flush(); | ||
| 194 | } | ||
| 195 | return 0; | ||
| 196 | } | ||
| 197 | #endif | ||
| 198 | |||
| 199 | bool iota_gfx_init(void) { | ||
| 200 | bool success = false; | ||
| 201 | |||
| 202 | send_cmd1(DisplayOff); | ||
| 203 | send_cmd2(SetDisplayClockDiv, 0x80); | ||
| 204 | send_cmd2(SetMultiPlex, DisplayHeight - 1); | ||
| 205 | |||
| 206 | send_cmd2(SetDisplayOffset, 0); | ||
| 207 | |||
| 208 | |||
| 209 | send_cmd1(SetStartLine | 0x0); | ||
| 210 | send_cmd2(SetChargePump, 0x14 /* Enable */); | ||
| 211 | send_cmd2(SetMemoryMode, 0 /* horizontal addressing */); | ||
| 212 | |||
| 213 | /// Flips the display orientation 0 degrees | ||
| 214 | send_cmd1(SegRemap | 0x1); | ||
| 215 | send_cmd1(ComScanDec); | ||
| 216 | /* | ||
| 217 | // the following Flip the display orientation 180 degrees | ||
| 218 | send_cmd1(SegRemap); | ||
| 219 | send_cmd1(ComScanInc); | ||
| 220 | // end flip */ | ||
| 221 | send_cmd2(SetComPins, 0x2); | ||
| 222 | send_cmd2(SetContrast, 0x8f); | ||
| 223 | send_cmd2(SetPreCharge, 0xf1); | ||
| 224 | send_cmd2(SetVComDetect, 0x40); | ||
| 225 | send_cmd1(DisplayAllOnResume); | ||
| 226 | send_cmd1(NormalDisplay); | ||
| 227 | send_cmd1(DeActivateScroll); | ||
| 228 | send_cmd1(DisplayOn); | ||
| 229 | |||
| 230 | send_cmd2(SetContrast, 0); // Dim | ||
| 231 | |||
| 232 | clear_display(); | ||
| 233 | |||
| 234 | success = true; | ||
| 235 | |||
| 236 | iota_gfx_flush(); | ||
| 237 | |||
| 238 | #if DEBUG_TO_SCREEN | ||
| 239 | print_set_sendchar(capture_sendchar); | ||
| 240 | #endif | ||
| 241 | |||
| 242 | done: | ||
| 243 | return success; | ||
| 244 | } | ||
| 245 | |||
| 246 | bool iota_gfx_off(void) { | ||
| 247 | bool success = false; | ||
| 248 | |||
| 249 | send_cmd1(DisplayOff); | ||
| 250 | success = true; | ||
| 251 | |||
| 252 | done: | ||
| 253 | return success; | ||
| 254 | } | ||
| 255 | |||
| 256 | bool iota_gfx_on(void) { | ||
| 257 | bool success = false; | ||
| 258 | |||
| 259 | send_cmd1(DisplayOn); | ||
| 260 | success = true; | ||
| 261 | |||
| 262 | done: | ||
| 263 | return success; | ||
| 264 | } | ||
| 265 | |||
| 266 | static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { | ||
| 267 | *matrix->cursor = c; | ||
| 268 | ++matrix->cursor; | ||
| 269 | |||
| 270 | if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) { | ||
| 271 | // We went off the end; scroll the display upwards by one line | ||
| 272 | memmove(&matrix->display[0], &matrix->display[1], | ||
| 273 | MatrixCols * (MatrixRows - 1)); | ||
| 274 | matrix->cursor = &matrix->display[MatrixRows - 1][0]; | ||
| 275 | memset(matrix->cursor, ' ', MatrixCols); | ||
| 276 | } | ||
| 277 | } | ||
| 278 | |||
| 279 | static void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { | ||
| 280 | matrix->dirty = true; | ||
| 281 | |||
| 282 | if (c == '\n') { | ||
| 283 | // Clear to end of line from the cursor and then move to the | ||
| 284 | // start of the next line | ||
| 285 | uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols; | ||
| 286 | |||
| 287 | while (cursor_col++ < MatrixCols) { | ||
| 288 | matrix_write_char_inner(matrix, ' '); | ||
| 289 | } | ||
| 290 | return; | ||
| 291 | } | ||
| 292 | |||
| 293 | matrix_write_char_inner(matrix, c); | ||
| 294 | } | ||
| 295 | |||
| 296 | void iota_gfx_write_char(uint8_t c) { | ||
| 297 | matrix_write_char(&display, c); | ||
| 298 | } | ||
| 299 | |||
| 300 | static void matrix_write(struct CharacterMatrix *matrix, const char *data) { | ||
| 301 | const char *end = data + strlen(data); | ||
| 302 | while (data < end) { | ||
| 303 | matrix_write_char(matrix, *data); | ||
| 304 | ++data; | ||
| 305 | } | ||
| 306 | } | ||
| 307 | |||
| 308 | void iota_gfx_write(const char *data) { | ||
| 309 | matrix_write(&display, data); | ||
| 310 | } | ||
| 311 | |||
| 312 | static void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { | ||
| 313 | while (true) { | ||
| 314 | uint8_t c = pgm_read_byte(data); | ||
| 315 | if (c == 0) { | ||
| 316 | return; | ||
| 317 | } | ||
| 318 | matrix_write_char(matrix, c); | ||
| 319 | ++data; | ||
| 320 | } | ||
| 321 | } | ||
| 322 | |||
| 323 | void iota_gfx_write_P(const char *data) { | ||
| 324 | matrix_write_P(&display, data); | ||
| 325 | } | ||
| 326 | |||
| 327 | static void matrix_clear(struct CharacterMatrix *matrix) { | ||
| 328 | memset(matrix->display, ' ', sizeof(matrix->display)); | ||
| 329 | matrix->cursor = &matrix->display[0][0]; | ||
| 330 | matrix->dirty = true; | ||
| 331 | } | ||
| 332 | |||
| 333 | void iota_gfx_clear_screen(void) { | ||
| 334 | matrix_clear(&display); | ||
| 335 | } | ||
| 336 | |||
| 337 | static void matrix_render(struct CharacterMatrix *matrix) { | ||
| 338 | last_flush = timer_read(); | ||
| 339 | iota_gfx_on(); | ||
| 340 | #if DEBUG_TO_SCREEN | ||
| 341 | ++displaying; | ||
| 342 | #endif | ||
| 343 | |||
| 344 | // Move to the home position | ||
| 345 | send_cmd3(PageAddr, 0, MatrixRows - 1); | ||
| 346 | send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1); | ||
| 347 | |||
| 348 | if (i2c_start_write(i2cAddress)) { | ||
| 349 | goto done; | ||
| 350 | } | ||
| 351 | if (i2c_master_write(0x40)) { | ||
| 352 | // Data mode | ||
| 353 | goto done; | ||
| 354 | } | ||
| 355 | |||
| 356 | for (uint8_t row = 0; row < MatrixRows; ++row) { | ||
| 357 | for (uint8_t col = 0; col < MatrixCols; ++col) { | ||
| 358 | const uint8_t *glyph = font + (matrix->display[row][col] * (FontWidth - 1)); | ||
| 359 | |||
| 360 | for (uint8_t glyphCol = 0; glyphCol < FontWidth - 1; ++glyphCol) { | ||
| 361 | uint8_t colBits = pgm_read_byte(glyph + glyphCol); | ||
| 362 | i2c_master_write(colBits); | ||
| 363 | } | ||
| 364 | |||
| 365 | // 1 column of space between chars (it's not included in the glyph) | ||
| 366 | i2c_master_write(0); | ||
| 367 | } | ||
| 368 | } | ||
| 369 | |||
| 370 | matrix->dirty = false; | ||
| 371 | |||
| 372 | done: | ||
| 373 | i2c_master_stop(); | ||
| 374 | #if DEBUG_TO_SCREEN | ||
| 375 | --displaying; | ||
| 376 | #endif | ||
| 377 | } | ||
| 378 | |||
| 379 | void iota_gfx_flush(void) { | ||
| 380 | matrix_render(&display); | ||
| 381 | } | ||
| 382 | |||
| 383 | static void matrix_update(struct CharacterMatrix *dest, | ||
| 384 | const struct CharacterMatrix *source) { | ||
| 385 | if (memcmp(dest->display, source->display, sizeof(dest->display))) { | ||
| 386 | memcpy(dest->display, source->display, sizeof(dest->display)); | ||
| 387 | dest->dirty = true; | ||
| 388 | } | ||
| 389 | } | ||
| 390 | |||
| 391 | static void render_status_info(void) { | ||
| 392 | #if DEBUG_TO_SCREEN | ||
| 393 | if (debug_enable) { | ||
| 394 | return; | ||
| 395 | } | ||
| 396 | #endif | ||
| 397 | |||
| 398 | struct CharacterMatrix matrix; | ||
| 399 | |||
| 400 | matrix_clear(&matrix); | ||
| 401 | matrix_write_P(&matrix, PSTR("USB: ")); | ||
| 402 | #ifdef PROTOCOL_LUFA | ||
| 403 | switch (USB_DeviceState) { | ||
| 404 | case DEVICE_STATE_Unattached: | ||
| 405 | matrix_write_P(&matrix, PSTR("Unattached")); | ||
| 406 | break; | ||
| 407 | case DEVICE_STATE_Suspended: | ||
| 408 | matrix_write_P(&matrix, PSTR("Suspended")); | ||
| 409 | break; | ||
| 410 | case DEVICE_STATE_Configured: | ||
| 411 | matrix_write_P(&matrix, PSTR("Connected")); | ||
| 412 | break; | ||
| 413 | case DEVICE_STATE_Powered: | ||
| 414 | matrix_write_P(&matrix, PSTR("Powered")); | ||
| 415 | break; | ||
| 416 | case DEVICE_STATE_Default: | ||
| 417 | matrix_write_P(&matrix, PSTR("Default")); | ||
| 418 | break; | ||
| 419 | case DEVICE_STATE_Addressed: | ||
| 420 | matrix_write_P(&matrix, PSTR("Addressed")); | ||
| 421 | break; | ||
| 422 | default: | ||
| 423 | matrix_write_P(&matrix, PSTR("Invalid")); | ||
| 424 | } | ||
| 425 | #endif | ||
| 426 | |||
| 427 | // 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 | ||
| 428 | |||
| 429 | char buf[40]; | ||
| 430 | snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); | ||
| 431 | matrix_write_P(&matrix, PSTR("\n\nLayer: ")); | ||
| 432 | switch (layer_state) { | ||
| 433 | case _BASE: | ||
| 434 | matrix_write_P(&matrix, PSTR("Default")); | ||
| 435 | break; | ||
| 436 | case _RAISE: | ||
| 437 | matrix_write_P(&matrix, PSTR("Raise")); | ||
| 438 | break; | ||
| 439 | case _LOWER: | ||
| 440 | matrix_write_P(&matrix, PSTR("Lower")); | ||
| 441 | break; | ||
| 442 | case _ADJUST: | ||
| 443 | matrix_write_P(&matrix, PSTR("ADJUST")); | ||
| 444 | break; | ||
| 445 | default: | ||
| 446 | matrix_write(&matrix, buf); | ||
| 447 | } | ||
| 448 | |||
| 449 | // Host Keyboard LED Status | ||
| 450 | char led[40]; | ||
| 451 | snprintf(led, sizeof(led), "\n%s %s %s", | ||
| 452 | (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ", | ||
| 453 | (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ", | ||
| 454 | (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " "); | ||
| 455 | matrix_write(&matrix, led); | ||
| 456 | matrix_update(&display, &matrix); | ||
| 457 | } | ||
| 458 | |||
| 459 | void iota_gfx_task(void) { | ||
| 460 | render_status_info(); | ||
| 461 | |||
| 462 | if (display.dirty) { | ||
| 463 | iota_gfx_flush(); | ||
| 464 | } | ||
| 465 | |||
| 466 | if (timer_elapsed(last_flush) > ScreenOffInterval) { | ||
| 467 | iota_gfx_off(); | ||
| 468 | } | ||
| 469 | } | ||
| 470 | #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 @@ | |||
| 1 | #ifndef SSD1306_H | ||
| 2 | #define SSD1306_H | ||
| 3 | |||
| 4 | #include <stdbool.h> | ||
| 5 | #include <stdio.h> | ||
| 6 | |||
| 7 | bool iota_gfx_init(void); | ||
| 8 | void iota_gfx_task(void); | ||
| 9 | bool iota_gfx_off(void); | ||
| 10 | bool iota_gfx_on(void); | ||
| 11 | void iota_gfx_flush(void); | ||
| 12 | void iota_gfx_write_char(uint8_t c); | ||
| 13 | void iota_gfx_write(const char *data); | ||
| 14 | void iota_gfx_write_P(const char *data); | ||
| 15 | void iota_gfx_clear_screen(void); | ||
| 16 | |||
| 17 | #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 @@ | |||
| 1 | SUBPROJECT_DEFAULT = rev1 | ||
| 2 | |||
| 3 | ifndef MAKEFILE_INCLUDED | ||
| 4 | include ../../Makefile | ||
| 5 | 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 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef CONFIG_H | ||
| 19 | #define CONFIG_H | ||
| 20 | |||
| 21 | #include "config_common.h" | ||
| 22 | |||
| 23 | /* USB Device descriptor parameter */ | ||
| 24 | #define VENDOR_ID 0xFEED | ||
| 25 | #define PRODUCT_ID 0x3060 | ||
| 26 | #define MANUFACTURER That-Canadian | ||
| 27 | #define PRODUCT MiniDox | ||
| 28 | #define DESCRIPTION A compact version of the Ergo Dox | ||
| 29 | |||
| 30 | /* key matrix size */ | ||
| 31 | // Rows are doubled-up | ||
| 32 | #define MATRIX_ROWS 8 | ||
| 33 | #define MATRIX_COLS 5 | ||
| 34 | |||
| 35 | /* COL2ROW or ROW2COL */ | ||
| 36 | #define DIODE_DIRECTION COL2ROW | ||
| 37 | |||
| 38 | /* define if matrix has ghost */ | ||
| 39 | //#define MATRIX_HAS_GHOST | ||
| 40 | |||
| 41 | /* number of backlight levels */ | ||
| 42 | // #define BACKLIGHT_LEVELS 3 | ||
| 43 | |||
| 44 | /* Set 0 if debouncing isn't needed */ | ||
| 45 | #define DEBOUNCING_DELAY 5 | ||
| 46 | |||
| 47 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
| 48 | #define LOCKING_SUPPORT_ENABLE | ||
| 49 | /* Locking resynchronize hack */ | ||
| 50 | #define LOCKING_RESYNC_ENABLE | ||
| 51 | |||
| 52 | /* key combination for command */ | ||
| 53 | #define IS_COMMAND() ( \ | ||
| 54 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
| 55 | ) | ||
| 56 | |||
| 57 | /* disable debug print */ | ||
| 58 | //#define NO_DEBUG | ||
| 59 | |||
| 60 | /* disable print */ | ||
| 61 | //#define NO_PRINT | ||
| 62 | |||
| 63 | /* disable action features */ | ||
| 64 | //#define NO_ACTION_LAYER | ||
| 65 | //#define NO_ACTION_TAPPING | ||
| 66 | //#define NO_ACTION_ONESHOT | ||
| 67 | //#define NO_ACTION_MACRO | ||
| 68 | //#define NO_ACTION_FUNCTION | ||
| 69 | |||
| 70 | #ifdef SUBPROJECT_rev1 | ||
| 71 | #include "rev1/config.h" | ||
| 72 | #endif | ||
| 73 | |||
| 74 | #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 @@ | |||
| 1 | #include <util/twi.h> | ||
| 2 | #include <avr/io.h> | ||
| 3 | #include <stdlib.h> | ||
| 4 | #include <avr/interrupt.h> | ||
| 5 | #include <util/twi.h> | ||
| 6 | #include <stdbool.h> | ||
| 7 | #include "i2c.h" | ||
| 8 | |||
| 9 | #ifdef USE_I2C | ||
| 10 | |||
| 11 | // Limits the amount of we wait for any one i2c transaction. | ||
| 12 | // Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is | ||
| 13 | // 9 bits, a single transaction will take around 90μs to complete. | ||
| 14 | // | ||
| 15 | // (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit | ||
| 16 | // poll loop takes at least 8 clock cycles to execute | ||
| 17 | #define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 | ||
| 18 | |||
| 19 | #define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) | ||
| 20 | |||
| 21 | volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; | ||
| 22 | |||
| 23 | static volatile uint8_t slave_buffer_pos; | ||
| 24 | static volatile bool slave_has_register_set = false; | ||
| 25 | |||
| 26 | // Wait for an i2c operation to finish | ||
| 27 | inline static | ||
| 28 | void i2c_delay(void) { | ||
| 29 | uint16_t lim = 0; | ||
| 30 | while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT) | ||
| 31 | lim++; | ||
| 32 | |||
| 33 | // easier way, but will wait slightly longer | ||
| 34 | // _delay_us(100); | ||
| 35 | } | ||
| 36 | |||
| 37 | // Setup twi to run at 100kHz | ||
| 38 | void i2c_master_init(void) { | ||
| 39 | // no prescaler | ||
| 40 | TWSR = 0; | ||
| 41 | // Set TWI clock frequency to SCL_CLOCK. Need TWBR>10. | ||
| 42 | // Check datasheets for more info. | ||
| 43 | TWBR = ((F_CPU/SCL_CLOCK)-16)/2; | ||
| 44 | } | ||
| 45 | |||
| 46 | // Start a transaction with the given i2c slave address. The direction of the | ||
| 47 | // transfer is set with I2C_READ and I2C_WRITE. | ||
| 48 | // returns: 0 => success | ||
| 49 | // 1 => error | ||
| 50 | uint8_t i2c_master_start(uint8_t address) { | ||
| 51 | TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA); | ||
| 52 | |||
| 53 | i2c_delay(); | ||
| 54 | |||
| 55 | // check that we started successfully | ||
| 56 | if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START)) | ||
| 57 | return 1; | ||
| 58 | |||
| 59 | TWDR = address; | ||
| 60 | TWCR = (1<<TWINT) | (1<<TWEN); | ||
| 61 | |||
| 62 | i2c_delay(); | ||
| 63 | |||
| 64 | if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) ) | ||
| 65 | return 1; // slave did not acknowledge | ||
| 66 | else | ||
| 67 | return 0; // success | ||
| 68 | } | ||
| 69 | |||
| 70 | |||
| 71 | // Finish the i2c transaction. | ||
| 72 | void i2c_master_stop(void) { | ||
| 73 | TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); | ||
| 74 | |||
| 75 | uint16_t lim = 0; | ||
| 76 | while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT) | ||
| 77 | lim++; | ||
| 78 | } | ||
| 79 | |||
| 80 | // Write one byte to the i2c slave. | ||
| 81 | // returns 0 => slave ACK | ||
| 82 | // 1 => slave NACK | ||
| 83 | uint8_t i2c_master_write(uint8_t data) { | ||
| 84 | TWDR = data; | ||
| 85 | TWCR = (1<<TWINT) | (1<<TWEN); | ||
| 86 | |||
| 87 | i2c_delay(); | ||
| 88 | |||
| 89 | // check if the slave acknowledged us | ||
| 90 | return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1; | ||
| 91 | } | ||
| 92 | |||
| 93 | // Read one byte from the i2c slave. If ack=1 the slave is acknowledged, | ||
| 94 | // if ack=0 the acknowledge bit is not set. | ||
| 95 | // returns: byte read from i2c device | ||
| 96 | uint8_t i2c_master_read(int ack) { | ||
| 97 | TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA); | ||
| 98 | |||
| 99 | i2c_delay(); | ||
| 100 | return TWDR; | ||
| 101 | } | ||
| 102 | |||
| 103 | void i2c_reset_state(void) { | ||
| 104 | TWCR = 0; | ||
| 105 | } | ||
| 106 | |||
| 107 | void i2c_slave_init(uint8_t address) { | ||
| 108 | TWAR = address << 0; // slave i2c address | ||
| 109 | // TWEN - twi enable | ||
| 110 | // TWEA - enable address acknowledgement | ||
| 111 | // TWINT - twi interrupt flag | ||
| 112 | // TWIE - enable the twi interrupt | ||
| 113 | TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN); | ||
| 114 | } | ||
| 115 | |||
| 116 | ISR(TWI_vect); | ||
| 117 | |||
| 118 | ISR(TWI_vect) { | ||
| 119 | uint8_t ack = 1; | ||
| 120 | switch(TW_STATUS) { | ||
| 121 | case TW_SR_SLA_ACK: | ||
| 122 | // this device has been addressed as a slave receiver | ||
| 123 | slave_has_register_set = false; | ||
| 124 | break; | ||
| 125 | |||
| 126 | case TW_SR_DATA_ACK: | ||
| 127 | // this device has received data as a slave receiver | ||
| 128 | // The first byte that we receive in this transaction sets the location | ||
| 129 | // of the read/write location of the slaves memory that it exposes over | ||
| 130 | // i2c. After that, bytes will be written at slave_buffer_pos, incrementing | ||
| 131 | // slave_buffer_pos after each write. | ||
| 132 | if(!slave_has_register_set) { | ||
| 133 | slave_buffer_pos = TWDR; | ||
| 134 | // don't acknowledge the master if this memory loctaion is out of bounds | ||
| 135 | if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) { | ||
| 136 | ack = 0; | ||
| 137 | slave_buffer_pos = 0; | ||
| 138 | } | ||
| 139 | slave_has_register_set = true; | ||
| 140 | } else { | ||
| 141 | i2c_slave_buffer[slave_buffer_pos] = TWDR; | ||
| 142 | BUFFER_POS_INC(); | ||
| 143 | } | ||
| 144 | break; | ||
| 145 | |||
| 146 | case TW_ST_SLA_ACK: | ||
| 147 | case TW_ST_DATA_ACK: | ||
| 148 | // master has addressed this device as a slave transmitter and is | ||
| 149 | // requesting data. | ||
| 150 | TWDR = i2c_slave_buffer[slave_buffer_pos]; | ||
| 151 | BUFFER_POS_INC(); | ||
| 152 | break; | ||
| 153 | |||
| 154 | case TW_BUS_ERROR: // something went wrong, reset twi state | ||
| 155 | TWCR = 0; | ||
| 156 | default: | ||
| 157 | break; | ||
| 158 | } | ||
| 159 | // Reset everything, so we are ready for the next TWI interrupt | ||
| 160 | TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN); | ||
| 161 | } | ||
| 162 | #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 @@ | |||
| 1 | #ifndef I2C_H | ||
| 2 | #define I2C_H | ||
| 3 | |||
| 4 | #include <stdint.h> | ||
| 5 | |||
| 6 | #ifndef F_CPU | ||
| 7 | #define F_CPU 16000000UL | ||
| 8 | #endif | ||
| 9 | |||
| 10 | #define I2C_READ 1 | ||
| 11 | #define I2C_WRITE 0 | ||
| 12 | |||
| 13 | #define I2C_ACK 1 | ||
| 14 | #define I2C_NACK 0 | ||
| 15 | |||
| 16 | #define SLAVE_BUFFER_SIZE 0x10 | ||
| 17 | |||
| 18 | // i2c SCL clock frequency | ||
| 19 | #define SCL_CLOCK 100000L | ||
| 20 | |||
| 21 | extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; | ||
| 22 | |||
| 23 | void i2c_master_init(void); | ||
| 24 | uint8_t i2c_master_start(uint8_t address); | ||
| 25 | void i2c_master_stop(void); | ||
| 26 | uint8_t i2c_master_write(uint8_t data); | ||
| 27 | uint8_t i2c_master_read(int); | ||
| 28 | void i2c_reset_state(void); | ||
| 29 | void i2c_slave_init(uint8_t address); | ||
| 30 | |||
| 31 | #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 @@ | |||
| 1 | #include "minidox.h" | ||
| 2 | #include "action_layer.h" | ||
| 3 | #include "eeconfig.h" | ||
| 4 | |||
| 5 | extern keymap_config_t keymap_config; | ||
| 6 | |||
| 7 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
| 8 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
| 9 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
| 10 | // entirely and just use numbers. | ||
| 11 | #define _QWERTY 0 | ||
| 12 | #define _LOWER 1 | ||
| 13 | #define _RAISE 2 | ||
| 14 | #define _ADJUST 16 | ||
| 15 | |||
| 16 | enum custom_keycodes { | ||
| 17 | QWERTY = SAFE_RANGE, | ||
| 18 | LOWER, | ||
| 19 | RAISE, | ||
| 20 | ADJUST, | ||
| 21 | }; | ||
| 22 | |||
| 23 | // Fillers to make layering more clear | ||
| 24 | #define _______ KC_TRNS | ||
| 25 | #define XXXXXXX KC_NO | ||
| 26 | |||
| 27 | // Defines for task manager and such | ||
| 28 | #define CALTDEL LCTL(LALT(KC_DEL)) | ||
| 29 | #define TSKMGR LCTL(LSFT(KC_ESC)) | ||
| 30 | |||
| 31 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 32 | |||
| 33 | /* Qwerty | ||
| 34 | * | ||
| 35 | * ,----------------------------------. ,----------------------------------. | ||
| 36 | * | Q | W | E | R | T | | Y | U | I | O | P | | ||
| 37 | * |------+------+------+------+------| |------+------+------+------+------| | ||
| 38 | * | A | S | D | F | G | | H | J | K | L | ; | | ||
| 39 | * |------+------+------+------+------| |------+------+------+------+------| | ||
| 40 | * | Z | X | C | V | B | | N | M | , | . | / | | ||
| 41 | * `----------------------------------' `----------------------------------' | ||
| 42 | * ,--------------------. ,------,-------------. | ||
| 43 | * | Ctrl | LOWER| | | | RAISE| Shift| | ||
| 44 | * `-------------| Space| |BckSpc|------+------. | ||
| 45 | * | | | | | ||
| 46 | * `------' `------' | ||
| 47 | */ | ||
| 48 | [_QWERTY] = KEYMAP( \ | ||
| 49 | KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \ | ||
| 50 | KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, \ | ||
| 51 | KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, \ | ||
| 52 | KC_LCTL, LOWER, KC_SPC, KC_BSPC, RAISE, OSM(MOD_LSFT) \ | ||
| 53 | ), | ||
| 54 | |||
| 55 | /* Raise | ||
| 56 | * | ||
| 57 | * ,----------------------------------. ,----------------------------------. | ||
| 58 | * | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | ||
| 59 | * |------+------+------+------+------| |------+------+------+------+------| | ||
| 60 | * | Tab | Left | Down | Up | Right| | | - | = | [ | ] | | ||
| 61 | * |------+------+------+------+------| |------+------+------+------+------| | ||
| 62 | * | Ctrl| ` | GUI | Alt | | | | | | \ | ' | | ||
| 63 | * `----------------------------------' `----------------------------------' | ||
| 64 | * ,--------------------. ,------,-------------. | ||
| 65 | * | | LOWER| | | | RAISE| | | ||
| 66 | * `-------------| | | |------+------. | ||
| 67 | * | | | | | ||
| 68 | * `------' `------' | ||
| 69 | */ | ||
| 70 | [_RAISE] = KEYMAP( \ | ||
| 71 | KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, \ | ||
| 72 | KC_TAB, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, \ | ||
| 73 | KC_LCTL, KC_GRV, KC_LGUI, KC_LALT, _______, _______, _______, _______, KC_BSLS, KC_QUOT, \ | ||
| 74 | _______, _______, _______, _______, _______, _______ \ | ||
| 75 | ), | ||
| 76 | |||
| 77 | /* Lower | ||
| 78 | * | ||
| 79 | * ,----------------------------------. ,----------------------------------. | ||
| 80 | * | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | ||
| 81 | * |------+------+------+------+------| |------+------+------+------+------| | ||
| 82 | * | Esc | | | | | | | _ | + | { | } | | ||
| 83 | * |------+------+------+------+------| |------+------+------+------+------| | ||
| 84 | * | Caps| ~ | | | | | | | | | | " | | ||
| 85 | * `----------------------------------' `----------------------------------' | ||
| 86 | * ,--------------------. ,------,-------------. | ||
| 87 | * | | LOWER| | | | RAISE| Del | | ||
| 88 | * `-------------| | | Enter|------+------. | ||
| 89 | * | | | | | ||
| 90 | * `------' `------' | ||
| 91 | */ | ||
| 92 | [_LOWER] = KEYMAP( \ | ||
| 93 | KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, \ | ||
| 94 | KC_ESC, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, \ | ||
| 95 | KC_CAPS, KC_TILD, _______, _______, _______, _______, _______, _______, KC_PIPE, KC_DQT, \ | ||
| 96 | _______, _______, _______, KC_ENT, _______, KC_DEL \ | ||
| 97 | ), | ||
| 98 | |||
| 99 | /* Adjust (Lower + Raise) | ||
| 100 | * | ||
| 101 | * ,----------------------------------. ,----------------------------------. | ||
| 102 | * | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | | ||
| 103 | * |------+------+------+------+------| |------+------+------+------+------| | ||
| 104 | * | F11 | F12 | | | | | | | |Taskmg|caltde| | ||
| 105 | * |------+------+------+------+------| |------+------+------+------+------| | ||
| 106 | * | Reset| | | | | | | | | | | | ||
| 107 | * `----------------------------------' `----------------------------------' | ||
| 108 | * ,--------------------. ,------,-------------. | ||
| 109 | * | | LOWER| | | | RAISE| | | ||
| 110 | * `-------------| | | |------+------. | ||
| 111 | * | | | | | ||
| 112 | * `------' `------' | ||
| 113 | */ | ||
| 114 | [_ADJUST] = KEYMAP( \ | ||
| 115 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, \ | ||
| 116 | KC_F11, KC_F12, _______, _______, _______, _______, _______, _______, TSKMGR, CALTDEL, \ | ||
| 117 | RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ | ||
| 118 | _______, _______, _______, _______, _______, _______ \ | ||
| 119 | ) | ||
| 120 | }; | ||
| 121 | |||
| 122 | void persistant_default_layer_set(uint16_t default_layer) { | ||
| 123 | eeconfig_update_default_layer(default_layer); | ||
| 124 | default_layer_set(default_layer); | ||
| 125 | } | ||
| 126 | |||
| 127 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 128 | switch (keycode) { | ||
| 129 | case QWERTY: | ||
| 130 | if (record->event.pressed) { | ||
| 131 | #ifdef AUDIO_ENABLE | ||
| 132 | PLAY_NOTE_ARRAY(tone_qwerty, false, 0); | ||
| 133 | #endif | ||
| 134 | persistant_default_layer_set(1UL<<_QWERTY); | ||
| 135 | } | ||
| 136 | return false; | ||
| 137 | break; | ||
| 138 | case LOWER: | ||
| 139 | if (record->event.pressed) { | ||
| 140 | layer_on(_LOWER); | ||
| 141 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 142 | } else { | ||
| 143 | layer_off(_LOWER); | ||
| 144 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 145 | } | ||
| 146 | return false; | ||
| 147 | break; | ||
| 148 | case RAISE: | ||
| 149 | if (record->event.pressed) { | ||
| 150 | layer_on(_RAISE); | ||
| 151 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 152 | } else { | ||
| 153 | layer_off(_RAISE); | ||
| 154 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 155 | } | ||
| 156 | return false; | ||
| 157 | break; | ||
| 158 | case ADJUST: | ||
| 159 | if (record->event.pressed) { | ||
| 160 | layer_on(_ADJUST); | ||
| 161 | } else { | ||
| 162 | layer_off(_ADJUST); | ||
| 163 | } | ||
| 164 | return false; | ||
| 165 | break; | ||
| 166 | } | ||
| 167 | return true; | ||
| 168 | } \ 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 @@ | |||
| 1 | RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 2 | |||
| 3 | ifndef QUANTUM_DIR | ||
| 4 | include ../../../../Makefile | ||
| 5 | 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 @@ | |||
| 1 | /* | ||
| 2 | This is the c configuration file for the keymap | ||
| 3 | |||
| 4 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 5 | Copyright 2015 Jack Humbert | ||
| 6 | |||
| 7 | This program is free software: you can redistribute it and/or modify | ||
| 8 | it under the terms of the GNU General Public License as published by | ||
| 9 | the Free Software Foundation, either version 2 of the License, or | ||
| 10 | (at your option) any later version. | ||
| 11 | |||
| 12 | This program is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | GNU General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #ifndef CONFIG_USER_H | ||
| 22 | #define CONFIG_USER_H | ||
| 23 | |||
| 24 | #include "../../config.h" | ||
| 25 | |||
| 26 | #define USE_SERIAL | ||
| 27 | |||
| 28 | /* ws2812 RGB LED */ | ||
| 29 | #define RGB_DI_PIN D7 | ||
| 30 | #define RGBLIGHT_TIMER | ||
| 31 | #define RGBLED_NUM 4 // Number of LEDs | ||
| 32 | #define RGBLIGHT_ANIMATIONS | ||
| 33 | #define RGBLIGHT_HUE_STEP 10 | ||
| 34 | #define RGBLIGHT_SAT_STEP 17 | ||
| 35 | #define RGBLIGHT_VAL_STEP 17 | ||
| 36 | |||
| 37 | #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 @@ | |||
| 1 | #include "minidox.h" | ||
| 2 | #include "action_layer.h" | ||
| 3 | #include "eeconfig.h" | ||
| 4 | |||
| 5 | extern keymap_config_t keymap_config; | ||
| 6 | |||
| 7 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
| 8 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
| 9 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
| 10 | // entirely and just use numbers. | ||
| 11 | #define _QWERTY 0 | ||
| 12 | #define _LOWER 1 | ||
| 13 | #define _RAISE 2 | ||
| 14 | #define _ADJUST 16 | ||
| 15 | |||
| 16 | enum custom_keycodes { | ||
| 17 | QWERTY = SAFE_RANGE, | ||
| 18 | LOWER, | ||
| 19 | RAISE, | ||
| 20 | ADJUST, | ||
| 21 | }; | ||
| 22 | |||
| 23 | // Fillers to make layering more clear | ||
| 24 | #define _______ KC_TRNS | ||
| 25 | #define XXXXXXX KC_NO | ||
| 26 | |||
| 27 | // Defines for task manager and such | ||
| 28 | #define CALTDEL LCTL(LALT(KC_DEL)) | ||
| 29 | #define TSKMGR LCTL(LSFT(KC_ESC)) | ||
| 30 | |||
| 31 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 32 | |||
| 33 | /* Qwerty | ||
| 34 | * | ||
| 35 | * ,----------------------------------. ,----------------------------------. | ||
| 36 | * | Q | W | E | R | T | | Y | U | I | O | P | | ||
| 37 | * |------+------+------+------+------| |------+------+------+------+------| | ||
| 38 | * | A | S | D | F | G | | H | J | K | L | ; | | ||
| 39 | * |------+------+------+------+------| |------+------+------+------+------| | ||
| 40 | * | Z | X | C | V | B | | N | M | , | . | / | | ||
| 41 | * `----------------------------------' `----------------------------------' | ||
| 42 | * ,--------------------. ,------,-------------. | ||
| 43 | * | Ctrl | LOWER| | | | RAISE| Shift| | ||
| 44 | * `-------------| Space| |BckSpc|------+------. | ||
| 45 | * | | | | | ||
| 46 | * `------' `------' | ||
| 47 | */ | ||
| 48 | [_QWERTY] = KEYMAP( \ | ||
| 49 | KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \ | ||
| 50 | KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, \ | ||
| 51 | KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, \ | ||
| 52 | KC_LCTL, LOWER, KC_SPC, KC_BSPC, RAISE, OSM(MOD_LSFT) \ | ||
| 53 | ), | ||
| 54 | |||
| 55 | /* Raise | ||
| 56 | * | ||
| 57 | * ,----------------------------------. ,----------------------------------. | ||
| 58 | * | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | ||
| 59 | * |------+------+------+------+------| |------+------+------+------+------| | ||
| 60 | * | Tab | Left | Down | Up | Right| | | - | = | [ | ] | | ||
| 61 | * |------+------+------+------+------| |------+------+------+------+------| | ||
| 62 | * | Ctrl| ` | GUI | Alt | | | | | | \ | ' | | ||
| 63 | * `----------------------------------' `----------------------------------' | ||
| 64 | * ,--------------------. ,------,-------------. | ||
| 65 | * | | LOWER| | | | RAISE| | | ||
| 66 | * `-------------| | | |------+------. | ||
| 67 | * | | | | | ||
| 68 | * `------' `------' | ||
| 69 | */ | ||
| 70 | [_RAISE] = KEYMAP( \ | ||
| 71 | KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, \ | ||
| 72 | KC_TAB, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, \ | ||
| 73 | KC_LCTL, KC_GRV, KC_LGUI, KC_LALT, _______, _______, _______, _______, KC_BSLS, KC_QUOT, \ | ||
| 74 | _______, _______, _______, _______, _______, _______ \ | ||
| 75 | ), | ||
| 76 | |||
| 77 | /* Lower | ||
| 78 | * | ||
| 79 | * ,----------------------------------. ,----------------------------------. | ||
| 80 | * | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | ||
| 81 | * |------+------+------+------+------| |------+------+------+------+------| | ||
| 82 | * | Esc | | | | | | | _ | + | { | } | | ||
| 83 | * |------+------+------+------+------| |------+------+------+------+------| | ||
| 84 | * | Caps| ~ | | | | | | | | | | " | | ||
| 85 | * `----------------------------------' `----------------------------------' | ||
| 86 | * ,--------------------. ,------,-------------. | ||
| 87 | * | | LOWER| | | | RAISE| Del | | ||
| 88 | * `-------------| | | Enter|------+------. | ||
| 89 | * | | | | | ||
| 90 | * `------' `------' | ||
| 91 | */ | ||
| 92 | [_LOWER] = KEYMAP( \ | ||
| 93 | KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, \ | ||
| 94 | KC_ESC, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, \ | ||
| 95 | KC_CAPS, KC_TILD, _______, _______, _______, _______, _______, _______, KC_PIPE, KC_DQT, \ | ||
| 96 | _______, _______, _______, KC_ENT, _______, KC_DEL \ | ||
| 97 | ), | ||
| 98 | |||
| 99 | /* Adjust (Lower + Raise) | ||
| 100 | * | ||
| 101 | * ,----------------------------------. ,----------------------------------. | ||
| 102 | * | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | Up | F9 | F10 | | ||
| 103 | * |------+------+------+------+------| |------+------+------+------+------| | ||
| 104 | * | F11 | F12 | | | | | | Left | Down |Right |caltde| | ||
| 105 | * |------+------+------+------+------| |------+------+------+------+------| | ||
| 106 | * | Reset| | | | | | | | F8 |Taskmg| | | ||
| 107 | * `----------------------------------' `----------------------------------' | ||
| 108 | * ,--------------------. ,------,-------------. | ||
| 109 | * | | LOWER| | | | RAISE| | | ||
| 110 | * `-------------| | | |------+------. | ||
| 111 | * | | | | | ||
| 112 | * `------' `------' | ||
| 113 | */ | ||
| 114 | [_ADJUST] = KEYMAP( \ | ||
| 115 | KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_UP, KC_F9, KC_F10, \ | ||
| 116 | KC_F11, KC_F12, _______, RGB_SAI, RGB_SAD, _______, KC_LEFT, KC_DOWN, KC_RGHT, CALTDEL, \ | ||
| 117 | RESET, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_VAI, RGB_VAD, KC_F8, TSKMGR, _______, \ | ||
| 118 | _______, _______, _______, _______, _______, _______ \ | ||
| 119 | ) | ||
| 120 | }; | ||
| 121 | |||
| 122 | #ifdef AUDIO_ENABLE | ||
| 123 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
| 124 | #endif | ||
| 125 | |||
| 126 | void persistant_default_layer_set(uint16_t default_layer) { | ||
| 127 | eeconfig_update_default_layer(default_layer); | ||
| 128 | default_layer_set(default_layer); | ||
| 129 | } | ||
| 130 | |||
| 131 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 132 | switch (keycode) { | ||
| 133 | case QWERTY: | ||
| 134 | if (record->event.pressed) { | ||
| 135 | #ifdef AUDIO_ENABLE | ||
| 136 | PLAY_NOTE_ARRAY(tone_qwerty, false, 0); | ||
| 137 | #endif | ||
| 138 | persistant_default_layer_set(1UL<<_QWERTY); | ||
| 139 | } | ||
| 140 | return false; | ||
| 141 | break; | ||
| 142 | case LOWER: | ||
| 143 | if (record->event.pressed) { | ||
| 144 | layer_on(_LOWER); | ||
| 145 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 146 | } else { | ||
| 147 | layer_off(_LOWER); | ||
| 148 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 149 | } | ||
| 150 | return false; | ||
| 151 | break; | ||
| 152 | case RAISE: | ||
| 153 | if (record->event.pressed) { | ||
| 154 | layer_on(_RAISE); | ||
| 155 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 156 | } else { | ||
| 157 | layer_off(_RAISE); | ||
| 158 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 159 | } | ||
| 160 | return false; | ||
| 161 | break; | ||
| 162 | case ADJUST: | ||
| 163 | if (record->event.pressed) { | ||
| 164 | layer_on(_ADJUST); | ||
| 165 | } else { | ||
| 166 | layer_off(_ADJUST); | ||
| 167 | } | ||
| 168 | return false; | ||
| 169 | break; | ||
| 170 | } | ||
| 171 | return true; | ||
| 172 | } \ 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 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | /* | ||
| 19 | * scan matrix | ||
| 20 | */ | ||
| 21 | #include <stdint.h> | ||
| 22 | #include <stdbool.h> | ||
| 23 | #include <avr/io.h> | ||
| 24 | #include <avr/wdt.h> | ||
| 25 | #include <avr/interrupt.h> | ||
| 26 | #include <util/delay.h> | ||
| 27 | #include "print.h" | ||
| 28 | #include "debug.h" | ||
| 29 | #include "util.h" | ||
| 30 | #include "matrix.h" | ||
| 31 | #include "split_util.h" | ||
| 32 | #include "pro_micro.h" | ||
| 33 | #include "config.h" | ||
| 34 | |||
| 35 | #ifdef USE_I2C | ||
| 36 | # include "i2c.h" | ||
| 37 | #else // USE_SERIAL | ||
| 38 | # include "serial.h" | ||
| 39 | #endif | ||
| 40 | |||
| 41 | #ifndef DEBOUNCE | ||
| 42 | # define DEBOUNCE 5 | ||
| 43 | #endif | ||
| 44 | |||
| 45 | #define ERROR_DISCONNECT_COUNT 5 | ||
| 46 | |||
| 47 | static uint8_t debouncing = DEBOUNCE; | ||
| 48 | static const int ROWS_PER_HAND = MATRIX_ROWS/2; | ||
| 49 | static uint8_t error_count = 0; | ||
| 50 | |||
| 51 | static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; | ||
| 52 | static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; | ||
| 53 | |||
| 54 | /* matrix state(1:on, 0:off) */ | ||
| 55 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
| 56 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
| 57 | |||
| 58 | static matrix_row_t read_cols(void); | ||
| 59 | static void init_cols(void); | ||
| 60 | static void unselect_rows(void); | ||
| 61 | static void select_row(uint8_t row); | ||
| 62 | |||
| 63 | __attribute__ ((weak)) | ||
| 64 | void matrix_init_quantum(void) { | ||
| 65 | matrix_init_kb(); | ||
| 66 | } | ||
| 67 | |||
| 68 | __attribute__ ((weak)) | ||
| 69 | void matrix_scan_quantum(void) { | ||
| 70 | matrix_scan_kb(); | ||
| 71 | } | ||
| 72 | |||
| 73 | __attribute__ ((weak)) | ||
| 74 | void matrix_init_kb(void) { | ||
| 75 | matrix_init_user(); | ||
| 76 | } | ||
| 77 | |||
| 78 | __attribute__ ((weak)) | ||
| 79 | void matrix_scan_kb(void) { | ||
| 80 | matrix_scan_user(); | ||
| 81 | } | ||
| 82 | |||
| 83 | __attribute__ ((weak)) | ||
| 84 | void matrix_init_user(void) { | ||
| 85 | } | ||
| 86 | |||
| 87 | __attribute__ ((weak)) | ||
| 88 | void matrix_scan_user(void) { | ||
| 89 | } | ||
| 90 | |||
| 91 | inline | ||
| 92 | uint8_t matrix_rows(void) | ||
| 93 | { | ||
| 94 | return MATRIX_ROWS; | ||
| 95 | } | ||
| 96 | |||
| 97 | inline | ||
| 98 | uint8_t matrix_cols(void) | ||
| 99 | { | ||
| 100 | return MATRIX_COLS; | ||
| 101 | } | ||
| 102 | |||
| 103 | void matrix_init(void) | ||
| 104 | { | ||
| 105 | debug_enable = true; | ||
| 106 | debug_matrix = true; | ||
| 107 | debug_mouse = true; | ||
| 108 | // initialize row and col | ||
| 109 | unselect_rows(); | ||
| 110 | init_cols(); | ||
| 111 | |||
| 112 | TX_RX_LED_INIT; | ||
| 113 | |||
| 114 | // initialize matrix state: all keys off | ||
| 115 | for (uint8_t i=0; i < MATRIX_ROWS; i++) { | ||
| 116 | matrix[i] = 0; | ||
| 117 | matrix_debouncing[i] = 0; | ||
| 118 | } | ||
| 119 | |||
| 120 | matrix_init_quantum(); | ||
| 121 | } | ||
| 122 | |||
| 123 | uint8_t _matrix_scan(void) | ||
| 124 | { | ||
| 125 | // Right hand is stored after the left in the matirx so, we need to offset it | ||
| 126 | int offset = isLeftHand ? 0 : (ROWS_PER_HAND); | ||
| 127 | |||
| 128 | for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { | ||
| 129 | select_row(i); | ||
| 130 | _delay_us(30); // without this wait read unstable value. | ||
| 131 | matrix_row_t cols = read_cols(); | ||
| 132 | if (matrix_debouncing[i+offset] != cols) { | ||
| 133 | matrix_debouncing[i+offset] = cols; | ||
| 134 | debouncing = DEBOUNCE; | ||
| 135 | } | ||
| 136 | unselect_rows(); | ||
| 137 | } | ||
| 138 | |||
| 139 | if (debouncing) { | ||
| 140 | if (--debouncing) { | ||
| 141 | _delay_ms(1); | ||
| 142 | } else { | ||
| 143 | for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { | ||
| 144 | matrix[i+offset] = matrix_debouncing[i+offset]; | ||
| 145 | } | ||
| 146 | } | ||
| 147 | } | ||
| 148 | |||
| 149 | return 1; | ||
| 150 | } | ||
| 151 | |||
| 152 | #ifdef USE_I2C | ||
| 153 | |||
| 154 | // Get rows from other half over i2c | ||
| 155 | int i2c_transaction(void) { | ||
| 156 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
| 157 | |||
| 158 | int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); | ||
| 159 | if (err) goto i2c_error; | ||
| 160 | |||
| 161 | // start of matrix stored at 0x00 | ||
| 162 | err = i2c_master_write(0x00); | ||
| 163 | if (err) goto i2c_error; | ||
| 164 | |||
| 165 | // Start read | ||
| 166 | err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); | ||
| 167 | if (err) goto i2c_error; | ||
| 168 | |||
| 169 | if (!err) { | ||
| 170 | int i; | ||
| 171 | for (i = 0; i < ROWS_PER_HAND-1; ++i) { | ||
| 172 | matrix[slaveOffset+i] = i2c_master_read(I2C_ACK); | ||
| 173 | } | ||
| 174 | matrix[slaveOffset+i] = i2c_master_read(I2C_NACK); | ||
| 175 | i2c_master_stop(); | ||
| 176 | } else { | ||
| 177 | i2c_error: // the cable is disconnceted, or something else went wrong | ||
| 178 | i2c_reset_state(); | ||
| 179 | return err; | ||
| 180 | } | ||
| 181 | |||
| 182 | return 0; | ||
| 183 | } | ||
| 184 | |||
| 185 | #else // USE_SERIAL | ||
| 186 | |||
| 187 | int serial_transaction(void) { | ||
| 188 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
| 189 | |||
| 190 | if (serial_update_buffers()) { | ||
| 191 | return 1; | ||
| 192 | } | ||
| 193 | |||
| 194 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 195 | matrix[slaveOffset+i] = serial_slave_buffer[i]; | ||
| 196 | } | ||
| 197 | return 0; | ||
| 198 | } | ||
| 199 | #endif | ||
| 200 | |||
| 201 | uint8_t matrix_scan(void) | ||
| 202 | { | ||
| 203 | int ret = _matrix_scan(); | ||
| 204 | |||
| 205 | |||
| 206 | |||
| 207 | #ifdef USE_I2C | ||
| 208 | if( i2c_transaction() ) { | ||
| 209 | #else // USE_SERIAL | ||
| 210 | if( serial_transaction() ) { | ||
| 211 | #endif | ||
| 212 | // turn on the indicator led when halves are disconnected | ||
| 213 | TXLED1; | ||
| 214 | |||
| 215 | error_count++; | ||
| 216 | |||
| 217 | if (error_count > ERROR_DISCONNECT_COUNT) { | ||
| 218 | // reset other half if disconnected | ||
| 219 | int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; | ||
| 220 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 221 | matrix[slaveOffset+i] = 0; | ||
| 222 | } | ||
| 223 | } | ||
| 224 | } else { | ||
| 225 | // turn off the indicator led on no error | ||
| 226 | TXLED0; | ||
| 227 | error_count = 0; | ||
| 228 | } | ||
| 229 | |||
| 230 | matrix_scan_quantum(); | ||
| 231 | |||
| 232 | return ret; | ||
| 233 | } | ||
| 234 | |||
| 235 | void matrix_slave_scan(void) { | ||
| 236 | _matrix_scan(); | ||
| 237 | |||
| 238 | int offset = (isLeftHand) ? 0 : (MATRIX_ROWS / 2); | ||
| 239 | |||
| 240 | #ifdef USE_I2C | ||
| 241 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 242 | /* i2c_slave_buffer[i] = matrix[offset+i]; */ | ||
| 243 | i2c_slave_buffer[i] = matrix[offset+i]; | ||
| 244 | } | ||
| 245 | #else // USE_SERIAL | ||
| 246 | for (int i = 0; i < ROWS_PER_HAND; ++i) { | ||
| 247 | serial_slave_buffer[i] = matrix[offset+i]; | ||
| 248 | } | ||
| 249 | #endif | ||
| 250 | } | ||
| 251 | |||
| 252 | bool matrix_is_modified(void) | ||
| 253 | { | ||
| 254 | if (debouncing) return false; | ||
| 255 | return true; | ||
| 256 | } | ||
| 257 | |||
| 258 | inline | ||
| 259 | bool matrix_is_on(uint8_t row, uint8_t col) | ||
| 260 | { | ||
| 261 | return (matrix[row] & ((matrix_row_t)1<<col)); | ||
| 262 | } | ||
| 263 | |||
| 264 | inline | ||
| 265 | matrix_row_t matrix_get_row(uint8_t row) | ||
| 266 | { | ||
| 267 | return matrix[row]; | ||
| 268 | } | ||
| 269 | |||
| 270 | void matrix_print(void) | ||
| 271 | { | ||
| 272 | print("\nr/c 0123456789ABCDEF\n"); | ||
| 273 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 274 | phex(row); print(": "); | ||
| 275 | pbin_reverse16(matrix_get_row(row)); | ||
| 276 | print("\n"); | ||
| 277 | } | ||
| 278 | } | ||
| 279 | |||
| 280 | uint8_t matrix_key_count(void) | ||
| 281 | { | ||
| 282 | uint8_t count = 0; | ||
| 283 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 284 | count += bitpop16(matrix[i]); | ||
| 285 | } | ||
| 286 | return count; | ||
| 287 | } | ||
| 288 | |||
| 289 | static void init_cols(void) | ||
| 290 | { | ||
| 291 | for(int x = 0; x < MATRIX_COLS; x++) { | ||
| 292 | _SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF); | ||
| 293 | _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF); | ||
| 294 | } | ||
| 295 | } | ||
| 296 | |||
| 297 | static matrix_row_t read_cols(void) | ||
| 298 | { | ||
| 299 | matrix_row_t result = 0; | ||
| 300 | for(int x = 0; x < MATRIX_COLS; x++) { | ||
| 301 | result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x); | ||
| 302 | } | ||
| 303 | return result; | ||
| 304 | } | ||
| 305 | |||
| 306 | static void unselect_rows(void) | ||
| 307 | { | ||
| 308 | for(int x = 0; x < ROWS_PER_HAND; x++) { | ||
| 309 | _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF); | ||
| 310 | _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF); | ||
| 311 | } | ||
| 312 | } | ||
| 313 | |||
| 314 | static void select_row(uint8_t row) | ||
| 315 | { | ||
| 316 | _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF); | ||
| 317 | _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF); | ||
| 318 | } | ||
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 @@ | |||
| 1 | #ifndef MINIDOX_H | ||
| 2 | #define MINIDOX_H | ||
| 3 | |||
| 4 | #ifdef SUBPROJECT_rev1 | ||
| 5 | #include "rev1.h" | ||
| 6 | #endif | ||
| 7 | |||
| 8 | #include "quantum.h" | ||
| 9 | |||
| 10 | #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 @@ | |||
| 1 | ECO | ||
| 2 | === | ||
| 3 | |||
| 4 |  | ||
| 5 | |||
| 6 | A compact version of the ErgoDox | ||
| 7 | |||
| 8 | Keyboard Maintainer: That-Canadian | ||
| 9 | Hardware Supported: MiniDox PCB rev1 Pro Micro | ||
| 10 | |||
| 11 | Make example for this keyboard (after setting up your build environment): | ||
| 12 | |||
| 13 | make minidox-rev1-default | ||
| 14 | |||
| 15 | 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 @@ | |||
| 1 | ifndef MAKEFILE_INCLUDED | ||
| 2 | include ../../Makefile | ||
| 3 | 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 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef REV1_CONFIG_H | ||
| 19 | #define REV1_CONFIG_H | ||
| 20 | |||
| 21 | #include "../config.h" | ||
| 22 | |||
| 23 | #define DEVICE_VER 0x0001 | ||
| 24 | |||
| 25 | // wiring of each half | ||
| 26 | #define MATRIX_ROW_PINS { B2, B6, B4, B5 } | ||
| 27 | #define MATRIX_COL_PINS { F4, D3, D2, D1, D4 } | ||
| 28 | |||
| 29 | #define CATERINA_BOOTLOADER | ||
| 30 | |||
| 31 | #define USE_SERIAL | ||
| 32 | |||
| 33 | // #define EE_HANDS | ||
| 34 | |||
| 35 | #define I2C_MASTER_LEFT | ||
| 36 | //#define I2C_MASTER_RIGHT | ||
| 37 | |||
| 38 | #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 @@ | |||
| 1 | #ifndef REV1_H | ||
| 2 | #define REV1_H | ||
| 3 | |||
| 4 | #include "../minidox.h" | ||
| 5 | |||
| 6 | //void promicro_bootloader_jmp(bool program); | ||
| 7 | #include "quantum.h" | ||
| 8 | |||
| 9 | //void promicro_bootloader_jmp(bool program); | ||
| 10 | |||
| 11 | #define KEYMAP( \ | ||
| 12 | k01, k02, k03, k04, k05, k45, k44, k43, k42, k41, \ | ||
| 13 | k11, k12, k13, k14, k15, k55, k54, k53, k52, k51, \ | ||
| 14 | k21, k22, k23, k24, k25, k65, k64, k63, k62, k61, \ | ||
| 15 | k33, k34, k35, k75, k74, k73 \ | ||
| 16 | ) \ | ||
| 17 | { \ | ||
| 18 | { k01, k02, k03, k04, k05 }, \ | ||
| 19 | { k11, k12, k13, k14, k15 }, \ | ||
| 20 | { k21, k22, k23, k24, k25 }, \ | ||
| 21 | { KC_NO, KC_NO, k33, k34, k35 }, \ | ||
| 22 | { k41, k42, k43, k44, k45 }, \ | ||
| 23 | { k51, k52, k53, k54, k55 }, \ | ||
| 24 | { k61, k62, k63, k64, k65 }, \ | ||
| 25 | { KC_NO, KC_NO, k73, k74, k75 } \ | ||
| 26 | } | ||
| 27 | |||
| 28 | #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 @@ | |||
| 1 | BACKLIGHT_ENABLE = no | ||
| 2 | |||
| 3 | ifndef QUANTUM_DIR | ||
| 4 | include ../../../Makefile | ||
| 5 | 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 @@ | |||
| 1 | SRC += matrix.c \ | ||
| 2 | i2c.c \ | ||
| 3 | split_util.c \ | ||
| 4 | serial.c | ||
| 5 | |||
| 6 | # MCU name | ||
| 7 | #MCU = at90usb1287 | ||
| 8 | MCU = atmega32u4 | ||
| 9 | |||
| 10 | # Processor frequency. | ||
| 11 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
| 12 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
| 13 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
| 14 | # automatically to create a 32-bit value in your source code. | ||
| 15 | # | ||
| 16 | # This will be an integer division of F_USB below, as it is sourced by | ||
| 17 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
| 18 | # does not *change* the processor frequency - it should merely be updated to | ||
| 19 | # reflect the processor speed set externally so that the code can use accurate | ||
| 20 | # software delays. | ||
| 21 | F_CPU = 16000000 | ||
| 22 | |||
| 23 | # | ||
| 24 | # LUFA specific | ||
| 25 | # | ||
| 26 | # Target architecture (see library "Board Types" documentation). | ||
| 27 | ARCH = AVR8 | ||
| 28 | |||
| 29 | # Input clock frequency. | ||
| 30 | # This will define a symbol, F_USB, in all source code files equal to the | ||
| 31 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
| 32 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
| 33 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
| 34 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
| 35 | # at the end, this will be done automatically to create a 32-bit value in your | ||
| 36 | # source code. | ||
| 37 | # | ||
| 38 | # If no clock division is performed on the input clock inside the AVR (via the | ||
| 39 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
| 40 | F_USB = $(F_CPU) | ||
| 41 | |||
| 42 | # Interrupt driven control endpoint task(+60) | ||
| 43 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
| 44 | |||
| 45 | |||
| 46 | # Boot Section Size in *bytes* | ||
| 47 | # Teensy halfKay 512 | ||
| 48 | # Teensy++ halfKay 1024 | ||
| 49 | # Atmel DFU loader 4096 | ||
| 50 | # LUFA bootloader 4096 | ||
| 51 | # USBaspLoader 2048 | ||
| 52 | OPT_DEFS += -DBOOTLOADER_SIZE=4096 | ||
| 53 | |||
| 54 | # Build Options | ||
| 55 | # change to "no" to disable the options, or define them in the Makefile in | ||
| 56 | # the appropriate keymap folder that will get included automatically | ||
| 57 | # | ||
| 58 | BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) | ||
| 59 | MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) | ||
| 60 | EXTRAKEY_ENABLE ?= no # Audio control and System control(+450) | ||
| 61 | CONSOLE_ENABLE ?= no # Console for debug(+400) | ||
| 62 | COMMAND_ENABLE ?= yes # Commands for debug and configuration | ||
| 63 | NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 64 | BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality | ||
| 65 | MIDI_ENABLE ?= no # MIDI controls | ||
| 66 | AUDIO_ENABLE ?= no # Audio output on port C6 | ||
| 67 | UNICODE_ENABLE ?= no # Unicode | ||
| 68 | BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID | ||
| 69 | RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. | ||
| 70 | USE_I2C ?= no | ||
| 71 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 72 | SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend | ||
| 73 | |||
| 74 | 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 @@ | |||
| 1 | /* | ||
| 2 | * WARNING: be careful changing this code, it is very timing dependent | ||
| 3 | */ | ||
| 4 | |||
| 5 | #ifndef F_CPU | ||
| 6 | #define F_CPU 16000000 | ||
| 7 | #endif | ||
| 8 | |||
| 9 | #include <avr/io.h> | ||
| 10 | #include <avr/interrupt.h> | ||
| 11 | #include <util/delay.h> | ||
| 12 | #include <stdbool.h> | ||
| 13 | #include "serial.h" | ||
| 14 | |||
| 15 | #ifdef USE_SERIAL | ||
| 16 | |||
| 17 | // Serial pulse period in microseconds. Its probably a bad idea to lower this | ||
| 18 | // value. | ||
| 19 | #define SERIAL_DELAY 24 | ||
| 20 | |||
| 21 | uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; | ||
| 22 | uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; | ||
| 23 | |||
| 24 | #define SLAVE_DATA_CORRUPT (1<<0) | ||
| 25 | volatile uint8_t status = 0; | ||
| 26 | |||
| 27 | inline static | ||
| 28 | void serial_delay(void) { | ||
| 29 | _delay_us(SERIAL_DELAY); | ||
| 30 | } | ||
| 31 | |||
| 32 | inline static | ||
| 33 | void serial_output(void) { | ||
| 34 | SERIAL_PIN_DDR |= SERIAL_PIN_MASK; | ||
| 35 | } | ||
| 36 | |||
| 37 | // make the serial pin an input with pull-up resistor | ||
| 38 | inline static | ||
| 39 | void serial_input(void) { | ||
| 40 | SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK; | ||
| 41 | SERIAL_PIN_PORT |= SERIAL_PIN_MASK; | ||
| 42 | } | ||
| 43 | |||
| 44 | inline static | ||
| 45 | uint8_t serial_read_pin(void) { | ||
| 46 | return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK); | ||
| 47 | } | ||
| 48 | |||
| 49 | inline static | ||
| 50 | void serial_low(void) { | ||
| 51 | SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; | ||
| 52 | } | ||
| 53 | |||
| 54 | inline static | ||
| 55 | void serial_high(void) { | ||
| 56 | SERIAL_PIN_PORT |= SERIAL_PIN_MASK; | ||
| 57 | } | ||
| 58 | |||
| 59 | void serial_master_init(void) { | ||
| 60 | serial_output(); | ||
| 61 | serial_high(); | ||
| 62 | } | ||
| 63 | |||
| 64 | void serial_slave_init(void) { | ||
| 65 | serial_input(); | ||
| 66 | |||
| 67 | // Enable INT0 | ||
| 68 | EIMSK |= _BV(INT0); | ||
| 69 | // Trigger on falling edge of INT0 | ||
| 70 | EICRA &= ~(_BV(ISC00) | _BV(ISC01)); | ||
| 71 | } | ||
| 72 | |||
| 73 | // Used by the master to synchronize timing with the slave. | ||
| 74 | static | ||
| 75 | void sync_recv(void) { | ||
| 76 | serial_input(); | ||
| 77 | // This shouldn't hang if the slave disconnects because the | ||
| 78 | // serial line will float to high if the slave does disconnect. | ||
| 79 | while (!serial_read_pin()); | ||
| 80 | serial_delay(); | ||
| 81 | } | ||
| 82 | |||
| 83 | // Used by the slave to send a synchronization signal to the master. | ||
| 84 | static | ||
| 85 | void sync_send(void) { | ||
| 86 | serial_output(); | ||
| 87 | |||
| 88 | serial_low(); | ||
| 89 | serial_delay(); | ||
| 90 | |||
| 91 | serial_high(); | ||
| 92 | } | ||
| 93 | |||
| 94 | // Reads a byte from the serial line | ||
| 95 | static | ||
| 96 | uint8_t serial_read_byte(void) { | ||
| 97 | uint8_t byte = 0; | ||
| 98 | serial_input(); | ||
| 99 | for ( uint8_t i = 0; i < 8; ++i) { | ||
| 100 | byte = (byte << 1) | serial_read_pin(); | ||
| 101 | serial_delay(); | ||
| 102 | _delay_us(1); | ||
| 103 | } | ||
| 104 | |||
| 105 | return byte; | ||
| 106 | } | ||
| 107 | |||
| 108 | // Sends a byte with MSB ordering | ||
| 109 | static | ||
| 110 | void serial_write_byte(uint8_t data) { | ||
| 111 | uint8_t b = 8; | ||
| 112 | serial_output(); | ||
| 113 | while( b-- ) { | ||
| 114 | if(data & (1 << b)) { | ||
| 115 | serial_high(); | ||
| 116 | } else { | ||
| 117 | serial_low(); | ||
| 118 | } | ||
| 119 | serial_delay(); | ||
| 120 | } | ||
| 121 | } | ||
| 122 | |||
| 123 | // interrupt handle to be used by the slave device | ||
| 124 | ISR(SERIAL_PIN_INTERRUPT) { | ||
| 125 | sync_send(); | ||
| 126 | |||
| 127 | uint8_t checksum = 0; | ||
| 128 | for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { | ||
| 129 | serial_write_byte(serial_slave_buffer[i]); | ||
| 130 | sync_send(); | ||
| 131 | checksum += serial_slave_buffer[i]; | ||
| 132 | } | ||
| 133 | serial_write_byte(checksum); | ||
| 134 | sync_send(); | ||
| 135 | |||
| 136 | // wait for the sync to finish sending | ||
| 137 | serial_delay(); | ||
| 138 | |||
| 139 | // read the middle of pulses | ||
| 140 | _delay_us(SERIAL_DELAY/2); | ||
| 141 | |||
| 142 | uint8_t checksum_computed = 0; | ||
| 143 | for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { | ||
| 144 | serial_master_buffer[i] = serial_read_byte(); | ||
| 145 | sync_send(); | ||
| 146 | checksum_computed += serial_master_buffer[i]; | ||
| 147 | } | ||
| 148 | uint8_t checksum_received = serial_read_byte(); | ||
| 149 | sync_send(); | ||
| 150 | |||
| 151 | serial_input(); // end transaction | ||
| 152 | |||
| 153 | if ( checksum_computed != checksum_received ) { | ||
| 154 | status |= SLAVE_DATA_CORRUPT; | ||
| 155 | } else { | ||
| 156 | status &= ~SLAVE_DATA_CORRUPT; | ||
| 157 | } | ||
| 158 | } | ||
| 159 | |||
| 160 | inline | ||
| 161 | bool serial_slave_DATA_CORRUPT(void) { | ||
| 162 | return status & SLAVE_DATA_CORRUPT; | ||
| 163 | } | ||
| 164 | |||
| 165 | // Copies the serial_slave_buffer to the master and sends the | ||
| 166 | // serial_master_buffer to the slave. | ||
| 167 | // | ||
| 168 | // Returns: | ||
| 169 | // 0 => no error | ||
| 170 | // 1 => slave did not respond | ||
| 171 | int serial_update_buffers(void) { | ||
| 172 | // this code is very time dependent, so we need to disable interrupts | ||
| 173 | cli(); | ||
| 174 | |||
| 175 | // signal to the slave that we want to start a transaction | ||
| 176 | serial_output(); | ||
| 177 | serial_low(); | ||
| 178 | _delay_us(1); | ||
| 179 | |||
| 180 | // wait for the slaves response | ||
| 181 | serial_input(); | ||
| 182 | serial_high(); | ||
| 183 | _delay_us(SERIAL_DELAY); | ||
| 184 | |||
| 185 | // check if the slave is present | ||
| 186 | if (serial_read_pin()) { | ||
| 187 | // slave failed to pull the line low, assume not present | ||
| 188 | sei(); | ||
| 189 | return 1; | ||
| 190 | } | ||
| 191 | |||
| 192 | // if the slave is present syncronize with it | ||
| 193 | sync_recv(); | ||
| 194 | |||
| 195 | uint8_t checksum_computed = 0; | ||
| 196 | // receive data from the slave | ||
| 197 | for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { | ||
| 198 | serial_slave_buffer[i] = serial_read_byte(); | ||
| 199 | sync_recv(); | ||
| 200 | checksum_computed += serial_slave_buffer[i]; | ||
| 201 | } | ||
| 202 | uint8_t checksum_received = serial_read_byte(); | ||
| 203 | sync_recv(); | ||
| 204 | |||
| 205 | if (checksum_computed != checksum_received) { | ||
| 206 | sei(); | ||
| 207 | return 1; | ||
| 208 | } | ||
| 209 | |||
| 210 | uint8_t checksum = 0; | ||
| 211 | // send data to the slave | ||
| 212 | for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { | ||
| 213 | serial_write_byte(serial_master_buffer[i]); | ||
| 214 | sync_recv(); | ||
| 215 | checksum += serial_master_buffer[i]; | ||
| 216 | } | ||
| 217 | serial_write_byte(checksum); | ||
| 218 | sync_recv(); | ||
| 219 | |||
| 220 | // always, release the line when not in use | ||
| 221 | serial_output(); | ||
| 222 | serial_high(); | ||
| 223 | |||
| 224 | sei(); | ||
| 225 | return 0; | ||
| 226 | } | ||
| 227 | |||
| 228 | #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 @@ | |||
| 1 | #ifndef MY_SERIAL_H | ||
| 2 | #define MY_SERIAL_H | ||
| 3 | |||
| 4 | #include "config.h" | ||
| 5 | #include <stdbool.h> | ||
| 6 | |||
| 7 | /* TODO: some defines for interrupt setup */ | ||
| 8 | #define SERIAL_PIN_DDR DDRD | ||
| 9 | #define SERIAL_PIN_PORT PORTD | ||
| 10 | #define SERIAL_PIN_INPUT PIND | ||
| 11 | #define SERIAL_PIN_MASK _BV(PD0) | ||
| 12 | #define SERIAL_PIN_INTERRUPT INT0_vect | ||
| 13 | |||
| 14 | #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 | ||
| 15 | #define SERIAL_MASTER_BUFFER_LENGTH 1 | ||
| 16 | |||
| 17 | // Buffers for master - slave communication | ||
| 18 | extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; | ||
| 19 | extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; | ||
| 20 | |||
| 21 | void serial_master_init(void); | ||
| 22 | void serial_slave_init(void); | ||
| 23 | int serial_update_buffers(void); | ||
| 24 | bool serial_slave_data_corrupt(void); | ||
| 25 | |||
| 26 | #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 @@ | |||
| 1 | #include <avr/io.h> | ||
| 2 | #include <avr/wdt.h> | ||
| 3 | #include <avr/power.h> | ||
| 4 | #include <avr/interrupt.h> | ||
| 5 | #include <util/delay.h> | ||
| 6 | #include <avr/eeprom.h> | ||
| 7 | #include "split_util.h" | ||
| 8 | #include "matrix.h" | ||
| 9 | #include "keyboard.h" | ||
| 10 | #include "config.h" | ||
| 11 | |||
| 12 | #ifdef USE_I2C | ||
| 13 | # include "i2c.h" | ||
| 14 | #else | ||
| 15 | # include "serial.h" | ||
| 16 | #endif | ||
| 17 | |||
| 18 | volatile bool isLeftHand = true; | ||
| 19 | |||
| 20 | static void setup_handedness(void) { | ||
| 21 | #ifdef EE_HANDS | ||
| 22 | isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); | ||
| 23 | #else | ||
| 24 | #ifdef I2C_MASTER_RIGHT | ||
| 25 | isLeftHand = !has_usb(); | ||
| 26 | #else | ||
| 27 | isLeftHand = has_usb(); | ||
| 28 | #endif | ||
| 29 | #endif | ||
| 30 | } | ||
| 31 | |||
| 32 | static void keyboard_master_setup(void) { | ||
| 33 | #ifdef USE_I2C | ||
| 34 | i2c_master_init(); | ||
| 35 | #else | ||
| 36 | serial_master_init(); | ||
| 37 | #endif | ||
| 38 | } | ||
| 39 | |||
| 40 | static void keyboard_slave_setup(void) { | ||
| 41 | #ifdef USE_I2C | ||
| 42 | i2c_slave_init(SLAVE_I2C_ADDRESS); | ||
| 43 | #else | ||
| 44 | serial_slave_init(); | ||
| 45 | #endif | ||
| 46 | } | ||
| 47 | |||
| 48 | bool has_usb(void) { | ||
| 49 | USBCON |= (1 << OTGPADE); //enables VBUS pad | ||
| 50 | _delay_us(5); | ||
| 51 | return (USBSTA & (1<<VBUS)); //checks state of VBUS | ||
| 52 | } | ||
| 53 | |||
| 54 | void split_keyboard_setup(void) { | ||
| 55 | setup_handedness(); | ||
| 56 | |||
| 57 | if (has_usb()) { | ||
| 58 | keyboard_master_setup(); | ||
| 59 | } else { | ||
| 60 | keyboard_slave_setup(); | ||
| 61 | } | ||
| 62 | sei(); | ||
| 63 | } | ||
| 64 | |||
| 65 | void keyboard_slave_loop(void) { | ||
| 66 | matrix_init(); | ||
| 67 | |||
| 68 | while (1) { | ||
| 69 | matrix_slave_scan(); | ||
| 70 | } | ||
| 71 | } | ||
| 72 | |||
| 73 | // this code runs before the usb and keyboard is initialized | ||
| 74 | void matrix_setup(void) { | ||
| 75 | split_keyboard_setup(); | ||
| 76 | |||
| 77 | if (!has_usb()) { | ||
| 78 | keyboard_slave_loop(); | ||
| 79 | } | ||
| 80 | } | ||
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 @@ | |||
| 1 | #ifndef SPLIT_KEYBOARD_UTIL_H | ||
| 2 | #define SPLIT_KEYBOARD_UTIL_H | ||
| 3 | |||
| 4 | #include <stdbool.h> | ||
| 5 | |||
| 6 | #ifdef EE_HANDS | ||
| 7 | #define EECONFIG_BOOTMAGIC_END (uint8_t *)10 | ||
| 8 | #define EECONFIG_HANDEDNESS EECONFIG_BOOTMAGIC_END | ||
| 9 | #endif | ||
| 10 | |||
| 11 | #define SLAVE_I2C_ADDRESS 0x32 | ||
| 12 | |||
| 13 | extern volatile bool isLeftHand; | ||
| 14 | |||
| 15 | // slave version of matix scan, defined in matrix.c | ||
| 16 | void matrix_slave_scan(void); | ||
| 17 | |||
| 18 | void split_keyboard_setup(void); | ||
| 19 | bool has_usb(void); | ||
| 20 | void keyboard_slave_loop(void); | ||
| 21 | |||
| 22 | #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 @@ | |||
| 1 | /* | ||
| 2 | pins_arduino.h - Pin definition functions for Arduino | ||
| 3 | Part of Arduino - http://www.arduino.cc/ | ||
| 4 | |||
| 5 | Copyright (c) 2007 David A. Mellis | ||
| 6 | |||
| 7 | This library is free software; you can redistribute it and/or | ||
| 8 | modify it under the terms of the GNU Lesser General Public | ||
| 9 | License as published by the Free Software Foundation; either | ||
| 10 | version 2.1 of the License, or (at your option) any later version. | ||
| 11 | |||
| 12 | This library is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | Lesser General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU Lesser General | ||
| 18 | Public License along with this library; if not, write to the | ||
| 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, | ||
| 20 | Boston, MA 02111-1307 USA | ||
| 21 | |||
| 22 | $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ | ||
| 23 | */ | ||
| 24 | |||
| 25 | #ifndef Pins_Arduino_h | ||
| 26 | #define Pins_Arduino_h | ||
| 27 | |||
| 28 | #include <avr/pgmspace.h> | ||
| 29 | |||
| 30 | // Workaround for wrong definitions in "iom32u4.h". | ||
| 31 | // This should be fixed in the AVR toolchain. | ||
| 32 | #undef UHCON | ||
| 33 | #undef UHINT | ||
| 34 | #undef UHIEN | ||
| 35 | #undef UHADDR | ||
| 36 | #undef UHFNUM | ||
| 37 | #undef UHFNUML | ||
| 38 | #undef UHFNUMH | ||
| 39 | #undef UHFLEN | ||
| 40 | #undef UPINRQX | ||
| 41 | #undef UPINTX | ||
| 42 | #undef UPNUM | ||
| 43 | #undef UPRST | ||
| 44 | #undef UPCONX | ||
| 45 | #undef UPCFG0X | ||
| 46 | #undef UPCFG1X | ||
| 47 | #undef UPSTAX | ||
| 48 | #undef UPCFG2X | ||
| 49 | #undef UPIENX | ||
| 50 | #undef UPDATX | ||
| 51 | #undef TCCR2A | ||
| 52 | #undef WGM20 | ||
| 53 | #undef WGM21 | ||
| 54 | #undef COM2B0 | ||
| 55 | #undef COM2B1 | ||
| 56 | #undef COM2A0 | ||
| 57 | #undef COM2A1 | ||
| 58 | #undef TCCR2B | ||
| 59 | #undef CS20 | ||
| 60 | #undef CS21 | ||
| 61 | #undef CS22 | ||
| 62 | #undef WGM22 | ||
| 63 | #undef FOC2B | ||
| 64 | #undef FOC2A | ||
| 65 | #undef TCNT2 | ||
| 66 | #undef TCNT2_0 | ||
| 67 | #undef TCNT2_1 | ||
| 68 | #undef TCNT2_2 | ||
| 69 | #undef TCNT2_3 | ||
| 70 | #undef TCNT2_4 | ||
| 71 | #undef TCNT2_5 | ||
| 72 | #undef TCNT2_6 | ||
| 73 | #undef TCNT2_7 | ||
| 74 | #undef OCR2A | ||
| 75 | #undef OCR2_0 | ||
| 76 | #undef OCR2_1 | ||
| 77 | #undef OCR2_2 | ||
| 78 | #undef OCR2_3 | ||
| 79 | #undef OCR2_4 | ||
| 80 | #undef OCR2_5 | ||
| 81 | #undef OCR2_6 | ||
| 82 | #undef OCR2_7 | ||
| 83 | #undef OCR2B | ||
| 84 | #undef OCR2_0 | ||
| 85 | #undef OCR2_1 | ||
| 86 | #undef OCR2_2 | ||
| 87 | #undef OCR2_3 | ||
| 88 | #undef OCR2_4 | ||
| 89 | #undef OCR2_5 | ||
| 90 | #undef OCR2_6 | ||
| 91 | #undef OCR2_7 | ||
| 92 | |||
| 93 | #define NUM_DIGITAL_PINS 30 | ||
| 94 | #define NUM_ANALOG_INPUTS 12 | ||
| 95 | |||
| 96 | #define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) | ||
| 97 | #define TXLED0 PORTD |= (1<<5) | ||
| 98 | #define TXLED1 PORTD &= ~(1<<5) | ||
| 99 | #define RXLED0 PORTB |= (1<<0) | ||
| 100 | #define RXLED1 PORTB &= ~(1<<0) | ||
| 101 | |||
| 102 | static const uint8_t SDA = 2; | ||
| 103 | static const uint8_t SCL = 3; | ||
| 104 | #define LED_BUILTIN 13 | ||
| 105 | |||
| 106 | // Map SPI port to 'new' pins D14..D17 | ||
| 107 | static const uint8_t SS = 17; | ||
| 108 | static const uint8_t MOSI = 16; | ||
| 109 | static const uint8_t MISO = 14; | ||
| 110 | static const uint8_t SCK = 15; | ||
| 111 | |||
| 112 | // Mapping of analog pins as digital I/O | ||
| 113 | // A6-A11 share with digital pins | ||
| 114 | static const uint8_t ADC0 = 18; | ||
| 115 | static const uint8_t ADC1 = 19; | ||
| 116 | static const uint8_t ADC2 = 20; | ||
| 117 | static const uint8_t ADC3 = 21; | ||
| 118 | static const uint8_t ADC4 = 22; | ||
| 119 | static const uint8_t ADC5 = 23; | ||
| 120 | static const uint8_t ADC6 = 24; // D4 | ||
| 121 | static const uint8_t ADC7 = 25; // D6 | ||
| 122 | static const uint8_t ADC8 = 26; // D8 | ||
| 123 | static const uint8_t ADC9 = 27; // D9 | ||
| 124 | static const uint8_t ADC10 = 28; // D10 | ||
| 125 | static const uint8_t ADC11 = 29; // D12 | ||
| 126 | |||
| 127 | #define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) | ||
| 128 | #define digitalPinToPCICRbit(p) 0 | ||
| 129 | #define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) | ||
| 130 | #define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) | ||
| 131 | |||
| 132 | // __AVR_ATmega32U4__ has an unusual mapping of pins to channels | ||
| 133 | extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; | ||
| 134 | #define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) | ||
| 135 | |||
| 136 | #define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) | ||
| 137 | |||
| 138 | #ifdef ARDUINO_MAIN | ||
| 139 | |||
| 140 | // On the Arduino board, digital pins are also used | ||
| 141 | // for the analog output (software PWM). Analog input | ||
| 142 | // pins are a separate set. | ||
| 143 | |||
| 144 | // ATMEL ATMEGA32U4 / ARDUINO LEONARDO | ||
| 145 | // | ||
| 146 | // D0 PD2 RXD1/INT2 | ||
| 147 | // D1 PD3 TXD1/INT3 | ||
| 148 | // D2 PD1 SDA SDA/INT1 | ||
| 149 | // D3# PD0 PWM8/SCL OC0B/SCL/INT0 | ||
| 150 | // D4 A6 PD4 ADC8 | ||
| 151 | // D5# PC6 ??? OC3A/#OC4A | ||
| 152 | // D6# A7 PD7 FastPWM #OC4D/ADC10 | ||
| 153 | // D7 PE6 INT6/AIN0 | ||
| 154 | // | ||
| 155 | // D8 A8 PB4 ADC11/PCINT4 | ||
| 156 | // D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5 | ||
| 157 | // D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6 | ||
| 158 | // D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7 | ||
| 159 | // D12 A11 PD6 T1/#OC4D/ADC9 | ||
| 160 | // D13# PC7 PWM10 CLK0/OC4A | ||
| 161 | // | ||
| 162 | // A0 D18 PF7 ADC7 | ||
| 163 | // A1 D19 PF6 ADC6 | ||
| 164 | // A2 D20 PF5 ADC5 | ||
| 165 | // A3 D21 PF4 ADC4 | ||
| 166 | // A4 D22 PF1 ADC1 | ||
| 167 | // A5 D23 PF0 ADC0 | ||
| 168 | // | ||
| 169 | // New pins D14..D17 to map SPI port to digital pins | ||
| 170 | // | ||
| 171 | // MISO D14 PB3 MISO,PCINT3 | ||
| 172 | // SCK D15 PB1 SCK,PCINT1 | ||
| 173 | // MOSI D16 PB2 MOSI,PCINT2 | ||
| 174 | // SS D17 PB0 RXLED,SS/PCINT0 | ||
| 175 | // | ||
| 176 | // Connected LEDs on board for TX and RX | ||
| 177 | // TXLED D24 PD5 XCK1 | ||
| 178 | // RXLED D17 PB0 | ||
| 179 | // HWB PE2 HWB | ||
| 180 | |||
| 181 | // these arrays map port names (e.g. port B) to the | ||
| 182 | // appropriate addresses for various functions (e.g. reading | ||
| 183 | // and writing) | ||
| 184 | const uint16_t PROGMEM port_to_mode_PGM[] = { | ||
| 185 | NOT_A_PORT, | ||
| 186 | NOT_A_PORT, | ||
| 187 | (uint16_t) &DDRB, | ||
| 188 | (uint16_t) &DDRC, | ||
| 189 | (uint16_t) &DDRD, | ||
| 190 | (uint16_t) &DDRE, | ||
| 191 | (uint16_t) &DDRF, | ||
| 192 | }; | ||
| 193 | |||
| 194 | const uint16_t PROGMEM port_to_output_PGM[] = { | ||
| 195 | NOT_A_PORT, | ||
| 196 | NOT_A_PORT, | ||
| 197 | (uint16_t) &PORTB, | ||
| 198 | (uint16_t) &PORTC, | ||
| 199 | (uint16_t) &PORTD, | ||
| 200 | (uint16_t) &PORTE, | ||
| 201 | (uint16_t) &PORTF, | ||
| 202 | }; | ||
| 203 | |||
| 204 | const uint16_t PROGMEM port_to_input_PGM[] = { | ||
| 205 | NOT_A_PORT, | ||
| 206 | NOT_A_PORT, | ||
| 207 | (uint16_t) &PINB, | ||
| 208 | (uint16_t) &PINC, | ||
| 209 | (uint16_t) &PIND, | ||
| 210 | (uint16_t) &PINE, | ||
| 211 | (uint16_t) &PINF, | ||
| 212 | }; | ||
| 213 | |||
| 214 | const uint8_t PROGMEM digital_pin_to_port_PGM[] = { | ||
| 215 | PD, // D0 - PD2 | ||
| 216 | PD, // D1 - PD3 | ||
| 217 | PD, // D2 - PD1 | ||
| 218 | PD, // D3 - PD0 | ||
| 219 | PD, // D4 - PD4 | ||
| 220 | PC, // D5 - PC6 | ||
| 221 | PD, // D6 - PD7 | ||
| 222 | PE, // D7 - PE6 | ||
| 223 | |||
| 224 | PB, // D8 - PB4 | ||
| 225 | PB, // D9 - PB5 | ||
| 226 | PB, // D10 - PB6 | ||
| 227 | PB, // D11 - PB7 | ||
| 228 | PD, // D12 - PD6 | ||
| 229 | PC, // D13 - PC7 | ||
| 230 | |||
| 231 | PB, // D14 - MISO - PB3 | ||
| 232 | PB, // D15 - SCK - PB1 | ||
| 233 | PB, // D16 - MOSI - PB2 | ||
| 234 | PB, // D17 - SS - PB0 | ||
| 235 | |||
| 236 | PF, // D18 - A0 - PF7 | ||
| 237 | PF, // D19 - A1 - PF6 | ||
| 238 | PF, // D20 - A2 - PF5 | ||
| 239 | PF, // D21 - A3 - PF4 | ||
| 240 | PF, // D22 - A4 - PF1 | ||
| 241 | PF, // D23 - A5 - PF0 | ||
| 242 | |||
| 243 | PD, // D24 - PD5 | ||
| 244 | PD, // D25 / D6 - A7 - PD7 | ||
| 245 | PB, // D26 / D8 - A8 - PB4 | ||
| 246 | PB, // D27 / D9 - A9 - PB5 | ||
| 247 | PB, // D28 / D10 - A10 - PB6 | ||
| 248 | PD, // D29 / D12 - A11 - PD6 | ||
| 249 | }; | ||
| 250 | |||
| 251 | const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { | ||
| 252 | _BV(2), // D0 - PD2 | ||
| 253 | _BV(3), // D1 - PD3 | ||
| 254 | _BV(1), // D2 - PD1 | ||
| 255 | _BV(0), // D3 - PD0 | ||
| 256 | _BV(4), // D4 - PD4 | ||
| 257 | _BV(6), // D5 - PC6 | ||
| 258 | _BV(7), // D6 - PD7 | ||
| 259 | _BV(6), // D7 - PE6 | ||
| 260 | |||
| 261 | _BV(4), // D8 - PB4 | ||
| 262 | _BV(5), // D9 - PB5 | ||
| 263 | _BV(6), // D10 - PB6 | ||
| 264 | _BV(7), // D11 - PB7 | ||
| 265 | _BV(6), // D12 - PD6 | ||
| 266 | _BV(7), // D13 - PC7 | ||
| 267 | |||
| 268 | _BV(3), // D14 - MISO - PB3 | ||
| 269 | _BV(1), // D15 - SCK - PB1 | ||
| 270 | _BV(2), // D16 - MOSI - PB2 | ||
| 271 | _BV(0), // D17 - SS - PB0 | ||
| 272 | |||
| 273 | _BV(7), // D18 - A0 - PF7 | ||
| 274 | _BV(6), // D19 - A1 - PF6 | ||
| 275 | _BV(5), // D20 - A2 - PF5 | ||
| 276 | _BV(4), // D21 - A3 - PF4 | ||
| 277 | _BV(1), // D22 - A4 - PF1 | ||
| 278 | _BV(0), // D23 - A5 - PF0 | ||
| 279 | |||
| 280 | _BV(5), // D24 - PD5 | ||
| 281 | _BV(7), // D25 / D6 - A7 - PD7 | ||
| 282 | _BV(4), // D26 / D8 - A8 - PB4 | ||
| 283 | _BV(5), // D27 / D9 - A9 - PB5 | ||
| 284 | _BV(6), // D28 / D10 - A10 - PB6 | ||
| 285 | _BV(6), // D29 / D12 - A11 - PD6 | ||
| 286 | }; | ||
| 287 | |||
| 288 | const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { | ||
| 289 | NOT_ON_TIMER, | ||
| 290 | NOT_ON_TIMER, | ||
| 291 | NOT_ON_TIMER, | ||
| 292 | TIMER0B, /* 3 */ | ||
| 293 | NOT_ON_TIMER, | ||
| 294 | TIMER3A, /* 5 */ | ||
| 295 | TIMER4D, /* 6 */ | ||
| 296 | NOT_ON_TIMER, | ||
| 297 | |||
| 298 | NOT_ON_TIMER, | ||
| 299 | TIMER1A, /* 9 */ | ||
| 300 | TIMER1B, /* 10 */ | ||
| 301 | TIMER0A, /* 11 */ | ||
| 302 | |||
| 303 | NOT_ON_TIMER, | ||
| 304 | TIMER4A, /* 13 */ | ||
| 305 | |||
| 306 | NOT_ON_TIMER, | ||
| 307 | NOT_ON_TIMER, | ||
| 308 | NOT_ON_TIMER, | ||
| 309 | NOT_ON_TIMER, | ||
| 310 | NOT_ON_TIMER, | ||
| 311 | NOT_ON_TIMER, | ||
| 312 | |||
| 313 | NOT_ON_TIMER, | ||
| 314 | NOT_ON_TIMER, | ||
| 315 | NOT_ON_TIMER, | ||
| 316 | NOT_ON_TIMER, | ||
| 317 | NOT_ON_TIMER, | ||
| 318 | NOT_ON_TIMER, | ||
| 319 | NOT_ON_TIMER, | ||
| 320 | NOT_ON_TIMER, | ||
| 321 | NOT_ON_TIMER, | ||
| 322 | NOT_ON_TIMER, | ||
| 323 | }; | ||
| 324 | |||
| 325 | const uint8_t PROGMEM analog_pin_to_channel_PGM[] = { | ||
| 326 | 7, // A0 PF7 ADC7 | ||
| 327 | 6, // A1 PF6 ADC6 | ||
| 328 | 5, // A2 PF5 ADC5 | ||
| 329 | 4, // A3 PF4 ADC4 | ||
| 330 | 1, // A4 PF1 ADC1 | ||
| 331 | 0, // A5 PF0 ADC0 | ||
| 332 | 8, // A6 D4 PD4 ADC8 | ||
| 333 | 10, // A7 D6 PD7 ADC10 | ||
| 334 | 11, // A8 D8 PB4 ADC11 | ||
| 335 | 12, // A9 D9 PB5 ADC12 | ||
| 336 | 13, // A10 D10 PB6 ADC13 | ||
| 337 | 9 // A11 D12 PD6 ADC9 | ||
| 338 | }; | ||
| 339 | |||
| 340 | #endif /* ARDUINO_MAIN */ | ||
| 341 | |||
| 342 | // These serial port names are intended to allow libraries and architecture-neutral | ||
| 343 | // sketches to automatically default to the correct port name for a particular type | ||
| 344 | // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, | ||
| 345 | // the first hardware serial port whose RX/TX pins are not dedicated to another use. | ||
| 346 | // | ||
| 347 | // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor | ||
| 348 | // | ||
| 349 | // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial | ||
| 350 | // | ||
| 351 | // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library | ||
| 352 | // | ||
| 353 | // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. | ||
| 354 | // | ||
| 355 | // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX | ||
| 356 | // pins are NOT connected to anything by default. | ||
| 357 | #define SERIAL_PORT_MONITOR Serial | ||
| 358 | #define SERIAL_PORT_USBVIRTUAL Serial | ||
| 359 | #define SERIAL_PORT_HARDWARE Serial1 | ||
| 360 | #define SERIAL_PORT_HARDWARE_OPEN Serial1 | ||
| 361 | |||
| 362 | #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 @@ | |||
| 1 | /* | ||
| 2 | pins_arduino.h - Pin definition functions for Arduino | ||
| 3 | Part of Arduino - http://www.arduino.cc/ | ||
| 4 | |||
| 5 | Copyright (c) 2007 David A. Mellis | ||
| 6 | |||
| 7 | This library is free software; you can redistribute it and/or | ||
| 8 | modify it under the terms of the GNU Lesser General Public | ||
| 9 | License as published by the Free Software Foundation; either | ||
| 10 | version 2.1 of the License, or (at your option) any later version. | ||
| 11 | |||
| 12 | This library is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | Lesser General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU Lesser General | ||
| 18 | Public License along with this library; if not, write to the | ||
| 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, | ||
| 20 | Boston, MA 02111-1307 USA | ||
| 21 | |||
| 22 | $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ | ||
| 23 | */ | ||
| 24 | |||
| 25 | #ifndef Pins_Arduino_h | ||
| 26 | #define Pins_Arduino_h | ||
| 27 | |||
| 28 | #include <avr/pgmspace.h> | ||
| 29 | |||
| 30 | // Workaround for wrong definitions in "iom32u4.h". | ||
| 31 | // This should be fixed in the AVR toolchain. | ||
| 32 | #undef UHCON | ||
| 33 | #undef UHINT | ||
| 34 | #undef UHIEN | ||
| 35 | #undef UHADDR | ||
| 36 | #undef UHFNUM | ||
| 37 | #undef UHFNUML | ||
| 38 | #undef UHFNUMH | ||
| 39 | #undef UHFLEN | ||
| 40 | #undef UPINRQX | ||
| 41 | #undef UPINTX | ||
| 42 | #undef UPNUM | ||
| 43 | #undef UPRST | ||
| 44 | #undef UPCONX | ||
| 45 | #undef UPCFG0X | ||
| 46 | #undef UPCFG1X | ||
| 47 | #undef UPSTAX | ||
| 48 | #undef UPCFG2X | ||
| 49 | #undef UPIENX | ||
| 50 | #undef UPDATX | ||
| 51 | #undef TCCR2A | ||
| 52 | #undef WGM20 | ||
| 53 | #undef WGM21 | ||
| 54 | #undef COM2B0 | ||
| 55 | #undef COM2B1 | ||
| 56 | #undef COM2A0 | ||
| 57 | #undef COM2A1 | ||
| 58 | #undef TCCR2B | ||
| 59 | #undef CS20 | ||
| 60 | #undef CS21 | ||
| 61 | #undef CS22 | ||
| 62 | #undef WGM22 | ||
| 63 | #undef FOC2B | ||
| 64 | #undef FOC2A | ||
| 65 | #undef TCNT2 | ||
| 66 | #undef TCNT2_0 | ||
| 67 | #undef TCNT2_1 | ||
| 68 | #undef TCNT2_2 | ||
| 69 | #undef TCNT2_3 | ||
| 70 | #undef TCNT2_4 | ||
| 71 | #undef TCNT2_5 | ||
| 72 | #undef TCNT2_6 | ||
| 73 | #undef TCNT2_7 | ||
| 74 | #undef OCR2A | ||
| 75 | #undef OCR2_0 | ||
| 76 | #undef OCR2_1 | ||
| 77 | #undef OCR2_2 | ||
| 78 | #undef OCR2_3 | ||
| 79 | #undef OCR2_4 | ||
| 80 | #undef OCR2_5 | ||
| 81 | #undef OCR2_6 | ||
| 82 | #undef OCR2_7 | ||
| 83 | #undef OCR2B | ||
| 84 | #undef OCR2_0 | ||
| 85 | #undef OCR2_1 | ||
| 86 | #undef OCR2_2 | ||
| 87 | #undef OCR2_3 | ||
| 88 | #undef OCR2_4 | ||
| 89 | #undef OCR2_5 | ||
| 90 | #undef OCR2_6 | ||
| 91 | #undef OCR2_7 | ||
| 92 | |||
| 93 | #define NUM_DIGITAL_PINS 30 | ||
| 94 | #define NUM_ANALOG_INPUTS 12 | ||
| 95 | |||
| 96 | #define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) | ||
| 97 | #define TXLED0 PORTD |= (1<<5) | ||
| 98 | #define TXLED1 PORTD &= ~(1<<5) | ||
| 99 | #define RXLED0 PORTB |= (1<<0) | ||
| 100 | #define RXLED1 PORTB &= ~(1<<0) | ||
| 101 | |||
| 102 | static const uint8_t SDA = 2; | ||
| 103 | static const uint8_t SCL = 3; | ||
| 104 | #define LED_BUILTIN 13 | ||
| 105 | |||
| 106 | // Map SPI port to 'new' pins D14..D17 | ||
| 107 | static const uint8_t SS = 17; | ||
| 108 | static const uint8_t MOSI = 16; | ||
| 109 | static const uint8_t MISO = 14; | ||
| 110 | static const uint8_t SCK = 15; | ||
| 111 | |||
| 112 | // Mapping of analog pins as digital I/O | ||
| 113 | // A6-A11 share with digital pins | ||
| 114 | static const uint8_t ADC0 = 18; | ||
| 115 | static const uint8_t ADC1 = 19; | ||
| 116 | static const uint8_t ADC2 = 20; | ||
| 117 | static const uint8_t ADC3 = 21; | ||
| 118 | static const uint8_t ADC4 = 22; | ||
| 119 | static const uint8_t ADC5 = 23; | ||
| 120 | static const uint8_t ADC6 = 24; // D4 | ||
| 121 | static const uint8_t ADC7 = 25; // D6 | ||
| 122 | static const uint8_t ADC8 = 26; // D8 | ||
| 123 | static const uint8_t ADC9 = 27; // D9 | ||
| 124 | static const uint8_t ADC10 = 28; // D10 | ||
| 125 | static const uint8_t ADC11 = 29; // D12 | ||
| 126 | |||
| 127 | #define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) | ||
| 128 | #define digitalPinToPCICRbit(p) 0 | ||
| 129 | #define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) | ||
| 130 | #define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) | ||
| 131 | |||
| 132 | // __AVR_ATmega32U4__ has an unusual mapping of pins to channels | ||
| 133 | extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; | ||
| 134 | #define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) | ||
| 135 | |||
| 136 | #define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) | ||
| 137 | |||
| 138 | #ifdef ARDUINO_MAIN | ||
| 139 | |||
| 140 | // On the Arduino board, digital pins are also used | ||
| 141 | // for the analog output (software PWM). Analog input | ||
| 142 | // pins are a separate set. | ||
| 143 | |||
| 144 | // ATMEL ATMEGA32U4 / ARDUINO LEONARDO | ||
| 145 | // | ||
| 146 | // D0 PD2 RXD1/INT2 | ||
| 147 | // D1 PD3 TXD1/INT3 | ||
| 148 | // D2 PD1 SDA SDA/INT1 | ||
| 149 | // D3# PD0 PWM8/SCL OC0B/SCL/INT0 | ||
| 150 | // D4 A6 PD4 ADC8 | ||
| 151 | // D5# PC6 ??? OC3A/#OC4A | ||
| 152 | // D6# A7 PD7 FastPWM #OC4D/ADC10 | ||
| 153 | // D7 PE6 INT6/AIN0 | ||
| 154 | // | ||
| 155 | // D8 A8 PB4 ADC11/PCINT4 | ||
| 156 | // D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5 | ||
| 157 | // D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6 | ||
| 158 | // D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7 | ||
| 159 | // D12 A11 PD6 T1/#OC4D/ADC9 | ||
| 160 | // D13# PC7 PWM10 CLK0/OC4A | ||
| 161 | // | ||
| 162 | // A0 D18 PF7 ADC7 | ||
| 163 | // A1 D19 PF6 ADC6 | ||
| 164 | // A2 D20 PF5 ADC5 | ||
| 165 | // A3 D21 PF4 ADC4 | ||
| 166 | // A4 D22 PF1 ADC1 | ||
| 167 | // A5 D23 PF0 ADC0 | ||
| 168 | // | ||
| 169 | // New pins D14..D17 to map SPI port to digital pins | ||
| 170 | // | ||
| 171 | // MISO D14 PB3 MISO,PCINT3 | ||
| 172 | // SCK D15 PB1 SCK,PCINT1 | ||
| 173 | // MOSI D16 PB2 MOSI,PCINT2 | ||
| 174 | // SS D17 PB0 RXLED,SS/PCINT0 | ||
| 175 | // | ||
| 176 | // Connected LEDs on board for TX and RX | ||
| 177 | // TXLED D24 PD5 XCK1 | ||
| 178 | // RXLED D17 PB0 | ||
| 179 | // HWB PE2 HWB | ||
| 180 | |||
| 181 | // these arrays map port names (e.g. port B) to the | ||
| 182 | // appropriate addresses for various functions (e.g. reading | ||
| 183 | // and writing) | ||
| 184 | const uint16_t PROGMEM port_to_mode_PGM[] = { | ||
| 185 | NOT_A_PORT, | ||
| 186 | NOT_A_PORT, | ||
| 187 | (uint16_t) &DDRB, | ||
| 188 | (uint16_t) &DDRC, | ||
| 189 | (uint16_t) &DDRD, | ||
| 190 | (uint16_t) &DDRE, | ||
| 191 | (uint16_t) &DDRF, | ||
| 192 | }; | ||
| 193 | |||
| 194 | const uint16_t PROGMEM port_to_output_PGM[] = { | ||
| 195 | NOT_A_PORT, | ||
| 196 | NOT_A_PORT, | ||
| 197 | (uint16_t) &PORTB, | ||
| 198 | (uint16_t) &PORTC, | ||
| 199 | (uint16_t) &PORTD, | ||
| 200 | (uint16_t) &PORTE, | ||
| 201 | (uint16_t) &PORTF, | ||
| 202 | }; | ||
| 203 | |||
| 204 | const uint16_t PROGMEM port_to_input_PGM[] = { | ||
| 205 | NOT_A_PORT, | ||
| 206 | NOT_A_PORT, | ||
| 207 | (uint16_t) &PINB, | ||
| 208 | (uint16_t) &PINC, | ||
| 209 | (uint16_t) &PIND, | ||
| 210 | (uint16_t) &PINE, | ||
| 211 | (uint16_t) &PINF, | ||
| 212 | }; | ||
| 213 | |||
| 214 | const uint8_t PROGMEM digital_pin_to_port_PGM[] = { | ||
| 215 | PD, // D0 - PD2 | ||
| 216 | PD, // D1 - PD3 | ||
| 217 | PD, // D2 - PD1 | ||
| 218 | PD, // D3 - PD0 | ||
| 219 | PD, // D4 - PD4 | ||
| 220 | PC, // D5 - PC6 | ||
| 221 | PD, // D6 - PD7 | ||
| 222 | PE, // D7 - PE6 | ||
| 223 | |||
| 224 | PB, // D8 - PB4 | ||
| 225 | PB, // D9 - PB5 | ||
| 226 | PB, // D10 - PB6 | ||
| 227 | PB, // D11 - PB7 | ||
| 228 | PD, // D12 - PD6 | ||
| 229 | PC, // D13 - PC7 | ||
| 230 | |||
| 231 | PB, // D14 - MISO - PB3 | ||
| 232 | PB, // D15 - SCK - PB1 | ||
| 233 | PB, // D16 - MOSI - PB2 | ||
| 234 | PB, // D17 - SS - PB0 | ||
| 235 | |||
| 236 | PF, // D18 - A0 - PF7 | ||
| 237 | PF, // D19 - A1 - PF6 | ||
| 238 | PF, // D20 - A2 - PF5 | ||
| 239 | PF, // D21 - A3 - PF4 | ||
| 240 | PF, // D22 - A4 - PF1 | ||
| 241 | PF, // D23 - A5 - PF0 | ||
| 242 | |||
| 243 | PD, // D24 - PD5 | ||
| 244 | PD, // D25 / D6 - A7 - PD7 | ||
| 245 | PB, // D26 / D8 - A8 - PB4 | ||
| 246 | PB, // D27 / D9 - A9 - PB5 | ||
| 247 | PB, // D28 / D10 - A10 - PB6 | ||
| 248 | PD, // D29 / D12 - A11 - PD6 | ||
| 249 | }; | ||
| 250 | |||
| 251 | const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { | ||
| 252 | _BV(2), // D0 - PD2 | ||
| 253 | _BV(3), // D1 - PD3 | ||
| 254 | _BV(1), // D2 - PD1 | ||
| 255 | _BV(0), // D3 - PD0 | ||
| 256 | _BV(4), // D4 - PD4 | ||
| 257 | _BV(6), // D5 - PC6 | ||
| 258 | _BV(7), // D6 - PD7 | ||
| 259 | _BV(6), // D7 - PE6 | ||
| 260 | |||
| 261 | _BV(4), // D8 - PB4 | ||
| 262 | _BV(5), // D9 - PB5 | ||
| 263 | _BV(6), // D10 - PB6 | ||
| 264 | _BV(7), // D11 - PB7 | ||
| 265 | _BV(6), // D12 - PD6 | ||
| 266 | _BV(7), // D13 - PC7 | ||
| 267 | |||
| 268 | _BV(3), // D14 - MISO - PB3 | ||
| 269 | _BV(1), // D15 - SCK - PB1 | ||
| 270 | _BV(2), // D16 - MOSI - PB2 | ||
| 271 | _BV(0), // D17 - SS - PB0 | ||
| 272 | |||
| 273 | _BV(7), // D18 - A0 - PF7 | ||
| 274 | _BV(6), // D19 - A1 - PF6 | ||
| 275 | _BV(5), // D20 - A2 - PF5 | ||
| 276 | _BV(4), // D21 - A3 - PF4 | ||
| 277 | _BV(1), // D22 - A4 - PF1 | ||
| 278 | _BV(0), // D23 - A5 - PF0 | ||
| 279 | |||
| 280 | _BV(5), // D24 - PD5 | ||
| 281 | _BV(7), // D25 / D6 - A7 - PD7 | ||
| 282 | _BV(4), // D26 / D8 - A8 - PB4 | ||
| 283 | _BV(5), // D27 / D9 - A9 - PB5 | ||
| 284 | _BV(6), // D28 / D10 - A10 - PB6 | ||
| 285 | _BV(6), // D29 / D12 - A11 - PD6 | ||
| 286 | }; | ||
| 287 | |||
| 288 | const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { | ||
| 289 | NOT_ON_TIMER, | ||
| 290 | NOT_ON_TIMER, | ||
| 291 | NOT_ON_TIMER, | ||
| 292 | TIMER0B, /* 3 */ | ||
| 293 | NOT_ON_TIMER, | ||
| 294 | TIMER3A, /* 5 */ | ||
| 295 | TIMER4D, /* 6 */ | ||
| 296 | NOT_ON_TIMER, | ||
| 297 | |||
| 298 | NOT_ON_TIMER, | ||
| 299 | TIMER1A, /* 9 */ | ||
| 300 | TIMER1B, /* 10 */ | ||
| 301 | TIMER0A, /* 11 */ | ||
| 302 | |||
| 303 | NOT_ON_TIMER, | ||
| 304 | TIMER4A, /* 13 */ | ||
| 305 | |||
| 306 | NOT_ON_TIMER, | ||
| 307 | NOT_ON_TIMER, | ||
| 308 | NOT_ON_TIMER, | ||
| 309 | NOT_ON_TIMER, | ||
| 310 | NOT_ON_TIMER, | ||
| 311 | NOT_ON_TIMER, | ||
| 312 | |||
| 313 | NOT_ON_TIMER, | ||
| 314 | NOT_ON_TIMER, | ||
| 315 | NOT_ON_TIMER, | ||
| 316 | NOT_ON_TIMER, | ||
| 317 | NOT_ON_TIMER, | ||
| 318 | NOT_ON_TIMER, | ||
| 319 | NOT_ON_TIMER, | ||
| 320 | NOT_ON_TIMER, | ||
| 321 | NOT_ON_TIMER, | ||
| 322 | NOT_ON_TIMER, | ||
| 323 | }; | ||
| 324 | |||
| 325 | const uint8_t PROGMEM analog_pin_to_channel_PGM[] = { | ||
| 326 | 7, // A0 PF7 ADC7 | ||
| 327 | 6, // A1 PF6 ADC6 | ||
| 328 | 5, // A2 PF5 ADC5 | ||
| 329 | 4, // A3 PF4 ADC4 | ||
| 330 | 1, // A4 PF1 ADC1 | ||
| 331 | 0, // A5 PF0 ADC0 | ||
| 332 | 8, // A6 D4 PD4 ADC8 | ||
| 333 | 10, // A7 D6 PD7 ADC10 | ||
| 334 | 11, // A8 D8 PB4 ADC11 | ||
| 335 | 12, // A9 D9 PB5 ADC12 | ||
| 336 | 13, // A10 D10 PB6 ADC13 | ||
| 337 | 9 // A11 D12 PD6 ADC9 | ||
| 338 | }; | ||
| 339 | |||
| 340 | #endif /* ARDUINO_MAIN */ | ||
| 341 | |||
| 342 | // These serial port names are intended to allow libraries and architecture-neutral | ||
| 343 | // sketches to automatically default to the correct port name for a particular type | ||
| 344 | // of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, | ||
| 345 | // the first hardware serial port whose RX/TX pins are not dedicated to another use. | ||
| 346 | // | ||
| 347 | // SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor | ||
| 348 | // | ||
| 349 | // SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial | ||
| 350 | // | ||
| 351 | // SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library | ||
| 352 | // | ||
| 353 | // SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. | ||
| 354 | // | ||
| 355 | // SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX | ||
| 356 | // pins are NOT connected to anything by default. | ||
| 357 | #define SERIAL_PORT_MONITOR Serial | ||
| 358 | #define SERIAL_PORT_USBVIRTUAL Serial | ||
| 359 | #define SERIAL_PORT_HARDWARE Serial1 | ||
| 360 | #define SERIAL_PORT_HARDWARE_OPEN Serial1 | ||
| 361 | |||
| 362 | #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 @@ | |||
| 1 | #ifndef SSD1306_H | ||
| 2 | #define SSD1306_H | ||
| 3 | |||
| 4 | #include <stdbool.h> | ||
| 5 | #include <stdio.h> | ||
| 6 | |||
| 7 | bool iota_gfx_init(void); | ||
| 8 | void iota_gfx_task(void); | ||
| 9 | bool iota_gfx_off(void); | ||
| 10 | bool iota_gfx_on(void); | ||
| 11 | void iota_gfx_flush(void); | ||
| 12 | void iota_gfx_write_char(uint8_t c); | ||
| 13 | void iota_gfx_write(const char *data); | ||
| 14 | void iota_gfx_write_P(const char *data); | ||
| 15 | void iota_gfx_clear_screen(void); | ||
| 16 | |||
| 17 | #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 @@ | |||
| 1 | #include "../../config.h" | ||
| 2 | |||
| 3 | #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 @@ | |||
| 5 | #include "command.h" | 5 | #include "command.h" |
| 6 | 6 | ||
| 7 | #define _MA 0 | 7 | #define _MA 0 |
| 8 | #define _FL 1 | 8 | #define _GA 1 |
| 9 | #define _AR 2 | 9 | #define _FL 2 |
| 10 | #define _LO 3 | 10 | #define _AR 3 |
| 11 | #define _UL 4 | 11 | #define _LO 4 |
| 12 | #define _UL 5 | ||
| 12 | 13 | ||
| 13 | #define TRNS KC_TRNS | 14 | #define TRNS KC_TRNS |
| 14 | #define trigger_time 400 | 15 | #define trigger_time 400 |
| @@ -29,6 +30,15 @@ | |||
| 29 | #define LSHIFT OSM(MOD_LSFT) | 30 | #define LSHIFT OSM(MOD_LSFT) |
| 30 | #define SPACE LT(_AR, KC_SPC) | 31 | #define SPACE LT(_AR, KC_SPC) |
| 31 | 32 | ||
| 33 | #define MACRO_BREATH_TOGGLE 13 | ||
| 34 | #define MACRO_BREATH_SPEED_INC 14 | ||
| 35 | #define MACRO_BREATH_SPEED_DEC 15 | ||
| 36 | #define MACRO_BREATH_DEFAULT 16 | ||
| 37 | #define M_BRTOG M(MACRO_BREATH_TOGGLE) | ||
| 38 | #define M_BSPDU M(MACRO_BREATH_SPEED_INC) | ||
| 39 | #define M_BSPDD M(MACRO_BREATH_SPEED_DEC) | ||
| 40 | #define M_BDFLT M(MACRO_BREATH_DEFAULT) | ||
| 41 | |||
| 32 | static uint16_t key_timer; | 42 | static uint16_t key_timer; |
| 33 | 43 | ||
| 34 | enum emoticons { | 44 | enum emoticons { |
| @@ -57,28 +67,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 57 | 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, \ | 67 | 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, \ |
| 58 | 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, \ | 68 | 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, \ |
| 59 | KC_LCTL, KC_LGUI, KC_LALT, SPACE, KC_RALT, KC_RCTRL, MO(_FL), KC_LEFT, KC_DOWN, KC_RGHT), | 69 | KC_LCTL, KC_LGUI, KC_LALT, SPACE, KC_RALT, KC_RCTRL, MO(_FL), KC_LEFT, KC_DOWN, KC_RGHT), |
| 60 | 70 | ||
| 61 | /* Keymap _FL: Function Layer | 71 | /* Keymap _FL: Function Layer |
| 62 | * ,----------------------------------------------------------------. | 72 | * ,----------------------------------------------------------------. |
| 63 | * |~` | F1|F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12| |Prsc| | 73 | * |~` | F1|F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Reset |Prsc| |
| 64 | * |----------------------------------------------------------------| | 74 | * |----------------------------------------------------------------| |
| 65 | * | |MbL|MsU|MbR| | | | | | | | | | |_LO | | 75 | * | |MbL|MsU|MbR| | | | | | | | | | |_LO | |
| 66 | * |----------------------------------------------------------------| | 76 | * |----------------------------------------------------------------| |
| 67 | * | |MsL|MsD|MsR| | | | | | | | | |Hme | | 77 | * | |MsL|MsD|MsR| |_GA| | | | | | | |Hme | |
| 68 | * |----------------------------------------------------------------| | 78 | * |----------------------------------------------------------------| |
| 69 | * | | | | | | | | | |VoU|VoD|Mut| |MwU|End | | 79 | * | | |BL-|BL+|BL |BR-|BR+|BR | |VoU|VoD|Mut| |MwU|End | |
| 70 | * |----------------------------------------------------------------| | 80 | * |----------------------------------------------------------------| |
| 71 | * | | | | | | | |MwL|MwD|MwR | | 81 | * | | | | | | | |MwL|MwD|MwR | |
| 72 | * `----------------------------------------------------------------' | 82 | * `----------------------------------------------------------------' |
| 73 | */ | 83 | */ |
| 74 | [_FL] = KEYMAP_ANSI( | 84 | [_FL] = KEYMAP_ANSI( |
| 75 | 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, \ | 85 | 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, \ |
| 76 | TRNS, KC_BTN1, KC_MS_U, KC_BTN2, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TO(_LO), \ | 86 | TRNS, KC_BTN1, KC_MS_U, KC_BTN2, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TO(_LO), \ |
| 77 | TRNS, KC_MS_L, KC_MS_D, KC_MS_R, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_HOME, \ | 87 | TRNS, KC_MS_L, KC_MS_D, KC_MS_R, TRNS, TG(_GA), TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_HOME, \ |
| 78 | TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_VOLD, KC_VOLU, KC_MUTE, TRNS, KC_WH_U, KC_END, \ | 88 | 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, \ |
| 79 | TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_WH_L, KC_WH_D, KC_WH_R), | 89 | TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_WH_L, KC_WH_D, KC_WH_R), |
| 80 | 90 | ||
| 81 | /* Keymap _UL: Unlock layer | 91 | /* Keymap _AR: Arrow layer |
| 82 | * ,----------------------------------------------------------------. | 92 | * ,----------------------------------------------------------------. |
| 83 | * | | | | | | | | | | | | | | | | | 93 | * | | | | | | | | | | | | | | | | |
| 84 | * |----------------------------------------------------------------| | 94 | * |----------------------------------------------------------------| |
| @@ -95,9 +105,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 95 | TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ | 105 | TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ |
| 96 | LENNY, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ | 106 | LENNY, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ |
| 97 | DWNHRT, TRNS, TRNS, TRNS, TRNS, TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, TRNS, TRNS, TRNS, TRNS, \ | 107 | DWNHRT, TRNS, TRNS, TRNS, TRNS, TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, TRNS, TRNS, TRNS, TRNS, \ |
| 98 | SHRUG, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ | 108 | SHRUG, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ |
| 99 | TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS), | 109 | TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS), |
| 100 | 110 | ||
| 111 | /* Keymap _GA: Game layer | ||
| 112 | * ,----------------------------------------------------------------. | ||
| 113 | * |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |P/P | | ||
| 114 | * |----------------------------------------------------------------| | ||
| 115 | * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |Del | | ||
| 116 | * |----------------------------------------------------------------| | ||
| 117 | * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return |PgUp| | ||
| 118 | * |----------------------------------------------------------------| | ||
| 119 | * |Shft|End| Z| X| C| V| B| N| M| ,| .| /|Shift | Up|PgDn| | ||
| 120 | * |----------------------------------------------------------------| | ||
| 121 | * |Ctrl|Win |Alt | Space |Alt|Ctrl| FN|Lef|Dow|Rig | | ||
| 122 | * `----------------------------------------------------------------' | ||
| 123 | */ | ||
| 124 | [_GA] = KEYMAP_ANSI( | ||
| 125 | KC_ESC, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, KC_BSPC, KC_MPLY, \ | ||
| 126 | 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, \ | ||
| 127 | 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, \ | ||
| 128 | 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, \ | ||
| 129 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTRL, MO(_FL), KC_LEFT, KC_DOWN, KC_RGHT), | ||
| 130 | |||
| 101 | /* Keymap _UL: Unlock layer | 131 | /* Keymap _UL: Unlock layer |
| 102 | * ,----------------------------------------------------------------. | 132 | * ,----------------------------------------------------------------. |
| 103 | * | | | | | | | | | | | | | | | | | 133 | * | | | | | | | | | | | | | | | | |
| @@ -378,6 +408,29 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { | |||
| 378 | } | 408 | } |
| 379 | } | 409 | } |
| 380 | break; | 410 | break; |
| 411 | case MACRO_BREATH_TOGGLE: | ||
| 412 | if (record->event.pressed) { | ||
| 413 | breathing_toggle(); | ||
| 414 | } | ||
| 415 | break; | ||
| 416 | |||
| 417 | case MACRO_BREATH_SPEED_INC: | ||
| 418 | if (record->event.pressed) { | ||
| 419 | breathing_speed_inc(1); | ||
| 420 | } | ||
| 421 | break; | ||
| 422 | |||
| 423 | case MACRO_BREATH_SPEED_DEC: | ||
| 424 | if (record->event.pressed) { | ||
| 425 | breathing_speed_dec(1); | ||
| 426 | } | ||
| 427 | break; | ||
| 428 | |||
| 429 | case MACRO_BREATH_DEFAULT: | ||
| 430 | if (record->event.pressed) { | ||
| 431 | breathing_defaults(); | ||
| 432 | } | ||
| 433 | break; | ||
| 381 | } | 434 | } |
| 382 | return MACRO_NONE; | 435 | return MACRO_NONE; |
| 383 | }; \ No newline at end of file | 436 | }; |
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 @@ | |||
| 1 | /* Copyright 2017 Fred Sundvik | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #if defined(VISUALIZER_ENABLE) | ||
| 18 | |||
| 19 | #include "animations.h" | ||
| 20 | #include "visualizer.h" | ||
| 21 | |||
| 22 | #ifdef BACKLIGHT_ENABLE | ||
| 23 | #include "led_keyframes.h" | ||
| 24 | #endif | ||
| 25 | |||
| 26 | #include "visualizer_keyframes.h" | ||
| 27 | |||
| 28 | |||
| 29 | #if defined(LCD_ENABLE) || defined(LCD_BACKLIGHT_ENABLE) || defined(BACKLIGHT_ENABLE) | ||
| 30 | |||
| 31 | static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 32 | #ifdef BACKLIGHT_ENABLE | ||
| 33 | led_keyframe_enable(animation, state); | ||
| 34 | #endif | ||
| 35 | return false; | ||
| 36 | } | ||
| 37 | |||
| 38 | static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 39 | #ifdef BACKLIGHT_ENABLE | ||
| 40 | led_keyframe_disable(animation, state); | ||
| 41 | #endif | ||
| 42 | return false; | ||
| 43 | } | ||
| 44 | |||
| 45 | static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 46 | bool ret = false; | ||
| 47 | #ifdef BACKLIGHT_ENABLE | ||
| 48 | ret |= led_keyframe_fade_in_all(animation, state); | ||
| 49 | #endif | ||
| 50 | return ret; | ||
| 51 | } | ||
| 52 | |||
| 53 | static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 54 | bool ret = false; | ||
| 55 | #ifdef BACKLIGHT_ENABLE | ||
| 56 | ret |= led_keyframe_fade_out_all(animation, state); | ||
| 57 | #endif | ||
| 58 | return ret; | ||
| 59 | } | ||
| 60 | |||
| 61 | |||
| 62 | // Don't worry, if the startup animation is long, you can use the keyboard like normal | ||
| 63 | // during that time | ||
| 64 | keyframe_animation_t default_startup_animation = { | ||
| 65 | .num_frames = 2, | ||
| 66 | .loop = false, | ||
| 67 | .frame_lengths = {0, gfxMillisecondsToTicks(5000)}, | ||
| 68 | .frame_functions = { | ||
| 69 | keyframe_enable, | ||
| 70 | keyframe_fade_in, | ||
| 71 | }, | ||
| 72 | }; | ||
| 73 | |||
| 74 | keyframe_animation_t default_suspend_animation = { | ||
| 75 | .num_frames = 2, | ||
| 76 | .loop = false, | ||
| 77 | .frame_lengths = {gfxMillisecondsToTicks(1000), 0}, | ||
| 78 | .frame_functions = { | ||
| 79 | keyframe_fade_out, | ||
| 80 | keyframe_disable, | ||
| 81 | }, | ||
| 82 | }; | ||
| 83 | #endif | ||
| 84 | |||
| 85 | #if defined(BACKLIGHT_ENABLE) | ||
| 86 | #define CROSSFADE_TIME 1000 | ||
| 87 | #define GRADIENT_TIME 3000 | ||
| 88 | |||
| 89 | keyframe_animation_t led_test_animation = { | ||
| 90 | .num_frames = 14, | ||
| 91 | .loop = true, | ||
| 92 | .frame_lengths = { | ||
| 93 | gfxMillisecondsToTicks(1000), // fade in | ||
| 94 | gfxMillisecondsToTicks(1000), // no op (leds on) | ||
| 95 | gfxMillisecondsToTicks(1000), // fade out | ||
| 96 | gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade | ||
| 97 | gfxMillisecondsToTicks(GRADIENT_TIME), // left to rigt (outside in) | ||
| 98 | gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade | ||
| 99 | gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom | ||
| 100 | 0, // mirror leds | ||
| 101 | gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade | ||
| 102 | gfxMillisecondsToTicks(GRADIENT_TIME), // left_to_right (mirrored, so inside out) | ||
| 103 | gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade | ||
| 104 | gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom | ||
| 105 | 0, // normal leds | ||
| 106 | gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade | ||
| 107 | |||
| 108 | }, | ||
| 109 | .frame_functions = { | ||
| 110 | led_keyframe_fade_in_all, | ||
| 111 | keyframe_no_operation, | ||
| 112 | led_keyframe_fade_out_all, | ||
| 113 | led_keyframe_crossfade, | ||
| 114 | led_keyframe_left_to_right_gradient, | ||
| 115 | led_keyframe_crossfade, | ||
| 116 | led_keyframe_top_to_bottom_gradient, | ||
| 117 | led_keyframe_mirror_orientation, | ||
| 118 | led_keyframe_crossfade, | ||
| 119 | led_keyframe_left_to_right_gradient, | ||
| 120 | led_keyframe_crossfade, | ||
| 121 | led_keyframe_top_to_bottom_gradient, | ||
| 122 | led_keyframe_normal_orientation, | ||
| 123 | led_keyframe_crossfade, | ||
| 124 | }, | ||
| 125 | }; | ||
| 126 | #endif | ||
| 127 | |||
| 128 | #endif | ||
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 = { | |||
| 22 | 400000 // clock speed (Hz); 400kHz max for IS31 | 22 | 400000 // clock speed (Hz); 400kHz max for IS31 |
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | #define GDISP_SCREEN_WIDTH 16 | ||
| 26 | #define GDISP_SCREEN_HEIGHT 5 | ||
| 27 | |||
| 28 | static const uint8_t led_mask[] = { | 25 | static const uint8_t led_mask[] = { |
| 29 | 0xFF, 0x00, /* C1-1 -> C1-16 */ | 26 | 0xFF, 0x00, /* C1-1 -> C1-16 */ |
| 30 | 0xFF, 0x00, /* C2-1 -> C2-16 */ | 27 | 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/>. | |||
| 81 | //#define NO_ACTION_MACRO | 81 | //#define NO_ACTION_MACRO |
| 82 | //#define NO_ACTION_FUNCTION | 82 | //#define NO_ACTION_FUNCTION |
| 83 | 83 | ||
| 84 | #endif | 84 | #endif \ No newline at end of file |
| 85 | |||
| 86 | // The visualizer needs gfx thread priorities | ||
| 87 | #define LED_DISPLAY_NUMBER 0 | ||
| 88 | |||
| 89 | #define LED_NUM_ROWS 5 | ||
| 90 | #define LED_NUM_COLS 16 | ||
| 91 | |||
| 92 | #define VISUALIZER_THREAD_PRIORITY (NORMAL_PRIORITY - 2) | ||
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 @@ | |||
| 1 | GFXINC += drivers/gdisp/IS31FL3731C | ||
| 2 | GFXSRC += drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c | ||
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 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2016 Fred Sundvik <fsundvik@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef _GDISP_LLD_CONFIG_H | ||
| 19 | #define _GDISP_LLD_CONFIG_H | ||
| 20 | |||
| 21 | #if GFX_USE_GDISP | ||
| 22 | |||
| 23 | /*===========================================================================*/ | ||
| 24 | /* Driver hardware support. */ | ||
| 25 | /*===========================================================================*/ | ||
| 26 | |||
| 27 | #define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing | ||
| 28 | #define GDISP_HARDWARE_DRAWPIXEL TRUE | ||
| 29 | #define GDISP_HARDWARE_PIXELREAD TRUE | ||
| 30 | #define GDISP_HARDWARE_CONTROL TRUE | ||
| 31 | |||
| 32 | #define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256 | ||
| 33 | |||
| 34 | #endif /* GFX_USE_GDISP */ | ||
| 35 | |||
| 36 | #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 @@ | |||
| 22 | #ifndef _GFXCONF_H | 22 | #ifndef _GFXCONF_H |
| 23 | #define _GFXCONF_H | 23 | #define _GFXCONF_H |
| 24 | 24 | ||
| 25 | 25 | #include "common_gfxconf.h" | |
| 26 | /////////////////////////////////////////////////////////////////////////// | ||
| 27 | // GOS - One of these must be defined, preferably in your Makefile // | ||
| 28 | /////////////////////////////////////////////////////////////////////////// | ||
| 29 | //#define GFX_USE_OS_CHIBIOS TRUE | ||
| 30 | //#define GFX_USE_OS_FREERTOS FALSE | ||
| 31 | // #define GFX_FREERTOS_USE_TRACE FALSE | ||
| 32 | //#define GFX_USE_OS_WIN32 FALSE | ||
| 33 | //#define GFX_USE_OS_LINUX FALSE | ||
| 34 | //#define GFX_USE_OS_OSX FALSE | ||
| 35 | //#define GFX_USE_OS_ECOS FALSE | ||
| 36 | //#define GFX_USE_OS_RAWRTOS FALSE | ||
| 37 | //#define GFX_USE_OS_ARDUINO FALSE | ||
| 38 | //#define GFX_USE_OS_KEIL FALSE | ||
| 39 | //#define GFX_USE_OS_CMSIS FALSE | ||
| 40 | //#define GFX_USE_OS_RAW32 FALSE | ||
| 41 | // #define INTERRUPTS_OFF() optional_code | ||
| 42 | // #define INTERRUPTS_ON() optional_code | ||
| 43 | // These are not defined by default for some reason | ||
| 44 | #define GOS_NEED_X_THREADS FALSE | ||
| 45 | #define GOS_NEED_X_HEAP FALSE | ||
| 46 | |||
| 47 | // Options that (should where relevant) apply to all operating systems | ||
| 48 | #define GFX_NO_INLINE FALSE | ||
| 49 | // #define GFX_COMPILER GFX_COMPILER_UNKNOWN | ||
| 50 | // #define GFX_CPU GFX_CPU_UNKNOWN | ||
| 51 | // #define GFX_OS_HEAP_SIZE 0 | ||
| 52 | // #define GFX_OS_NO_INIT FALSE | ||
| 53 | // #define GFX_OS_INIT_NO_WARNING FALSE | ||
| 54 | // #define GFX_OS_PRE_INIT_FUNCTION myHardwareInitRoutine | ||
| 55 | // #define GFX_OS_EXTRA_INIT_FUNCTION myOSInitRoutine | ||
| 56 | // #define GFX_OS_EXTRA_DEINIT_FUNCTION myOSDeInitRoutine | ||
| 57 | |||
| 58 | |||
| 59 | /////////////////////////////////////////////////////////////////////////// | ||
| 60 | // GDISP // | ||
| 61 | /////////////////////////////////////////////////////////////////////////// | ||
| 62 | #define GFX_USE_GDISP TRUE | ||
| 63 | |||
| 64 | //#define GDISP_NEED_AUTOFLUSH FALSE | ||
| 65 | //#define GDISP_NEED_TIMERFLUSH FALSE | ||
| 66 | //#define GDISP_NEED_VALIDATION TRUE | ||
| 67 | //#define GDISP_NEED_CLIP TRUE | ||
| 68 | #define GDISP_NEED_CIRCLE TRUE | ||
| 69 | #define GDISP_NEED_ELLIPSE TRUE | ||
| 70 | #define GDISP_NEED_ARC TRUE | ||
| 71 | #define GDISP_NEED_ARCSECTORS TRUE | ||
| 72 | #define GDISP_NEED_CONVEX_POLYGON TRUE | ||
| 73 | //#define GDISP_NEED_SCROLL FALSE | ||
| 74 | #define GDISP_NEED_PIXELREAD TRUE | ||
| 75 | #define GDISP_NEED_CONTROL TRUE | ||
| 76 | //#define GDISP_NEED_QUERY FALSE | ||
| 77 | //#define GDISP_NEED_MULTITHREAD FALSE | ||
| 78 | //#define GDISP_NEED_STREAMING FALSE | ||
| 79 | #define GDISP_NEED_TEXT TRUE | ||
| 80 | // #define GDISP_NEED_TEXT_WORDWRAP FALSE | ||
| 81 | // #define GDISP_NEED_ANTIALIAS FALSE | ||
| 82 | // #define GDISP_NEED_UTF8 FALSE | ||
| 83 | #define GDISP_NEED_TEXT_KERNING TRUE | ||
| 84 | // #define GDISP_INCLUDE_FONT_UI1 FALSE | ||
| 85 | // #define GDISP_INCLUDE_FONT_UI2 FALSE // The smallest preferred font. | ||
| 86 | // #define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE | ||
| 87 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE | ||
| 88 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE | ||
| 89 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE | ||
| 90 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS20 FALSE | ||
| 91 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE | ||
| 92 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE | ||
| 93 | #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 TRUE | ||
| 94 | // #define GDISP_INCLUDE_FONT_FIXED_10X20 FALSE | ||
| 95 | // #define GDISP_INCLUDE_FONT_FIXED_7X14 FALSE | ||
| 96 | #define GDISP_INCLUDE_FONT_FIXED_5X8 TRUE | ||
| 97 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE | ||
| 98 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE | ||
| 99 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS20_AA FALSE | ||
| 100 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE | ||
| 101 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE | ||
| 102 | // #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE | ||
| 103 | // #define GDISP_INCLUDE_USER_FONTS FALSE | ||
| 104 | |||
| 105 | //#define GDISP_NEED_IMAGE FALSE | ||
| 106 | // #define GDISP_NEED_IMAGE_NATIVE FALSE | ||
| 107 | // #define GDISP_NEED_IMAGE_GIF FALSE | ||
| 108 | // #define GDISP_NEED_IMAGE_BMP FALSE | ||
| 109 | // #define GDISP_NEED_IMAGE_BMP_1 FALSE | ||
| 110 | // #define GDISP_NEED_IMAGE_BMP_4 FALSE | ||
| 111 | // #define GDISP_NEED_IMAGE_BMP_4_RLE FALSE | ||
| 112 | // #define GDISP_NEED_IMAGE_BMP_8 FALSE | ||
| 113 | // #define GDISP_NEED_IMAGE_BMP_8_RLE FALSE | ||
| 114 | // #define GDISP_NEED_IMAGE_BMP_16 FALSE | ||
| 115 | // #define GDISP_NEED_IMAGE_BMP_24 FALSE | ||
| 116 | // #define GDISP_NEED_IMAGE_BMP_32 FALSE | ||
| 117 | // #define GDISP_NEED_IMAGE_JPG FALSE | ||
| 118 | // #define GDISP_NEED_IMAGE_PNG FALSE | ||
| 119 | // #define GDISP_NEED_IMAGE_ACCOUNTING FALSE | ||
| 120 | #ifdef EMULATOR | ||
| 121 | #define GDISP_NEED_PIXMAP TRUE | ||
| 122 | #endif | ||
| 123 | // #define GDISP_NEED_PIXMAP_IMAGE FALSE | ||
| 124 | |||
| 125 | //#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE // If not defined the native hardware orientation is used. | ||
| 126 | //#define GDISP_LINEBUF_SIZE 128 | ||
| 127 | //#define GDISP_STARTUP_COLOR Black | ||
| 128 | #define GDISP_NEED_STARTUP_LOGO FALSE | ||
| 129 | |||
| 130 | //#define GDISP_TOTAL_DISPLAYS 2 | ||
| 131 | |||
| 132 | #ifndef EMULATOR | ||
| 133 | #define GDISP_DRIVER_LIST GDISPVMT_IS31FL3731C_WHITEFOX | ||
| 134 | #endif | ||
| 135 | |||
| 136 | #ifdef GDISP_DRIVER_LIST | ||
| 137 | // For code and speed optimization define as TRUE or FALSE if all controllers have the same capability | ||
| 138 | #define GDISP_HARDWARE_STREAM_WRITE FALSE | ||
| 139 | #define GDISP_HARDWARE_STREAM_READ FALSE | ||
| 140 | #define GDISP_HARDWARE_STREAM_POS FALSE | ||
| 141 | #define GDISP_HARDWARE_DRAWPIXEL TRUE | ||
| 142 | #define GDISP_HARDWARE_CLEARS FALSE | ||
| 143 | #define GDISP_HARDWARE_FILLS FALSE | ||
| 144 | //#define GDISP_HARDWARE_BITFILLS FALSE | ||
| 145 | #define GDISP_HARDWARE_SCROLL FALSE | ||
| 146 | #define GDISP_HARDWARE_PIXELREAD TRUE | ||
| 147 | #define GDISP_HARDWARE_CONTROL TRUE | ||
| 148 | #define GDISP_HARDWARE_QUERY FALSE | ||
| 149 | #define GDISP_HARDWARE_CLIP FALSE | ||
| 150 | |||
| 151 | #define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888 | ||
| 152 | #endif | ||
| 153 | |||
| 154 | // The custom format is not defined for some reason, so define it as error | ||
| 155 | // so we don't get compiler warnings | ||
| 156 | #define GDISP_PIXELFORMAT_CUSTOM GDISP_PIXELFORMAT_ERROR | ||
| 157 | |||
| 158 | #define GDISP_USE_GFXNET FALSE | ||
| 159 | // #define GDISP_GFXNET_PORT 13001 | ||
| 160 | // #define GDISP_GFXNET_CUSTOM_LWIP_STARTUP FALSE | ||
| 161 | // #define GDISP_DONT_WAIT_FOR_NET_DISPLAY FALSE | ||
| 162 | // #define GDISP_GFXNET_UNSAFE_SOCKETS FALSE | ||
| 163 | |||
| 164 | |||
| 165 | /////////////////////////////////////////////////////////////////////////// | ||
| 166 | // GWIN // | ||
| 167 | /////////////////////////////////////////////////////////////////////////// | ||
| 168 | #define GFX_USE_GWIN FALSE | ||
| 169 | |||
| 170 | //#define GWIN_NEED_WINDOWMANAGER FALSE | ||
| 171 | // #define GWIN_REDRAW_IMMEDIATE FALSE | ||
| 172 | // #define GWIN_REDRAW_SINGLEOP FALSE | ||
| 173 | // #define GWIN_NEED_FLASHING FALSE | ||
| 174 | // #define GWIN_FLASHING_PERIOD 250 | ||
| 175 | |||
| 176 | //#define GWIN_NEED_CONSOLE FALSE | ||
| 177 | // #define GWIN_CONSOLE_USE_HISTORY FALSE | ||
| 178 | // #define GWIN_CONSOLE_HISTORY_AVERAGING FALSE | ||
| 179 | // #define GWIN_CONSOLE_HISTORY_ATCREATE FALSE | ||
| 180 | // #define GWIN_CONSOLE_ESCSEQ FALSE | ||
| 181 | // #define GWIN_CONSOLE_USE_BASESTREAM FALSE | ||
| 182 | // #define GWIN_CONSOLE_USE_FLOAT FALSE | ||
| 183 | //#define GWIN_NEED_GRAPH FALSE | ||
| 184 | //#define GWIN_NEED_GL3D FALSE | ||
| 185 | |||
| 186 | //#define GWIN_NEED_WIDGET FALSE | ||
| 187 | //#define GWIN_FOCUS_HIGHLIGHT_WIDTH 1 | ||
| 188 | // #define GWIN_NEED_LABEL FALSE | ||
| 189 | // #define GWIN_LABEL_ATTRIBUTE FALSE | ||
| 190 | // #define GWIN_NEED_BUTTON FALSE | ||
| 191 | // #define GWIN_BUTTON_LAZY_RELEASE FALSE | ||
| 192 | // #define GWIN_NEED_SLIDER FALSE | ||
| 193 | // #define GWIN_SLIDER_NOSNAP FALSE | ||
| 194 | // #define GWIN_SLIDER_DEAD_BAND 5 | ||
| 195 | // #define GWIN_SLIDER_TOGGLE_INC 20 | ||
| 196 | // #define GWIN_NEED_CHECKBOX FALSE | ||
| 197 | // #define GWIN_NEED_IMAGE FALSE | ||
| 198 | // #define GWIN_NEED_IMAGE_ANIMATION FALSE | ||
| 199 | // #define GWIN_NEED_RADIO FALSE | ||
| 200 | // #define GWIN_NEED_LIST FALSE | ||
| 201 | // #define GWIN_NEED_LIST_IMAGES FALSE | ||
| 202 | // #define GWIN_NEED_PROGRESSBAR FALSE | ||
| 203 | // #define GWIN_PROGRESSBAR_AUTO FALSE | ||
| 204 | // #define GWIN_NEED_KEYBOARD FALSE | ||
| 205 | // #define GWIN_KEYBOARD_DEFAULT_LAYOUT VirtualKeyboard_English1 | ||
| 206 | // #define GWIN_NEED_KEYBOARD_ENGLISH1 TRUE | ||
| 207 | // #define GWIN_NEED_TEXTEDIT FALSE | ||
| 208 | // #define GWIN_FLAT_STYLING FALSE | ||
| 209 | // #define GWIN_WIDGET_TAGS FALSE | ||
| 210 | |||
| 211 | //#define GWIN_NEED_CONTAINERS FALSE | ||
| 212 | // #define GWIN_NEED_CONTAINER FALSE | ||
| 213 | // #define GWIN_NEED_FRAME FALSE | ||
| 214 | // #define GWIN_NEED_TABSET FALSE | ||
| 215 | // #define GWIN_TABSET_TABHEIGHT 18 | ||
| 216 | |||
| 217 | |||
| 218 | /////////////////////////////////////////////////////////////////////////// | ||
| 219 | // GEVENT // | ||
| 220 | /////////////////////////////////////////////////////////////////////////// | ||
| 221 | #define GFX_USE_GEVENT TRUE | ||
| 222 | |||
| 223 | //#define GEVENT_ASSERT_NO_RESOURCE FALSE | ||
| 224 | //#define GEVENT_MAXIMUM_SIZE 32 | ||
| 225 | //#define GEVENT_MAX_SOURCE_LISTENERS 32 | ||
| 226 | |||
| 227 | |||
| 228 | /////////////////////////////////////////////////////////////////////////// | ||
| 229 | // GTIMER // | ||
| 230 | /////////////////////////////////////////////////////////////////////////// | ||
| 231 | #define GFX_USE_GTIMER FALSE | ||
| 232 | |||
| 233 | //#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY | ||
| 234 | //#define GTIMER_THREAD_WORKAREA_SIZE 2048 | ||
| 235 | |||
| 236 | |||
| 237 | /////////////////////////////////////////////////////////////////////////// | ||
| 238 | // GQUEUE // | ||
| 239 | /////////////////////////////////////////////////////////////////////////// | ||
| 240 | #define GFX_USE_GQUEUE FALSE | ||
| 241 | |||
| 242 | //#define GQUEUE_NEED_ASYNC FALSE | ||
| 243 | //#define GQUEUE_NEED_GSYNC FALSE | ||
| 244 | //#define GQUEUE_NEED_FSYNC FALSE | ||
| 245 | //#define GQUEUE_NEED_BUFFERS FALSE | ||
| 246 | |||
| 247 | /////////////////////////////////////////////////////////////////////////// | ||
| 248 | // GINPUT // | ||
| 249 | /////////////////////////////////////////////////////////////////////////// | ||
| 250 | #define GFX_USE_GINPUT FALSE | ||
| 251 | |||
| 252 | //#define GINPUT_NEED_MOUSE FALSE | ||
| 253 | // #define GINPUT_TOUCH_STARTRAW FALSE | ||
| 254 | // #define GINPUT_TOUCH_NOTOUCH FALSE | ||
| 255 | // #define GINPUT_TOUCH_NOCALIBRATE FALSE | ||
| 256 | // #define GINPUT_TOUCH_NOCALIBRATE_GUI FALSE | ||
| 257 | // #define GINPUT_MOUSE_POLL_PERIOD 25 | ||
| 258 | // #define GINPUT_MOUSE_CLICK_TIME 300 | ||
| 259 | // #define GINPUT_TOUCH_CXTCLICK_TIME 700 | ||
| 260 | // #define GINPUT_TOUCH_USER_CALIBRATION_LOAD FALSE | ||
| 261 | // #define GINPUT_TOUCH_USER_CALIBRATION_SAVE FALSE | ||
| 262 | // #define GMOUSE_DRIVER_LIST GMOUSEVMT_Win32, GMOUSEVMT_Win32 | ||
| 263 | //#define GINPUT_NEED_KEYBOARD FALSE | ||
| 264 | // #define GINPUT_KEYBOARD_POLL_PERIOD 200 | ||
| 265 | // #define GKEYBOARD_DRIVER_LIST GKEYBOARDVMT_Win32, GKEYBOARDVMT_Win32 | ||
| 266 | // #define GKEYBOARD_LAYOUT_OFF FALSE | ||
| 267 | // #define GKEYBOARD_LAYOUT_SCANCODE2_US FALSE | ||
| 268 | //#define GINPUT_NEED_TOGGLE FALSE | ||
| 269 | //#define GINPUT_NEED_DIAL FALSE | ||
| 270 | |||
| 271 | |||
| 272 | /////////////////////////////////////////////////////////////////////////// | ||
| 273 | // GFILE // | ||
| 274 | /////////////////////////////////////////////////////////////////////////// | ||
| 275 | #define GFX_USE_GFILE FALSE | ||
| 276 | |||
| 277 | //#define GFILE_NEED_PRINTG FALSE | ||
| 278 | //#define GFILE_NEED_SCANG FALSE | ||
| 279 | //#define GFILE_NEED_STRINGS FALSE | ||
| 280 | //#define GFILE_NEED_FILELISTS FALSE | ||
| 281 | //#define GFILE_NEED_STDIO FALSE | ||
| 282 | //#define GFILE_NEED_NOAUTOMOUNT FALSE | ||
| 283 | //#define GFILE_NEED_NOAUTOSYNC FALSE | ||
| 284 | |||
| 285 | //#define GFILE_NEED_MEMFS FALSE | ||
| 286 | //#define GFILE_NEED_ROMFS FALSE | ||
| 287 | //#define GFILE_NEED_RAMFS FALSE | ||
| 288 | //#define GFILE_NEED_FATFS FALSE | ||
| 289 | //#define GFILE_NEED_NATIVEFS FALSE | ||
| 290 | //#define GFILE_NEED_CHBIOSFS FALSE | ||
| 291 | |||
| 292 | //#define GFILE_ALLOW_FLOATS FALSE | ||
| 293 | //#define GFILE_ALLOW_DEVICESPECIFIC FALSE | ||
| 294 | //#define GFILE_MAX_GFILES 3 | ||
| 295 | |||
| 296 | /////////////////////////////////////////////////////////////////////////// | ||
| 297 | // GADC // | ||
| 298 | /////////////////////////////////////////////////////////////////////////// | ||
| 299 | #define GFX_USE_GADC FALSE | ||
| 300 | |||
| 301 | //#define GADC_MAX_LOWSPEED_DEVICES 4 | ||
| 302 | |||
| 303 | |||
| 304 | /////////////////////////////////////////////////////////////////////////// | ||
| 305 | // GAUDIO // | ||
| 306 | /////////////////////////////////////////////////////////////////////////// | ||
| 307 | #define GFX_USE_GAUDIO FALSE | ||
| 308 | // There seems to be a bug in the ugfx code, the wrong define is used | ||
| 309 | // So define it in order to avoid warnings | ||
| 310 | #define GFX_USE_GAUDIN GFX_USE_GAUDIO | ||
| 311 | // #define GAUDIO_NEED_PLAY FALSE | ||
| 312 | // #define GAUDIO_NEED_RECORD FALSE | ||
| 313 | |||
| 314 | |||
| 315 | /////////////////////////////////////////////////////////////////////////// | ||
| 316 | // GMISC // | ||
| 317 | /////////////////////////////////////////////////////////////////////////// | ||
| 318 | #define GFX_USE_GMISC TRUE | ||
| 319 | |||
| 320 | //#define GMISC_NEED_ARRAYOPS FALSE | ||
| 321 | //#define GMISC_NEED_FASTTRIG FALSE | ||
| 322 | //#define GMISC_NEED_FIXEDTRIG FALSE | ||
| 323 | //#define GMISC_NEED_INVSQRT FALSE | ||
| 324 | // #define GMISC_INVSQRT_MIXED_ENDIAN FALSE | ||
| 325 | // #define GMISC_INVSQRT_REAL_SLOW FALSE | ||
| 326 | #define GMISC_NEED_MATRIXFLOAT2D TRUE | ||
| 327 | #define GMISC_NEED_MATRIXFIXED2D FALSE | ||
| 328 | 26 | ||
| 329 | #endif /* _GFXCONF_H */ | 27 | #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 @@ | |||
| 1 | # project specific files | 1 | # project specific files |
| 2 | SRC = matrix.c \ | 2 | SRC = matrix.c \ |
| 3 | led.c \ | 3 | led.c |
| 4 | animations.c | ||
| 5 | 4 | ||
| 6 | ## chip/board settings | 5 | ## chip/board settings |
| 7 | # - the next two should match the directories in | 6 | # - the next two should match the directories in |
| @@ -70,4 +69,6 @@ CUSTOM_MATRIX = yes # Custom matrix file | |||
| 70 | BACKLIGHT_ENABLE = yes | 69 | BACKLIGHT_ENABLE = yes |
| 71 | VISUALIZER_ENABLE = yes | 70 | VISUALIZER_ENABLE = yes |
| 72 | 71 | ||
| 73 | include $(KEYBOARD_PATH)/drivers/gdisp/IS31FL3731C/driver.mk | 72 | LED_DRIVER = is31fl3731c |
| 73 | LED_WIDTH = 16 | ||
| 74 | 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 @@ | |||
| 20 | #include "visualizer.h" | 20 | #include "visualizer.h" |
| 21 | #include "visualizer_keyframes.h" | 21 | #include "visualizer_keyframes.h" |
| 22 | #include "led.h" | 22 | #include "led.h" |
| 23 | #include "animations.h" | 23 | #include "default_animations.h" |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | static bool initial_update = true; | 26 | 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 @@ | |||
| 20 | #include "visualizer.h" | 20 | #include "visualizer.h" |
| 21 | 21 | ||
| 22 | // Animates the LCD backlight color between the current color and the target color (of the state) | 22 | // Animates the LCD backlight color between the current color and the target color (of the state) |
| 23 | bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state); | 23 | bool lcd_backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state); |
| 24 | // Sets the backlight color to the target color | 24 | // Sets the backlight color to the target color |
| 25 | bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state); | 25 | bool lcd_backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state); |
| 26 | 26 | ||
| 27 | bool backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state); | 27 | bool lcd_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state); |
| 28 | bool backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state); | 28 | bool lcd_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state); |
| 29 | 29 | ||
| 30 | #endif /* QUANTUM_VISUALIZER_LCD_BACKLIGHT_KEYFRAMES_H_ */ | 30 | #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 @@ | |||
| 1 | /* | 1 | /* |
| 2 | LUFA Library | 2 | LUFA Library |
| 3 | Copyright (C) Dean Camera, 2017. | 3 | Copyright (C) Dean Camera, 2017. |
| 4 | 4 | ||
| 5 | dean [at] fourwalledcubicle [dot] com | 5 | dean [at] fourwalledcubicle [dot] com |
| 6 | www.lufa-lib.org | 6 | www.lufa-lib.org |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | /* | 9 | /* |
| 10 | Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) | 10 | Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
| 11 | 11 | ||
| 12 | Permission to use, copy, modify, distribute, and sell this | 12 | Permission to use, copy, modify, distribute, and sell this |
| 13 | software and its documentation for any purpose is hereby granted | 13 | software and its documentation for any purpose is hereby granted |
| 14 | without fee, provided that the above copyright notice appear in | 14 | without fee, provided that the above copyright notice appear in |
| 15 | all copies and that both that the copyright notice and this | 15 | all copies and that both that the copyright notice and this |
| 16 | permission notice and warranty disclaimer appear in supporting | 16 | permission notice and warranty disclaimer appear in supporting |
| 17 | documentation, and that the name of the author not be used in | 17 | documentation, and that the name of the author not be used in |
| 18 | advertising or publicity pertaining to distribution of the | 18 | advertising or publicity pertaining to distribution of the |
| 19 | software without specific, written prior permission. | 19 | software without specific, written prior permission. |
| 20 | 20 | ||
| 21 | The author disclaims all warranties with regard to this | 21 | The author disclaims all warranties with regard to this |
| 22 | software, including all implied warranties of merchantability | 22 | software, including all implied warranties of merchantability |
| 23 | and fitness. In no event shall the author be liable for any | 23 | and fitness. In no event shall the author be liable for any |
| 24 | special, indirect or consequential damages or any damages | 24 | special, indirect or consequential damages or any damages |
| 25 | whatsoever resulting from loss of use, data or profits, whether | 25 | whatsoever resulting from loss of use, data or profits, whether |
| 26 | in an action of contract, negligence or other tortious action, | 26 | in an action of contract, negligence or other tortious action, |
| 27 | arising out of or in connection with the use or performance of | 27 | arising out of or in connection with the use or performance of |
| 28 | this software. | 28 | this software. |
| 29 | */ | 29 | */ |
| 30 | 30 | ||
| 31 | #if AUX_BOOT_SECTION_SIZE > 0 | 31 | #if AUX_BOOT_SECTION_SIZE > 0 |
| 32 | #warning Using a AUX bootloader section in addition to the defined bootloader space (see documentation). | 32 | #warning Using a AUX bootloader section in addition to the defined bootloader space (see documentation). |
| 33 | 33 | ||
| 34 | ; Trampoline to jump over the AUX bootloader section to the start of the bootloader, | 34 | ; Trampoline to jump over the AUX bootloader section to the start of the bootloader, |
| 35 | ; on devices where an AUX bootloader section is used. | 35 | ; on devices where an AUX bootloader section is used. |
| 36 | .section .boot_aux_trampoline, "ax" | 36 | .section .boot_aux_trampoline, "ax" |
| 37 | .global Boot_AUX_Trampoline | 37 | .global Boot_AUX_Trampoline |
| 38 | Boot_AUX_Trampoline: | 38 | Boot_AUX_Trampoline: |
| 39 | jmp BOOT_START_ADDR | 39 | jmp BOOT_START_ADDR |
| 40 | #endif | 40 | #endif |
| 41 | 41 | ||
| 42 | ; Trampolines to actual API implementations if the target address is outside the | 42 | ; Trampolines to actual API implementations if the target address is outside the |
| 43 | ; range of a rjmp instruction (can happen with large bootloader sections) | 43 | ; range of a rjmp instruction (can happen with large bootloader sections) |
| 44 | .section .apitable_trampolines, "ax" | 44 | .section .apitable_trampolines, "ax" |
| 45 | .global BootloaderAPI_Trampolines | 45 | .global BootloaderAPI_Trampolines |
| 46 | BootloaderAPI_Trampolines: | 46 | BootloaderAPI_Trampolines: |
| 47 | 47 | ||
| 48 | BootloaderAPI_ErasePage_Trampoline: | 48 | BootloaderAPI_ErasePage_Trampoline: |
| 49 | jmp BootloaderAPI_ErasePage | 49 | jmp BootloaderAPI_ErasePage |
| 50 | BootloaderAPI_WritePage_Trampoline: | 50 | BootloaderAPI_WritePage_Trampoline: |
| 51 | jmp BootloaderAPI_WritePage | 51 | jmp BootloaderAPI_WritePage |
| 52 | BootloaderAPI_FillWord_Trampoline: | 52 | BootloaderAPI_FillWord_Trampoline: |
| 53 | jmp BootloaderAPI_FillWord | 53 | jmp BootloaderAPI_FillWord |
| 54 | BootloaderAPI_ReadSignature_Trampoline: | 54 | BootloaderAPI_ReadSignature_Trampoline: |
| 55 | jmp BootloaderAPI_ReadSignature | 55 | jmp BootloaderAPI_ReadSignature |
| 56 | BootloaderAPI_ReadFuse_Trampoline: | 56 | BootloaderAPI_ReadFuse_Trampoline: |
| 57 | jmp BootloaderAPI_ReadFuse | 57 | jmp BootloaderAPI_ReadFuse |
| 58 | BootloaderAPI_ReadLock_Trampoline: | 58 | BootloaderAPI_ReadLock_Trampoline: |
| 59 | jmp BootloaderAPI_ReadLock | 59 | jmp BootloaderAPI_ReadLock |
| 60 | BootloaderAPI_WriteLock_Trampoline: | 60 | BootloaderAPI_WriteLock_Trampoline: |
| 61 | jmp BootloaderAPI_WriteLock | 61 | jmp BootloaderAPI_WriteLock |
| 62 | BootloaderAPI_UNUSED1: | 62 | BootloaderAPI_UNUSED1: |
| 63 | ret | 63 | ret |
| 64 | BootloaderAPI_UNUSED2: | 64 | BootloaderAPI_UNUSED2: |
| 65 | ret | 65 | ret |
| 66 | BootloaderAPI_UNUSED3: | 66 | BootloaderAPI_UNUSED3: |
| 67 | ret | 67 | ret |
| 68 | BootloaderAPI_UNUSED4: | 68 | BootloaderAPI_UNUSED4: |
| 69 | ret | 69 | ret |
| 70 | BootloaderAPI_UNUSED5: | 70 | BootloaderAPI_UNUSED5: |
| 71 | ret | 71 | ret |
| 72 | 72 | ||
| 73 | 73 | ||
| 74 | 74 | ||
| 75 | ; API function jump table | 75 | ; API function jump table |
| 76 | .section .apitable_jumptable, "ax" | 76 | .section .apitable_jumptable, "ax" |
| 77 | .global BootloaderAPI_JumpTable | 77 | .global BootloaderAPI_JumpTable |
| 78 | BootloaderAPI_JumpTable: | 78 | BootloaderAPI_JumpTable: |
| 79 | 79 | ||
| 80 | rjmp BootloaderAPI_ErasePage_Trampoline | 80 | rjmp BootloaderAPI_ErasePage_Trampoline |
| 81 | rjmp BootloaderAPI_WritePage_Trampoline | 81 | rjmp BootloaderAPI_WritePage_Trampoline |
| 82 | rjmp BootloaderAPI_FillWord_Trampoline | 82 | rjmp BootloaderAPI_FillWord_Trampoline |
| 83 | rjmp BootloaderAPI_ReadSignature_Trampoline | 83 | rjmp BootloaderAPI_ReadSignature_Trampoline |
| 84 | rjmp BootloaderAPI_ReadFuse_Trampoline | 84 | rjmp BootloaderAPI_ReadFuse_Trampoline |
| 85 | rjmp BootloaderAPI_ReadLock_Trampoline | 85 | rjmp BootloaderAPI_ReadLock_Trampoline |
| 86 | rjmp BootloaderAPI_WriteLock_Trampoline | 86 | rjmp BootloaderAPI_WriteLock_Trampoline |
| 87 | rjmp BootloaderAPI_UNUSED1 ; UNUSED ENTRY 1 | 87 | rjmp BootloaderAPI_UNUSED1 ; UNUSED ENTRY 1 |
| 88 | rjmp BootloaderAPI_UNUSED2 ; UNUSED ENTRY 2 | 88 | rjmp BootloaderAPI_UNUSED2 ; UNUSED ENTRY 2 |
| 89 | rjmp BootloaderAPI_UNUSED3 ; UNUSED ENTRY 3 | 89 | rjmp BootloaderAPI_UNUSED3 ; UNUSED ENTRY 3 |
| 90 | rjmp BootloaderAPI_UNUSED4 ; UNUSED ENTRY 4 | 90 | rjmp BootloaderAPI_UNUSED4 ; UNUSED ENTRY 4 |
| 91 | rjmp BootloaderAPI_UNUSED5 ; UNUSED ENTRY 5 | 91 | rjmp BootloaderAPI_UNUSED5 ; UNUSED ENTRY 5 |
| 92 | 92 | ||
| 93 | 93 | ||
| 94 | 94 | ||
| 95 | ; Bootloader table signatures and information | 95 | ; Bootloader table signatures and information |
| 96 | .section .apitable_signatures, "ax" | 96 | .section .apitable_signatures, "ax" |
| 97 | .global BootloaderAPI_Signatures | 97 | .global BootloaderAPI_Signatures |
| 98 | BootloaderAPI_Signatures: | 98 | BootloaderAPI_Signatures: |
| 99 | 99 | ||
| 100 | .long BOOT_START_ADDR ; Start address of the bootloader | 100 | .long BOOT_START_ADDR ; Start address of the bootloader |
| 101 | .word 0xDF30 ; Signature for the MS class bootloader, V1 | 101 | .word 0xDF30 ; Signature for the MS class bootloader, V1 |
| 102 | .word 0xDCFB ; Signature for a LUFA class bootloader | 102 | .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 @@ | |||
| 1 | # | 1 | # |
| 2 | # LUFA Library | 2 | # LUFA Library |
| 3 | # Copyright (C) Dean Camera, 2017. | 3 | # Copyright (C) Dean Camera, 2017. |
| 4 | # | 4 | # |
| 5 | # dean [at] fourwalledcubicle [dot] com | 5 | # dean [at] fourwalledcubicle [dot] com |
| 6 | # www.lufa-lib.org | 6 | # www.lufa-lib.org |
| 7 | # | 7 | # |
| 8 | # -------------------------------------- | 8 | # -------------------------------------- |
| 9 | # LUFA Project Makefile. | 9 | # LUFA Project Makefile. |
| 10 | # -------------------------------------- | 10 | # -------------------------------------- |
| 11 | 11 | ||
| 12 | # Run "make help" for target help. | 12 | # Run "make help" for target help. |
| 13 | 13 | ||
| 14 | MCU = at90usb1287 | 14 | MCU = at90usb1287 |
| 15 | ARCH = AVR8 | 15 | ARCH = AVR8 |
| 16 | BOARD = USBKEY | 16 | BOARD = USBKEY |
| 17 | F_CPU = 8000000 | 17 | F_CPU = 8000000 |
| 18 | F_USB = $(F_CPU) | 18 | F_USB = $(F_CPU) |
| 19 | OPTIMIZATION = s | 19 | OPTIMIZATION = s |
| 20 | TARGET = BootloaderMassStorage | 20 | TARGET = BootloaderMassStorage |
| 21 | SRC = $(TARGET).c Descriptors.c BootloaderAPI.c BootloaderAPITable.S Lib/SCSI.c Lib/VirtualFAT.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) | 21 | SRC = $(TARGET).c Descriptors.c BootloaderAPI.c BootloaderAPITable.S Lib/SCSI.c Lib/VirtualFAT.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) |
| 22 | LUFA_PATH = ../../LUFA | 22 | LUFA_PATH = ../../LUFA |
| 23 | CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=$(BOOT_START_OFFSET) | 23 | CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=$(BOOT_START_OFFSET) |
| 24 | LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET) $(BOOT_API_LD_FLAGS) | 24 | LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET) $(BOOT_API_LD_FLAGS) |
| 25 | 25 | ||
| 26 | # Flash size and bootloader section sizes of the target, in KB. These must | 26 | # Flash size and bootloader section sizes of the target, in KB. These must |
| 27 | # match the target's total FLASH size and the bootloader size set in the | 27 | # match the target's total FLASH size and the bootloader size set in the |
| 28 | # device's fuses. | 28 | # device's fuses. |
| 29 | FLASH_SIZE_KB = 128 | 29 | FLASH_SIZE_KB = 128 |
| 30 | BOOT_SECTION_SIZE_KB = 8 | 30 | BOOT_SECTION_SIZE_KB = 8 |
| 31 | 31 | ||
| 32 | # Bootloader address calculation formulas | 32 | # Bootloader address calculation formulas |
| 33 | # Do not modify these macros, but rather modify the dependent values above. | 33 | # Do not modify these macros, but rather modify the dependent values above. |
| 34 | CALC_ADDRESS_IN_HEX = $(shell printf "0x%X" $$(( $(1) )) ) | 34 | CALC_ADDRESS_IN_HEX = $(shell printf "0x%X" $$(( $(1) )) ) |
| 35 | BOOT_START_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024 ) | 35 | BOOT_START_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024 ) |
| 36 | BOOT_SEC_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) * 1024) - ($(strip $(1))) ) | 36 | BOOT_SEC_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) * 1024) - ($(strip $(1))) ) |
| 37 | 37 | ||
| 38 | # Bootloader linker section flags for relocating the API table sections to | 38 | # Bootloader linker section flags for relocating the API table sections to |
| 39 | # known FLASH addresses - these should not normally be user-edited. | 39 | # known FLASH addresses - these should not normally be user-edited. |
| 40 | BOOT_SECTION_LD_FLAG = -Wl,--section-start=$(strip $(1))=$(call BOOT_SEC_OFFSET, $(3)) -Wl,--undefined=$(strip $(2)) | 40 | BOOT_SECTION_LD_FLAG = -Wl,--section-start=$(strip $(1))=$(call BOOT_SEC_OFFSET, $(3)) -Wl,--undefined=$(strip $(2)) |
| 41 | BOOT_API_LD_FLAGS = $(call BOOT_SECTION_LD_FLAG, .apitable_trampolines, BootloaderAPI_Trampolines, 96) | 41 | BOOT_API_LD_FLAGS = $(call BOOT_SECTION_LD_FLAG, .apitable_trampolines, BootloaderAPI_Trampolines, 96) |
| 42 | BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_jumptable, BootloaderAPI_JumpTable, 32) | 42 | BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_jumptable, BootloaderAPI_JumpTable, 32) |
| 43 | BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_signatures, BootloaderAPI_Signatures, 8) | 43 | BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_signatures, BootloaderAPI_Signatures, 8) |
| 44 | 44 | ||
| 45 | # Check if the bootloader needs an AUX section, located before the real bootloader section to store some of the | 45 | # Check if the bootloader needs an AUX section, located before the real bootloader section to store some of the |
| 46 | # bootloader code. This is required for 32KB and smaller devices, where the actual bootloader is 6KB but the maximum | 46 | # bootloader code. This is required for 32KB and smaller devices, where the actual bootloader is 6KB but the maximum |
| 47 | # bootloader section size is 4KB. The actual usable application space will be reduced by 6KB for these devices. | 47 | # bootloader section size is 4KB. The actual usable application space will be reduced by 6KB for these devices. |
| 48 | ifeq ($(BOOT_SECTION_SIZE_KB),8) | 48 | ifeq ($(BOOT_SECTION_SIZE_KB),8) |
| 49 | CC_FLAGS += -DAUX_BOOT_SECTION_SIZE=0 | 49 | CC_FLAGS += -DAUX_BOOT_SECTION_SIZE=0 |
| 50 | else | 50 | else |
| 51 | AUX_BOOT_SECTION_SIZE_KB = (6 - $(BOOT_SECTION_SIZE_KB)) | 51 | AUX_BOOT_SECTION_SIZE_KB = (6 - $(BOOT_SECTION_SIZE_KB)) |
| 52 | 52 | ||
| 53 | CC_FLAGS += -DAUX_BOOT_SECTION_SIZE='($(AUX_BOOT_SECTION_SIZE_KB) * 1024)' | 53 | CC_FLAGS += -DAUX_BOOT_SECTION_SIZE='($(AUX_BOOT_SECTION_SIZE_KB) * 1024)' |
| 54 | LD_FLAGS += -Wl,--section-start=.boot_aux=$(call BOOT_SEC_OFFSET, (($(BOOT_SECTION_SIZE_KB) + $(AUX_BOOT_SECTION_SIZE_KB)) * 1024 - 16)) | 54 | LD_FLAGS += -Wl,--section-start=.boot_aux=$(call BOOT_SEC_OFFSET, (($(BOOT_SECTION_SIZE_KB) + $(AUX_BOOT_SECTION_SIZE_KB)) * 1024 - 16)) |
| 55 | LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .boot_aux_trampoline, Boot_AUX_Trampoline, ($(BOOT_SECTION_SIZE_KB) + $(AUX_BOOT_SECTION_SIZE_KB)) * 1024) | 55 | LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .boot_aux_trampoline, Boot_AUX_Trampoline, ($(BOOT_SECTION_SIZE_KB) + $(AUX_BOOT_SECTION_SIZE_KB)) * 1024) |
| 56 | endif | 56 | endif |
| 57 | 57 | ||
| 58 | # Default target | 58 | # Default target |
| 59 | all: | 59 | all: |
| 60 | 60 | ||
| 61 | # Include LUFA-specific DMBS extension modules | 61 | # Include LUFA-specific DMBS extension modules |
| 62 | DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA | 62 | DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA |
| 63 | include $(DMBS_LUFA_PATH)/lufa-sources.mk | 63 | include $(DMBS_LUFA_PATH)/lufa-sources.mk |
| 64 | include $(DMBS_LUFA_PATH)/lufa-gcc.mk | 64 | include $(DMBS_LUFA_PATH)/lufa-gcc.mk |
| 65 | 65 | ||
| 66 | # Include common DMBS build system modules | 66 | # Include common DMBS build system modules |
| 67 | DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS | 67 | DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS |
| 68 | include $(DMBS_PATH)/core.mk | 68 | include $(DMBS_PATH)/core.mk |
| 69 | include $(DMBS_PATH)/cppcheck.mk | 69 | include $(DMBS_PATH)/cppcheck.mk |
| 70 | include $(DMBS_PATH)/doxygen.mk | 70 | include $(DMBS_PATH)/doxygen.mk |
| 71 | include $(DMBS_PATH)/dfu.mk | 71 | include $(DMBS_PATH)/dfu.mk |
| 72 | include $(DMBS_PATH)/gcc.mk | 72 | include $(DMBS_PATH)/gcc.mk |
| 73 | include $(DMBS_PATH)/hid.mk | 73 | include $(DMBS_PATH)/hid.mk |
| 74 | include $(DMBS_PATH)/avrdude.mk | 74 | include $(DMBS_PATH)/avrdude.mk |
| 75 | include $(DMBS_PATH)/atprogram.mk | 75 | 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 @@ | |||
| 1 | /* | 1 | /* |
| 2 | LUFA Library | 2 | LUFA Library |
| 3 | Copyright (C) Dean Camera, 2017. | 3 | Copyright (C) Dean Camera, 2017. |
| 4 | 4 | ||
| 5 | dean [at] fourwalledcubicle [dot] com | 5 | dean [at] fourwalledcubicle [dot] com |
| 6 | www.lufa-lib.org | 6 | www.lufa-lib.org |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | /* | 9 | /* |
| 10 | Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) | 10 | Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
| 11 | 11 | ||
| 12 | Permission to use, copy, modify, distribute, and sell this | 12 | Permission to use, copy, modify, distribute, and sell this |
| 13 | software and its documentation for any purpose is hereby granted | 13 | software and its documentation for any purpose is hereby granted |
| 14 | without fee, provided that the above copyright notice appear in | 14 | without fee, provided that the above copyright notice appear in |
| 15 | all copies and that both that the copyright notice and this | 15 | all copies and that both that the copyright notice and this |
| 16 | permission notice and warranty disclaimer appear in supporting | 16 | permission notice and warranty disclaimer appear in supporting |
| 17 | documentation, and that the name of the author not be used in | 17 | documentation, and that the name of the author not be used in |
| 18 | advertising or publicity pertaining to distribution of the | 18 | advertising or publicity pertaining to distribution of the |
| 19 | software without specific, written prior permission. | 19 | software without specific, written prior permission. |
| 20 | 20 | ||
| 21 | The author disclaims all warranties with regard to this | 21 | The author disclaims all warranties with regard to this |
| 22 | software, including all implied warranties of merchantability | 22 | software, including all implied warranties of merchantability |
| 23 | and fitness. In no event shall the author be liable for any | 23 | and fitness. In no event shall the author be liable for any |
| 24 | special, indirect or consequential damages or any damages | 24 | special, indirect or consequential damages or any damages |
| 25 | whatsoever resulting from loss of use, data or profits, whether | 25 | whatsoever resulting from loss of use, data or profits, whether |
| 26 | in an action of contract, negligence or other tortious action, | 26 | in an action of contract, negligence or other tortious action, |
| 27 | arising out of or in connection with the use or performance of | 27 | arising out of or in connection with the use or performance of |
| 28 | this software. | 28 | this software. |
| 29 | */ | 29 | */ |
| 30 | 30 | ||
| 31 | ; Trampolines to actual API implementations if the target address is outside the | 31 | ; Trampolines to actual API implementations if the target address is outside the |
| 32 | ; range of a rjmp instruction (can happen with large bootloader sections) | 32 | ; range of a rjmp instruction (can happen with large bootloader sections) |
| 33 | .section .apitable_trampolines, "ax" | 33 | .section .apitable_trampolines, "ax" |
| 34 | .global BootloaderAPI_Trampolines | 34 | .global BootloaderAPI_Trampolines |
| 35 | BootloaderAPI_Trampolines: | 35 | BootloaderAPI_Trampolines: |
| 36 | 36 | ||
| 37 | BootloaderAPI_ErasePage_Trampoline: | 37 | BootloaderAPI_ErasePage_Trampoline: |
| 38 | jmp BootloaderAPI_ErasePage | 38 | jmp BootloaderAPI_ErasePage |
| 39 | BootloaderAPI_WritePage_Trampoline: | 39 | BootloaderAPI_WritePage_Trampoline: |
| 40 | jmp BootloaderAPI_WritePage | 40 | jmp BootloaderAPI_WritePage |
| 41 | BootloaderAPI_FillWord_Trampoline: | 41 | BootloaderAPI_FillWord_Trampoline: |
| 42 | jmp BootloaderAPI_FillWord | 42 | jmp BootloaderAPI_FillWord |
| 43 | BootloaderAPI_ReadSignature_Trampoline: | 43 | BootloaderAPI_ReadSignature_Trampoline: |
| 44 | jmp BootloaderAPI_ReadSignature | 44 | jmp BootloaderAPI_ReadSignature |
| 45 | BootloaderAPI_ReadFuse_Trampoline: | 45 | BootloaderAPI_ReadFuse_Trampoline: |
| 46 | jmp BootloaderAPI_ReadFuse | 46 | jmp BootloaderAPI_ReadFuse |
| 47 | BootloaderAPI_ReadLock_Trampoline: | 47 | BootloaderAPI_ReadLock_Trampoline: |
| 48 | jmp BootloaderAPI_ReadLock | 48 | jmp BootloaderAPI_ReadLock |
| 49 | BootloaderAPI_WriteLock_Trampoline: | 49 | BootloaderAPI_WriteLock_Trampoline: |
| 50 | jmp BootloaderAPI_WriteLock | 50 | jmp BootloaderAPI_WriteLock |
| 51 | BootloaderAPI_UNUSED1: | 51 | BootloaderAPI_UNUSED1: |
| 52 | ret | 52 | ret |
| 53 | BootloaderAPI_UNUSED2: | 53 | BootloaderAPI_UNUSED2: |
| 54 | ret | 54 | ret |
| 55 | BootloaderAPI_UNUSED3: | 55 | BootloaderAPI_UNUSED3: |
| 56 | ret | 56 | ret |
| 57 | BootloaderAPI_UNUSED4: | 57 | BootloaderAPI_UNUSED4: |
| 58 | ret | 58 | ret |
| 59 | BootloaderAPI_UNUSED5: | 59 | BootloaderAPI_UNUSED5: |
| 60 | ret | 60 | ret |
| 61 | 61 | ||
| 62 | 62 | ||
| 63 | 63 | ||
| 64 | ; API function jump table | 64 | ; API function jump table |
| 65 | .section .apitable_jumptable, "ax" | 65 | .section .apitable_jumptable, "ax" |
| 66 | .global BootloaderAPI_JumpTable | 66 | .global BootloaderAPI_JumpTable |
| 67 | BootloaderAPI_JumpTable: | 67 | BootloaderAPI_JumpTable: |
| 68 | 68 | ||
| 69 | rjmp BootloaderAPI_ErasePage_Trampoline | 69 | rjmp BootloaderAPI_ErasePage_Trampoline |
| 70 | rjmp BootloaderAPI_WritePage_Trampoline | 70 | rjmp BootloaderAPI_WritePage_Trampoline |
| 71 | rjmp BootloaderAPI_FillWord_Trampoline | 71 | rjmp BootloaderAPI_FillWord_Trampoline |
| 72 | rjmp BootloaderAPI_ReadSignature_Trampoline | 72 | rjmp BootloaderAPI_ReadSignature_Trampoline |
| 73 | rjmp BootloaderAPI_ReadFuse_Trampoline | 73 | rjmp BootloaderAPI_ReadFuse_Trampoline |
| 74 | rjmp BootloaderAPI_ReadLock_Trampoline | 74 | rjmp BootloaderAPI_ReadLock_Trampoline |
| 75 | rjmp BootloaderAPI_WriteLock_Trampoline | 75 | rjmp BootloaderAPI_WriteLock_Trampoline |
| 76 | rjmp BootloaderAPI_UNUSED1 ; UNUSED ENTRY 1 | 76 | rjmp BootloaderAPI_UNUSED1 ; UNUSED ENTRY 1 |
| 77 | rjmp BootloaderAPI_UNUSED2 ; UNUSED ENTRY 2 | 77 | rjmp BootloaderAPI_UNUSED2 ; UNUSED ENTRY 2 |
| 78 | rjmp BootloaderAPI_UNUSED3 ; UNUSED ENTRY 3 | 78 | rjmp BootloaderAPI_UNUSED3 ; UNUSED ENTRY 3 |
| 79 | rjmp BootloaderAPI_UNUSED4 ; UNUSED ENTRY 4 | 79 | rjmp BootloaderAPI_UNUSED4 ; UNUSED ENTRY 4 |
| 80 | rjmp BootloaderAPI_UNUSED5 ; UNUSED ENTRY 5 | 80 | rjmp BootloaderAPI_UNUSED5 ; UNUSED ENTRY 5 |
| 81 | 81 | ||
| 82 | 82 | ||
| 83 | 83 | ||
| 84 | ; Bootloader table signatures and information | 84 | ; Bootloader table signatures and information |
| 85 | .section .apitable_signatures, "ax" | 85 | .section .apitable_signatures, "ax" |
| 86 | .global BootloaderAPI_Signatures | 86 | .global BootloaderAPI_Signatures |
| 87 | BootloaderAPI_Signatures: | 87 | BootloaderAPI_Signatures: |
| 88 | 88 | ||
| 89 | .long BOOT_START_ADDR ; Start address of the bootloader | 89 | .long BOOT_START_ADDR ; Start address of the bootloader |
| 90 | .word 0xDF20 ; Signature for the Printer class bootloader | 90 | .word 0xDF20 ; Signature for the Printer class bootloader |
| 91 | .word 0xDCFB ; Signature for a LUFA class bootloader | 91 | .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 @@ | |||
| 1 | # | 1 | # |
| 2 | # LUFA Library | 2 | # LUFA Library |
| 3 | # Copyright (C) Dean Camera, 2017. | 3 | # Copyright (C) Dean Camera, 2017. |
| 4 | # | 4 | # |
| 5 | # dean [at] fourwalledcubicle [dot] com | 5 | # dean [at] fourwalledcubicle [dot] com |
| 6 | # www.lufa-lib.org | 6 | # www.lufa-lib.org |
| 7 | # | 7 | # |
| 8 | # -------------------------------------- | 8 | # -------------------------------------- |
| 9 | # LUFA Project Makefile. | 9 | # LUFA Project Makefile. |
| 10 | # -------------------------------------- | 10 | # -------------------------------------- |
| 11 | 11 | ||
| 12 | # Run "make help" for target help. | 12 | # Run "make help" for target help. |
| 13 | 13 | ||
| 14 | MCU = at90usb1287 | 14 | MCU = at90usb1287 |
| 15 | ARCH = AVR8 | 15 | ARCH = AVR8 |
| 16 | BOARD = USBKEY | 16 | BOARD = USBKEY |
| 17 | F_CPU = 8000000 | 17 | F_CPU = 8000000 |
| 18 | F_USB = $(F_CPU) | 18 | F_USB = $(F_CPU) |
| 19 | OPTIMIZATION = s | 19 | OPTIMIZATION = s |
| 20 | TARGET = BootloaderPrinter | 20 | TARGET = BootloaderPrinter |
| 21 | SRC = $(TARGET).c Descriptors.c BootloaderAPI.c BootloaderAPITable.S $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) | 21 | SRC = $(TARGET).c Descriptors.c BootloaderAPI.c BootloaderAPITable.S $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS) |
| 22 | LUFA_PATH = ../../LUFA | 22 | LUFA_PATH = ../../LUFA |
| 23 | CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=$(BOOT_START_OFFSET) | 23 | CC_FLAGS = -DUSE_LUFA_CONFIG_HEADER -IConfig/ -DBOOT_START_ADDR=$(BOOT_START_OFFSET) |
| 24 | LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET) $(BOOT_API_LD_FLAGS) | 24 | LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET) $(BOOT_API_LD_FLAGS) |
| 25 | 25 | ||
| 26 | # Flash size and bootloader section sizes of the target, in KB. These must | 26 | # Flash size and bootloader section sizes of the target, in KB. These must |
| 27 | # match the target's total FLASH size and the bootloader size set in the | 27 | # match the target's total FLASH size and the bootloader size set in the |
| 28 | # device's fuses. | 28 | # device's fuses. |
| 29 | FLASH_SIZE_KB = 128 | 29 | FLASH_SIZE_KB = 128 |
| 30 | BOOT_SECTION_SIZE_KB = 8 | 30 | BOOT_SECTION_SIZE_KB = 8 |
| 31 | 31 | ||
| 32 | # Bootloader address calculation formulas | 32 | # Bootloader address calculation formulas |
| 33 | # Do not modify these macros, but rather modify the dependent values above. | 33 | # Do not modify these macros, but rather modify the dependent values above. |
| 34 | CALC_ADDRESS_IN_HEX = $(shell printf "0x%X" $$(( $(1) )) ) | 34 | CALC_ADDRESS_IN_HEX = $(shell printf "0x%X" $$(( $(1) )) ) |
| 35 | BOOT_START_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024 ) | 35 | BOOT_START_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) - $(BOOT_SECTION_SIZE_KB)) * 1024 ) |
| 36 | BOOT_SEC_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) * 1024) - ($(strip $(1))) ) | 36 | BOOT_SEC_OFFSET = $(call CALC_ADDRESS_IN_HEX, ($(FLASH_SIZE_KB) * 1024) - ($(strip $(1))) ) |
| 37 | 37 | ||
| 38 | # Bootloader linker section flags for relocating the API table sections to | 38 | # Bootloader linker section flags for relocating the API table sections to |
| 39 | # known FLASH addresses - these should not normally be user-edited. | 39 | # known FLASH addresses - these should not normally be user-edited. |
| 40 | BOOT_SECTION_LD_FLAG = -Wl,--section-start=$(strip $(1))=$(call BOOT_SEC_OFFSET, $(3)) -Wl,--undefined=$(strip $(2)) | 40 | BOOT_SECTION_LD_FLAG = -Wl,--section-start=$(strip $(1))=$(call BOOT_SEC_OFFSET, $(3)) -Wl,--undefined=$(strip $(2)) |
| 41 | BOOT_API_LD_FLAGS = $(call BOOT_SECTION_LD_FLAG, .apitable_trampolines, BootloaderAPI_Trampolines, 96) | 41 | BOOT_API_LD_FLAGS = $(call BOOT_SECTION_LD_FLAG, .apitable_trampolines, BootloaderAPI_Trampolines, 96) |
| 42 | BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_jumptable, BootloaderAPI_JumpTable, 32) | 42 | BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_jumptable, BootloaderAPI_JumpTable, 32) |
| 43 | BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_signatures, BootloaderAPI_Signatures, 8) | 43 | BOOT_API_LD_FLAGS += $(call BOOT_SECTION_LD_FLAG, .apitable_signatures, BootloaderAPI_Signatures, 8) |
| 44 | 44 | ||
| 45 | # Default target | 45 | # Default target |
| 46 | all: | 46 | all: |
| 47 | 47 | ||
| 48 | # Include LUFA-specific DMBS extension modules | 48 | # Include LUFA-specific DMBS extension modules |
| 49 | DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA | 49 | DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA |
| 50 | include $(DMBS_LUFA_PATH)/lufa-sources.mk | 50 | include $(DMBS_LUFA_PATH)/lufa-sources.mk |
| 51 | include $(DMBS_LUFA_PATH)/lufa-gcc.mk | 51 | include $(DMBS_LUFA_PATH)/lufa-gcc.mk |
| 52 | 52 | ||
| 53 | # Include common DMBS build system modules | 53 | # Include common DMBS build system modules |
| 54 | DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS | 54 | DMBS_PATH ?= $(LUFA_PATH)/Build/DMBS/DMBS |
| 55 | include $(DMBS_PATH)/core.mk | 55 | include $(DMBS_PATH)/core.mk |
| 56 | include $(DMBS_PATH)/cppcheck.mk | 56 | include $(DMBS_PATH)/cppcheck.mk |
| 57 | include $(DMBS_PATH)/doxygen.mk | 57 | include $(DMBS_PATH)/doxygen.mk |
| 58 | include $(DMBS_PATH)/dfu.mk | 58 | include $(DMBS_PATH)/dfu.mk |
| 59 | include $(DMBS_PATH)/gcc.mk | 59 | include $(DMBS_PATH)/gcc.mk |
| 60 | include $(DMBS_PATH)/hid.mk | 60 | include $(DMBS_PATH)/hid.mk |
| 61 | include $(DMBS_PATH)/avrdude.mk | 61 | include $(DMBS_PATH)/avrdude.mk |
| 62 | include $(DMBS_PATH)/atprogram.mk | 62 | 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 @@ | |||
| 1 | <!-- | 1 | <!-- |
| 2 | LUFA Library | 2 | LUFA Library |
| 3 | Copyright (C) Dean Camera, 2017. | 3 | Copyright (C) Dean Camera, 2017. |
| 4 | 4 | ||
| 5 | dean [at] fourwalledcubicle [dot] com | 5 | dean [at] fourwalledcubicle [dot] com |
| 6 | www.lufa-lib.org | 6 | www.lufa-lib.org |
| 7 | --> | 7 | --> |
| 8 | 8 | ||
| 9 | <!-- Docbook XML to Microsoft Help Viewer 1.0 transform file --> | 9 | <!-- Docbook XML to Microsoft Help Viewer 1.0 transform file --> |
| 10 | 10 | ||
| 11 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | 11 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
| 12 | 12 | ||
| 13 | <xsl:import href="../Docbook/mshelp/docbook.xsl"/> | 13 | <xsl:import href="../Docbook/mshelp/docbook.xsl"/> |
| 14 | 14 | ||
| 15 | <xsl:output method="xml" indent="no"/> | 15 | <xsl:output method="xml" indent="no"/> |
| 16 | 16 | ||
| 17 | <xsl:template match="emphasis[@role = 'keyword' or @role = 'keywordtype' or @role = 'keywordflow']"> | 17 | <xsl:template match="emphasis[@role = 'keyword' or @role = 'keywordtype' or @role = 'keywordflow']"> |
| 18 | <span class="hl-keyword" style="color: #0079C1"> | 18 | <span class="hl-keyword" style="color: #0079C1"> |
| 19 | <xsl:apply-templates/> | 19 | <xsl:apply-templates/> |
| 20 | </span> | 20 | </span> |
| 21 | </xsl:template> | 21 | </xsl:template> |
| 22 | 22 | ||
| 23 | <xsl:template match="emphasis[@role = 'stringliteral' or @role = 'charliteral']"> | 23 | <xsl:template match="emphasis[@role = 'stringliteral' or @role = 'charliteral']"> |
| 24 | <span class="hl-string" style="color: #800000"> | 24 | <span class="hl-string" style="color: #800000"> |
| 25 | <xsl:apply-templates/> | 25 | <xsl:apply-templates/> |
| 26 | </span> | 26 | </span> |
| 27 | </xsl:template> | 27 | </xsl:template> |
| 28 | 28 | ||
| 29 | <xsl:template match="emphasis[@role = 'comment']"> | 29 | <xsl:template match="emphasis[@role = 'comment']"> |
| 30 | <em class="hl-comment" style="color: #008000"> | 30 | <em class="hl-comment" style="color: #008000"> |
| 31 | <xsl:apply-templates/> | 31 | <xsl:apply-templates/> |
| 32 | </em> | 32 | </em> |
| 33 | </xsl:template> | 33 | </xsl:template> |
| 34 | 34 | ||
| 35 | <xsl:template match="emphasis[@role = 'preprocessor']"> | 35 | <xsl:template match="emphasis[@role = 'preprocessor']"> |
| 36 | <span class="hl-preprocessor" style="color: #A000A0"> | 36 | <span class="hl-preprocessor" style="color: #A000A0"> |
| 37 | <xsl:apply-templates/> | 37 | <xsl:apply-templates/> |
| 38 | </span> | 38 | </span> |
| 39 | </xsl:template> | 39 | </xsl:template> |
| 40 | 40 | ||
| 41 | <xsl:template match="emphasis[@role = 'normal' and ancestor::programlisting]"> | 41 | <xsl:template match="emphasis[@role = 'normal' and ancestor::programlisting]"> |
| 42 | <xsl:apply-templates /> | 42 | <xsl:apply-templates /> |
| 43 | </xsl:template> | 43 | </xsl:template> |
| 44 | 44 | ||
| 45 | </xsl:stylesheet> | 45 | </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 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | 2 | ||
| 3 | <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"> | 3 | <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"> |
| 4 | <Identifier Id="FourWalledCubicle.LUFA.0e160d5c-e331-48d9-850b-e0387912171b"> | 4 | <Identifier Id="FourWalledCubicle.LUFA.0e160d5c-e331-48d9-850b-e0387912171b"> |
| 5 | <Name>LUFA Library</Name> | 5 | <Name>LUFA Library</Name> |
| 6 | <Author>Dean Camera</Author> | 6 | <Author>Dean Camera</Author> |
| 7 | <Version>0</Version> | 7 | <Version>0</Version> |
| 8 | <MoreInfoUrl>http://www.lufa-lib.org</MoreInfoUrl> | 8 | <MoreInfoUrl>http://www.lufa-lib.org</MoreInfoUrl> |
| 9 | <Description xml:space="preserve">LUFA, the Lightweight USB Framework for AVRs.</Description> | 9 | <Description xml:space="preserve">LUFA, the Lightweight USB Framework for AVRs.</Description> |
| 10 | 10 | ||
| 11 | <License>License.txt</License> | 11 | <License>License.txt</License> |
| 12 | <Icon>LUFA_thumb.png</Icon> | 12 | <Icon>LUFA_thumb.png</Icon> |
| 13 | <PreviewImage>LUFA.png</PreviewImage> | 13 | <PreviewImage>LUFA.png</PreviewImage> |
| 14 | 14 | ||
| 15 | <SupportedProducts> | 15 | <SupportedProducts> |
| 16 | <IsolatedShell Version="7.0">AtmelStudio</IsolatedShell> | 16 | <IsolatedShell Version="7.0">AtmelStudio</IsolatedShell> |
| 17 | </SupportedProducts> | 17 | </SupportedProducts> |
| 18 | 18 | ||
| 19 | <SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.5"/> | 19 | <SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.5"/> |
| 20 | <Locale>1033</Locale> | 20 | <Locale>1033</Locale> |
| 21 | 21 | ||
| 22 | <AllUsers>false</AllUsers> | 22 | <AllUsers>false</AllUsers> |
| 23 | </Identifier> | 23 | </Identifier> |
| 24 | 24 | ||
| 25 | <References/> | 25 | <References/> |
| 26 | 26 | ||
| 27 | <Content> | 27 | <Content> |
| 28 | <VsPackage>LUFA.pkgdef</VsPackage> | 28 | <VsPackage>LUFA.pkgdef</VsPackage> |
| 29 | <CustomExtension Type="MSHelp">helpcontentsetup.msha</CustomExtension> | 29 | <CustomExtension Type="MSHelp">helpcontentsetup.msha</CustomExtension> |
| 30 | <CustomExtension Type="asf-manifest">asf-manifest.xml</CustomExtension> | 30 | <CustomExtension Type="asf-manifest">asf-manifest.xml</CustomExtension> |
| 31 | </Content> | 31 | </Content> |
| 32 | </Vsix> | 32 | </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 @@ | |||
| 61 | #include <stdint.h> | 61 | #include <stdint.h> |
| 62 | #include <stdbool.h> | 62 | #include <stdbool.h> |
| 63 | #include "eeconfig.h" | 63 | #include "eeconfig.h" |
| 64 | #include "light_ws2812.h" | 64 | #include "ws2812.h" |
| 65 | 65 | ||
| 66 | extern LED_TYPE led[RGBLED_NUM]; | 66 | extern LED_TYPE led[RGBLED_NUM]; |
| 67 | 67 | ||
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 @@ | |||
| 1 | /** | ||
| 2 | * This file has a different license to the rest of the uGFX system. | ||
| 3 | * You can copy, modify and distribute this file as you see fit. | ||
| 4 | * You do not need to publish your source modifications to this file. | ||
| 5 | * The only thing you are not permitted to do is to relicense it | ||
| 6 | * under a different license. | ||
| 7 | */ | ||
| 8 | |||
| 9 | /** | ||
| 10 | * Copy this file into your project directory and rename it as gfxconf.h | ||
| 11 | * Edit your copy to turn on the uGFX features you want to use. | ||
| 12 | * The values below are the defaults. | ||
| 13 | * | ||
| 14 | * Only remove the comments from lines where you want to change the | ||
| 15 | * default value. This allows definitions to be included from | ||
| 16 | * driver makefiles when required and provides the best future | ||
| 17 | * compatibility for your project. | ||
| 18 | * | ||
| 19 | * Please use spaces instead of tabs in this file. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #ifndef COMMON_GFXCONF_H | ||
| 23 | #define COMMON_GFXCONF_H | ||
| 24 | |||
| 25 | |||
| 26 | /////////////////////////////////////////////////////////////////////////// | ||
| 27 | // GOS - One of these must be defined, preferably in your Makefile // | ||
| 28 | /////////////////////////////////////////////////////////////////////////// | ||
| 29 | //#define GFX_USE_OS_CHIBIOS TRUE | ||
| 30 | //#define GFX_USE_OS_FREERTOS FALSE | ||
| 31 | // #define GFX_FREERTOS_USE_TRACE FALSE | ||
| 32 | //#define GFX_USE_OS_WIN32 FALSE | ||
| 33 | //#define GFX_USE_OS_LINUX FALSE | ||
| 34 | //#define GFX_USE_OS_OSX FALSE | ||
| 35 | //#define GFX_USE_OS_ECOS FALSE | ||
| 36 | //#define GFX_USE_OS_RAWRTOS FALSE | ||
| 37 | //#define GFX_USE_OS_ARDUINO FALSE | ||
| 38 | //#define GFX_USE_OS_KEIL FALSE | ||
| 39 | //#define GFX_USE_OS_CMSIS FALSE | ||
| 40 | //#define GFX_USE_OS_RAW32 FALSE | ||
| 41 | // #define INTERRUPTS_OFF() optional_code | ||
| 42 | // #define INTERRUPTS_ON() optional_code | ||
| 43 | // These are not defined by default for some reason | ||
| 44 | #define GOS_NEED_X_THREADS FALSE | ||
| 45 | #define GOS_NEED_X_HEAP FALSE | ||
| 46 | |||
| 47 | // Options that (should where relevant) apply to all operating systems | ||
| 48 | #define GFX_NO_INLINE FALSE | ||
| 49 | // #define GFX_COMPILER GFX_COMPILER_UNKNOWN | ||
| 50 | // #define GFX_CPU GFX_CPU_UNKNOWN | ||
| 51 | // #define GFX_OS_HEAP_SIZE 0 | ||
| 52 | // #define GFX_OS_NO_INIT FALSE | ||
| 53 | // #define GFX_OS_INIT_NO_WARNING FALSE | ||
| 54 | // #define GFX_OS_PRE_INIT_FUNCTION myHardwareInitRoutine | ||
| 55 | // #define GFX_OS_EXTRA_INIT_FUNCTION myOSInitRoutine | ||
| 56 | // #define GFX_OS_EXTRA_DEINIT_FUNCTION myOSDeInitRoutine | ||
| 57 | |||
| 58 | |||
| 59 | /////////////////////////////////////////////////////////////////////////// | ||
| 60 | // GDISP // | ||
| 61 | /////////////////////////////////////////////////////////////////////////// | ||
| 62 | #define GFX_USE_GDISP TRUE | ||
| 63 | |||
| 64 | //#define GDISP_NEED_AUTOFLUSH FALSE | ||
| 65 | //#define GDISP_NEED_TIMERFLUSH FALSE | ||
| 66 | //#define GDISP_NEED_VALIDATION TRUE | ||
| 67 | //#define GDISP_NEED_CLIP TRUE | ||
| 68 | #define GDISP_NEED_CIRCLE TRUE | ||
| 69 | #define GDISP_NEED_ELLIPSE TRUE | ||
| 70 | #define GDISP_NEED_ARC TRUE | ||
| 71 | #define GDISP_NEED_ARCSECTORS TRUE | ||
| 72 | #define GDISP_NEED_CONVEX_POLYGON TRUE | ||
| 73 | //#define GDISP_NEED_SCROLL FALSE | ||
| 74 | #define GDISP_NEED_PIXELREAD TRUE | ||
| 75 | #define GDISP_NEED_CONTROL TRUE | ||
| 76 | //#define GDISP_NEED_QUERY FALSE | ||
| 77 | //#define GDISP_NEED_MULTITHREAD FALSE | ||
| 78 | //#define GDISP_NEED_STREAMING FALSE | ||
| 79 | #define GDISP_NEED_TEXT TRUE | ||
| 80 | // #define GDISP_NEED_TEXT_WORDWRAP FALSE | ||
| 81 | // #define GDISP_NEED_ANTIALIAS FALSE | ||
| 82 | // #define GDISP_NEED_UTF8 FALSE | ||
| 83 | #define GDISP_NEED_TEXT_KERNING TRUE | ||
| 84 | // #define GDISP_INCLUDE_FONT_UI1 FALSE | ||
| 85 | // #define GDISP_INCLUDE_FONT_UI2 FALSE // The smallest preferred font. | ||
| 86 | // #define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE | ||
| 87 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE | ||
| 88 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE | ||
| 89 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE | ||
| 90 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS20 FALSE | ||
| 91 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE | ||
| 92 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE | ||
| 93 | #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 TRUE | ||
| 94 | // #define GDISP_INCLUDE_FONT_FIXED_10X20 FALSE | ||
| 95 | // #define GDISP_INCLUDE_FONT_FIXED_7X14 FALSE | ||
| 96 | #define GDISP_INCLUDE_FONT_FIXED_5X8 TRUE | ||
| 97 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE | ||
| 98 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE | ||
| 99 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS20_AA FALSE | ||
| 100 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE | ||
| 101 | // #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE | ||
| 102 | // #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE | ||
| 103 | // #define GDISP_INCLUDE_USER_FONTS FALSE | ||
| 104 | |||
| 105 | //#define GDISP_NEED_IMAGE FALSE | ||
| 106 | // #define GDISP_NEED_IMAGE_NATIVE FALSE | ||
| 107 | // #define GDISP_NEED_IMAGE_GIF FALSE | ||
| 108 | // #define GDISP_NEED_IMAGE_BMP FALSE | ||
| 109 | // #define GDISP_NEED_IMAGE_BMP_1 FALSE | ||
| 110 | // #define GDISP_NEED_IMAGE_BMP_4 FALSE | ||
| 111 | // #define GDISP_NEED_IMAGE_BMP_4_RLE FALSE | ||
| 112 | // #define GDISP_NEED_IMAGE_BMP_8 FALSE | ||
| 113 | // #define GDISP_NEED_IMAGE_BMP_8_RLE FALSE | ||
| 114 | // #define GDISP_NEED_IMAGE_BMP_16 FALSE | ||
| 115 | // #define GDISP_NEED_IMAGE_BMP_24 FALSE | ||
| 116 | // #define GDISP_NEED_IMAGE_BMP_32 FALSE | ||
| 117 | // #define GDISP_NEED_IMAGE_JPG FALSE | ||
| 118 | // #define GDISP_NEED_IMAGE_PNG FALSE | ||
| 119 | // #define GDISP_NEED_IMAGE_ACCOUNTING FALSE | ||
| 120 | #ifdef EMULATOR | ||
| 121 | #define GDISP_NEED_PIXMAP TRUE | ||
| 122 | #endif | ||
| 123 | // #define GDISP_NEED_PIXMAP_IMAGE FALSE | ||
| 124 | |||
| 125 | //#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE // If not defined the native hardware orientation is used. | ||
| 126 | //#define GDISP_LINEBUF_SIZE 128 | ||
| 127 | //#define GDISP_STARTUP_COLOR Black | ||
| 128 | #define GDISP_NEED_STARTUP_LOGO FALSE | ||
| 129 | |||
| 130 | //#define GDISP_TOTAL_DISPLAYS 2 | ||
| 131 | |||
| 132 | #ifdef GDISP_DRIVER_LIST | ||
| 133 | // For code and speed optimization define as TRUE or FALSE if all controllers have the same capability | ||
| 134 | #define GDISP_HARDWARE_STREAM_WRITE FALSE | ||
| 135 | #define GDISP_HARDWARE_STREAM_READ FALSE | ||
| 136 | #define GDISP_HARDWARE_STREAM_POS FALSE | ||
| 137 | #define GDISP_HARDWARE_DRAWPIXEL TRUE | ||
| 138 | #define GDISP_HARDWARE_CLEARS FALSE | ||
| 139 | #define GDISP_HARDWARE_FILLS FALSE | ||
| 140 | //#define GDISP_HARDWARE_BITFILLS FALSE | ||
| 141 | #define GDISP_HARDWARE_SCROLL FALSE | ||
| 142 | #define GDISP_HARDWARE_PIXELREAD TRUE | ||
| 143 | #define GDISP_HARDWARE_CONTROL TRUE | ||
| 144 | #define GDISP_HARDWARE_QUERY FALSE | ||
| 145 | #define GDISP_HARDWARE_CLIP FALSE | ||
| 146 | |||
| 147 | #define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888 | ||
| 148 | #endif | ||
| 149 | |||
| 150 | // The custom format is not defined for some reason, so define it as error | ||
| 151 | // so we don't get compiler warnings | ||
| 152 | #define GDISP_PIXELFORMAT_CUSTOM GDISP_PIXELFORMAT_ERROR | ||
| 153 | |||
| 154 | #define GDISP_USE_GFXNET FALSE | ||
| 155 | // #define GDISP_GFXNET_PORT 13001 | ||
| 156 | // #define GDISP_GFXNET_CUSTOM_LWIP_STARTUP FALSE | ||
| 157 | // #define GDISP_DONT_WAIT_FOR_NET_DISPLAY FALSE | ||
| 158 | // #define GDISP_GFXNET_UNSAFE_SOCKETS FALSE | ||
| 159 | |||
| 160 | |||
| 161 | /////////////////////////////////////////////////////////////////////////// | ||
| 162 | // GWIN // | ||
| 163 | /////////////////////////////////////////////////////////////////////////// | ||
| 164 | #define GFX_USE_GWIN FALSE | ||
| 165 | |||
| 166 | //#define GWIN_NEED_WINDOWMANAGER FALSE | ||
| 167 | // #define GWIN_REDRAW_IMMEDIATE FALSE | ||
| 168 | // #define GWIN_REDRAW_SINGLEOP FALSE | ||
| 169 | // #define GWIN_NEED_FLASHING FALSE | ||
| 170 | // #define GWIN_FLASHING_PERIOD 250 | ||
| 171 | |||
| 172 | //#define GWIN_NEED_CONSOLE FALSE | ||
| 173 | // #define GWIN_CONSOLE_USE_HISTORY FALSE | ||
| 174 | // #define GWIN_CONSOLE_HISTORY_AVERAGING FALSE | ||
| 175 | // #define GWIN_CONSOLE_HISTORY_ATCREATE FALSE | ||
| 176 | // #define GWIN_CONSOLE_ESCSEQ FALSE | ||
| 177 | // #define GWIN_CONSOLE_USE_BASESTREAM FALSE | ||
| 178 | // #define GWIN_CONSOLE_USE_FLOAT FALSE | ||
| 179 | //#define GWIN_NEED_GRAPH FALSE | ||
| 180 | //#define GWIN_NEED_GL3D FALSE | ||
| 181 | |||
| 182 | //#define GWIN_NEED_WIDGET FALSE | ||
| 183 | //#define GWIN_FOCUS_HIGHLIGHT_WIDTH 1 | ||
| 184 | // #define GWIN_NEED_LABEL FALSE | ||
| 185 | // #define GWIN_LABEL_ATTRIBUTE FALSE | ||
| 186 | // #define GWIN_NEED_BUTTON FALSE | ||
| 187 | // #define GWIN_BUTTON_LAZY_RELEASE FALSE | ||
| 188 | // #define GWIN_NEED_SLIDER FALSE | ||
| 189 | // #define GWIN_SLIDER_NOSNAP FALSE | ||
| 190 | // #define GWIN_SLIDER_DEAD_BAND 5 | ||
| 191 | // #define GWIN_SLIDER_TOGGLE_INC 20 | ||
| 192 | // #define GWIN_NEED_CHECKBOX FALSE | ||
| 193 | // #define GWIN_NEED_IMAGE FALSE | ||
| 194 | // #define GWIN_NEED_IMAGE_ANIMATION FALSE | ||
| 195 | // #define GWIN_NEED_RADIO FALSE | ||
| 196 | // #define GWIN_NEED_LIST FALSE | ||
| 197 | // #define GWIN_NEED_LIST_IMAGES FALSE | ||
| 198 | // #define GWIN_NEED_PROGRESSBAR FALSE | ||
| 199 | // #define GWIN_PROGRESSBAR_AUTO FALSE | ||
| 200 | // #define GWIN_NEED_KEYBOARD FALSE | ||
| 201 | // #define GWIN_KEYBOARD_DEFAULT_LAYOUT VirtualKeyboard_English1 | ||
| 202 | // #define GWIN_NEED_KEYBOARD_ENGLISH1 TRUE | ||
| 203 | // #define GWIN_NEED_TEXTEDIT FALSE | ||
| 204 | // #define GWIN_FLAT_STYLING FALSE | ||
| 205 | // #define GWIN_WIDGET_TAGS FALSE | ||
| 206 | |||
| 207 | //#define GWIN_NEED_CONTAINERS FALSE | ||
| 208 | // #define GWIN_NEED_CONTAINER FALSE | ||
| 209 | // #define GWIN_NEED_FRAME FALSE | ||
| 210 | // #define GWIN_NEED_TABSET FALSE | ||
| 211 | // #define GWIN_TABSET_TABHEIGHT 18 | ||
| 212 | |||
| 213 | |||
| 214 | /////////////////////////////////////////////////////////////////////////// | ||
| 215 | // GEVENT // | ||
| 216 | /////////////////////////////////////////////////////////////////////////// | ||
| 217 | #define GFX_USE_GEVENT TRUE | ||
| 218 | |||
| 219 | //#define GEVENT_ASSERT_NO_RESOURCE FALSE | ||
| 220 | //#define GEVENT_MAXIMUM_SIZE 32 | ||
| 221 | //#define GEVENT_MAX_SOURCE_LISTENERS 32 | ||
| 222 | |||
| 223 | |||
| 224 | /////////////////////////////////////////////////////////////////////////// | ||
| 225 | // GTIMER // | ||
| 226 | /////////////////////////////////////////////////////////////////////////// | ||
| 227 | #define GFX_USE_GTIMER FALSE | ||
| 228 | |||
| 229 | //#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY | ||
| 230 | //#define GTIMER_THREAD_WORKAREA_SIZE 2048 | ||
| 231 | |||
| 232 | |||
| 233 | /////////////////////////////////////////////////////////////////////////// | ||
| 234 | // GQUEUE // | ||
| 235 | /////////////////////////////////////////////////////////////////////////// | ||
| 236 | #define GFX_USE_GQUEUE FALSE | ||
| 237 | |||
| 238 | //#define GQUEUE_NEED_ASYNC FALSE | ||
| 239 | //#define GQUEUE_NEED_GSYNC FALSE | ||
| 240 | //#define GQUEUE_NEED_FSYNC FALSE | ||
| 241 | //#define GQUEUE_NEED_BUFFERS FALSE | ||
| 242 | |||
| 243 | /////////////////////////////////////////////////////////////////////////// | ||
| 244 | // GINPUT // | ||
| 245 | /////////////////////////////////////////////////////////////////////////// | ||
| 246 | #define GFX_USE_GINPUT FALSE | ||
| 247 | |||
| 248 | //#define GINPUT_NEED_MOUSE FALSE | ||
| 249 | // #define GINPUT_TOUCH_STARTRAW FALSE | ||
| 250 | // #define GINPUT_TOUCH_NOTOUCH FALSE | ||
| 251 | // #define GINPUT_TOUCH_NOCALIBRATE FALSE | ||
| 252 | // #define GINPUT_TOUCH_NOCALIBRATE_GUI FALSE | ||
| 253 | // #define GINPUT_MOUSE_POLL_PERIOD 25 | ||
| 254 | // #define GINPUT_MOUSE_CLICK_TIME 300 | ||
| 255 | // #define GINPUT_TOUCH_CXTCLICK_TIME 700 | ||
| 256 | // #define GINPUT_TOUCH_USER_CALIBRATION_LOAD FALSE | ||
| 257 | // #define GINPUT_TOUCH_USER_CALIBRATION_SAVE FALSE | ||
| 258 | // #define GMOUSE_DRIVER_LIST GMOUSEVMT_Win32, GMOUSEVMT_Win32 | ||
| 259 | //#define GINPUT_NEED_KEYBOARD FALSE | ||
| 260 | // #define GINPUT_KEYBOARD_POLL_PERIOD 200 | ||
| 261 | // #define GKEYBOARD_DRIVER_LIST GKEYBOARDVMT_Win32, GKEYBOARDVMT_Win32 | ||
| 262 | // #define GKEYBOARD_LAYOUT_OFF FALSE | ||
| 263 | // #define GKEYBOARD_LAYOUT_SCANCODE2_US FALSE | ||
| 264 | //#define GINPUT_NEED_TOGGLE FALSE | ||
| 265 | //#define GINPUT_NEED_DIAL FALSE | ||
| 266 | |||
| 267 | |||
| 268 | /////////////////////////////////////////////////////////////////////////// | ||
| 269 | // GFILE // | ||
| 270 | /////////////////////////////////////////////////////////////////////////// | ||
| 271 | #define GFX_USE_GFILE FALSE | ||
| 272 | |||
| 273 | //#define GFILE_NEED_PRINTG FALSE | ||
| 274 | //#define GFILE_NEED_SCANG FALSE | ||
| 275 | //#define GFILE_NEED_STRINGS FALSE | ||
| 276 | //#define GFILE_NEED_FILELISTS FALSE | ||
| 277 | //#define GFILE_NEED_STDIO FALSE | ||
| 278 | //#define GFILE_NEED_NOAUTOMOUNT FALSE | ||
| 279 | //#define GFILE_NEED_NOAUTOSYNC FALSE | ||
| 280 | |||
| 281 | //#define GFILE_NEED_MEMFS FALSE | ||
| 282 | //#define GFILE_NEED_ROMFS FALSE | ||
| 283 | //#define GFILE_NEED_RAMFS FALSE | ||
| 284 | //#define GFILE_NEED_FATFS FALSE | ||
| 285 | //#define GFILE_NEED_NATIVEFS FALSE | ||
| 286 | //#define GFILE_NEED_CHBIOSFS FALSE | ||
| 287 | |||
| 288 | //#define GFILE_ALLOW_FLOATS FALSE | ||
| 289 | //#define GFILE_ALLOW_DEVICESPECIFIC FALSE | ||
| 290 | //#define GFILE_MAX_GFILES 3 | ||
| 291 | |||
| 292 | /////////////////////////////////////////////////////////////////////////// | ||
| 293 | // GADC // | ||
| 294 | /////////////////////////////////////////////////////////////////////////// | ||
| 295 | #define GFX_USE_GADC FALSE | ||
| 296 | |||
| 297 | //#define GADC_MAX_LOWSPEED_DEVICES 4 | ||
| 298 | |||
| 299 | |||
| 300 | /////////////////////////////////////////////////////////////////////////// | ||
| 301 | // GAUDIO // | ||
| 302 | /////////////////////////////////////////////////////////////////////////// | ||
| 303 | #define GFX_USE_GAUDIO FALSE | ||
| 304 | // There seems to be a bug in the ugfx code, the wrong define is used | ||
| 305 | // So define it in order to avoid warnings | ||
| 306 | #define GFX_USE_GAUDIN GFX_USE_GAUDIO | ||
| 307 | // #define GAUDIO_NEED_PLAY FALSE | ||
| 308 | // #define GAUDIO_NEED_RECORD FALSE | ||
| 309 | |||
| 310 | |||
| 311 | /////////////////////////////////////////////////////////////////////////// | ||
| 312 | // GMISC // | ||
| 313 | /////////////////////////////////////////////////////////////////////////// | ||
| 314 | #define GFX_USE_GMISC TRUE | ||
| 315 | |||
| 316 | //#define GMISC_NEED_ARRAYOPS FALSE | ||
| 317 | //#define GMISC_NEED_FASTTRIG FALSE | ||
| 318 | //#define GMISC_NEED_FIXEDTRIG FALSE | ||
| 319 | //#define GMISC_NEED_INVSQRT FALSE | ||
| 320 | // #define GMISC_INVSQRT_MIXED_ENDIAN FALSE | ||
| 321 | // #define GMISC_INVSQRT_REAL_SLOW FALSE | ||
| 322 | #define GMISC_NEED_MATRIXFLOAT2D TRUE | ||
| 323 | #define GMISC_NEED_MATRIXFIXED2D FALSE | ||
| 324 | |||
| 325 | #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 @@ | |||
| 16 | 16 | ||
| 17 | #if defined(VISUALIZER_ENABLE) | 17 | #if defined(VISUALIZER_ENABLE) |
| 18 | 18 | ||
| 19 | #include "animations.h" | 19 | #include "default_animations.h" |
| 20 | #include "visualizer.h" | 20 | #include "visualizer.h" |
| 21 | #ifdef LCD_ENABLE | 21 | #ifdef LCD_ENABLE |
| 22 | #include "lcd_keyframes.h" | 22 | #include "lcd_keyframes.h" |
| @@ -26,7 +26,7 @@ | |||
| 26 | #endif | 26 | #endif |
| 27 | 27 | ||
| 28 | #ifdef BACKLIGHT_ENABLE | 28 | #ifdef BACKLIGHT_ENABLE |
| 29 | #include "led_keyframes.h" | 29 | #include "led_backlight_keyframes.h" |
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
| 32 | #include "visualizer_keyframes.h" | 32 | #include "visualizer_keyframes.h" |
| @@ -39,10 +39,10 @@ static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* | |||
| 39 | lcd_keyframe_enable(animation, state); | 39 | lcd_keyframe_enable(animation, state); |
| 40 | #endif | 40 | #endif |
| 41 | #ifdef LCD_BACKLIGHT_ENABLE | 41 | #ifdef LCD_BACKLIGHT_ENABLE |
| 42 | backlight_keyframe_enable(animation, state); | 42 | lcd_backlight_keyframe_enable(animation, state); |
| 43 | #endif | 43 | #endif |
| 44 | #ifdef BACKLIGHT_ENABLE | 44 | #ifdef BACKLIGHT_ENABLE |
| 45 | led_keyframe_enable(animation, state); | 45 | led_backlight_keyframe_enable(animation, state); |
| 46 | #endif | 46 | #endif |
| 47 | return false; | 47 | return false; |
| 48 | } | 48 | } |
| @@ -52,10 +52,10 @@ static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t | |||
| 52 | lcd_keyframe_disable(animation, state); | 52 | lcd_keyframe_disable(animation, state); |
| 53 | #endif | 53 | #endif |
| 54 | #ifdef LCD_BACKLIGHT_ENABLE | 54 | #ifdef LCD_BACKLIGHT_ENABLE |
| 55 | backlight_keyframe_disable(animation, state); | 55 | lcd_backlight_keyframe_disable(animation, state); |
| 56 | #endif | 56 | #endif |
| 57 | #ifdef BACKLIGHT_ENABLE | 57 | #ifdef BACKLIGHT_ENABLE |
| 58 | led_keyframe_disable(animation, state); | 58 | led_backlight_keyframe_disable(animation, state); |
| 59 | #endif | 59 | #endif |
| 60 | return false; | 60 | return false; |
| 61 | } | 61 | } |
| @@ -63,10 +63,10 @@ static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t | |||
| 63 | static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) { | 63 | static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 64 | bool ret = false; | 64 | bool ret = false; |
| 65 | #ifdef LCD_BACKLIGHT_ENABLE | 65 | #ifdef LCD_BACKLIGHT_ENABLE |
| 66 | ret |= backlight_keyframe_animate_color(animation, state); | 66 | ret |= lcd_backlight_keyframe_animate_color(animation, state); |
| 67 | #endif | 67 | #endif |
| 68 | #ifdef BACKLIGHT_ENABLE | 68 | #ifdef BACKLIGHT_ENABLE |
| 69 | ret |= led_keyframe_fade_in_all(animation, state); | 69 | ret |= led_backlight_keyframe_fade_in_all(animation, state); |
| 70 | #endif | 70 | #endif |
| 71 | return ret; | 71 | return ret; |
| 72 | } | 72 | } |
| @@ -74,10 +74,10 @@ static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t | |||
| 74 | static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) { | 74 | static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 75 | bool ret = false; | 75 | bool ret = false; |
| 76 | #ifdef LCD_BACKLIGHT_ENABLE | 76 | #ifdef LCD_BACKLIGHT_ENABLE |
| 77 | ret |= backlight_keyframe_animate_color(animation, state); | 77 | ret |= lcd_backlight_keyframe_animate_color(animation, state); |
| 78 | #endif | 78 | #endif |
| 79 | #ifdef BACKLIGHT_ENABLE | 79 | #ifdef BACKLIGHT_ENABLE |
| 80 | ret |= led_keyframe_fade_out_all(animation, state); | 80 | ret |= led_backlight_keyframe_fade_out_all(animation, state); |
| 81 | #endif | 81 | #endif |
| 82 | return ret; | 82 | return ret; |
| 83 | } | 83 | } |
| @@ -86,22 +86,44 @@ static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_ | |||
| 86 | // Don't worry, if the startup animation is long, you can use the keyboard like normal | 86 | // Don't worry, if the startup animation is long, you can use the keyboard like normal |
| 87 | // during that time | 87 | // during that time |
| 88 | keyframe_animation_t default_startup_animation = { | 88 | keyframe_animation_t default_startup_animation = { |
| 89 | #if LCD_ENABLE | ||
| 89 | .num_frames = 3, | 90 | .num_frames = 3, |
| 91 | #else | ||
| 92 | .num_frames = 2, | ||
| 93 | #endif | ||
| 90 | .loop = false, | 94 | .loop = false, |
| 91 | .frame_lengths = {0, 0, gfxMillisecondsToTicks(5000)}, | 95 | .frame_lengths = { |
| 96 | 0, | ||
| 97 | #if LCD_ENABLE | ||
| 98 | 0, | ||
| 99 | #endif | ||
| 100 | gfxMillisecondsToTicks(5000)}, | ||
| 92 | .frame_functions = { | 101 | .frame_functions = { |
| 93 | keyframe_enable, | 102 | keyframe_enable, |
| 103 | #if LCD_ENABLE | ||
| 94 | lcd_keyframe_draw_logo, | 104 | lcd_keyframe_draw_logo, |
| 105 | #endif | ||
| 95 | keyframe_fade_in, | 106 | keyframe_fade_in, |
| 96 | }, | 107 | }, |
| 97 | }; | 108 | }; |
| 98 | 109 | ||
| 99 | keyframe_animation_t default_suspend_animation = { | 110 | keyframe_animation_t default_suspend_animation = { |
| 111 | #if LCD_ENABLE | ||
| 100 | .num_frames = 3, | 112 | .num_frames = 3, |
| 113 | #else | ||
| 114 | .num_frames = 2, | ||
| 115 | #endif | ||
| 101 | .loop = false, | 116 | .loop = false, |
| 102 | .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0}, | 117 | .frame_lengths = { |
| 118 | #if LCD_ENABLE | ||
| 119 | 0, | ||
| 120 | #endif | ||
| 121 | gfxMillisecondsToTicks(1000), | ||
| 122 | 0}, | ||
| 103 | .frame_functions = { | 123 | .frame_functions = { |
| 124 | #if LCD_ENABLE | ||
| 104 | lcd_keyframe_display_layer_text, | 125 | lcd_keyframe_display_layer_text, |
| 126 | #endif | ||
| 105 | keyframe_fade_out, | 127 | keyframe_fade_out, |
| 106 | keyframe_disable, | 128 | keyframe_disable, |
| 107 | }, | 129 | }, |
| @@ -133,20 +155,20 @@ keyframe_animation_t led_test_animation = { | |||
| 133 | 155 | ||
| 134 | }, | 156 | }, |
| 135 | .frame_functions = { | 157 | .frame_functions = { |
| 136 | led_keyframe_fade_in_all, | 158 | led_backlight_keyframe_fade_in_all, |
| 137 | keyframe_no_operation, | 159 | keyframe_no_operation, |
| 138 | led_keyframe_fade_out_all, | 160 | led_backlight_keyframe_fade_out_all, |
| 139 | led_keyframe_crossfade, | 161 | led_backlight_keyframe_crossfade, |
| 140 | led_keyframe_left_to_right_gradient, | 162 | led_backlight_keyframe_left_to_right_gradient, |
| 141 | led_keyframe_crossfade, | 163 | led_backlight_keyframe_crossfade, |
| 142 | led_keyframe_top_to_bottom_gradient, | 164 | led_backlight_keyframe_top_to_bottom_gradient, |
| 143 | led_keyframe_mirror_orientation, | 165 | led_backlight_keyframe_mirror_orientation, |
| 144 | led_keyframe_crossfade, | 166 | led_backlight_keyframe_crossfade, |
| 145 | led_keyframe_left_to_right_gradient, | 167 | led_backlight_keyframe_left_to_right_gradient, |
| 146 | led_keyframe_crossfade, | 168 | led_backlight_keyframe_crossfade, |
| 147 | led_keyframe_top_to_bottom_gradient, | 169 | led_backlight_keyframe_top_to_bottom_gradient, |
| 148 | led_keyframe_normal_orientation, | 170 | led_backlight_keyframe_normal_orientation, |
| 149 | led_keyframe_crossfade, | 171 | led_backlight_keyframe_crossfade, |
| 150 | }, | 172 | }, |
| 151 | }; | 173 | }; |
| 152 | #endif | 174 | #endif |
diff --git a/keyboards/whitefox/animations.h b/quantum/visualizer/default_animations.h index 6d8b9830d..51320b8b8 100644 --- a/keyboards/whitefox/animations.h +++ b/quantum/visualizer/default_animations.h | |||
| @@ -14,8 +14,8 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #ifndef KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ | 17 | #ifndef DEFAULT_ANIMATIONS_H_ |
| 18 | #define KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ | 18 | #define DEFAULT_ANIMATIONS_H_ |
| 19 | 19 | ||
| 20 | #include "visualizer.h" | 20 | #include "visualizer.h" |
| 21 | 21 | ||
| @@ -27,4 +27,4 @@ extern keyframe_animation_t default_suspend_animation; | |||
| 27 | // cases | 27 | // cases |
| 28 | extern keyframe_animation_t led_test_animation; | 28 | extern keyframe_animation_t led_test_animation; |
| 29 | 29 | ||
| 30 | #endif /* KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ */ | 30 | #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 @@ | |||
| 16 | 16 | ||
| 17 | #include "lcd_backlight_keyframes.h" | 17 | #include "lcd_backlight_keyframes.h" |
| 18 | 18 | ||
| 19 | bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state) { | 19 | bool lcd_backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 20 | int frame_length = animation->frame_lengths[animation->current_frame]; | 20 | int frame_length = animation->frame_lengths[animation->current_frame]; |
| 21 | int current_pos = frame_length - animation->time_left_in_frame; | 21 | int current_pos = frame_length - animation->time_left_in_frame; |
| 22 | uint8_t t_h = LCD_HUE(state->target_lcd_color); | 22 | uint8_t t_h = LCD_HUE(state->target_lcd_color); |
| @@ -49,7 +49,7 @@ bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualize | |||
| 49 | return true; | 49 | return true; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state) { | 52 | bool lcd_backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 53 | (void)animation; | 53 | (void)animation; |
| 54 | state->prev_lcd_color = state->target_lcd_color; | 54 | state->prev_lcd_color = state->target_lcd_color; |
| 55 | state->current_lcd_color = state->target_lcd_color; | 55 | state->current_lcd_color = state->target_lcd_color; |
| @@ -60,14 +60,14 @@ bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_st | |||
| 60 | return false; | 60 | return false; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | bool backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) { | 63 | bool lcd_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 64 | (void)animation; | 64 | (void)animation; |
| 65 | (void)state; | 65 | (void)state; |
| 66 | lcd_backlight_hal_color(0, 0, 0); | 66 | lcd_backlight_hal_color(0, 0, 0); |
| 67 | return false; | 67 | return false; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | bool backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) { | 70 | bool lcd_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 71 | (void)animation; | 71 | (void)animation; |
| 72 | (void)state; | 72 | (void)state; |
| 73 | lcd_backlight_color(LCD_HUE(state->current_lcd_color), | 73 | 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* | |||
| 166 | // or state structs, here we use the image | 166 | // or state structs, here we use the image |
| 167 | 167 | ||
| 168 | //gdispGBlitArea is a tricky function to use since it supports blitting part of the image | 168 | //gdispGBlitArea is a tricky function to use since it supports blitting part of the image |
| 169 | // if you have full screen image, then just use 128 and 32 for both source and target dimensions | 169 | // if you have full screen image, then just use LCD_WIDTH and LCD_HEIGHT for both source and target dimensions |
| 170 | gdispGBlitArea(GDISP, 0, 0, 128, 32, 0, 0, 128, (pixel_t*)resource_lcd_logo); | 170 | gdispGBlitArea(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, 0, 0, LCD_WIDTH, (pixel_t*)resource_lcd_logo); |
| 171 | 171 | ||
| 172 | return false; | 172 | return false; |
| 173 | } | 173 | } |
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. | |||
| 23 | */ | 23 | */ |
| 24 | #include "gfx.h" | 24 | #include "gfx.h" |
| 25 | #include "math.h" | 25 | #include "math.h" |
| 26 | #include "led_keyframes.h" | 26 | #include "led_backlight_keyframes.h" |
| 27 | 27 | ||
| 28 | static uint8_t fade_led_color(keyframe_animation_t* animation, int from, int to) { | 28 | static uint8_t fade_led_color(keyframe_animation_t* animation, int from, int to) { |
| 29 | int frame_length = animation->frame_lengths[animation->current_frame]; | 29 | 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 | |||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | // TODO: Should be customizable per keyboard | 43 | // TODO: Should be customizable per keyboard |
| 44 | #define NUM_ROWS LED_NUM_ROWS | 44 | #define NUM_ROWS LED_HEIGHT |
| 45 | #define NUM_COLS LED_NUM_COLS | 45 | #define NUM_COLS LED_WIDTH |
| 46 | 46 | ||
| 47 | static uint8_t crossfade_start_frame[NUM_ROWS][NUM_COLS]; | 47 | static uint8_t crossfade_start_frame[NUM_ROWS][NUM_COLS]; |
| 48 | static uint8_t crossfade_end_frame[NUM_ROWS][NUM_COLS]; | 48 | 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) { | |||
| 55 | return (uint8_t)(255.0f * v); | 55 | return (uint8_t)(255.0f * v); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | bool led_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state) { | 58 | bool led_backlight_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 59 | (void)state; | 59 | (void)state; |
| 60 | keyframe_fade_all_leds_from_to(animation, 0, 255); | 60 | keyframe_fade_all_leds_from_to(animation, 0, 255); |
| 61 | return true; | 61 | return true; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | bool led_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state) { | 64 | bool led_backlight_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 65 | (void)state; | 65 | (void)state; |
| 66 | keyframe_fade_all_leds_from_to(animation, 255, 0); | 66 | keyframe_fade_all_leds_from_to(animation, 255, 0); |
| 67 | return true; | 67 | return true; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | bool led_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state) { | 70 | bool led_backlight_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 71 | (void)state; | 71 | (void)state; |
| 72 | float frame_length = animation->frame_lengths[animation->current_frame]; | 72 | float frame_length = animation->frame_lengths[animation->current_frame]; |
| 73 | float current_pos = frame_length - animation->time_left_in_frame; | 73 | 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 | |||
| 79 | return true; | 79 | return true; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | bool led_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state) { | 82 | bool led_backlight_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 83 | (void)state; | 83 | (void)state; |
| 84 | float frame_length = animation->frame_lengths[animation->current_frame]; | 84 | float frame_length = animation->frame_lengths[animation->current_frame]; |
| 85 | float current_pos = frame_length - animation->time_left_in_frame; | 85 | float current_pos = frame_length - animation->time_left_in_frame; |
| @@ -98,7 +98,7 @@ static void copy_current_led_state(uint8_t* dest) { | |||
| 98 | } | 98 | } |
| 99 | } | 99 | } |
| 100 | } | 100 | } |
| 101 | bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state) { | 101 | bool led_backlight_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 102 | (void)state; | 102 | (void)state; |
| 103 | if (animation->first_update_of_frame) { | 103 | if (animation->first_update_of_frame) { |
| 104 | copy_current_led_state(&crossfade_start_frame[0][0]); | 104 | copy_current_led_state(&crossfade_start_frame[0][0]); |
| @@ -114,28 +114,28 @@ bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* | |||
| 114 | return true; | 114 | return true; |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | bool led_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state) { | 117 | bool led_backlight_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 118 | (void)state; | 118 | (void)state; |
| 119 | (void)animation; | 119 | (void)animation; |
| 120 | gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_180); | 120 | gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_180); |
| 121 | return false; | 121 | return false; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state) { | 124 | bool led_backlight_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 125 | (void)state; | 125 | (void)state; |
| 126 | (void)animation; | 126 | (void)animation; |
| 127 | gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_0); | 127 | gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_0); |
| 128 | return false; | 128 | return false; |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | bool led_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) { | 131 | bool led_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 132 | (void)state; | 132 | (void)state; |
| 133 | (void)animation; | 133 | (void)animation; |
| 134 | gdispGSetPowerMode(LED_DISPLAY, powerOff); | 134 | gdispGSetPowerMode(LED_DISPLAY, powerOff); |
| 135 | return false; | 135 | return false; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | bool led_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) { | 138 | bool led_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 139 | (void)state; | 139 | (void)state; |
| 140 | (void)animation; | 140 | (void)animation; |
| 141 | gdispGSetPowerMode(LED_DISPLAY, powerOn); | 141 | 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 | |||
| 22 | SOFTWARE. | 22 | SOFTWARE. |
| 23 | */ | 23 | */ |
| 24 | 24 | ||
| 25 | #ifndef LED_KEYFRAMES_H | 25 | #ifndef LED_BACKLIGHT_KEYFRAMES_H |
| 26 | #define LED_KEYFRAMES_H | 26 | #define LED_BACKLIGHT_KEYFRAMES_H |
| 27 | 27 | ||
| 28 | #include "visualizer.h" | 28 | #include "visualizer.h" |
| 29 | 29 | ||
| 30 | bool led_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state); | 30 | bool led_backlight_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state); |
| 31 | bool led_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state); | 31 | bool led_backlight_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state); |
| 32 | bool led_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state); | 32 | bool led_backlight_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state); |
| 33 | bool led_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state); | 33 | bool led_backlight_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state); |
| 34 | bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state); | 34 | bool led_backlight_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state); |
| 35 | bool led_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state); | 35 | bool led_backlight_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state); |
| 36 | bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state); | 36 | bool led_backlight_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state); |
| 37 | 37 | ||
| 38 | bool led_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state); | 38 | bool led_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state); |
| 39 | bool led_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state); | 39 | bool led_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state); |
| 40 | 40 | ||
| 41 | extern keyframe_animation_t led_test_animation; | 41 | extern keyframe_animation_t led_test_animation; |
| 42 | 42 | ||
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. | |||
| 52 | 52 | ||
| 53 | // Define this in config.h | 53 | // Define this in config.h |
| 54 | #ifndef VISUALIZER_THREAD_PRIORITY | 54 | #ifndef VISUALIZER_THREAD_PRIORITY |
| 55 | #define "Visualizer thread priority not defined" | 55 | // The visualizer needs gfx thread priorities |
| 56 | #define VISUALIZER_THREAD_PRIORITY (NORMAL_PRIORITY - 2) | ||
| 56 | #endif | 57 | #endif |
| 57 | 58 | ||
| 58 | static visualizer_keyboard_status_t current_status = { | 59 | static visualizer_keyboard_status_t current_status = { |
| @@ -255,6 +256,9 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) { | |||
| 255 | .mods = 0xFF, | 256 | .mods = 0xFF, |
| 256 | .leds = 0xFFFFFFFF, | 257 | .leds = 0xFFFFFFFF, |
| 257 | .suspended = false, | 258 | .suspended = false, |
| 259 | #ifdef BACKLIGHT_ENABLE | ||
| 260 | .backlight_level = 0, | ||
| 261 | #endif | ||
| 258 | #ifdef VISUALIZER_USER_DATA_SIZE | 262 | #ifdef VISUALIZER_USER_DATA_SIZE |
| 259 | .user_data = {0}, | 263 | .user_data = {0}, |
| 260 | #endif | 264 | #endif |
| @@ -299,6 +303,7 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) { | |||
| 299 | else { | 303 | else { |
| 300 | gdispGSetPowerMode(LED_DISPLAY, powerOff); | 304 | gdispGSetPowerMode(LED_DISPLAY, powerOff); |
| 301 | } | 305 | } |
| 306 | state.status.backlight_level = current_status.backlight_level; | ||
| 302 | } | 307 | } |
| 303 | #endif | 308 | #endif |
| 304 | if (visualizer_enabled) { | 309 | 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 @@ | |||
| 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 21 | # SOFTWARE. | 21 | # SOFTWARE. |
| 22 | 22 | ||
| 23 | define ADD_DRIVER | ||
| 24 | $(1)_DRIVER:=$(strip $($(1)_DRIVER)) | ||
| 25 | $(1)_WIDTH:=$(strip $($(1)_WIDTH)) | ||
| 26 | $(1)_HEIGHT:=$(strip $($(1)_HEIGHT)) | ||
| 27 | ifeq ($($(1)_DRIVER),) | ||
| 28 | $$(error $(1)_DRIVER is not defined) | ||
| 29 | endif | ||
| 30 | ifeq ($($(1)_WIDTH),) | ||
| 31 | $$(error $(1)_WIDTH is not defined) | ||
| 32 | endif | ||
| 33 | ifeq ($($(1)_HEIGHT),) | ||
| 34 | $$(error $(1)_HEIGHT is not defined) | ||
| 35 | endif | ||
| 36 | OPT_DEFS+=-D$(1)_WIDTH=$($(1)_WIDTH) | ||
| 37 | OPT_DEFS+=-D$(1)_HEIGHT=$($(1)_HEIGHT) | ||
| 38 | GFXDEFS+=-D$(1)_WIDTH=$($(1)_WIDTH) | ||
| 39 | GFXDEFS+=-D$(1)_HEIGHT=$($(1)_HEIGHT) | ||
| 40 | $(1)_DISPLAY_NUMBER:=$$(words $$(GDISP_DRIVER_LIST)) | ||
| 41 | OPT_DEFS+=-D$(1)_DISPLAY_NUMBER=$$($(1)_DISPLAY_NUMBER) | ||
| 42 | include $(TOP_DIR)/drivers/ugfx/gdisp/$($(1)_DRIVER)/driver.mk | ||
| 43 | endef | ||
| 44 | |||
| 45 | GDISP_DRIVER_LIST:= | ||
| 46 | |||
| 23 | SRC += $(VISUALIZER_DIR)/visualizer.c \ | 47 | SRC += $(VISUALIZER_DIR)/visualizer.c \ |
| 24 | $(VISUALIZER_DIR)/visualizer_keyframes.c | 48 | $(VISUALIZER_DIR)/visualizer_keyframes.c |
| 25 | EXTRAINCDIRS += $(GFXINC) $(VISUALIZER_DIR) | 49 | EXTRAINCDIRS += $(GFXINC) $(VISUALIZER_DIR) |
| @@ -40,16 +64,32 @@ SRC += $(VISUALIZER_DIR)/lcd_backlight_keyframes.c | |||
| 40 | # Note, that the linker will strip out any resources that are not actually in use | 64 | # Note, that the linker will strip out any resources that are not actually in use |
| 41 | SRC += $(VISUALIZER_DIR)/resources/lcd_logo.c | 65 | SRC += $(VISUALIZER_DIR)/resources/lcd_logo.c |
| 42 | OPT_DEFS += -DLCD_BACKLIGHT_ENABLE | 66 | OPT_DEFS += -DLCD_BACKLIGHT_ENABLE |
| 67 | $(eval $(call ADD_DRIVER,LCD)) | ||
| 43 | endif | 68 | endif |
| 44 | 69 | ||
| 45 | ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) | 70 | ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) |
| 46 | SRC += $(VISUALIZER_DIR)/led_keyframes.c | 71 | SRC += $(VISUALIZER_DIR)/led_backlight_keyframes.c |
| 72 | $(eval $(call ADD_DRIVER,LED)) | ||
| 47 | endif | 73 | endif |
| 48 | 74 | ||
| 75 | SRC += $(VISUALIZER_DIR)/default_animations.c | ||
| 76 | |||
| 49 | include $(GFXLIB)/gfx.mk | 77 | include $(GFXLIB)/gfx.mk |
| 78 | # For the common_gfxconf.h | ||
| 79 | GFXINC += quantum/visualizer | ||
| 80 | |||
| 50 | GFXSRC := $(patsubst $(TOP_DIR)/%,%,$(GFXSRC)) | 81 | GFXSRC := $(patsubst $(TOP_DIR)/%,%,$(GFXSRC)) |
| 51 | GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS))) | 82 | GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS))) |
| 52 | 83 | ||
| 84 | GDISP_LIST_COMMA=, | ||
| 85 | GDISP_LIST_EMPTY= | ||
| 86 | GDISP_LIST_SPACE=$(GDISP_LIST_EMPTY) $(GDISP_LIST_EMPTY) | ||
| 87 | |||
| 88 | GDISP_DRIVER_LIST := $(strip $(GDISP_DRIVER_LIST)) | ||
| 89 | GDISP_DRIVER_LIST := $(subst $(GDISP_LIST_SPACE),$(GDISP_LIST_COMMA),$(GDISP_DRIVER_LIST)) | ||
| 90 | |||
| 91 | GFXDEFS +=-DGDISP_DRIVER_LIST="$(GDISP_DRIVER_LIST)" | ||
| 92 | |||
| 53 | ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","") | 93 | ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","") |
| 54 | SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c | 94 | SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c |
| 55 | else | 95 | 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 | |||
| 12 | EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) | 12 | EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) |
| 13 | BIN = | 13 | BIN = |
| 14 | 14 | ||
| 15 | 15 | COMMON_VPATH += $(DRIVER_PATH)/avr | |
| 16 | 16 | ||
| 17 | COMPILEFLAGS += -funsigned-char | 17 | COMPILEFLAGS += -funsigned-char |
| 18 | COMPILEFLAGS += -funsigned-bitfields | 18 | COMPILEFLAGS += -funsigned-bitfields |
| @@ -87,11 +87,13 @@ DEBUG_PORT = 4242 | |||
| 87 | DEBUG_HOST = localhost | 87 | DEBUG_HOST = localhost |
| 88 | 88 | ||
| 89 | #============================================================================ | 89 | #============================================================================ |
| 90 | # Autodecct teensy loader | 90 | # Autodetect teensy loader |
| 91 | ifneq (, $(shell which teensy-loader-cli 2>/dev/null)) | 91 | ifndef TEENSY_LOADER_CLI |
| 92 | TEENSY_LOADER_CLI ?= teensy-loader-cli | 92 | ifneq (, $(shell which teensy-loader-cli 2>/dev/null)) |
| 93 | else | 93 | TEENSY_LOADER_CLI ?= teensy-loader-cli |
| 94 | TEENSY_LOADER_CLI ?= teensy_loader_cli | 94 | else |
| 95 | TEENSY_LOADER_CLI ?= teensy_loader_cli | ||
| 96 | endif | ||
| 95 | endif | 97 | endif |
| 96 | 98 | ||
| 97 | # Program the device. | 99 | # Program the device. |
| @@ -115,11 +117,11 @@ dfu: $(BUILD_DIR)/$(TARGET).hex sizeafter | |||
| 115 | echo "Error: Bootloader not found. Trying again in 5s." ;\ | 117 | echo "Error: Bootloader not found. Trying again in 5s." ;\ |
| 116 | sleep 5 ;\ | 118 | sleep 5 ;\ |
| 117 | done | 119 | done |
| 118 | ifneq (, $(findstring 0.7, $(shell $(DFU_PROGRAMMER) --version 2>&1))) | 120 | if $(DFU_PROGRAMMER) --version 2>&1 | grep -q 0.7 ; then\ |
| 119 | $(DFU_PROGRAMMER) $(MCU) erase --force | 121 | $(DFU_PROGRAMMER) $(MCU) erase --force;\ |
| 120 | else | 122 | else\ |
| 121 | $(DFU_PROGRAMMER) $(MCU) erase | 123 | $(DFU_PROGRAMMER) $(MCU) erase;\ |
| 122 | endif | 124 | fi |
| 123 | $(DFU_PROGRAMMER) $(MCU) flash $(BUILD_DIR)/$(TARGET).hex | 125 | $(DFU_PROGRAMMER) $(MCU) flash $(BUILD_DIR)/$(TARGET).hex |
| 124 | $(DFU_PROGRAMMER) $(MCU) reset | 126 | $(DFU_PROGRAMMER) $(MCU) reset |
| 125 | 127 | ||
| @@ -135,11 +137,11 @@ flip-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep | |||
| 135 | $(REMOVE) $(BUILD_DIR)/$(TARGET)eep.hex | 137 | $(REMOVE) $(BUILD_DIR)/$(TARGET)eep.hex |
| 136 | 138 | ||
| 137 | dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep | 139 | dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep |
| 138 | ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1))) | 140 | if $(DFU_PROGRAMMER) --version 2>&1 | grep -q 0.7 ; then\ |
| 139 | $(DFU_PROGRAMMER) $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep | 141 | $(DFU_PROGRAMMER) $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep;\ |
| 140 | else | 142 | else\ |
| 141 | $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep | 143 | $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep;\ |
| 142 | endif | 144 | fi |
| 143 | $(DFU_PROGRAMMER) $(MCU) reset | 145 | $(DFU_PROGRAMMER) $(MCU) reset |
| 144 | 146 | ||
| 145 | # Convert hex to bin. | 147 | # Convert hex to bin. |
