]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
[Keyboard] Instant60 Tsangan (#5580)
authorAndrew Kannan <andrew.kannan@klaviyo.com>
Mon, 8 Apr 2019 01:32:16 +0000 (21:32 -0400)
committerDrashna Jaelre <drashna@live.com>
Mon, 8 Apr 2019 01:32:16 +0000 (18:32 -0700)
* Update instant60 for tsangan version

* Add extra init hook

* Remove hacky first init thing

keyboards/cannonkeys/instant60/instant60.h
keyboards/cannonkeys/instant60/keymaps/default/keymap.c
keyboards/cannonkeys/instant60/keymaps/tsangan/keymap.c [new file with mode: 0644]
keyboards/cannonkeys/stm32f072/keyboard.c

index cca1b9a29c2e71799456ef2240032c6633100284..67d5ba98fe215cadadf0dbbc411e03ff1a0c54bf 100644 (file)
@@ -2,16 +2,46 @@
 
 #include "quantum.h"
 
-#define LAYOUT_default( \
+#define KNO KC_NO
+
+#define LAYOUT_ansi( \
   K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
   K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C,      K1E, \
-  K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B,          K2E, \
+  K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B,           K2E, \
   K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, \
-  K40, K41,  K42,              K45,             K49,  K4A,  K4B,  K4E \
+  K40, K41,  K42,              K45,            K49, K4A, K4B,           K4E \
+) { \
+  {  K00,  K01,  K02,  K03,  K04,    K05,    K06,    K07,    K08,    K09,  K0A,  K0B,  K0C,  K0D,  KNO}, \
+  {  K10,  K11,  K12,  K13,  K14,    K15,    K16,    K17,    K18,    K19,  K1A,  K1B,  K1C,  KNO,  K1E   }, \
+  {  K20,  K21,  K22,  K23,  K24,    K25,    K26,    K27,    K28,    K29,  K2A,  K2B,  KNO,  KNO,  K2E  }, \
+  {  K30,  K31,  K32,  K33,  K34,    K35,    K36,    K37,    K38,    K39,  K3A,  K3B,  KNO,  KNO,  KNO  }, \
+  {  K40,  K41,  K42,  KNO,  KNO,    K45,    KNO,    KNO,    KNO,    K49,  K4A,  K4B,  KNO,  KNO,  K4E  }  \
+}
+
+#define LAYOUT_tsangan( \
+  K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \
+  K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C,      K1E, \
+  K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B,           K2E, \
+  K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B,           K3E,\
+  K40, K41,  K42,              K45,            K49,      K4B,           K4E \
+) { \
+  {  K00,  K01,  K02,  K03,  K04,    K05,    K06,    K07,    K08,    K09,  K0A,  K0B,  K0C,  K0D,  K0E}, \
+  {  K10,  K11,  K12,  K13,  K14,    K15,    K16,    K17,    K18,    K19,  K1A,  K1B,  K1C,  KNO,  K1E   }, \
+  {  K20,  K21,  K22,  K23,  K24,    K25,    K26,    K27,    K28,    K29,  K2A,  K2B,  KNO,  KNO,  K2E  }, \
+  {  K30,  K31,  K32,  K33,  K34,    K35,    K36,    K37,    K38,    K39,  K3A,  K3B,  KNO,  KNO,  K3E  }, \
+  {  K40,  K41,  K42,  KNO,  KNO,    K45,    KNO,    KNO,    KNO,    K49,  KNO,  K4B,  KNO,  KNO,  K4E  }  \
+}
+
+#define LAYOUT_all( \
+  K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E,\
+  K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C,      K1E, \
+  K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B,          K2E, \
+  K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B,          K3E,\
+  K40, K41,  K42,              K45,            K49, K4A, K4B,          K4E \
 ) { \
-  {  K00,  K01,  K02,  K03,  K04,    K05,    K06,    K07,    K08,    K09,  K0A,  K0B,  K0C,    K0D,   KC_NO}, \
-  {  K10,  K11,  K12,  K13,  K14,    K15,    K16,    K17,    K18,    K19,  K1A,  K1B,  K1C,    KC_NO, K1E   }, \
-  {  K20,  K21,  K22,  K23,  K24,    K25,    K26,    K27,    K28,    K29,  K2A,  K2B,  KC_NO,  KC_NO, K2E  }, \
-  {  K30,  K31,  K32,  K33,  K34,    K35,    K36,    K37,    K38,    K39,  K3A,  K3B,  KC_NO,  KC_NO, KC_NO  }, \
-  {  K40,  K41,  K42,  KC_NO,  KC_NO,  K45,  KC_NO,  KC_NO,  KC_NO,  K49,  K4A,  K4B,  KC_NO,  KC_NO, K4E  }  \
+  {  K00,  K01,  K02,  K03,  K04,    K05,    K06,    K07,    K08,    K09,  K0A,  K0B,  K0C,  K0D,  K0E}, \
+  {  K10,  K11,  K12,  K13,  K14,    K15,    K16,    K17,    K18,    K19,  K1A,  K1B,  K1C,  KNO,  K1E   }, \
+  {  K20,  K21,  K22,  K23,  K24,    K25,    K26,    K27,    K28,    K29,  K2A,  K2B,  KNO,  KNO,  K2E  }, \
+  {  K30,  K31,  K32,  K33,  K34,    K35,    K36,    K37,    K38,    K39,  K3A,  K3B,  KNO,  KNO,  K3E  }, \
+  {  K40,  K41,  K42,  KNO,  KNO,    K45,    KNO,    KNO,    KNO,    K49,  K4A,  K4B,  KNO,  KNO,  K4E  }  \
 }
