initial stuff for f62

This commit is contained in:
Matthew J. Wolf
2023-06-09 12:29:41 -04:00
parent 26b0526b45
commit aea1b355ea
18 changed files with 2225 additions and 0 deletions

View File

@ -0,0 +1,19 @@
/* Copyright 2020 Purdea Andrei
*
* 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/>.
*/
#pragma once
// place overrides here

View File

@ -0,0 +1,87 @@
/* Copyright 2022 Matthew J Wolf
*
* 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/>.
*
* -----
* Based on F62_-_HHKB_-_Split_Backspace.json from Joe of Model F Labs
*/
/* all
* - Base
*
* Esc 1 2 3 4 5 6 7 8 9 0 - + \ `
*
* Tab Q W E R T Y U I O P [ ] Bspc
*
* Lctl A S D F G H J K L ; ' # Ent
*
* Lsft \ Z X C V B N M , . / Rsft Fn1
*
* Caps GUILalt Space Ratl NlkRctl
*
* - FN1
*
* ` F1 F2 F3 F4 F5 F6 F7 F8 F9 F10F11F12InsDel
*
* PscSklPauUp Del
*
* Vo-Vo+MutEjc Kp*Kp/HomPGuLefRgh
*
* Kp+Kp-EndPGdDow
*
* Fn2
*
* - FN2
*
* Dl-Dl+
*
* EprResHPt
*
* Deb
*
*
*
*
*
*/
#include QMK_KEYBOARD_H
enum layer_names {
_BASE,
_FN1,
_FN2
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT_all(
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_EQL, KC_BSLS, KC_GRV,
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_BSPC,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(_FN1),
KC_CAPS, KC_LGUI, KC_LALT, KC_SPC, _______, KC_RALT, KC_NUM, KC_RCTL
),
[_FN1] = LAYOUT_all(
KC_GRV, 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_INS, KC_DEL,
_______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SCRL, KC_PAUS, KC_UP, _______, KC_DEL,
_______, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, _______,
_______, _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______,
_______, _______, _______, MO(_FN2), _______, _______, _______, _______
),
[_FN2] = LAYOUT_all(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, HF_DWLD,HF_DWLU, _______, _______,
_______, _______, _______, EE_CLR, QK_BOOT, HF_TOGG, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, DB_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______
)
};

View File

@ -0,0 +1,3 @@
# A keymap for model_f_labs/f62/$(CONTROLLER)
Keymap for the HHKB Split Shift and Split Backspace.

View File

@ -0,0 +1,7 @@
#undef BOOTMAGIC_ENABLE
#undef BOOTMAGIC_LITE
/* Bootmagic Lite key configuration */
#define BOOTMAGIC_LITE_ROW 0
#define BOOTMAGIC_LITE_COLUMN 0

View File

@ -0,0 +1,92 @@
/* Copyright 2022 Matthew J Wolf
*
* 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/>.
*/
/* all
* - Base
*
* Esc 1 2 3 4 5 6 7 8 9 0 - + \ `
*
* Tab Q W E R T Y U I O P [ ] Bspc
*
* Lctl A S D F G H J K L ; ' # Ent
*
* Lsft \ Z X C V B N M , . / Rsft Fn1
*
* Caps GUILalt Space Ratl NlkRctl
*
* - FN1
*
* ` F1 F2 F3 F4 F5 F6 F7 F8 F9 F10F11F12InsDel
*
* PscSklPauUp Del
*
* Vo-Vo+MutEjc Kp*Kp/HomPGuLefRgh
*
* Kp+Kp-EndPGdDow
*
* Fn2
*
* - FN2
*
* Dl-Dl+
*
* EprResHPt
*
* Deb
*
*
*
*
*
*/
#include QMK_KEYBOARD_H
enum layer_names {
_BASE,
_FN1,
_FN2,
_FN3
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT_all(
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_EQL, KC_BSLS, KC_GRV,
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_BSPC,
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(_FN1),
KC_CAPS, KC_LGUI, KC_LALT, KC_SPC, _______, KC_RALT, KC_NUM, KC_RCTL
),
[_FN1] = LAYOUT_all(
KC_GRV, 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_INS, KC_DEL,
_______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SCRL, KC_PAUS, KC_UP, _______, KC_DEL,
_______, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, _______,
_______, _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______,
_______, _______, _______, MO(_FN2), _______, _______, _______, _______
),
[_FN2] = LAYOUT_all(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, HF_DWLD,HF_DWLU, _______, _______,
_______, _______, _______, EE_CLR, QK_BOOT, HF_TOGG, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, DB_TOGG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______
),
[_FN3] = LAYOUT_all(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______
)
};

