Skip to content

Commit

Permalink
[Keyboard] Add Spider Island split 78 key ps2avrGB based keyboard (qm…
Browse files Browse the repository at this point in the history
  • Loading branch information
valpackett authored Sep 23, 2020
1 parent 064d69d commit 2012b9c
Show file tree
Hide file tree
Showing 8 changed files with 427 additions and 0 deletions.
35 changes: 35 additions & 0 deletions keyboards/spiderisland/split78/config.h
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

#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
94 changes: 94 additions & 0 deletions keyboards/spiderisland/split78/info.json
Original file line number Diff line number Diff line change
@@ -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}
]
}
}
}
41 changes: 41 additions & 0 deletions keyboards/spiderisland/split78/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/
#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
)
};
155 changes: 155 additions & 0 deletions keyboards/spiderisland/split78/matrix.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
/*
Copyright 2017 Luiz Ribeiro <luizribeiro@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 <string.h>
#include <stdio.h>
#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<<row) );
i2c_transmit(TWI_ADDR_WRITE, (uint8_t *)txdata, 2, I2C_TIMEOUT);
#endif

//Set the local row on port B
DDRB = (1 << row);
PORTB = ~(1 << row);
}
25 changes: 25 additions & 0 deletions keyboards/spiderisland/split78/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# SpiderIsland Split 78-key

![Board Photo](https://i.imgur.com/N3DjdGql.jpg)
[Image Gallery](https://imgur.com/a/0AUY8Ng)

The 78 key split keyboard from [SpiderIsland on AliExpress](https://a.aliexpress.com/_dVJsSpR).
Out of the box it runs ps2avrGB firmware, like [`split75`](../../wheatfield/split75/README.md).
It is mistakenly called "87 key" on the AliExpress title and "104 key" (?!) in the caption inside the photo.

This port is based on the `split75` port which was mostly done by [Michael L. Walker](https://github.com/walkerstop).

* Keyboard Maintainer: [unrelenting.technology](https://github.com/myfreeweb)
* Hardware Availability: https://a.aliexpress.com/_dVJsSpR

Make example for this keyboard (after setting up your build environment):

make spiderisland/split78:default

Flashing example for this keyboard ([after setting up the bootloadHID flashing environment](https://docs.qmk.fm/#/flashing_bootloadhid))

make spiderisland/split78:default:flash

**Reset Key**: Hold down the key located at the leftmost position in the top row, commonly programmed as Escape while plugging in the keyboard.

See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
24 changes: 24 additions & 0 deletions keyboards/spiderisland/split78/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# MCU name
MCU = atmega32a

# Bootloader selection
BOOTLOADER = bootloadHID

# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
WS2812_DRIVER = i2c

# custom matrix setup
CUSTOM_MATRIX = lite
SRC += matrix.c
QUANTUM_LIB_SRC += i2c_master.c
17 changes: 17 additions & 0 deletions keyboards/spiderisland/split78/split78.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* 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 <http://www.gnu.org/licenses/>.
*/

#include "split78.h"
Loading

0 comments on commit 2012b9c

Please sign in to comment.