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 BuzzSaw #8923

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 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
74 changes: 74 additions & 0 deletions keyboards/gboards/k/buzzsaw/buzzsaw.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#include QMK_KEYBOARD_H

bool i2c_initialized = 0;
i2c_status_t mcp23018_status = 0x20;

void matrix_init_kb(void) {
// unused pins - C7, D4, D5, D7, E6
// set as input with internal pull-up enabled
setPinInput(B4);
writePinLow(B4);

setPinInput(B5);
writePinLow(B5);

setPinInput(B6);
writePinLow(B6);

setPinInput(B7);
writePinLow(B7);

setPinInput(D5);
writePinLow(D5);

setPinInput(D6);
writePinLow(D6);

setPinInput(D7);
writePinLow(D7);

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

// I2C subsystem
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, I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(IODIRA, I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b10000000, 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(0b10000000, 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;
}
36 changes: 36 additions & 0 deletions keyboards/gboards/k/buzzsaw/buzzsaw.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once

#include "quantum.h"
#include <stdint.h>
#include <stdbool.h>
#include "i2c_master.h"
#include <util/delay.h>

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

uint8_t init_mcp23018(void);

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

/* ---------- LEFT HAND ----------- ---------- RIGHT HAND ---------- */
#define LAYOUT_buzzsaw(N00, N01, N02, N03, N04, N05, N06, N07, N08, N09, N10, N11, N12, N13, N14, A01, L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, R06, R07, A02, L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, R16, A03, L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, K00, L30, L31, L32, L33, R30, R31, K01, K02, K03) \
{ \
{N06, KC_NO, KC_NO, KC_NO, KC_NO}, {N05, L05, L15, L25, KC_NO}, {N04, L04, L14, L24, KC_NO}, {N03, L03, L13, L23, L33}, {N02, L02, L12, L22, L32}, {N01, L01, L11, L21, L31}, {N00, L00, L10, L20, L30}, \
\
{N07, R00, R10, R20, R30}, {N08, R01, R11, R21, R31}, {N09, R02, R12, R22, K01}, {N10, R03, R13, R23, K02}, {N11, R04, R14, R24, K03}, {N12, R05, R15, R25, KC_NO}, {N13, R06, R16, K00, KC_NO}, {N14, R07, A03, KC_NO, KC_NO}, {A01, A02, KC_NO, KC_NO, KC_NO}, \
}
69 changes: 69 additions & 0 deletions keyboards/gboards/k/buzzsaw/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
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 13
#define BOOTMAGIC_LITE_COLUMN 2

#ifndef SCROLLSTEP
# define SCROLLSTEP 1
#endif

#define VERBOSE

/* USB Device descriptor parameter */
#define VENDOR_ID 0x0007
#define PRODUCT_ID 0x0004
#define DEVICE_VER 0x0001
#define MANUFACTURER g Heavy Industries
#define PRODUCT BuzzSaw
#define DESCRIPTION Crouching Alice, Hidden Gergo

/* key matrix size */
#define MATRIX_ROWS 16
#define MATRIX_COLS 6
#define MATRIX_LEFT 7
#define MATRIX_RIGHT 9

#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_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) || get_mods() == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)))

#define DEBOUNCE 5
#define USB_MAX_POWER_CONSUMPTION 500
3 changes: 3 additions & 0 deletions keyboards/gboards/k/buzzsaw/keymaps/default/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

#define IGNORE_MOD_TAP_INTERRUPT
35 changes: 35 additions & 0 deletions keyboards/gboards/k/buzzsaw/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* 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 BASE 0 // default layer

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
*
* ,--------------------------------. ,-------------------------------. .---.
* | ESC | 1 | 2 | 3 | 4 | 5 | 6 | | 7 | 8 | 9 | 0 | - | = | + |BSP| |ESC|
* |--------------------------------' |-------------------------------| |---|
* | TAB | Q | W | E | R | T | | Y | U | I | O | P | [ | ] | | | |INS|
* |----------------------------| |-------------------------------| |---|
* | CAPS | A | S | D | F | G | | H | J | K | L | ; | " | RET | |DEL|
* |----------------------------| |-------------------------------| '---'
* | Shift | Z | X | C | V | B | | B | N | M | < | > | ? | .---.
* |----------------------------' '-----------------------'--. |UP |
* | CNTL |ALT| 0 |COD| |SPC| ALT | CTL | .---|---|---|
* '--------------------' '----------------' |LFT|DWN|RGT|
* '-----------'
*/
[BASE] = LAYOUT_buzzsaw(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_PPLS, KC_PMNS, KC_BSPC, KC_ESC,
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_NUBS, KC_INS,
KC_CAPS,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_DEL,
KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP,
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_RALT, KC_LEFT,KC_DOWN, KC_RIGHT)
};
23 changes: 23 additions & 0 deletions keyboards/gboards/k/buzzsaw/keymaps/default/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#----------------------------------------------------------------------------
# make gergo:germ:dfu
# Make sure you have dfu-programmer installed!
#----------------------------------------------------------------------------
# Firmware options
BALLER = no # Enable to ball out
BALLSTEP = 20 # Multiple in px to move, multiplied by layer number
SCROLLSTEP = 1 # Lines to scroll with ball
MOUSEKEY_ENABLE = yes # Mouse keys(+4700), needed for baller

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

# A bunch of stuff that you shouldn't touch unless you
# know what you're doing.
#
# No touchy, capiche?
ifeq ($(strip $(DEBUG_MATRIX)), yes)
OPT_DEFS += -DDEBUG_MATRIX
endif
Loading