View File

@ -0,0 +1,4 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
SRC = ../xwhatsit_capsense_matrix.c

View File

@ -0,0 +1,22 @@
{
"name": "Model F Labs F62",
"vendorId": "0x1209",
"productId": "0x6262",
"matrix": { "rows": 8, "cols": 9 },
"layouts": {
"labels": [
"Split Backspace",["Split Right Shift","No Split","HHKB Split","Non-HHKB Split"],["Enter","ANSI Enter", "Tie Enter","ISO Enter"],"Split Space","Split Left Shift (ISO)"
],
"keymap": [
[{"x":2.5},"4,0","6,0","6,1","4,2","6,2","4,3","6,3","4,4","6,4","4,5","6,5","4,6","6,6",{"w":2},"6,7\n\n\n0,0",{"x":0.25},"4,7\n\n\n0,1","6,7\n\n\n0,1"],
[{"x":2.5,"w":1.5},"5,0","4,1","5,1","7,2","5,2","7,3","5,3","7,4","5,4","7,5","5,5","5,6","5,7",{"w":1.5},"7,7\n\n\n2,0",{"x":1,"w":1.5},"7,7\n\n\n2,1",{"x":1.75,"w":1.25,"h":2,"w2":1.5,"h2":1,"x2":-0.25},"2,7\n\n\n2,2"],
[{"x":2.5,"w":1.75},"7,0","7,1","2,1","0,2","2,2","0,3","2,3","2,4","0,4","0,5","2,5","2,6",{"w":2.25},"2,7\n\n\n2,0",{"x":0.25},"7,6\n\n\n2,1",{"w":1.25},"2,7\n\n\n2,1",{"x":0.75},"7,6\n\n\n2,2"],
[{"w":1.25},"2,0\n\n\n4,1","0,0\n\n\n4,1",{"x":0.25,"w":2.25},"2,0\n\n\n4,0","1,1","0,1","1,2","3,2","1,3","1,4","3,4","3,5","1,5","0,6",{"w":2.75},"1,7\n\n\n1,0",{"x":0.25,"w":1.75},"0,7\n\n\n1,1","1,7\n\n\n1,1",{"x":0.25},"0,7\n\n\n1,2",{"w":1.75},"1,7\n\n\n1,2"],
[{"x":2.5,"w":1.5},"3,0","1,0",{"w":1.5},"3,1",{"w":7},"3,3\n\n\n3,0",{"w":1.5},"1,6","3,7",{"w":1.5},"3,8"],
[{"y":0.25,"x":6.5,"w":5.5},"3,3\n\n\n3,1",{"w":1.5},"3,6\n\n\n3,1"]
]
}
}

View File