index e898a3f3b70898dcc124eda2afa6a7db1898f6b3..7753181a489357412b17f63a6871e5ff50eb2419 100644 (file)
@@ -30,7 +30,7 @@ enum custom_keycodes {
 };
 
 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-  [_BASE] = LAYOUT_default(
+  [_BASE] = LAYOUT_ansi(
     KC_GESC, KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,                 KC_7,    KC_8,    KC_9,    KC_0,    KC_MINS, KC_EQL,   KC_BSPC, \
     KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,   KC_U,    KC_I,    KC_O,    KC_P,    KC_LBRC, KC_RBRC,  KC_BSLS, \
     KC_CAPS, KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,                 KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT,           KC_ENT,  \
@@ -38,7 +38,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     KC_LCTL, KC_LGUI, KC_LALT,                            KC_SPC,                                          KC_RALT, KC_RGUI, MO(_FN1), KC_RCTL
   ),
 
-  [_FN1] = LAYOUT_default(
+  [_FN1] = LAYOUT_ansi(
     KC_GESC, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  KC_DEL, \
     RGB_TOG, RGB_MOD, KC_UP,   _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
     BL_BRTG, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, _______, _______, _______,          _______, \
diff --git a/keyboards/cannonkeys/instant60/keymaps/tsangan/keymap.c b/keyboards/cannonkeys/instant60/keymaps/tsangan/keymap.c
new file mode 100644 (file)
index 0000000..e95ac1b
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include QMK_KEYBOARD_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 _BASE 0
+#define _FN1 1
+
+enum custom_keycodes {
+  QWERTY = SAFE_RANGE,
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+  [_BASE] = LAYOUT_tsangan(
+    KC_GESC, KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,                 KC_7,    KC_8,    KC_9,    KC_0,    KC_MINS, KC_EQL,   KC_BSPC, KC_DEL, \
+    KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,   KC_U,    KC_I,    KC_O,    KC_P,    KC_LBRC, KC_RBRC,  KC_BSLS, \
+    KC_CAPS, KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,                 KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT,           KC_ENT,  \
+    KC_LSFT, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,                 KC_M,    KC_COMM, KC_DOT,  KC_SLSH,                    KC_RSFT, MO(_FN1),\
+    KC_LCTL, KC_LGUI, KC_LALT,                            KC_SPC,                                          KC_RALT, KC_RGUI, KC_RCTL
+  ),
+
+  [_FN1] = LAYOUT_tsangan(
+    KC_GESC, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  KC_F11,  KC_F12,  KC_DEL, _______,\
+    RGB_TOG, RGB_MOD, KC_UP,   _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
+    BL_BRTG, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, _______, _______, _______,          _______, \
+    BL_INC,  BL_DEC,  BL_TOGG, _______, _______, _______, _______, _______, _______, _______, _______,                   _______, _______,\
+    KC_GRV,  _______, _______,                            _______,                            _______, _______, RESET
+  )
+};
index 4316d5186794db4e20c1062a1cf9b8c2056324ae..f94ecb5fbb098d67f7f524a814c4a6f81a2bf77c 100644 (file)
@@ -15,7 +15,6 @@ backlight_config_t kb_backlight_config = {
   .level = BACKLIGHT_LEVELS
 };
 
-
 bool eeprom_is_valid(void)
 {
        return (eeprom_read_word(((void*)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC &&
@@ -51,9 +50,13 @@ void eeprom_init_kb(void)
        } else  {
                // Save the magic number last, in case saving was interrupted
                eeprom_set_valid(true);
+    save_backlight_config_to_eeprom();
        }
 }
 
+__attribute__ ((weak))
+void matrix_init_board(void);
+
 void matrix_init_kb(void){
        eeprom_init_kb();
       /* MOSI pin*/
@@ -64,6 +67,8 @@ void matrix_init_kb(void){
     leds_init();
 #endif
     backlight_init_ports();
+
+    matrix_init_board();
 }
 
 void matrix_scan_kb(void)