Skip to content

Commit

Permalink
[Keyboard] Update Gergo to use newer Ergodox Matrix code (qmk#5703)
Browse files Browse the repository at this point in the history
* [Keyboard] Update Gergo to use newer Ergodox Matrix code

And update layout macros to be correct

* Almost forgot the json file

* Remove board specific defines for i2c timeout
  • Loading branch information
drashna authored and foosinn committed May 6, 2019
1 parent 7938c42 commit b96d1fc
Show file tree
Hide file tree
Showing 12 changed files with 317 additions and 453 deletions.
16 changes: 8 additions & 8 deletions keyboards/gergo/gergo.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ uint8_t init_mcp23018(void) {
// - 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(0b10000000, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b11111111, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out;
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, 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(0b10000000, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b11111111, ERGODOX_EZ_I2C_TIMEOUT); if (mcp23018_status) goto out;
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();
Expand Down
18 changes: 7 additions & 11 deletions keyboards/gergo/gergo.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#pragma once
#include <util/delay.h>

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


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

Expand All @@ -26,18 +26,14 @@ extern i2c_status_t mcp23018_status;
#define OLATA 0x14 // output latch register
#define OLATB 0x15

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

/* ---------- LEFT HAND ----------- ---------- RIGHT HAND ---------- */
#define LAYOUT_GERGO( \
#define LAYOUT_gergo( \
L00,L01,L02,L03,L04,L05, R00,R01,R02,R03,R04,R05, \
L10,L11,L12,L13,L14,L15,L16, R10,R11,R12,R13,R14,R15,R16, \
L20,L21,L22,L23,L24,L25,L26, R20,R21,R22,R23,R24,R25,R26, \
L31,L32, R33,R34, \
L30, R30, \
L33,L34, R31,R32) \
\
L20,L21,L22,L23,L24,L25,L26,L30, R30,R20,R21,R22,R23,R24,R25,R26, \
L31,L32,L33,L34, R31,R32,R33,R34) \
/* matrix positions */ \
{ \
{ KC_NO, L16, L26, L30}, \
Expand Down
178 changes: 0 additions & 178 deletions keyboards/gergo/i2cmaster.h

This file was deleted.

42 changes: 21 additions & 21 deletions keyboards/gergo/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"keyboard_name": "Gergo",
"url": "http://gboards.ca",
"layouts": {
"LAYOUT_GERGO": {
"LAYOUT_gergo": {
"layout": [
{
"label": "L00",
Expand Down Expand Up @@ -180,6 +180,16 @@
"x": 6.5,
"y": 1.75
},
{
"label": "L30",
"x": 8.25,
"y": 2.75
},
{
"label": "R30",
"x": 10.25,
"y": 2.75
},
{
"h": 1.5,
"label": "R20",
Expand Down Expand Up @@ -227,26 +237,6 @@
"x": 6,
"y": 3.63
},
{
"label": "R33",
"x": 12.5,
"y": 3.63
},
{
"label": "R34",
"x": 13.75,
"y": 3.25
},
{
"label": "L30",
"x": 8.25,
"y": 2.75
},
{
"label": "R30",
"x": 10.25,
"y": 2.75
},
{
"h": 2,
"label": "L33",
Expand All @@ -270,6 +260,16 @@
"label": "R32",
"x": 11.25,
"y": 3.75
},
{
"label": "R33",
"x": 12.5,
"y": 3.63
},
{
"label": "R34",
"x": 13.75,
"y": 3.25
}
]
}
Expand Down
3 changes: 3 additions & 0 deletions keyboards/gergo/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
Loading

0 comments on commit b96d1fc

Please sign in to comment.