@ -0,0 +1,190 @@
/*
Copyright 2020 Purdea Andrei
Copyright 2021-2022 Matthew J Wolf
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/>.
*/
#pragma once
//#include "config_common.h"
/* USB Device descriptor parameter */
// #define VENDOR_ID 0xFEED
// #define PRODUCT_ID 0X0F62
// #xdefine DEVICE_VER 0x0001
// #define MANUFACTURER Model F Labs
// #define PRODUCT Reproduction IBM F62 Keyboard
// DESCRIPTION is no longer an option
//#define DESCRIPTION Tom Wong-Cornall/Ellipse/wcass/Purdea Andrei
/* key matrix size */
#define MATRIX_ROWS 8
#define MATRIX_COLS 9
// Note: physical column are 16, but only 11 are ever used. Column 0..9 match the physical column. Column 10 is physical column 15.
/*
* Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
*/
#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
/* 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
/*
* 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
/* Bootmagic Lite key configuration */
// #define BOOTMAGIC_LITE_ROW 0
// #define BOOTMAGIC_LITE_COLUMN 0
#define HOLD_ON_OTHER_KEY_PRESS
/* XWHATSIT CONTROLLER TYPE */
#define CONTROLLER_IS_XWHATSIT_MODEL_F_OR_WCASS_MODEL_F
#define CAPSENSE_KEYBOARD_SETTLE_TIME_US 8
#define CAPSENSE_DAC_SETTLE_TIME_US 8
#define CAPSENSE_HARDCODED_SAMPLE_TIME 4
#define CAPSENSE_CAL_ENABLED 1
// #define CAPSENSE_CAL_ENABLED 0
// #define CAPSENSE_CAL_DEBUG 1
#define CAPSENSE_CAL_DEBUG 0
#define CAPSENSE_CAL_INIT_REPS 16
#define CAPSENSE_CAL_EACHKEY_REPS 16
#define CAPSENSE_CAL_BINS 5
#define CAPSENSE_CAL_THRESHOLD_OFFSET 24
#if !CAPSENSE_CAL_ENABLED
#define CAPSENSE_HARDCODED_THRESHOLD 142
#endif
#define CAPSENSE_KEYMAP_COL_TO_PHYSICAL_COL(col) (((col) == 8)?15:(col))
// By default we set up for support of xwhatsit's solenoid driver board.
// Comment out HAPTIC_ENABLE_PIN if you don't have an enable pin:
#define HAPTIC_ENABLE_PIN B7
// We disable haptic feedbeck during USB low power conditions:
#define HAPTIC_OFF_IN_LOW_POWER 1
// Change this if you are using a different pin for the solenoid:
#define SOLENOID_PIN B6
// If you are not using a solenoid then comment out the above, and also in rules.mk, remove "HAPTIC_ENABLE += SOLENOID"
// You can also tune the following for your solenoid:
#define SOLENOID_DEFAULT_DWELL 4
#define SOLENOID_MIN_DWELL 4
//#define SOLENOID_MAX_DWELL 100
#define NO_HAPTIC_MOD
// If the lock lights are not used, then please don't define the below pins,
// or leave them set as unused pins:
// The following definitions match the lock lights as used by the original
// xwhatsit firmware, but enabling all three of these is not compatible with
// standard solenoid support, because B6 and B7 pins are already in use:
//#define LED_NUM_LOCK_PIN B5
//#define LED_CAPS_LOCK_PIN B6
//#define LED_SCROLL_LOCK_PIN B4
// Since solenoid support is enabled by default, the above lock light pin
// assignments are disabled by default.
// Instead the more common Num Lock and Caps Lock are assigned the following
// way by default, and this can be used in combination with the solenoid:
#define LED_NUM_LOCK_PIN B4
#define LED_CAPS_LOCK_PIN B5
// Uncomment below if the leds are on when the pin is driving zero:
//#define LED_NUM_LOCK_ACTIVE_LOW
//#define LED_CAPS_LOCK_ACTIVE_LOW
//#define LED_SCROLL_LOCK_ACTIVE_LOW
#include "../../post_config.h"
// ----- xwhatsit hardware configuration (type_f) -----
#define CAPSENSE_DAC_SCLK B1
#define CAPSENSE_DAC_DIN B2
#define CAPSENSE_DAC_SYNC_N B0
#define CAPSENSE_DAC_MAX 1023
#define CAPSENSE_SHIFT_DIN D4
#define CAPSENSE_SHIFT_OE D5
#define CAPSENSE_SHIFT_SHCP D7
#define CAPSENSE_SHIFT_STCP D6
#define CAPSENSE_SHIFT_STCP_IO _SFR_IO_ADDR(PORTD)
#define CAPSENSE_SHIFT_STCP_BIT 6
#define SETUP_ROW_GPIOS() \
do { \
PORTC |= 0xF0; \
PORTD |= 0x0F; \
} while (0)
#if 1
#define SETUP_UNUSED_PINS() do {} while (0)
#else
// TODO ENABLE THIS ONCE TESTED
#define SETUP_UNUSED_PINS() \
do { \
PORTB |= ~(DDRB | 0x07); \
PORTC |= ~(DDRC | 0xf3); \
PORTD |= ~(DDRD | 0xff); \
} while (0)
#endif
#define CAPSENSE_READ_ROWS_NUMBER_OF_BYTES_PER_SAMPLE 2
#define CAPSENSE_READ_ROWS_PIN_1 _SFR_IO_ADDR(PINC)
#define CAPSENSE_READ_ROWS_PIN_2 _SFR_IO_ADDR(PIND)
#define CAPSENSE_READ_ROWS_ASM_INSTRUCTIONS "in %[dest_row_1], %[ioreg_row_1]\n\tin %[dest_row_2], %[ioreg_row_2]"
#define CAPSENSE_READ_ROWS_STORE_TO_ARRAY_INSTRUCTIONS \
"st %a[arr]+, %[dest_row_1]" "\n\t" \
"st %a[arr]+, %[dest_row_2]"
#define CAPSENSE_READ_ROWS_STORE_TO_ARRAY_INSTRUCTIONS_FAKE \
"st %a[arr], %[dest_row_1]" "\n\t" \
"st %a[arr], %[dest_row_2]"
#define CAPSENSE_READ_ROWS_OUTPUT_CONSTRAINTS [dest_row_1] "=&r" (dest_row_1), [dest_row_2] "=&r" (dest_row_2)
#define CAPSENSE_READ_ROWS_INPUT_CONSTRAINTS [ioreg_row_1] "I" (CAPSENSE_READ_ROWS_PIN_1), [ioreg_row_2] "I" (CAPSENSE_READ_ROWS_PIN_2)
#define CAPSENSE_READ_ROWS_LOCAL_VARS uint8_t dest_row_1, dest_row_2
#define CAPSENSE_READ_ROWS_EXTRACT_FROM_ARRAY do { dest_row_1 = array[p0++]; dest_row_2 = array[p0++]; } while (0)
/*
#ifndef CAPSENSE_KEYMAP_COL_TO_PHYSICAL_COL
#define CAPSENSE_KEYMAP_COL_TO_PHYSICAL_COL(col) (col)
#endif
*/
#if (!defined(CAPSENSE_CONDUCTIVE_PLASTIC_IS_PUSHED_DOWN_ON_KEYPRESS)) && (!defined(CAPSENSE_CONDUCTIVE_PLASTIC_IS_PULLED_UP_ON_KEYPRESS))
#define CAPSENSE_CONDUCTIVE_PLASTIC_IS_PUSHED_DOWN_ON_KEYPRESS
#endif
#define CAPSENSE_KEYMAP_ROW_TO_PHYSICAL_ROW(row) (7-(row))
#define CAPSENSE_PHYSICAL_ROW_TO_KEYMAP_ROW(row) (7-(row))
#define CAPSENSE_READ_ROWS_VALUE ((dest_row_1 >> 4) | (dest_row_2 << 4))

