summaryrefslogtreecommitdiffstats
path: root/keyboards/ktec/ergodone
diff options
context:
space:
mode:
authorpeepeetee <43021794+peepeetee@users.noreply.github.com>2021-08-21 22:53:49 -0500
committerGitHub <noreply@github.com>2021-08-22 13:53:49 +1000
commit78ccd9c201199444bc06161b05ee8d7ba9c31613 (patch)
tree726d9e55d8cde510fe72bc1fb9bb2a7dabdbecc2 /keyboards/ktec/ergodone
parentc70abc8d047319830e369ae4e14cd43bae3bd3b8 (diff)
Organize KPrepublic, K.T.E.C, xiudi boards into directories (#12159)
* reset; redoing my steps; and recommit * include xd002/.noci
Diffstat (limited to 'keyboards/ktec/ergodone')
-rw-r--r--keyboards/ktec/ergodone/config.h81
-rw-r--r--keyboards/ktec/ergodone/ergodone.c54
-rw-r--r--keyboards/ktec/ergodone/ergodone.h182
-rw-r--r--keyboards/ktec/ergodone/expander.c120
-rw-r--r--keyboards/ktec/ergodone/expander.h48
-rw-r--r--keyboards/ktec/ergodone/i2cmaster.h178
-rw-r--r--keyboards/ktec/ergodone/info.json107
-rw-r--r--keyboards/ktec/ergodone/keymaps/art/keymap.c446
-rw-r--r--keyboards/ktec/ergodone/keymaps/default/keymap.c199
-rw-r--r--keyboards/ktec/ergodone/keymaps/default/readme.md15
-rw-r--r--keyboards/ktec/ergodone/keymaps/eozaki/keymap.c201
-rw-r--r--keyboards/ktec/ergodone/keymaps/eozaki/readme.md13
-rw-r--r--keyboards/ktec/ergodone/keymaps/erovia/config.h3
-rw-r--r--keyboards/ktec/ergodone/keymaps/erovia/keymap.c229
-rw-r--r--keyboards/ktec/ergodone/keymaps/erovia/readme.md76
-rw-r--r--keyboards/ktec/ergodone/keymaps/erovia/rules.mk1
-rw-r--r--keyboards/ktec/ergodone/keymaps/kloki/keymap.c219
-rw-r--r--keyboards/ktec/ergodone/keymaps/kloki/readme.md7
-rw-r--r--keyboards/ktec/ergodone/keymaps/vega/keymap.c555
-rw-r--r--keyboards/ktec/ergodone/keymaps/vega/rules.mk2
-rw-r--r--keyboards/ktec/ergodone/keymaps/via/config.h18
-rw-r--r--keyboards/ktec/ergodone/keymaps/via/keymap.c196
-rw-r--r--keyboards/ktec/ergodone/keymaps/via/readme.md5
-rw-r--r--keyboards/ktec/ergodone/keymaps/via/rules.mk2
-rw-r--r--keyboards/ktec/ergodone/matrix.c256
-rw-r--r--keyboards/ktec/ergodone/readme.md33
-rw-r--r--keyboards/ktec/ergodone/rules.mk37
-rw-r--r--keyboards/ktec/ergodone/twimaster.c208
28 files changed, 3491 insertions, 0 deletions
diff --git a/keyboards/ktec/ergodone/config.h b/keyboards/ktec/ergodone/config.h
new file mode 100644
index 0000000000..39e0ae8c75
--- /dev/null
+++ b/keyboards/ktec/ergodone/config.h
@@ -0,0 +1,81 @@
+#ifndef ERGODOX_ERGODONE_CONFIG_H
+#define ERGODOX_ERGODONE_CONFIG_H
+
+#include "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0x1209
+#define PRODUCT_ID 0x2328
+// The official ErgoDone VID and PID are documented at http://pid.codes/1209/2328/.
+#define DEVICE_VER 0x0001
+#define MANUFACTURER K.T.E.C.
+#define PRODUCT ErgoDone
+
+/* key matrix size */
+#define MATRIX_ROWS 6
+#define MATRIX_COLS 14
+
+#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)) \
+)
+
+/* number of backlight levels */
+#define BACKLIGHT_LEVELS 3
+
+#define LED_BRIGHTNESS_LO 15
+#define LED_BRIGHTNESS_HI 255
+
+/* fix space cadet rollover issue */
+#define DISABLE_SPACE_CADET_ROLLOVER
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCE 5
+
+#define USB_MAX_POWER_CONSUMPTION 500
+
+/* NKRO */
+#ifndef FORCE_NKRO
+ #define FORCE_NKRO // Depends on NKRO_ENABLE.
+#endif
+
+/*
+ * Feature disable options
+ * These options are also useful to firmware size reduction.
+ */
+
+/* disable debug print */
+// #define NO_DEBUG
+
+/* disable print */
+// #define NO_PRINT
+
+/* disable action features */
+//#define NO_ACTION_LAYER
+//#define NO_ACTION_TAPPING
+//#define NO_ACTION_ONESHOT
+//#define NO_ACTION_MACRO
+//#define NO_ACTION_FUNCTION
+//#define DEBUG_MATRIX_SCAN_RATE
+
+#endif
diff --git a/keyboards/ktec/ergodone/ergodone.c b/keyboards/ktec/ergodone/ergodone.c
new file mode 100644
index 0000000000..e0579408e5
--- /dev/null
+++ b/keyboards/ktec/ergodone/ergodone.c
@@ -0,0 +1,54 @@
+#include "ergodone.h"
+
+extern inline void ergodox_board_led_on(void);
+extern inline void ergodox_right_led_1_on(void);
+extern inline void ergodox_right_led_2_on(void);
+extern inline void ergodox_right_led_3_on(void);
+extern inline void ergodox_right_led_on(uint8_t led);
+
+extern inline void ergodox_board_led_off(void);
+extern inline void ergodox_right_led_1_off(void);
+extern inline void ergodox_right_led_2_off(void);
+extern inline void ergodox_right_led_3_off(void);
+extern inline void ergodox_right_led_off(uint8_t led);
+
+extern inline void ergodox_led_all_off(void);
+
+void ergodox_led_init(void);
+void ergodox_blink_all_leds(void);
+
+void matrix_init_kb(void) {
+ ergodox_led_init();
+ ergodox_blink_all_leds();
+ matrix_init_user();
+}
+
+void ergodox_led_init(void)
+ {
+ DDRB |= (1<<PB5 | 1<<PB6 | 1<<PB3);
+ PORTB &= ~(1<<PB5 | 1<<PB6 | 1<<PB3);
+ DDRB |= (1<<PB0);
+ PORTB |= (1<<PB0);
+ DDRD |= (1<<PB5);
+ PORTD |= (1<<PB5);
+}
+
+void ergodox_blink_all_leds(void)
+{
+ ergodox_led_all_off();
+ ergodox_led_all_set(LED_BRIGHTNESS_HI);
+ ergodox_right_led_1_on();
+ _delay_ms(50);
+ ergodox_right_led_2_on();
+ _delay_ms(50);
+ ergodox_right_led_3_on();
+ _delay_ms(50);
+ ergodox_right_led_1_off();
+ _delay_ms(50);
+ ergodox_right_led_2_off();
+ _delay_ms(50);
+ ergodox_right_led_3_off();
+ //ergodox_led_all_on();
+ //_delay_ms(333);
+ ergodox_led_all_off();
+}
diff --git a/keyboards/ktec/ergodone/ergodone.h b/keyboards/ktec/ergodone/ergodone.h
new file mode 100644
index 0000000000..f88280fa2a
--- /dev/null
+++ b/keyboards/ktec/ergodone/ergodone.h
@@ -0,0 +1,182 @@
+#ifndef ERGODOX_ERGODONE_H
+#define ERGODOX_ERGODONE_H
+
+#include "quantum.h"
+#include <stdint.h>
+#include <stdbool.h>
+
+#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
+#define CPU_16MHz 0x00
+
+void init_ergodox(void);
+
+inline void ergodox_right_led_1_off(void) { DDRB &= ~(1<<PB5); PORTB &= ~(1<<PB5); }
+inline void ergodox_right_led_1_on(void) { DDRB |= (1<<PB5); PORTB |= (1<<PB5); }
+inline void ergodox_right_led_2_off(void) { DDRB &= ~(1<<PB6); PORTB &= ~(1<<PB6); }
+inline void ergodox_right_led_2_on(void) { DDRB |= (1<<PB6); PORTB |= (1<<PB6); }
+inline void ergodox_right_led_3_off(void) { DDRB &= ~(1<<PB3); PORTB &= ~(1<<PB3); }
+inline void ergodox_right_led_3_on(void) { DDRB |= (1<<PB3); PORTB |= (1<<PB3); }
+inline void ergodox_right_led_on(uint8_t l) {
+ switch (l) {
+ case 1:
+ ergodox_right_led_1_on();
+ break;
+ case 2:
+ ergodox_right_led_2_on();
+ break;
+ case 3:
+ ergodox_right_led_3_on();
+ break;
+ default:
+ break;
+ }
+}
+
+inline void ergodox_right_led_off(uint8_t l) {
+ switch (l) {
+ case 1:
+ ergodox_right_led_1_off();
+ break;
+ case 2:
+ ergodox_right_led_2_off();
+ break;
+ case 3:
+ ergodox_right_led_3_off();
+ break;
+ default:
+ break;
+ }
+}
+inline void ergodox_board_led_off(void) { DDRB &= ~(1<<PB0); PORTB |= (1<<PB0); }
+inline void ergodox_board_led_on(void) { DDRB |= (1<<PB0); PORTB &= ~(1<<PB0); }
+inline void ergodox_led_all_on(void) {
+ ergodox_right_led_1_on();
+ ergodox_right_led_2_on();
+ ergodox_right_led_3_on();
+ ergodox_board_led_on();
+}
+inline void ergodox_led_all_off(void) {
+ ergodox_right_led_1_off();
+ ergodox_right_led_2_off();
+ ergodox_right_led_3_off();
+ ergodox_board_led_off();
+}
+inline void ergodox_right_led_1_set(uint8_t n) {}
+inline void ergodox_right_led_2_set(uint8_t n) {}
+inline void ergodox_right_led_3_set(uint8_t n) {}
+inline void ergodox_right_led_set(uint8_t l, uint8_t n) {}
+inline void ergodox_led_all_set(uint8_t n) {}
+
+/*
+ * LEFT HAND: LINES 76-83
+ * RIGHT HAND: LINES 85-92
+ */
+#define LAYOUT_ergodox( \
+ \
+ k00,k01,k02,k03,k04,k05,k06, \
+ k10,k11,k12,k13,k14,k15,k16, \
+ k20,k21,k22,k23,k24,k25, \
+ k30,k31,k32,k33,k34,k35,k36, \
+ k40,k41,k42,k43,k44, \
+ k55,k56, \
+ k54, \
+ k53,k52,k51, \
+ \
+ k07,k08,k09,k0A,k0B,k0C,k0D, \
+ k17,k18,k19,k1A,k1B,k1C,k1D, \
+ k28,k29,k2A,k2B,k2C,k2D, \
+ k37,k38,k39,k3A,k3B,k3C,k3D, \
+ k49,k4A,k4B,k4C,k4D, \
+ k57,k58, \
+ k59, \
+ k5C,k5B,k5A ) \
+ \
+ /* matrix positions */ \
+ { \
+ { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D }, \
+ { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D }, \
+ { k20, k21, k22, k23, k24, k25, KC_NO, KC_NO, k28, k29, k2A, k2B, k2C, k2D }, \
+ { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D }, \
+ { k40, k41, k42, k43, k44, KC_NO, KC_NO, KC_NO, KC_NO, k49, k4A, k4B, k4C, k4D }, \
+ { KC_NO, k51, k52, k53, k54, k55, k56, k57, k58, k59, k5A, k5B, k5C, KC_NO } \
+ }
+
+/*
+ * LEFT HAND: LINES 110-117
+ * RIGHT HAND: LINES 119-126
+ */
+#define LAYOUT_ergodox_80( \
+ \
+ k00,k01,k02,k03,k04,k05,k06, \
+ k10,k11,k12,k13,k14,k15,k16, \
+ k20,k21,k22,k23,k24,k25, \
+ k30,k31,k32,k33,k34,k35,k36, \
+ k40,k41,k42,k43,k44, \
+ k55,k56, \
+ k45,k46,k54, \
+ k53,k52,k51, \
+ \
+ k07,k08,k09,k0A,k0B,k0C,k0D, \
+ k17,k18,k19,k1A,k1B,k1C,k1D, \
+ k28,k29,k2A,k2B,k2C,k2D, \
+ k37,k38,k39,k3A,k3B,k3C,k3D, \
+ k49,k4A,k4B,k4C,k4D, \
+ k57,k58, \
+ k59,k47,k48, \
+ k5C,k5B,k5A ) \
+ \
+ /* matrix positions */ \
+ { \
+ { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D }, \
+ { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D }, \
+ { k20, k21, k22, k23, k24, k25, KC_NO, KC_NO, k28, k29, k2A, k2B, k2C, k2D }, \
+ { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D }, \
+ { k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4A, k4B, k4C, k4D }, \
+ { KC_NO, k51, k52, k53, k54, k55, k56, k57, k58, k59, k5A, k5B, k5C, KC_NO } \
+ }
+
+/* ---------- LEFT HAND ----------- ---------- RIGHT HAND ---------- */
+#define LAYOUT_ergodox_pretty( \
+ \
+ L00,L01,L02,L03,L04,L05,L06, R00,R01,R02,R03,R04,R05,R06, \
+ L10,L11,L12,L13,L14,L15,L16, R10,R11,R12,R13,R14,R15,R16, \
+ L20,L21,L22,L23,L24,L25, R21,R22,R23,R24,R25,R26, \
+ L30,L31,L32,L33,L34,L35,L36, R30,R31,R32,R33,R34,R35,R36, \
+ L40,L41,L42,L43,L44, R42,R43,R44,R45,R46, \
+ L55,L56, R50,R51, \
+ L54, R52, \
+ L53,L52,L51, R55,R54,R53 ) \
+ \
+ /* matrix positions */ \
+ { \
+ { L00,L01,L02,L03,L04,L05,L06, R00,R01,R02,R03,R04,R05,R06 }, \
+ { L10,L11,L12,L13,L14,L15,L16, R10,R11,R12,R13,R14,R15,R16 }, \
+ { L20,L21,L22,L23,L24,L25,KC_NO, KC_NO,R21,R22,R23,R24,R25,R26 }, \
+ { L30,L31,L32,L33,L34,L35,L36, R30,R31,R32,R33,R34,R35,R36 }, \
+ { L40,L41,L42,L43,L44,KC_NO,KC_NO, KC_NO,KC_NO,R42,R43,R44,R45,R46 }, \
+ { KC_NO,L51,L52,L53,L54,L55,L56, R50,R51,R52,R53,R54,R55,KC_NO } \
+ }
+
+/* ---------- LEFT HAND ----------- ---------- RIGHT HAND ---------- */
+#define LAYOUT_ergodox_pretty_80( \
+ \
+ L00,L01,L02,L03,L04,L05,L06, R00,R01,R02,R03,R04,R05,R06, \
+ L10,L11,L12,L13,L14,L15,L16, R10,R11,R12,R13,R14,R15,R16, \
+ L20,L21,L22,L23,L24,L25, R21,R22,R23,R24,R25,R26, \
+ L30,L31,L32,L33,L34,L35,L36, R30,R31,R32,R33,R34,R35,R36, \
+ L40,L41,L42,L43,L44, R42,R43,R44,R45,R46, \
+ L55,L56, R50,R51, \
+ L45,L46,L54, R52,R40,R41, \
+ L53,L52,L51, R55,R54,R53 ) \
+ \
+ /* matrix positions */ \
+ { \
+ { L00,L01,L02,L03,L04,L05,L06, R00,R01,R02,R03,R04,R05,R06 }, \
+ { L10,L11,L12,L13,L14,L15,L16, R10,R11,R12,R13,R14,R15,R16 }, \
+ { L20,L21,L22,L23,L24,L25,KC_NO, KC_NO,R21,R22,R23,R24,R25,R26 }, \
+ { L30,L31,L32,L33,L34,L35,L36, R30,R31,R32,R33,R34,R35,R36 }, \
+ { L40,L41,L42,L43,L44,L45,L46, R40,R41,R42,R43,R44,R45,R46 }, \
+ { KC_NO,L51,L52,L53,L54,L55,L56, R50,R51,R52,R53,R54,R55,KC_NO } \
+ }
+
+#endif
diff --git a/keyboards/ktec/ergodone/expander.c b/keyboards/ktec/ergodone/expander.c
new file mode 100644
index 0000000000..0c8a2289c5
--- /dev/null
+++ b/keyboards/ktec/ergodone/expander.c
@@ -0,0 +1,120 @@
+#include <stdbool.h>
+#include "action.h"
+#include "i2cmaster.h"
+#include "expander.h"
+#include "debug.h"
+
+static uint8_t expander_status = 0;
+static uint8_t expander_input = 0;
+
+void expander_config(void);
+uint8_t expander_write(uint8_t reg, uint8_t data);
+uint8_t expander_read(uint8_t reg, uint8_t *data);
+
+void expander_init(void)
+{
+ i2c_init();
+ expander_scan();
+}
+
+void expander_scan(void)
+{
+ dprintf("expander status: %d ... ", expander_status);
+ uint8_t ret = i2c_start(EXPANDER_ADDR | I2C_WRITE);
+ if (ret == 0) {
+ i2c_stop();
+ if (expander_status == 0) {
+ dprintf("attached\n");
+ expander_status = 1;
+ expander_config();
+ clear_keyboard();
+ }
+ }
+ else {
+ if (expander_status == 1) {
+ dprintf("detached\n");
+ expander_status = 0;
+ clear_keyboard();
+ }
+ }
+ dprintf("%d\n", expander_status);
+}
+
+void expander_read_cols(void)
+{
+ expander_read(EXPANDER_REG_GPIOA, &expander_input);
+}
+
+uint8_t expander_get_col(uint8_t col)
+{
+ if (col > 4) {
+ col++;
+ }
+ return expander_input & (1<<col) ? 1 : 0;
+}
+
+matrix_row_t expander_read_row(void)
+{
+ expander_read_cols();
+
+ /* make cols */
+ matrix_row_t cols = 0;
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) {
+ if (expander_get_col(col)) {
+ cols |= (1UL << (MATRIX_COLS - 1 - col));
+ }
+ }
+
+ return cols;
+}
+
+void expander_unselect_rows(void)
+{
+ expander_write(EXPANDER_REG_IODIRB, 0xFF);
+}
+
+void expander_select_row(uint8_t row)
+{
+ expander_write(EXPANDER_REG_IODIRB, ~(1<<(row+1)));
+}
+
+void expander_config(void)
+{
+ expander_write(EXPANDER_REG_IPOLA, 0xFF);
+ expander_write(EXPANDER_REG_GPPUA, 0xFF);
+ expander_write(EXPANDER_REG_IODIRB, 0xFF);
+}
+
+uint8_t expander_write(uint8_t reg, uint8_t data)
+{
+ if (expander_status == 0) {
+ return 0;
+ }
+ uint8_t ret;
+ ret = i2c_start(EXPANDER_ADDR | I2C_WRITE);
+ if (ret) goto stop;
+ ret = i2c_write(reg);
+ if (ret) goto stop;
+ ret = i2c_write(data);
+ stop:
+ i2c_stop();
+ return ret;
+}
+
+uint8_t expander_read(uint8_t reg, uint8_t *data)
+{
+ if (expander_status == 0) {
+ return 0;
+ }
+ uint8_t ret;
+ ret = i2c_start(EXPANDER_ADDR | I2C_WRITE);
+ if (ret) goto stop;
+ ret = i2c_write(reg);
+ if (ret) goto stop;
+ ret = i2c_rep_start(EXPANDER_ADDR | I2C_READ);
+ if (ret) goto stop;
+ *data = i2c_readNak();
+ stop:
+ i2c_stop();
+ return ret;
+}
diff --git a/keyboards/ktec/ergodone/expander.h b/keyboards/ktec/ergodone/expander.h
new file mode 100644
index 0000000000..8676fed693
--- /dev/null
+++ b/keyboards/ktec/ergodone/expander.h
@@ -0,0 +1,48 @@
+#ifndef EXPANDER_H
+#define EXPANDER_H
+
+#include <stdint.h>
+#include "matrix.h"
+
+#define MCP23017
+#define MCP23017_A0 0
+#define MCP23017_A1 0
+#define MCP23017_A2 0
+
+#ifdef MCP23017
+#define EXPANDER_ADDR ((0x20|(MCP23017_A0<<0)|(MCP23017_A1<<1)|(MCP23017_A2<<2)) << 1)
+enum EXPANDER_REG_BANK0 {
+ EXPANDER_REG_IODIRA = 0,
+ EXPANDER_REG_IODIRB,
+ EXPANDER_REG_IPOLA,
+ EXPANDER_REG_IPOLB,
+ EXPANDER_REG_GPINTENA,
+ EXPANDER_REG_GPINTENB,
+ EXPANDER_REG_DEFVALA,
+ EXPANDER_REG_DEFVALB,
+ EXPANDER_REG_INTCONA,
+ EXPANDER_REG_INTCONB,
+ EXPANDER_REG_IOCONA,
+ EXPANDER_REG_IOCONB,
+ EXPANDER_REG_GPPUA,
+ EXPANDER_REG_GPPUB,
+ EXPANDER_REG_INTFA,
+ EXPANDER_REG_INTFB,
+ EXPANDER_REG_INTCAPA,
+ EXPANDER_REG_INTCAPB,
+ EXPANDER_REG_GPIOA,
+ EXPANDER_REG_GPIOB,
+ EXPANDER_REG_OLATA,
+ EXPANDER_REG_OLATB
+};
+#endif
+
+void expander_init(void);
+void expander_scan(void);
+void expander_read_cols(void);
+uint8_t expander_get_col(uint8_t col);
+matrix_row_t expander_read_row(void);
+void expander_unselect_rows(void);
+void expander_select_row(uint8_t row);
+
+#endif
diff --git a/keyboards/ktec/ergodone/i2cmaster.h b/keyboards/ktec/ergodone/i2cmaster.h
new file mode 100644
index 0000000000..3917b9e6c0
--- /dev/null
+++ b/keyboards/ktec/ergodone/i2cmaster.h
@@ -0,0 +1,178 @@
+#ifndef _I2CMASTER_H
+#define _I2CMASTER_H 1
+/*************************************************************************
+* Title: C include file for the I2C master interface
+* (i2cmaster.S or twimaster.c)
+* Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury
+* File: $Id: i2cmaster.h,v 1.10 2005/03/06 22:39:57 Peter Exp $
+* Software: AVR-GCC 3.4.3 / avr-libc 1.2.3
+* Target: any AVR device
+* Usage: see Doxygen manual
+**************************************************************************/
+
+#ifdef DOXYGEN
+/**
+ @defgroup pfleury_ic2master I2C Master library
+ @code #include <i2cmaster.h> @endcode
+
+ @brief I2C (TWI) Master Software Library
+
+ Basic routines for communicating with I2C slave devices. This single master
+ implementation is limited to one bus master on the I2C bus.
+
+ This I2c library is implemented as a compact assembler software implementation of the I2C protocol
+ which runs on any AVR (i2cmaster.S) and as a TWI hardware interface for all AVR with built-in TWI hardware (twimaster.c).
+ Since the API for these two implementations is exactly the same, an application can be linked either against the
+ software I2C implementation or the hardware I2C implementation.
+
+ Use 4.7k pull-up resistor on the SDA and SCL pin.
+
+ Adapt the SCL and SDA port and pin definitions and eventually the delay routine in the module
+ i2cmaster.S to your target when using the software I2C implementation !
+
+ Adjust the CPU clock frequence F_CPU in twimaster.c or in the Makfile when using the TWI hardware implementaion.
+
+ @note
+ The module i2cmaster.S is based on the Atmel Application Note AVR300, corrected and adapted
+ to GNU assembler and AVR-GCC C call interface.
+ Replaced the incorrect quarter period delays found in AVR300 with
+ half period delays.
+
+ @author Peter Fleury pfleury@gmx.ch http://jump.to/fleury
+
+ @par API Usage Example
+ The following code shows typical usage of this library, see example test_i2cmaster.c
+
+ @code
+
+ #include <i2cmaster.h>
+
+
+ #define Dev24C02 0xA2 // device address of EEPROM 24C02, see datasheet
+
+ int main(void)
+ {
+ unsigned char ret;
+
+ i2c_init(); // initialize I2C library
+
+ // write 0x75 to EEPROM address 5 (Byte Write)
+ i2c_start_wait(Dev24C02+I2C_WRITE); // set device address and write mode
+ i2c_write(0x05); // write address = 5
+ i2c_write(0x75); // write value 0x75 to EEPROM
+ i2c_stop(); // set stop conditon = release bus
+
+
+ // read previously written value back from EEPROM address 5
+ i2c_start_wait(Dev24C02+I2C_WRITE); // set device address and write mode
+
+ i2c_write(0x05); // write address = 5
+ i2c_rep_start(Dev24C02+I2C_READ); // set device address and read mode
+
+ ret = i2c_readNak(); // read one byte from EEPROM
+ i2c_stop();
+
+ for(;;);
+ }
+ @endcode
+
+*/
+#endif /* DOXYGEN */
+
+/**@{*/
+
+#if (__GNUC__ * 100 + __GNUC_MINOR__) < 304
+#error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !"
+#endif
+
+#include <avr/io.h>
+
+/** defines the data direction (reading from I2C device) in i2c_start(),i2c_rep_start() */
+#define I2C_READ 1
+
+/** defines the data direction (writing to I2C device) in i2c_start(),i2c_rep_start() */
+#define I2C_WRITE 0
+
+
+/**
+ @brief initialize the I2C master interace. Need to be called only once
+ @param void
+ @return none
+ */
+extern void i2c_init(void);
+
+
+/**
+ @brief Terminates the data transfer and releases the I2C bus
+ @param void
+ @return none
+ */
+extern void i2c_stop(void);
+
+
+/**
+ @brief Issues a start condition and sends address and transfer direction
+
+ @param addr address and transfer direction of I2C device
+ @retval 0 device accessible
+ @retval 1 failed to access device
+ */
+extern unsigned char i2c_start(unsigned char addr);
+
+
+/**
+ @brief Issues a repeated start condition and sends address and transfer direction
+
+ @param addr address and transfer direction of I2C device
+ @retval 0 device accessible
+ @retval 1 failed to access device
+ */
+extern unsigned char i2c_rep_start(unsigned char addr);
+
+
+/**
+ @brief Issues a start condition and sends address and transfer direction
+
+ If device is busy, use ack polling to wait until device ready
+ @param addr address and transfer direction of I2C device
+ @return none
+ */
+extern void i2c_start_wait(unsigned char addr);
+
+
+/**
+ @brief Send one byte to I2C device
+ @param data byte to be transfered
+ @retval 0 write successful
+ @retval 1 write failed
+ */
+extern unsigned char i2c_write(unsigned char data);
+
+
+/**
+ @brief read one byte from the I2C device, request more data from device
+ @return byte read from I2C device
+ */
+extern unsigned char i2c_readAck(void);
+
+/**
+ @brief read one byte from the I2C device, read is followed by a stop condition
+ @return byte read from I2C device
+ */
+extern unsigned char i2c_readNak(void);
+
+/**
+ @brief read one byte from the I2C device
+
+ Implemented as a macro, which calls either i2c_readAck or i2c_readNak
+
+ @param ack 1 send ack, request more data from device<br>
+ 0 send nak, read is followed by a stop condition
+ @return byte read from I2C device
+ */
+extern unsigned char i2c_read(unsigned char ack);
+#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak();
+
+
+/**@}*/
+#endif
diff --git a/keyboards/ktec/ergodone/info.json b/keyboards/ktec/ergodone/info.json
new file mode 100644
index 0000000000..33128758ac
--- /dev/null
+++ b/keyboards/ktec/ergodone/info.json
@@ -0,0 +1,107 @@
+{
+ "keyboard_name": "Ergodone",
+ "maintainer": "Yu He",
+ "width": 17,
+ "height": 8,
+
+ "layouts": {
+ "LAYOUT_ergodox": {
+
+ "layout": [
+ {"x":0, "y":0.375, "w":1.5}, {"x":1.5, "y":0.375}, {"x":2.5, "y":0.125}, {"x":3.5, "y":0}, {"x":4.5, "y":0.125}, {"x":5.5, "y":0.25}, {"x":6.5, "y":0.25},
+ {"x":0, "y":1.375, "w":1.5}, {"x":1.5, "y":1.375}, {"x":2.5, "y":1.125}, {"x":3.5, "y":1}, {"x":4.5, "y":1.125}, {"x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5},
+ {"x":0, "y":2.375, "w":1.5}, {"x":1.5, "y":2.375}, {"x":2.5, "y":2.125}, {"x":3.5, "y":2}, {"x":4.5, "y":2.125}, {"x":5.5, "y":2.25},
+ {"x":0, "y":3.375, "w":1.5}, {"x":1.5, "y":3.375}, {"x":2.5, "y":3.125}, {"x":3.5, "y":3}, {"x":4.5, "y":3.125}, {"x":5.5, "y":3.25}, {"x":6.5, "y":2.75, "h":1.5},
+ {"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":2.5, "y":4.125}, {"x":3.5, "y":4}, {"x":4.5, "y":4.125},
+
+ {"x":6, "y":5}, {"x":7, "y":5},
+ {"x":7, "y":6},
+ {"x":5, "y":6, "h":2}, {"x":6, "y":6, "h":2}, {"x":7, "y":7},
+
+
+ {"x":9.5, "y":0.25}, {"x":10.5, "y":0.25}, {"x":11.5, "y":0.125}, {"x":12.5, "y":0}, {"x":13.5, "y":0.125}, {"x":14.5, "y":0.375}, {"x":15.5, "y":0.375, "w":1.5},
+ {"x":9.5, "y":1.25, "h":1.5}, {"x":10.5, "y":1.25}, {"x":11.5, "y":1.125}, {"x":12.5, "y":1}, {"x":13.5, "y":1.125}, {"x":14.5, "y":1.375}, {"x":15.5, "y":1.375, "w":1.5},
+ {"x":10.5, "y":2.25}, {"x":11.5, "y":2.125}, {"x":12.5, "y":2}, {"x":13.5, "y":2.125}, {"x":14.5, "y":2.375}, {"x":15.5, "y":2.375, "w":1.5},
+ {"x":9.5, "y":2.75, "h":1.5}, {"x":10.5, "y":3.25}, {"x":11.5, "y":3.125}, {"x":12.5, "y":3}, {"x":13.5, "y":3.125}, {"x":14.5, "y":3.375}, {"x":15.5, "y":3.375, "w":1.5},
+ {"x":11.5, "y":4.125}, {"x":12.5, "y":4}, {"x":13.5, "y":4.125}, {"x":14.5, "y":4.375}, {"x":15.5, "y":4.375},
+
+
+ {"x":9, "y":5}, {"x":10, "y":5},
+ {"x":9, "y":6},
+ {"x":9, "y":7}, {"x":10, "y":6, "h":2}, {"x":11, "y":6, "h":2}
+ ]
+ },
+ "LAYOUT_ergodox_pretty": {
+ "layout": [
+ {"x":0, "y":0.375, "w":1.5}, {"x":1.5, "y":0.375}, {"x":2.5, "y":0.125}, {"x":3.5, "y":0}, {"x":4.5, "y":0.125}, {"x":5.5, "y":0.25}, {"x":6.5, "y":0.25},
+ {"x":9.5, "y":0.25}, {"x":10.5, "y":0.25}, {"x":11.5, "y":0.125}, {"x":12.5, "y":0}, {"x":13.5, "y":0.125}, {"x":14.5, "y":0.375}, {"x":15.5, "y":0.375, "w":1.5},
+
+ {"x":0, "y":1.375, "w":1.5}, {"x":1.5, "y":1.375}, {"x":2.5, "y":1.125}, {"x":3.5, "y":1}, {"x":4.5, "y":1.125}, {"x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5},
+ {"x":9.5, "y":1.25, "h":1.5}, {"x":10.5, "y":1.25}, {"x":11.5, "y":1.125}, {"x":12.5, "y":1}, {"x":13.5, "y":1.125}, {"x":14.5, "y":1.375}, {"x":15.5, "y":1.375, "w":1.5},
+
+ {"x":0, "y":2.375, "w":1.5}, {"x":1.5, "y":2.375}, {"x":2.5, "y":2.125}, {"x":3.5, "y":2}, {"x":4.5, "y":2.125}, {"x":5.5, "y":2.25},
+ {"x":10.5, "y":2.25}, {"x":11.5, "y":2.125}, {"x":12.5, "y":2}, {"x":13.5, "y":2.125}, {"x":14.5, "y":2.375}, {"x":15.5, "y":2.375, "w":1.5},
+
+ {"x":0, "y":3.375, "w":1.5}, {"x":1.5, "y":3.375}, {"x":2.5, "y":3.125}, {"x":3.5, "y":3}, {"x":4.5, "y":3.125}, {"x":5.5, "y":3.25}, {"x":6.5, "y":2.75, "h":1.5},
+ {"x":9.5, "y":2.75, "h":1.5}, {"x":10.5, "y":3.25}, {"x":11.5, "y":3.125}, {"x":12.5, "y":3}, {"x":13.5, "y":3.125}, {"x":14.5, "y":3.375}, {"x":15.5, "y":3.375, "w":1.5},
+
+ {"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":2.5, "y":4.125}, {"x":3.5, "y":4}, {"x":4.5, "y":4.125},
+ {"x":11.5, "y":4.125}, {"x":12.5, "y":4}, {"x":13.5, "y":4.125}, {"x":14.5, "y":4.375}, {"x":15.5, "y":4.375},
+
+ {"x":6, "y":5}, {"x":7, "y":5}, {"x":9, "y":5}, {"x":10, "y":5},
+ {"x":7, "y":6}, {"x":9, "y":6},
+ {"x":5, "y":6, "h":2}, {"x":6, "y":6, "h":2}, {"x":7, "y":7}, {"x":9, "y":7}, {"x":10, "y":6, "h":2}, {"x":11, "y":6, "h":2}
+ ]
+ },
+ "LAYOUT_ergodox_80": {
+
+ "layout": [
+ {"x":0, "y":0.375, "w":1.5}, {"x":1.5, "y":0.375}, {"x":2.5, "y":0.125}, {"x":3.5, "y":0}, {"x":4.5, "y":0.125}, {"x":5.5, "y":0.25}, {"x":6.5, "y":0.25},
+ {"x":0, "y":1.375, "w":1.5}, {"x":1.5, "y":1.375}, {"x":2.5, "y":1.125}, {"x":3.5, "y":1}, {"x":4.5, "y":1.125}, {"x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5},
+ {"x":0, "y":2.375, "w":1.5}, {"x":1.5, "y":2.375}, {"x":2.5, "y":2.125}, {"x":3.5, "y":2}, {"x":4.5, "y":2.125}, {"x":5.5, "y":2.25},
+ {"x":0, "y":3.375, "w":1.5}, {"x":1.5, "y":3.375}, {"x":2.5, "y":3.125}, {"x":3.5, "y":3}, {"x":4.5, "y":3.125}, {"x":5.5, "y":3.25}, {"x":6.5, "y":2.75, "h":1.5},
+ {"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":2.5, "y":4.125}, {"x":3.5, "y":4}, {"x"