From 4c71b329a228738f5c39eb07ed806ce14fbe97af Mon Sep 17 00:00:00 2001 From: Fabian Topfstedt Date: Mon, 26 Jun 2017 22:33:14 +0200 Subject: clone smt layout --- keyboards/lets_split/keymaps/fabian/config.h | 34 ++++ keyboards/lets_split/keymaps/fabian/keymap.c | 219 ++++++++++++++++++++++++++ keyboards/lets_split/keymaps/fabian/readme.md | 88 +++++++++++ 3 files changed, 341 insertions(+) create mode 100644 keyboards/lets_split/keymaps/fabian/config.h create mode 100644 keyboards/lets_split/keymaps/fabian/keymap.c create mode 100644 keyboards/lets_split/keymaps/fabian/readme.md (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/keymaps/fabian/config.h b/keyboards/lets_split/keymaps/fabian/config.h new file mode 100644 index 000000000..ba271d1ac --- /dev/null +++ b/keyboards/lets_split/keymaps/fabian/config.h @@ -0,0 +1,34 @@ +/* +Copyright 2012 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + + +#define USE_SERIAL + +#define MASTER_LEFT +// #define _MASTER_RIGHT +// #define EE_HANDS + + +#ifdef SUBPROJECT_rev1 + #include "../../rev1/config.h" +#endif +#ifdef SUBPROJECT_rev2 + #include "../../rev2/config.h" +#endif +#ifdef SUBPROJECT_rev2fliphalf + #include "../../rev2fliphalf/config.h" +#endif diff --git a/keyboards/lets_split/keymaps/fabian/keymap.c b/keyboards/lets_split/keymaps/fabian/keymap.c new file mode 100644 index 000000000..18d409f08 --- /dev/null +++ b/keyboards/lets_split/keymaps/fabian/keymap.c @@ -0,0 +1,219 @@ +#include "lets_split.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + LOWER, + RAISE, + ADJUST, +}; + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +// Custom macros +#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl +#define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift +#define HPR_TAB ALL_T(KC_TAB) // Tap for Tab, hold for Hyper (Super+Ctrl+Alt+Shift) +#define MEH_GRV MEH_T(KC_GRV) // Tap for Backtick, hold for Meh (Ctrl+Alt+Shift) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------. ,-----------------------------------------. + * | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Esc | A | S | D | F | G | | H | J | K | L | ; | " | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | ` | Ctrl | Alt | GUI |Lower |Space | |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------' `-----------------------------------------' + */ +[_QWERTY] = KEYMAP( \ + HPR_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ + CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, \ + MEH_GRV, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* Colemak + * ,-----------------------------------------. ,-----------------------------------------. + * | Tab | Q | W | F | P | G | | J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Esc | A | R | S | T | D | | H | N | E | I | O | " | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | | K | M | , | . | / |Enter | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | ` | Ctrl | Alt | GUI |Lower |Space | |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------' `-----------------------------------------' + */ +[_COLEMAK] = KEYMAP( \ + HPR_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ + CTL_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, \ + MEH_GRV, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* Dvorak + * ,-----------------------------------------. ,-----------------------------------------. + * | Tab | " | , | . | P | Y | | F | G | C | R | L | Bksp | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Esc | A | O | E | U | I | | D | H | T | N | S | - | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | ` | Ctrl | Alt | GUI |Lower |Space | |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------' `-----------------------------------------' + */ +[_DVORAK] = KEYMAP( \ + HPR_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ + CTL_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, \ + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_ENT, \ + MEH_GRV, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT +), + +/* Lower + * ,-----------------------------------------. ,-----------------------------------------. + * | 0 | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | $ | F1 | F2 | F3 | F4 | F5 | | F6 | 4 | 5 | 6 | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | | F12 | 1 | 2 | 3 | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------' `-----------------------------------------' + */ +[_LOWER] = KEYMAP( \ + ALL_T(KC_0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ + CTL_T(KC_DLR), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_4, KC_5, KC_6, _______, _______, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_1, KC_2, KC_3, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY +), + +/* Raise + * ,-----------------------------------------. ,-----------------------------------------. + * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | Del | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | _ | ? | + | { | } | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | - | / | = | [ | ] | \ | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | | Home |PageDn|PageUp| End | + * `-----------------------------------------' `-----------------------------------------' + */ +[_RAISE] = KEYMAP( \ + ALL_T(KC_TILD), KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ + _______, _______, _______, _______, _______, _______, KC_UNDS, KC_QUES, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ + _______, _______, _______, _______, _______, _______, KC_MINS, KC_SLSH, KC_EQL, KC_LBRC, KC_RBRC, SFT_T(KC_BSLS), \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END +), + +/* Adjust (Lower + Raise) + * ,-----------------------------------------. ,-----------------------------------------. + * | | Reset| | | | | | | | | | | Reset| + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm| |AGswap|Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | | | | | | + * |------+------+------+------+------+------| |------+------+------+------+------+------| + * | | | | | | | | | | | | | | + * `-----------------------------------------' `-----------------------------------------' + */ +[_ADJUST] = KEYMAP( \ + _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +) + +}; + +#ifdef AUDIO_ENABLE +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +#endif + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + persistent_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_colemak, false, 0); + #endif + persistent_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_dvorak, false, 0); + #endif + persistent_default_layer_set(1UL<<_DVORAK); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + } + return true; +} diff --git a/keyboards/lets_split/keymaps/fabian/readme.md b/keyboards/lets_split/keymaps/fabian/readme.md new file mode 100644 index 000000000..20bc662f0 --- /dev/null +++ b/keyboards/lets_split/keymaps/fabian/readme.md @@ -0,0 +1,88 @@ +# smt's Let's Split keymap + +This keymap is ported from my Planck keymap. + + +## Qwerty + +``` +,-----------------------------------------. ,-----------------------------------------. +| Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| Esc | A | S | D | F | G | | H | J | K | L | ; | " | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| Shift| Z | X | C | V | B | | N | M | , | . | / |Enter | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| ` | Ctrl | Alt | GUI |Lower |Space | |Space |Raise | Left | Down | Up |Right | +`-----------------------------------------' `-----------------------------------------' +``` + +## Colemak + +``` +,-----------------------------------------. ,-----------------------------------------. +| Tab | Q | W | F | P | G | | J | L | U | Y | ; | Bksp | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| Esc | A | R | S | T | D | | H | N | E | I | O | " | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| Shift| Z | X | C | V | B | | K | M | , | . | / |Enter | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| ` | Ctrl | Alt | GUI |Lower |Space | |Space |Raise | Left | Down | Up |Right | +`-----------------------------------------' `-----------------------------------------' +``` + +## Dvorak + +``` +,-----------------------------------------. ,-----------------------------------------. +| Tab | " | , | . | P | Y | | F | G | C | R | L | Bksp | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| Esc | A | O | E | U | I | | D | H | T | N | S | - | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| Shift| ; | Q | J | K | X | | B | M | W | V | Z |Enter | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| ` | Ctrl | Alt | GUI |Lower |Space | |Space |Raise | Left | Down | Up |Right | +`-----------------------------------------' `-----------------------------------------' +``` + +## Lower + +``` +,-----------------------------------------. ,-----------------------------------------. +| 0 | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| $ | F1 | F2 | F3 | F4 | F5 | | F6 | 4 | 5 | 6 | | | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| | F7 | F8 | F9 | F10 | F11 | | F12 | 1 | 2 | 3 | | | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| | | | | | | | | | Next | Vol- | Vol+ | Play | +`-----------------------------------------' `-----------------------------------------' +``` + +## Raise + +``` +,-----------------------------------------. ,-----------------------------------------. +| ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | Del | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| | | | | | | | _ | ? | + | { | } | | | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| | | | | | | | - | / | = | [ | ] | \ | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| | | | | | | | | | Home |PageDn|PageUp| End | +`-----------------------------------------' `-----------------------------------------' +``` + +## Adjust (Lower + Raise) + +``` +,-----------------------------------------. ,-----------------------------------------. +| | Reset| | | | | | | | | | | Reset| +|------+------+------+------+------+------| |------+------+------+------+------+------| +| | | |Aud on|Audoff|AGnorm| |AGswap|Qwerty|Colemk|Dvorak| | | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| | | | | | | | | | | | | | +|------+------+------+------+------+------| |------+------+------+------+------+------| +| | | | | | | | | | | | | | +`-----------------------------------------' `-----------------------------------------' +``` -- cgit v1.2.3 From 786eb4e73d92cbca81e7893095f9c689f4577d91 Mon Sep 17 00:00:00 2001 From: Fabian Topfstedt Date: Tue, 27 Jun 2017 09:14:04 +0200 Subject: my layout --- keyboards/lets_split/keymaps/fabian/keymap.c | 45 ++++++++++++++-------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/keymaps/fabian/keymap.c b/keyboards/lets_split/keymaps/fabian/keymap.c index 18d409f08..1793bcc05 100644 --- a/keyboards/lets_split/keymaps/fabian/keymap.c +++ b/keyboards/lets_split/keymaps/fabian/keymap.c @@ -31,6 +31,7 @@ enum custom_keycodes { // Custom macros #define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl #define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift +#define SFT_BSP SFT_T(KC_BSPC) // Tap for Backspace, hold for Shift #define HPR_TAB ALL_T(KC_TAB) // Tap for Tab, hold for Hyper (Super+Ctrl+Alt+Shift) #define MEH_GRV MEH_T(KC_GRV) // Tap for Backtick, hold for Meh (Ctrl+Alt+Shift) @@ -44,14 +45,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------| |------+------+------+------+------+------| * | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | ` | Ctrl | Alt | GUI |Lower |Space | |Space |Raise | Left | Down | Up |Right | + * | ` | Ctrl | Alt | GUI |Lower |Space | | Bksp |Raise | GUI |AltGr | Ctrl | | * `-----------------------------------------' `-----------------------------------------' */ [_QWERTY] = KEYMAP( \ HPR_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, \ - MEH_GRV, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + MEH_GRV, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_RGUI, KC_RALT, KC_RCTL, _______ ), /* Colemak @@ -62,14 +63,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------| |------+------+------+------+------+------| * | Shift| Z | X | C | V | B | | K | M | , | . | / |Enter | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | ` | Ctrl | Alt | GUI |Lower |Space | |Space |Raise | Left | Down | Up |Right | + * | ` | Ctrl | Alt | GUI |Lower |Space | | Bksp |Raise | GUI |AltGr | Ctrl | | * `-----------------------------------------' `-----------------------------------------' */ [_COLEMAK] = KEYMAP( \ HPR_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ CTL_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, \ - MEH_GRV, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + MEH_GRV, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_RGUI, KC_RALT, KC_RCTL, _______ ), /* Dvorak @@ -80,50 +81,50 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------| |------+------+------+------+------+------| * | Shift| ; | Q | J | K | X | | B | M | W | V | Z |Enter | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | ` | Ctrl | Alt | GUI |Lower |Space | |Space |Raise | Left | Down | Up |Right | + * | ` | Ctrl | Alt | GUI |Lower |Space | | Bksp |Raise | GUI |AltGr | Ctrl | | * `-----------------------------------------' `-----------------------------------------' */ [_DVORAK] = KEYMAP( \ HPR_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ CTL_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, \ KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_ENT, \ - MEH_GRV, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT + MEH_GRV, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_RGUI, KC_RALT, KC_RCTL, _______ ), /* Lower * ,-----------------------------------------. ,-----------------------------------------. - * | 0 | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | + * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | Bksp | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | $ | F1 | F2 | F3 | F4 | F5 | | F6 | 4 | 5 | 6 | | | + * | Del | F1 | F2 | F3 | F4 | F5 | | F6 | _ | + | { | } | | | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | | F12 | 1 | 2 | 3 | | | + * | | F7 | F8 | F9 | F10 | F11 | | F12 | Left | Down | Up |Right | | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | | | | | | | | | Next | Vol- | Vol+ | Play | + * | | | | | | | | | | Home |PageDn|PageUp| End | * `-----------------------------------------' `-----------------------------------------' */ [_LOWER] = KEYMAP( \ - ALL_T(KC_0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ - CTL_T(KC_DLR), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_4, KC_5, KC_6, _______, _______, \ - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_1, KC_2, KC_3, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY + ALL_T(KC_TILD), KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END ), /* Raise * ,-----------------------------------------. ,-----------------------------------------. - * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | Del | + * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | | | | | | | _ | ? | + | { | } | | | + * | Del | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | | | | | | | - | / | = | [ | ] | \ | + * | | F7 | F8 | F9 | F10 | F11 | | F12 | Left | Down | Up | Right| | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | | | | | | | | | Home |PageDn|PageUp| End | + * | | | | | | | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------' `-----------------------------------------' */ [_RAISE] = KEYMAP( \ - ALL_T(KC_TILD), KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ - _______, _______, _______, _______, _______, _______, KC_UNDS, KC_QUES, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ - _______, _______, _______, _______, _______, _______, KC_MINS, KC_SLSH, KC_EQL, KC_LBRC, KC_RBRC, SFT_T(KC_BSLS), \ - _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END + ALL_T(KC_GRV), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LCBR, KC_RCBR, KC_BSLS, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ), /* Adjust (Lower + Raise) -- cgit v1.2.3 From 7d0a471051551c3ef9d8a60dbf4bc5b1b2d70cea Mon Sep 17 00:00:00 2001 From: Fabian Topfstedt Date: Tue, 27 Jun 2017 09:18:05 +0200 Subject: removed wrong readme --- keyboards/lets_split/keymaps/fabian/readme.md | 88 --------------------------- 1 file changed, 88 deletions(-) delete mode 100644 keyboards/lets_split/keymaps/fabian/readme.md (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/keymaps/fabian/readme.md b/keyboards/lets_split/keymaps/fabian/readme.md deleted file mode 100644 index 20bc662f0..000000000 --- a/keyboards/lets_split/keymaps/fabian/readme.md +++ /dev/null @@ -1,88 +0,0 @@ -# smt's Let's Split keymap - -This keymap is ported from my Planck keymap. - - -## Qwerty - -``` -,-----------------------------------------. ,-----------------------------------------. -| Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| Esc | A | S | D | F | G | | H | J | K | L | ; | " | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| Shift| Z | X | C | V | B | | N | M | , | . | / |Enter | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| ` | Ctrl | Alt | GUI |Lower |Space | |Space |Raise | Left | Down | Up |Right | -`-----------------------------------------' `-----------------------------------------' -``` - -## Colemak - -``` -,-----------------------------------------. ,-----------------------------------------. -| Tab | Q | W | F | P | G | | J | L | U | Y | ; | Bksp | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| Esc | A | R | S | T | D | | H | N | E | I | O | " | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| Shift| Z | X | C | V | B | | K | M | , | . | / |Enter | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| ` | Ctrl | Alt | GUI |Lower |Space | |Space |Raise | Left | Down | Up |Right | -`-----------------------------------------' `-----------------------------------------' -``` - -## Dvorak - -``` -,-----------------------------------------. ,-----------------------------------------. -| Tab | " | , | . | P | Y | | F | G | C | R | L | Bksp | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| Esc | A | O | E | U | I | | D | H | T | N | S | - | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| Shift| ; | Q | J | K | X | | B | M | W | V | Z |Enter | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| ` | Ctrl | Alt | GUI |Lower |Space | |Space |Raise | Left | Down | Up |Right | -`-----------------------------------------' `-----------------------------------------' -``` - -## Lower - -``` -,-----------------------------------------. ,-----------------------------------------. -| 0 | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| $ | F1 | F2 | F3 | F4 | F5 | | F6 | 4 | 5 | 6 | | | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| | F7 | F8 | F9 | F10 | F11 | | F12 | 1 | 2 | 3 | | | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| | | | | | | | | | Next | Vol- | Vol+ | Play | -`-----------------------------------------' `-----------------------------------------' -``` - -## Raise - -``` -,-----------------------------------------. ,-----------------------------------------. -| ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | Del | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| | | | | | | | _ | ? | + | { | } | | | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| | | | | | | | - | / | = | [ | ] | \ | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| | | | | | | | | | Home |PageDn|PageUp| End | -`-----------------------------------------' `-----------------------------------------' -``` - -## Adjust (Lower + Raise) - -``` -,-----------------------------------------. ,-----------------------------------------. -| | Reset| | | | | | | | | | | Reset| -|------+------+------+------+------+------| |------+------+------+------+------+------| -| | | |Aud on|Audoff|AGnorm| |AGswap|Qwerty|Colemk|Dvorak| | | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| | | | | | | | | | | | | | -|------+------+------+------+------+------| |------+------+------+------+------+------| -| | | | | | | | | | | | | | -`-----------------------------------------' `-----------------------------------------' -``` -- cgit v1.2.3 From 9aa748df2a65517b7216ea5bd10aa64bfbf62c2a Mon Sep 17 00:00:00 2001 From: Fabian Topfstedt Date: Tue, 27 Jun 2017 10:36:00 +0200 Subject: my layout --- keyboards/lets_split/keymaps/fabian/keymap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/keymaps/fabian/keymap.c b/keyboards/lets_split/keymaps/fabian/keymap.c index 1793bcc05..d448bb04b 100644 --- a/keyboards/lets_split/keymaps/fabian/keymap.c +++ b/keyboards/lets_split/keymaps/fabian/keymap.c @@ -45,14 +45,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------| |------+------+------+------+------+------| * | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | ` | Ctrl | Alt | GUI |Lower |Space | | Bksp |Raise | GUI |AltGr | Ctrl | | + * | GUI | Ctrl | Alt | GUI |Lower |Space | | Bksp |Raise | GUI |AltGr | Ctrl | GUI | * `-----------------------------------------' `-----------------------------------------' */ [_QWERTY] = KEYMAP( \ HPR_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, \ - MEH_GRV, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_RGUI, KC_RALT, KC_RCTL, _______ + KC_LGUI, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_RGUI, KC_RALT, KC_RCTL, KC_RGUI ), /* Colemak @@ -63,14 +63,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------| |------+------+------+------+------+------| * | Shift| Z | X | C | V | B | | K | M | , | . | / |Enter | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | ` | Ctrl | Alt | GUI |Lower |Space | | Bksp |Raise | GUI |AltGr | Ctrl | | + * | GUI | Ctrl | Alt | GUI |Lower |Space | | Bksp |Raise | GUI |AltGr | Ctrl | GUI | * `-----------------------------------------' `-----------------------------------------' */ [_COLEMAK] = KEYMAP( \ HPR_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ CTL_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, \ - MEH_GRV, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_RGUI, KC_RALT, KC_RCTL, _______ + KC_LGUI, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_RGUI, KC_RALT, KC_RCTL, KC_RGUI ), /* Dvorak @@ -81,14 +81,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------| |------+------+------+------+------+------| * | Shift| ; | Q | J | K | X | | B | M | W | V | Z |Enter | * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | ` | Ctrl | Alt | GUI |Lower |Space | | Bksp |Raise | GUI |AltGr | Ctrl | | + * | GUI | Ctrl | Alt | GUI |Lower |Space | | Bksp |Raise | GUI |AltGr | Ctrl | GUI | * `-----------------------------------------' `-----------------------------------------' */ [_DVORAK] = KEYMAP( \ HPR_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ CTL_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, \ KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_ENT, \ - MEH_GRV, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_RGUI, KC_RALT, KC_RCTL, _______ + KC_LGUI, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_RGUI, KC_RALT, KC_RCTL, KC_RGUI ), /* Lower -- cgit v1.2.3 From 99b6e918eab31d4f53cabc04a995da945335ac7f Mon Sep 17 00:00:00 2001 From: Fabian Topfstedt Date: Tue, 27 Jun 2017 16:20:17 +0200 Subject: fixed brackets --- keyboards/lets_split/keymaps/fabian/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/keymaps/fabian/keymap.c b/keyboards/lets_split/keymaps/fabian/keymap.c index d448bb04b..b3e19aaea 100644 --- a/keyboards/lets_split/keymaps/fabian/keymap.c +++ b/keyboards/lets_split/keymaps/fabian/keymap.c @@ -122,7 +122,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_RAISE] = KEYMAP( \ ALL_T(KC_GRV), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, \ - KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LCBR, KC_RCBR, KC_BSLS, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, \ _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY ), -- cgit v1.2.3 From 7bddacf25fcd7085968d10d6df9f55620b256a89 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Fri, 7 Jul 2017 13:32:29 -0400 Subject: update lets_split lufa include --- keyboards/lets_split/keymaps/OLED_sample/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/keymaps/OLED_sample/keymap.c b/keyboards/lets_split/keymaps/OLED_sample/keymap.c index 274f917e2..59b700eee 100644 --- a/keyboards/lets_split/keymaps/OLED_sample/keymap.c +++ b/keyboards/lets_split/keymaps/OLED_sample/keymap.c @@ -2,7 +2,7 @@ #include "bootloader.h" #include "action_layer.h" #include "eeconfig.h" -#include "tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/Peripheral/TWI.h" +#include "lib/lufa/LUFA/Drivers/Peripheral/TWI.h" #ifdef AUDIO_ENABLE #include "audio.h" #endif -- cgit v1.2.3 From 1c26468ad5a0701e244c99cbcbc547c93b75d515 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Fri, 7 Jul 2017 14:53:47 -0400 Subject: update include --- keyboards/lets_split/keymaps/OLED_sample/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/keymaps/OLED_sample/keymap.c b/keyboards/lets_split/keymaps/OLED_sample/keymap.c index 59b700eee..5dbab5332 100644 --- a/keyboards/lets_split/keymaps/OLED_sample/keymap.c +++ b/keyboards/lets_split/keymaps/OLED_sample/keymap.c @@ -2,7 +2,7 @@ #include "bootloader.h" #include "action_layer.h" #include "eeconfig.h" -#include "lib/lufa/LUFA/Drivers/Peripheral/TWI.h" +#include "LUFA/Drivers/Peripheral/TWI.h" #ifdef AUDIO_ENABLE #include "audio.h" #endif -- cgit v1.2.3 From 53174036e9d8aabe01d1e7fcca7580edf3ee1178 Mon Sep 17 00:00:00 2001 From: Ethan Spitz Date: Thu, 6 Jul 2017 22:03:31 -0700 Subject: Add new keymap to try to get pretty close to the default layout for an ergodox keyboard. Coming from that I really like being able to use the backspace from my left thumb. --- keyboards/lets_split/keymaps/ergodoxish/Makefile | 3 + keyboards/lets_split/keymaps/ergodoxish/config.h | 37 ++++ keyboards/lets_split/keymaps/ergodoxish/keymap.c | 214 +++++++++++++++++++++++ 3 files changed, 254 insertions(+) create mode 100644 keyboards/lets_split/keymaps/ergodoxish/Makefile create mode 100644 keyboards/lets_split/keymaps/ergodoxish/config.h create mode 100644 keyboards/lets_split/keymaps/ergodoxish/keymap.c (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/keymaps/ergodoxish/Makefile b/keyboards/lets_split/keymaps/ergodoxish/Makefile new file mode 100644 index 000000000..457a3d01d --- /dev/null +++ b/keyboards/lets_split/keymaps/ergodoxish/Makefile @@ -0,0 +1,3 @@ +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/lets_split/keymaps/ergodoxish/config.h b/keyboards/lets_split/keymaps/ergodoxish/config.h new file mode 100644 index 000000000..7f33a4363 --- /dev/null +++ b/keyboards/lets_split/keymaps/ergodoxish/config.h @@ -0,0 +1,37 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +Copyright 2015 Jack Humbert + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +// #define USE_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define _MASTER_RIGHT +// #define EE_HANDS + +#endif \ No newline at end of file diff --git a/keyboards/lets_split/keymaps/ergodoxish/keymap.c b/keyboards/lets_split/keymaps/ergodoxish/keymap.c new file mode 100644 index 000000000..936312b2e --- /dev/null +++ b/keyboards/lets_split/keymaps/ergodoxish/keymap.c @@ -0,0 +1,214 @@ +#include "lets_split.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + LOWER, + RAISE, + ADJUST, +}; + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_QWERTY] = KEYMAP( \ + 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_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ +), + +/* Colemak + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_COLEMAK] = KEYMAP( \ + KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ + KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ +), + +/* Dvorak + * ,-----------------------------------------------------------------------------------. + * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_DVORAK] = KEYMAP( \ + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ + KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ +), + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = KEYMAP( \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ +), + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = KEYMAP( \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ +), + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | Reset| | | | | | | | | | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = KEYMAP( \ + _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ +) + + +}; + +#ifdef AUDIO_ENABLE +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +#endif + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + persistent_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_colemak, false, 0); + #endif + persistent_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_dvorak, false, 0); + #endif + persistent_default_layer_set(1UL<<_DVORAK); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + } + return true; +} \ No newline at end of file -- cgit v1.2.3 From 42d5a324eb673b2214a87c8911d850105c3bdaab Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Mon, 10 Jul 2017 11:18:47 -0400 Subject: Start mvoing hardware drivers to /drivers/ (#1433) * start driver isolation * update nyquist and orthodox boards * update atreus62 * move drivers to avr * update avr conditional --- common.mk | 6 +- common_features.mk | 2 +- drivers/avr/analog.c | 69 +++++ drivers/avr/analog.h | 52 ++++ drivers/avr/glcdfont.c | 276 +++++++++++++++++++ drivers/avr/pro_micro.h | 362 ++++++++++++++++++++++++ drivers/avr/ssd1306.c | 470 ++++++++++++++++++++++++++++++++ drivers/avr/ssd1306.h | 17 ++ drivers/avr/ws2812.c | 342 +++++++++++++++++++++++ drivers/avr/ws2812.h | 91 +++++++ keyboards/atreus62/pro_micro.h | 362 ------------------------ keyboards/handwired/promethium/rgbsps.c | 2 +- keyboards/handwired/promethium/rules.mk | 4 +- keyboards/lets_split/common/glcdfont.c | 276 ------------------- keyboards/lets_split/pro_micro.h | 362 ------------------------ keyboards/lets_split/ssd1306.c | 470 -------------------------------- keyboards/lets_split/ssd1306.h | 17 -- keyboards/nyquist/pro_micro.h | 362 ------------------------ keyboards/orthodox/pro_micro.h | 362 ------------------------ keyboards/orthodox/ssd1306.c | 470 -------------------------------- keyboards/orthodox/ssd1306.h | 17 -- quantum/analog.c | 69 ----- quantum/analog.h | 52 ---- quantum/light_ws2812.c | 342 ----------------------- quantum/light_ws2812.h | 91 ------- quantum/rgblight.h | 2 +- tmk_core/avr.mk | 2 +- 27 files changed, 1690 insertions(+), 3259 deletions(-) create mode 100644 drivers/avr/analog.c create mode 100644 drivers/avr/analog.h create mode 100644 drivers/avr/glcdfont.c create mode 100644 drivers/avr/pro_micro.h create mode 100644 drivers/avr/ssd1306.c create mode 100644 drivers/avr/ssd1306.h create mode 100644 drivers/avr/ws2812.c create mode 100644 drivers/avr/ws2812.h delete mode 100644 keyboards/atreus62/pro_micro.h delete mode 100644 keyboards/lets_split/common/glcdfont.c delete mode 100644 keyboards/lets_split/pro_micro.h delete mode 100644 keyboards/lets_split/ssd1306.c delete mode 100644 keyboards/lets_split/ssd1306.h delete mode 100644 keyboards/nyquist/pro_micro.h delete mode 100644 keyboards/orthodox/pro_micro.h delete mode 100644 keyboards/orthodox/ssd1306.c delete mode 100644 keyboards/orthodox/ssd1306.h delete mode 100644 quantum/analog.c delete mode 100644 quantum/analog.h delete mode 100755 quantum/light_ws2812.c delete mode 100755 quantum/light_ws2812.h (limited to 'keyboards/lets_split') diff --git a/common.mk b/common.mk index f87c20934..5b49680ea 100644 --- a/common.mk +++ b/common.mk @@ -9,6 +9,9 @@ LIB_PATH = $(TOP_DIR)/lib QUANTUM_DIR = quantum QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR) +DRIVER_DIR = drivers +DRIVER_PATH = $(TOP_DIR)/$(DRIVER_DIR) + BUILD_DIR := $(TOP_DIR)/.build COMMON_VPATH := $(TOP_DIR) @@ -17,4 +20,5 @@ COMMON_VPATH += $(QUANTUM_PATH) COMMON_VPATH += $(QUANTUM_PATH)/keymap_extras COMMON_VPATH += $(QUANTUM_PATH)/audio COMMON_VPATH += $(QUANTUM_PATH)/process_keycode -COMMON_VPATH += $(QUANTUM_PATH)/api \ No newline at end of file +COMMON_VPATH += $(QUANTUM_PATH)/api +COMMON_VPATH += $(DRIVER_PATH) \ No newline at end of file diff --git a/common_features.mk b/common_features.mk index f5e7af01f..5eb56ccbf 100644 --- a/common_features.mk +++ b/common_features.mk @@ -87,7 +87,7 @@ endif ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) OPT_DEFS += -DRGBLIGHT_ENABLE - SRC += $(QUANTUM_DIR)/light_ws2812.c + SRC += ws2812.c SRC += $(QUANTUM_DIR)/rgblight.c CIE1931_CURVE = yes LED_BREATHING_TABLE = yes diff --git a/drivers/avr/analog.c b/drivers/avr/analog.c new file mode 100644 index 000000000..1ec38df75 --- /dev/null +++ b/drivers/avr/analog.c @@ -0,0 +1,69 @@ +/* Copyright 2015 Jack Humbert + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Simple analog to digitial conversion + +#include +#include +#include +#include "analog.h" + + +static uint8_t aref = (1<= 12) return 0; + return adc_read(pgm_read_byte(pin_to_mux + pin)); +#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) + if (pin >= 8) return 0; + return adc_read(pin); +#else + return 0; +#endif +} + +// Mux input +int16_t adc_read(uint8_t mux) +{ +#if defined(__AVR_AT90USB162__) + return 0; +#else + uint8_t low; + + ADCSRA = (1<. + */ + +#ifndef _analog_h_included__ +#define _analog_h_included__ + +#include + +void analogReference(uint8_t mode); +int16_t analogRead(uint8_t pin); +int16_t adc_read(uint8_t mux); + +#define ADC_REF_POWER (1< + #include +#elif defined(ESP8266) + #include +#else + #define PROGMEM +#endif + +// Standard ASCII 5x7 font + +static const unsigned char font[] PROGMEM = { + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, + 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, + 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, + 0x18, 0x3C, 0x7E, 0x3C, 0x18, + 0x1C, 0x57, 0x7D, 0x57, 0x1C, + 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, + 0x00, 0x18, 0x3C, 0x18, 0x00, + 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, + 0x00, 0x18, 0x24, 0x18, 0x00, + 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, + 0x30, 0x48, 0x3A, 0x06, 0x0E, + 0x26, 0x29, 0x79, 0x29, 0x26, + 0x40, 0x7F, 0x05, 0x05, 0x07, + 0x40, 0x7F, 0x05, 0x25, 0x3F, + 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, + 0x7F, 0x3E, 0x1C, 0x1C, 0x08, + 0x08, 0x1C, 0x1C, 0x3E, 0x7F, + 0x14, 0x22, 0x7F, 0x22, 0x14, + 0x5F, 0x5F, 0x00, 0x5F, 0x5F, + 0x06, 0x09, 0x7F, 0x01, 0x7F, + 0x00, 0x66, 0x89, 0x95, 0x6A, + 0x60, 0x60, 0x60, 0x60, 0x60, + 0x94, 0xA2, 0xFF, 0xA2, 0x94, + 0x08, 0x04, 0x7E, 0x04, 0x08, + 0x10, 0x20, 0x7E, 0x20, 0x10, + 0x08, 0x08, 0x2A, 0x1C, 0x08, + 0x08, 0x1C, 0x2A, 0x08, 0x08, + 0x1E, 0x10, 0x10, 0x10, 0x10, + 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, + 0x30, 0x38, 0x3E, 0x38, 0x30, + 0x06, 0x0E, 0x3E, 0x0E, 0x06, + 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5F, 0x00, 0x00, + 0x00, 0x07, 0x00, 0x07, 0x00, + 0x14, 0x7F, 0x14, 0x7F, 0x14, + 0x24, 0x2A, 0x7F, 0x2A, 0x12, + 0x23, 0x13, 0x08, 0x64, 0x62, + 0x36, 0x49, 0x56, 0x20, 0x50, + 0x00, 0x08, 0x07, 0x03, 0x00, + 0x00, 0x1C, 0x22, 0x41, 0x00, + 0x00, 0x41, 0x22, 0x1C, 0x00, + 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, + 0x08, 0x08, 0x3E, 0x08, 0x08, + 0x00, 0x80, 0x70, 0x30, 0x00, + 0x08, 0x08, 0x08, 0x08, 0x08, + 0x00, 0x00, 0x60, 0x60, 0x00, + 0x20, 0x10, 0x08, 0x04, 0x02, + 0x3E, 0x51, 0x49, 0x45, 0x3E, + 0x00, 0x42, 0x7F, 0x40, 0x00, + 0x72, 0x49, 0x49, 0x49, 0x46, + 0x21, 0x41, 0x49, 0x4D, 0x33, + 0x18, 0x14, 0x12, 0x7F, 0x10, + 0x27, 0x45, 0x45, 0x45, 0x39, + 0x3C, 0x4A, 0x49, 0x49, 0x31, + 0x41, 0x21, 0x11, 0x09, 0x07, + 0x36, 0x49, 0x49, 0x49, 0x36, + 0x46, 0x49, 0x49, 0x29, 0x1E, + 0x00, 0x00, 0x14, 0x00, 0x00, + 0x00, 0x40, 0x34, 0x00, 0x00, + 0x00, 0x08, 0x14, 0x22, 0x41, + 0x14, 0x14, 0x14, 0x14, 0x14, + 0x00, 0x41, 0x22, 0x14, 0x08, + 0x02, 0x01, 0x59, 0x09, 0x06, + 0x3E, 0x41, 0x5D, 0x59, 0x4E, + 0x7C, 0x12, 0x11, 0x12, 0x7C, + 0x7F, 0x49, 0x49, 0x49, 0x36, + 0x3E, 0x41, 0x41, 0x41, 0x22, + 0x7F, 0x41, 0x41, 0x41, 0x3E, + 0x7F, 0x49, 0x49, 0x49, 0x41, + 0x7F, 0x09, 0x09, 0x09, 0x01, + 0x3E, 0x41, 0x41, 0x51, 0x73, + 0x7F, 0x08, 0x08, 0x08, 0x7F, + 0x00, 0x41, 0x7F, 0x41, 0x00, + 0x20, 0x40, 0x41, 0x3F, 0x01, + 0x7F, 0x08, 0x14, 0x22, 0x41, + 0x7F, 0x40, 0x40, 0x40, 0x40, + 0x7F, 0x02, 0x1C, 0x02, 0x7F, + 0x7F, 0x04, 0x08, 0x10, 0x7F, + 0x3E, 0x41, 0x41, 0x41, 0x3E, + 0x7F, 0x09, 0x09, 0x09, 0x06, + 0x3E, 0x41, 0x51, 0x21, 0x5E, + 0x7F, 0x09, 0x19, 0x29, 0x46, + 0x26, 0x49, 0x49, 0x49, 0x32, + 0x03, 0x01, 0x7F, 0x01, 0x03, + 0x3F, 0x40, 0x40, 0x40, 0x3F, + 0x1F, 0x20, 0x40, 0x20, 0x1F, + 0x3F, 0x40, 0x38, 0x40, 0x3F, + 0x63, 0x14, 0x08, 0x14, 0x63, + 0x03, 0x04, 0x78, 0x04, 0x03, + 0x61, 0x59, 0x49, 0x4D, 0x43, + 0x00, 0x7F, 0x41, 0x41, 0x41, + 0x02, 0x04, 0x08, 0x10, 0x20, + 0x00, 0x41, 0x41, 0x41, 0x7F, + 0x04, 0x02, 0x01, 0x02, 0x04, + 0x40, 0x40, 0x40, 0x40, 0x40, + 0x00, 0x03, 0x07, 0x08, 0x00, + 0x20, 0x54, 0x54, 0x78, 0x40, + 0x7F, 0x28, 0x44, 0x44, 0x38, + 0x38, 0x44, 0x44, 0x44, 0x28, + 0x38, 0x44, 0x44, 0x28, 0x7F, + 0x38, 0x54, 0x54, 0x54, 0x18, + 0x00, 0x08, 0x7E, 0x09, 0x02, + 0x18, 0xA4, 0xA4, 0x9C, 0x78, + 0x7F, 0x08, 0x04, 0x04, 0x78, + 0x00, 0x44, 0x7D, 0x40, 0x00, + 0x20, 0x40, 0x40, 0x3D, 0x00, + 0x7F, 0x10, 0x28, 0x44, 0x00, + 0x00, 0x41, 0x7F, 0x40, 0x00, + 0x7C, 0x04, 0x78, 0x04, 0x78, + 0x7C, 0x08, 0x04, 0x04, 0x78, + 0x38, 0x44, 0x44, 0x44, 0x38, + 0xFC, 0x18, 0x24, 0x24, 0x18, + 0x18, 0x24, 0x24, 0x18, 0xFC, + 0x7C, 0x08, 0x04, 0x04, 0x08, + 0x48, 0x54, 0x54, 0x54, 0x24, + 0x04, 0x04, 0x3F, 0x44, 0x24, + 0x3C, 0x40, 0x40, 0x20, 0x7C, + 0x1C, 0x20, 0x40, 0x20, 0x1C, + 0x3C, 0x40, 0x30, 0x40, 0x3C, + 0x44, 0x28, 0x10, 0x28, 0x44, + 0x4C, 0x90, 0x90, 0x90, 0x7C, + 0x44, 0x64, 0x54, 0x4C, 0x44, + 0x00, 0x08, 0x36, 0x41, 0x00, + 0x00, 0x00, 0x77, 0x00, 0x00, + 0x00, 0x41, 0x36, 0x08, 0x00, + 0x02, 0x01, 0x02, 0x04, 0x02, + 0x3C, 0x26, 0x23, 0x26, 0x3C, + 0x1E, 0xA1, 0xA1, 0x61, 0x12, + 0x3A, 0x40, 0x40, 0x20, 0x7A, + 0x38, 0x54, 0x54, 0x55, 0x59, + 0x21, 0x55, 0x55, 0x79, 0x41, + 0x22, 0x54, 0x54, 0x78, 0x42, // a-umlaut + 0x21, 0x55, 0x54, 0x78, 0x40, + 0x20, 0x54, 0x55, 0x79, 0x40, + 0x0C, 0x1E, 0x52, 0x72, 0x12, + 0x39, 0x55, 0x55, 0x55, 0x59, + 0x39, 0x54, 0x54, 0x54, 0x59, + 0x39, 0x55, 0x54, 0x54, 0x58, + 0x00, 0x00, 0x45, 0x7C, 0x41, + 0x00, 0x02, 0x45, 0x7D, 0x42, + 0x00, 0x01, 0x45, 0x7C, 0x40, + 0x7D, 0x12, 0x11, 0x12, 0x7D, // A-umlaut + 0xF0, 0x28, 0x25, 0x28, 0xF0, + 0x7C, 0x54, 0x55, 0x45, 0x00, + 0x20, 0x54, 0x54, 0x7C, 0x54, + 0x7C, 0x0A, 0x09, 0x7F, 0x49, + 0x32, 0x49, 0x49, 0x49, 0x32, + 0x3A, 0x44, 0x44, 0x44, 0x3A, // o-umlaut + 0x32, 0x4A, 0x48, 0x48, 0x30, + 0x3A, 0x41, 0x41, 0x21, 0x7A, + 0x3A, 0x42, 0x40, 0x20, 0x78, + 0x00, 0x9D, 0xA0, 0xA0, 0x7D, + 0x3D, 0x42, 0x42, 0x42, 0x3D, // O-umlaut + 0x3D, 0x40, 0x40, 0x40, 0x3D, + 0x3C, 0x24, 0xFF, 0x24, 0x24, + 0x48, 0x7E, 0x49, 0x43, 0x66, + 0x2B, 0x2F, 0xFC, 0x2F, 0x2B, + 0xFF, 0x09, 0x29, 0xF6, 0x20, + 0xC0, 0x88, 0x7E, 0x09, 0x03, + 0x20, 0x54, 0x54, 0x79, 0x41, + 0x00, 0x00, 0x44, 0x7D, 0x41, + 0x30, 0x48, 0x48, 0x4A, 0x32, + 0x38, 0x40, 0x40, 0x22, 0x7A, + 0x00, 0x7A, 0x0A, 0x0A, 0x72, + 0x7D, 0x0D, 0x19, 0x31, 0x7D, + 0x26, 0x29, 0x29, 0x2F, 0x28, + 0x26, 0x29, 0x29, 0x29, 0x26, + 0x30, 0x48, 0x4D, 0x40, 0x20, + 0x38, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x38, + 0x2F, 0x10, 0xC8, 0xAC, 0xBA, + 0x2F, 0x10, 0x28, 0x34, 0xFA, + 0x00, 0x00, 0x7B, 0x00, 0x00, + 0x08, 0x14, 0x2A, 0x14, 0x22, + 0x22, 0x14, 0x2A, 0x14, 0x08, + 0x55, 0x00, 0x55, 0x00, 0x55, // #176 (25% block) missing in old code + 0xAA, 0x55, 0xAA, 0x55, 0xAA, // 50% block + 0xFF, 0x55, 0xFF, 0x55, 0xFF, // 75% block + 0x00, 0x00, 0x00, 0xFF, 0x00, + 0x10, 0x10, 0x10, 0xFF, 0x00, + 0x14, 0x14, 0x14, 0xFF, 0x00, + 0x10, 0x10, 0xFF, 0x00, 0xFF, + 0x10, 0x10, 0xF0, 0x10, 0xF0, + 0x14, 0x14, 0x14, 0xFC, 0x00, + 0x14, 0x14, 0xF7, 0x00, 0xFF, + 0x00, 0x00, 0xFF, 0x00, 0xFF, + 0x14, 0x14, 0xF4, 0x04, 0xFC, + 0x14, 0x14, 0x17, 0x10, 0x1F, + 0x10, 0x10, 0x1F, 0x10, 0x1F, + 0x14, 0x14, 0x14, 0x1F, 0x00, + 0x10, 0x10, 0x10, 0xF0, 0x00, + 0x00, 0x00, 0x00, 0x1F, 0x10, + 0x10, 0x10, 0x10, 0x1F, 0x10, + 0x10, 0x10, 0x10, 0xF0, 0x10, + 0x00, 0x00, 0x00, 0xFF, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0xFF, 0x10, + 0x00, 0x00, 0x00, 0xFF, 0x14, + 0x00, 0x00, 0xFF, 0x00, 0xFF, + 0x00, 0x00, 0x1F, 0x10, 0x17, + 0x00, 0x00, 0xFC, 0x04, 0xF4, + 0x14, 0x14, 0x17, 0x10, 0x17, + 0x14, 0x14, 0xF4, 0x04, 0xF4, + 0x00, 0x00, 0xFF, 0x00, 0xF7, + 0x14, 0x14, 0x14, 0x14, 0x14, + 0x14, 0x14, 0xF7, 0x00, 0xF7, + 0x14, 0x14, 0x14, 0x17, 0x14, + 0x10, 0x10, 0x1F, 0x10, 0x1F, + 0x14, 0x14, 0x14, 0xF4, 0x14, + 0x10, 0x10, 0xF0, 0x10, 0xF0, + 0x00, 0x00, 0x1F, 0x10, 0x1F, + 0x00, 0x00, 0x00, 0x1F, 0x14, + 0x00, 0x00, 0x00, 0xFC, 0x14, + 0x00, 0x00, 0xF0, 0x10, 0xF0, + 0x10, 0x10, 0xFF, 0x10, 0xFF, + 0x14, 0x14, 0x14, 0xFF, 0x14, + 0x10, 0x10, 0x10, 0x1F, 0x00, + 0x00, 0x00, 0x00, 0xF0, 0x10, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, + 0xFF, 0xFF, 0xFF, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xFF, 0xFF, + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, + 0x38, 0x44, 0x44, 0x38, 0x44, + 0xFC, 0x4A, 0x4A, 0x4A, 0x34, // sharp-s or beta + 0x7E, 0x02, 0x02, 0x06, 0x06, + 0x02, 0x7E, 0x02, 0x7E, 0x02, + 0x63, 0x55, 0x49, 0x41, 0x63, + 0x38, 0x44, 0x44, 0x3C, 0x04, + 0x40, 0x7E, 0x20, 0x1E, 0x20, + 0x06, 0x02, 0x7E, 0x02, 0x02, + 0x99, 0xA5, 0xE7, 0xA5, 0x99, + 0x1C, 0x2A, 0x49, 0x2A, 0x1C, + 0x4C, 0x72, 0x01, 0x72, 0x4C, + 0x30, 0x4A, 0x4D, 0x4D, 0x30, + 0x30, 0x48, 0x78, 0x48, 0x30, + 0xBC, 0x62, 0x5A, 0x46, 0x3D, + 0x3E, 0x49, 0x49, 0x49, 0x00, + 0x7E, 0x01, 0x01, 0x01, 0x7E, + 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, + 0x44, 0x44, 0x5F, 0x44, 0x44, + 0x40, 0x51, 0x4A, 0x44, 0x40, + 0x40, 0x44, 0x4A, 0x51, 0x40, + 0x00, 0x00, 0xFF, 0x01, 0x03, + 0xE0, 0x80, 0xFF, 0x00, 0x00, + 0x08, 0x08, 0x6B, 0x6B, 0x08, + 0x36, 0x12, 0x36, 0x24, 0x36, + 0x06, 0x0F, 0x09, 0x0F, 0x06, + 0x00, 0x00, 0x18, 0x18, 0x00, + 0x00, 0x00, 0x10, 0x10, 0x00, + 0x30, 0x40, 0xFF, 0x01, 0x01, + 0x00, 0x1F, 0x01, 0x01, 0x1E, + 0x00, 0x19, 0x1D, 0x17, 0x12, + 0x00, 0x3C, 0x3C, 0x3C, 0x3C, + 0x00, 0x00, 0x00, 0x00, 0x00 // #255 NBSP +}; +#endif // FONT5X7_H diff --git a/drivers/avr/pro_micro.h b/drivers/avr/pro_micro.h new file mode 100644 index 000000000..f9e7ed75d --- /dev/null +++ b/drivers/avr/pro_micro.h @@ -0,0 +1,362 @@ +/* + pins_arduino.h - Pin definition functions for Arduino + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2007 David A. Mellis + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ +*/ + +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +// Workaround for wrong definitions in "iom32u4.h". +// This should be fixed in the AVR toolchain. +#undef UHCON +#undef UHINT +#undef UHIEN +#undef UHADDR +#undef UHFNUM +#undef UHFNUML +#undef UHFNUMH +#undef UHFLEN +#undef UPINRQX +#undef UPINTX +#undef UPNUM +#undef UPRST +#undef UPCONX +#undef UPCFG0X +#undef UPCFG1X +#undef UPSTAX +#undef UPCFG2X +#undef UPIENX +#undef UPDATX +#undef TCCR2A +#undef WGM20 +#undef WGM21 +#undef COM2B0 +#undef COM2B1 +#undef COM2A0 +#undef COM2A1 +#undef TCCR2B +#undef CS20 +#undef CS21 +#undef CS22 +#undef WGM22 +#undef FOC2B +#undef FOC2A +#undef TCNT2 +#undef TCNT2_0 +#undef TCNT2_1 +#undef TCNT2_2 +#undef TCNT2_3 +#undef TCNT2_4 +#undef TCNT2_5 +#undef TCNT2_6 +#undef TCNT2_7 +#undef OCR2A +#undef OCR2_0 +#undef OCR2_1 +#undef OCR2_2 +#undef OCR2_3 +#undef OCR2_4 +#undef OCR2_5 +#undef OCR2_6 +#undef OCR2_7 +#undef OCR2B +#undef OCR2_0 +#undef OCR2_1 +#undef OCR2_2 +#undef OCR2_3 +#undef OCR2_4 +#undef OCR2_5 +#undef OCR2_6 +#undef OCR2_7 + +#define NUM_DIGITAL_PINS 30 +#define NUM_ANALOG_INPUTS 12 + +#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) +#define TXLED0 PORTD |= (1<<5) +#define TXLED1 PORTD &= ~(1<<5) +#define RXLED0 PORTB |= (1<<0) +#define RXLED1 PORTB &= ~(1<<0) + +static const uint8_t SDA = 2; +static const uint8_t SCL = 3; +#define LED_BUILTIN 13 + +// Map SPI port to 'new' pins D14..D17 +static const uint8_t SS = 17; +static const uint8_t MOSI = 16; +static const uint8_t MISO = 14; +static const uint8_t SCK = 15; + +// Mapping of analog pins as digital I/O +// A6-A11 share with digital pins +static const uint8_t ADC0 = 18; +static const uint8_t ADC1 = 19; +static const uint8_t ADC2 = 20; +static const uint8_t ADC3 = 21; +static const uint8_t ADC4 = 22; +static const uint8_t ADC5 = 23; +static const uint8_t ADC6 = 24; // D4 +static const uint8_t ADC7 = 25; // D6 +static const uint8_t ADC8 = 26; // D8 +static const uint8_t ADC9 = 27; // D9 +static const uint8_t ADC10 = 28; // D10 +static const uint8_t ADC11 = 29; // D12 + +#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) +#define digitalPinToPCICRbit(p) 0 +#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) +#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) + +// __AVR_ATmega32U4__ has an unusual mapping of pins to channels +extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; +#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) + +#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) + +#ifdef ARDUINO_MAIN + +// On the Arduino board, digital pins are also used +// for the analog output (software PWM). Analog input +// pins are a separate set. + +// ATMEL ATMEGA32U4 / ARDUINO LEONARDO +// +// D0 PD2 RXD1/INT2 +// D1 PD3 TXD1/INT3 +// D2 PD1 SDA SDA/INT1 +// D3# PD0 PWM8/SCL OC0B/SCL/INT0 +// D4 A6 PD4 ADC8 +// D5# PC6 ??? OC3A/#OC4A +// D6# A7 PD7 FastPWM #OC4D/ADC10 +// D7 PE6 INT6/AIN0 +// +// D8 A8 PB4 ADC11/PCINT4 +// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5 +// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6 +// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7 +// D12 A11 PD6 T1/#OC4D/ADC9 +// D13# PC7 PWM10 CLK0/OC4A +// +// A0 D18 PF7 ADC7 +// A1 D19 PF6 ADC6 +// A2 D20 PF5 ADC5 +// A3 D21 PF4 ADC4 +// A4 D22 PF1 ADC1 +// A5 D23 PF0 ADC0 +// +// New pins D14..D17 to map SPI port to digital pins +// +// MISO D14 PB3 MISO,PCINT3 +// SCK D15 PB1 SCK,PCINT1 +// MOSI D16 PB2 MOSI,PCINT2 +// SS D17 PB0 RXLED,SS/PCINT0 +// +// Connected LEDs on board for TX and RX +// TXLED D24 PD5 XCK1 +// RXLED D17 PB0 +// HWB PE2 HWB + +// these arrays map port names (e.g. port B) to the +// appropriate addresses for various functions (e.g. reading +// and writing) +const uint16_t PROGMEM port_to_mode_PGM[] = { + NOT_A_PORT, + NOT_A_PORT, + (uint16_t) &DDRB, + (uint16_t) &DDRC, + (uint16_t) &DDRD, + (uint16_t) &DDRE, + (uint16_t) &DDRF, +}; + +const uint16_t PROGMEM port_to_output_PGM[] = { + NOT_A_PORT, + NOT_A_PORT, + (uint16_t) &PORTB, + (uint16_t) &PORTC, + (uint16_t) &PORTD, + (uint16_t) &PORTE, + (uint16_t) &PORTF, +}; + +const uint16_t PROGMEM port_to_input_PGM[] = { + NOT_A_PORT, + NOT_A_PORT, + (uint16_t) &PINB, + (uint16_t) &PINC, + (uint16_t) &PIND, + (uint16_t) &PINE, + (uint16_t) &PINF, +}; + +const uint8_t PROGMEM digital_pin_to_port_PGM[] = { + PD, // D0 - PD2 + PD, // D1 - PD3 + PD, // D2 - PD1 + PD, // D3 - PD0 + PD, // D4 - PD4 + PC, // D5 - PC6 + PD, // D6 - PD7 + PE, // D7 - PE6 + + PB, // D8 - PB4 + PB, // D9 - PB5 + PB, // D10 - PB6 + PB, // D11 - PB7 + PD, // D12 - PD6 + PC, // D13 - PC7 + + PB, // D14 - MISO - PB3 + PB, // D15 - SCK - PB1 + PB, // D16 - MOSI - PB2 + PB, // D17 - SS - PB0 + + PF, // D18 - A0 - PF7 + PF, // D19 - A1 - PF6 + PF, // D20 - A2 - PF5 + PF, // D21 - A3 - PF4 + PF, // D22 - A4 - PF1 + PF, // D23 - A5 - PF0 + + PD, // D24 - PD5 + PD, // D25 / D6 - A7 - PD7 + PB, // D26 / D8 - A8 - PB4 + PB, // D27 / D9 - A9 - PB5 + PB, // D28 / D10 - A10 - PB6 + PD, // D29 / D12 - A11 - PD6 +}; + +const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { + _BV(2), // D0 - PD2 + _BV(3), // D1 - PD3 + _BV(1), // D2 - PD1 + _BV(0), // D3 - PD0 + _BV(4), // D4 - PD4 + _BV(6), // D5 - PC6 + _BV(7), // D6 - PD7 + _BV(6), // D7 - PE6 + + _BV(4), // D8 - PB4 + _BV(5), // D9 - PB5 + _BV(6), // D10 - PB6 + _BV(7), // D11 - PB7 + _BV(6), // D12 - PD6 + _BV(7), // D13 - PC7 + + _BV(3), // D14 - MISO - PB3 + _BV(1), // D15 - SCK - PB1 + _BV(2), // D16 - MOSI - PB2 + _BV(0), // D17 - SS - PB0 + + _BV(7), // D18 - A0 - PF7 + _BV(6), // D19 - A1 - PF6 + _BV(5), // D20 - A2 - PF5 + _BV(4), // D21 - A3 - PF4 + _BV(1), // D22 - A4 - PF1 + _BV(0), // D23 - A5 - PF0 + + _BV(5), // D24 - PD5 + _BV(7), // D25 / D6 - A7 - PD7 + _BV(4), // D26 / D8 - A8 - PB4 + _BV(5), // D27 / D9 - A9 - PB5 + _BV(6), // D28 / D10 - A10 - PB6 + _BV(6), // D29 / D12 - A11 - PD6 +}; + +const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + TIMER0B, /* 3 */ + NOT_ON_TIMER, + TIMER3A, /* 5 */ + TIMER4D, /* 6 */ + NOT_ON_TIMER, + + NOT_ON_TIMER, + TIMER1A, /* 9 */ + TIMER1B, /* 10 */ + TIMER0A, /* 11 */ + + NOT_ON_TIMER, + TIMER4A, /* 13 */ + + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, + NOT_ON_TIMER, +}; + +const uint8_t PROGMEM analog_pin_to_channel_PGM[] = { + 7, // A0 PF7 ADC7 + 6, // A1 PF6 ADC6 + 5, // A2 PF5 ADC5 + 4, // A3 PF4 ADC4 + 1, // A4 PF1 ADC1 + 0, // A5 PF0 ADC0 + 8, // A6 D4 PD4 ADC8 + 10, // A7 D6 PD7 ADC10 + 11, // A8 D8 PB4 ADC11 + 12, // A9 D9 PB5 ADC12 + 13, // A10 D10 PB6 ADC13 + 9 // A11 D12 PD6 ADC9 +}; + +#endif /* ARDUINO_MAIN */ + +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#define SERIAL_PORT_MONITOR Serial +#define SERIAL_PORT_USBVIRTUAL Serial +#define SERIAL_PORT_HARDWARE Serial1 +#define SERIAL_PORT_HARDWARE_OPEN Serial1 + +#endif /* Pins_Arduino_h */ diff --git a/drivers/avr/ssd1306.c b/drivers/avr/ssd1306.c new file mode 100644 index 000000000..f9312d2dc --- /dev/null +++ b/drivers/avr/ssd1306.c @@ -0,0 +1,470 @@ +#ifdef SSD1306OLED + +#include "ssd1306.h" +#include "config.h" +#include "i2c.h" +#include +#include "print.h" +#include "lets_split.h" +#include "glcdfont.c" +#ifdef ADAFRUIT_BLE_ENABLE +#include "adafruit_ble.h" +#endif +#ifdef PROTOCOL_LUFA +#include "lufa.h" +#endif +#include "sendchar.h" +#include "pincontrol.h" + +//assign the right code to your layers +#define _BASE 0 +#define _LOWER 8 +#define _RAISE 16 +#define _FNLAYER 64 +#define _NUMLAY 128 +#define _NLOWER 136 +#define _NFNLAYER 192 +#define _MOUSECURSOR 256 +#define _ADJUST 65560 + +// Set this to 1 to help diagnose early startup problems +// when testing power-on with ble. Turn it off otherwise, +// as the latency of printing most of the debug info messes +// with the matrix scan, causing keys to drop. +#define DEBUG_TO_SCREEN 0 + +// Controls the SSD1306 128x32 OLED display via i2c + +#define i2cAddress 0x3C + +#define DisplayHeight 32 +#define DisplayWidth 128 + +#define FontHeight 8 +#define FontWidth 6 + +#define MatrixRows (DisplayHeight / FontHeight) +#define MatrixCols (DisplayWidth / FontWidth) + +struct CharacterMatrix { + uint8_t display[MatrixRows][MatrixCols]; + uint8_t *cursor; + bool dirty; +}; + +static struct CharacterMatrix display; +//static uint16_t last_battery_update; +//static uint32_t vbat; +//#define BatteryUpdateInterval 10000 /* milliseconds */ +#define ScreenOffInterval 300000 /* milliseconds */ +#if DEBUG_TO_SCREEN +static uint8_t displaying; +#endif +static uint16_t last_flush; + +enum ssd1306_cmds { + DisplayOff = 0xAE, + DisplayOn = 0xAF, + + SetContrast = 0x81, + DisplayAllOnResume = 0xA4, + + DisplayAllOn = 0xA5, + NormalDisplay = 0xA6, + InvertDisplay = 0xA7, + SetDisplayOffset = 0xD3, + SetComPins = 0xda, + SetVComDetect = 0xdb, + SetDisplayClockDiv = 0xD5, + SetPreCharge = 0xd9, + SetMultiPlex = 0xa8, + SetLowColumn = 0x00, + SetHighColumn = 0x10, + SetStartLine = 0x40, + + SetMemoryMode = 0x20, + ColumnAddr = 0x21, + PageAddr = 0x22, + + ComScanInc = 0xc0, + ComScanDec = 0xc8, + SegRemap = 0xa0, + SetChargePump = 0x8d, + ExternalVcc = 0x01, + SwitchCapVcc = 0x02, + + ActivateScroll = 0x2f, + DeActivateScroll = 0x2e, + SetVerticalScrollArea = 0xa3, + RightHorizontalScroll = 0x26, + LeftHorizontalScroll = 0x27, + VerticalAndRightHorizontalScroll = 0x29, + VerticalAndLeftHorizontalScroll = 0x2a, +}; + + +// Write command sequence. +// Returns true on success. +static inline bool _send_cmd1(uint8_t cmd) { + bool res = false; + + if (i2c_start_write(i2cAddress)) { + xprintf("failed to start write to %d\n", i2cAddress); + goto done; + } + + if (i2c_master_write(0x0 /* command byte follows */)) { + print("failed to write control byte\n"); + + goto done; + } + + if (i2c_master_write(cmd)) { + xprintf("failed to write command %d\n", cmd); + goto done; + } + res = true; +done: + i2c_master_stop(); + return res; +} + +// Write 2-byte command sequence. +// Returns true on success +static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) { + if (!_send_cmd1(cmd)) { + return false; + } + return _send_cmd1(opr); +} + +// Write 3-byte command sequence. +// Returns true on success +static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) { + if (!_send_cmd1(cmd)) { + return false; + } + if (!_send_cmd1(opr1)) { + return false; + } + return _send_cmd1(opr2); +} + +#define send_cmd1(c) if (!_send_cmd1(c)) {goto done;} +#define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} +#define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} + +static void matrix_clear(struct CharacterMatrix *matrix); + +static void clear_display(void) { + matrix_clear(&display); + + // Clear all of the display bits (there can be random noise + // in the RAM on startup) + send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1); + send_cmd3(ColumnAddr, 0, DisplayWidth - 1); + + if (i2c_start_write(i2cAddress)) { + goto done; + } + if (i2c_master_write(0x40)) { + // Data mode + goto done; + } + for (uint8_t row = 0; row < MatrixRows; ++row) { + for (uint8_t col = 0; col < DisplayWidth; ++col) { + i2c_master_write(0); + } + } + + display.dirty = false; + +done: + i2c_master_stop(); +} + +#if DEBUG_TO_SCREEN +#undef sendchar +static int8_t capture_sendchar(uint8_t c) { + sendchar(c); + iota_gfx_write_char(c); + + if (!displaying) { + iota_gfx_flush(); + } + return 0; +} +#endif + +bool iota_gfx_init(void) { + bool success = false; + + send_cmd1(DisplayOff); + send_cmd2(SetDisplayClockDiv, 0x80); + send_cmd2(SetMultiPlex, DisplayHeight - 1); + + send_cmd2(SetDisplayOffset, 0); + + + send_cmd1(SetStartLine | 0x0); + send_cmd2(SetChargePump, 0x14 /* Enable */); + send_cmd2(SetMemoryMode, 0 /* horizontal addressing */); + +/// Flips the display orientation 0 degrees + send_cmd1(SegRemap | 0x1); + send_cmd1(ComScanDec); +/* +// the following Flip the display orientation 180 degrees + send_cmd1(SegRemap); + send_cmd1(ComScanInc); +// end flip */ + send_cmd2(SetComPins, 0x2); + send_cmd2(SetContrast, 0x8f); + send_cmd2(SetPreCharge, 0xf1); + send_cmd2(SetVComDetect, 0x40); + send_cmd1(DisplayAllOnResume); + send_cmd1(NormalDisplay); + send_cmd1(DeActivateScroll); + send_cmd1(DisplayOn); + + send_cmd2(SetContrast, 0); // Dim + + clear_display(); + + success = true; + + iota_gfx_flush(); + +#if DEBUG_TO_SCREEN + print_set_sendchar(capture_sendchar); +#endif + +done: + return success; +} + +bool iota_gfx_off(void) { + bool success = false; + + send_cmd1(DisplayOff); + success = true; + +done: + return success; +} + +bool iota_gfx_on(void) { + bool success = false; + + send_cmd1(DisplayOn); + success = true; + +done: + return success; +} + +static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { + *matrix->cursor = c; + ++matrix->cursor; + + if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) { + // We went off the end; scroll the display upwards by one line + memmove(&matrix->display[0], &matrix->display[1], + MatrixCols * (MatrixRows - 1)); + matrix->cursor = &matrix->display[MatrixRows - 1][0]; + memset(matrix->cursor, ' ', MatrixCols); + } +} + +static void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { + matrix->dirty = true; + + if (c == '\n') { + // Clear to end of line from the cursor and then move to the + // start of the next line + uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols; + + while (cursor_col++ < MatrixCols) { + matrix_write_char_inner(matrix, ' '); + } + return; + } + + matrix_write_char_inner(matrix, c); +} + +void iota_gfx_write_char(uint8_t c) { + matrix_write_char(&display, c); +} + +static void matrix_write(struct CharacterMatrix *matrix, const char *data) { + const char *end = data + strlen(data); + while (data < end) { + matrix_write_char(matrix, *data); + ++data; + } +} + +void iota_gfx_write(const char *data) { + matrix_write(&display, data); +} + +static void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { + while (true) { + uint8_t c = pgm_read_byte(data); + if (c == 0) { + return; + } + matrix_write_char(matrix, c); + ++data; + } +} + +void iota_gfx_write_P(const char *data) { + matrix_write_P(&display, data); +} + +static void matrix_clear(struct CharacterMatrix *matrix) { + memset(matrix->display, ' ', sizeof(matrix->display)); + matrix->cursor = &matrix->display[0][0]; + matrix->dirty = true; +} + +void iota_gfx_clear_screen(void) { + matrix_clear(&display); +} + +static void matrix_render(struct CharacterMatrix *matrix) { + last_flush = timer_read(); + iota_gfx_on(); +#if DEBUG_TO_SCREEN + ++displaying; +#endif + + // Move to the home position + send_cmd3(PageAddr, 0, MatrixRows - 1); + send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1); + + if (i2c_start_write(i2cAddress)) { + goto done; + } + if (i2c_master_write(0x40)) { + // Data mode + goto done; + } + + for (uint8_t row = 0; row < MatrixRows; ++row) { + for (uint8_t col = 0; col < MatrixCols; ++col) { + const uint8_t *glyph = font + (matrix->display[row][col] * (FontWidth - 1)); + + for (uint8_t glyphCol = 0; glyphCol < FontWidth - 1; ++glyphCol) { + uint8_t colBits = pgm_read_byte(glyph + glyphCol); + i2c_master_write(colBits); + } + + // 1 column of space between chars (it's not included in the glyph) + i2c_master_write(0); + } + } + + matrix->dirty = false; + +done: + i2c_master_stop(); +#if DEBUG_TO_SCREEN + --displaying; +#endif +} + +void iota_gfx_flush(void) { + matrix_render(&display); +} + +static void matrix_update(struct CharacterMatrix *dest, + const struct CharacterMatrix *source) { + if (memcmp(dest->display, source->display, sizeof(dest->display))) { + memcpy(dest->display, source->display, sizeof(dest->display)); + dest->dirty = true; + } +} + +static void render_status_info(void) { +#if DEBUG_TO_SCREEN + if (debug_enable) { + return; + } +#endif + + struct CharacterMatrix matrix; + + matrix_clear(&matrix); + matrix_write_P(&matrix, PSTR("USB: ")); +#ifdef PROTOCOL_LUFA + switch (USB_DeviceState) { + case DEVICE_STATE_Unattached: + matrix_write_P(&matrix, PSTR("Unattached")); + break; + case DEVICE_STATE_Suspended: + matrix_write_P(&matrix, PSTR("Suspended")); + break; + case DEVICE_STATE_Configured: + matrix_write_P(&matrix, PSTR("Connected")); + break; + case DEVICE_STATE_Powered: + matrix_write_P(&matrix, PSTR("Powered")); + break; + case DEVICE_STATE_Default: + matrix_write_P(&matrix, PSTR("Default")); + break; + case DEVICE_STATE_Addressed: + matrix_write_P(&matrix, PSTR("Addressed")); + break; + default: + matrix_write_P(&matrix, PSTR("Invalid")); + } +#endif + +// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below + + char buf[40]; + snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); + matrix_write_P(&matrix, PSTR("\n\nLayer: ")); + switch (layer_state) { + case _BASE: + matrix_write_P(&matrix, PSTR("Default")); + break; + case _RAISE: + matrix_write_P(&matrix, PSTR("Raise")); + break; + case _LOWER: + matrix_write_P(&matrix, PSTR("Lower")); + break; + case _ADJUST: + matrix_write_P(&matrix, PSTR("ADJUST")); + break; + default: + matrix_write(&matrix, buf); + } + + // Host Keyboard LED Status + char led[40]; + snprintf(led, sizeof(led), "\n%s %s %s", + (host_keyboard_leds() & (1< ScreenOffInterval) { + iota_gfx_off(); + } +} +#endif diff --git a/drivers/avr/ssd1306.h b/drivers/avr/ssd1306.h new file mode 100644 index 000000000..b0c74f987 --- /dev/null +++ b/drivers/avr/ssd1306.h @@ -0,0 +1,17 @@ +#ifndef SSD1306_H +#define SSD1306_H + +#include +#include + +bool iota_gfx_init(void); +void iota_gfx_task(void); +bool iota_gfx_off(void); +bool iota_gfx_on(void); +void iota_gfx_flush(void); +void iota_gfx_write_char(uint8_t c); +void iota_gfx_write(const char *data); +void iota_gfx_write_P(const char *data); +void iota_gfx_clear_screen(void); + +#endif diff --git a/drivers/avr/ws2812.c b/drivers/avr/ws2812.c new file mode 100644 index 000000000..59e032bf7 --- /dev/null +++ b/drivers/avr/ws2812.c @@ -0,0 +1,342 @@ +/* +* light weight WS2812 lib V2.0b +* +* Controls WS2811/WS2812/WS2812B RGB-LEDs +* Author: Tim (cpldcpu@gmail.com) +* +* Jan 18th, 2014 v2.0b Initial Version +* Nov 29th, 2015 v2.3 Added SK6812RGBW support +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ + +#include "ws2812.h" +#include +#include +#include +#include "debug.h" + +#ifdef RGBW_BB_TWI + +// Port for the I2C +#define I2C_DDR DDRD +#define I2C_PIN PIND +#define I2C_PORT PORTD + +// Pins to be used in the bit banging +#define I2C_CLK 0 +#define I2C_DAT 1 + +#define I2C_DATA_HI()\ +I2C_DDR &= ~ (1 << I2C_DAT);\ +I2C_PORT |= (1 << I2C_DAT); +#define I2C_DATA_LO()\ +I2C_DDR |= (1 << I2C_DAT);\ +I2C_PORT &= ~ (1 << I2C_DAT); + +#define I2C_CLOCK_HI()\ +I2C_DDR &= ~ (1 << I2C_CLK);\ +I2C_PORT |= (1 << I2C_CLK); +#define I2C_CLOCK_LO()\ +I2C_DDR |= (1 << I2C_CLK);\ +I2C_PORT &= ~ (1 << I2C_CLK); + +#define I2C_DELAY 1 + +void I2C_WriteBit(unsigned char c) +{ + if (c > 0) + { + I2C_DATA_HI(); + } + else + { + I2C_DATA_LO(); + } + + I2C_CLOCK_HI(); + _delay_us(I2C_DELAY); + + I2C_CLOCK_LO(); + _delay_us(I2C_DELAY); + + if (c > 0) + { + I2C_DATA_LO(); + } + + _delay_us(I2C_DELAY); +} + +// Inits bitbanging port, must be called before using the functions below +// +void I2C_Init(void) +{ + I2C_PORT &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK)); + + I2C_CLOCK_HI(); + I2C_DATA_HI(); + + _delay_us(I2C_DELAY); +} + +// Send a START Condition +// +void I2C_Start(void) +{ + // set both to high at the same time + I2C_DDR &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK)); + _delay_us(I2C_DELAY); + + I2C_DATA_LO(); + _delay_us(I2C_DELAY); + + I2C_CLOCK_LO(); + _delay_us(I2C_DELAY); +} + +// Send a STOP Condition +// +void I2C_Stop(void) +{ + I2C_CLOCK_HI(); + _delay_us(I2C_DELAY); + + I2C_DATA_HI(); + _delay_us(I2C_DELAY); +} + +// write a byte to the I2C slave device +// +unsigned char I2C_Write(unsigned char c) +{ + for (char i = 0; i < 8; i++) + { + I2C_WriteBit(c & 128); + + c <<= 1; + } + + + I2C_WriteBit(0); + _delay_us(I2C_DELAY); + _delay_us(I2C_DELAY); + + // _delay_us(I2C_DELAY); + //return I2C_ReadBit(); + return 0; +} + + +#endif + +// Setleds for standard RGB +void inline ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) +{ + // ws2812_setleds_pin(ledarray,leds, _BV(ws2812_pin)); + ws2812_setleds_pin(ledarray,leds, _BV(RGB_DI_PIN & 0xF)); +} + +void inline ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask) +{ + // ws2812_DDRREG |= pinmask; // Enable DDR + // new universal format (DDR) + _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= pinmask; + + ws2812_sendarray_mask((uint8_t*)ledarray,leds+leds+leds,pinmask); + _delay_us(50); +} + +// Setleds for SK6812RGBW +void inline ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t leds) +{ + + #ifdef RGBW_BB_TWI + uint8_t sreg_prev, twcr_prev; + sreg_prev=SREG; + twcr_prev=TWCR; + cli(); + TWCR &= ~(1<> 4) + 1) |= _BV(RGB_DI_PIN & 0xF); + + ws2812_sendarray_mask((uint8_t*)ledarray,leds<<2,_BV(RGB_DI_PIN & 0xF)); + + + #ifndef RGBW_BB_TWI + _delay_us(80); + #endif +} + +void ws2812_sendarray(uint8_t *data,uint16_t datlen) +{ + ws2812_sendarray_mask(data,datlen,_BV(RGB_DI_PIN & 0xF)); +} + +/* + This routine writes an array of bytes with RGB values to the Dataout pin + using the fast 800kHz clockless WS2811/2812 protocol. +*/ + +// Timing in ns +#define w_zeropulse 350 +#define w_onepulse 900 +#define w_totalperiod 1250 + +// Fixed cycles used by the inner loop +#define w_fixedlow 2 +#define w_fixedhigh 4 +#define w_fixedtotal 8 + +// Insert NOPs to match the timing, if possible +#define w_zerocycles (((F_CPU/1000)*w_zeropulse )/1000000) +#define w_onecycles (((F_CPU/1000)*w_onepulse +500000)/1000000) +#define w_totalcycles (((F_CPU/1000)*w_totalperiod +500000)/1000000) + +// w1 - nops between rising edge and falling edge - low +#define w1 (w_zerocycles-w_fixedlow) +// w2 nops between fe low and fe high +#define w2 (w_onecycles-w_fixedhigh-w1) +// w3 nops to complete loop +#define w3 (w_totalcycles-w_fixedtotal-w1-w2) + +#if w1>0 + #define w1_nops w1 +#else + #define w1_nops 0 +#endif + +// The only critical timing parameter is the minimum pulse length of the "0" +// Warn or throw error if this timing can not be met with current F_CPU settings. +#define w_lowtime ((w1_nops+w_fixedlow)*1000000)/(F_CPU/1000) +#if w_lowtime>550 + #error "Light_ws2812: Sorry, the clock speed is too low. Did you set F_CPU correctly?" +#elif w_lowtime>450 + #warning "Light_ws2812: The timing is critical and may only work on WS2812B, not on WS2812(S)." + #warning "Please consider a higher clockspeed, if possible" +#endif + +#if w2>0 +#define w2_nops w2 +#else +#define w2_nops 0 +#endif + +#if w3>0 +#define w3_nops w3 +#else +#define w3_nops 0 +#endif + +#define w_nop1 "nop \n\t" +#define w_nop2 "rjmp .+0 \n\t" +#define w_nop4 w_nop2 w_nop2 +#define w_nop8 w_nop4 w_nop4 +#define w_nop16 w_nop8 w_nop8 + +void inline ws2812_sendarray_mask(uint8_t *data,uint16_t datlen,uint8_t maskhi) +{ + uint8_t curbyte,ctr,masklo; + uint8_t sreg_prev; + + // masklo =~maskhi&ws2812_PORTREG; + // maskhi |= ws2812_PORTREG; + masklo =~maskhi&_SFR_IO8((RGB_DI_PIN >> 4) + 2); + maskhi |= _SFR_IO8((RGB_DI_PIN >> 4) + 2); + sreg_prev=SREG; + cli(); + + while (datlen--) { + curbyte=(*data++); + + asm volatile( + " ldi %0,8 \n\t" + "loop%=: \n\t" + " out %2,%3 \n\t" // '1' [01] '0' [01] - re +#if (w1_nops&1) +w_nop1 +#endif +#if (w1_nops&2) +w_nop2 +#endif +#if (w1_nops&4) +w_nop4 +#endif +#if (w1_nops&8) +w_nop8 +#endif +#if (w1_nops&16) +w_nop16 +#endif + " sbrs %1,7 \n\t" // '1' [03] '0' [02] + " out %2,%4 \n\t" // '1' [--] '0' [03] - fe-low + " lsl %1 \n\t" // '1' [04] '0' [04] +#if (w2_nops&1) + w_nop1 +#endif +#if (w2_nops&2) + w_nop2 +#endif +#if (w2_nops&4) + w_nop4 +#endif +#if (w2_nops&8) + w_nop8 +#endif +#if (w2_nops&16) + w_nop16 +#endif + " out %2,%4 \n\t" // '1' [+1] '0' [+1] - fe-high +#if (w3_nops&1) +w_nop1 +#endif +#if (w3_nops&2) +w_nop2 +#endif +#if (w3_nops&4) +w_nop4 +#endif +#if (w3_nops&8) +w_nop8 +#endif +#if (w3_nops&16) +w_nop16 +#endif + + " dec %0 \n\t" // '1' [+2] '0' [+2] + " brne loop%=\n\t" // '1' [+3] '0' [+4] + : "=&d" (ctr) + : "r" (curbyte), "I" (_SFR_IO_ADDR(_SFR_IO8((RGB_DI_PIN >> 4) + 2))), "r" (maskhi), "r" (masklo) + ); + } + + SREG=sreg_prev; +} diff --git a/drivers/avr/ws2812.h b/drivers/avr/ws2812.h new file mode 100644 index 000000000..60924a0fb --- /dev/null +++ b/drivers/avr/ws2812.h @@ -0,0 +1,91 @@ +/* + * light weight WS2812 lib include + * + * Version 2.3 - Nev 29th 2015 + * Author: Tim (cpldcpu@gmail.com) + * + * Please do not change this file! All configuration is handled in "ws2812_config.h" + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef LIGHT_WS2812_H_ +#define LIGHT_WS2812_H_ + +#include +#include +//#include "ws2812_config.h" +//#include "i2cmaster.h" + +#ifdef RGBW + #define LED_TYPE struct cRGBW +#else + #define LED_TYPE struct cRGB +#endif + + +/* + * Structure of the LED array + * + * cRGB: RGB for WS2812S/B/C/D, SK6812, SK6812Mini, SK6812WWA, APA104, APA106 + * cRGBW: RGBW for SK6812RGBW + */ + +struct cRGB { uint8_t g; uint8_t r; uint8_t b; }; +struct cRGBW { uint8_t g; uint8_t r; uint8_t b; uint8_t w;}; + + + +/* User Interface + * + * Input: + * ledarray: An array of GRB data describing the LED colors + * number_of_leds: The number of LEDs to write + * pinmask (optional): Bitmask describing the output bin. e.g. _BV(PB0) + * + * The functions will perform the following actions: + * - Set the data-out pin as output + * - Send out the LED data + * - Wait 50�s to reset the LEDs + */ + +void ws2812_setleds (LED_TYPE *ledarray, uint16_t number_of_leds); +void ws2812_setleds_pin (LED_TYPE *ledarray, uint16_t number_of_leds,uint8_t pinmask); +void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds); + +/* + * Old interface / Internal functions + * + * The functions take a byte-array and send to the data output as WS2812 bitstream. + * The length is the number of bytes to send - three per LED. + */ + +void ws2812_sendarray (uint8_t *array,uint16_t length); +void ws2812_sendarray_mask(uint8_t *array,uint16_t length, uint8_t pinmask); + + +/* + * Internal defines + */ +#ifndef CONCAT +#define CONCAT(a, b) a ## b +#endif +#ifndef CONCAT_EXP +#define CONCAT_EXP(a, b) CONCAT(a, b) +#endif + +// #define ws2812_PORTREG CONCAT_EXP(PORT,ws2812_port) +// #define ws2812_DDRREG CONCAT_EXP(DDR,ws2812_port) + +#endif /* LIGHT_WS2812_H_ */ diff --git a/keyboards/atreus62/pro_micro.h b/keyboards/atreus62/pro_micro.h deleted file mode 100644 index f9e7ed75d..000000000 --- a/keyboards/atreus62/pro_micro.h +++ /dev/null @@ -1,362 +0,0 @@ -/* - pins_arduino.h - Pin definition functions for Arduino - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2007 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ -*/ - -#ifndef Pins_Arduino_h -#define Pins_Arduino_h - -#include - -// Workaround for wrong definitions in "iom32u4.h". -// This should be fixed in the AVR toolchain. -#undef UHCON -#undef UHINT -#undef UHIEN -#undef UHADDR -#undef UHFNUM -#undef UHFNUML -#undef UHFNUMH -#undef UHFLEN -#undef UPINRQX -#undef UPINTX -#undef UPNUM -#undef UPRST -#undef UPCONX -#undef UPCFG0X -#undef UPCFG1X -#undef UPSTAX -#undef UPCFG2X -#undef UPIENX -#undef UPDATX -#undef TCCR2A -#undef WGM20 -#undef WGM21 -#undef COM2B0 -#undef COM2B1 -#undef COM2A0 -#undef COM2A1 -#undef TCCR2B -#undef CS20 -#undef CS21 -#undef CS22 -#undef WGM22 -#undef FOC2B -#undef FOC2A -#undef TCNT2 -#undef TCNT2_0 -#undef TCNT2_1 -#undef TCNT2_2 -#undef TCNT2_3 -#undef TCNT2_4 -#undef TCNT2_5 -#undef TCNT2_6 -#undef TCNT2_7 -#undef OCR2A -#undef OCR2_0 -#undef OCR2_1 -#undef OCR2_2 -#undef OCR2_3 -#undef OCR2_4 -#undef OCR2_5 -#undef OCR2_6 -#undef OCR2_7 -#undef OCR2B -#undef OCR2_0 -#undef OCR2_1 -#undef OCR2_2 -#undef OCR2_3 -#undef OCR2_4 -#undef OCR2_5 -#undef OCR2_6 -#undef OCR2_7 - -#define NUM_DIGITAL_PINS 30 -#define NUM_ANALOG_INPUTS 12 - -#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) -#define TXLED0 PORTD |= (1<<5) -#define TXLED1 PORTD &= ~(1<<5) -#define RXLED0 PORTB |= (1<<0) -#define RXLED1 PORTB &= ~(1<<0) - -static const uint8_t SDA = 2; -static const uint8_t SCL = 3; -#define LED_BUILTIN 13 - -// Map SPI port to 'new' pins D14..D17 -static const uint8_t SS = 17; -static const uint8_t MOSI = 16; -static const uint8_t MISO = 14; -static const uint8_t SCK = 15; - -// Mapping of analog pins as digital I/O -// A6-A11 share with digital pins -static const uint8_t ADC0 = 18; -static const uint8_t ADC1 = 19; -static const uint8_t ADC2 = 20; -static const uint8_t ADC3 = 21; -static const uint8_t ADC4 = 22; -static const uint8_t ADC5 = 23; -static const uint8_t ADC6 = 24; // D4 -static const uint8_t ADC7 = 25; // D6 -static const uint8_t ADC8 = 26; // D8 -static const uint8_t ADC9 = 27; // D9 -static const uint8_t ADC10 = 28; // D10 -static const uint8_t ADC11 = 29; // D12 - -#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) -#define digitalPinToPCICRbit(p) 0 -#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) -#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) - -// __AVR_ATmega32U4__ has an unusual mapping of pins to channels -extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; -#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) - -#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) - -#ifdef ARDUINO_MAIN - -// On the Arduino board, digital pins are also used -// for the analog output (software PWM). Analog input -// pins are a separate set. - -// ATMEL ATMEGA32U4 / ARDUINO LEONARDO -// -// D0 PD2 RXD1/INT2 -// D1 PD3 TXD1/INT3 -// D2 PD1 SDA SDA/INT1 -// D3# PD0 PWM8/SCL OC0B/SCL/INT0 -// D4 A6 PD4 ADC8 -// D5# PC6 ??? OC3A/#OC4A -// D6# A7 PD7 FastPWM #OC4D/ADC10 -// D7 PE6 INT6/AIN0 -// -// D8 A8 PB4 ADC11/PCINT4 -// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5 -// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6 -// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7 -// D12 A11 PD6 T1/#OC4D/ADC9 -// D13# PC7 PWM10 CLK0/OC4A -// -// A0 D18 PF7 ADC7 -// A1 D19 PF6 ADC6 -// A2 D20 PF5 ADC5 -// A3 D21 PF4 ADC4 -// A4 D22 PF1 ADC1 -// A5 D23 PF0 ADC0 -// -// New pins D14..D17 to map SPI port to digital pins -// -// MISO D14 PB3 MISO,PCINT3 -// SCK D15 PB1 SCK,PCINT1 -// MOSI D16 PB2 MOSI,PCINT2 -// SS D17 PB0 RXLED,SS/PCINT0 -// -// Connected LEDs on board for TX and RX -// TXLED D24 PD5 XCK1 -// RXLED D17 PB0 -// HWB PE2 HWB - -// these arrays map port names (e.g. port B) to the -// appropriate addresses for various functions (e.g. reading -// and writing) -const uint16_t PROGMEM port_to_mode_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &DDRB, - (uint16_t) &DDRC, - (uint16_t) &DDRD, - (uint16_t) &DDRE, - (uint16_t) &DDRF, -}; - -const uint16_t PROGMEM port_to_output_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &PORTB, - (uint16_t) &PORTC, - (uint16_t) &PORTD, - (uint16_t) &PORTE, - (uint16_t) &PORTF, -}; - -const uint16_t PROGMEM port_to_input_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &PINB, - (uint16_t) &PINC, - (uint16_t) &PIND, - (uint16_t) &PINE, - (uint16_t) &PINF, -}; - -const uint8_t PROGMEM digital_pin_to_port_PGM[] = { - PD, // D0 - PD2 - PD, // D1 - PD3 - PD, // D2 - PD1 - PD, // D3 - PD0 - PD, // D4 - PD4 - PC, // D5 - PC6 - PD, // D6 - PD7 - PE, // D7 - PE6 - - PB, // D8 - PB4 - PB, // D9 - PB5 - PB, // D10 - PB6 - PB, // D11 - PB7 - PD, // D12 - PD6 - PC, // D13 - PC7 - - PB, // D14 - MISO - PB3 - PB, // D15 - SCK - PB1 - PB, // D16 - MOSI - PB2 - PB, // D17 - SS - PB0 - - PF, // D18 - A0 - PF7 - PF, // D19 - A1 - PF6 - PF, // D20 - A2 - PF5 - PF, // D21 - A3 - PF4 - PF, // D22 - A4 - PF1 - PF, // D23 - A5 - PF0 - - PD, // D24 - PD5 - PD, // D25 / D6 - A7 - PD7 - PB, // D26 / D8 - A8 - PB4 - PB, // D27 / D9 - A9 - PB5 - PB, // D28 / D10 - A10 - PB6 - PD, // D29 / D12 - A11 - PD6 -}; - -const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { - _BV(2), // D0 - PD2 - _BV(3), // D1 - PD3 - _BV(1), // D2 - PD1 - _BV(0), // D3 - PD0 - _BV(4), // D4 - PD4 - _BV(6), // D5 - PC6 - _BV(7), // D6 - PD7 - _BV(6), // D7 - PE6 - - _BV(4), // D8 - PB4 - _BV(5), // D9 - PB5 - _BV(6), // D10 - PB6 - _BV(7), // D11 - PB7 - _BV(6), // D12 - PD6 - _BV(7), // D13 - PC7 - - _BV(3), // D14 - MISO - PB3 - _BV(1), // D15 - SCK - PB1 - _BV(2), // D16 - MOSI - PB2 - _BV(0), // D17 - SS - PB0 - - _BV(7), // D18 - A0 - PF7 - _BV(6), // D19 - A1 - PF6 - _BV(5), // D20 - A2 - PF5 - _BV(4), // D21 - A3 - PF4 - _BV(1), // D22 - A4 - PF1 - _BV(0), // D23 - A5 - PF0 - - _BV(5), // D24 - PD5 - _BV(7), // D25 / D6 - A7 - PD7 - _BV(4), // D26 / D8 - A8 - PB4 - _BV(5), // D27 / D9 - A9 - PB5 - _BV(6), // D28 / D10 - A10 - PB6 - _BV(6), // D29 / D12 - A11 - PD6 -}; - -const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - TIMER0B, /* 3 */ - NOT_ON_TIMER, - TIMER3A, /* 5 */ - TIMER4D, /* 6 */ - NOT_ON_TIMER, - - NOT_ON_TIMER, - TIMER1A, /* 9 */ - TIMER1B, /* 10 */ - TIMER0A, /* 11 */ - - NOT_ON_TIMER, - TIMER4A, /* 13 */ - - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, -}; - -const uint8_t PROGMEM analog_pin_to_channel_PGM[] = { - 7, // A0 PF7 ADC7 - 6, // A1 PF6 ADC6 - 5, // A2 PF5 ADC5 - 4, // A3 PF4 ADC4 - 1, // A4 PF1 ADC1 - 0, // A5 PF0 ADC0 - 8, // A6 D4 PD4 ADC8 - 10, // A7 D6 PD7 ADC10 - 11, // A8 D8 PB4 ADC11 - 12, // A9 D9 PB5 ADC12 - 13, // A10 D10 PB6 ADC13 - 9 // A11 D12 PD6 ADC9 -}; - -#endif /* ARDUINO_MAIN */ - -// These serial port names are intended to allow libraries and architecture-neutral -// sketches to automatically default to the correct port name for a particular type -// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, -// the first hardware serial port whose RX/TX pins are not dedicated to another use. -// -// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor -// -// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial -// -// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library -// -// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. -// -// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX -// pins are NOT connected to anything by default. -#define SERIAL_PORT_MONITOR Serial -#define SERIAL_PORT_USBVIRTUAL Serial -#define SERIAL_PORT_HARDWARE Serial1 -#define SERIAL_PORT_HARDWARE_OPEN Serial1 - -#endif /* Pins_Arduino_h */ diff --git a/keyboards/handwired/promethium/rgbsps.c b/keyboards/handwired/promethium/rgbsps.c index f30badd35..84fac1ae1 100644 --- a/keyboards/handwired/promethium/rgbsps.c +++ b/keyboards/handwired/promethium/rgbsps.c @@ -1,4 +1,4 @@ -#include "light_ws2812.h" +#include "ws2812.h" #include "rgbsps.h" struct cRGB led[RGBSPS_NUM]; diff --git a/keyboards/handwired/promethium/rules.mk b/keyboards/handwired/promethium/rules.mk index 6fa45b42b..69903dceb 100644 --- a/keyboards/handwired/promethium/rules.mk +++ b/keyboards/handwired/promethium/rules.mk @@ -72,7 +72,7 @@ BLUETOOTH = AdafruitBLE # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend -SRC += $(QUANTUM_DIR)/light_ws2812.c +SRC += ws2812.c SRC += rgbsps.c -SRC += $(QUANTUM_DIR)/analog.c +SRC += analog.c SRC += matrix.c diff --git a/keyboards/lets_split/common/glcdfont.c b/keyboards/lets_split/common/glcdfont.c deleted file mode 100644 index 6f88bd23a..000000000 --- a/keyboards/lets_split/common/glcdfont.c +++ /dev/null @@ -1,276 +0,0 @@ -// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. -// See gfxfont.h for newer custom bitmap font info. - -#ifndef FONT5X7_H -#define FONT5X7_H - -#ifdef __AVR__ - #include - #include -#elif defined(ESP8266) - #include -#else - #define PROGMEM -#endif - -// Standard ASCII 5x7 font - -static const unsigned char font[] PROGMEM = { - 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, - 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, - 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, - 0x18, 0x3C, 0x7E, 0x3C, 0x18, - 0x1C, 0x57, 0x7D, 0x57, 0x1C, - 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, - 0x00, 0x18, 0x3C, 0x18, 0x00, - 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, - 0x00, 0x18, 0x24, 0x18, 0x00, - 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, - 0x30, 0x48, 0x3A, 0x06, 0x0E, - 0x26, 0x29, 0x79, 0x29, 0x26, - 0x40, 0x7F, 0x05, 0x05, 0x07, - 0x40, 0x7F, 0x05, 0x25, 0x3F, - 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, - 0x7F, 0x3E, 0x1C, 0x1C, 0x08, - 0x08, 0x1C, 0x1C, 0x3E, 0x7F, - 0x14, 0x22, 0x7F, 0x22, 0x14, - 0x5F, 0x5F, 0x00, 0x5F, 0x5F, - 0x06, 0x09, 0x7F, 0x01, 0x7F, - 0x00, 0x66, 0x89, 0x95, 0x6A, - 0x60, 0x60, 0x60, 0x60, 0x60, - 0x94, 0xA2, 0xFF, 0xA2, 0x94, - 0x08, 0x04, 0x7E, 0x04, 0x08, - 0x10, 0x20, 0x7E, 0x20, 0x10, - 0x08, 0x08, 0x2A, 0x1C, 0x08, - 0x08, 0x1C, 0x2A, 0x08, 0x08, - 0x1E, 0x10, 0x10, 0x10, 0x10, - 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, - 0x30, 0x38, 0x3E, 0x38, 0x30, - 0x06, 0x0E, 0x3E, 0x0E, 0x06, - 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x5F, 0x00, 0x00, - 0x00, 0x07, 0x00, 0x07, 0x00, - 0x14, 0x7F, 0x14, 0x7F, 0x14, - 0x24, 0x2A, 0x7F, 0x2A, 0x12, - 0x23, 0x13, 0x08, 0x64, 0x62, - 0x36, 0x49, 0x56, 0x20, 0x50, - 0x00, 0x08, 0x07, 0x03, 0x00, - 0x00, 0x1C, 0x22, 0x41, 0x00, - 0x00, 0x41, 0x22, 0x1C, 0x00, - 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, - 0x08, 0x08, 0x3E, 0x08, 0x08, - 0x00, 0x80, 0x70, 0x30, 0x00, - 0x08, 0x08, 0x08, 0x08, 0x08, - 0x00, 0x00, 0x60, 0x60, 0x00, - 0x20, 0x10, 0x08, 0x04, 0x02, - 0x3E, 0x51, 0x49, 0x45, 0x3E, - 0x00, 0x42, 0x7F, 0x40, 0x00, - 0x72, 0x49, 0x49, 0x49, 0x46, - 0x21, 0x41, 0x49, 0x4D, 0x33, - 0x18, 0x14, 0x12, 0x7F, 0x10, - 0x27, 0x45, 0x45, 0x45, 0x39, - 0x3C, 0x4A, 0x49, 0x49, 0x31, - 0x41, 0x21, 0x11, 0x09, 0x07, - 0x36, 0x49, 0x49, 0x49, 0x36, - 0x46, 0x49, 0x49, 0x29, 0x1E, - 0x00, 0x00, 0x14, 0x00, 0x00, - 0x00, 0x40, 0x34, 0x00, 0x00, - 0x00, 0x08, 0x14, 0x22, 0x41, - 0x14, 0x14, 0x14, 0x14, 0x14, - 0x00, 0x41, 0x22, 0x14, 0x08, - 0x02, 0x01, 0x59, 0x09, 0x06, - 0x3E, 0x41, 0x5D, 0x59, 0x4E, - 0x7C, 0x12, 0x11, 0x12, 0x7C, - 0x7F, 0x49, 0x49, 0x49, 0x36, - 0x3E, 0x41, 0x41, 0x41, 0x22, - 0x7F, 0x41, 0x41, 0x41, 0x3E, - 0x7F, 0x49, 0x49, 0x49, 0x41, - 0x7F, 0x09, 0x09, 0x09, 0x01, - 0x3E, 0x41, 0x41, 0x51, 0x73, - 0x7F, 0x08, 0x08, 0x08, 0x7F, - 0x00, 0x41, 0x7F, 0x41, 0x00, - 0x20, 0x40, 0x41, 0x3F, 0x01, - 0x7F, 0x08, 0x14, 0x22, 0x41, - 0x7F, 0x40, 0x40, 0x40, 0x40, - 0x7F, 0x02, 0x1C, 0x02, 0x7F, - 0x7F, 0x04, 0x08, 0x10, 0x7F, - 0x3E, 0x41, 0x41, 0x41, 0x3E, - 0x7F, 0x09, 0x09, 0x09, 0x06, - 0x3E, 0x41, 0x51, 0x21, 0x5E, - 0x7F, 0x09, 0x19, 0x29, 0x46, - 0x26, 0x49, 0x49, 0x49, 0x32, - 0x03, 0x01, 0x7F, 0x01, 0x03, - 0x3F, 0x40, 0x40, 0x40, 0x3F, - 0x1F, 0x20, 0x40, 0x20, 0x1F, - 0x3F, 0x40, 0x38, 0x40, 0x3F, - 0x63, 0x14, 0x08, 0x14, 0x63, - 0x03, 0x04, 0x78, 0x04, 0x03, - 0x61, 0x59, 0x49, 0x4D, 0x43, - 0x00, 0x7F, 0x41, 0x41, 0x41, - 0x02, 0x04, 0x08, 0x10, 0x20, - 0x00, 0x41, 0x41, 0x41, 0x7F, - 0x04, 0x02, 0x01, 0x02, 0x04, - 0x40, 0x40, 0x40, 0x40, 0x40, - 0x00, 0x03, 0x07, 0x08, 0x00, - 0x20, 0x54, 0x54, 0x78, 0x40, - 0x7F, 0x28, 0x44, 0x44, 0x38, - 0x38, 0x44, 0x44, 0x44, 0x28, - 0x38, 0x44, 0x44, 0x28, 0x7F, - 0x38, 0x54, 0x54, 0x54, 0x18, - 0x00, 0x08, 0x7E, 0x09, 0x02, - 0x18, 0xA4, 0xA4, 0x9C, 0x78, - 0x7F, 0x08, 0x04, 0x04, 0x78, - 0x00, 0x44, 0x7D, 0x40, 0x00, - 0x20, 0x40, 0x40, 0x3D, 0x00, - 0x7F, 0x10, 0x28, 0x44, 0x00, - 0x00, 0x41, 0x7F, 0x40, 0x00, - 0x7C, 0x04, 0x78, 0x04, 0x78, - 0x7C, 0x08, 0x04, 0x04, 0x78, - 0x38, 0x44, 0x44, 0x44, 0x38, - 0xFC, 0x18, 0x24, 0x24, 0x18, - 0x18, 0x24, 0x24, 0x18, 0xFC, - 0x7C, 0x08, 0x04, 0x04, 0x08, - 0x48, 0x54, 0x54, 0x54, 0x24, - 0x04, 0x04, 0x3F, 0x44, 0x24, - 0x3C, 0x40, 0x40, 0x20, 0x7C, - 0x1C, 0x20, 0x40, 0x20, 0x1C, - 0x3C, 0x40, 0x30, 0x40, 0x3C, - 0x44, 0x28, 0x10, 0x28, 0x44, - 0x4C, 0x90, 0x90, 0x90, 0x7C, - 0x44, 0x64, 0x54, 0x4C, 0x44, - 0x00, 0x08, 0x36, 0x41, 0x00, - 0x00, 0x00, 0x77, 0x00, 0x00, - 0x00, 0x41, 0x36, 0x08, 0x00, - 0x02, 0x01, 0x02, 0x04, 0x02, - 0x3C, 0x26, 0x23, 0x26, 0x3C, - 0x1E, 0xA1, 0xA1, 0x61, 0x12, - 0x3A, 0x40, 0x40, 0x20, 0x7A, - 0x38, 0x54, 0x54, 0x55, 0x59, - 0x21, 0x55, 0x55, 0x79, 0x41, - 0x22, 0x54, 0x54, 0x78, 0x42, // a-umlaut - 0x21, 0x55, 0x54, 0x78, 0x40, - 0x20, 0x54, 0x55, 0x79, 0x40, - 0x0C, 0x1E, 0x52, 0x72, 0x12, - 0x39, 0x55, 0x55, 0x55, 0x59, - 0x39, 0x54, 0x54, 0x54, 0x59, - 0x39, 0x55, 0x54, 0x54, 0x58, - 0x00, 0x00, 0x45, 0x7C, 0x41, - 0x00, 0x02, 0x45, 0x7D, 0x42, - 0x00, 0x01, 0x45, 0x7C, 0x40, - 0x7D, 0x12, 0x11, 0x12, 0x7D, // A-umlaut - 0xF0, 0x28, 0x25, 0x28, 0xF0, - 0x7C, 0x54, 0x55, 0x45, 0x00, - 0x20, 0x54, 0x54, 0x7C, 0x54, - 0x7C, 0x0A, 0x09, 0x7F, 0x49, - 0x32, 0x49, 0x49, 0x49, 0x32, - 0x3A, 0x44, 0x44, 0x44, 0x3A, // o-umlaut - 0x32, 0x4A, 0x48, 0x48, 0x30, - 0x3A, 0x41, 0x41, 0x21, 0x7A, - 0x3A, 0x42, 0x40, 0x20, 0x78, - 0x00, 0x9D, 0xA0, 0xA0, 0x7D, - 0x3D, 0x42, 0x42, 0x42, 0x3D, // O-umlaut - 0x3D, 0x40, 0x40, 0x40, 0x3D, - 0x3C, 0x24, 0xFF, 0x24, 0x24, - 0x48, 0x7E, 0x49, 0x43, 0x66, - 0x2B, 0x2F, 0xFC, 0x2F, 0x2B, - 0xFF, 0x09, 0x29, 0xF6, 0x20, - 0xC0, 0x88, 0x7E, 0x09, 0x03, - 0x20, 0x54, 0x54, 0x79, 0x41, - 0x00, 0x00, 0x44, 0x7D, 0x41, - 0x30, 0x48, 0x48, 0x4A, 0x32, - 0x38, 0x40, 0x40, 0x22, 0x7A, - 0x00, 0x7A, 0x0A, 0x0A, 0x72, - 0x7D, 0x0D, 0x19, 0x31, 0x7D, - 0x26, 0x29, 0x29, 0x2F, 0x28, - 0x26, 0x29, 0x29, 0x29, 0x26, - 0x30, 0x48, 0x4D, 0x40, 0x20, - 0x38, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x38, - 0x2F, 0x10, 0xC8, 0xAC, 0xBA, - 0x2F, 0x10, 0x28, 0x34, 0xFA, - 0x00, 0x00, 0x7B, 0x00, 0x00, - 0x08, 0x14, 0x2A, 0x14, 0x22, - 0x22, 0x14, 0x2A, 0x14, 0x08, - 0x55, 0x00, 0x55, 0x00, 0x55, // #176 (25% block) missing in old code - 0xAA, 0x55, 0xAA, 0x55, 0xAA, // 50% block - 0xFF, 0x55, 0xFF, 0x55, 0xFF, // 75% block - 0x00, 0x00, 0x00, 0xFF, 0x00, - 0x10, 0x10, 0x10, 0xFF, 0x00, - 0x14, 0x14, 0x14, 0xFF, 0x00, - 0x10, 0x10, 0xFF, 0x00, 0xFF, - 0x10, 0x10, 0xF0, 0x10, 0xF0, - 0x14, 0x14, 0x14, 0xFC, 0x00, - 0x14, 0x14, 0xF7, 0x00, 0xFF, - 0x00, 0x00, 0xFF, 0x00, 0xFF, - 0x14, 0x14, 0xF4, 0x04, 0xFC, - 0x14, 0x14, 0x17, 0x10, 0x1F, - 0x10, 0x10, 0x1F, 0x10, 0x1F, - 0x14, 0x14, 0x14, 0x1F, 0x00, - 0x10, 0x10, 0x10, 0xF0, 0x00, - 0x00, 0x00, 0x00, 0x1F, 0x10, - 0x10, 0x10, 0x10, 0x1F, 0x10, - 0x10, 0x10, 0x10, 0xF0, 0x10, - 0x00, 0x00, 0x00, 0xFF, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0xFF, 0x10, - 0x00, 0x00, 0x00, 0xFF, 0x14, - 0x00, 0x00, 0xFF, 0x00, 0xFF, - 0x00, 0x00, 0x1F, 0x10, 0x17, - 0x00, 0x00, 0xFC, 0x04, 0xF4, - 0x14, 0x14, 0x17, 0x10, 0x17, - 0x14, 0x14, 0xF4, 0x04, 0xF4, - 0x00, 0x00, 0xFF, 0x00, 0xF7, - 0x14, 0x14, 0x14, 0x14, 0x14, - 0x14, 0x14, 0xF7, 0x00, 0xF7, - 0x14, 0x14, 0x14, 0x17, 0x14, - 0x10, 0x10, 0x1F, 0x10, 0x1F, - 0x14, 0x14, 0x14, 0xF4, 0x14, - 0x10, 0x10, 0xF0, 0x10, 0xF0, - 0x00, 0x00, 0x1F, 0x10, 0x1F, - 0x00, 0x00, 0x00, 0x1F, 0x14, - 0x00, 0x00, 0x00, 0xFC, 0x14, - 0x00, 0x00, 0xF0, 0x10, 0xF0, - 0x10, 0x10, 0xFF, 0x10, 0xFF, - 0x14, 0x14, 0x14, 0xFF, 0x14, - 0x10, 0x10, 0x10, 0x1F, 0x00, - 0x00, 0x00, 0x00, 0xF0, 0x10, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, - 0xFF, 0xFF, 0xFF, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xFF, 0xFF, - 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, - 0x38, 0x44, 0x44, 0x38, 0x44, - 0xFC, 0x4A, 0x4A, 0x4A, 0x34, // sharp-s or beta - 0x7E, 0x02, 0x02, 0x06, 0x06, - 0x02, 0x7E, 0x02, 0x7E, 0x02, - 0x63, 0x55, 0x49, 0x41, 0x63, - 0x38, 0x44, 0x44, 0x3C, 0x04, - 0x40, 0x7E, 0x20, 0x1E, 0x20, - 0x06, 0x02, 0x7E, 0x02, 0x02, - 0x99, 0xA5, 0xE7, 0xA5, 0x99, - 0x1C, 0x2A, 0x49, 0x2A, 0x1C, - 0x4C, 0x72, 0x01, 0x72, 0x4C, - 0x30, 0x4A, 0x4D, 0x4D, 0x30, - 0x30, 0x48, 0x78, 0x48, 0x30, - 0xBC, 0x62, 0x5A, 0x46, 0x3D, - 0x3E, 0x49, 0x49, 0x49, 0x00, - 0x7E, 0x01, 0x01, 0x01, 0x7E, - 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, - 0x44, 0x44, 0x5F, 0x44, 0x44, - 0x40, 0x51, 0x4A, 0x44, 0x40, - 0x40, 0x44, 0x4A, 0x51, 0x40, - 0x00, 0x00, 0xFF, 0x01, 0x03, - 0xE0, 0x80, 0xFF, 0x00, 0x00, - 0x08, 0x08, 0x6B, 0x6B, 0x08, - 0x36, 0x12, 0x36, 0x24, 0x36, - 0x06, 0x0F, 0x09, 0x0F, 0x06, - 0x00, 0x00, 0x18, 0x18, 0x00, - 0x00, 0x00, 0x10, 0x10, 0x00, - 0x30, 0x40, 0xFF, 0x01, 0x01, - 0x00, 0x1F, 0x01, 0x01, 0x1E, - 0x00, 0x19, 0x1D, 0x17, 0x12, - 0x00, 0x3C, 0x3C, 0x3C, 0x3C, - 0x00, 0x00, 0x00, 0x00, 0x00 // #255 NBSP -}; -#endif // FONT5X7_H diff --git a/keyboards/lets_split/pro_micro.h b/keyboards/lets_split/pro_micro.h deleted file mode 100644 index f9e7ed75d..000000000 --- a/keyboards/lets_split/pro_micro.h +++ /dev/null @@ -1,362 +0,0 @@ -/* - pins_arduino.h - Pin definition functions for Arduino - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2007 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ -*/ - -#ifndef Pins_Arduino_h -#define Pins_Arduino_h - -#include - -// Workaround for wrong definitions in "iom32u4.h". -// This should be fixed in the AVR toolchain. -#undef UHCON -#undef UHINT -#undef UHIEN -#undef UHADDR -#undef UHFNUM -#undef UHFNUML -#undef UHFNUMH -#undef UHFLEN -#undef UPINRQX -#undef UPINTX -#undef UPNUM -#undef UPRST -#undef UPCONX -#undef UPCFG0X -#undef UPCFG1X -#undef UPSTAX -#undef UPCFG2X -#undef UPIENX -#undef UPDATX -#undef TCCR2A -#undef WGM20 -#undef WGM21 -#undef COM2B0 -#undef COM2B1 -#undef COM2A0 -#undef COM2A1 -#undef TCCR2B -#undef CS20 -#undef CS21 -#undef CS22 -#undef WGM22 -#undef FOC2B -#undef FOC2A -#undef TCNT2 -#undef TCNT2_0 -#undef TCNT2_1 -#undef TCNT2_2 -#undef TCNT2_3 -#undef TCNT2_4 -#undef TCNT2_5 -#undef TCNT2_6 -#undef TCNT2_7 -#undef OCR2A -#undef OCR2_0 -#undef OCR2_1 -#undef OCR2_2 -#undef OCR2_3 -#undef OCR2_4 -#undef OCR2_5 -#undef OCR2_6 -#undef OCR2_7 -#undef OCR2B -#undef OCR2_0 -#undef OCR2_1 -#undef OCR2_2 -#undef OCR2_3 -#undef OCR2_4 -#undef OCR2_5 -#undef OCR2_6 -#undef OCR2_7 - -#define NUM_DIGITAL_PINS 30 -#define NUM_ANALOG_INPUTS 12 - -#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) -#define TXLED0 PORTD |= (1<<5) -#define TXLED1 PORTD &= ~(1<<5) -#define RXLED0 PORTB |= (1<<0) -#define RXLED1 PORTB &= ~(1<<0) - -static const uint8_t SDA = 2; -static const uint8_t SCL = 3; -#define LED_BUILTIN 13 - -// Map SPI port to 'new' pins D14..D17 -static const uint8_t SS = 17; -static const uint8_t MOSI = 16; -static const uint8_t MISO = 14; -static const uint8_t SCK = 15; - -// Mapping of analog pins as digital I/O -// A6-A11 share with digital pins -static const uint8_t ADC0 = 18; -static const uint8_t ADC1 = 19; -static const uint8_t ADC2 = 20; -static const uint8_t ADC3 = 21; -static const uint8_t ADC4 = 22; -static const uint8_t ADC5 = 23; -static const uint8_t ADC6 = 24; // D4 -static const uint8_t ADC7 = 25; // D6 -static const uint8_t ADC8 = 26; // D8 -static const uint8_t ADC9 = 27; // D9 -static const uint8_t ADC10 = 28; // D10 -static const uint8_t ADC11 = 29; // D12 - -#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) -#define digitalPinToPCICRbit(p) 0 -#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) -#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) - -// __AVR_ATmega32U4__ has an unusual mapping of pins to channels -extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; -#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) - -#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) - -#ifdef ARDUINO_MAIN - -// On the Arduino board, digital pins are also used -// for the analog output (software PWM). Analog input -// pins are a separate set. - -// ATMEL ATMEGA32U4 / ARDUINO LEONARDO -// -// D0 PD2 RXD1/INT2 -// D1 PD3 TXD1/INT3 -// D2 PD1 SDA SDA/INT1 -// D3# PD0 PWM8/SCL OC0B/SCL/INT0 -// D4 A6 PD4 ADC8 -// D5# PC6 ??? OC3A/#OC4A -// D6# A7 PD7 FastPWM #OC4D/ADC10 -// D7 PE6 INT6/AIN0 -// -// D8 A8 PB4 ADC11/PCINT4 -// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5 -// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6 -// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7 -// D12 A11 PD6 T1/#OC4D/ADC9 -// D13# PC7 PWM10 CLK0/OC4A -// -// A0 D18 PF7 ADC7 -// A1 D19 PF6 ADC6 -// A2 D20 PF5 ADC5 -// A3 D21 PF4 ADC4 -// A4 D22 PF1 ADC1 -// A5 D23 PF0 ADC0 -// -// New pins D14..D17 to map SPI port to digital pins -// -// MISO D14 PB3 MISO,PCINT3 -// SCK D15 PB1 SCK,PCINT1 -// MOSI D16 PB2 MOSI,PCINT2 -// SS D17 PB0 RXLED,SS/PCINT0 -// -// Connected LEDs on board for TX and RX -// TXLED D24 PD5 XCK1 -// RXLED D17 PB0 -// HWB PE2 HWB - -// these arrays map port names (e.g. port B) to the -// appropriate addresses for various functions (e.g. reading -// and writing) -const uint16_t PROGMEM port_to_mode_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &DDRB, - (uint16_t) &DDRC, - (uint16_t) &DDRD, - (uint16_t) &DDRE, - (uint16_t) &DDRF, -}; - -const uint16_t PROGMEM port_to_output_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &PORTB, - (uint16_t) &PORTC, - (uint16_t) &PORTD, - (uint16_t) &PORTE, - (uint16_t) &PORTF, -}; - -const uint16_t PROGMEM port_to_input_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &PINB, - (uint16_t) &PINC, - (uint16_t) &PIND, - (uint16_t) &PINE, - (uint16_t) &PINF, -}; - -const uint8_t PROGMEM digital_pin_to_port_PGM[] = { - PD, // D0 - PD2 - PD, // D1 - PD3 - PD, // D2 - PD1 - PD, // D3 - PD0 - PD, // D4 - PD4 - PC, // D5 - PC6 - PD, // D6 - PD7 - PE, // D7 - PE6 - - PB, // D8 - PB4 - PB, // D9 - PB5 - PB, // D10 - PB6 - PB, // D11 - PB7 - PD, // D12 - PD6 - PC, // D13 - PC7 - - PB, // D14 - MISO - PB3 - PB, // D15 - SCK - PB1 - PB, // D16 - MOSI - PB2 - PB, // D17 - SS - PB0 - - PF, // D18 - A0 - PF7 - PF, // D19 - A1 - PF6 - PF, // D20 - A2 - PF5 - PF, // D21 - A3 - PF4 - PF, // D22 - A4 - PF1 - PF, // D23 - A5 - PF0 - - PD, // D24 - PD5 - PD, // D25 / D6 - A7 - PD7 - PB, // D26 / D8 - A8 - PB4 - PB, // D27 / D9 - A9 - PB5 - PB, // D28 / D10 - A10 - PB6 - PD, // D29 / D12 - A11 - PD6 -}; - -const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { - _BV(2), // D0 - PD2 - _BV(3), // D1 - PD3 - _BV(1), // D2 - PD1 - _BV(0), // D3 - PD0 - _BV(4), // D4 - PD4 - _BV(6), // D5 - PC6 - _BV(7), // D6 - PD7 - _BV(6), // D7 - PE6 - - _BV(4), // D8 - PB4 - _BV(5), // D9 - PB5 - _BV(6), // D10 - PB6 - _BV(7), // D11 - PB7 - _BV(6), // D12 - PD6 - _BV(7), // D13 - PC7 - - _BV(3), // D14 - MISO - PB3 - _BV(1), // D15 - SCK - PB1 - _BV(2), // D16 - MOSI - PB2 - _BV(0), // D17 - SS - PB0 - - _BV(7), // D18 - A0 - PF7 - _BV(6), // D19 - A1 - PF6 - _BV(5), // D20 - A2 - PF5 - _BV(4), // D21 - A3 - PF4 - _BV(1), // D22 - A4 - PF1 - _BV(0), // D23 - A5 - PF0 - - _BV(5), // D24 - PD5 - _BV(7), // D25 / D6 - A7 - PD7 - _BV(4), // D26 / D8 - A8 - PB4 - _BV(5), // D27 / D9 - A9 - PB5 - _BV(6), // D28 / D10 - A10 - PB6 - _BV(6), // D29 / D12 - A11 - PD6 -}; - -const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - TIMER0B, /* 3 */ - NOT_ON_TIMER, - TIMER3A, /* 5 */ - TIMER4D, /* 6 */ - NOT_ON_TIMER, - - NOT_ON_TIMER, - TIMER1A, /* 9 */ - TIMER1B, /* 10 */ - TIMER0A, /* 11 */ - - NOT_ON_TIMER, - TIMER4A, /* 13 */ - - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, -}; - -const uint8_t PROGMEM analog_pin_to_channel_PGM[] = { - 7, // A0 PF7 ADC7 - 6, // A1 PF6 ADC6 - 5, // A2 PF5 ADC5 - 4, // A3 PF4 ADC4 - 1, // A4 PF1 ADC1 - 0, // A5 PF0 ADC0 - 8, // A6 D4 PD4 ADC8 - 10, // A7 D6 PD7 ADC10 - 11, // A8 D8 PB4 ADC11 - 12, // A9 D9 PB5 ADC12 - 13, // A10 D10 PB6 ADC13 - 9 // A11 D12 PD6 ADC9 -}; - -#endif /* ARDUINO_MAIN */ - -// These serial port names are intended to allow libraries and architecture-neutral -// sketches to automatically default to the correct port name for a particular type -// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, -// the first hardware serial port whose RX/TX pins are not dedicated to another use. -// -// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor -// -// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial -// -// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library -// -// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. -// -// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX -// pins are NOT connected to anything by default. -#define SERIAL_PORT_MONITOR Serial -#define SERIAL_PORT_USBVIRTUAL Serial -#define SERIAL_PORT_HARDWARE Serial1 -#define SERIAL_PORT_HARDWARE_OPEN Serial1 - -#endif /* Pins_Arduino_h */ diff --git a/keyboards/lets_split/ssd1306.c b/keyboards/lets_split/ssd1306.c deleted file mode 100644 index 5c6dff27f..000000000 --- a/keyboards/lets_split/ssd1306.c +++ /dev/null @@ -1,470 +0,0 @@ -#ifdef SSD1306OLED - -#include "ssd1306.h" -#include "config.h" -#include "i2c.h" -#include -#include "print.h" -#include "lets_split.h" -#include "common/glcdfont.c" -#ifdef ADAFRUIT_BLE_ENABLE -#include "adafruit_ble.h" -#endif -#ifdef PROTOCOL_LUFA -#include "lufa.h" -#endif -#include "sendchar.h" -#include "pincontrol.h" - -//assign the right code to your layers -#define _BASE 0 -#define _LOWER 8 -#define _RAISE 16 -#define _FNLAYER 64 -#define _NUMLAY 128 -#define _NLOWER 136 -#define _NFNLAYER 192 -#define _MOUSECURSOR 256 -#define _ADJUST 65560 - -// Set this to 1 to help diagnose early startup problems -// when testing power-on with ble. Turn it off otherwise, -// as the latency of printing most of the debug info messes -// with the matrix scan, causing keys to drop. -#define DEBUG_TO_SCREEN 0 - -// Controls the SSD1306 128x32 OLED display via i2c - -#define i2cAddress 0x3C - -#define DisplayHeight 32 -#define DisplayWidth 128 - -#define FontHeight 8 -#define FontWidth 6 - -#define MatrixRows (DisplayHeight / FontHeight) -#define MatrixCols (DisplayWidth / FontWidth) - -struct CharacterMatrix { - uint8_t display[MatrixRows][MatrixCols]; - uint8_t *cursor; - bool dirty; -}; - -static struct CharacterMatrix display; -//static uint16_t last_battery_update; -//static uint32_t vbat; -//#define BatteryUpdateInterval 10000 /* milliseconds */ -#define ScreenOffInterval 300000 /* milliseconds */ -#if DEBUG_TO_SCREEN -static uint8_t displaying; -#endif -static uint16_t last_flush; - -enum ssd1306_cmds { - DisplayOff = 0xAE, - DisplayOn = 0xAF, - - SetContrast = 0x81, - DisplayAllOnResume = 0xA4, - - DisplayAllOn = 0xA5, - NormalDisplay = 0xA6, - InvertDisplay = 0xA7, - SetDisplayOffset = 0xD3, - SetComPins = 0xda, - SetVComDetect = 0xdb, - SetDisplayClockDiv = 0xD5, - SetPreCharge = 0xd9, - SetMultiPlex = 0xa8, - SetLowColumn = 0x00, - SetHighColumn = 0x10, - SetStartLine = 0x40, - - SetMemoryMode = 0x20, - ColumnAddr = 0x21, - PageAddr = 0x22, - - ComScanInc = 0xc0, - ComScanDec = 0xc8, - SegRemap = 0xa0, - SetChargePump = 0x8d, - ExternalVcc = 0x01, - SwitchCapVcc = 0x02, - - ActivateScroll = 0x2f, - DeActivateScroll = 0x2e, - SetVerticalScrollArea = 0xa3, - RightHorizontalScroll = 0x26, - LeftHorizontalScroll = 0x27, - VerticalAndRightHorizontalScroll = 0x29, - VerticalAndLeftHorizontalScroll = 0x2a, -}; - - -// Write command sequence. -// Returns true on success. -static inline bool _send_cmd1(uint8_t cmd) { - bool res = false; - - if (i2c_start_write(i2cAddress)) { - xprintf("failed to start write to %d\n", i2cAddress); - goto done; - } - - if (i2c_master_write(0x0 /* command byte follows */)) { - print("failed to write control byte\n"); - - goto done; - } - - if (i2c_master_write(cmd)) { - xprintf("failed to write command %d\n", cmd); - goto done; - } - res = true; -done: - i2c_master_stop(); - return res; -} - -// Write 2-byte command sequence. -// Returns true on success -static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) { - if (!_send_cmd1(cmd)) { - return false; - } - return _send_cmd1(opr); -} - -// Write 3-byte command sequence. -// Returns true on success -static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) { - if (!_send_cmd1(cmd)) { - return false; - } - if (!_send_cmd1(opr1)) { - return false; - } - return _send_cmd1(opr2); -} - -#define send_cmd1(c) if (!_send_cmd1(c)) {goto done;} -#define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} -#define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} - -static void matrix_clear(struct CharacterMatrix *matrix); - -static void clear_display(void) { - matrix_clear(&display); - - // Clear all of the display bits (there can be random noise - // in the RAM on startup) - send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1); - send_cmd3(ColumnAddr, 0, DisplayWidth - 1); - - if (i2c_start_write(i2cAddress)) { - goto done; - } - if (i2c_master_write(0x40)) { - // Data mode - goto done; - } - for (uint8_t row = 0; row < MatrixRows; ++row) { - for (uint8_t col = 0; col < DisplayWidth; ++col) { - i2c_master_write(0); - } - } - - display.dirty = false; - -done: - i2c_master_stop(); -} - -#if DEBUG_TO_SCREEN -#undef sendchar -static int8_t capture_sendchar(uint8_t c) { - sendchar(c); - iota_gfx_write_char(c); - - if (!displaying) { - iota_gfx_flush(); - } - return 0; -} -#endif - -bool iota_gfx_init(void) { - bool success = false; - - send_cmd1(DisplayOff); - send_cmd2(SetDisplayClockDiv, 0x80); - send_cmd2(SetMultiPlex, DisplayHeight - 1); - - send_cmd2(SetDisplayOffset, 0); - - - send_cmd1(SetStartLine | 0x0); - send_cmd2(SetChargePump, 0x14 /* Enable */); - send_cmd2(SetMemoryMode, 0 /* horizontal addressing */); - -/// Flips the display orientation 0 degrees - send_cmd1(SegRemap | 0x1); - send_cmd1(ComScanDec); -/* -// the following Flip the display orientation 180 degrees - send_cmd1(SegRemap); - send_cmd1(ComScanInc); -// end flip */ - send_cmd2(SetComPins, 0x2); - send_cmd2(SetContrast, 0x8f); - send_cmd2(SetPreCharge, 0xf1); - send_cmd2(SetVComDetect, 0x40); - send_cmd1(DisplayAllOnResume); - send_cmd1(NormalDisplay); - send_cmd1(DeActivateScroll); - send_cmd1(DisplayOn); - - send_cmd2(SetContrast, 0); // Dim - - clear_display(); - - success = true; - - iota_gfx_flush(); - -#if DEBUG_TO_SCREEN - print_set_sendchar(capture_sendchar); -#endif - -done: - return success; -} - -bool iota_gfx_off(void) { - bool success = false; - - send_cmd1(DisplayOff); - success = true; - -done: - return success; -} - -bool iota_gfx_on(void) { - bool success = false; - - send_cmd1(DisplayOn); - success = true; - -done: - return success; -} - -static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { - *matrix->cursor = c; - ++matrix->cursor; - - if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) { - // We went off the end; scroll the display upwards by one line - memmove(&matrix->display[0], &matrix->display[1], - MatrixCols * (MatrixRows - 1)); - matrix->cursor = &matrix->display[MatrixRows - 1][0]; - memset(matrix->cursor, ' ', MatrixCols); - } -} - -static void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { - matrix->dirty = true; - - if (c == '\n') { - // Clear to end of line from the cursor and then move to the - // start of the next line - uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols; - - while (cursor_col++ < MatrixCols) { - matrix_write_char_inner(matrix, ' '); - } - return; - } - - matrix_write_char_inner(matrix, c); -} - -void iota_gfx_write_char(uint8_t c) { - matrix_write_char(&display, c); -} - -static void matrix_write(struct CharacterMatrix *matrix, const char *data) { - const char *end = data + strlen(data); - while (data < end) { - matrix_write_char(matrix, *data); - ++data; - } -} - -void iota_gfx_write(const char *data) { - matrix_write(&display, data); -} - -static void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { - while (true) { - uint8_t c = pgm_read_byte(data); - if (c == 0) { - return; - } - matrix_write_char(matrix, c); - ++data; - } -} - -void iota_gfx_write_P(const char *data) { - matrix_write_P(&display, data); -} - -static void matrix_clear(struct CharacterMatrix *matrix) { - memset(matrix->display, ' ', sizeof(matrix->display)); - matrix->cursor = &matrix->display[0][0]; - matrix->dirty = true; -} - -void iota_gfx_clear_screen(void) { - matrix_clear(&display); -} - -static void matrix_render(struct CharacterMatrix *matrix) { - last_flush = timer_read(); - iota_gfx_on(); -#if DEBUG_TO_SCREEN - ++displaying; -#endif - - // Move to the home position - send_cmd3(PageAddr, 0, MatrixRows - 1); - send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1); - - if (i2c_start_write(i2cAddress)) { - goto done; - } - if (i2c_master_write(0x40)) { - // Data mode - goto done; - } - - for (uint8_t row = 0; row < MatrixRows; ++row) { - for (uint8_t col = 0; col < MatrixCols; ++col) { - const uint8_t *glyph = font + (matrix->display[row][col] * (FontWidth - 1)); - - for (uint8_t glyphCol = 0; glyphCol < FontWidth - 1; ++glyphCol) { - uint8_t colBits = pgm_read_byte(glyph + glyphCol); - i2c_master_write(colBits); - } - - // 1 column of space between chars (it's not included in the glyph) - i2c_master_write(0); - } - } - - matrix->dirty = false; - -done: - i2c_master_stop(); -#if DEBUG_TO_SCREEN - --displaying; -#endif -} - -void iota_gfx_flush(void) { - matrix_render(&display); -} - -static void matrix_update(struct CharacterMatrix *dest, - const struct CharacterMatrix *source) { - if (memcmp(dest->display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; - } -} - -static void render_status_info(void) { -#if DEBUG_TO_SCREEN - if (debug_enable) { - return; - } -#endif - - struct CharacterMatrix matrix; - - matrix_clear(&matrix); - matrix_write_P(&matrix, PSTR("USB: ")); -#ifdef PROTOCOL_LUFA - switch (USB_DeviceState) { - case DEVICE_STATE_Unattached: - matrix_write_P(&matrix, PSTR("Unattached")); - break; - case DEVICE_STATE_Suspended: - matrix_write_P(&matrix, PSTR("Suspended")); - break; - case DEVICE_STATE_Configured: - matrix_write_P(&matrix, PSTR("Connected")); - break; - case DEVICE_STATE_Powered: - matrix_write_P(&matrix, PSTR("Powered")); - break; - case DEVICE_STATE_Default: - matrix_write_P(&matrix, PSTR("Default")); - break; - case DEVICE_STATE_Addressed: - matrix_write_P(&matrix, PSTR("Addressed")); - break; - default: - matrix_write_P(&matrix, PSTR("Invalid")); - } -#endif - -// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below - - char buf[40]; - snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); - matrix_write_P(&matrix, PSTR("\n\nLayer: ")); - switch (layer_state) { - case _BASE: - matrix_write_P(&matrix, PSTR("Default")); - break; - case _RAISE: - matrix_write_P(&matrix, PSTR("Raise")); - break; - case _LOWER: - matrix_write_P(&matrix, PSTR("Lower")); - break; - case _ADJUST: - matrix_write_P(&matrix, PSTR("ADJUST")); - break; - default: - matrix_write(&matrix, buf); - } - - // Host Keyboard LED Status - char led[40]; - snprintf(led, sizeof(led), "\n%s %s %s", - (host_keyboard_leds() & (1< ScreenOffInterval) { - iota_gfx_off(); - } -} -#endif diff --git a/keyboards/lets_split/ssd1306.h b/keyboards/lets_split/ssd1306.h deleted file mode 100644 index b0c74f987..000000000 --- a/keyboards/lets_split/ssd1306.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef SSD1306_H -#define SSD1306_H - -#include -#include - -bool iota_gfx_init(void); -void iota_gfx_task(void); -bool iota_gfx_off(void); -bool iota_gfx_on(void); -void iota_gfx_flush(void); -void iota_gfx_write_char(uint8_t c); -void iota_gfx_write(const char *data); -void iota_gfx_write_P(const char *data); -void iota_gfx_clear_screen(void); - -#endif diff --git a/keyboards/nyquist/pro_micro.h b/keyboards/nyquist/pro_micro.h deleted file mode 100644 index f9e7ed75d..000000000 --- a/keyboards/nyquist/pro_micro.h +++ /dev/null @@ -1,362 +0,0 @@ -/* - pins_arduino.h - Pin definition functions for Arduino - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2007 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ -*/ - -#ifndef Pins_Arduino_h -#define Pins_Arduino_h - -#include - -// Workaround for wrong definitions in "iom32u4.h". -// This should be fixed in the AVR toolchain. -#undef UHCON -#undef UHINT -#undef UHIEN -#undef UHADDR -#undef UHFNUM -#undef UHFNUML -#undef UHFNUMH -#undef UHFLEN -#undef UPINRQX -#undef UPINTX -#undef UPNUM -#undef UPRST -#undef UPCONX -#undef UPCFG0X -#undef UPCFG1X -#undef UPSTAX -#undef UPCFG2X -#undef UPIENX -#undef UPDATX -#undef TCCR2A -#undef WGM20 -#undef WGM21 -#undef COM2B0 -#undef COM2B1 -#undef COM2A0 -#undef COM2A1 -#undef TCCR2B -#undef CS20 -#undef CS21 -#undef CS22 -#undef WGM22 -#undef FOC2B -#undef FOC2A -#undef TCNT2 -#undef TCNT2_0 -#undef TCNT2_1 -#undef TCNT2_2 -#undef TCNT2_3 -#undef TCNT2_4 -#undef TCNT2_5 -#undef TCNT2_6 -#undef TCNT2_7 -#undef OCR2A -#undef OCR2_0 -#undef OCR2_1 -#undef OCR2_2 -#undef OCR2_3 -#undef OCR2_4 -#undef OCR2_5 -#undef OCR2_6 -#undef OCR2_7 -#undef OCR2B -#undef OCR2_0 -#undef OCR2_1 -#undef OCR2_2 -#undef OCR2_3 -#undef OCR2_4 -#undef OCR2_5 -#undef OCR2_6 -#undef OCR2_7 - -#define NUM_DIGITAL_PINS 30 -#define NUM_ANALOG_INPUTS 12 - -#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) -#define TXLED0 PORTD |= (1<<5) -#define TXLED1 PORTD &= ~(1<<5) -#define RXLED0 PORTB |= (1<<0) -#define RXLED1 PORTB &= ~(1<<0) - -static const uint8_t SDA = 2; -static const uint8_t SCL = 3; -#define LED_BUILTIN 13 - -// Map SPI port to 'new' pins D14..D17 -static const uint8_t SS = 17; -static const uint8_t MOSI = 16; -static const uint8_t MISO = 14; -static const uint8_t SCK = 15; - -// Mapping of analog pins as digital I/O -// A6-A11 share with digital pins -static const uint8_t ADC0 = 18; -static const uint8_t ADC1 = 19; -static const uint8_t ADC2 = 20; -static const uint8_t ADC3 = 21; -static const uint8_t ADC4 = 22; -static const uint8_t ADC5 = 23; -static const uint8_t ADC6 = 24; // D4 -static const uint8_t ADC7 = 25; // D6 -static const uint8_t ADC8 = 26; // D8 -static const uint8_t ADC9 = 27; // D9 -static const uint8_t ADC10 = 28; // D10 -static const uint8_t ADC11 = 29; // D12 - -#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) -#define digitalPinToPCICRbit(p) 0 -#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) -#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) - -// __AVR_ATmega32U4__ has an unusual mapping of pins to channels -extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; -#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) - -#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) - -#ifdef ARDUINO_MAIN - -// On the Arduino board, digital pins are also used -// for the analog output (software PWM). Analog input -// pins are a separate set. - -// ATMEL ATMEGA32U4 / ARDUINO LEONARDO -// -// D0 PD2 RXD1/INT2 -// D1 PD3 TXD1/INT3 -// D2 PD1 SDA SDA/INT1 -// D3# PD0 PWM8/SCL OC0B/SCL/INT0 -// D4 A6 PD4 ADC8 -// D5# PC6 ??? OC3A/#OC4A -// D6# A7 PD7 FastPWM #OC4D/ADC10 -// D7 PE6 INT6/AIN0 -// -// D8 A8 PB4 ADC11/PCINT4 -// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5 -// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6 -// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7 -// D12 A11 PD6 T1/#OC4D/ADC9 -// D13# PC7 PWM10 CLK0/OC4A -// -// A0 D18 PF7 ADC7 -// A1 D19 PF6 ADC6 -// A2 D20 PF5 ADC5 -// A3 D21 PF4 ADC4 -// A4 D22 PF1 ADC1 -// A5 D23 PF0 ADC0 -// -// New pins D14..D17 to map SPI port to digital pins -// -// MISO D14 PB3 MISO,PCINT3 -// SCK D15 PB1 SCK,PCINT1 -// MOSI D16 PB2 MOSI,PCINT2 -// SS D17 PB0 RXLED,SS/PCINT0 -// -// Connected LEDs on board for TX and RX -// TXLED D24 PD5 XCK1 -// RXLED D17 PB0 -// HWB PE2 HWB - -// these arrays map port names (e.g. port B) to the -// appropriate addresses for various functions (e.g. reading -// and writing) -const uint16_t PROGMEM port_to_mode_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &DDRB, - (uint16_t) &DDRC, - (uint16_t) &DDRD, - (uint16_t) &DDRE, - (uint16_t) &DDRF, -}; - -const uint16_t PROGMEM port_to_output_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &PORTB, - (uint16_t) &PORTC, - (uint16_t) &PORTD, - (uint16_t) &PORTE, - (uint16_t) &PORTF, -}; - -const uint16_t PROGMEM port_to_input_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &PINB, - (uint16_t) &PINC, - (uint16_t) &PIND, - (uint16_t) &PINE, - (uint16_t) &PINF, -}; - -const uint8_t PROGMEM digital_pin_to_port_PGM[] = { - PD, // D0 - PD2 - PD, // D1 - PD3 - PD, // D2 - PD1 - PD, // D3 - PD0 - PD, // D4 - PD4 - PC, // D5 - PC6 - PD, // D6 - PD7 - PE, // D7 - PE6 - - PB, // D8 - PB4 - PB, // D9 - PB5 - PB, // D10 - PB6 - PB, // D11 - PB7 - PD, // D12 - PD6 - PC, // D13 - PC7 - - PB, // D14 - MISO - PB3 - PB, // D15 - SCK - PB1 - PB, // D16 - MOSI - PB2 - PB, // D17 - SS - PB0 - - PF, // D18 - A0 - PF7 - PF, // D19 - A1 - PF6 - PF, // D20 - A2 - PF5 - PF, // D21 - A3 - PF4 - PF, // D22 - A4 - PF1 - PF, // D23 - A5 - PF0 - - PD, // D24 - PD5 - PD, // D25 / D6 - A7 - PD7 - PB, // D26 / D8 - A8 - PB4 - PB, // D27 / D9 - A9 - PB5 - PB, // D28 / D10 - A10 - PB6 - PD, // D29 / D12 - A11 - PD6 -}; - -const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { - _BV(2), // D0 - PD2 - _BV(3), // D1 - PD3 - _BV(1), // D2 - PD1 - _BV(0), // D3 - PD0 - _BV(4), // D4 - PD4 - _BV(6), // D5 - PC6 - _BV(7), // D6 - PD7 - _BV(6), // D7 - PE6 - - _BV(4), // D8 - PB4 - _BV(5), // D9 - PB5 - _BV(6), // D10 - PB6 - _BV(7), // D11 - PB7 - _BV(6), // D12 - PD6 - _BV(7), // D13 - PC7 - - _BV(3), // D14 - MISO - PB3 - _BV(1), // D15 - SCK - PB1 - _BV(2), // D16 - MOSI - PB2 - _BV(0), // D17 - SS - PB0 - - _BV(7), // D18 - A0 - PF7 - _BV(6), // D19 - A1 - PF6 - _BV(5), // D20 - A2 - PF5 - _BV(4), // D21 - A3 - PF4 - _BV(1), // D22 - A4 - PF1 - _BV(0), // D23 - A5 - PF0 - - _BV(5), // D24 - PD5 - _BV(7), // D25 / D6 - A7 - PD7 - _BV(4), // D26 / D8 - A8 - PB4 - _BV(5), // D27 / D9 - A9 - PB5 - _BV(6), // D28 / D10 - A10 - PB6 - _BV(6), // D29 / D12 - A11 - PD6 -}; - -const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - TIMER0B, /* 3 */ - NOT_ON_TIMER, - TIMER3A, /* 5 */ - TIMER4D, /* 6 */ - NOT_ON_TIMER, - - NOT_ON_TIMER, - TIMER1A, /* 9 */ - TIMER1B, /* 10 */ - TIMER0A, /* 11 */ - - NOT_ON_TIMER, - TIMER4A, /* 13 */ - - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, -}; - -const uint8_t PROGMEM analog_pin_to_channel_PGM[] = { - 7, // A0 PF7 ADC7 - 6, // A1 PF6 ADC6 - 5, // A2 PF5 ADC5 - 4, // A3 PF4 ADC4 - 1, // A4 PF1 ADC1 - 0, // A5 PF0 ADC0 - 8, // A6 D4 PD4 ADC8 - 10, // A7 D6 PD7 ADC10 - 11, // A8 D8 PB4 ADC11 - 12, // A9 D9 PB5 ADC12 - 13, // A10 D10 PB6 ADC13 - 9 // A11 D12 PD6 ADC9 -}; - -#endif /* ARDUINO_MAIN */ - -// These serial port names are intended to allow libraries and architecture-neutral -// sketches to automatically default to the correct port name for a particular type -// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, -// the first hardware serial port whose RX/TX pins are not dedicated to another use. -// -// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor -// -// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial -// -// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library -// -// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. -// -// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX -// pins are NOT connected to anything by default. -#define SERIAL_PORT_MONITOR Serial -#define SERIAL_PORT_USBVIRTUAL Serial -#define SERIAL_PORT_HARDWARE Serial1 -#define SERIAL_PORT_HARDWARE_OPEN Serial1 - -#endif /* Pins_Arduino_h */ diff --git a/keyboards/orthodox/pro_micro.h b/keyboards/orthodox/pro_micro.h deleted file mode 100644 index f9e7ed75d..000000000 --- a/keyboards/orthodox/pro_micro.h +++ /dev/null @@ -1,362 +0,0 @@ -/* - pins_arduino.h - Pin definition functions for Arduino - Part of Arduino - http://www.arduino.cc/ - - Copyright (c) 2007 David A. Mellis - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General - Public License along with this library; if not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, - Boston, MA 02111-1307 USA - - $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ -*/ - -#ifndef Pins_Arduino_h -#define Pins_Arduino_h - -#include - -// Workaround for wrong definitions in "iom32u4.h". -// This should be fixed in the AVR toolchain. -#undef UHCON -#undef UHINT -#undef UHIEN -#undef UHADDR -#undef UHFNUM -#undef UHFNUML -#undef UHFNUMH -#undef UHFLEN -#undef UPINRQX -#undef UPINTX -#undef UPNUM -#undef UPRST -#undef UPCONX -#undef UPCFG0X -#undef UPCFG1X -#undef UPSTAX -#undef UPCFG2X -#undef UPIENX -#undef UPDATX -#undef TCCR2A -#undef WGM20 -#undef WGM21 -#undef COM2B0 -#undef COM2B1 -#undef COM2A0 -#undef COM2A1 -#undef TCCR2B -#undef CS20 -#undef CS21 -#undef CS22 -#undef WGM22 -#undef FOC2B -#undef FOC2A -#undef TCNT2 -#undef TCNT2_0 -#undef TCNT2_1 -#undef TCNT2_2 -#undef TCNT2_3 -#undef TCNT2_4 -#undef TCNT2_5 -#undef TCNT2_6 -#undef TCNT2_7 -#undef OCR2A -#undef OCR2_0 -#undef OCR2_1 -#undef OCR2_2 -#undef OCR2_3 -#undef OCR2_4 -#undef OCR2_5 -#undef OCR2_6 -#undef OCR2_7 -#undef OCR2B -#undef OCR2_0 -#undef OCR2_1 -#undef OCR2_2 -#undef OCR2_3 -#undef OCR2_4 -#undef OCR2_5 -#undef OCR2_6 -#undef OCR2_7 - -#define NUM_DIGITAL_PINS 30 -#define NUM_ANALOG_INPUTS 12 - -#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) -#define TXLED0 PORTD |= (1<<5) -#define TXLED1 PORTD &= ~(1<<5) -#define RXLED0 PORTB |= (1<<0) -#define RXLED1 PORTB &= ~(1<<0) - -static const uint8_t SDA = 2; -static const uint8_t SCL = 3; -#define LED_BUILTIN 13 - -// Map SPI port to 'new' pins D14..D17 -static const uint8_t SS = 17; -static const uint8_t MOSI = 16; -static const uint8_t MISO = 14; -static const uint8_t SCK = 15; - -// Mapping of analog pins as digital I/O -// A6-A11 share with digital pins -static const uint8_t ADC0 = 18; -static const uint8_t ADC1 = 19; -static const uint8_t ADC2 = 20; -static const uint8_t ADC3 = 21; -static const uint8_t ADC4 = 22; -static const uint8_t ADC5 = 23; -static const uint8_t ADC6 = 24; // D4 -static const uint8_t ADC7 = 25; // D6 -static const uint8_t ADC8 = 26; // D8 -static const uint8_t ADC9 = 27; // D9 -static const uint8_t ADC10 = 28; // D10 -static const uint8_t ADC11 = 29; // D12 - -#define digitalPinToPCICR(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCICR) : ((uint8_t *)0)) -#define digitalPinToPCICRbit(p) 0 -#define digitalPinToPCMSK(p) ((((p) >= 8 && (p) <= 11) || ((p) >= 14 && (p) <= 17) || ((p) >= A8 && (p) <= A10)) ? (&PCMSK0) : ((uint8_t *)0)) -#define digitalPinToPCMSKbit(p) ( ((p) >= 8 && (p) <= 11) ? (p) - 4 : ((p) == 14 ? 3 : ((p) == 15 ? 1 : ((p) == 16 ? 2 : ((p) == 17 ? 0 : (p - A8 + 4)))))) - -// __AVR_ATmega32U4__ has an unusual mapping of pins to channels -extern const uint8_t PROGMEM analog_pin_to_channel_PGM[]; -#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) ) - -#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) - -#ifdef ARDUINO_MAIN - -// On the Arduino board, digital pins are also used -// for the analog output (software PWM). Analog input -// pins are a separate set. - -// ATMEL ATMEGA32U4 / ARDUINO LEONARDO -// -// D0 PD2 RXD1/INT2 -// D1 PD3 TXD1/INT3 -// D2 PD1 SDA SDA/INT1 -// D3# PD0 PWM8/SCL OC0B/SCL/INT0 -// D4 A6 PD4 ADC8 -// D5# PC6 ??? OC3A/#OC4A -// D6# A7 PD7 FastPWM #OC4D/ADC10 -// D7 PE6 INT6/AIN0 -// -// D8 A8 PB4 ADC11/PCINT4 -// D9# A9 PB5 PWM16 OC1A/#OC4B/ADC12/PCINT5 -// D10# A10 PB6 PWM16 OC1B/0c4B/ADC13/PCINT6 -// D11# PB7 PWM8/16 0C0A/OC1C/#RTS/PCINT7 -// D12 A11 PD6 T1/#OC4D/ADC9 -// D13# PC7 PWM10 CLK0/OC4A -// -// A0 D18 PF7 ADC7 -// A1 D19 PF6 ADC6 -// A2 D20 PF5 ADC5 -// A3 D21 PF4 ADC4 -// A4 D22 PF1 ADC1 -// A5 D23 PF0 ADC0 -// -// New pins D14..D17 to map SPI port to digital pins -// -// MISO D14 PB3 MISO,PCINT3 -// SCK D15 PB1 SCK,PCINT1 -// MOSI D16 PB2 MOSI,PCINT2 -// SS D17 PB0 RXLED,SS/PCINT0 -// -// Connected LEDs on board for TX and RX -// TXLED D24 PD5 XCK1 -// RXLED D17 PB0 -// HWB PE2 HWB - -// these arrays map port names (e.g. port B) to the -// appropriate addresses for various functions (e.g. reading -// and writing) -const uint16_t PROGMEM port_to_mode_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &DDRB, - (uint16_t) &DDRC, - (uint16_t) &DDRD, - (uint16_t) &DDRE, - (uint16_t) &DDRF, -}; - -const uint16_t PROGMEM port_to_output_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &PORTB, - (uint16_t) &PORTC, - (uint16_t) &PORTD, - (uint16_t) &PORTE, - (uint16_t) &PORTF, -}; - -const uint16_t PROGMEM port_to_input_PGM[] = { - NOT_A_PORT, - NOT_A_PORT, - (uint16_t) &PINB, - (uint16_t) &PINC, - (uint16_t) &PIND, - (uint16_t) &PINE, - (uint16_t) &PINF, -}; - -const uint8_t PROGMEM digital_pin_to_port_PGM[] = { - PD, // D0 - PD2 - PD, // D1 - PD3 - PD, // D2 - PD1 - PD, // D3 - PD0 - PD, // D4 - PD4 - PC, // D5 - PC6 - PD, // D6 - PD7 - PE, // D7 - PE6 - - PB, // D8 - PB4 - PB, // D9 - PB5 - PB, // D10 - PB6 - PB, // D11 - PB7 - PD, // D12 - PD6 - PC, // D13 - PC7 - - PB, // D14 - MISO - PB3 - PB, // D15 - SCK - PB1 - PB, // D16 - MOSI - PB2 - PB, // D17 - SS - PB0 - - PF, // D18 - A0 - PF7 - PF, // D19 - A1 - PF6 - PF, // D20 - A2 - PF5 - PF, // D21 - A3 - PF4 - PF, // D22 - A4 - PF1 - PF, // D23 - A5 - PF0 - - PD, // D24 - PD5 - PD, // D25 / D6 - A7 - PD7 - PB, // D26 / D8 - A8 - PB4 - PB, // D27 / D9 - A9 - PB5 - PB, // D28 / D10 - A10 - PB6 - PD, // D29 / D12 - A11 - PD6 -}; - -const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { - _BV(2), // D0 - PD2 - _BV(3), // D1 - PD3 - _BV(1), // D2 - PD1 - _BV(0), // D3 - PD0 - _BV(4), // D4 - PD4 - _BV(6), // D5 - PC6 - _BV(7), // D6 - PD7 - _BV(6), // D7 - PE6 - - _BV(4), // D8 - PB4 - _BV(5), // D9 - PB5 - _BV(6), // D10 - PB6 - _BV(7), // D11 - PB7 - _BV(6), // D12 - PD6 - _BV(7), // D13 - PC7 - - _BV(3), // D14 - MISO - PB3 - _BV(1), // D15 - SCK - PB1 - _BV(2), // D16 - MOSI - PB2 - _BV(0), // D17 - SS - PB0 - - _BV(7), // D18 - A0 - PF7 - _BV(6), // D19 - A1 - PF6 - _BV(5), // D20 - A2 - PF5 - _BV(4), // D21 - A3 - PF4 - _BV(1), // D22 - A4 - PF1 - _BV(0), // D23 - A5 - PF0 - - _BV(5), // D24 - PD5 - _BV(7), // D25 / D6 - A7 - PD7 - _BV(4), // D26 / D8 - A8 - PB4 - _BV(5), // D27 / D9 - A9 - PB5 - _BV(6), // D28 / D10 - A10 - PB6 - _BV(6), // D29 / D12 - A11 - PD6 -}; - -const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - TIMER0B, /* 3 */ - NOT_ON_TIMER, - TIMER3A, /* 5 */ - TIMER4D, /* 6 */ - NOT_ON_TIMER, - - NOT_ON_TIMER, - TIMER1A, /* 9 */ - TIMER1B, /* 10 */ - TIMER0A, /* 11 */ - - NOT_ON_TIMER, - TIMER4A, /* 13 */ - - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, - NOT_ON_TIMER, -}; - -const uint8_t PROGMEM analog_pin_to_channel_PGM[] = { - 7, // A0 PF7 ADC7 - 6, // A1 PF6 ADC6 - 5, // A2 PF5 ADC5 - 4, // A3 PF4 ADC4 - 1, // A4 PF1 ADC1 - 0, // A5 PF0 ADC0 - 8, // A6 D4 PD4 ADC8 - 10, // A7 D6 PD7 ADC10 - 11, // A8 D8 PB4 ADC11 - 12, // A9 D9 PB5 ADC12 - 13, // A10 D10 PB6 ADC13 - 9 // A11 D12 PD6 ADC9 -}; - -#endif /* ARDUINO_MAIN */ - -// These serial port names are intended to allow libraries and architecture-neutral -// sketches to automatically default to the correct port name for a particular type -// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, -// the first hardware serial port whose RX/TX pins are not dedicated to another use. -// -// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor -// -// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial -// -// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library -// -// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. -// -// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX -// pins are NOT connected to anything by default. -#define SERIAL_PORT_MONITOR Serial -#define SERIAL_PORT_USBVIRTUAL Serial -#define SERIAL_PORT_HARDWARE Serial1 -#define SERIAL_PORT_HARDWARE_OPEN Serial1 - -#endif /* Pins_Arduino_h */ diff --git a/keyboards/orthodox/ssd1306.c b/keyboards/orthodox/ssd1306.c deleted file mode 100644 index 5c6dff27f..000000000 --- a/keyboards/orthodox/ssd1306.c +++ /dev/null @@ -1,470 +0,0 @@ -#ifdef SSD1306OLED - -#include "ssd1306.h" -#include "config.h" -#include "i2c.h" -#include -#include "print.h" -#include "lets_split.h" -#include "common/glcdfont.c" -#ifdef ADAFRUIT_BLE_ENABLE -#include "adafruit_ble.h" -#endif -#ifdef PROTOCOL_LUFA -#include "lufa.h" -#endif -#include "sendchar.h" -#include "pincontrol.h" - -//assign the right code to your layers -#define _BASE 0 -#define _LOWER 8 -#define _RAISE 16 -#define _FNLAYER 64 -#define _NUMLAY 128 -#define _NLOWER 136 -#define _NFNLAYER 192 -#define _MOUSECURSOR 256 -#define _ADJUST 65560 - -// Set this to 1 to help diagnose early startup problems -// when testing power-on with ble. Turn it off otherwise, -// as the latency of printing most of the debug info messes -// with the matrix scan, causing keys to drop. -#define DEBUG_TO_SCREEN 0 - -// Controls the SSD1306 128x32 OLED display via i2c - -#define i2cAddress 0x3C - -#define DisplayHeight 32 -#define DisplayWidth 128 - -#define FontHeight 8 -#define FontWidth 6 - -#define MatrixRows (DisplayHeight / FontHeight) -#define MatrixCols (DisplayWidth / FontWidth) - -struct CharacterMatrix { - uint8_t display[MatrixRows][MatrixCols]; - uint8_t *cursor; - bool dirty; -}; - -static struct CharacterMatrix display; -//static uint16_t last_battery_update; -//static uint32_t vbat; -//#define BatteryUpdateInterval 10000 /* milliseconds */ -#define ScreenOffInterval 300000 /* milliseconds */ -#if DEBUG_TO_SCREEN -static uint8_t displaying; -#endif -static uint16_t last_flush; - -enum ssd1306_cmds { - DisplayOff = 0xAE, - DisplayOn = 0xAF, - - SetContrast = 0x81, - DisplayAllOnResume = 0xA4, - - DisplayAllOn = 0xA5, - NormalDisplay = 0xA6, - InvertDisplay = 0xA7, - SetDisplayOffset = 0xD3, - SetComPins = 0xda, - SetVComDetect = 0xdb, - SetDisplayClockDiv = 0xD5, - SetPreCharge = 0xd9, - SetMultiPlex = 0xa8, - SetLowColumn = 0x00, - SetHighColumn = 0x10, - SetStartLine = 0x40, - - SetMemoryMode = 0x20, - ColumnAddr = 0x21, - PageAddr = 0x22, - - ComScanInc = 0xc0, - ComScanDec = 0xc8, - SegRemap = 0xa0, - SetChargePump = 0x8d, - ExternalVcc = 0x01, - SwitchCapVcc = 0x02, - - ActivateScroll = 0x2f, - DeActivateScroll = 0x2e, - SetVerticalScrollArea = 0xa3, - RightHorizontalScroll = 0x26, - LeftHorizontalScroll = 0x27, - VerticalAndRightHorizontalScroll = 0x29, - VerticalAndLeftHorizontalScroll = 0x2a, -}; - - -// Write command sequence. -// Returns true on success. -static inline bool _send_cmd1(uint8_t cmd) { - bool res = false; - - if (i2c_start_write(i2cAddress)) { - xprintf("failed to start write to %d\n", i2cAddress); - goto done; - } - - if (i2c_master_write(0x0 /* command byte follows */)) { - print("failed to write control byte\n"); - - goto done; - } - - if (i2c_master_write(cmd)) { - xprintf("failed to write command %d\n", cmd); - goto done; - } - res = true; -done: - i2c_master_stop(); - return res; -} - -// Write 2-byte command sequence. -// Returns true on success -static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) { - if (!_send_cmd1(cmd)) { - return false; - } - return _send_cmd1(opr); -} - -// Write 3-byte command sequence. -// Returns true on success -static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) { - if (!_send_cmd1(cmd)) { - return false; - } - if (!_send_cmd1(opr1)) { - return false; - } - return _send_cmd1(opr2); -} - -#define send_cmd1(c) if (!_send_cmd1(c)) {goto done;} -#define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} -#define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} - -static void matrix_clear(struct CharacterMatrix *matrix); - -static void clear_display(void) { - matrix_clear(&display); - - // Clear all of the display bits (there can be random noise - // in the RAM on startup) - send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1); - send_cmd3(ColumnAddr, 0, DisplayWidth - 1); - - if (i2c_start_write(i2cAddress)) { - goto done; - } - if (i2c_master_write(0x40)) { - // Data mode - goto done; - } - for (uint8_t row = 0; row < MatrixRows; ++row) { - for (uint8_t col = 0; col < DisplayWidth; ++col) { - i2c_master_write(0); - } - } - - display.dirty = false; - -done: - i2c_master_stop(); -} - -#if DEBUG_TO_SCREEN -#undef sendchar -static int8_t capture_sendchar(uint8_t c) { - sendchar(c); - iota_gfx_write_char(c); - - if (!displaying) { - iota_gfx_flush(); - } - return 0; -} -#endif - -bool iota_gfx_init(void) { - bool success = false; - - send_cmd1(DisplayOff); - send_cmd2(SetDisplayClockDiv, 0x80); - send_cmd2(SetMultiPlex, DisplayHeight - 1); - - send_cmd2(SetDisplayOffset, 0); - - - send_cmd1(SetStartLine | 0x0); - send_cmd2(SetChargePump, 0x14 /* Enable */); - send_cmd2(SetMemoryMode, 0 /* horizontal addressing */); - -/// Flips the display orientation 0 degrees - send_cmd1(SegRemap | 0x1); - send_cmd1(ComScanDec); -/* -// the following Flip the display orientation 180 degrees - send_cmd1(SegRemap); - send_cmd1(ComScanInc); -// end flip */ - send_cmd2(SetComPins, 0x2); - send_cmd2(SetContrast, 0x8f); - send_cmd2(SetPreCharge, 0xf1); - send_cmd2(SetVComDetect, 0x40); - send_cmd1(DisplayAllOnResume); - send_cmd1(NormalDisplay); - send_cmd1(DeActivateScroll); - send_cmd1(DisplayOn); - - send_cmd2(SetContrast, 0); // Dim - - clear_display(); - - success = true; - - iota_gfx_flush(); - -#if DEBUG_TO_SCREEN - print_set_sendchar(capture_sendchar); -#endif - -done: - return success; -} - -bool iota_gfx_off(void) { - bool success = false; - - send_cmd1(DisplayOff); - success = true; - -done: - return success; -} - -bool iota_gfx_on(void) { - bool success = false; - - send_cmd1(DisplayOn); - success = true; - -done: - return success; -} - -static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { - *matrix->cursor = c; - ++matrix->cursor; - - if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) { - // We went off the end; scroll the display upwards by one line - memmove(&matrix->display[0], &matrix->display[1], - MatrixCols * (MatrixRows - 1)); - matrix->cursor = &matrix->display[MatrixRows - 1][0]; - memset(matrix->cursor, ' ', MatrixCols); - } -} - -static void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { - matrix->dirty = true; - - if (c == '\n') { - // Clear to end of line from the cursor and then move to the - // start of the next line - uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols; - - while (cursor_col++ < MatrixCols) { - matrix_write_char_inner(matrix, ' '); - } - return; - } - - matrix_write_char_inner(matrix, c); -} - -void iota_gfx_write_char(uint8_t c) { - matrix_write_char(&display, c); -} - -static void matrix_write(struct CharacterMatrix *matrix, const char *data) { - const char *end = data + strlen(data); - while (data < end) { - matrix_write_char(matrix, *data); - ++data; - } -} - -void iota_gfx_write(const char *data) { - matrix_write(&display, data); -} - -static void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { - while (true) { - uint8_t c = pgm_read_byte(data); - if (c == 0) { - return; - } - matrix_write_char(matrix, c); - ++data; - } -} - -void iota_gfx_write_P(const char *data) { - matrix_write_P(&display, data); -} - -static void matrix_clear(struct CharacterMatrix *matrix) { - memset(matrix->display, ' ', sizeof(matrix->display)); - matrix->cursor = &matrix->display[0][0]; - matrix->dirty = true; -} - -void iota_gfx_clear_screen(void) { - matrix_clear(&display); -} - -static void matrix_render(struct CharacterMatrix *matrix) { - last_flush = timer_read(); - iota_gfx_on(); -#if DEBUG_TO_SCREEN - ++displaying; -#endif - - // Move to the home position - send_cmd3(PageAddr, 0, MatrixRows - 1); - send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1); - - if (i2c_start_write(i2cAddress)) { - goto done; - } - if (i2c_master_write(0x40)) { - // Data mode - goto done; - } - - for (uint8_t row = 0; row < MatrixRows; ++row) { - for (uint8_t col = 0; col < MatrixCols; ++col) { - const uint8_t *glyph = font + (matrix->display[row][col] * (FontWidth - 1)); - - for (uint8_t glyphCol = 0; glyphCol < FontWidth - 1; ++glyphCol) { - uint8_t colBits = pgm_read_byte(glyph + glyphCol); - i2c_master_write(colBits); - } - - // 1 column of space between chars (it's not included in the glyph) - i2c_master_write(0); - } - } - - matrix->dirty = false; - -done: - i2c_master_stop(); -#if DEBUG_TO_SCREEN - --displaying; -#endif -} - -void iota_gfx_flush(void) { - matrix_render(&display); -} - -static void matrix_update(struct CharacterMatrix *dest, - const struct CharacterMatrix *source) { - if (memcmp(dest->display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; - } -} - -static void render_status_info(void) { -#if DEBUG_TO_SCREEN - if (debug_enable) { - return; - } -#endif - - struct CharacterMatrix matrix; - - matrix_clear(&matrix); - matrix_write_P(&matrix, PSTR("USB: ")); -#ifdef PROTOCOL_LUFA - switch (USB_DeviceState) { - case DEVICE_STATE_Unattached: - matrix_write_P(&matrix, PSTR("Unattached")); - break; - case DEVICE_STATE_Suspended: - matrix_write_P(&matrix, PSTR("Suspended")); - break; - case DEVICE_STATE_Configured: - matrix_write_P(&matrix, PSTR("Connected")); - break; - case DEVICE_STATE_Powered: - matrix_write_P(&matrix, PSTR("Powered")); - break; - case DEVICE_STATE_Default: - matrix_write_P(&matrix, PSTR("Default")); - break; - case DEVICE_STATE_Addressed: - matrix_write_P(&matrix, PSTR("Addressed")); - break; - default: - matrix_write_P(&matrix, PSTR("Invalid")); - } -#endif - -// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below - - char buf[40]; - snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); - matrix_write_P(&matrix, PSTR("\n\nLayer: ")); - switch (layer_state) { - case _BASE: - matrix_write_P(&matrix, PSTR("Default")); - break; - case _RAISE: - matrix_write_P(&matrix, PSTR("Raise")); - break; - case _LOWER: - matrix_write_P(&matrix, PSTR("Lower")); - break; - case _ADJUST: - matrix_write_P(&matrix, PSTR("ADJUST")); - break; - default: - matrix_write(&matrix, buf); - } - - // Host Keyboard LED Status - char led[40]; - snprintf(led, sizeof(led), "\n%s %s %s", - (host_keyboard_leds() & (1< ScreenOffInterval) { - iota_gfx_off(); - } -} -#endif diff --git a/keyboards/orthodox/ssd1306.h b/keyboards/orthodox/ssd1306.h deleted file mode 100644 index b0c74f987..000000000 --- a/keyboards/orthodox/ssd1306.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef SSD1306_H -#define SSD1306_H - -#include -#include - -bool iota_gfx_init(void); -void iota_gfx_task(void); -bool iota_gfx_off(void); -bool iota_gfx_on(void); -void iota_gfx_flush(void); -void iota_gfx_write_char(uint8_t c); -void iota_gfx_write(const char *data); -void iota_gfx_write_P(const char *data); -void iota_gfx_clear_screen(void); - -#endif diff --git a/quantum/analog.c b/quantum/analog.c deleted file mode 100644 index 1ec38df75..000000000 --- a/quantum/analog.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright 2015 Jack Humbert - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -// Simple analog to digitial conversion - -#include -#include -#include -#include "analog.h" - - -static uint8_t aref = (1<= 12) return 0; - return adc_read(pgm_read_byte(pin_to_mux + pin)); -#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) - if (pin >= 8) return 0; - return adc_read(pin); -#else - return 0; -#endif -} - -// Mux input -int16_t adc_read(uint8_t mux) -{ -#if defined(__AVR_AT90USB162__) - return 0; -#else - uint8_t low; - - ADCSRA = (1<. - */ - -#ifndef _analog_h_included__ -#define _analog_h_included__ - -#include - -void analogReference(uint8_t mode); -int16_t analogRead(uint8_t pin); -int16_t adc_read(uint8_t mux); - -#define ADC_REF_POWER (1<. -*/ - -#include "light_ws2812.h" -#include -#include -#include -#include "debug.h" - -#ifdef RGBW_BB_TWI - -// Port for the I2C -#define I2C_DDR DDRD -#define I2C_PIN PIND -#define I2C_PORT PORTD - -// Pins to be used in the bit banging -#define I2C_CLK 0 -#define I2C_DAT 1 - -#define I2C_DATA_HI()\ -I2C_DDR &= ~ (1 << I2C_DAT);\ -I2C_PORT |= (1 << I2C_DAT); -#define I2C_DATA_LO()\ -I2C_DDR |= (1 << I2C_DAT);\ -I2C_PORT &= ~ (1 << I2C_DAT); - -#define I2C_CLOCK_HI()\ -I2C_DDR &= ~ (1 << I2C_CLK);\ -I2C_PORT |= (1 << I2C_CLK); -#define I2C_CLOCK_LO()\ -I2C_DDR |= (1 << I2C_CLK);\ -I2C_PORT &= ~ (1 << I2C_CLK); - -#define I2C_DELAY 1 - -void I2C_WriteBit(unsigned char c) -{ - if (c > 0) - { - I2C_DATA_HI(); - } - else - { - I2C_DATA_LO(); - } - - I2C_CLOCK_HI(); - _delay_us(I2C_DELAY); - - I2C_CLOCK_LO(); - _delay_us(I2C_DELAY); - - if (c > 0) - { - I2C_DATA_LO(); - } - - _delay_us(I2C_DELAY); -} - -// Inits bitbanging port, must be called before using the functions below -// -void I2C_Init(void) -{ - I2C_PORT &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK)); - - I2C_CLOCK_HI(); - I2C_DATA_HI(); - - _delay_us(I2C_DELAY); -} - -// Send a START Condition -// -void I2C_Start(void) -{ - // set both to high at the same time - I2C_DDR &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK)); - _delay_us(I2C_DELAY); - - I2C_DATA_LO(); - _delay_us(I2C_DELAY); - - I2C_CLOCK_LO(); - _delay_us(I2C_DELAY); -} - -// Send a STOP Condition -// -void I2C_Stop(void) -{ - I2C_CLOCK_HI(); - _delay_us(I2C_DELAY); - - I2C_DATA_HI(); - _delay_us(I2C_DELAY); -} - -// write a byte to the I2C slave device -// -unsigned char I2C_Write(unsigned char c) -{ - for (char i = 0; i < 8; i++) - { - I2C_WriteBit(c & 128); - - c <<= 1; - } - - - I2C_WriteBit(0); - _delay_us(I2C_DELAY); - _delay_us(I2C_DELAY); - - // _delay_us(I2C_DELAY); - //return I2C_ReadBit(); - return 0; -} - - -#endif - -// Setleds for standard RGB -void inline ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) -{ - // ws2812_setleds_pin(ledarray,leds, _BV(ws2812_pin)); - ws2812_setleds_pin(ledarray,leds, _BV(RGB_DI_PIN & 0xF)); -} - -void inline ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask) -{ - // ws2812_DDRREG |= pinmask; // Enable DDR - // new universal format (DDR) - _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= pinmask; - - ws2812_sendarray_mask((uint8_t*)ledarray,leds+leds+leds,pinmask); - _delay_us(50); -} - -// Setleds for SK6812RGBW -void inline ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t leds) -{ - - #ifdef RGBW_BB_TWI - uint8_t sreg_prev, twcr_prev; - sreg_prev=SREG; - twcr_prev=TWCR; - cli(); - TWCR &= ~(1<> 4) + 1) |= _BV(RGB_DI_PIN & 0xF); - - ws2812_sendarray_mask((uint8_t*)ledarray,leds<<2,_BV(RGB_DI_PIN & 0xF)); - - - #ifndef RGBW_BB_TWI - _delay_us(80); - #endif -} - -void ws2812_sendarray(uint8_t *data,uint16_t datlen) -{ - ws2812_sendarray_mask(data,datlen,_BV(RGB_DI_PIN & 0xF)); -} - -/* - This routine writes an array of bytes with RGB values to the Dataout pin - using the fast 800kHz clockless WS2811/2812 protocol. -*/ - -// Timing in ns -#define w_zeropulse 350 -#define w_onepulse 900 -#define w_totalperiod 1250 - -// Fixed cycles used by the inner loop -#define w_fixedlow 2 -#define w_fixedhigh 4 -#define w_fixedtotal 8 - -// Insert NOPs to match the timing, if possible -#define w_zerocycles (((F_CPU/1000)*w_zeropulse )/1000000) -#define w_onecycles (((F_CPU/1000)*w_onepulse +500000)/1000000) -#define w_totalcycles (((F_CPU/1000)*w_totalperiod +500000)/1000000) - -// w1 - nops between rising edge and falling edge - low -#define w1 (w_zerocycles-w_fixedlow) -// w2 nops between fe low and fe high -#define w2 (w_onecycles-w_fixedhigh-w1) -// w3 nops to complete loop -#define w3 (w_totalcycles-w_fixedtotal-w1-w2) - -#if w1>0 - #define w1_nops w1 -#else - #define w1_nops 0 -#endif - -// The only critical timing parameter is the minimum pulse length of the "0" -// Warn or throw error if this timing can not be met with current F_CPU settings. -#define w_lowtime ((w1_nops+w_fixedlow)*1000000)/(F_CPU/1000) -#if w_lowtime>550 - #error "Light_ws2812: Sorry, the clock speed is too low. Did you set F_CPU correctly?" -#elif w_lowtime>450 - #warning "Light_ws2812: The timing is critical and may only work on WS2812B, not on WS2812(S)." - #warning "Please consider a higher clockspeed, if possible" -#endif - -#if w2>0 -#define w2_nops w2 -#else -#define w2_nops 0 -#endif - -#if w3>0 -#define w3_nops w3 -#else -#define w3_nops 0 -#endif - -#define w_nop1 "nop \n\t" -#define w_nop2 "rjmp .+0 \n\t" -#define w_nop4 w_nop2 w_nop2 -#define w_nop8 w_nop4 w_nop4 -#define w_nop16 w_nop8 w_nop8 - -void inline ws2812_sendarray_mask(uint8_t *data,uint16_t datlen,uint8_t maskhi) -{ - uint8_t curbyte,ctr,masklo; - uint8_t sreg_prev; - - // masklo =~maskhi&ws2812_PORTREG; - // maskhi |= ws2812_PORTREG; - masklo =~maskhi&_SFR_IO8((RGB_DI_PIN >> 4) + 2); - maskhi |= _SFR_IO8((RGB_DI_PIN >> 4) + 2); - sreg_prev=SREG; - cli(); - - while (datlen--) { - curbyte=(*data++); - - asm volatile( - " ldi %0,8 \n\t" - "loop%=: \n\t" - " out %2,%3 \n\t" // '1' [01] '0' [01] - re -#if (w1_nops&1) -w_nop1 -#endif -#if (w1_nops&2) -w_nop2 -#endif -#if (w1_nops&4) -w_nop4 -#endif -#if (w1_nops&8) -w_nop8 -#endif -#if (w1_nops&16) -w_nop16 -#endif - " sbrs %1,7 \n\t" // '1' [03] '0' [02] - " out %2,%4 \n\t" // '1' [--] '0' [03] - fe-low - " lsl %1 \n\t" // '1' [04] '0' [04] -#if (w2_nops&1) - w_nop1 -#endif -#if (w2_nops&2) - w_nop2 -#endif -#if (w2_nops&4) - w_nop4 -#endif -#if (w2_nops&8) - w_nop8 -#endif -#if (w2_nops&16) - w_nop16 -#endif - " out %2,%4 \n\t" // '1' [+1] '0' [+1] - fe-high -#if (w3_nops&1) -w_nop1 -#endif -#if (w3_nops&2) -w_nop2 -#endif -#if (w3_nops&4) -w_nop4 -#endif -#if (w3_nops&8) -w_nop8 -#endif -#if (w3_nops&16) -w_nop16 -#endif - - " dec %0 \n\t" // '1' [+2] '0' [+2] - " brne loop%=\n\t" // '1' [+3] '0' [+4] - : "=&d" (ctr) - : "r" (curbyte), "I" (_SFR_IO_ADDR(_SFR_IO8((RGB_DI_PIN >> 4) + 2))), "r" (maskhi), "r" (masklo) - ); - } - - SREG=sreg_prev; -} diff --git a/quantum/light_ws2812.h b/quantum/light_ws2812.h deleted file mode 100755 index 60924a0fb..000000000 --- a/quantum/light_ws2812.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * light weight WS2812 lib include - * - * Version 2.3 - Nev 29th 2015 - * Author: Tim (cpldcpu@gmail.com) - * - * Please do not change this file! All configuration is handled in "ws2812_config.h" - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef LIGHT_WS2812_H_ -#define LIGHT_WS2812_H_ - -#include -#include -//#include "ws2812_config.h" -//#include "i2cmaster.h" - -#ifdef RGBW - #define LED_TYPE struct cRGBW -#else - #define LED_TYPE struct cRGB -#endif - - -/* - * Structure of the LED array - * - * cRGB: RGB for WS2812S/B/C/D, SK6812, SK6812Mini, SK6812WWA, APA104, APA106 - * cRGBW: RGBW for SK6812RGBW - */ - -struct cRGB { uint8_t g; uint8_t r; uint8_t b; }; -struct cRGBW { uint8_t g; uint8_t r; uint8_t b; uint8_t w;}; - - - -/* User Interface - * - * Input: - * ledarray: An array of GRB data describing the LED colors - * number_of_leds: The number of LEDs to write - * pinmask (optional): Bitmask describing the output bin. e.g. _BV(PB0) - * - * The functions will perform the following actions: - * - Set the data-out pin as output - * - Send out the LED data - * - Wait 50�s to reset the LEDs - */ - -void ws2812_setleds (LED_TYPE *ledarray, uint16_t number_of_leds); -void ws2812_setleds_pin (LED_TYPE *ledarray, uint16_t number_of_leds,uint8_t pinmask); -void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds); - -/* - * Old interface / Internal functions - * - * The functions take a byte-array and send to the data output as WS2812 bitstream. - * The length is the number of bytes to send - three per LED. - */ - -void ws2812_sendarray (uint8_t *array,uint16_t length); -void ws2812_sendarray_mask(uint8_t *array,uint16_t length, uint8_t pinmask); - - -/* - * Internal defines - */ -#ifndef CONCAT -#define CONCAT(a, b) a ## b -#endif -#ifndef CONCAT_EXP -#define CONCAT_EXP(a, b) CONCAT(a, b) -#endif - -// #define ws2812_PORTREG CONCAT_EXP(PORT,ws2812_port) -// #define ws2812_DDRREG CONCAT_EXP(DDR,ws2812_port) - -#endif /* LIGHT_WS2812_H_ */ diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 92130192c..8fea96a9e 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -61,7 +61,7 @@ #include #include #include "eeconfig.h" -#include "light_ws2812.h" +#include "ws2812.h" extern LED_TYPE led[RGBLED_NUM]; diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index 6773726ee..4af34ba57 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk @@ -12,7 +12,7 @@ HEX = $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) BIN = - +COMMON_VPATH += $(DRIVER_PATH)/avr COMPILEFLAGS += -funsigned-char COMPILEFLAGS += -funsigned-bitfields -- cgit v1.2.3 From cc468523dfec8175939f575a214714eea8aaa7a3 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 11 Jul 2017 14:23:26 -0400 Subject: clean up ssd1306 implementation --- drivers/avr/ssd1306.c | 174 ++-------------------- drivers/avr/ssd1306.h | 77 ++++++++++ keyboards/lets_split/keymaps/OLED_sample/keymap.c | 78 ++++++++++ 3 files changed, 169 insertions(+), 160 deletions(-) (limited to 'keyboards/lets_split') diff --git a/drivers/avr/ssd1306.c b/drivers/avr/ssd1306.c index e454f5437..03a909e9d 100644 --- a/drivers/avr/ssd1306.c +++ b/drivers/avr/ssd1306.c @@ -1,7 +1,6 @@ #ifdef SSD1306OLED #include "ssd1306.h" -#include "config.h" #include "i2c.h" #include #include "print.h" @@ -13,18 +12,7 @@ #include "lufa.h" #endif #include "sendchar.h" -#include "pincontrol.h" - -//assign the right code to your layers -#define _BASE 0 -#define _LOWER 8 -#define _RAISE 16 -#define _FNLAYER 64 -#define _NUMLAY 128 -#define _NLOWER 136 -#define _NFNLAYER 192 -#define _MOUSECURSOR 256 -#define _ADJUST 65560 +#include "timer.h" // Set this to 1 to help diagnose early startup problems // when testing power-on with ble. Turn it off otherwise, @@ -32,26 +20,6 @@ // with the matrix scan, causing keys to drop. #define DEBUG_TO_SCREEN 0 -// Controls the SSD1306 128x32 OLED display via i2c - -#define i2cAddress 0x3C - -#define DisplayHeight 32 -#define DisplayWidth 128 - -#define FontHeight 8 -#define FontWidth 6 - -#define MatrixRows (DisplayHeight / FontHeight) -#define MatrixCols (DisplayWidth / FontWidth) - -struct CharacterMatrix { - uint8_t display[MatrixRows][MatrixCols]; - uint8_t *cursor; - bool dirty; -}; - -static struct CharacterMatrix display; //static uint16_t last_battery_update; //static uint32_t vbat; //#define BatteryUpdateInterval 10000 /* milliseconds */ @@ -61,54 +29,13 @@ static uint8_t displaying; #endif static uint16_t last_flush; -enum ssd1306_cmds { - DisplayOff = 0xAE, - DisplayOn = 0xAF, - - SetContrast = 0x81, - DisplayAllOnResume = 0xA4, - - DisplayAllOn = 0xA5, - NormalDisplay = 0xA6, - InvertDisplay = 0xA7, - SetDisplayOffset = 0xD3, - SetComPins = 0xda, - SetVComDetect = 0xdb, - SetDisplayClockDiv = 0xD5, - SetPreCharge = 0xd9, - SetMultiPlex = 0xa8, - SetLowColumn = 0x00, - SetHighColumn = 0x10, - SetStartLine = 0x40, - - SetMemoryMode = 0x20, - ColumnAddr = 0x21, - PageAddr = 0x22, - - ComScanInc = 0xc0, - ComScanDec = 0xc8, - SegRemap = 0xa0, - SetChargePump = 0x8d, - ExternalVcc = 0x01, - SwitchCapVcc = 0x02, - - ActivateScroll = 0x2f, - DeActivateScroll = 0x2e, - SetVerticalScrollArea = 0xa3, - RightHorizontalScroll = 0x26, - LeftHorizontalScroll = 0x27, - VerticalAndRightHorizontalScroll = 0x29, - VerticalAndLeftHorizontalScroll = 0x2a, -}; - - // Write command sequence. // Returns true on success. static inline bool _send_cmd1(uint8_t cmd) { bool res = false; - if (i2c_start_write(i2cAddress)) { - xprintf("failed to start write to %d\n", i2cAddress); + if (i2c_start_write(SSD1306_ADDRESS)) { + xprintf("failed to start write to %d\n", SSD1306_ADDRESS); goto done; } @@ -153,8 +80,6 @@ static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) { #define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} #define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} -static void matrix_clear(struct CharacterMatrix *matrix); - static void clear_display(void) { matrix_clear(&display); @@ -163,7 +88,7 @@ static void clear_display(void) { send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1); send_cmd3(ColumnAddr, 0, DisplayWidth - 1); - if (i2c_start_write(i2cAddress)) { + if (i2c_start_write(SSD1306_ADDRESS)) { goto done; } if (i2c_master_write(0x40)) { @@ -262,7 +187,7 @@ done: return success; } -static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { +void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { *matrix->cursor = c; ++matrix->cursor; @@ -275,7 +200,7 @@ static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { } } -static void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { +void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { matrix->dirty = true; if (c == '\n') { @@ -296,7 +221,7 @@ void iota_gfx_write_char(uint8_t c) { matrix_write_char(&display, c); } -static void matrix_write(struct CharacterMatrix *matrix, const char *data) { +void matrix_write(struct CharacterMatrix *matrix, const char *data) { const char *end = data + strlen(data); while (data < end) { matrix_write_char(matrix, *data); @@ -308,7 +233,7 @@ void iota_gfx_write(const char *data) { matrix_write(&display, data); } -static void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { +void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { while (true) { uint8_t c = pgm_read_byte(data); if (c == 0) { @@ -323,7 +248,7 @@ void iota_gfx_write_P(const char *data) { matrix_write_P(&display, data); } -static void matrix_clear(struct CharacterMatrix *matrix) { +void matrix_clear(struct CharacterMatrix *matrix) { memset(matrix->display, ' ', sizeof(matrix->display)); matrix->cursor = &matrix->display[0][0]; matrix->dirty = true; @@ -333,7 +258,7 @@ void iota_gfx_clear_screen(void) { matrix_clear(&display); } -static void matrix_render(struct CharacterMatrix *matrix) { +void matrix_render(struct CharacterMatrix *matrix) { last_flush = timer_read(); iota_gfx_on(); #if DEBUG_TO_SCREEN @@ -344,7 +269,7 @@ static void matrix_render(struct CharacterMatrix *matrix) { send_cmd3(PageAddr, 0, MatrixRows - 1); send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1); - if (i2c_start_write(i2cAddress)) { + if (i2c_start_write(SSD1306_ADDRESS)) { goto done; } if (i2c_master_write(0x40)) { @@ -379,84 +304,13 @@ void iota_gfx_flush(void) { matrix_render(&display); } -static void matrix_update(struct CharacterMatrix *dest, - const struct CharacterMatrix *source) { - if (memcmp(dest->display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; - } -} - -static void render_status_info(void) { -#if DEBUG_TO_SCREEN - if (debug_enable) { - return; - } -#endif - - struct CharacterMatrix matrix; - - matrix_clear(&matrix); - matrix_write_P(&matrix, PSTR("USB: ")); -#ifdef PROTOCOL_LUFA - switch (USB_DeviceState) { - case DEVICE_STATE_Unattached: - matrix_write_P(&matrix, PSTR("Unattached")); - break; - case DEVICE_STATE_Suspended: - matrix_write_P(&matrix, PSTR("Suspended")); - break; - case DEVICE_STATE_Configured: - matrix_write_P(&matrix, PSTR("Connected")); - break; - case DEVICE_STATE_Powered: - matrix_write_P(&matrix, PSTR("Powered")); - break; - case DEVICE_STATE_Default: - matrix_write_P(&matrix, PSTR("Default")); - break; - case DEVICE_STATE_Addressed: - matrix_write_P(&matrix, PSTR("Addressed")); - break; - default: - matrix_write_P(&matrix, PSTR("Invalid")); - } -#endif +__attribute__((weak)) +void iota_gfx_task_user(void) { -// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below - - char buf[40]; - snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); - matrix_write_P(&matrix, PSTR("\n\nLayer: ")); - switch (layer_state) { - case _BASE: - matrix_write_P(&matrix, PSTR("Default")); - break; - case _RAISE: - matrix_write_P(&matrix, PSTR("Raise")); - break; - case _LOWER: - matrix_write_P(&matrix, PSTR("Lower")); - break; - case _ADJUST: - matrix_write_P(&matrix, PSTR("ADJUST")); - break; - default: - matrix_write(&matrix, buf); - } - - // Host Keyboard LED Status - char led[40]; - snprintf(led, sizeof(led), "\n%s %s %s", - (host_keyboard_leds() & (1< #include +#include "pincontrol.h" +#include "config.h" + +enum ssd1306_cmds { + DisplayOff = 0xAE, + DisplayOn = 0xAF, + + SetContrast = 0x81, + DisplayAllOnResume = 0xA4, + + DisplayAllOn = 0xA5, + NormalDisplay = 0xA6, + InvertDisplay = 0xA7, + SetDisplayOffset = 0xD3, + SetComPins = 0xda, + SetVComDetect = 0xdb, + SetDisplayClockDiv = 0xD5, + SetPreCharge = 0xd9, + SetMultiPlex = 0xa8, + SetLowColumn = 0x00, + SetHighColumn = 0x10, + SetStartLine = 0x40, + + SetMemoryMode = 0x20, + ColumnAddr = 0x21, + PageAddr = 0x22, + + ComScanInc = 0xc0, + ComScanDec = 0xc8, + SegRemap = 0xa0, + SetChargePump = 0x8d, + ExternalVcc = 0x01, + SwitchCapVcc = 0x02, + + ActivateScroll = 0x2f, + DeActivateScroll = 0x2e, + SetVerticalScrollArea = 0xa3, + RightHorizontalScroll = 0x26, + LeftHorizontalScroll = 0x27, + VerticalAndRightHorizontalScroll = 0x29, + VerticalAndLeftHorizontalScroll = 0x2a, +}; + +// Controls the SSD1306 128x32 OLED display via i2c + +#ifndef SSD1306_ADDRESS +#define SSD1306_ADDRESS 0x3C +#endif + +#define DisplayHeight 32 +#define DisplayWidth 128 + +#define FontHeight 8 +#define FontWidth 6 + +#define MatrixRows (DisplayHeight / FontHeight) +#define MatrixCols (DisplayWidth / FontWidth) + +struct CharacterMatrix { + uint8_t display[MatrixRows][MatrixCols]; + uint8_t *cursor; + bool dirty; +}; + +struct CharacterMatrix display; bool iota_gfx_init(void); void iota_gfx_task(void); @@ -14,4 +79,16 @@ void iota_gfx_write(const char *data); void iota_gfx_write_P(const char *data); void iota_gfx_clear_screen(void); +__attribute__((weak)) +void iota_gfx_task_user(void); + +void matrix_clear(struct CharacterMatrix *matrix); +void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c); +void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c); +void matrix_write(struct CharacterMatrix *matrix, const char *data); +void matrix_write_P(struct CharacterMatrix *matrix, const char *data); +void matrix_render(struct CharacterMatrix *matrix); + + + #endif diff --git a/keyboards/lets_split/keymaps/OLED_sample/keymap.c b/keyboards/lets_split/keymaps/OLED_sample/keymap.c index 5dbab5332..ad32269c8 100644 --- a/keyboards/lets_split/keymaps/OLED_sample/keymap.c +++ b/keyboards/lets_split/keymaps/OLED_sample/keymap.c @@ -357,3 +357,81 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) return MACRO_NONE; } + +void matrix_update(struct CharacterMatrix *dest, + const struct CharacterMatrix *source) { + if (memcmp(dest->display, source->display, sizeof(dest->display))) { + memcpy(dest->display, source->display, sizeof(dest->display)); + dest->dirty = true; + } +} + +void iota_gfx_task_user(void) { +#if DEBUG_TO_SCREEN + if (debug_enable) { + return; + } +#endif + + struct CharacterMatrix matrix; + + matrix_clear(&matrix); + matrix_write_P(&matrix, PSTR("USB: ")); +#ifdef PROTOCOL_LUFA + switch (USB_DeviceState) { + case DEVICE_STATE_Unattached: + matrix_write_P(&matrix, PSTR("Unattached")); + break; + case DEVICE_STATE_Suspended: + matrix_write_P(&matrix, PSTR("Suspended")); + break; + case DEVICE_STATE_Configured: + matrix_write_P(&matrix, PSTR("Connected")); + break; + case DEVICE_STATE_Powered: + matrix_write_P(&matrix, PSTR("Powered")); + break; + case DEVICE_STATE_Default: + matrix_write_P(&matrix, PSTR("Default")); + break; + case DEVICE_STATE_Addressed: + matrix_write_P(&matrix, PSTR("Addressed")); + break; + default: + matrix_write_P(&matrix, PSTR("Invalid")); + } +#endif + +// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below + + char buf[40]; + snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); + matrix_write_P(&matrix, PSTR("\n\nLayer: ")); + switch (layer_state) { + case _QWERTY: + case _COLEMAK: + case _DVORAK: + matrix_write_P(&matrix, PSTR("Default")); + break; + case _RAISE: + matrix_write_P(&matrix, PSTR("Raise")); + break; + case _LOWER: + matrix_write_P(&matrix, PSTR("Lower")); + break; + case _ADJUST: + matrix_write_P(&matrix, PSTR("ADJUST")); + break; + default: + matrix_write(&matrix, buf); + } + + // Host Keyboard LED Status + char led[40]; + snprintf(led, sizeof(led), "\n%s %s %s", + (host_keyboard_leds() & (1<display, source->display, sizeof(dest->display))) { + memcpy(dest->display, source->display, sizeof(dest->display)); + dest->dirty = true; + } +} + +//assign the right code to your layers for OLED display +#define L_BASE 0 +#define L_LOWER 8 +#define L_RAISE 16 +#define L_FNLAYER 64 +#define L_NUMLAY 128 +#define L_NLOWER 136 +#define L_NFNLAYER 192 +#define L_MOUSECURSOR 256 +#define L_ADJUST 65560 + +void iota_gfx_task_user(void) { +#if DEBUG_TO_SCREEN + if (debug_enable) { + return; + } +#endif + + struct CharacterMatrix matrix; + + matrix_clear(&matrix); + matrix_write_P(&matrix, PSTR("USB: ")); +#ifdef PROTOCOL_LUFA + switch (USB_DeviceState) { + case DEVICE_STATE_Unattached: + matrix_write_P(&matrix, PSTR("Unattached")); + break; + case DEVICE_STATE_Suspended: + matrix_write_P(&matrix, PSTR("Suspended")); + break; + case DEVICE_STATE_Configured: + matrix_write_P(&matrix, PSTR("Connected")); + break; + case DEVICE_STATE_Powered: + matrix_write_P(&matrix, PSTR("Powered")); + break; + case DEVICE_STATE_Default: + matrix_write_P(&matrix, PSTR("Default")); + break; + case DEVICE_STATE_Addressed: + matrix_write_P(&matrix, PSTR("Addressed")); + break; + default: + matrix_write_P(&matrix, PSTR("Invalid")); + } +#endif + +// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below + + char buf[40]; + snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); + matrix_write_P(&matrix, PSTR("\n\nLayer: ")); + switch (layer_state) { + case L_BASE: + matrix_write_P(&matrix, PSTR("Default")); + break; + case L_RAISE: + matrix_write_P(&matrix, PSTR("Raise")); + break; + case L_LOWER: + matrix_write_P(&matrix, PSTR("Lower")); + break; + case L_ADJUST: + matrix_write_P(&matrix, PSTR("ADJUST")); + break; + default: + matrix_write(&matrix, buf); + } + + // Host Keyboard LED Status + char led[40]; + snprintf(led, sizeof(led), "\n%s %s %s", + (host_keyboard_leds() & (1<display, source->display, sizeof(dest->display))) { + memcpy(dest->display, source->display, sizeof(dest->display)); + dest->dirty = true; + } +} + +//assign the right code to your layers for OLED display +#define L_BASE 0 +#define L_LOWER 8 +#define L_RAISE 16 +#define L_FNLAYER 64 +#define L_NUMLAY 128 +#define L_NLOWER 136 +#define L_NFNLAYER 192 +#define L_MOUSECURSOR 256 +#define L_ADJUST 65560 + +void iota_gfx_task_user(void) { +#if DEBUG_TO_SCREEN + if (debug_enable) { + return; + } +#endif + + struct CharacterMatrix matrix; + + matrix_clear(&matrix); + matrix_write_P(&matrix, PSTR("USB: ")); +#ifdef PROTOCOL_LUFA + switch (USB_DeviceState) { + case DEVICE_STATE_Unattached: + matrix_write_P(&matrix, PSTR("Unattached")); + break; + case DEVICE_STATE_Suspended: + matrix_write_P(&matrix, PSTR("Suspended")); + break; + case DEVICE_STATE_Configured: + matrix_write_P(&matrix, PSTR("Connected")); + break; + case DEVICE_STATE_Powered: + matrix_write_P(&matrix, PSTR("Powered")); + break; + case DEVICE_STATE_Default: + matrix_write_P(&matrix, PSTR("Default")); + break; + case DEVICE_STATE_Addressed: + matrix_write_P(&matrix, PSTR("Addressed")); + break; + default: + matrix_write_P(&matrix, PSTR("Invalid")); + } +#endif + +// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below + + char buf[40]; + snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); + matrix_write_P(&matrix, PSTR("\n\nLayer: ")); + switch (layer_state) { + case L_BASE: + matrix_write_P(&matrix, PSTR("Default")); + break; + case L_RAISE: + matrix_write_P(&matrix, PSTR("Raise")); + break; + case L_LOWER: + matrix_write_P(&matrix, PSTR("Lower")); + break; + case L_ADJUST: + matrix_write_P(&matrix, PSTR("ADJUST")); + break; + default: + matrix_write(&matrix, buf); + } + + // Host Keyboard LED Status + char led[40]; + snprintf(led, sizeof(led), "\n%s %s %s", + (host_keyboard_leds() & (1<. #define FLIP_HALF #define SSD1306OLED +//#define OLED_ROTATE180 #define PREVENT_STUCK_MODIFIERS diff --git a/keyboards/lets_split/keymaps/OLED_sample/keymap.c b/keyboards/lets_split/keymaps/OLED_sample/keymap.c index ad32269c8..9553309f8 100644 --- a/keyboards/lets_split/keymaps/OLED_sample/keymap.c +++ b/keyboards/lets_split/keymaps/OLED_sample/keymap.c @@ -358,6 +358,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) return MACRO_NONE; } + void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) { if (memcmp(dest->display, source->display, sizeof(dest->display))) { @@ -366,6 +367,17 @@ void matrix_update(struct CharacterMatrix *dest, } } +//assign the right code to your layers for OLED display +#define L_BASE 0 +#define L_LOWER 8 +#define L_RAISE 16 +#define L_FNLAYER 64 +#define L_NUMLAY 128 +#define L_NLOWER 136 +#define L_NFNLAYER 192 +#define L_MOUSECURSOR 256 +#define L_ADJUST 65560 + void iota_gfx_task_user(void) { #if DEBUG_TO_SCREEN if (debug_enable) { @@ -408,18 +420,16 @@ void iota_gfx_task_user(void) { snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); matrix_write_P(&matrix, PSTR("\n\nLayer: ")); switch (layer_state) { - case _QWERTY: - case _COLEMAK: - case _DVORAK: + case L_BASE: matrix_write_P(&matrix, PSTR("Default")); break; - case _RAISE: + case L_RAISE: matrix_write_P(&matrix, PSTR("Raise")); break; - case _LOWER: + case L_LOWER: matrix_write_P(&matrix, PSTR("Lower")); break; - case _ADJUST: + case L_ADJUST: matrix_write_P(&matrix, PSTR("ADJUST")); break; default: -- cgit v1.2.3 From c7ea65c6d3c0fe50e7c77831c68b435d440be73d Mon Sep 17 00:00:00 2001 From: Fabian Topfstedt Date: Wed, 26 Jul 2017 11:09:29 +0200 Subject: default based customizations --- keyboards/lets_split/keymaps/fabian/keymap.c | 159 ++++++++++++++------------- 1 file changed, 80 insertions(+), 79 deletions(-) (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/keymaps/fabian/keymap.c b/keyboards/lets_split/keymaps/fabian/keymap.c index b3e19aaea..c15c9724e 100644 --- a/keyboards/lets_split/keymaps/fabian/keymap.c +++ b/keyboards/lets_split/keymaps/fabian/keymap.c @@ -28,123 +28,124 @@ enum custom_keycodes { #define _______ KC_TRNS #define XXXXXXX KC_NO -// Custom macros -#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl -#define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift -#define SFT_BSP SFT_T(KC_BSPC) // Tap for Backspace, hold for Shift -#define HPR_TAB ALL_T(KC_TAB) // Tap for Tab, hold for Hyper (Super+Ctrl+Alt+Shift) -#define MEH_GRV MEH_T(KC_GRV) // Tap for Backtick, hold for Meh (Ctrl+Alt+Shift) +// Custom +#define CTL_ESC CTL_T(KC_ESC) // Tap for Escape, hold for Control +#define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift +#define SFT_BSP SFT_T(KC_BSPC) // Tap for Backspace, hold for Shift +#define HPR_TAB ALL_T(KC_TAB) // Tap for Tab, hold for Hyper (Super+Ctrl+Alt+Shift) +// #define MEH_GRV MEH_T(KC_GRV) // Tap for Backtick, hold for Meh (Ctrl+Alt+Shift) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Qwerty - * ,-----------------------------------------. ,-----------------------------------------. - * | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | Esc | A | S | D | F | G | | H | J | K | L | ; | " | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | GUI | Ctrl | Alt | GUI |Lower |Space | | Bksp |Raise | GUI |AltGr | Ctrl | GUI | - * `-----------------------------------------' `-----------------------------------------' + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space | Bksp |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' */ [_QWERTY] = KEYMAP( \ HPR_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, \ - KC_LGUI, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_RGUI, KC_RALT, KC_RCTL, KC_RGUI + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ ), /* Colemak - * ,-----------------------------------------. ,-----------------------------------------. - * | Tab | Q | W | F | P | G | | J | L | U | Y | ; | Bksp | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | Esc | A | R | S | T | D | | H | N | E | I | O | " | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | | K | M | , | . | / |Enter | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | GUI | Ctrl | Alt | GUI |Lower |Space | | Bksp |Raise | GUI |AltGr | Ctrl | GUI | - * `-----------------------------------------' `-----------------------------------------' + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space | Bksp |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' */ [_COLEMAK] = KEYMAP( \ HPR_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ CTL_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, \ - KC_LGUI, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_RGUI, KC_RALT, KC_RCTL, KC_RGUI + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ ), /* Dvorak - * ,-----------------------------------------. ,-----------------------------------------. - * | Tab | " | , | . | P | Y | | F | G | C | R | L | Bksp | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | Esc | A | O | E | U | I | | D | H | T | N | S | - | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | Shift| ; | Q | J | K | X | | B | M | W | V | Z |Enter | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | GUI | Ctrl | Alt | GUI |Lower |Space | | Bksp |Raise | GUI |AltGr | Ctrl | GUI | - * `-----------------------------------------' `-----------------------------------------' + * ,-----------------------------------------------------------------------------------. + * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space | Bksp |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' */ [_DVORAK] = KEYMAP( \ HPR_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ - CTL_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, \ - KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_ENT, \ - KC_LGUI, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_RGUI, KC_RALT, KC_RCTL, KC_RGUI + CTL_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_ENT , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ ), /* Lower - * ,-----------------------------------------. ,-----------------------------------------. - * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | Bksp | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | Del | F1 | F2 | F3 | F4 | F5 | | F6 | _ | + | { | } | | | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | | F12 | Left | Down | Up |Right | | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | | | | | | | | | Home |PageDn|PageUp| End | - * `-----------------------------------------' `-----------------------------------------' + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 | MS L | MS D |MS U | MS R |MS Btn| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' */ [_LOWER] = KEYMAP( \ - ALL_T(KC_TILD), KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ - KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_BTN1, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ ), /* Raise - * ,-----------------------------------------. ,-----------------------------------------. - * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | Del | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | | F12 | Left | Down | Up | Right| | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | | | | | | | | | Next | Vol- | Vol+ | Play | - * `-----------------------------------------' `-----------------------------------------' + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 | Left | Down | Up | Rght |MS_BN2| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' */ [_RAISE] = KEYMAP( \ - ALL_T(KC_GRV), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, \ - KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_BTN2, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ ), /* Adjust (Lower + Raise) - * ,-----------------------------------------. ,-----------------------------------------. - * | | Reset| | | | | | | | | | | Reset| - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | | |Aud on|Audoff|AGnorm| |AGswap|Qwerty|Colemk|Dvorak| | | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | | | | | | | | | | | | | - * |------+------+------+------+------+------| |------+------+------+------+------+------| - * | | | | | | | | | | | | | | - * `-----------------------------------------' `-----------------------------------------' + * ,-----------------------------------------------------------------------------------. + * | |Reset | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Reset | Del | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' */ -[_ADJUST] = KEYMAP( \ - _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET, \ - _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ +[_ADJUST] = KEYMAP( \ + _______, RESET, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, RESET, KC_DEL, \ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ ) + }; #ifdef AUDIO_ENABLE -- cgit v1.2.3 From 75677655ad1546e5c75cdeafc136d59b99f26480 Mon Sep 17 00:00:00 2001 From: Fabian Topfstedt Date: Wed, 26 Jul 2017 11:11:13 +0200 Subject: left shift is backspace on tap --- keyboards/lets_split/keymaps/fabian/keymap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/keymaps/fabian/keymap.c b/keyboards/lets_split/keymaps/fabian/keymap.c index c15c9724e..b253dbfc1 100644 --- a/keyboards/lets_split/keymaps/fabian/keymap.c +++ b/keyboards/lets_split/keymaps/fabian/keymap.c @@ -51,7 +51,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_QWERTY] = KEYMAP( \ HPR_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT , \ + SFT_BSP, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT , \ ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ ), @@ -69,7 +69,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_COLEMAK] = KEYMAP( \ HPR_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ CTL_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT , \ + SFT_BSP, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT , \ ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ ), @@ -87,7 +87,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_DVORAK] = KEYMAP( \ HPR_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ CTL_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ - KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_ENT , \ + SFT_BSP, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_ENT , \ ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ ), -- cgit v1.2.3 From 3b05183deb37dd39a7dcc9d989da1e7ee61c19a5 Mon Sep 17 00:00:00 2001 From: Fabian Topfstedt Date: Wed, 26 Jul 2017 12:18:40 +0200 Subject: symmetric modifiers in bottom row --- keyboards/lets_split/keymaps/fabian/keymap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/keymaps/fabian/keymap.c b/keyboards/lets_split/keymaps/fabian/keymap.c index b253dbfc1..0af505b47 100644 --- a/keyboards/lets_split/keymaps/fabian/keymap.c +++ b/keyboards/lets_split/keymaps/fabian/keymap.c @@ -45,14 +45,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------|------+------+------+------+------+------| * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |Adjust| Ctrl | Alt | GUI |Lower |Space | Bksp |Raise | Left | Down | Up |Right | + * |Adjust| Ctrl | Alt | GUI |Lower |Space | Bksp |Raise | GUI |AltGr | Ctrl |Adjust| * `-----------------------------------------------------------------------------------' */ [_QWERTY] = KEYMAP( \ HPR_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ SFT_BSP, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT , \ - ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_RGUI, KC_RALT, KC_RCTL, ADJUST \ ), /* Colemak @@ -63,14 +63,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------|------+------+------+------+------+------| * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |Adjust| Ctrl | Alt | GUI |Lower |Space | Bksp |Raise | Left | Down | Up |Right | + * |Adjust| Ctrl | Alt | GUI |Lower |Space | Bksp |Raise | GUI |AltGr | Ctrl |Adjust| * `-----------------------------------------------------------------------------------' */ [_COLEMAK] = KEYMAP( \ HPR_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ CTL_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ SFT_BSP, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT , \ - ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_RGUI, KC_RALT, KC_RCTL, ADJUST \ ), /* Dvorak @@ -81,14 +81,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+------|------+------+------+------+------+------| * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | * |------+------+------+------+------+------+------+------+------+------+------+------| - * |Adjust| Ctrl | Alt | GUI |Lower |Space | Bksp |Raise | Left | Down | Up |Right | + * |Adjust| Ctrl | Alt | GUI |Lower |Space | Bksp |Raise | GUI |AltGr | Ctrl |Adjust| * `-----------------------------------------------------------------------------------' */ [_DVORAK] = KEYMAP( \ HPR_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ CTL_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ SFT_BSP, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_ENT , \ - ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, SFT_BSP, RAISE, KC_RGUI, KC_RALT, KC_RCTL, ADJUST \ ), /* Lower -- cgit v1.2.3 From de9331c50cb8ec769f7f4fb2eb7a73a435fc4db2 Mon Sep 17 00:00:00 2001 From: Fabian Topfstedt Date: Wed, 26 Jul 2017 12:19:13 +0200 Subject: custom makefile --- keyboards/lets_split/keymaps/fabian/Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 keyboards/lets_split/keymaps/fabian/Makefile (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/keymaps/fabian/Makefile b/keyboards/lets_split/keymaps/fabian/Makefile new file mode 100644 index 000000000..b8c82cb99 --- /dev/null +++ b/keyboards/lets_split/keymaps/fabian/Makefile @@ -0,0 +1,9 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +# UNICODE_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif -- cgit v1.2.3 From 07cb997b6d3de54573ccfdedcb8ca2e9fd89c9fd Mon Sep 17 00:00:00 2001 From: ahtn Date: Tue, 25 Jul 2017 13:25:48 +1000 Subject: Changes lets_split to use timer based debouncing The let's split code used delays in its debouncing algorithm which increases input latency. This commit copies and adapts the code from `quantum/matrix.c` to lets_split's `matrix.c`. --- keyboards/lets_split/matrix.c | 242 ++++++++++++++++++++++++++++++-------- keyboards/lets_split/split_util.c | 2 + 2 files changed, 197 insertions(+), 47 deletions(-) (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/matrix.c b/keyboards/lets_split/matrix.c index 81dfb1445..4def27239 100644 --- a/keyboards/lets_split/matrix.c +++ b/keyboards/lets_split/matrix.c @@ -21,9 +21,7 @@ along with this program. If not, see . #include #include #include -#include -#include -#include +#include "wait.h" #include "print.h" #include "debug.h" #include "util.h" @@ -31,6 +29,7 @@ along with this program. If not, see . #include "split_util.h" #include "pro_micro.h" #include "config.h" +#include "timer.h" #ifdef USE_I2C # include "i2c.h" @@ -38,14 +37,29 @@ along with this program. If not, see . # include "serial.h" #endif -#ifndef DEBOUNCE -# define DEBOUNCE 5 +#ifndef DEBOUNCING_DELAY +# define DEBOUNCING_DELAY 5 #endif +#if (DEBOUNCING_DELAY > 0) + static uint16_t debouncing_time; + static bool debouncing = false; +#endif + +#if (MATRIX_COLS <= 8) +# define print_matrix_header() print("\nr/c 01234567\n") +# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop(matrix[i]) +# define ROW_SHIFTER ((uint8_t)1) +#else +# error "Currently only supports 8 COLS" +#endif +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + #define ERROR_DISCONNECT_COUNT 5 -static uint8_t debouncing = DEBOUNCE; -static const int ROWS_PER_HAND = MATRIX_ROWS/2; +#define ROWS_PER_HAND (MATRIX_ROWS/2) + static uint8_t error_count = 0; static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; @@ -55,11 +69,19 @@ static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; static matrix_row_t matrix[MATRIX_ROWS]; static matrix_row_t matrix_debouncing[MATRIX_ROWS]; -static matrix_row_t read_cols(void); -static void init_cols(void); -static void unselect_rows(void); -static void select_row(uint8_t row); - +#if (DIODE_DIRECTION == COL2ROW) + static void init_cols(void); + static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row); + static void unselect_rows(void); + static void select_row(uint8_t row); + static void unselect_row(uint8_t row); +#elif (DIODE_DIRECTION == ROW2COL) + static void init_rows(void); + static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col); + static void unselect_cols(void); + static void unselect_col(uint8_t col); + static void select_col(uint8_t col); +#endif __attribute__ ((weak)) void matrix_init_quantum(void) { matrix_init_kb(); @@ -118,33 +140,54 @@ void matrix_init(void) } matrix_init_quantum(); + } uint8_t _matrix_scan(void) { - // Right hand is stored after the left in the matirx so, we need to offset it int offset = isLeftHand ? 0 : (ROWS_PER_HAND); +#if (DIODE_DIRECTION == COL2ROW) + // Set row, read cols + for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) { +# if (DEBOUNCING_DELAY > 0) + bool matrix_changed = read_cols_on_row(matrix_debouncing+offset, current_row); + + if (matrix_changed) { + debouncing = true; + debouncing_time = timer_read(); + PORTD ^= (1 << 2); + } + +# else + read_cols_on_row(matrix+offset, current_row); +# endif + + } + +#elif (DIODE_DIRECTION == ROW2COL) + // Set col, read rows + for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { +# if (DEBOUNCING_DELAY > 0) + bool matrix_changed = read_rows_on_col(matrix_debouncing+offset, current_col); + if (matrix_changed) { + debouncing = true; + debouncing_time = timer_read(); + } +# else + read_rows_on_col(matrix+offset, current_col); +# endif - for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { - select_row(i); - _delay_us(30); // without this wait read unstable value. - matrix_row_t cols = read_cols(); - if (matrix_debouncing[i+offset] != cols) { - matrix_debouncing[i+offset] = cols; - debouncing = DEBOUNCE; - } - unselect_rows(); } +#endif - if (debouncing) { - if (--debouncing) { - _delay_ms(1); - } else { +# if (DEBOUNCING_DELAY > 0) + if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) { for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { matrix[i+offset] = matrix_debouncing[i+offset]; } + debouncing = false; } - } +# endif return 1; } @@ -200,9 +243,7 @@ int serial_transaction(void) { uint8_t matrix_scan(void) { - int ret = _matrix_scan(); - - + uint8_t ret = _matrix_scan(); #ifdef USE_I2C if( i2c_transaction() ) { @@ -233,11 +274,10 @@ uint8_t matrix_scan(void) void matrix_slave_scan(void) { _matrix_scan(); - int offset = (isLeftHand) ? 0 : (MATRIX_ROWS / 2); + int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; #ifdef USE_I2C for (int i = 0; i < ROWS_PER_HAND; ++i) { - /* i2c_slave_buffer[i] = matrix[offset+i]; */ i2c_slave_buffer[i] = matrix[offset+i]; } #else // USE_SERIAL @@ -284,33 +324,141 @@ uint8_t matrix_key_count(void) return count; } -static void init_cols(void) +#if (DIODE_DIRECTION == COL2ROW) + +static void init_cols(void) { - for(int x = 0; x < MATRIX_COLS; x++) { - _SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF); - _SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF); + for(uint8_t x = 0; x < MATRIX_COLS; x++) { + uint8_t pin = col_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI } } -static matrix_row_t read_cols(void) +static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { - matrix_row_t result = 0; - for(int x = 0; x < MATRIX_COLS; x++) { - result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x); + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[current_row]; + + // Clear data in matrix row + current_matrix[current_row] = 0; + + // Select row and wait for row selecton to stabilize + select_row(current_row); + wait_us(30); + + // For each col... + for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { + + // Select the col pin to read (active low) + uint8_t pin = col_pins[col_index]; + uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF)); + + // Populate the matrix row with the state of the col pin + current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); } - return result; + + // Unselect row + unselect_row(current_row); + + return (last_row_value != current_matrix[current_row]); +} + +static void select_row(uint8_t row) +{ + uint8_t pin = row_pins[row]; + _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT + _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW +} + +static void unselect_row(uint8_t row) +{ + uint8_t pin = row_pins[row]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI } static void unselect_rows(void) { - for(int x = 0; x < ROWS_PER_HAND; x++) { - _SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF); - _SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF); + for(uint8_t x = 0; x < ROWS_PER_HAND; x++) { + uint8_t pin = row_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI } } -static void select_row(uint8_t row) +#elif (DIODE_DIRECTION == ROW2COL) + +static void init_rows(void) +{ + for(uint8_t x = 0; x < ROWS_PER_HAND; x++) { + uint8_t pin = row_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } +} + +static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) +{ + bool matrix_changed = false; + + // Select col and wait for col selecton to stabilize + select_col(current_col); + wait_us(30); + + // For each row... + for(uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) + { + + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[row_index]; + + // Check row pin state + if ((_SFR_IO8(row_pins[row_index] >> 4) & _BV(row_pins[row_index] & 0xF)) == 0) + { + // Pin LO, set col bit + current_matrix[row_index] |= (ROW_SHIFTER << current_col); + } + else + { + // Pin HI, clear col bit + current_matrix[row_index] &= ~(ROW_SHIFTER << current_col); + } + + // Determine if the matrix changed state + if ((last_row_value != current_matrix[row_index]) && !(matrix_changed)) + { + matrix_changed = true; + } + } + + // Unselect col + unselect_col(current_col); + + return matrix_changed; +} + +static void select_col(uint8_t col) +{ + uint8_t pin = col_pins[col]; + _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT + _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW +} + +static void unselect_col(uint8_t col) +{ + uint8_t pin = col_pins[col]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI +} + +static void unselect_cols(void) { - _SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF); - _SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF); + for(uint8_t x = 0; x < MATRIX_COLS; x++) { + uint8_t pin = col_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } } + +#endif diff --git a/keyboards/lets_split/split_util.c b/keyboards/lets_split/split_util.c index 39639c3b4..346cbc908 100644 --- a/keyboards/lets_split/split_util.c +++ b/keyboards/lets_split/split_util.c @@ -8,6 +8,7 @@ #include "matrix.h" #include "keyboard.h" #include "config.h" +#include "timer.h" #ifdef USE_I2C # include "i2c.h" @@ -42,6 +43,7 @@ static void keyboard_master_setup(void) { } static void keyboard_slave_setup(void) { + timer_init(); #ifdef USE_I2C i2c_slave_init(SLAVE_I2C_ADDRESS); #else -- cgit v1.2.3 From 23549791ebe632d1f6dded86c4c61d36f8db878a Mon Sep 17 00:00:00 2001 From: xk Date: Mon, 31 Jul 2017 13:11:28 -0600 Subject: Add keymap xk --- keyboards/lets_split/keymaps/xk/Makefile | 19 ++ keyboards/lets_split/keymaps/xk/config.h | 47 ++++ keyboards/lets_split/keymaps/xk/keymap.c | 353 +++++++++++++++++++++++++++++++ 3 files changed, 419 insertions(+) create mode 100644 keyboards/lets_split/keymaps/xk/Makefile create mode 100644 keyboards/lets_split/keymaps/xk/config.h create mode 100755 keyboards/lets_split/keymaps/xk/keymap.c (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/keymaps/xk/Makefile b/keyboards/lets_split/keymaps/xk/Makefile new file mode 100644 index 000000000..46eb7989d --- /dev/null +++ b/keyboards/lets_split/keymaps/xk/Makefile @@ -0,0 +1,19 @@ +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +USE_I2C = yes +TAP_DANCE_ENABLE = yes + +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/lets_split/keymaps/xk/config.h b/keyboards/lets_split/keymaps/xk/config.h new file mode 100644 index 000000000..d37985043 --- /dev/null +++ b/keyboards/lets_split/keymaps/xk/config.h @@ -0,0 +1,47 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +Copyright 2015 Jack Humbert + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. +*/ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#define TAPPING_TOGGLE 1 +#define TAPPING_TERM 200 +#define ONESHOT_TAP_TOGGLE 2 +#define ONESHOT_LAYER_TOGGLE 2 +#define ONESHOT_TIMEOUT 300 + +/* Use I2C or Serial, not both */ + +// #define USE_SERIAL +#define USE_I2C + +#define MOUSEKEY_INTERVAL 50 +#define MOUSEKEY_DELAY 0 +#define MOUSEKEY_TIME_TO_MAX 60 +#define MOUSEKEY_MAX_SPEED 7 + +#define MOUSEKEY_WHEEL_DELAY 0 +#define MOUSEKEY_WHEEL_MAX_SPEED 8 +#define MOUSEKEY_WHEEL_TIME_TO_MAX 40 + +// #define MASTER_LEFT +// #define _MASTER_RIGHT +#define EE_HANDS + + +#define PREVENT_STUCK_MODIFIERS +//#define IGNORE_MOD_TAP_INTERRUPT +#define PERMISSIVE_HOLD + +#endif \ No newline at end of file diff --git a/keyboards/lets_split/keymaps/xk/keymap.c b/keyboards/lets_split/keymaps/xk/keymap.c new file mode 100755 index 000000000..4d89a67f7 --- /dev/null +++ b/keyboards/lets_split/keymaps/xk/keymap.c @@ -0,0 +1,353 @@ +#include "lets_split.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + +#define _COLEMAK 0 +#define _KAMELOC 1 +#define _IKAPILA 2 +#define _IKASHFT 3 +#define _ARROWKY 4 +#define _FNCTION 5 +#define _NINEKEY 6 +#define _NAVIGAT 7 +#define _QWERTY 8 +#define _GRVTABL 15 + +enum custom_keycodes { + COLEMAK = SAFE_RANGE, + KAMELOC, + IKAPILA, + IKASHFT, + ARROWKY, + FNCTION, + NINEKEY, + NAVIGAT, + QWERTY, + GRVTABL, +}; + +//TD Declarations +enum { + VOM = 0, + PRN, + EGT, + HRD, + DSH, + QUT, + ESC, + EQE, + PGN, + UND, + BSDEL, + bsdel_mods, + BOOTME, +}; + +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +// action-TAP for key/mod behavior LT(layer, kc) +#define XK_TAB LT(_FNCTION, KC_TAB) +#define XK_BSP LT(_KAMELOC, M(3)) + +#define XK_HARD LT(_FNCTION, M(1)) +#define XK_SPC LT(_IKAPILA, KC_SPC) +#define XK_ENT LT(_IKAPILA, KC_ENT) +#define XK_PGDN LT(_NAVIGAT, TD(PGN)) +#define XK_PREN LT(_IKASHFT, M(0)) +#define PIPBOY LT(_FNCTION, KC_BSLS) + +#define XK_DEL LT(_KAMELOC, KC_DEL) +#define XK_GRV LT(_GRVTABL, KC_GRV) + +// mod-TAP for mod/key behavior MT(modkey, kc) +#define ESC_IT MT(MOD_MEH, TD(ESC)) + +#define ALT_IT MT(MOD_LALT, KC_SCLN) +#define CTL_IT MT(MOD_LCTL, KC_SLSH) +#define XK_EGPT MT((MOD_LCTL | MOD_LALT | MOD_LGUI), M(2)) + +#define SFT_IT MT(MOD_RSFT, TG(_NAVIGAT)) +#define SFT_ENT MT(MOD_RSFT, KC_ENT) + +//sticky modifiers +#define KYCTL OSM(MOD_LCTL) +#define KYGUI OSM(MOD_LGUI) +#define KYSFT OSM(MOD_LSFT) +#define KYALT OSM(MOD_LALT) +#define CAKY OSM(MOD_LCTL | MOD_LALT) + +//shortcuts +#define CADEL LALT(LCTL(KC_DEL)) +#define CAINS LALT(LCTL(KC_INS)) +#define TGNKRO MAGIC_TOGGLE_NKRO + +#define NAVCH LCTL(KC_HOME) +#define NAVCPD LCTL(KC_PGDN) +#define NAVCPU LCTL(KC_PGUP) +#define NAVCE LCTL(KC_END) +#define NAVCU LCTL(KC_UP) +#define NAVCD LCTL(KC_DOWN) +#define NAVCL LCTL(KC_LEFT) +#define NAVCR LCTL(KC_RGHT) +#define NAVGU LGUI(KC_UP) +#define NAVGD LGUI(KC_DOWN) +#define NAVGL LGUI(KC_LEFT) +#define NAVGR LGUI(KC_RGHT) + +#define KC_NDSH LCTL(KC_PMNS) +#define KC_MDSH LALT(LCTL(KC_PMNS)) + +//!not sure if this old TMK code will work +//#define BOOTME ACTION_FUNCTION(BOOTLOADER) +#define LCLEAR ACTION_LAYER_SET_CLEAR(0) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* + TAP + ┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐ + │TAB │ Q │ W │ F │ P │ B │ │ J │ L │ U │ Y │ ; │DEL │ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │BKSP│ A │ R │ S │ T │ G │ │ M │ N │ E │ I │ O │ ' │ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │OSFT│ X │ C │ D │ V │ Z │ │ K │ H │ , │ . │ / │LNAV│ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │OCTL│OALT│L9KY│ [] │OGUI│SPC │ │ENT │PGDN│ () │ {} │ \ │ ` │ + └────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘ + HOLD + ┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐ + │L FN│ │ │ │ │ │ │ │ │ │ │ALT │L!@#│ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │L OH│ │ │ │ │ │ │ │ │ │ │ │L OH│ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │SFT │ │ │ │ │ │ │ │ │ │ │CTL │SFT │ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │CTL │ALT │L9KY│L!@#│GUI │L123│ │L123│LNAV│L!@#│MEH │L FN│LGRV│ + └────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘ + DOUBLETAP + ┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐ + │ │!F4 │ │ │ │ │ │ │ │ │ │ │ │ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │OSML│ │ │ │ │UNDO│ │ │ │ │ │ │ │ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │OSML│OSML│ESC │ │OSML│ │ │ │PGUP│ │ │ │ │ + └────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘ + Switch type + ┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐ + │Br │Z │Z │Z │Z │Z │ │Z │Z │Z │Z │Br │G │ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │G │Z │Z │Z │Z │Z │ │Z │Z │Z │Z │Z │Z │ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │Y │Z │Z │Z │Z │Z │ │Z │Z │Z │Z │B │Y │ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │Y │Y │C │Z │BLK │BLK │ │BLK │BLK │Z │Z │B │G │ + └────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘ +*/ + +// Colemak PB&J (Mod-DH) +[_COLEMAK] = KEYMAP( \ + XK_TAB, TD(QUT), KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, ALT_IT, XK_GRV, \ + XK_BSP, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, XK_DEL, \ + KYSFT, KC_X, KC_C, KC_D, KC_V, TD(UND), KC_K, KC_H, KC_COMM, KC_DOT, CTL_IT, SFT_IT, \ + KYCTL, KYALT, ESC_IT, XK_HARD, KYGUI, XK_SPC, XK_ENT, XK_PGDN, XK_PREN, XK_EGPT, PIPBOY, XK_GRV \ +), + +// useful for one-handed typing +[_KAMELOC] = KEYMAP( \ + _______, KC_SCLN, KC_Y, KC_U, KC_L, KC_J, KC_B, KC_P, KC_F, KC_W, TD(QUT), _______, \ + _______, KC_O, KC_I, KC_E, KC_N, KC_M, KC_G, KC_T, KC_S, KC_R, KC_A, _______, \ + _______, KC_SLSH, KC_DOT, KC_COMM, KC_H, KC_K, TD(UND), KC_V, KC_D, KC_C, KC_X, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ +), + +/* + ┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐ + │ ~ │ 1 │ 2 │ 3 │ 4 │ 5 │ │ 6 │ 7 │ 8 │ 9 │ 0 │ │ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │ │DASH│MV- │ V+ │NEXT│PLAY│ │ ← │ ↓ │ ↑ │ → │INS │ │ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │ │ - │ = │ [ │ ] │ \ │ │HOME│PGDN│PGUP│END │ \ │ │ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ + └────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘ +*/ +[_IKAPILA] = KEYMAP( \ + KC_TILD, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, \ + _______, TD(DSH), TD(VOM), KC_VOLU, KC_MNXT, KC_MPLY, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_INS, _______, \ + _______, KC_MINS, KC_EQL, TD(HRD), KC_RBRC, KC_BSLS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_BSLS, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ +), + +/* + ┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐ + │ │ ! │ @ │ # │ $ │ % │ │ ^ │ & │ * │ ( │ ) │ │ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │ │DASH│MV- │ V+ │NEXT│PLAY│ │HOME│PGDN│PGUP│END │PSCR│ │ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │ │ _ │ + │ { │ } │ | │ │ ← │ ↓ │ ↑ │ → │ │ │ + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ + └────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┘ +*/ + +[_IKASHFT] = KEYMAP( \ + _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, \ + KC_DEL, TD(DSH), TD(VOM), KC_VOLU, KC_MNXT, KC_MPLY, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_PSCR, _______, \ + _______, KC_UNDS, KC_PLUS, TD(EGT), KC_RCBR, KC_PIPE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_PAUS, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ +), + +/* + ┌────┬────┬────┬────┬────┬────┐ ┌────┬────┬────┬────┬────┬────┐ + │ │ → │ ↑ │ ← │ ↓ │ → │ │ → │ ↓ │ ← │ ↑ │ ↑ │ │ just in case someone hacks my IP with a 10MeG pipe, you know? + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ + │ │ ← │ ↓ │ → │ ↑ │ ← │ │ ↑ │ ← │ ↓ │ → │ ← │ │ hacker_evasion layer + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ >>init network SEQUENCE + │ │ ↑ │ ← │ ↓ │ → │ ↑ │ │ ↓ │ ← │ ↑ │ → │ ← │ │ sleep 11; echo "DONE\n" + ├────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┤ throttle INPUT 11001001 OUTPUT 010011001 ? FULL )); \ + │ │ │ │ → │ ← │ ↓ │ │ → │ ↑ │ ← │ ↓ │ ↑ │ │ <event.pressed) { + switch(id) { + case 0: + return MACRO(D(LSHIFT),T(9), T(0),U(LSHIFT), T(LEFT), END); + case 1: + return MACRO(T(LBRC), T(RBRC), T(LEFT), END); + case 2: + return MACRO(D(LSHIFT),T(LBRC), T(RBRC),U(LSHIFT), T(ENT), T(UP), END); + case 3: + return MACRO(T(BSPC), END); +/* static bool bsdel_mods = false; + case BSDEL: { + uint8_t kc = KC_BSPC; + if (record->event.pressed) { + if (keyboard_report->mods) { + kc = KC_DEL; + } + register_code (kc); + bsdel_mods = keyboard_report->mods; + } + else { + if (bsdel_mods) { + kc = KC_DEL; + } + + unregister_code (kc); + } + } +*/ case 4: + if (!record->event.pressed) { +// bootloader(); + } + } + } + return MACRO_NONE; +}; -- cgit v1.2.3 From e0caf94323d5cc0baae38af11984902fb1a5375f Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Thu, 3 Aug 2017 14:23:12 -0400 Subject: Move avrdude flashing script from individual keyboard rules.mk to common location and improve script. Port detection script is now more informative and better handles first time flashing of a Pro Micro --- keyboards/deltasplit75/rules.mk | 12 ------------ keyboards/handwired/atreus50/rules.mk | 12 ------------ keyboards/handwired/magicforce61/rules.mk | 12 ------------ keyboards/handwired/magicforce68/rules.mk | 12 ------------ keyboards/handwired/numpad20/rules.mk | 12 ------------ keyboards/handwired/ortho5x13/rules.mk | 12 ------------ keyboards/lets_split/rules.mk | 12 ------------ keyboards/nyquist/rules.mk | 12 ------------ keyboards/orthodox/rules.mk | 12 ------------ tmk_core/avr.mk | 14 ++++++++++++++ 10 files changed, 14 insertions(+), 108 deletions(-) (limited to 'keyboards/lets_split') diff --git a/keyboards/deltasplit75/rules.mk b/keyboards/deltasplit75/rules.mk index 0efa78550..1aee5313c 100644 --- a/keyboards/deltasplit75/rules.mk +++ b/keyboards/deltasplit75/rules.mk @@ -73,15 +73,3 @@ USE_I2C ?= yes SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend CUSTOM_MATRIX = yes - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [[ -z $$USB ]]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/keyboards/handwired/atreus50/rules.mk b/keyboards/handwired/atreus50/rules.mk index 5e808dfa7..2e2d48f6a 100644 --- a/keyboards/handwired/atreus50/rules.mk +++ b/keyboards/handwired/atreus50/rules.mk @@ -67,15 +67,3 @@ RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [[ -z $$USB ]]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/keyboards/handwired/magicforce61/rules.mk b/keyboards/handwired/magicforce61/rules.mk index 913bcb93e..a3fdd3d70 100644 --- a/keyboards/handwired/magicforce61/rules.mk +++ b/keyboards/handwired/magicforce61/rules.mk @@ -69,15 +69,3 @@ AUDIO_ENABLE ?= no # Audio output on port C6 ifndef QUANTUM_DIR include ../../../Makefile endif - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [[ -z $$USB ]]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/keyboards/handwired/magicforce68/rules.mk b/keyboards/handwired/magicforce68/rules.mk index 0e07bde40..0d21623ce 100644 --- a/keyboards/handwired/magicforce68/rules.mk +++ b/keyboards/handwired/magicforce68/rules.mk @@ -69,15 +69,3 @@ AUDIO_ENABLE = no # Audio output on port C6 ifndef QUANTUM_DIR include ../../../Makefile endif - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [[ -z $$USB ]]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/keyboards/handwired/numpad20/rules.mk b/keyboards/handwired/numpad20/rules.mk index 0e07bde40..0d21623ce 100644 --- a/keyboards/handwired/numpad20/rules.mk +++ b/keyboards/handwired/numpad20/rules.mk @@ -69,15 +69,3 @@ AUDIO_ENABLE = no # Audio output on port C6 ifndef QUANTUM_DIR include ../../../Makefile endif - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [[ -z $$USB ]]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/keyboards/handwired/ortho5x13/rules.mk b/keyboards/handwired/ortho5x13/rules.mk index 0e07bde40..0d21623ce 100644 --- a/keyboards/handwired/ortho5x13/rules.mk +++ b/keyboards/handwired/ortho5x13/rules.mk @@ -69,15 +69,3 @@ AUDIO_ENABLE = no # Audio output on port C6 ifndef QUANTUM_DIR include ../../../Makefile endif - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [[ -z $$USB ]]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/keyboards/lets_split/rules.mk b/keyboards/lets_split/rules.mk index cc87ee31c..c2b7d556e 100644 --- a/keyboards/lets_split/rules.mk +++ b/keyboards/lets_split/rules.mk @@ -74,15 +74,3 @@ USE_I2C = yes SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend CUSTOM_MATRIX = yes - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [ -z $$USB ]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/keyboards/nyquist/rules.mk b/keyboards/nyquist/rules.mk index dfcff1d90..3f40ff2f8 100644 --- a/keyboards/nyquist/rules.mk +++ b/keyboards/nyquist/rules.mk @@ -73,15 +73,3 @@ USE_I2C = yes SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend CUSTOM_MATRIX = yes - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [[ -z $$USB ]]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/keyboards/orthodox/rules.mk b/keyboards/orthodox/rules.mk index dfcff1d90..3f40ff2f8 100644 --- a/keyboards/orthodox/rules.mk +++ b/keyboards/orthodox/rules.mk @@ -73,15 +73,3 @@ USE_I2C = yes SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend CUSTOM_MATRIX = yes - -avrdude: build - ls /dev/tty* > /tmp/1; \ - echo "Reset your Pro Micro now"; \ - while [[ -z $$USB ]]; do \ - sleep 1; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex - -.PHONY: avrdude diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index 4af34ba57..0d0eec3bf 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk @@ -144,6 +144,20 @@ dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep fi $(DFU_PROGRAMMER) $(MCU) reset +avrdude: $(BUILD_DIR)/$(TARGET).hex + ls /dev/tty* > /tmp/1; \ + echo "Detecting Pro Micro port, reset your Pro Micro now.\c"; \ + while [ -z $$USB ]; do \ + sleep 1; \ + echo ".\c"; \ + ls /dev/tty* > /tmp/2; \ + USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ + done; \ + echo ""; \ + echo "Detected Pro Micro port at $$USB"; \ + sleep 1; \ + avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex + # Convert hex to bin. flashbin: $(BUILD_DIR)/$(TARGET).hex $(OBJCOPY) -Iihex -Obinary $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin -- cgit v1.2.3 From 479139f9d4ef981a2f10918f0fb5a2c148ca0c8b Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Thu, 3 Aug 2017 14:33:55 -0400 Subject: Fix location of where the make command should be run --- keyboards/lets_split/readme.md | 4 ++-- keyboards/minidox/readme.md | 4 ++-- keyboards/nyquist/readme.md | 4 +++- keyboards/orthodox/readme.md | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/readme.md b/keyboards/lets_split/readme.md index 610b776ee..0ef7ff59d 100644 --- a/keyboards/lets_split/readme.md +++ b/keyboards/lets_split/readme.md @@ -106,7 +106,7 @@ Notes on Software Configuration ------------------------------- Configuring the firmware is similar to any other QMK project. One thing -to note is that `MATIX_ROWS` in `config.h` is the total number of rows between +to note is that `MATRIX_ROWS` in `config.h` is the total number of rows between the two halves, i.e. if your split keyboard has 4 rows in each half, then `MATRIX_ROWS=8`. @@ -115,7 +115,7 @@ not be very difficult to adapt it to support more if required. Flashing ------- -From the keymap directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. +From the `lets_split` directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. Example: `make rev2-default-avrdude` diff --git a/keyboards/minidox/readme.md b/keyboards/minidox/readme.md index da8971486..c15fd244a 100644 --- a/keyboards/minidox/readme.md +++ b/keyboards/minidox/readme.md @@ -1,7 +1,7 @@ MiniDox ===== -![MimiDox](http://i.imgur.com/iWb3yO0.jpg) +![MiniDox](http://i.imgur.com/iWb3yO0.jpg) A compact version of the ErgoDox @@ -22,7 +22,7 @@ Flashing ------- Note: Most of this is copied from the Let's Split readme, because it is awesome -From the keymap directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. +From the `minidox` directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. Example: `make rev1-default-avrdude` Choosing which board to plug the USB cable into (choosing Master) diff --git a/keyboards/nyquist/readme.md b/keyboards/nyquist/readme.md index c70bf0257..61b9317d5 100644 --- a/keyboards/nyquist/readme.md +++ b/keyboards/nyquist/readme.md @@ -6,6 +6,8 @@ The Nyquist is a 60% split ortholinear board by [Keebio](https://keeb.io). It ha ## Build Guide +A build log of the Nyquist can be found here: [Nyquist Build Log](http://imgur.com/a/dD4sX). + Since the design is very similar to the Let's Split v2, the build guide for that can be used while the build guide for the Nyquist is being fully developed. A build guide for putting together the Let's Split v2 can be found here: [An Overly Verbose Guide to Building a Let's Split Keyboard](https://github.com/nicinabox/lets-split-guide) There is additional information there about flashing and adding RGB underglow. @@ -98,7 +100,7 @@ unnecessary in simple use cases. Flashing ------- -From the keymap directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. +From the `nyquist` directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. Example: `make rev1-serial-avrdude` diff --git a/keyboards/orthodox/readme.md b/keyboards/orthodox/readme.md index 57e940b0f..e1fbf94ba 100644 --- a/keyboards/orthodox/readme.md +++ b/keyboards/orthodox/readme.md @@ -96,7 +96,7 @@ the two halves, i.e. if your split keyboard has 3 rows in each half, then Flashing ------- -From the keymap directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. +From the `orthodox` directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. Example: `make rev2-default-avrdude` -- cgit v1.2.3 From 72b706748938031395a34491b77a341197d31fe0 Mon Sep 17 00:00:00 2001 From: dwrz Date: Sun, 6 Aug 2017 15:08:04 +0000 Subject: Add piemod keymaps for Let's Split and Planck. --- keyboards/lets_split/keymaps/piemod/Makefile | 10 +++ keyboards/lets_split/keymaps/piemod/README.md | 31 +++++++ keyboards/lets_split/keymaps/piemod/keymap.c | 121 ++++++++++++++++++++++++++ keyboards/planck/keymaps/piemod/Makefile | 10 +++ keyboards/planck/keymaps/piemod/README.md | 31 +++++++ keyboards/planck/keymaps/piemod/keymap.c | 111 +++++++++++++++++++++++ 6 files changed, 314 insertions(+) create mode 100755 keyboards/lets_split/keymaps/piemod/Makefile create mode 100644 keyboards/lets_split/keymaps/piemod/README.md create mode 100644 keyboards/lets_split/keymaps/piemod/keymap.c create mode 100755 keyboards/planck/keymaps/piemod/Makefile create mode 100644 keyboards/planck/keymaps/piemod/README.md create mode 100644 keyboards/planck/keymaps/piemod/keymap.c (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/keymaps/piemod/Makefile b/keyboards/lets_split/keymaps/piemod/Makefile new file mode 100755 index 000000000..1e48872e3 --- /dev/null +++ b/keyboards/lets_split/keymaps/piemod/Makefile @@ -0,0 +1,10 @@ +SUBPROJECT_DEFAULT = rev4 + +MOUSEKEY_ENABLE = yes +BLUETOOTH_ENABLE = yes +EXTRAKEY_ENABLE = yes +AUDIO_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/lets_split/keymaps/piemod/README.md b/keyboards/lets_split/keymaps/piemod/README.md new file mode 100644 index 000000000..f2a051da1 --- /dev/null +++ b/keyboards/lets_split/keymaps/piemod/README.md @@ -0,0 +1,31 @@ +PieMod +====== + +A keymap for users that need: + +- *P*: Programming symbols. + +- *I*: i3wm. + +- *E*: Emacs. + +- *M*: Macros. + +- *O*: Ortholinear. + +- *D*: Dvorak. + +Still a work-in-progress. Suggestions welcome @ https://github.com/dwrz/piemod. + +### Keymap + +![PieMod Keymap](./keymap.png) + +### TODO + +- [ ] Add Emacs layer. +- [ ] Add Macro layer. +- [ ] Add system control keys (rotation, brightness). +- [ ] Switch " and ' quotes (or function to toggle default). +- [ ] Add capslock. +. diff --git a/keyboards/lets_split/keymaps/piemod/keymap.c b/keyboards/lets_split/keymaps/piemod/keymap.c new file mode 100644 index 000000000..558370fa8 --- /dev/null +++ b/keyboards/lets_split/keymaps/piemod/keymap.c @@ -0,0 +1,121 @@ +#include "lets_split.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + +#define _DVORAK 0 +#define _ARROW 1 //F(1) +#define _SYMBOL 2 // F(2) +#define _NUMBER 3 // F(3) +#define _FUNCTION 4 // F(4) +#define _EMACS 5 // F(5) +#define _MACROS 6 // F(6) +#define _MOUSE 7 // F(7) + +enum custom_keycodes { + DVORAK = SAFE_RANGE, + ARROW, + SYMBOL, + NUMBER, + FUNCTION, + EMACS, + MACROS, + MOUSE, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_DVORAK] = KEYMAP( \ + KC_ESC, KC_QUOTE, F(7), KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DELETE, \ + KC_TAB, F(1), F(2), F(3), F(4), KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENTER, \ + KC_LSHIFT, KC_SCOLON, F(5), KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_MINUS, \ + F(10), F(6), KC_MENU, KC_LALT, KC_LGUI, KC_BSPACE, KC_SPACE, KC_RCTRL, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT \ +), + +[_ARROW] = KEYMAP( \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_HOME, KC_UP, KC_END, KC_PGUP, \ + KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDN, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_NO, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO \ +), + +[_SYMBOL] = KEYMAP( \ + KC_TILD, KC_GRAVE, KC_NO, KC_EQUAL, KC_PLUS, KC_NO, KC_LBRACKET, KC_RBRACKET, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, \ + KC_NO, KC_NO, KC_TRNS, KC_SCOLON, KC_COLN, KC_NO, KC_LCBR, KC_RCBR, KC_DLR, KC_PERC, KC_CIRC, F(21), \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BSLASH, KC_SLASH, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_ASTR, KC_SLASH, KC_MINUS, KC_PLUS, KC_EQUAL \ +), + +[_NUMBER] = KEYMAP( \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_7, KC_8, KC_9, KC_NO, \ + KC_NO, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_4, KC_5, KC_6, KC_NO, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_0, KC_1, KC_2, KC_3, KC_NO, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_ASTR, KC_SLASH, KC_MINUS, KC_PLUS, KC_EQUAL \ +), + +[_FUNCTION] = KEYMAP( \ + KC_PSCREEN, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_AUDIO_MUTE, KC_AUDIO_VOL_DOWN, KC_AUDIO_VOL_UP, KC_MEDIA_PLAY_PAUSE, \ + RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_DELETE, KC_INSERT, KC_HOME, KC_PGDN, KC_PGUP, KC_END \ +), + +[_EMACS] = KEYMAP( \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO \ +), + +[_MACROS] = KEYMAP( \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO \ +), + +[_MOUSE] = KEYMAP( \ + KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MS_U, KC_NO, KC_NO, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MS_BTN1, KC_MS_BTN2, KC_MS_BTN3, KC_NO, KC_NO, KC_NO \ +) +}; + +enum function_id { + TEENSY_KEY, + CUSTOM_KEY, + L_CTRL_ALT_ENT, + R_CTRL_ALT_ENT, +}; + +int CAPSLOCKED = 0; + + const uint16_t PROGMEM fn_actions[] = { + + // DVORAK 0 + // ARROW 1, F(1) + // SYMBOL 2, F(2) + // NUMBER 3, F(3) + // FUNCTION 4, F(4) + // EMACS 5, F(5) + // MACROS 6, F(6) + // MOUSE 7, F(7) + + // Layers + [1] = ACTION_LAYER_TAP_KEY(1, KC_A), // FN1 = Momentary Arrow layer on A. + [2] = ACTION_LAYER_TAP_KEY(2, KC_O), // FN2 = Momentary symbOl layer on O. + [3] = ACTION_LAYER_TAP_KEY(3, KC_E), // FN3 = Momentary numbEr layer on E. + [4] = ACTION_LAYER_TAP_KEY(4, KC_U), // FN4 = Momentary fUnction layer on U. + [5] = ACTION_LAYER_TAP_KEY(5, KC_Q), // FN5 = Momentary emaQs layer on Q. + [6] = ACTION_LAYER_TAP_KEY(6, KC_LCTRL), // FN6 = Momentary MACROS on ??? key. + [7] = ACTION_LAYER_TAP_KEY(7, KC_COMMA), // FN7 = Momentary MOUSE on , key. + + // Special Keys + [10] = ACTION_MODS_KEY(KC_LCTRL, KC_LALT), // FN10 = Ctrl + Alt. + + // Symbols + [21] = ACTION_MODS_KEY(MOD_LSFT, KC_SLASH), // FN21 = Question mark. + + }; diff --git a/keyboards/planck/keymaps/piemod/Makefile b/keyboards/planck/keymaps/piemod/Makefile new file mode 100755 index 000000000..1e48872e3 --- /dev/null +++ b/keyboards/planck/keymaps/piemod/Makefile @@ -0,0 +1,10 @@ +SUBPROJECT_DEFAULT = rev4 + +MOUSEKEY_ENABLE = yes +BLUETOOTH_ENABLE = yes +EXTRAKEY_ENABLE = yes +AUDIO_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/planck/keymaps/piemod/README.md b/keyboards/planck/keymaps/piemod/README.md new file mode 100644 index 000000000..f2a051da1 --- /dev/null +++ b/keyboards/planck/keymaps/piemod/README.md @@ -0,0 +1,31 @@ +PieMod +====== + +A keymap for users that need: + +- *P*: Programming symbols. + +- *I*: i3wm. + +- *E*: Emacs. + +- *M*: Macros. + +- *O*: Ortholinear. + +- *D*: Dvorak. + +Still a work-in-progress. Suggestions welcome @ https://github.com/dwrz/piemod. + +### Keymap + +![PieMod Keymap](./keymap.png) + +### TODO + +- [ ] Add Emacs layer. +- [ ] Add Macro layer. +- [ ] Add system control keys (rotation, brightness). +- [ ] Switch " and ' quotes (or function to toggle default). +- [ ] Add capslock. +. diff --git a/keyboards/planck/keymaps/piemod/keymap.c b/keyboards/planck/keymaps/piemod/keymap.c new file mode 100644 index 000000000..e6e7a8a5a --- /dev/null +++ b/keyboards/planck/keymaps/piemod/keymap.c @@ -0,0 +1,111 @@ +#include "planck.h" +#include "action_layer.h" +#ifdef AUDIO_ENABLE + #include "audio.h" +#endif +#include "eeconfig.h" + +#define DVORAK 0 +#define ARROW 1 //F(1) +#define SYMBOL 2 // F(2) +#define NUMBER 3 // F(3) +#define FUNCTION 4 // F(4) +#define EMACS 5 // F(5) +#define CUSTOM_MACROS 6 // F(6) +#define MOUSE 7 // F(7) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [DVORAK] = { + {KC_ESC, KC_QUOTE, F(7), KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DELETE}, + {KC_TAB, F(1), F(2), F(3), F(4), KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENTER}, + {KC_LSHIFT, KC_SCOLON, F(5), KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_MINUS}, + {F(10), F(6), KC_MENU, KC_LALT, KC_LGUI, KC_BSPACE, KC_SPACE, KC_RCTRL, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT}, + }, + + [ARROW] = { + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_HOME, KC_UP, KC_END, KC_PGUP}, + {KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDN}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_NO}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO} + }, + + [SYMBOL] = { + {KC_TILD, KC_GRAVE, KC_NO, KC_EQUAL, KC_PLUS, KC_NO, KC_LBRACKET, KC_RBRACKET, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN}, + {KC_NO, KC_NO, KC_TRNS, KC_SCOLON, KC_COLN, KC_NO, KC_LCBR, KC_RCBR, KC_DLR, KC_PERC, KC_CIRC, F(21)}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BSLASH, KC_SLASH, KC_EXLM, KC_AT, KC_HASH, KC_PIPE}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_ASTR, KC_SLASH, KC_MINUS, KC_PLUS, KC_EQUAL} + }, + + [NUMBER] = { + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_7, KC_8, KC_9, KC_NO}, + {KC_NO, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_4, KC_5, KC_6, KC_NO}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_0, KC_1, KC_2, KC_3, KC_NO}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_ASTR, KC_SLASH, KC_MINUS, KC_PLUS, KC_EQUAL} + }, + + [FUNCTION] = { + {KC_PSCREEN, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_NO, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_AUDIO_MUTE, KC_AUDIO_VOL_DOWN, KC_AUDIO_VOL_UP, KC_MEDIA_PLAY_PAUSE}, + {RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_DELETE, KC_INSERT, KC_HOME, KC_PGDN, KC_PGUP, KC_END} + }, + + [EMACS] = { + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO}, + {KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO} + }, + + [CUSTOM_MACROS] = { + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO}, + {KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO} + }, + + [MOUSE] = { + {KC_NO, KC_NO, KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MS_U, KC_NO, KC_NO}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MS_L, KC_MS_D, KC_MS_R, KC_NO}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO}, + {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MS_BTN1, KC_MS_BTN2, KC_MS_BTN3, KC_NO, KC_NO, KC_NO} + }, + + }; + + enum function_id { + TEENSY_KEY, + CUSTOM_KEY, + L_CTRL_ALT_ENT, + R_CTRL_ALT_ENT, + }; + + int CAPSLOCKED = 0; + + const uint16_t PROGMEM fn_actions[] = { + + // DVORAK 0 + // ARROW 1, F(1) + // SYMBOL 2, F(2) + // NUMBER 3, F(3) + // FUNCTION 4, F(4) + // EMACS 5, F(5) + // MACROS 6, F(6) + // MOUSE 7, F(7) + + // Layers + [1] = ACTION_LAYER_TAP_KEY(1, KC_A), // FN1 = Momentary Arrow layer on A. + [2] = ACTION_LAYER_TAP_KEY(2, KC_O), // FN2 = Momentary symbOl layer on O. + [3] = ACTION_LAYER_TAP_KEY(3, KC_E), // FN3 = Momentary numbEr layer on E. + [4] = ACTION_LAYER_TAP_KEY(4, KC_U), // FN4 = Momentary fUnction layer on U. + [5] = ACTION_LAYER_TAP_KEY(5, KC_Q), // FN5 = Momentary emaQs layer on Q. + [6] = ACTION_LAYER_TAP_KEY(6, KC_LCTRL), // FN6 = Momentary MACROS on ??? key. + [7] = ACTION_LAYER_TAP_KEY(7, KC_COMMA), // FN7 = Momentary MOUSE on , key. + + // Special Keys + [10] = ACTION_MODS_KEY(KC_LCTRL, KC_LALT), // FN10 = Ctrl + Alt. + + // Symbols + [21] = ACTION_MODS_KEY(MOD_LSFT, KC_SLASH), // FN21 = Question mark. + + }; -- cgit v1.2.3 From 3fa32867ad03db239c395700d5b711c955b1aa07 Mon Sep 17 00:00:00 2001 From: dwrz Date: Sun, 6 Aug 2017 15:10:58 +0000 Subject: Remove makefile from Let's Split piemod. --- keyboards/lets_split/keymaps/piemod/Makefile | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100755 keyboards/lets_split/keymaps/piemod/Makefile (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/keymaps/piemod/Makefile b/keyboards/lets_split/keymaps/piemod/Makefile deleted file mode 100755 index 1e48872e3..000000000 --- a/keyboards/lets_split/keymaps/piemod/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -SUBPROJECT_DEFAULT = rev4 - -MOUSEKEY_ENABLE = yes -BLUETOOTH_ENABLE = yes -EXTRAKEY_ENABLE = yes -AUDIO_ENABLE = yes - -ifndef QUANTUM_DIR - include ../../../../Makefile -endif -- cgit v1.2.3 From 70407a1b6702d1001f8b92e486f215c1800ce82d Mon Sep 17 00:00:00 2001 From: dwrz Date: Thu, 10 Aug 2017 17:07:07 +0000 Subject: Add config.h to piemod keymap. --- keyboards/lets_split/keymaps/piemod/config.h | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 keyboards/lets_split/keymaps/piemod/config.h (limited to 'keyboards/lets_split') diff --git a/keyboards/lets_split/keymaps/piemod/config.h b/keyboards/lets_split/keymaps/piemod/config.h new file mode 100644 index 000000000..7f33a4363 --- /dev/null +++ b/keyboards/lets_split/keymaps/piemod/config.h @@ -0,0 +1,37 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +Copyright 2015 Jack Humbert + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +// #define USE_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define _MASTER_RIGHT +// #define EE_HANDS + +#endif \ No newline at end of file -- cgit v1.2.3