Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gBoards GergoPlex firmware #10406

Closed
wants to merge 14 commits into from
55 changes: 55 additions & 0 deletions keyboards/gboards/gergoplex/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
Copyright 2012 Jun Wako <[email protected]>
Copyright 2013 Oleg Kostyuk <[email protected]>

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/>.
*/

// Copy and worked on with love from the EZ team

#pragma once
#include "config_common.h"

#define BOOTMAGIC_LITE_ROW 9
#define BOOTMAGIC_LITE_COLUMN 2

#define VERBOSE

/* USB Device descriptor parameter */
#define VENDOR_ID 0x0007
pirj marked this conversation as resolved.
Show resolved Hide resolved
#define PRODUCT_ID 0x0002
#define DEVICE_VER 0x0001
#define MANUFACTURER g Heavy Industries
#define PRODUCT GergoPlex
#define DESCRIPTION More ErgoGergo
pirj marked this conversation as resolved.
Show resolved Hide resolved

/* key matrix size */
#define MATRIX_ROWS 10
#define MATRIX_ROWS_PER_SIDE (MATRIX_ROWS / 2)
#define MATRIX_COLS 4

#define MOUSEKEY_INTERVAL 20
#define MOUSEKEY_DELAY 0
#define MOUSEKEY_TIME_TO_MAX 60
#define MOUSEKEY_MAX_SPEED 7
#define MOUSEKEY_WHEEL_DELAY 0
#define TAPPING_TOGGLE 1
#define TAPPING_TERM 200
#define IGNORE_MOD_TAP_INTERRUPT
pirj marked this conversation as resolved.
Show resolved Hide resolved
#define LOCKING_SUPPORT_ENABLE
#define LOCKING_RESYNC_ENABLE
#define IS_COMMAND() (get_mods() == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) || get_mods() == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)))

#define DEBOUNCE 5
#define COMBO_TERM 40
80 changes: 80 additions & 0 deletions keyboards/gboards/gergoplex/gergoplex.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#include "gergoplex.h"

bool i2c_initialized = 0;
i2c_status_t mcp23018_status = 0x20;

