diff --git a/data/mappings/keyboard_aliases.hjson b/data/mappings/keyboard_aliases.hjson index 4e602b685692..6e20052eb30b 100644 --- a/data/mappings/keyboard_aliases.hjson +++ b/data/mappings/keyboard_aliases.hjson @@ -194,6 +194,12 @@ "exclusive/e85": { "target": "exclusive/e85/hotswap" }, + "fc660c": { + "target": "leopold/fc660c" + }, + "fc980c": { + "target": "leopold/fc980c/hasu" + }, "gh60": { "target": "gh60/revc" }, diff --git a/keyboards/fc660c/ad5258.c b/keyboards/fc660c/ad5258.c deleted file mode 100644 index b1df75789b21..000000000000 --- a/keyboards/fc660c/ad5258.c +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2017 Balz Guenat -based on work by Jun Wako - -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 . -*/ - -#include "ad5258.h" -#include "i2c_master.h" - -/////////////////////////////////////////////////////////////////////////////// -// -// AD5258 I2C digital potentiometer -// http://www.analog.com/media/en/technical-documentation/data-sheets/AD5258.pdf -// -#define AD5258_I2C_ADDRESS 0x18 -#define AD5258_INST_RDAC 0x00 -#define AD5258_INST_EEPROM 0x20 - -void ad5258_init(void) { - i2c_init(); -} - -uint8_t ad5258_read_rdac(void) { - // read RDAC register - uint8_t ret = 0; - i2c_readReg(AD5258_I2C_ADDRESS, AD5258_INST_RDAC, &ret, 1, 100); - return ret; -} - -uint8_t ad5258_read_eeprom(void) { - uint8_t ret = 0; - i2c_readReg(AD5258_I2C_ADDRESS, AD5258_INST_EEPROM, &ret, 1, 100); - return ret; -} - -void ad5258_write_rdac(uint8_t rdac) { - // write RDAC register: - uint8_t data = rdac & 0x3F; - i2c_writeReg(AD5258_I2C_ADDRESS, AD5258_INST_RDAC, &data, 1, 100); -} diff --git a/keyboards/fc660c/fc660c.c b/keyboards/fc660c/fc660c.c deleted file mode 100644 index 50540cbfb9bc..000000000000 --- a/keyboards/fc660c/fc660c.c +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright 2017 Balz Guenat - -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 . -*/ - -#include "fc660c.h" - -#ifdef ACTUATION_DEPTH_ADJUSTMENT -void matrix_init_kb(void) { - adjust_actuation_point(ACTUATION_DEPTH_ADJUSTMENT); - - matrix_init_user(); -} - -void actuation_point_up(void) { - // write RDAC register: lower value makes actuation point shallow - uint8_t rdac = ad5258_read_rdac(); - if (rdac == 0) { - ad5258_write_rdac(0); - } else { - ad5258_write_rdac(rdac - 1); - } -} - -void actuation_point_down(void) { - // write RDAC register: higher value makes actuation point deep - uint8_t rdac = ad5258_read_rdac(); - if (rdac == 63) { - ad5258_write_rdac(63); - } else { - ad5258_write_rdac(rdac + 1); - } -} - -void adjust_actuation_point(int offset) { - ad5258_init(); - uint8_t rdac = ad5258_read_eeprom() + offset; - if (rdac > 63) { // protects from under and overflows - if (offset > 0) { - ad5258_write_rdac(63); - } else { - ad5258_write_rdac(0); - } - } else { - ad5258_write_rdac(rdac); - } -} -#endif diff --git a/keyboards/fc980c/ad5258.c b/keyboards/fc980c/ad5258.c deleted file mode 100644 index b1df75789b21..000000000000 --- a/keyboards/fc980c/ad5258.c +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright 2017 Balz Guenat -based on work by Jun Wako - -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 . -*/ - -#include "ad5258.h" -#include "i2c_master.h" - -/////////////////////////////////////////////////////////////////////////////// -// -// AD5258 I2C digital potentiometer -// http://www.analog.com/media/en/technical-documentation/data-sheets/AD5258.pdf -// -#define AD5258_I2C_ADDRESS 0x18 -#define AD5258_INST_RDAC 0x00 -#define AD5258_INST_EEPROM 0x20 - -void ad5258_init(void) { - i2c_init(); -} - -uint8_t ad5258_read_rdac(void) { - // read RDAC register - uint8_t ret = 0; - i2c_readReg(AD5258_I2C_ADDRESS, AD5258_INST_RDAC, &ret, 1, 100); - return ret; -} - -uint8_t ad5258_read_eeprom(void) { - uint8_t ret = 0; - i2c_readReg(AD5258_I2C_ADDRESS, AD5258_INST_EEPROM, &ret, 1, 100); - return ret; -} - -void ad5258_write_rdac(uint8_t rdac) { - // write RDAC register: - uint8_t data = rdac & 0x3F; - i2c_writeReg(AD5258_I2C_ADDRESS, AD5258_INST_RDAC, &data, 1, 100); -} diff --git a/keyboards/fc980c/fc980c.c b/keyboards/fc980c/fc980c.c deleted file mode 100644 index c1c62da9ac5e..000000000000 --- a/keyboards/fc980c/fc980c.c +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright 2017 Balz Guenat - -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 . -*/ - -#include "fc980c.h" - -#ifdef ACTUATION_DEPTH_ADJUSTMENT -void matrix_init_kb(void) { - adjust_actuation_point(ACTUATION_DEPTH_ADJUSTMENT); - - matrix_init_user(); -} - -void actuation_point_up(void) { - // write RDAC register: lower value makes actuation point shallow - uint8_t rdac = ad5258_read_rdac(); - if (rdac == 0) { - ad5258_write_rdac(0); - } else { - ad5258_write_rdac(rdac - 1); - } -} - -void actuation_point_down(void) { - // write RDAC register: higher value makes actuation point deep - uint8_t rdac = ad5258_read_rdac(); - if (rdac == 63) { - ad5258_write_rdac(63); - } else { - ad5258_write_rdac(rdac + 1); - } -} - -void adjust_actuation_point(int offset) { - ad5258_init(); - uint8_t rdac = ad5258_read_eeprom() + offset; - if (rdac > 63) { // protects from under and overflows - if (offset > 0) { - ad5258_write_rdac(63); - } else { - ad5258_write_rdac(0); - } - } else { - ad5258_write_rdac(rdac); - } -} -#endif diff --git a/keyboards/fc980c/keymaps/actuation-point-example/README.md b/keyboards/fc980c/keymaps/actuation-point-example/README.md deleted file mode 100644 index e4e9ab98cae6..000000000000 --- a/keyboards/fc980c/keymaps/actuation-point-example/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Actuation Point adjustment example keymap - -This keymap is an example of how the actuation point adjustment functionality could be used. In `config.h`, we set `ACTUATION_DEPTH_ADJUSTMENT` to `+1`, which puts the actuation point slightly deeper, making the keys less sensitive. - -If [hid_listen](https://www.pjrc.com/teensy/hid_listen.html) is running, `CAPS_LOCK + F9` prints the current RDAC setting and `CAPS_LOCK + F10` prints the default or base setting. `CAPS_LOCK + F11` and `CAPS_LOCK + F12` can be used to adjust the actuation point dynamically. Make only small adjustments and find your ideal setting. For example, if the base setting of your keyboard is 56 but you prefer a slightly lower actuation point at 58, you should set `ACTUATION_DEPTH_ADJUSTMENT` to `+2`. - -If something goes wrong during adjustment, for example keys not actuating anymore or actuating spontaneously, don't panic. Just unplug the keyboard and plug it back in. This will revert all your dynamic changes made with `F11` and `F12`. - -If you discover you have set a too high or low value for `ACTUATION_DEPTH_ADJUSTMENT`, you will need to recompile and reflash your keyboard. diff --git a/keyboards/fc980c/keymaps/actuation-point-example/keymap.c b/keyboards/fc980c/keymaps/actuation-point-example/keymap.c deleted file mode 100644 index 50b6a9ff40b9..000000000000 --- a/keyboards/fc980c/keymaps/actuation-point-example/keymap.c +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright 2017 Balz Guenat - -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 . -*/ -#include QMK_KEYBOARD_H - -enum custom_keycodes -{ - AP_UP = SAFE_RANGE, // Higher actuation point, more sensitive - AP_DN, // Lower actuation point, less sensitive - AP_READ_RDAC, // Prints current RDAC value to console - AP_READ_EEPROM, // Prints base RDAC value to console -}; - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT( - KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, KC_PGUP, KC_PGDN, - KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, - 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_BSLS, KC_P7, KC_P8, KC_P9, KC_PPLS, - MO(1), 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_P4, KC_P5, KC_P6, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, MO(1), KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT), - [1] = LAYOUT( - _______, _______, _______, _______, _______, _______, _______, _______, _______, AP_READ_RDAC, AP_READ_EEPROM, AP_DN, AP_UP, _______, _______, KC_HOME, KC_END, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - KC_CAPS, KC_MPRV, KC_VOLU, KC_MNXT, KC_PGUP, KC_INS, KC_HOME, LCTL(KC_LEFT), LCTL(KC_RGHT), KC_END, KC_PSCR, KC_SCRL, KC_PAUS, _______, _______, _______, _______, _______, - _______, KC_MUTE, KC_VOLD, KC_MPLY, KC_PGDN, KC_DEL, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, LCTL(KC_BSPC), LCTL(KC_DEL), _______, _______, _______, _______, KC_PGUP, _______, _______, _______, _______, - _______, _______, _______, _______, _______, KC_APP, _______, KC_HOME, KC_PGDN, KC_END, _______, _______), -}; - -void matrix_init_user(void){}; - -bool process_record_user(uint16_t keycode, keyrecord_t *record) -{ - if (record->event.pressed) - { - switch (keycode) - { - case AP_UP: - { - actuation_point_up(); - return false; - } - case AP_DN: - { - actuation_point_down(); - return false; - } - case AP_READ_RDAC: - { - xprintf("RDAC: %d", ad5258_read_rdac()); - return false; - } - case AP_READ_EEPROM: - { - xprintf("EEPROM: %d", ad5258_read_eeprom()); - return false; - } - - default: - return true; - } - } - else - { - return true; - } -}; diff --git a/keyboards/leopold/actuation_point.c b/keyboards/leopold/actuation_point.c new file mode 100644 index 000000000000..a1a4d18ce0c2 --- /dev/null +++ b/keyboards/leopold/actuation_point.c @@ -0,0 +1,53 @@ +/* +Copyright 2017 Balz Guenat + +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 . +*/ + +#include "actuation_point.h" + +#include "ad5258.h" + +#include "util.h" + +#ifdef ACTUATION_DEPTH_ADJUSTMENT +int8_t actuation_point_make_shallower(void) { + return actuation_point_adjust(-1 * ACTUATION_DEPTH_ADJUSTMENT); +} + +int8_t actuation_point_make_deeper(void) { + return actuation_point_adjust(ACTUATION_DEPTH_ADJUSTMENT); +} + +int8_t actuation_point_adjust(int8_t offset) { + int8_t ret = -1; + int8_t rdac = ad5258_read_rdac(); + + if (rdac >= 0) { + int8_t rdac_new = rdac + offset; + + if (offset > 0) { + ret = ad5258_write_rdac(MIN(AD5258_RDAC_MAX, rdac_new)); + } else if (offset < 0) { + ret = ad5258_write_rdac(MAX(AD5258_RDAC_MIN, rdac_new)); + } + } + + return ret; +} + +void actuation_point_reset(void) { + ad5258_restore_from_eeprom(); +} +#endif diff --git a/keyboards/fc660c/ad5258.h b/keyboards/leopold/actuation_point.h similarity index 80% rename from keyboards/fc660c/ad5258.h rename to keyboards/leopold/actuation_point.h index c27f247675df..3712d47e505e 100644 --- a/keyboards/fc660c/ad5258.h +++ b/keyboards/leopold/actuation_point.h @@ -19,10 +19,10 @@ along with this program. If not, see . #include -void ad5258_init(void); +int8_t actuation_point_make_shallower(void); -uint8_t ad5258_read_rdac(void); +int8_t actuation_point_make_deeper(void); -uint8_t ad5258_read_eeprom(void); +int8_t actuation_point_adjust(int8_t offset); -void ad5258_write_rdac(uint8_t rdac); +void actuation_point_reset(void); diff --git a/keyboards/leopold/ad5258.c b/keyboards/leopold/ad5258.c new file mode 100644 index 000000000000..31ec968cd12e --- /dev/null +++ b/keyboards/leopold/ad5258.c @@ -0,0 +1,91 @@ +/* +Copyright 2017 Balz Guenat +based on work by Jun Wako + +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 . +*/ + +#include "ad5258.h" + +#include + +#include "i2c_master.h" +#include "debug.h" +#include "wait.h" +#include "util.h" + +/////////////////////////////////////////////////////////////////////////////// +// +// AD5258 I2C digital potentiometer +// http://www.analog.com/media/en/technical-documentation/data-sheets/AD5258.pdf +// +#define AD5258_I2C_ADDRESS (0b0011000 << 1) // QMK I2C API requires shifting the address one bit to the left +#define AD5258_INST_RDAC 0x00 +#define AD5258_INST_EEPROM 0x20 +#define AD5258_INST_NOP 0x80 +#define AD5258_INST_RESTORE 0xA0 + +#define AD5258_I2C_TIMEOUT 100 + +void ad5258_init(void) { + i2c_init(); +} + +int8_t ad5258_read_rdac(void) { + uint8_t data = 0; + + i2c_status_t e = i2c_readReg(AD5258_I2C_ADDRESS, AD5258_INST_RDAC, &data, 1, AD5258_I2C_TIMEOUT); + if (e != I2C_STATUS_SUCCESS) { + return -1; + } + + return MIN(AD5258_RDAC_MAX, data); +}; + +int8_t ad5258_read_eeprom(void) { + uint8_t data = 0; + + i2c_status_t e = i2c_readReg(AD5258_I2C_ADDRESS, AD5258_INST_EEPROM, &data, 1, AD5258_I2C_TIMEOUT); + if (e != I2C_STATUS_SUCCESS) { + return -1; + } + + return MIN(AD5258_RDAC_MAX, data); +} + +int8_t ad5258_write_rdac(uint8_t rdac) { + uint8_t data = MIN(AD5258_RDAC_MAX, rdac); + i2c_status_t e = i2c_writeReg(AD5258_I2C_ADDRESS, AD5258_INST_RDAC, &data, 1, AD5258_I2C_TIMEOUT); + if (e == I2C_STATUS_SUCCESS) { + return data; + } else if (e == I2C_STATUS_TIMEOUT) { + dprintln("actuation_point_write_rdac: timeout"); + } else if (e == I2C_STATUS_ERROR) { + dprintln("actuation_point_write_rdac: error"); + } + + return -1; +}; + +void ad5258_restore_from_eeprom(void) { + i2c_status_t e = i2c_writeReg(AD5258_I2C_ADDRESS, AD5258_INST_RESTORE, NULL, 0, AD5258_I2C_TIMEOUT); + if (e == I2C_STATUS_TIMEOUT) { + dprintln("ad5258_restore_from_eeprom: timeout"); + } else if (e == I2C_STATUS_ERROR) { + dprintln("ad5258_restore_from_eeprom: error"); + } else { + wait_us(350); // datasheet specifies 300us restore interval + i2c_writeReg(AD5258_I2C_ADDRESS, AD5258_INST_NOP, NULL, 0, AD5258_I2C_TIMEOUT); // recommended in datasheet + } +} diff --git a/keyboards/fc980c/fc980c.h b/keyboards/leopold/ad5258.h similarity index 69% rename from keyboards/fc980c/fc980c.h rename to keyboards/leopold/ad5258.h index aa98e36be945..aea6fa32ac82 100644 --- a/keyboards/fc980c/fc980c.h +++ b/keyboards/leopold/ad5258.h @@ -17,15 +17,17 @@ along with this program. If not, see . #pragma once -#include "quantum.h" +#include -#ifdef ACTUATION_DEPTH_ADJUSTMENT -# include "ad5258.h" +#define AD5258_RDAC_MAX 63 +#define AD5258_RDAC_MIN 0 -// see keymaps/actuation-point-example to see how these functions can be used. -void actuation_point_up(void); -void actuation_point_down(void); +void ad5258_init(void); -// be careful with this. -void adjust_actuation_point(int offset); -#endif +int8_t ad5258_read_rdac(void); + +int8_t ad5258_read_eeprom(void); + +int8_t ad5258_write_rdac(uint8_t rdac); + +void ad5258_restore_from_eeprom(void); diff --git a/keyboards/fc660c/config.h b/keyboards/leopold/fc660c/config.h similarity index 100% rename from keyboards/fc660c/config.h rename to keyboards/leopold/fc660c/config.h diff --git a/keyboards/fc980c/ad5258.h b/keyboards/leopold/fc660c/fc660c.c similarity index 79% rename from keyboards/fc980c/ad5258.h rename to keyboards/leopold/fc660c/fc660c.c index c27f247675df..f0de3ad44fb6 100644 --- a/keyboards/fc980c/ad5258.h +++ b/keyboards/leopold/fc660c/fc660c.c @@ -15,14 +15,12 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#pragma once +#include "fc660c.h" -#include +#ifdef ACTUATION_DEPTH_ADJUSTMENT +void matrix_init_kb(void) { + actuation_point_adjust(ACTUATION_DEPTH_ADJUSTMENT); -void ad5258_init(void); - -uint8_t ad5258_read_rdac(void); - -uint8_t ad5258_read_eeprom(void); - -void ad5258_write_rdac(uint8_t rdac); + matrix_init_user(); +} +#endif diff --git a/keyboards/fc660c/fc660c.h b/keyboards/leopold/fc660c/fc660c.h similarity index 77% rename from keyboards/fc660c/fc660c.h rename to keyboards/leopold/fc660c/fc660c.h index aa98e36be945..0ddfc5355068 100644 --- a/keyboards/fc660c/fc660c.h +++ b/keyboards/leopold/fc660c/fc660c.h @@ -21,11 +21,5 @@ along with this program. If not, see . #ifdef ACTUATION_DEPTH_ADJUSTMENT # include "ad5258.h" - -// see keymaps/actuation-point-example to see how these functions can be used. -void actuation_point_up(void); -void actuation_point_down(void); - -// be careful with this. -void adjust_actuation_point(int offset); +# include "actuation_point.h" #endif diff --git a/keyboards/fc660c/info.json b/keyboards/leopold/fc660c/info.json similarity index 98% rename from keyboards/fc660c/info.json rename to keyboards/leopold/fc660c/info.json index e65ed35dae70..d12b24816aac 100644 --- a/keyboards/fc660c/info.json +++ b/keyboards/leopold/fc660c/info.json @@ -1,6 +1,5 @@ { - "keyboard_name": "FC660C", - "manufacturer": "Hasu", + "keyboard_name": "FC660C with tmk controller", "url": "", "maintainer": "qmk", "usb": { diff --git a/keyboards/fc660c/keymaps/dbroqua/keymap.c b/keyboards/leopold/fc660c/keymaps/dbroqua/keymap.c similarity index 100% rename from keyboards/fc660c/keymaps/dbroqua/keymap.c rename to keyboards/leopold/fc660c/keymaps/dbroqua/keymap.c diff --git a/keyboards/fc660c/keymaps/default/README.md b/keyboards/leopold/fc660c/keymaps/default/README.md similarity index 100% rename from keyboards/fc660c/keymaps/default/README.md rename to keyboards/leopold/fc660c/keymaps/default/README.md diff --git a/keyboards/fc660c/keymaps/default/keymap.c b/keyboards/leopold/fc660c/keymaps/default/keymap.c similarity index 100% rename from keyboards/fc660c/keymaps/default/keymap.c rename to keyboards/leopold/fc660c/keymaps/default/keymap.c diff --git a/keyboards/fc660c/keymaps/default_rgb/config.h b/keyboards/leopold/fc660c/keymaps/default_rgb/config.h similarity index 100% rename from keyboards/fc660c/keymaps/default_rgb/config.h rename to keyboards/leopold/fc660c/keymaps/default_rgb/config.h diff --git a/keyboards/fc660c/keymaps/default_rgb/keymap.c b/keyboards/leopold/fc660c/keymaps/default_rgb/keymap.c similarity index 100% rename from keyboards/fc660c/keymaps/default_rgb/keymap.c rename to keyboards/leopold/fc660c/keymaps/default_rgb/keymap.c diff --git a/keyboards/fc660c/keymaps/default_rgb/readme.md b/keyboards/leopold/fc660c/keymaps/default_rgb/readme.md similarity index 100% rename from keyboards/fc660c/keymaps/default_rgb/readme.md rename to keyboards/leopold/fc660c/keymaps/default_rgb/readme.md diff --git a/keyboards/fc660c/keymaps/default_rgb/rules.mk b/keyboards/leopold/fc660c/keymaps/default_rgb/rules.mk similarity index 100% rename from keyboards/fc660c/keymaps/default_rgb/rules.mk rename to keyboards/leopold/fc660c/keymaps/default_rgb/rules.mk diff --git a/keyboards/fc660c/keymaps/mikefightsbears/keymap.c b/keyboards/leopold/fc660c/keymaps/mikefightsbears/keymap.c similarity index 100% rename from keyboards/fc660c/keymaps/mikefightsbears/keymap.c rename to keyboards/leopold/fc660c/keymaps/mikefightsbears/keymap.c diff --git a/keyboards/fc660c/keymaps/mikefightsbears/rules.mk b/keyboards/leopold/fc660c/keymaps/mikefightsbears/rules.mk similarity index 100% rename from keyboards/fc660c/keymaps/mikefightsbears/rules.mk rename to keyboards/leopold/fc660c/keymaps/mikefightsbears/rules.mk diff --git a/keyboards/fc660c/keymaps/siroleo/README.md b/keyboards/leopold/fc660c/keymaps/siroleo/README.md similarity index 100% rename from keyboards/fc660c/keymaps/siroleo/README.md rename to keyboards/leopold/fc660c/keymaps/siroleo/README.md diff --git a/keyboards/fc660c/keymaps/siroleo/config.h b/keyboards/leopold/fc660c/keymaps/siroleo/config.h similarity index 100% rename from keyboards/fc660c/keymaps/siroleo/config.h rename to keyboards/leopold/fc660c/keymaps/siroleo/config.h diff --git a/keyboards/fc660c/keymaps/siroleo/keymap.c b/keyboards/leopold/fc660c/keymaps/siroleo/keymap.c similarity index 100% rename from keyboards/fc660c/keymaps/siroleo/keymap.c rename to keyboards/leopold/fc660c/keymaps/siroleo/keymap.c diff --git a/keyboards/fc660c/keymaps/via/README.md b/keyboards/leopold/fc660c/keymaps/via/README.md similarity index 100% rename from keyboards/fc660c/keymaps/via/README.md rename to keyboards/leopold/fc660c/keymaps/via/README.md diff --git a/keyboards/fc660c/keymaps/via/keymap.c b/keyboards/leopold/fc660c/keymaps/via/keymap.c similarity index 100% rename from keyboards/fc660c/keymaps/via/keymap.c rename to keyboards/leopold/fc660c/keymaps/via/keymap.c diff --git a/keyboards/fc660c/keymaps/via/rules.mk b/keyboards/leopold/fc660c/keymaps/via/rules.mk similarity index 100% rename from keyboards/fc660c/keymaps/via/rules.mk rename to keyboards/leopold/fc660c/keymaps/via/rules.mk diff --git a/keyboards/fc660c/keymaps/via_rgb/config.h b/keyboards/leopold/fc660c/keymaps/via_rgb/config.h similarity index 100% rename from keyboards/fc660c/keymaps/via_rgb/config.h rename to keyboards/leopold/fc660c/keymaps/via_rgb/config.h diff --git a/keyboards/fc660c/keymaps/via_rgb/keymap.c b/keyboards/leopold/fc660c/keymaps/via_rgb/keymap.c similarity index 100% rename from keyboards/fc660c/keymaps/via_rgb/keymap.c rename to keyboards/leopold/fc660c/keymaps/via_rgb/keymap.c diff --git a/keyboards/fc660c/keymaps/via_rgb/readme.md b/keyboards/leopold/fc660c/keymaps/via_rgb/readme.md similarity index 100% rename from keyboards/fc660c/keymaps/via_rgb/readme.md rename to keyboards/leopold/fc660c/keymaps/via_rgb/readme.md diff --git a/keyboards/fc660c/keymaps/via_rgb/rules.mk b/keyboards/leopold/fc660c/keymaps/via_rgb/rules.mk similarity index 100% rename from keyboards/fc660c/keymaps/via_rgb/rules.mk rename to keyboards/leopold/fc660c/keymaps/via_rgb/rules.mk diff --git a/keyboards/fc660c/keymaps/zyber/keymap.c b/keyboards/leopold/fc660c/keymaps/zyber/keymap.c similarity index 100% rename from keyboards/fc660c/keymaps/zyber/keymap.c rename to keyboards/leopold/fc660c/keymaps/zyber/keymap.c diff --git a/keyboards/fc660c/matrix.c b/keyboards/leopold/fc660c/matrix.c similarity index 100% rename from keyboards/fc660c/matrix.c rename to keyboards/leopold/fc660c/matrix.c diff --git a/keyboards/fc660c/readme.md b/keyboards/leopold/fc660c/readme.md similarity index 89% rename from keyboards/fc660c/readme.md rename to keyboards/leopold/fc660c/readme.md index 638c55957725..a6a65bb309a4 100644 --- a/keyboards/fc660c/readme.md +++ b/keyboards/leopold/fc660c/readme.md @@ -1,7 +1,7 @@ FC660C Alt Controller ================= -This file and the entire QMK port of this board are based on its TMK implementation: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/fc980c +This file and the entire QMK port of this board are based on its TMK implementation: ------------ @@ -17,7 +17,7 @@ See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) To flash the firmware, press the reset button on the controller and run: - sudo make fc660c:default:dfu + make leopold/fc660c:default:flash -------- @@ -88,11 +88,11 @@ Row5-7 have no key, you can omit scaning on those lines. Topre original controll | 7| | | | | | | | | | | | | | | | | Logic analyzer pics: -- http://i.imgur.com/9XoNTev.png -- https://i.imgur.com/5FCP1Ay.png +- +- This code emuluates what original cotnroller does for matrix scan. -- https://github.com/tmk/tmk_keyboard/blob/master/keyboard/fc660c/fc660c.c +- ### Row designation @@ -135,19 +135,19 @@ LV4051A(Z4, Z5) select one of 16 column lines to sense capacitance of switches. FCC documents ------------- -https://fccid.io/RPKFC660C + -- schematic: https://fccid.io/pdf.php?id=1888185 -- part list: https://fccid.io/pdf.php?id=1888184 +- schematic: +- part list: Datasheets ---------- -- Hirose DF14A-20P-1.25H: http://www.mouser.com/ds/2/185/DF14_catalog-939195.pdf -- LV07A: http://www.ti.com/lit/ds/symlink/sn74lv07a.pdf -- LV138A: http://www.ti.com/lit/ds/symlink/sn74lvc138a.pdf -- LV4051A: http://www.ti.com/lit/ds/symlink/sn74lv4051a.pdf -- AD5258: http://www.analog.com/media/en/technical-documentation/data-sheets/AD5258.pdf +- Hirose DF14A-20P-1.25H: +- LV07A: +- LV138A: +- LV4051A: +- AD5258: 3.3V power supply @@ -164,4 +164,4 @@ Lower value of RDAC register causes shallower actuation point. Resources --------- -- Pics: https://imgur.com/a/UTR8Z +- Pics: diff --git a/keyboards/fc660c/rules.mk b/keyboards/leopold/fc660c/rules.mk similarity index 86% rename from keyboards/fc660c/rules.mk rename to keyboards/leopold/fc660c/rules.mk index 03a674d668cf..785d7ca7f5b3 100644 --- a/keyboards/fc660c/rules.mk +++ b/keyboards/leopold/fc660c/rules.mk @@ -14,4 +14,4 @@ NKRO_ENABLE = yes # Enable N-Key Rollover I2C_DRIVER_REQUIRED = yes CUSTOM_MATRIX = yes -SRC += matrix.c ad5258.c +SRC += matrix.c keyboards/leopold/ad5258.c keyboards/leopold/actuation_point.c diff --git a/keyboards/leopold/fc980c/fc980c.c b/keyboards/leopold/fc980c/fc980c.c new file mode 100644 index 000000000000..be1d44739d93 --- /dev/null +++ b/keyboards/leopold/fc980c/fc980c.c @@ -0,0 +1,39 @@ +// Copyright 2023 Wilhelm Schuster +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "fc980c.h" + +#include "debug.h" +#include "i2c_master.h" + +keyboard_config_t fc980c_config; + +void fc980c_matrix_init_kb(void) { +#ifdef ACTUATION_DEPTH_ADJUSTMENT + i2c_init(); +#endif +} + +void fc980c_eeconfig_update_kb(void) { +#ifdef ACTUATION_DEPTH_ADJUSTMENT + dprintf("saving rdac config (%"PRId8") to qmk eeprom\n", fc980c_config.actuation_point_value); + eeconfig_update_kb(fc980c_config.raw); +#endif +} + +void fc980c_eeconfig_init_kb(void) { +#ifdef ACTUATION_DEPTH_ADJUSTMENT + fc980c_config.actuation_point_value = -1; + fc980c_eeconfig_update_kb(); +#endif +} + +void fc980c_keyboard_post_init_kb(void) { +#ifdef ACTUATION_DEPTH_ADJUSTMENT + fc980c_config.raw = eeconfig_read_kb(); + + if (fc980c_config.actuation_point_value >= 0) { + ad5258_write_rdac(fc980c_config.actuation_point_value); + } +#endif +} diff --git a/keyboards/leopold/fc980c/fc980c.h b/keyboards/leopold/fc980c/fc980c.h new file mode 100644 index 000000000000..162c416aafde --- /dev/null +++ b/keyboards/leopold/fc980c/fc980c.h @@ -0,0 +1,26 @@ +// Copyright 2023 Wilhelm Schuster +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "quantum.h" + +#ifdef ACTUATION_DEPTH_ADJUSTMENT +# include "ad5258.h" +# include "actuation_point.h" +#endif + +typedef union { + uint32_t raw; + struct { + int8_t actuation_point_value; + }; +} keyboard_config_t; + +void fc980c_matrix_init_kb(void); + +void fc980c_eeconfig_update_kb(void); + +void fc980c_eeconfig_init_kb(void); + +void fc980c_keyboard_post_init_kb(void); diff --git a/keyboards/fc980c/config.h b/keyboards/leopold/fc980c/hasu/config.h similarity index 100% rename from keyboards/fc980c/config.h rename to keyboards/leopold/fc980c/hasu/config.h diff --git a/keyboards/leopold/fc980c/hasu/hasu.c b/keyboards/leopold/fc980c/hasu/hasu.c new file mode 100644 index 000000000000..3a43f4f55cc3 --- /dev/null +++ b/keyboards/leopold/fc980c/hasu/hasu.c @@ -0,0 +1,36 @@ +/* +Copyright 2017 Balz Guenat + +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 . +*/ + +#include "fc980c.h" + +void matrix_init_kb(void) { + fc980c_matrix_init_kb(); + + matrix_init_user(); +} + +void eeconfig_init_kb(void) { + fc980c_eeconfig_init_kb(); + + eeconfig_init_user(); +} + +void keyboard_post_init_kb(void) { + fc980c_keyboard_post_init_kb(); + + keyboard_post_init_user(); +} diff --git a/keyboards/fc980c/info.json b/keyboards/leopold/fc980c/hasu/info.json similarity index 98% rename from keyboards/fc980c/info.json rename to keyboards/leopold/fc980c/hasu/info.json index 27a10b6f51fe..5580fa4cadb4 100644 --- a/keyboards/fc980c/info.json +++ b/keyboards/leopold/fc980c/hasu/info.json @@ -1,6 +1,5 @@ { - "keyboard_name": "FC980C", - "manufacturer": "Hasu", + "keyboard_name": "FC980C with hasu controller", "url": "", "maintainer": "qmk", "usb": { @@ -15,6 +14,9 @@ }, "processor": "atmega32u4", "bootloader": "atmel-dfu", + "build": { + "lto": true + }, "debounce": 0, "layouts": { "LAYOUT": { diff --git a/keyboards/fc980c/matrix.c b/keyboards/leopold/fc980c/hasu/matrix.c similarity index 100% rename from keyboards/fc980c/matrix.c rename to keyboards/leopold/fc980c/hasu/matrix.c diff --git a/keyboards/fc980c/readme.md b/keyboards/leopold/fc980c/hasu/readme.md similarity index 83% rename from keyboards/fc980c/readme.md rename to keyboards/leopold/fc980c/hasu/readme.md index 61dcf6ee9643..474f1eb7a589 100644 --- a/keyboards/fc980c/readme.md +++ b/keyboards/leopold/fc980c/hasu/readme.md @@ -3,33 +3,33 @@ FC980C Alt Controller ===================== -This file and the entire QMK port of this board are based on its TMK implementation: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/fc980c +This file and the entire QMK port of this board are based on its TMK implementation: ------------ - Keyboard Maintainer: [Balz Guenat](https://github.com/BalzGuenat) - Hardware Supported: Hasu's Alt Controller (see below) -- Hardware Availability: https://geekhack.org/index.php?topic=90104.0 +- Hardware Availability: Make example for this keyboard (after setting up your build environment): - make fc980c:default + make leopold/fc980c/hasu:default See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. To flash the firmware, press the reset button on the controller and run: - sudo make fc980c:default:dfu + make leopold/fc980c/hasu:default:flash ----------- This controller replaces original controller of Leopold FC980C and makes the keyboard programmable. -Discuss this here: https://geekhack.org/index.php?topic=90681.0 +Discuss this here: The keyboard is very similar electronically to its sibling model FC660C you can also refer this. -FC660C Alt Controller: https://geekhack.org/index.php?topic=88439.0 +FC660C Alt Controller: Actuation Point adjustment @@ -138,25 +138,17 @@ LV4051A(Z4, Z5) select one of 16 column lines to sense capacitance of switches. |F |1 |1 |1 |1 | -Firmware --------- -Just `make` to build firmware. And consult with wiki for further information. - -- https://github.com/tmk/tmk_keyboard/tree/master/keyboard/fc660c -- https://github.com/tmk/tmk_keyboard/wiki - - Datasheets ---------- -- Hirose DF14A-20P-1.25H: http://www.mouser.com/ds/2/185/DF14_catalog-939195.pdf -- LV07A: http://www.ti.com/lit/ds/symlink/sn74lv07a.pdf -- LV138A: http://www.ti.com/lit/ds/symlink/sn74lvc138a.pdf -- LV4051A: http://www.ti.com/lit/ds/symlink/sn74lv4051a.pdf -- AD5258: http://www.analog.com/media/en/technical-documentation/data-sheets/AD5258.pdf -- JST S5B-PH-SM4: http://www.jst-mfg.com/product/pdf/eng/ePH.pdf -- Hirose UX60SC-MB-5S8: https://www.hirose.com/product/en/products/UX/UX60SC-MB-5S8%2880%29/ -- Tr(E42) for LED?: http://www.bklighting.com/cimages/specs-758.pdf -- TYU TU1252WNR-05S: http://php2.twinner.com.tw/files/goodjob/TY1252series.pdf +- Hirose DF14A-20P-1.25H: +- LV07A: +- LV138A: +- LV4051A: +- AD5258: +- JST S5B-PH-SM4: +- Hirose UX60SC-MB-5S8: +- Tr(E42) for LED?: +- TYU TU1252WNR-05S: 3.3V power supply @@ -177,9 +169,9 @@ USB connector board ------------------- The keyboard has USB receptacle on small separate 1.0mm-thick PCB. USB receptacle is Hirose UX60SC-MB-5S8 while wire-to-PCB connector is TYU TU1252WNR-05S. -http://i.imgur.com/Nucn6h9.jpg +![USB daughterboard](https://i.imgur.com/Nucn6h9.jpg) Resources --------- -- Pics: http://imgur.com/a/HhyIq +- Pics: diff --git a/keyboards/fc980c/rules.mk b/keyboards/leopold/fc980c/hasu/rules.mk similarity index 86% rename from keyboards/fc980c/rules.mk rename to keyboards/leopold/fc980c/hasu/rules.mk index 03a674d668cf..785d7ca7f5b3 100644 --- a/keyboards/fc980c/rules.mk +++ b/keyboards/leopold/fc980c/hasu/rules.mk @@ -14,4 +14,4 @@ NKRO_ENABLE = yes # Enable N-Key Rollover I2C_DRIVER_REQUIRED = yes CUSTOM_MATRIX = yes -SRC += matrix.c ad5258.c +SRC += matrix.c keyboards/leopold/ad5258.c keyboards/leopold/actuation_point.c diff --git a/keyboards/fc980c/keymaps/actuation-point-example/config.h b/keyboards/leopold/fc980c/keymaps/actuation_point_example/config.h similarity index 96% rename from keyboards/fc980c/keymaps/actuation-point-example/config.h rename to keyboards/leopold/fc980c/keymaps/actuation_point_example/config.h index a4ecab70fdeb..59eb1130e029 100644 --- a/keyboards/fc980c/keymaps/actuation-point-example/config.h +++ b/keyboards/leopold/fc980c/keymaps/actuation_point_example/config.h @@ -21,5 +21,4 @@ // too high and keys will fail to actuate. too low and keys will actuate spontaneously. // test all keys before further adjustment. // this should probably stay in the range +/-5. -#undef ACTUATION_DEPTH_ADJUSTMENT #define ACTUATION_DEPTH_ADJUSTMENT +1 diff --git a/keyboards/leopold/fc980c/keymaps/actuation_point_example/keymap.c b/keyboards/leopold/fc980c/keymaps/actuation_point_example/keymap.c new file mode 100644 index 000000000000..b2fbdbb745fe --- /dev/null +++ b/keyboards/leopold/fc980c/keymaps/actuation_point_example/keymap.c @@ -0,0 +1,79 @@ +// Copyright 2023 Wilhelm Schuster +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +#include + +#include "debug.h" + +extern keyboard_config_t fc980c_config; + +enum custom_keycodes { + AP_UP = SAFE_RANGE, // make actuation point deeper + AP_DN, // make actuation point shallower + AP_RST, // reset actuation point to factory value + AP_PRINT_VAL // type current actuation point value (max 63) +}; + +enum layer_names { + _BASE_LAYER, + _FUNCTION_LAYER +}; + +#define FN MO(_FUNCTION_LAYER) + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE_LAYER] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, KC_PGUP, KC_PGDN, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + 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_BSLS, KC_P7, KC_P8, KC_P9, KC_PPLS, + 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_P4, KC_P5, KC_P6, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, FN, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT + ), + + [_FUNCTION_LAYER] = LAYOUT( + QK_BOOT, AP_PRINT_VAL, AP_DN, AP_UP, AP_RST, _______, _______, _______, _______, _______, _______, _______, _______, NK_TOGG, _______, KC_HOME, KC_END, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SCRL, KC_PAUS, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PGUP, _______, _______, _______, _______, + _______, _______, _______, _______, _______, KC_APP, _______, KC_HOME, KC_PGDN, KC_END, _______, _______ + ) +}; +// clang-format on + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + int8_t r_val; + + switch (keycode) { + case AP_UP: + r_val = actuation_point_make_deeper(); + if (r_val >= 0) fc980c_config.actuation_point_value = r_val; + fc980c_eeconfig_update_kb(); + break; + case AP_DN: + r_val = actuation_point_make_shallower(); + if (r_val >= 0) fc980c_config.actuation_point_value = r_val; + fc980c_eeconfig_update_kb(); + break; + case AP_RST: + actuation_point_reset(); + eeconfig_init_kb(); + break; + case AP_PRINT_VAL: + dprintf("actuation_point (AD5258): rdac %"PRId8", eeprom %"PRId8"\n", ad5258_read_rdac(), ad5258_read_eeprom()); +#ifdef SEND_STRING_ENABLE + char rdac_buf[3]; + snprintf(rdac_buf, sizeof(rdac_buf), "%"PRId8, ad5258_read_rdac()); + send_string(rdac_buf); +#endif + break; + } + } + + return true; +} diff --git a/keyboards/leopold/fc980c/keymaps/actuation_point_example/readme.md b/keyboards/leopold/fc980c/keymaps/actuation_point_example/readme.md new file mode 100644 index 000000000000..d4cd6d342ae8 --- /dev/null +++ b/keyboards/leopold/fc980c/keymaps/actuation_point_example/readme.md @@ -0,0 +1,17 @@ +Keymap for adjusting the switch acuation point +============================================== + +This keymap provides custom keycodes that allow adjusting the actuation point of +the Topre switches on the FC980C. The keyboard comes with an actuation point +predefined from the factory. This value will never be touched, rather QMK will +store the custom actuation point value separetely so that it can easily be reset +to the factory value. + +Actuation point adjustment keycodes +----------------------------------- + +- `AP_UP` - makes the actuation point deeper +- `AP_DN` - makes the actuation point shallower +- `AP_RST` - restores the factory actuation point value +- `AP_PRINT_VAL` - types out the current actuation point value (between 0 and + 63, inclusive) diff --git a/keyboards/fc980c/keymaps/coloneljesus/README.md b/keyboards/leopold/fc980c/keymaps/coloneljesus/README.md similarity index 100% rename from keyboards/fc980c/keymaps/coloneljesus/README.md rename to keyboards/leopold/fc980c/keymaps/coloneljesus/README.md diff --git a/keyboards/fc980c/keymaps/coloneljesus/config.h b/keyboards/leopold/fc980c/keymaps/coloneljesus/config.h similarity index 95% rename from keyboards/fc980c/keymaps/coloneljesus/config.h rename to keyboards/leopold/fc980c/keymaps/coloneljesus/config.h index 9d47e9b3e572..e5f7617c9c21 100644 --- a/keyboards/fc980c/keymaps/coloneljesus/config.h +++ b/keyboards/leopold/fc980c/keymaps/coloneljesus/config.h @@ -14,9 +14,7 @@ * along with this program. If not, see . */ -#ifndef CONFIG_USER_H -#define CONFIG_USER_H - +#pragma once // place overrides here @@ -27,5 +25,3 @@ // this should probably stay in the range +/-5. #undef ACTUATION_DEPTH_ADJUSTMENT #define ACTUATION_DEPTH_ADJUSTMENT +2 - -#endif diff --git a/keyboards/fc980c/keymaps/coloneljesus/keymap.c b/keyboards/leopold/fc980c/keymaps/coloneljesus/keymap.c similarity index 100% rename from keyboards/fc980c/keymaps/coloneljesus/keymap.c rename to keyboards/leopold/fc980c/keymaps/coloneljesus/keymap.c diff --git a/keyboards/fc980c/keymaps/default/README.md b/keyboards/leopold/fc980c/keymaps/default/README.md similarity index 100% rename from keyboards/fc980c/keymaps/default/README.md rename to keyboards/leopold/fc980c/keymaps/default/README.md diff --git a/keyboards/fc980c/keymaps/default/keymap.c b/keyboards/leopold/fc980c/keymaps/default/keymap.c similarity index 100% rename from keyboards/fc980c/keymaps/default/keymap.c rename to keyboards/leopold/fc980c/keymaps/default/keymap.c diff --git a/keyboards/fc980c/keymaps/via/keymap.c b/keyboards/leopold/fc980c/keymaps/via/keymap.c similarity index 100% rename from keyboards/fc980c/keymaps/via/keymap.c rename to keyboards/leopold/fc980c/keymaps/via/keymap.c diff --git a/keyboards/fc980c/keymaps/via/rules.mk b/keyboards/leopold/fc980c/keymaps/via/rules.mk similarity index 100% rename from keyboards/fc980c/keymaps/via/rules.mk rename to keyboards/leopold/fc980c/keymaps/via/rules.mk diff --git a/keyboards/leopold/fc980c/wlhlm/config.h b/keyboards/leopold/fc980c/wlhlm/config.h new file mode 100644 index 000000000000..7416083bd20c --- /dev/null +++ b/keyboards/leopold/fc980c/wlhlm/config.h @@ -0,0 +1,16 @@ +// Copyright 2023 Wilhelm Schuster +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +/* Custom matrix pins and port select array */ +#define MATRIX_KEY_ENABLE_PIN A4 +#define MATRIX_KEY_STATE_PIN B15 +#define MATRIX_KEY_HYS_PIN A8 +#define MATRIX_MUX_ROW_PINS {A5, A6, A7} +#define MATRIX_MUX_COL_PINS {B0, B12, B13, B14} + +/* While the original BOM specifies an M24C64 EEPROM not directly supported by + * QMK, its parameters are identical to the 24LC64 EEPROM for which a QMK define + * already exists. */ +#define EEPROM_I2C_24LC64 diff --git a/keyboards/leopold/fc980c/wlhlm/halconf.h b/keyboards/leopold/fc980c/wlhlm/halconf.h new file mode 100644 index 000000000000..607500c3e593 --- /dev/null +++ b/keyboards/leopold/fc980c/wlhlm/halconf.h @@ -0,0 +1,8 @@ +// Copyright 2023 Wilhelm Schuster +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define HAL_USE_I2C TRUE + +#include_next diff --git a/keyboards/leopold/fc980c/wlhlm/info.json b/keyboards/leopold/fc980c/wlhlm/info.json new file mode 100644 index 000000000000..cd9391e00adf --- /dev/null +++ b/keyboards/leopold/fc980c/wlhlm/info.json @@ -0,0 +1,163 @@ +{ + "keyboard_name": "FC980C with wlhlm PCB", + "url": "https://github.com/wlhlm/fc980c-controller", + "maintainer": "wlhlm", + + "usb": { + "vid": "0x7E09", + "pid": "0xF980", + "device_version": "2.0.0", + + "max_power": 100 + }, + + "processor": "STM32F401", + "bootloader": "stm32-dfu", + + "features": { + "bootmagic": true, + "command": true, + "extrakey": true, + "nkro": true, + + "mousekey": false, + "console": false, + "backlight": false, + "audio": false + }, + + "eeprom": { + "driver": "i2c" + }, + + "build": { + "lto": true + }, + + "matrix_size": { + "rows": 8, + "cols": 16 + }, + + "debounce": 0, + + "bootmagic": { + "matrix": [0, 13] + }, + + "indicators": { + "num_lock": "A3", + "caps_lock": "A2", + "scroll_lock": "A1" + }, + + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"Esc", "x":0, "y":0, "matrix": [0, 13]}, + {"label":"F1", "x":2, "y":0, "matrix": [2, 13]}, + {"label":"F2", "x":3, "y":0, "matrix": [5, 13]}, + {"label":"F3", "x":4, "y":0, "matrix": [3, 13]}, + {"label":"F4", "x":5, "y":0, "matrix": [6, 13]}, + {"label":"F5", "x":6.5, "y":0, "matrix": [7, 13]}, + {"label":"F6", "x":7.5, "y":0, "matrix": [7, 15]}, + {"label":"F7", "x":8.5, "y":0, "matrix": [7, 14]}, + {"label":"F8", "x":9.5, "y":0, "matrix": [7, 12]}, + {"label":"F9", "x":11, "y":0, "matrix": [7, 2]}, + {"label":"F10", "x":12, "y":0, "matrix": [7, 1]}, + {"label":"F11", "x":13, "y":0, "matrix": [7, 0]}, + {"label":"F12", "x":14, "y":0, "matrix": [7, 3]}, + {"label":"Delete", "x":15.5, "y":0, "matrix": [7, 4]}, + {"label":"Insert", "x":16.5, "y":0, "matrix": [7, 6]}, + {"label":"Page Up", "x":17.5, "y":0, "matrix": [7, 7]}, + {"label":"Page Down", "x":18.5, "y":0, "matrix": [7, 5]}, + + {"label":"`", "x":0, "y":1.5, "matrix": [0, 10]}, + {"label":"1", "x":1, "y":1.5, "matrix": [6, 9]}, + {"label":"2", "x":2, "y":1.5, "matrix": [5, 9]}, + {"label":"3", "x":3, "y":1.5, "matrix": [5, 8]}, + {"label":"4", "x":4, "y":1.5, "matrix": [5, 11]}, + {"label":"5", "x":5, "y":1.5, "matrix": [6, 15]}, + {"label":"6", "x":6, "y":1.5, "matrix": [5, 15]}, + {"label":"7", "x":7, "y":1.5, "matrix": [5, 14]}, + {"label":"8", "x":8, "y":1.5, "matrix": [6, 12]}, + {"label":"9", "x":9, "y":1.5, "matrix": [5, 12]}, + {"label":"0", "x":10, "y":1.5, "matrix": [5, 2]}, + {"label":"-", "x":11, "y":1.5, "matrix": [5, 1]}, + {"label":"=", "x":12, "y":1.5, "matrix": [5, 0]}, + {"label":"Backspace", "x":13, "y":1.5, "w":2, "matrix": [5, 5]}, + {"label":"Num Lock", "x":15.5, "y":1.5, "matrix": [5, 4]}, + {"label":"/", "x":16.5, "y":1.5, "matrix": [5, 6]}, + {"label":"*", "x":17.5, "y":1.5, "matrix": [5, 7]}, + {"label":"-", "x":18.5, "y":1.5, "matrix": [6, 5]}, + + {"label":"Tab", "x":0, "y":2.5, "w":1.5, "matrix": [6, 10]}, + {"label":"Q", "x":1.5, "y":2.5, "matrix": [3, 9]}, + {"label":"W", "x":2.5, "y":2.5, "matrix": [6, 8]}, + {"label":"E", "x":3.5, "y":2.5, "matrix": [6, 11]}, + {"label":"R", "x":4.5, "y":2.5, "matrix": [3, 11]}, + {"label":"T", "x":5.5, "y":2.5, "matrix": [3, 15]}, + {"label":"Y", "x":6.5, "y":2.5, "matrix": [6, 14]}, + {"label":"U", "x":7.5, "y":2.5, "matrix": [3, 14]}, + {"label":"I", "x":8.5, "y":2.5, "matrix": [3, 12]}, + {"label":"O", "x":9.5, "y":2.5, "matrix": [6, 2]}, + {"label":"P", "x":10.5, "y":2.5, "matrix": [6, 1]}, + {"label":"[", "x":11.5, "y":2.5, "matrix": [6, 0]}, + {"label":"]", "x":12.5, "y":2.5, "matrix": [3, 3]}, + {"label":"\\", "x":13.5, "y":2.5, "w":1.5, "matrix": [5, 3]}, + {"label":"7", "x":15.5, "y":2.5, "matrix": [6, 4]}, + {"label":"8", "x":16.5, "y":2.5, "matrix": [6, 6]}, + {"label":"9", "x":17.5, "y":2.5, "matrix": [6, 7]}, + {"label":"+", "x":18.5, "y":2.5, "h":2, "matrix": [2, 5]}, + + {"label":"Caps Lock", "x":0, "y":3.5, "w":1.75, "matrix": [3, 10]}, + {"label":"A", "x":1.75, "y":3.5, "matrix": [2, 9]}, + {"label":"S", "x":2.75, "y":3.5, "matrix": [3, 8]}, + {"label":"D", "x":3.75, "y":3.5, "matrix": [2, 8]}, + {"label":"F", "x":4.75, "y":3.5, "matrix": [2, 11]}, + {"label":"G", "x":5.75, "y":3.5, "matrix": [2, 15]}, + {"label":"H", "x":6.75, "y":3.5, "matrix": [2, 14]}, + {"label":"J", "x":7.75, "y":3.5, "matrix": [2, 12]}, + {"label":"K", "x":8.75, "y":3.5, "matrix": [1, 12]}, + {"label":"L", "x":9.75, "y":3.5, "matrix": [3, 2]}, + {"label":";", "x":10.75, "y":3.5, "matrix": [3, 1]}, + {"label":"'", "x":11.75, "y":3.5, "matrix": [2, 0]}, + {"label":"Enter", "x":12.75, "y":3.5, "w":2.25, "matrix": [6, 3]}, + {"label":"4", "x":15.5, "y":3.5, "matrix": [2, 4]}, + {"label":"5", "x":16.5, "y":3.5, "matrix": [2, 6]}, + {"label":"6", "x":17.5, "y":3.5, "matrix": [2, 7]}, + + {"label":"Shift", "x":0, "y":4.5, "w":2.25, "matrix": [2, 10]}, + {"label":"Z", "x":2.25, "y":4.5, "matrix": [1, 8]}, + {"label":"X", "x":3.25, "y":4.5, "matrix": [0, 8]}, + {"label":"C", "x":4.25, "y":4.5, "matrix": [1, 11]}, + {"label":"V", "x":5.25, "y":4.5, "matrix": [0, 11]}, + {"label":"B", "x":6.25, "y":4.5, "matrix": [1, 15]}, + {"label":"N", "x":7.25, "y":4.5, "matrix": [1, 14]}, + {"label":"M", "x":8.25, "y":4.5, "matrix": [0, 14]}, + {"label":",", "x":9.25, "y":4.5, "matrix": [2, 2]}, + {"label":".", "x":10.25, "y":4.5, "matrix": [1, 1]}, + {"label":"/", "x":11.25, "y":4.5, "matrix": [2, 1]}, + {"label":"Shift", "x":12.25, "y":4.5, "w":1.75, "matrix": [3, 0]}, + {"label":"Up", "x":14.25, "y":4.75, "matrix": [3, 4]}, + {"label":"1", "x":15.5, "y":4.5, "matrix": [1, 4]}, + {"label":"2", "x":16.5, "y":4.5, "matrix": [1, 6]}, + {"label":"3", "x":17.5, "y":4.5, "matrix": [1, 7]}, + {"label":"Enter", "x":18.5, "y":4.5, "h":2, "matrix": [1, 5]}, + + {"label":"Ctrl", "x":0, "y":5.5, "w":1.25, "matrix": [1, 10]}, + {"label":"Win", "x":1.25, "y":5.5, "matrix": [0, 9]}, + {"label":"Alt", "x":2.25, "y":5.5, "w":1.25, "matrix": [1, 9]}, + {"label":"Space", "x":3.5, "y":5.5, "w":6, "matrix": [0, 15]}, + {"label":"Alt", "x":9.5, "y":5.5, "w":1.25, "matrix": [0, 2]}, + {"label":"Ctrl", "x":10.75, "y":5.5, "matrix": [0, 1]}, + {"label":"Fn", "x":11.75, "y":5.5, "w":1.25, "matrix": [1, 0]}, + {"label":"Left", "x":13.25, "y":5.75, "matrix": [0, 0]}, + {"label":"Down", "x":14.25, "y":5.75, "matrix": [0, 4]}, + {"label":"Right", "x":15.25, "y":5.75, "matrix": [0, 6]}, + {"label":"0", "x":16.5, "y":5.5, "matrix": [0, 7]}, + {"label":".", "x":17.5, "y":5.5, "matrix": [0, 5]} + ] + } + } +} diff --git a/keyboards/leopold/fc980c/wlhlm/matrix.c b/keyboards/leopold/fc980c/wlhlm/matrix.c new file mode 100644 index 000000000000..8b28b3aaffe3 --- /dev/null +++ b/keyboards/leopold/fc980c/wlhlm/matrix.c @@ -0,0 +1,101 @@ +// Copyright 2023 Wilhelm Schuster +// Copyright 2019 Evy Dekkers +// Copyright 2012-2018 Jun Wako, Jack Humbert, Yiancar +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "matrix.h" +#include "gpio.h" +#include "util.h" +#include "wait.h" + +static const pin_t row_pins[] = MATRIX_MUX_ROW_PINS; +static const pin_t col_pins[] = MATRIX_MUX_COL_PINS; + +static inline void KEY_ENABLE_on(void) { writePinLow(MATRIX_KEY_ENABLE_PIN); } +static inline void KEY_ENABLE_off(void) { writePinHigh(MATRIX_KEY_ENABLE_PIN); } +static inline void KEY_HYS_on(void) { writePinHigh(MATRIX_KEY_HYS_PIN); } +static inline void KEY_HYS_off(void) { writePinLow(MATRIX_KEY_HYS_PIN); } + +static void set_row(int row) { + writePin(row_pins[0], row & 0b00000001); + writePin(row_pins[1], row & 0b00000010); + writePin(row_pins[2], row & 0b00000100); +} + +static void set_col(int col) { + writePin(col_pins[0], col & 0b00000001); + writePin(col_pins[1], col & 0b00000010); + writePin(col_pins[2], col & 0b00000100); + writePin(col_pins[3], col & 0b00001000); +} + +static bool read_rows_on_col(matrix_row_t current_matrix[], int current_col) { + bool matrix_changed = false; + + set_col(current_col); + + for (int row_index = 0; row_index < MATRIX_ROWS; row_index++) { + // store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[row_index]; + + set_row(row_index); + + if (last_row_value & (1 << current_col)) { + KEY_HYS_on(); + } + matrix_output_select_delay(); + + KEY_ENABLE_on(); + wait_us(1); + + // KEY_STATE is only valid for 20us after KEY_ENABLE + if (!readPin(MATRIX_KEY_STATE_PIN)) { + // pin LO, set col bit + current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << current_col); + } else { + // pin HI, clear col bit + current_matrix[row_index] &= ~(MATRIX_ROW_SHIFTER << current_col); + } + + KEY_HYS_off(); + KEY_ENABLE_off(); + + // KEY_STATE keeps its state for 20us after KEY_ENABLE. This + // unfortunately puts quite a low ceiling on maximum scan rate. + wait_us(21); + + // determine if the matrix changed state + if ((last_row_value != current_matrix[row_index]) && !(matrix_changed)) { + matrix_changed = true; + } + } + + return matrix_changed; +} + +void matrix_init_custom(void) { + setPinInput(MATRIX_KEY_STATE_PIN); // uses external pullup + setPinOutput(MATRIX_KEY_HYS_PIN); + setPinOutput(MATRIX_KEY_ENABLE_PIN); + + for (int i = 0; i < ARRAY_SIZE(row_pins); i++) { + setPinOutput(row_pins[i]); + } + for (int i = 0; i < ARRAY_SIZE(col_pins); i++) { + setPinOutput(col_pins[i]); + } + + KEY_ENABLE_off(); + KEY_HYS_off(); +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + bool changed = false; + + for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { + changed |= read_rows_on_col(current_matrix, current_col); + } + + return changed; +} + diff --git a/keyboards/leopold/fc980c/wlhlm/mcuconf.h b/keyboards/leopold/fc980c/wlhlm/mcuconf.h new file mode 100644 index 000000000000..c978874ce2f1 --- /dev/null +++ b/keyboards/leopold/fc980c/wlhlm/mcuconf.h @@ -0,0 +1,9 @@ +// Copyright 2023 Wilhelm Schuster +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include_next + +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE diff --git a/keyboards/leopold/fc980c/wlhlm/readme.md b/keyboards/leopold/fc980c/wlhlm/readme.md new file mode 100644 index 000000000000..09450179d8df --- /dev/null +++ b/keyboards/leopold/fc980c/wlhlm/readme.md @@ -0,0 +1,30 @@ +# Leopold FC980C replacement controller + +![wlhlm FC980C replacement controller render](https://i.imgur.com/5AW0DTmh.png) + +* Keyboard Maintainer: [wlhlm](https://github.com/wlhlm) +* Hardware Supported: rev. 1, rev. 2 +* [PCB Source](https://github.com/wlhlm/fc980c-controller/) + +Make example for this keyboard (after setting up your build environment): + + make leopold/fc980c/wlhlm:default + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). + +## Flashing the firmware onto the keyboard + +To be able to flash the controller, it first has to be brought into bootloader mode. There are three ways this can be accomplished: + +- Hold the `BOOT0` button at the back of the controller board (also accessible through the case) pressed while plugging the board into USB. +- Hold the `Escape` key while plugging the board into USB (requires QMK to already be flashed onto the controller). +- Press `Fn+Esc` (requires QMK to already be flashed onto the controller). + +After entering bootloader mode, new firmware can be flashed. Make example for flashing this keyboard: + + make leopold/fc980c/wlhlm:default:flash + +## Actuation point adjustment + +Topre keyboards such as the FC980C are based around capacitive sense and allow adjustment of the actuation point. This feature is not supported by the firmware running on the stock FC980C controller, this replacement controller however unlocks said functionality through the flexibility of QMK. Check the `actuation_point_example` keymap for guidance. + diff --git a/keyboards/leopold/fc980c/wlhlm/rules.mk b/keyboards/leopold/fc980c/wlhlm/rules.mk new file mode 100644 index 000000000000..aa23680095e3 --- /dev/null +++ b/keyboards/leopold/fc980c/wlhlm/rules.mk @@ -0,0 +1,5 @@ +CUSTOM_MATRIX = lite + +I2C_DRIVER_REQUIRED = yes + +SRC += matrix.c keyboards/leopold/ad5258.c keyboards/leopold/actuation_point.c diff --git a/keyboards/leopold/fc980c/wlhlm/wlhlm.c b/keyboards/leopold/fc980c/wlhlm/wlhlm.c new file mode 100644 index 000000000000..bfa72cef5b10 --- /dev/null +++ b/keyboards/leopold/fc980c/wlhlm/wlhlm.c @@ -0,0 +1,22 @@ +// Copyright 2023 Wilhelm Schuster +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "fc980c.h" + +void matrix_init_kb(void) { + fc980c_matrix_init_kb(); + + matrix_init_user(); +} + +void eeconfig_init_kb(void) { + fc980c_eeconfig_init_kb(); + + eeconfig_init_user(); +} + +void keyboard_post_init_kb(void) { + fc980c_keyboard_post_init_kb(); + + keyboard_post_init_user(); +} diff --git a/keyboards/leopold/info.json b/keyboards/leopold/info.json new file mode 100644 index 000000000000..53e2c366120f --- /dev/null +++ b/keyboards/leopold/info.json @@ -0,0 +1,3 @@ +{ + "manufacturer": "Leopold" +}