[Keyboard] tau4 fixup/refactor (#18523)

This commit is contained in:
Less/Rikki 2022-09-29 20:10:33 -04:00 committed by GitHub
parent 96c1ac24ee
commit 1dd15a8f22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 182 additions and 132 deletions

0
keyboards/tau4/common/glcdfont.c Executable file → Normal file
View File

34
keyboards/tau4/config.h Executable file → Normal file
View File

@ -19,35 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config_common.h"
/* key matrix size */
#define MATRIX_ROWS 4
#define MATRIX_COLS 12
/* key matrix pins */
#define MATRIX_ROW_PINS { F4, F5, F6, F7 }
#define MATRIX_COL_PINS { D4, D6, D7, B4, B5, B6, C6, C7, F1, F0, B0, B1 }
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
#define RGB_DI_PIN B2
#ifdef RGB_DI_PIN
#define RGBLIGHT_ANIMATIONS
#define RGBLIGHT_LAYERS
#define RGBLED_NUM 10
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 16
#define RGBLIGHT_VAL_STEP 8
#define RGBLIGHT_LIMIT_VAL 128
#endif
#define ENCODERS_PAD_A { B3 }
#define ENCODERS_PAD_B { B7 }
#define ENCODER_RESOLUTION 1
// Buggy, currently disabled
/* #define EXTERNAL_EEPROM_I2C_BASE_ADDRESS 0b10100000
#define EXTERNAL_EEPROM_I2C_ADDRESS(loc) (EXTERNAL_EEPROM_I2C_BASE_ADDRESS | ((((loc) >> 8) & 0x07) << 1))
@ -56,9 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define EXTERNAL_EEPROM_ADDRESS_SIZE 1
#define EXTERNAL_EEPROM_WRITE_TIME 5 */
#define OLED_DISPLAY_ADDRESS 0x3C
#define OLED_BRIGHTNESS 255
#define OLED_IC OLED_IC_SSD1306
#define RGBLIGHT_LAYERS_RETAIN_VAL
#define OLED_DISPLAY_WIDTH 128
#define OLED_DISPLAY_HEIGHT 32
#define OLED_FONT_H "keyboards/tau4/common/glcdfont.c"

View File

@ -1,11 +1,120 @@
{
"keyboard_name": "tau4",
"manufacturer": "taukeyboards",
"url": "",
"url": "https://gaskell.tech/tau/four.html",
"maintainer": "qmk",
"usb": {
"vid": "0xFEED",
"pid": "0x6060",
"device_version": "0.0.1"
},
"bootloader": "atmel-dfu",
"build": {
"lto": true
},
"matrix_pins": {
"rows": [ "F4", "F5", "F6", "F7" ],
"cols": [ "D4", "D6", "D7", "B4", "B5", "B6", "C6", "C7", "F1", "F0", "B0", "B1" ]
},
"processor": "atmega32u4",
"features": {
"bootmagic": true,
"encoder": true,
"extrakey": true,
"mousekey": true,
"nkro": true,
"oled": true,
"rgblight": true
},
"community_layouts": [ "ortho_4x12" ],
"diode_direction": "COL2ROW",
"encoder": {
"rotary": [
{ "pin_a": "B3", "pin_b": "B7", "resolution": 1 }
]
},
"rgblight": {
"animations": {
"alternating": true,
"breathing": true,
"christmas": true,
"knight": true,
"rainbow_mood": true,
"rainbow_swirl": true,
"rgb_test": true,
"snake": true,
"static_gradient": true,
"twinkle": true
},
"brightness_steps": 8,
"hue_steps": 8,
"layers": {
"blink": false,
"enabled": true,
"max": 5,
"override_rgb": false
},
"led_count": 10,
"max_brightness": 128,
"pin": "B2",
"saturation_steps": 16,
"sleep": true
},
"layouts": {
"LAYOUT_ortho_4x12": {
"layout": [
{"label": "Mute", "matrix": [0, 0], "x":0, "y":0},
{"label": "Q", "matrix": [0, 1], "x":1, "y":0},
{"label": "W", "matrix": [0, 2], "x":2, "y":0},
{"label": "E", "matrix": [0, 3], "x":3, "y":0},
{"label": "R", "matrix": [0, 4], "x":4, "y":0},
{"label": "T", "matrix": [0, 5], "x":5, "y":0},
{"label": "Y", "matrix": [0, 6], "x":6, "y":0},
{"label": "U", "matrix": [0, 7], "x":7, "y":0},
{"label": "I", "matrix": [0, 8], "x":8, "y":0},
{"label": "O", "matrix": [0, 9], "x":9, "y":0},
{"label": "P", "matrix": [0, 10], "x":10, "y":0},
{"label": "Backspace", "matrix": [0, 11], "x":11, "y":0},
{"label": "Esc", "matrix": [1, 0], "x":0, "y":1},
{"label": "A", "matrix": [1, 1], "x":1, "y":1},
{"label": "S", "matrix": [1, 2], "x":2, "y":1},
{"label": "D", "matrix": [1, 3], "x":3, "y":1},
{"label": "F", "matrix": [1, 4], "x":4, "y":1},
{"label": "G", "matrix": [1, 5], "x":5, "y":1},
{"label": "H", "matrix": [1, 6], "x":6, "y":1},
{"label": "J", "matrix": [1, 7], "x":7, "y":1},
{"label": "K", "matrix": [1, 8], "x":8, "y":1},
{"label": "L", "matrix": [1, 9], "x":9, "y":1},
{"label": ";:", "matrix": [1, 10], "x":10, "y":1},
{"label": "'\"", "matrix": [1, 11], "x":11, "y":1},
{"label": "Shift", "matrix": [2, 0], "x":0, "y":2},
{"label": "Z", "matrix": [2, 1], "x":1, "y":2},
{"label": "X", "matrix": [2, 2], "x":2, "y":2},
{"label": "C", "matrix": [2, 3], "x":3, "y":2},
{"label": "V", "matrix": [2, 4], "x":4, "y":2},
{"label": "B", "matrix": [2, 5], "x":5, "y":2},
{"label": "N", "matrix": [2, 6], "x":6, "y":2},
{"label": "M", "matrix": [2, 7], "x":7, "y":2},
{"label": ",<", "matrix": [2, 8], "x":8, "y":2},
{"label": ".>", "matrix": [2, 9], "x":9, "y":2},
{"label": "/?", "matrix": [2, 10], "x":10, "y":2},
{"label": "Enter", "matrix": [2, 11], "x":11, "y":2},
{"label": "Backspace", "matrix": [3, 0], "x":0, "y":3},
{"label": "Ctrl", "matrix": [3, 1], "x":1, "y":3},
{"label": "GUI", "matrix": [3, 2], "x":2, "y":3},
{"label": "Alt", "matrix": [3, 3], "x":3, "y":3},
{"label": "Lower", "matrix": [3, 4], "x":4, "y":3},
{"label": "Space", "matrix": [3, 5], "x":5, "y":3},
{"label": "Space", "matrix": [3, 6], "x":6, "y":3},
{"label": "Raise", "matrix": [3, 7], "x":7, "y":3},
{"label": "Left", "matrix": [3, 8], "x":8, "y":3},
{"label": "Down", "matrix": [3, 9], "x":9, "y":3},
{"label": "Up", "matrix": [3, 10], "x":10, "y":3},
{"label": "Right", "matrix": [3, 11], "x":11, "y":3}
]
}
}
}

View File

@ -85,8 +85,10 @@ void keyboard_post_init_user(void) {
rgblight_layers = my_rgb_layers;
// Uncomment for debug mode
/* debug_enable=true;
debug_matrix=true; */
//debug_enable=true;
//debug_matrix=true;
//debug_keyboard=true;
//debug_mouse=true;
}
layer_state_t layer_state_set_user(layer_state_t state) {
@ -101,47 +103,12 @@ layer_state_t layer_state_set_user(layer_state_t state) {
return state;
}
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { /* First encoder */
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#ifdef OLED_ENABLE
static void render_status(void) {
oled_write_P(PSTR("Tau.4 v1.0\n\n"), false);
oled_write_P(PSTR("Layer:\n"), false);
switch (get_highest_layer(layer_state)) {
case _QWERTY:
oled_write_P(PSTR("Default "), false);
break;
case _NUMPAD:
oled_write_P(PSTR("Numpad "), false);
break;
case _LOWER:
oled_write_P(PSTR("Lower "), false);
break;
case _RAISE:
oled_write_P(PSTR("Raise "), false);
break;
case _ADJUST:
oled_write_P(PSTR("Adjust "), false);
break;
default:
oled_write_P(PSTR("Undefined"), false);
}
}
bool oled_task_user(void) {
render_status();
return false;
}
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[_QWERTY] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[_NUMPAD] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
[_LOWER] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
[_RAISE] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
[_ADJUST] = { ENCODER_CCW_CW(KC_TRNS, KC_TRNS) },
};
#endif

View File

@ -0,0 +1 @@
ENCODER_MAP_ENABLE = yes

View File

@ -6,11 +6,21 @@ A 40% ortholinear keyboard, developed by Oliver Gaskell. More info on [gaskell.t
* Keyboard Maintainer: [Oliver Gaskell](https://github.com/ogaskell)
* Hardware Supported: Tau4 PCB rev1.0, Tau4 PCB rev1.1
* Hardware Availability: Group Buy - Opens 05 Feb 2021 [More Details](https://gaskell.tech/tau/four.html)
* Hardware Availability: Group Buy took place between 05 Feb 2021 to 05 Mar 2021. [More Details](https://gaskell.tech/tau/four.html)
Make example for this keyboard (after setting up your build environment):
make tau4:default
Flashing example for this keyboard:
make tau4:default:flash
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).
## Bootloader
Enter the bootloader in 2 ways:
* **Bootmagic reset**: Hold down the top left key and plug in the keyboard. (If you built with an encoder in the top left, the "key" will be that encoder.) This will also clear EEPROM, so it is a good first step if the keyboard is misbehaving.
* **Keycode in layout**: By default, `QK_BOOT` is assigned to the top right key on the `ADJUST` (fifth) layer.

20
keyboards/tau4/rules.mk Executable file → Normal file
View File

@ -1,25 +1,7 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
BOOTLOADER = atmel-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
ENCODER_ENABLE = yes # Rotary Encoder support
OLED_ENABLE = yes
OLED_DRIVER = SSD1306 # OLED display support
# EEPROM_DRIVER ?= i2c # Driver for external EEPROM chip
# This is currently not working due to QMK not officially supporting the chip used on the Tau4, I am working on a fix.
LAYOUTS = ortho_4x12

45
keyboards/tau4/tau4.c Executable file → Normal file
View File

@ -15,4 +15,47 @@ 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 "tau4.h"
#include "quantum.h"
#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) { /* First encoder */
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
}
#endif
#ifdef OLED_ENABLE
bool oled_task_kb(void) {
if (!oled_task_user()) { return false; }
oled_write_P(PSTR("Tau.4 v1.0\n\n"), false);
oled_write_P(PSTR("Layer:\n"), false);
switch (get_highest_layer(layer_state)) {
case 0:
oled_write_P(PSTR("Default "), false);
break;
case 1:
oled_write_P(PSTR("Numpad "), false);
break;
case 2:
oled_write_P(PSTR("Lower "), false);
break;
case 3:
oled_write_P(PSTR("Raise "), false);
break;
case 4:
oled_write_P(PSTR("Adjust "), false);
break;
default:
oled_write_P(PSTR("Undefined"), false);
}
return true;
}
#endif

View File

@ -1,32 +0,0 @@
/*
Copyright 2020 Oliver Gaskell <me@gaskell.tech>
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 "quantum.h"
#define LAYOUT_ortho_4x12( \
K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, \
K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, \
K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, \
K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311 \
) { \
{ K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011 }, \
{ K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111 }, \
{ K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211 }, \
{ K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311 } \
}