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

gBoards ErgoTaco #8924

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions keyboards/gboards/k/ergotaco/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
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 VERBOSE

/* USB Device descriptor parameter */
#define VENDOR_ID 0x0007
#define PRODUCT_ID 0x0005
#define DEVICE_VER 0x0001
#define MANUFACTURER g Heavy Industries
#define PRODUCT ErgoTaco
#define DESCRIPTION QMK keyboard firmware for ErgoTaco

/* key matrix size */
#define MATRIX_ROWS 12
#define MATRIX_ROWS_PER_SIDE (MATRIX_ROWS / 2)
#define MATRIX_COLS 1

#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 if matrix has ghost */
//#define MATRIX_HAS_GHOST

#define TAPPING_TERM 200
#define IGNORE_MOD_TAP_INTERRUPT // this makes it possible to do rolling combos (zx) with keys that convert to other keys on hold (z becomes ctrl when you hold it, and when this option isn't enabled, z rapidly followed by x actually sends Ctrl-x. That's bad.)

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

/* key combination for command */
#define IS_COMMAND() (get_mods() == MOD_MASK_CTRL || get_mods() == MOD_MASK_SHIFT)

#define DEBOUNCE 5
#define USB_MAX_POWER_CONSUMPTION 500
79 changes: 79 additions & 0 deletions keyboards/gboards/k/ergotaco/ergotaco.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#include QMK_KEYBOARD_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
// set as input with internal pull-up enabled
DDRB &= ~(1 << 4 | 1 << 5 | 1 << 6 | 1 << 7);
PORTB |= (1 << 4 | 1 << 5 | 1 << 6 | 1 << 7);

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

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

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

DDRF &= ~(1 << 0 | 1 << 1 | 1 << 4 | 1 << 6 | 1 << 7);
PORTF |= (1 << 0 | 1 << 1 | 1 << 4 | 1 << 6 | 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);
}

// set pin direction
// - unused : input : 1
// - input : input : 1
// - driving : output : 0
mcp23018_status = i2c_start(I2C_ADDR_WRITE, ERGODOX_EZ_I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(IODIRA, ERGODOX_EZ_I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b00000000, ERGODOX_EZ_I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b11111111, ERGODOX_EZ_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, ERGODOX_EZ_I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(GPPUA, ERGODOX_EZ_I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b00000000, ERGODOX_EZ_I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b11111111, ERGODOX_EZ_I2C_TIMEOUT);
if (mcp23018_status) goto out;

out:
i2c_stop();
// SREG=sreg_prev;
// uprintf("Init %x\n", mcp23018_status);
return mcp23018_status;
}
35 changes: 35 additions & 0 deletions keyboards/gboards/k/ergotaco/ergotaco.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once
#include <util/delay.h>
#include <stdint.h>
#include <stdbool.h>
#include "quantum.h"
#include "i2c_master.h"
#include "matrix.h"

extern i2c_status_t mcp23018_status;
#define ERGODOX_EZ_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 0b0100000
#define I2C_ADDR 0x20
#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

void init_ergodox(void);
uint8_t init_mcp23018(void);

/* ---------- LEFT HAND ----------- ---------- RIGHT HAND ---------- */
#define LAYOUT(L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05) \
\
/* matrix positions */ \
{ {R00}, {R01}, {R02}, {R03}, {R04}, {R05}, {L05}, {L04}, {L03}, {L02}, {L01}, {L00}, }
61 changes: 61 additions & 0 deletions keyboards/gboards/k/ergotaco/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"keyboard_name": "ErgoTaco",
"url": "http://gboards.ca",
"maintainer": "germ",
"width": 13,
"height": 2.75,
"layouts": {
"LAYOUT": {
"layout": [
{
"x": 0,
"y": 1.25
},
{
"x": 1,
"y": 0.75
},
{
"x": 2,
"y": 0.5
},
{
"x": 3,
"y": 0.25
},
{
"x": 4,
"y": 1
},
{
"x": 5,
"y": 1.75
},
{
"x": 7,
"y": 1.75
},
{
"x": 8,
"y": 1
},
{
"x": 9,
"y": 0.25
},
{
"x": 10,
"y": 0.5
},
{
"x": 11,
"y": 0.75
},
{
"x": 12,
"y": 1.25
}
]
}
}
}
42 changes: 42 additions & 0 deletions keyboards/gboards/k/ergotaco/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* 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
*
* There's also a template for adding new layers at the bottom of this file!
*/

#include QMK_KEYBOARD_H

#define FIESTA 0 // default layer
#define TACOTIME 1 // symbols

// Blank template at the bottom
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap template
*
* ,-------------------------------------------------. ,--------------------------------------------.
* | | | | | | | | | | | | | | |
* `-------+------+------+------+------+-------------' `-------+------+------+------+------+--------' */
[FIESTA] = LAYOUT(
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H
),
};

/* Keymap template
*
* ,-------------------------------------------------. ,--------------------------------------------.
* | | | | | | | | | | | | | | |
* `-------+------+------+------+------+-------------' `-------+------+------+------+------+--------'
[FIESTA] = LAYOUT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
*/

// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
};

// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
};
6 changes: 6 additions & 0 deletions keyboards/gboards/k/ergotaco/keymaps/default/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This is the default keymap for the ErgoTaco, Make it your own!

## Settings
To edit various settings, enable the 1u trackball and whatnot please modify /keyboards/ergotaco/keymaps/default/rules.mk

Ideally you should copy this directory and make your changes there. If you come up with a good layout submit a PR!
4 changes: 4 additions & 0 deletions keyboards/gboards/k/ergotaco/keymaps/default/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#Debug options
VERBOSE = yes
DEBUG_MATRIX_SCAN_RATE = no
DEBUG_MATRIX = yes
Loading