瀏覽代碼

update matrix

Jack Humbert 7 年之前
父節點
當前提交
fae437cfad

+ 33 - 0
drivers/arm/twi2c.c

@@ -0,0 +1,33 @@
+/* Copyright 2018 Jack Humbert
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "twi2c.h"
+
+#ifndef I2C_DRIVER
+	#define I2C_DRIVER &I2CD1
+#endif
+
+static const I2CConfig i2cconfig = {
+  STM32_TIMINGR_PRESC(15U) |
+  STM32_TIMINGR_SCLDEL(4U) | STM32_TIMINGR_SDADEL(2U) |
+  STM32_TIMINGR_SCLH(15U)  | STM32_TIMINGR_SCLL(21U),
+  0,
+  0
+};
+
+void twi2c_init(void) {
+	i2cStart(I2C_DRIVER, &i2cconfig);
+}

+ 18 - 0
drivers/arm/twi2c.h

@@ -0,0 +1,18 @@
+/* Copyright 2018 Jack Humbert
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ch.h"
+#include "hal.h"

+ 12 - 0
keyboards/_qmk_handwire/_qmk_handwire.h

@@ -29,6 +29,12 @@
 /* The fully-featured KEYMAP() that has every single key available in the matrix.
  */
 #define KEYMAP(\
+    j00, j01, j02, j03, j04, j05, j06, \
+    j10, j11, j12, j13, j14, j15, j16, \
+    j20, j21, j22, j23, j24, j25, j26, \
+    j30, j31, j32, j33, j34, j35, \
+    j40, j41, j42, j43, j44, \
+                        j54, j55, j56, \
     k00, k01, k02, k03, k04, k05, k06, \
     k10, k11, k12, k13, k14, k15, k16, \
     k20, k21, k22, k23, k24, k25, k26, \
@@ -36,6 +42,12 @@
               k42, k43, k44, k45, k46, \
     k50, k51, k52 \
 ) { \
+    { j00, j01, j02, j03, j04, j05, j06 }, \
+    { j10, j11, j12, j13, j14, j15, j16 }, \
+    { j20, j21, j22, j23, j24, j25, j26 }, \
+    { j30, j31, j32, j33, j34, j35, 0   }, \
+    { j40, j41, j42, j43, j44, 0,   0   }, \
+    { 0,   0,   0,   0,   j54, j55, j56 }, \
     { k00, k01, k02, k03, k04, k05, k06 }, \
     { k10, k11, k12, k13, k14, k15, k16 }, \
     { k20, k21, k22, k23, k24, k25, k26 }, \

+ 1 - 1
keyboards/_qmk_handwire/config.h

@@ -29,7 +29,7 @@
 #define DESCRIPTION     "Handwire protoboard"
 
 /* key matrix size */
-#define MATRIX_ROWS 6
+#define MATRIX_ROWS 12
 #define MATRIX_COLS 7
 
 /*

+ 7 - 0
keyboards/_qmk_handwire/keymaps/default/keymap.c

@@ -37,6 +37,13 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
       KC_INS,  KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_BSPC,    
       KC_PGUP, KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_DEL,    
       KC_PGDN, KC_H,    KC_J,    KC_K,    KC_L,    KC_COLN, KC_QUOT,    
+      KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_ENT,    
+      KC_RCTL, KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT,    
+                                          MO(2), MO(1), KC_SPC,
+
+      KC_INS,  KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_BSPC,    
+      KC_PGUP, KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_DEL,    
+      KC_PGDN, KC_H,    KC_J,    KC_K,    KC_L,    KC_COLN, KC_QUOT,    
                KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_ENT,    
                         KC_RCTL, KC_LEFT, KC_DOWN, KC_UP,   KC_RGHT,    
       MO(2), MO(1), KC_SPC