void matrix_init_kb(void) {
// (tied to Vcc for hardware convenience)
// DDRB &= ~(1<<4); // set B(4) as input
// PORTB &= ~(1<<4); // set B(4) internal pull-up disabled

// unused pins - C7, D4, D5, D7, E6
// set as input with internal pull-up enabled
DDRB &= ~(1 << 0 | 1 << 4 | 1 << 5 | 1 << 6 | 1 << 7);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intend to replace this according to this comment:

We rather use the GPIO control functions: https://docs.qmk.fm/#/internals_gpio_control?id=functions

PORTB |= (1 << 0 | 1 << 4 | 1 << 5 | 1 << 6 | 1 << 7);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what's going on, it's updated in my branch that is linked to this PR https://github.com/pirj/qmk_firmware/blob/prettify-gergoplex/keyboards/gboards/gergoplex/gergoplex.c, but not here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub probably doesn't update closed PRs.


DDRC &= ~(1 << 6);
PORTC |= (1 << 6);

PORTD |= (1 << 5 | 1 << 4 | 1 << 6 | 1 << 7);
DDRD &= ~(1 << 5 | 1 << 4 | 1 << 6 | 1 << 7);

DDRE &= ~(1 << 6);
PORTE |= (1 << 6);

DDRF &= ~(1 << 0 | 1 << 7);
PORTF |= (1 << 0 | 1 << 7);

matrix_init_user();
}
uint8_t init_mcp23018(void) {
print("starting init");
mcp23018_status = 0x20;

// I2C subsystem

// uint8_t sreg_prev;
// sreg_prev=SREG;
// cli();

if (i2c_initialized == 0) {
i2c_init(); // on pins D(1,0)
i2c_initialized = true;
_delay_ms(1000);
}
// i2c_init(); // on pins D(1,0)
// _delay_ms(1000);

// set pin direction
// - unused : input : 1
// - input : input : 1
// - driving : output : 0
mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(IODIRA, I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b11000001, I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b11111111, I2C_TIMEOUT);
if (mcp23018_status) goto out;
i2c_stop();

// set pull-up
// - unused : on : 1
// - input : on : 1
// - driving : off : 0
mcp23018_status = i2c_start(I2C_ADDR_WRITE, I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(GPPUA, I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b11000001, I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b11111111, I2C_TIMEOUT);
if (mcp23018_status) goto out;

out:
i2c_stop();
// SREG=sreg_prev;
// uprintf("Init %x\n", mcp23018_status);
return mcp23018_status;
}
44 changes: 44 additions & 0 deletions keyboards/gboards/gergoplex/gergoplex.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#pragma once

#include "quantum.h"
#include "i2c_master.h"

extern i2c_status_t mcp23018_status;
#define I2C_TIMEOUT 1000
#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
#define CPU_16MHz 0x00

// I2C aliases and register addresses (see "mcp23018.md")
#define I2C_ADDR 0x20 // 0b0100000
#define I2C_ADDR_WRITE ((I2C_ADDR << 1) | I2C_WRITE)
#define I2C_ADDR_READ ((I2C_ADDR << 1) | I2C_READ)
#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

uint8_t init_mcp23018(void);

// Create a keymap using only KC_ prefixed keys
#define LAYOUT_kc( \
L00, L01, L02, L03, L04, R00, R01, R02, R03, R04, \
L10, L11, L12, L13, L14, R10, R11, R12, R13, R14, \
L20, L21, L22, L23, L24, R20, R21, R22, R23, R24, \
L30, L31, L32, R30, R31, R32 \
) \
{ \
{KC_##L04, KC_##L14, KC_##L24, KC_NO}, \
{KC_##L03, KC_##L13, KC_##L23, KC_##L32}, \
{KC_##L02, KC_##L12, KC_##L22, KC_##L31}, \
{KC_##L01, KC_##L11, KC_##L21, KC_##L30}, \
{KC_##L00, KC_##L10, KC_##L20, KC_NO}, \
{KC_##R00, KC_##R10, KC_##R20, KC_NO}, \
{KC_##R01, KC_##R11, KC_##R21, KC_##R30}, \
{KC_##R02, KC_##R12, KC_##R22, KC_##R31}, \
{KC_##R03, KC_##R13, KC_##R23, KC_##R32}, \
{KC_##R04, KC_##R14, KC_##R24, KC_NO}, \
}
pirj marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 12 additions & 0 deletions keyboards/gboards/gergoplex/keymaps/default/combos.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// List any combo dictionaries you want loaded to
// your device below!

// QMK wide includes
#include "combos/germ-vim-helpers.def"
#include "combos/germ-mouse-keys.def"

// User includes
#include "gergoplex.def"

// Word completion
// #include "combos/eng-combos.def"
2 changes: 2 additions & 0 deletions keyboards/gboards/gergoplex/keymaps/default/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define COMBO_ALLOW_ACTION_KEYS
#define COMBO_VARIABLE_LEN
12 changes: 12 additions & 0 deletions keyboards/gboards/gergoplex/keymaps/default/gergoplex.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Gergoplex specfic combos

COMB(opBacksl, KC_BSLS, KC_O, KC_P)
COMB(hjLess, KC_LT, KC_H, KC_J)
COMB(klGreat, KC_GT, KC_K, KC_L)
COMB(xcDash, KC_MINS, KC_X, KC_C)
COMB(mcUnds, KC_UNDS, KC_M, KC_COMM)
COMB(nmQuot, KC_QUOT, KC_N, KC_M)
COMB(gbClic, KC_BTN1, KC_G, KC_B)
COMB(fvClic, KC_BTN2, KC_F, KC_V)

SUBS(pasta, "I'd just like to interject for a moment.", KC_H, KC_J, KC_K, KC_L)
118 changes: 118 additions & 0 deletions keyboards/gboards/gergoplex/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/* Good on you for modifying your layout! if you don't have
* time to read the QMK docs, a list of keycodes can be found at
* https://github.com/qmk/qmk_firmware/blob/master/docs/keycodes.md
*/

#include "gergoplex.h"
#include "g/keymap_combo.h"


enum {
_ALPHA, // default
_SPECIAL, // special characters
_NUMBERS // numbers/function/motion
};

#define KC_CTL_A MT(MOD_LCTL, KC_A) // Tap for A, hold for Control
#define KC_CTL_CL MT(MOD_LCTL, KC_SCLN) // Tap for colon, hold for Control
#define KC_SFT_Z MT(MOD_RSFT, KC_Z) // Tap for Z, hold for Shift
#define KC_SFT_SL MT(MOD_RSFT, KC_SLSH) // Tap for slash, hold for Shift

#define KC_GUI_ESC MT(MOD_LGUI, KC_ESC) // Tap for Esc, hold for GUI (Meta, Command, Win)
#define KC_ALT_ENT MT(MOD_LALT, KC_ENT) // Tap for Enter, hold for Alt (Option)
#define KC_SYM_SPC LT(_SPECIAL, KC_SPC) // Tap for Space, hold for Symbol layer
#define KC_NUM_SPC LT(_NUMBERS, KC_SPC) // Tap for Space, hold for Numbers layer
#define KC_SFT_TAB MT(MOD_RSFT, KC_TAB) // Tap for Tab, hold for Right Shift

#define KC_CMB_TOG CMB_TOG // A hack to allow KC_-less keycode along with KC_-ful ones

/* Combomap
*
* ,-------------------------------. ,-------------------------------.
* | | ESC | | | | | ESC | BSLH |
* |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------|
* | | BSPC ENT | | | LES COLN GRT | |
* |-------+-----+-----+-RMB-+-LMB-| |-----+-----+-----+-----+-------|
* | | MINS | | | | QUO UNDR | | |
* `-------------------------------' `-------------------------------'
* .-----------------. .-----------------.
* | | | | | | | |
* '-----------------' '-----------------'
*/

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Alpha layer
*
* ,-------------------------------. ,-------------------------------.
* | Q | W | E | R | T | | Y | U | I | O | P |
* |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------|
* | CTRL A| S | D | F | G | | H | J | K | L |CTRL ; |
* |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------|
* | SHFT Z| X | C | V | B | | N | M | < | > |SHFT / |
* `-------------------------------' `-------------------------------'
* .------------------------------. .----------------------.
* | ESC META | ENT ALT | SPC SYM | | SPC NUM | SHFT | TAB |
* '------------------------------' '----------------------'
*/
[_ALPHA] = LAYOUT_kc(
// ,-------------------------------. ,-------------------------------.
Q , W , E , R , T , Y , U , I , O , P ,
// |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------|
CTL_A , S , D , F , G , H , J , K , L , CTL_CL,
// |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------|
SFT_Z , X , C , V , B , N , M ,COMMA, DOT , SFT_SL,
// '-------------------------------' '-------------------------------'
// .---------------------------. .------------------------.
GUI_ESC, ALT_ENT, SYM_SPC , NUM_SPC, LSFT, SFT_TAB ),
// '---------------------------' '------------------------'

/* Keymap 1: Special characters layer
*
* ,-------------------------------. ,-------------------------------.
* | ! | @ | { | } | | | | ` | ~ | | | \ |
* |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------|
* | # | $ | ( | ) | RMB | | + | - | / | * | ' |
* |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------|
* | % | ^ | [ | ] | LMB | | & | = | , | . | - |
* `-------------------------------' `-------------------------------'
* .-------------------------. .-----------------.
* | ComboToggle | ; | = | | = | ; | DEL |
* '-------------------------' '-----------------'
*/
[_SPECIAL] = LAYOUT_kc(
// ,-------------------------------. ,-------------------------------.
EXLM , AT , LCBR, RCBR, PIPE, GRV , TILD, TRNS, TRNS, BSLS ,
// |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------|
HASH , DLR , LPRN, RPRN, BTN2, PLUS, MINS, SLSH, ASTR, QUOT ,
// |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------|
PERC , CIRC, LBRC, RBRC, BTN1, AMPR, EQL , COMM, DOT , MINS ,
// '-------------------------------' '-------------------------------'
// .---------------------------. .------------------------.
CMB_TOG, SCLN , EQL , EQL , SCLN , DEL ),
// '---------------------------' '------------------------'

/* Keymap 2: Numbers/Function/Motion layer
*
* ,-------------------------------. ,-------------------------------.
* | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 |
* |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------|
* | F1 | F2 | F3 | F4 | F5 | | LFT | DWN | UP | RGT | VOLUP |
* |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------|
* | F6 | F7 | F8 | F9 | F10 | | MLFT| MDWN| MUP | MRGT| VOLDN |
* `-------------------------------' `-------------------------------'
* .-----------------. .-----------------.
* | F11 | F12 | | | | PLY | SKP |
* '-----------------' '-----------------'
*/
[_NUMBERS] = LAYOUT_kc(
// ,-------------------------------. ,-------------------------------.
1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,
// |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------|
F1 , F2 , F3 , F4 , F5 , LEFT, DOWN, UP , RGHT, VOLU ,
// |-------+-----+-----+-----+-----| |-----+-----+-----+-----+-------|
F6 , F7 , F8 , F9 , F10 , MS_L, MS_D, MS_U, MS_R, VOLD ,
// '-------------------------------' '-------------------------------'
// .---------------------------. .------------------------.
F11 , F12 , TRNS , TRNS , MPLY , MNXT )
// '---------------------------' '------------------------'
};
19 changes: 19 additions & 0 deletions keyboards/gboards/gergoplex/keymaps/default/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#----------------------------------------------------------------------------
# make gboards/gergoplex:default:flash
# Make sure you have dfu-programmer installed!
#----------------------------------------------------------------------------
# Firmware options
MOUSEKEY_ENABLE = no

#Debug options
VERBOSE = yes
DEBUG_MATRIX_SCAN_RATE = no
DEBUG_MATRIX = no
CONSOLE_ENABLE = no

#Combos!
VPATH += keyboards/gboards/

ifeq ($(strip $(DEBUG_MATRIX)), yes)
OPT_DEFS += -DDEBUG_MATRIX
endif
4 changes: 4 additions & 0 deletions keyboards/gboards/gergoplex/keymaps/default/testing.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Gergoplex specfic combos

COMB(overlap1, KC_Q, KC_B, KC_V)
COMB(overlap2, KC_R, KC_C, KC_V, KC_B)
Loading