View File

@ -0,0 +1,10 @@
{
"keyboard_name": "Reproduction IBM F62 Keyboard",
"manufacturer": "Model F Labs",
"url": "https://www.modelfkeyboards.com/",
"usb": {
"vid": "0x1209",
"pid": "0x6262",
"device_version": "0.0.1"
}
}

View File

@ -0,0 +1,15 @@
# model_f_labs/f62/wcass
![model_f_labs/f62/wcass](https://www.modelfkeyboards.com/wp-content/uploads/2019/11/F62-F77-new.jpg)
A short description of the keyboard/project
* Keyboard Maintainer: [Purdea Andrei](https://github.com/purdeaandrei)
* Hardware Supported: Supports the brand new Model F reproductions from https://www.modelfkeyboards.com/, using the smaller xwhatsit controller developed by wcass.
* Hardware Availability: https://www.modelfkeyboards.com/
Make example for this keyboard (after setting up your build environment):
make model_f_labs/f62/wcass: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).

View File

@ -0,0 +1,55 @@
# Copyright 2020 Purdea Andrei
# Copyright 2021-2022 Matthew J Wolf
#
# 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/>.
# MCU name
MCU = atmega32u2
# Bootloader selection
# Teensy halfkay
# Pro Micro caterina
# Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = atmel-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = yes # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = yes # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
MIDI_ENABLE = no # MIDI support
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = no # Audio output on port C6
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
HD44780_ENABLE = no # Enable support for HD44780 based LCDs
RAW_ENABLE = yes
LTO_ENABLE = yes # Link Time Optimization - reduces file size
HAPTIC_ENABLE = yes
HAPTIC_DRIVER = SOLENOID
CUSTOM_MATRIX=lite
SRC += ../xwhatsit_capsense_matrix.c ../xwhatsit_util_comm.c

View File

@ -0,0 +1,58 @@
/* Copyright 2020 Purdea Andrei
*
* 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/>.
*/
#include "wcass.h"
const char *KEYBOARD_FILENAME = __FILE__; // used by util_comm
void keyboard_post_init_kb(void)
{
// debug_enable=true;
// debug_matrix=true;
}
// Optional override functions below.
// You can leave any or all of these undefined.
// These are only required if you want to perform custom actions.
/*
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
matrix_init_user();
}
void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
}
bool led_update_kb(led_t led_state) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
return led_update_user(led_state);
}
*/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,71 @@
/* Copyright 2020 Purdea Andrei
* Copyright 2021 Matthew J Wolf
*
* 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/>.
*/
// This file should be included at the end of each keyboard-specific config.h
#pragma once
#ifndef MATRIX_CAPSENSE_ROWS
# ifdef MATRIX_EXTRA_DIRECT_ROWS
# define MATRIX_CAPSENSE_ROWS (MATRIX_ROWS - MATRIX_EXTRA_DIRECT_ROWS)
# ifndef MATRIX_EXTRA_DIRECT_COLS
# define MATRIX_EXTRA_DIRECT_COLS MATRIX_COLS
# endif
# else
# define MATRIX_CAPSENSE_ROWS MATRIX_ROWS
# endif
#endif
#ifndef CAPSENSE_CAL_INIT_REPS
# define CAPSENSE_CAL_INIT_REPS 16
#endif
#ifndef CAPSENSE_CAL_EACHKEY_REPS
# define CAPSENSE_CAL_EACHKEY_REPS 16
#endif
// Testing Options
#ifndef CAPSENSE_KEYBOARD_SETTLE_TIME_US
# error "Please define CAPSENSE_KEYBOARD_SETTLE_TIME_US in config.h"
#endif
#ifndef CAPSENSE_DAC_SETTLE_TIME_US
# error "Please define CAPSENSE_DAC_SETTLE_TIME_US in config.h"
#endif
#ifndef CAPSENSE_HARDCODED_SAMPLE_TIME
# error "Please define CAPSENSE_HARDCODED_SAMPLE_TIME in config.h"
#endif
#ifndef CAPSENSE_CAL_ENABLED
# error "Please define CAPSENSE_CAL_ENABLED as 1/0 in config.h"
#endif
#ifndef CAPSENSE_CAL_DEBUG
# error "Please define CAPSENSE_CAL_DEBUG as 1/0 in config.h"
#endif
#ifndef CAPSENSE_CAL_BINS
# error "Please define CAPSENSE_CAL_BINS in config.h"
#endif
#ifndef CAPSENSE_CAL_THRESHOLD_OFFSET
# error "Please define CAPSENSE_CAL_THRESHOLD_OFFSET in config.h"
#endif
// #if (!defined(CAPSENSE_CONDUCTIVE_PLASTIC_IS_PULLED_UP_ON_KEYPRESS)) && (!defined(CAPSENSE_CONDUCTIVE_PLASTIC_IS_PUSHED_DOWN_ON_KEYPRESS))
// # error "Please specify whether the flyplate is pushed down or pulled up on keypress!"
// #endif
#if defined(KEYBOARD_SHARED_EP) && defined(RAW_ENABLE)
#error "Enabling the KEYBOARD_SHARED_EP will make the util be unable to communicate with the firmware, because due to hidapi limiations, the util can't figure out which interface to talk to, so it hardcodes interface zero."
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,69 @@
/* Copyright 2020 Purdea Andrei
* Copyright 2021 Matthew J Wolf
*
* 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/>.
*/
#pragma once
#define nSHDN_BIT 12
#define MCP_DAC_GAIN_2X 0
#define MCP_DAC_GAIN_1X 1
#define nGA_BIT 13
#define BUF_BIT 14
#define TRACKING_TEST_TIME 4
// Key 1 is the always non-pressed key under the space bar to the right.
#define TRACKING_KEY_1_COL 6
#define TRACKING_KEY_1_ROW 4
// Key 2 is the always-pressed calibration pad to the far right-bottom of the keyboard. (both on F62 and F77)
#define TRACKING_KEY_2_COL 15
#define TRACKING_KEY_2_ROW 6
// Key 3 is the F key
#define TRACKING_KEY_3_COL 2
#define TRACKING_KEY_3_ROW 5
// Key 4 is the half of the split backspace that is unused if the user has a normal backspace.
#define TRACKING_KEY_4_COL 7
#define TRACKING_KEY_4_ROW 3
// Key 5 is hidden key next to the left shift, which is only used in ISO layouts.
#define TRACKING_KEY_5_COL 0
#define TRACKING_KEY_5_ROW 7
#define TRACKING_REPS 16
#ifndef NO_PRINT
#define NRTIMES 64
#define TESTATONCE 8
#define REPS_V2 15
#endif
#ifndef MATRIX_MANIPULATE_H
#define MATRIX_MANIPULATE_H
#include "quantum.h"
// Contains stuff used to manipulate the matrix using the util.
// These are defined in capsense_matrix.c. This file is not called matrix.h to avoid conflict with qmk-native matrix.h
extern bool keyboard_scan_enabled;
void matrix_scan_raw(matrix_row_t current_matrix[]);
extern uint16_t cal_thresholds[CAPSENSE_CAL_BINS];
extern matrix_row_t assigned_to_threshold[CAPSENSE_CAL_BINS][MATRIX_CAPSENSE_ROWS];
uint16_t measure_middle_keymap_coords(uint8_t col, uint8_t row, uint8_t time, uint8_t reps);
void shift_data(uint32_t data, int data_idle, int shcp_idle, int stcp_idle);
void dac_write_threshold(uint16_t value);
uint8_t test_single(uint8_t col, uint16_t time, uint8_t *interference_ptr);
void shift_select_col_no_strobe(uint8_t col);
void shift_select_nothing(void);
#endif

View File

@ -0,0 +1,228 @@
/* Copyright 2020 Purdea Andrei
* Copyright 2021-2022 Matthew J Wolf
*
* 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/>.
*/
#include "quantum.h"
#include "raw_hid.h"
#include "xwhatsit_util_comm.h"
#include "xwhatsit_capsense_matrix.h"
#include <string.h>
#include <platforms/eeprom.h>
extern const char *KEYBOARD_FILENAME; // This must be defined in keyboard_name.c to equal the filename. This is sent back to the PC-side software for it to determine which keyboard we are using.
static const uint8_t magic[] = UTIL_COMM_MAGIC;
// Has well know issues.
//#define min(x, y) (((x) < (y))?(x):(y))
inline int min(int x, int y) {
if (x > y) {
return y;
}
return x;
}
void raw_hid_receive(uint8_t *data, uint8_t length) {
if (0 != memcmp(data, magic, sizeof(magic))) {
return;
}
uint8_t response[RAW_EPSIZE];
memcpy(response, magic, sizeof(magic));
response[2] = UTIL_COMM_RESPONSE_ERROR;
switch (data[2])
{
case UTIL_COMM_GET_VERSION:
response[2] = UTIL_COMM_RESPONSE_OK;
response[3] = UTIL_COMM_VERSION_MAJOR;
response[4] = UTIL_COMM_VERSION_MID;
response[5] = (UTIL_COMM_VERSION_MINOR >> 8) & 0xff;
response[6] = (UTIL_COMM_VERSION_MINOR >> 0) & 0xff;
break;
case UTIL_COMM_DISABLE_KEYBOARD:
response[2] = UTIL_COMM_RESPONSE_OK;
response[3] = (uint8_t) keyboard_scan_enabled;
keyboard_scan_enabled = 0;
break;
case UTIL_COMM_ENABLE_KEYBOARD:
response[2] = UTIL_COMM_RESPONSE_OK;
response[3] = (uint8_t) keyboard_scan_enabled;
keyboard_scan_enabled = 1;
break;
case UTIL_COMM_ENTER_BOOTLOADER:
keyboard_scan_enabled = 0;
wait_ms(10);
bootloader_jump();
// we should not be reaching the following:
wait_ms(10);
response[2] = UTIL_COMM_RESPONSE_OK;
break;
case UTIL_COMM_GET_KEYSTATE:
response[2] = UTIL_COMM_RESPONSE_OK;
{
matrix_row_t current_matrix[MATRIX_ROWS];
matrix_scan_raw(current_matrix);
char *current_matrix_ptr = (char *)current_matrix;
int offset = 0;
if (sizeof(current_matrix) > 32-3)
{
offset = data[3];
current_matrix_ptr += offset;
}
memcpy(&response[3], current_matrix_ptr, min(32-3, sizeof(current_matrix)-offset));
}
break;
case UTIL_COMM_GET_THRESHOLDS:
response[2] = UTIL_COMM_RESPONSE_OK;
#if CAPSENSE_CAL_ENABLED
response[3] = CAPSENSE_CAL_BINS;
{
const uint8_t cal_bin = data[3];
response[4] = cal_thresholds[cal_bin] & 0xff;
response[5] = (cal_thresholds[cal_bin] >> 8) & 0xff;
char *assigned_to_threshold_ptr = (char *)assigned_to_threshold[cal_bin];
int offset = 0;
if (sizeof(assigned_to_threshold[cal_bin]) > 32-6)
{
offset = data[4];
assigned_to_threshold_ptr += offset;
}
memcpy(&response[6], assigned_to_threshold_ptr, min(32-6, sizeof(assigned_to_threshold[cal_bin]) - offset));
}
#else
response[3] = 0;
response[4] = (CAPSENSE_HARDCODED_THRESHOLD) & 0xff;
response[5] = ((CAPSENSE_HARDCODED_THRESHOLD) >> 8) & 0xff;
#endif
break;
case UTIL_COMM_GET_KEYBOARD_FILENAME:
{
response[2] = UTIL_COMM_RESPONSE_OK;
if (data[3] >= strlen(KEYBOARD_FILENAME) + 1)
{
response[3] = 0;
} else {
const char *substring = KEYBOARD_FILENAME + data[3];
size_t substring_length = strlen(substring) + 1;
if (substring_length > RAW_EPSIZE - 3) substring_length = RAW_EPSIZE - 3;
memcpy(&response[3], substring, substring_length);
}
break;
}
case UTIL_COMM_ERASE_EEPROM:
{
response[2] = UTIL_COMM_RESPONSE_OK;
uint16_t addr;
for (addr=0; addr<E2END; addr += 1)
{
eeprom_update_byte((uint8_t*)addr, 0xff);
}
break;
}
case UTIL_COMM_GET_SIGNAL_VALUE:
{
response[2] = UTIL_COMM_RESPONSE_OK;
uint8_t col = data[3];
uint8_t row = data[4];
uint8_t count = data[5];
int i;
for (i=0;i<count;i++)
{
uint16_t value = measure_middle_keymap_coords(col, row, CAPSENSE_HARDCODED_SAMPLE_TIME, 8);
response[3+i*2] = value & 0xff;
response[3+i*2+1] = (value >> 8) & 0xff;
col += 1;
if (col >= MATRIX_COLS) {
col -= MATRIX_COLS;
row += 1;
}
if (row >= MATRIX_CAPSENSE_ROWS)
{
break;
}
}
break;
}
case UTIL_COMM_GET_KEYBOARD_DETAILS:
{
response[2] = UTIL_COMM_RESPONSE_OK;
response[3] = MATRIX_COLS;
response[4] = MATRIX_ROWS;
response[5] = GET_KEYBOARD_DETAILS_5;
#if defined(CONTROLLER_IS_XWHATSIT_BEAMSPRING_REV_4)
response[5] = 1;
#elif defined(CONTROLLER_IS_XWHATSIT_MODEL_F_OR_WCASS_MODEL_F)
response[5] = 2;
#elif defined(CONTROLLER_IS_THROUGH_HOLE_BEAMSPRING)
response[5] = 3;
#elif defined(CONTROLLER_IS_THROUGH_HOLE_MODEL_F)
response[5] = 4;
#else
response[5] = 0;
#endif
response[6] = CAPSENSE_KEYBOARD_SETTLE_TIME_US;
response[7] = CAPSENSE_DAC_SETTLE_TIME_US;
response[8] = CAPSENSE_HARDCODED_SAMPLE_TIME;
response[9] = CAPSENSE_CAL_ENABLED;
response[10] = CAPSENSE_DAC_MAX & 0xFF;
response[11] = (CAPSENSE_DAC_MAX >> 8) & 0xFF;
response[12] = MATRIX_CAPSENSE_ROWS;
response[13] = 0; // reserved for future
response[14] = 0; // reserved for future
response[15] = 0; // reserved for future
break;
}
case UTIL_COMM_SHIFT_DATA:
case UTIL_COMM_SHIFT_DATA_EXT:
{
response[2] = UTIL_COMM_RESPONSE_OK;
uint32_t shdata = (((uint32_t)(data[3])) << 0) |
(((uint32_t)(data[4])) << 8) |
(((uint32_t)(data[5])) << 16) |
(((uint32_t)(data[6])) << 24);
int data_idle = 0;
int shcp_idle = 0;
int stcp_idle = 0;
if (data[2] == UTIL_COMM_SHIFT_DATA_EXT)
{
data_idle = data[7];
shcp_idle = data[8];
stcp_idle = data[9];
}
shift_data(shdata, data_idle, shcp_idle, stcp_idle);
response[3] = readPin(CAPSENSE_SHIFT_DIN);
response[4] = readPin(CAPSENSE_SHIFT_SHCP);
response[5] = readPin(CAPSENSE_SHIFT_STCP);
break;
}
case UTIL_COMM_SET_DAC_VALUE:
{
response[2] = UTIL_COMM_RESPONSE_OK;
uint16_t value = data[3] | (((uint16_t)data[4]) << 8);
dac_write_threshold(value);
break;
}
case UTIL_COMM_GET_ROW_STATE:
{
response[2] = UTIL_COMM_RESPONSE_OK;
response[3] = test_single(255, 0, NULL);
break;
}
default:
break;
}
raw_hid_send(response, sizeof(response));
}

View File

@ -0,0 +1,66 @@
/* Copyright 2020 Purdea Andrei
* Copyright 2021 Matthew J Wolf
*
* 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/>.
*/
#pragma once
#ifndef RAW_EPSIZE
#define RAW_EPSIZE 32
#endif
#ifndef UTIL_COMM_H
#define UTIL_COMM_H
#define UTIL_COMM_VERSION_MAJOR 2
#define UTIL_COMM_VERSION_MID 0
#define UTIL_COMM_VERSION_MINOR 5
#define UTIL_COMM_MAGIC { 0x55, 0xAA }
enum command {
UTIL_COMM_GET_VERSION = 0x11,
UTIL_COMM_ENTER_BOOTLOADER,
UTIL_COMM_DISABLE_KEYBOARD,
UTIL_COMM_ENABLE_KEYBOARD,
UTIL_COMM_GET_KEYSTATE,
UTIL_COMM_GET_THRESHOLDS,
UTIL_COMM_GET_KEYBOARD_FILENAME,
UTIL_COMM_ERASE_EEPROM,
UTIL_COMM_GET_SIGNAL_VALUE,
UTIL_COMM_GET_KEYBOARD_DETAILS,
UTIL_COMM_SHIFT_DATA,
UTIL_COMM_SET_DAC_VALUE,
UTIL_COMM_GET_ROW_STATE,
UTIL_COMM_SHIFT_DATA_EXT,
};
enum response {
UTIL_COMM_RESPONSE_OK = 0x22,
UTIL_COMM_RESPONSE_ERROR
};
#endif
#if defined( CONTROLLER_IS_XWHATSIT_BEAMSPRING_REV_4 )
#define GET_KEYBOARD_DETAILS_5 1
#elif defined( CONTROLLER_IS_XWHATSIT_MODEL_F_OR_WCASS_MODEL_F )
#define GET_KEYBOARD_DETAILS_5 2
#elif defined( CONTROLLER_IS_THROUGH_HOLE_BEAMSPRING )
#define GET_KEYBOARD_DETAILS_5 3
#elif defined( CONTROLLER_IS_THROUGH_HOLE_MODEL_F )
#define GET_KEYBOARD_DETAILS_5 4
#else
#define GET_KEYBOARD_DETAILS_5 0
#endif