From 8b9617f93dce6fdf1b4e003da3e120f9c6853d23 Mon Sep 17 00:00:00 2001 From: myfreeweb Date: Wed, 23 Sep 2020 07:17:36 +0300 Subject: [Keyboard] Add Spider Island split 78 key ps2avrGB based keyboard (#9900) --- keyboards/spiderisland/split78/config.h | 35 +++++ keyboards/spiderisland/split78/info.json | 94 +++++++++++++ .../spiderisland/split78/keymaps/default/keymap.c | 41 ++++++ keyboards/spiderisland/split78/matrix.c | 155 +++++++++++++++++++++ keyboards/spiderisland/split78/readme.md | 25 ++++ keyboards/spiderisland/split78/rules.mk | 24 ++++ keyboards/spiderisland/split78/split78.c | 17 +++ keyboards/spiderisland/split78/split78.h | 36 +++++ 8 files changed, 427 insertions(+) create mode 100644 keyboards/spiderisland/split78/config.h create mode 100644 keyboards/spiderisland/split78/info.json create mode 100644 keyboards/spiderisland/split78/keymaps/default/keymap.c create mode 100644 keyboards/spiderisland/split78/matrix.c create mode 100644 keyboards/spiderisland/split78/readme.md create mode 100644 keyboards/spiderisland/split78/rules.mk create mode 100644 keyboards/spiderisland/split78/split78.c create mode 100644 keyboards/spiderisland/split78/split78.h (limited to 'keyboards/spiderisland') diff --git a/keyboards/spiderisland/split78/config.h b/keyboards/spiderisland/split78/config.h new file mode 100644 index 0000000000..a7ec160faf --- /dev/null +++ b/keyboards/spiderisland/split78/config.h @@ -0,0 +1,35 @@ +/* +Copyright 2020 unrelenting.technology + +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 . +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0xF4E4 +#define DEVICE_VER 0x0001 +#define MANUFACTURER SpiderIsland +#define PRODUCT Split 78-key + +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 14 + +#define BACKLIGHT_PIN D4 +#define BACKLIGHT_LEVELS 3 +#define BACKLIGHT_BREATHING diff --git a/keyboards/spiderisland/split78/info.json b/keyboards/spiderisland/split78/info.json new file mode 100644 index 0000000000..7a96efe762 --- /dev/null +++ b/keyboards/spiderisland/split78/info.json @@ -0,0 +1,94 @@ +{ + "keyboard_name": "Spider Island 78-key split", + "url": "", + "maintainer": "qmk", + "width": 16, + "height": 6.25, + "layouts": { + "LAYOUT": { + "layout": [ + {"x": 0, "y": 0}, + {"x": 2, "y": 0}, + {"x": 3, "y": 0}, + {"x": 4, "y": 0}, + {"x": 5, "y": 0}, + {"x": 6.5, "y": 0}, + {"x": 8.5, "y": 0}, + {"x": 9.5, "y": 0}, + {"x": 10.5, "y": 0}, + {"x": 12, "y": 0}, + {"x": 13, "y": 0}, + {"x": 14, "y": 0}, + {"x": 15, "y": 0}, + {"x": 0, "y": 1.25}, + {"x": 1, "y": 1.25}, + {"x": 2, "y": 1.25}, + {"x": 3, "y": 1.25}, + {"x": 4, "y": 1.25}, + {"x": 5, "y": 1.25}, + {"x": 6, "y": 1.25}, + {"x": 8, "y": 1.25}, + {"x": 9, "y": 1.25}, + {"x": 10, "y": 1.25}, + {"x": 11, "y": 1.25}, + {"x": 12, "y": 1.25}, + {"x": 13, "y": 1.25}, + {"x": 14, "y": 1.25, "w": 2}, + {"x": 0, "y": 2.25, "w": 1.5}, + {"x": 1.5, "y": 2.25}, + {"x": 2.5, "y": 2.25}, + {"x": 3.5, "y": 2.25}, + {"x": 4.5, "y": 2.25}, + {"x": 5.5, "y": 2.25}, + {"x": 7.5, "y": 2.25}, + {"x": 8.5, "y": 2.25}, + {"x": 9.5, "y": 2.25}, + {"x": 10.5, "y": 2.25}, + {"x": 11.5, "y": 2.25}, + {"x": 12.5, "y": 2.25}, + {"x": 13.5, "y": 2.25}, + {"x": 14.5, "y": 2.25, "w": 1.5}, + + {"x": 0, "y": 3.25, "w": 1.75}, + {"x": 1.75, "y": 3.25}, + {"x": 2.75, "y": 3.25}, + {"x": 3.75, "y": 3.25}, + {"x": 4.75, "y": 3.25}, + {"x": 5.75, "y": 3.25}, + {"x": 7.75, "y": 3.25}, + {"x": 8.75, "y": 3.25}, + {"x": 9.75, "y": 3.25}, + {"x": 10.75, "y": 3.25}, + {"x": 11.75, "y": 3.25}, + {"x": 12.75, "y": 3.25}, + {"x": 13.75, "y": 3.25, "w": 2.25}, + + {"x": 0, "y": 4.25, "w": 2.25}, + {"x": 2.25, "y": 4.25}, + {"x": 3.25, "y": 4.25}, + {"x": 4.25, "y": 4.25}, + {"x": 5.25, "y": 4.25}, + {"x": 6.25, "y": 4.25}, + {"x": 8.25, "y": 4.25}, + {"x": 9.25, "y": 4.25}, + {"x": 10.25, "y": 4.25}, + {"x": 11.25, "y": 4.25}, + {"x": 12.25, "y": 4.25, "w": 1.75}, + {"x": 14, "y": 4.25}, + {"x": 15, "y": 4.25}, + + {"x": 0, "y": 5.25, "w": 1.25}, + {"x": 1.25, "y": 5.25, "w": 1.25}, + {"x": 2.5, "y": 5.25, "w": 1.25}, + {"x": 3.75, "y": 5.25, "w": 1.25}, + {"x": 5, "y": 5.25, "w": 2.25}, + {"x": 8.25, "y": 5.25, "w": 2.25}, + {"x": 10.5, "y": 5.25, "w": 1.25}, + {"x": 11.75, "y": 5.25, "w": 1.25}, + {"x": 13, "y": 5.25}, + {"x": 14, "y": 5.25}, + {"x": 15, "y": 5.25} + ] + } + } +} diff --git a/keyboards/spiderisland/split78/keymaps/default/keymap.c b/keyboards/spiderisland/split78/keymaps/default/keymap.c new file mode 100644 index 0000000000..761648d958 --- /dev/null +++ b/keyboards/spiderisland/split78/keymaps/default/keymap.c @@ -0,0 +1,41 @@ +/* Copyright 2020 unrelenting.technology + * + * 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 QMK_KEYBOARD_H + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _BASE, + _FN +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT( + 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_GRV, 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_QUOT, KC_SCLN, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_RSFT, KC_UP, KC_SLSH, + KC_LCTL, KC_LGUI, KC_LALT, TT(_FN), KC_SPC, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + [_FN] = LAYOUT( + RESET, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, BL_DEC, BL_INC, KC_DEL, + KC_NLCK, XXXXXXX, KC_UP, XXXXXXX, XXXXXXX, XXXXXXX, KC_P7, KC_P8, KC_P9, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + BL_TOGG, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, KC_P4, KC_P5, KC_P6, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + KC_SLCK, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_P1, KC_P2, KC_P3, XXXXXXX, KC_SLSH, KC_PGUP, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_P0, KC_PDOT, KC_PENT, KC_HOME, KC_PGDN, KC_END + ) +}; diff --git a/keyboards/spiderisland/split78/matrix.c b/keyboards/spiderisland/split78/matrix.c new file mode 100644 index 0000000000..b5c7028fdf --- /dev/null +++ b/keyboards/spiderisland/split78/matrix.c @@ -0,0 +1,155 @@ +/* +Copyright 2017 Luiz Ribeiro + +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 +#include +#include "quantum.h" +#include "i2c_master.h" +#include "split78.h" + +#define RIGHT_HALF + + +void matrix_set_row_status(uint8_t row); + + +#if defined(RIGHT_HALF) +#define I2C_TIMEOUT 10 +#define MCP23018_TWI_ADDRESS 0b0100000 +#define TW_READ 1 +#define TW_WRITE 0 +#define TWI_ADDR_WRITE ( (MCP23018_TWI_ADDRESS<<1) | TW_WRITE ) +#define TWI_ADDR_READ ( (MCP23018_TWI_ADDRESS<<1) | TW_READ ) +#define IODIRA 0x00 // i/o direction register +#define IODIRB 0x01 +#define IODIRA 0x00 // i/o direction register +#define IODIRB 0x01 +#define GPPUA 0x0C // GPIO pull-up resistor register +#define GPPUB 0x0D +#define GPIOA 0x12 // general purpose i/o port register (write modifies OLAT) +#define GPIOB 0x13 +#define OLATA 0x14 // output latch register +#define OLATB 0x15 +#define MCP_ROWS_START 8 + +static uint8_t mcp23018_init(void) { + uint8_t ret; + uint8_t data[3]; + // set pin direction + // - unused : input : 1 + // - input : input : 1 + // - driving : output : 0 + data[0] = IODIRA; + data[1] = 0b00000000; // IODIRA + data[2] = (0b11111111); // IODIRB + + ret = i2c_transmit(TWI_ADDR_WRITE, (uint8_t *)data, 3, I2C_TIMEOUT); + if (ret) goto out; // make sure we got an ACK + + // set pull-up + // - unused : on : 1 + // - input : on : 1 + // - driving : off : 0 + data[0] = GPPUA; + data[1] = 0b00000000; // IODIRA + data[2] = (0b11111111); // IODIRB + + ret = i2c_transmit(TWI_ADDR_WRITE, (uint8_t *)data, 3, I2C_TIMEOUT); + if (ret) goto out; // make sure we got an ACK + + // set logical value (doesn't matter on inputs) + // - unused : hi-Z : 1 + // - input : hi-Z : 1 + // - driving : hi-Z : 1 + data[0] = OLATA; + data[1] = 0b11111111; // IODIRA + data[2] = (0b11111111); // IODIRB + + ret = i2c_transmit(TWI_ADDR_WRITE, (uint8_t *)data, 3, I2C_TIMEOUT); + +out: + return ret; +} +#endif + +void matrix_init_custom(void) { + // Set rows as output starting high + DDRB = 0xFF; + PORTB = 0xFF; + + // Set columns as inputs with pull-up enabled + DDRA = 0x00; + PORTA = 0xFF; + + // Initialize i2c communication + i2c_init(); + +#if defined(RIGHT_HALF) + // Initialize the chip on the other half + mcp23018_init(); +#endif + +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + bool matrix_has_changed = false; + + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[row]; + + matrix_row_t cols = 0; + // Select the row to scan + matrix_set_row_status(row); + + matrix_io_delay(); + //Set the local row + +#if defined(RIGHT_HALF) + // Initialize to 0x7F in case I2C read fails, + // as 0x75 would be no keys pressed + uint8_t data = 0x7F; + // Receive the columns from right half + i2c_receive(TWI_ADDR_WRITE, &data, 1, I2C_TIMEOUT); +#endif + + cols |= ((~(PINA | 0x80)) & 0x7F); +#if defined(RIGHT_HALF) + cols |= (((~(data | 0x80)) & 0x7F) << 7); +#endif + + current_matrix[row] = cols; + matrix_has_changed |= (last_row_value != current_matrix[row]); + } + + return matrix_has_changed; +} + +void matrix_set_row_status(uint8_t row) { +#if defined(RIGHT_HALF) + uint8_t txdata[3]; + + //Set the remote row on port A + txdata[0] = (GPIOA); + txdata[1] = ( 0xFF & ~(1<. + */ + +#include "split78.h" diff --git a/keyboards/spiderisland/split78/split78.h b/keyboards/spiderisland/split78/split78.h new file mode 100644 index 0000000000..2f6252f0c9 --- /dev/null +++ b/keyboards/spiderisland/split78/split78.h @@ -0,0 +1,36 @@ +/* Copyright 2020 unrelenting.technology + * + * 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 . + */ + +#pragma once + +#include "quantum.h" + +#define LAYOUT( \ + l00, l01, l02, l03, l04, l05, r00, r01, r02, r03, r04, r05, r06, \ + l06, l07, l08, l09, l10, l11, l12, r07, r08, r09, r10, r11, r12, r13, \ + l13, l14, l15, l16, l17, l18, r14, r15, r16, r17, r18, r19, r20, r21, \ + l19, l20, l21, l22, l23, l24, r22, r23, r24, r25, r26, r27, r28, \ + l25, l26, l27, l28, l29, l30, r29, r30, r31, r32, r33, r34, r35, \ + l31, l32, l33, l34, l35, r36, r37, r38, r39, r40, r41 \ +) { \ + { l00, l06, l13, l19, l25, l31, KC_NO, r00, r07, r14, r22, r29, r21 }, \ + { l01, l07, l14, l20, l26, l32, KC_NO, r01, r08, r15, r23, r30, r36 }, \ + { l02, l08, l15, l21, l27, l33, KC_NO, r02, r09, r16, r24, r31, r37 }, \ + { l03, l09, l16, l22, l28, l34, KC_NO, r03, r10, r17, r25, r32, r38 }, \ + { l04, l10, l17, l23, l29, l35, KC_NO, r04, r11, r18, r27, r33, r39 }, \ + { l05, l11, l18, l24, l30, l12, KC_NO, r05, r12, r19, r26, r34, r40 }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, r06, r13, r20, r28, r35, r41 }, \ +} -- cgit v1.2.1