diff --git a/keyboards/cheapino/cheapino.c b/keyboards/cheapino/cheapino.c new file mode 100644 index 000000000000..6b1e62de426c --- /dev/null +++ b/keyboards/cheapino/cheapino.c @@ -0,0 +1,75 @@ +#include "wait.h" +#include "quantum.h" + +// This is to keep state between callbacks, when it is 0 the +// initial RGB flash is finished +uint8_t _hue_countdown = 50; + +// These are to keep track of user selected color, so we +// can restore it after RGB flash +uint8_t _hue; +uint8_t _saturation; +uint8_t _value; + +// Do a little 2.5 seconds display of the different colors +// Use the deferred executor so the LED flash dance does not +// stop us from using the keyboard. +// https://docs.qmk.fm/#/custom_quantum_functions?id=deferred-executor-registration +uint32_t flash_led(uint32_t next_trigger_time, void *cb_arg) { + rgblight_sethsv(_hue_countdown * 5, 230, 70); + _hue_countdown--; + if (_hue_countdown == 0) { + // Finished, reset to user chosen led color + rgblight_sethsv(_hue, _saturation, _value); + return 0; + } else { + return 50; + } +} + +void keyboard_post_init_user(void) { + //debug_enable=true; + //debug_matrix=true; + //debug_keyboard=true; + //debug_mouse=true; + + // Store user selected rgb hsv: + _hue = rgblight_get_hue(); + _saturation = rgblight_get_sat(); + _value = rgblight_get_val(); + + // Flash a little on start + defer_exec(50, flash_led, NULL); +} + +// Make the builtin RGB led show different colors per layer: +// This seemed like a good idea but turned out pretty annoying, +// to me at least... Uncomment the lines below to enable +/* +uint8_t get_hue(uint8_t layer) { + switch (layer) { + case 6: + return 169; + case 5: + return 43; + case 4: + return 85; + case 3: + return 120; + case 2: + return 180; + case 1: + return 220; + default: + return 0; + } +} + +layer_state_t layer_state_set_user(layer_state_t state) { + uint8_t sat = rgblight_get_sat(); + uint8_t val = rgblight_get_val(); + uint8_t hue = get_hue(get_highest_layer(state)); + rgblight_sethsv(hue, sat, val); + return state; +} +*/ \ No newline at end of file diff --git a/keyboards/cheapino/config.h b/keyboards/cheapino/config.h new file mode 100644 index 000000000000..650058e1c5e6 --- /dev/null +++ b/keyboards/cheapino/config.h @@ -0,0 +1,38 @@ +// Copyright 2023 Thomas Haukland (@tompi) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT + +#define BOTH_SHIFTS_TURNS_ON_CAPS_WORD +#define WS2812_PIO_USE_PIO1 // Force the usage of PIO1 peripheral, by default the WS2812 implementation uses the PIO0 peripheral +//#define WS2812_TRST_US 80 +#define WS2812_BYTE_ORDER WS2812_BYTE_ORDER_RGB +#define RGB_MATRIX_DEFAULT_VAL 32 + + +// Pick good defaults for enabling homerow modifiers +#define TAPPING_TERM 225 +#define PERMISSIVE_HOLD + + +#define WS2812_DI_PIN GP16 // The pin connected to the data pin of the LEDs + #define RGBLED_NUM 1 // The number of LEDs connected + + +#define MAX_DEFERRED_EXECUTORS 32 diff --git a/keyboards/cheapino/encoder.c b/keyboards/cheapino/encoder.c new file mode 100644 index 000000000000..32575fc28fc6 --- /dev/null +++ b/keyboards/cheapino/encoder.c @@ -0,0 +1,72 @@ +#include "matrix.h" +#include "quantum.h" + +#define COL_SHIFTER ((uint16_t)1) + +static bool colABpressed = false; +static bool encoderPressed = false; + +void clicked(void) { + tap_code(KC_MUTE); +} + +void turned(bool clockwise) { + tap_code(clockwise ? KC_VOLU : KC_VOLD); +} + +void blank_column(matrix_row_t current_matrix[], uint8_t col) { + uint16_t column_index_bitmask = COL_SHIFTER << col; + for (uint8_t row_index = 0; row_index < MATRIX_ROWS-1; row_index++) { + current_matrix[row_index] &= ~column_index_bitmask; + } +} + +bool is_entire_column_held(matrix_row_t current_matrix[], uint8_t col) { + uint16_t column_index_bitmask = COL_SHIFTER << col; + for (uint8_t row_index = 0; row_index < MATRIX_ROWS-1; row_index++) { + if (!(current_matrix[row_index] & column_index_bitmask)) return false; + } + return true; +} + +// Because of a bug in the routing of the cheapino, encoder action +// triggers entire columns... fix it in software here, assumption is that +// you never press an entire column, sounds safe? +void fix_encoder_action(matrix_row_t current_matrix[]) { + + // 7th column means encoder was pressed + if (is_entire_column_held(current_matrix, 7)) { + encoderPressed = true; + blank_column(current_matrix, 7); + current_matrix[3] |= COL_SHIFTER; + } else { + current_matrix[3] &= ~COL_SHIFTER; + // Only trigger click on release + if (encoderPressed) { + encoderPressed = false; + clicked(); + } + } + + // Now check rotary action: + bool colA = is_entire_column_held(current_matrix, 9); + bool colB = is_entire_column_held(current_matrix, 11); + + if (colA && colB) { + colABpressed = true; + blank_column(current_matrix, 9); + blank_column(current_matrix, 11); + } else if (colA) { + if (colABpressed) { + colABpressed = false; + turned(true); + } + blank_column(current_matrix, 9); + } else if (colB) { + if (colABpressed) { + colABpressed = false; + turned(false); + } + blank_column(current_matrix, 11); + } +} diff --git a/keyboards/cheapino/encoder.h b/keyboards/cheapino/encoder.h new file mode 100644 index 000000000000..e393e5da2dac --- /dev/null +++ b/keyboards/cheapino/encoder.h @@ -0,0 +1,5 @@ +// +// Created by Thomas Haukland on 25/03/2023. +// + +void fix_encoder_action(matrix_row_t current_matrix[]); \ No newline at end of file diff --git a/keyboards/cheapino/halconf.h b/keyboards/cheapino/halconf.h new file mode 100644 index 000000000000..c06a0cbf6cce --- /dev/null +++ b/keyboards/cheapino/halconf.h @@ -0,0 +1,8 @@ + +#pragma once + +#define HAL_USE_PWM TRUE +#define HAL_USE_PAL TRUE +#define HAL_USE_I2C TRUE + +#include_next diff --git a/keyboards/cheapino/info.json b/keyboards/cheapino/info.json new file mode 100644 index 000000000000..afa14bb65c88 --- /dev/null +++ b/keyboards/cheapino/info.json @@ -0,0 +1,71 @@ +{ + "manufacturer": "Thomas Haukland", + "keyboard_name": "cheapino", + "maintainer": "tompi", + "bootloader": "rp2040", + "diode_direction": "ROW2COL", + "features": { + "bootmagic": true, + "command": false, + "console": true, + "extrakey": true, + "mousekey": true, + "nkro": false + }, + "community_layouts": [ + "split_3x5_3" + ], + "matrix_pins": { + "cols": ["GP0", "GP0", "GP1", "GP1", "GP2", "GP2", "GP29", "GP29", "GP28", "GP28", "GP27", "GP27"], + "rows": ["GP6", "GP5", "GP4", "GP3"] + }, + "processor": "RP2040", + "url": "", + "usb": { + "device_version": "1.0.0", + "pid": "0x0000", + "vid": "0xFEED" + }, + "layouts": { + "LAYOUT_split_3x5_3": { + "layout": [ + { "matrix": [0, 4], "x": 0, "y": 0.25 }, + { "matrix": [0, 3], "x": 1, "y": 0.125 }, + { "matrix": [0, 2], "x": 2, "y": 0 }, + { "matrix": [0, 1], "x": 3, "y": 0.125 }, + { "matrix": [0, 0], "x": 4, "y": 0.25 }, + { "matrix": [2, 6], "x": 7, "y": 0.25 }, + { "matrix": [2, 7], "x": 8, "y": 0.125 }, + { "matrix": [2, 8], "x": 9, "y": 0 }, + { "matrix": [2, 9], "x": 10, "y": 0.125 }, + { "matrix": [2, 10], "x": 11, "y": 0.25 }, + { "matrix": [1, 4], "x": 0, "y": 1.25 }, + { "matrix": [1, 3], "x": 1, "y": 1.125 }, + { "matrix": [1, 2], "x": 2, "y": 1 }, + { "matrix": [1, 1], "x": 3, "y": 1.125 }, + { "matrix": [1, 0], "x": 4, "y": 1.25 }, + { "matrix": [1, 6], "x": 7, "y": 1.25 }, + { "matrix": [1, 7], "x": 8, "y": 1.125 }, + { "matrix": [1, 8], "x": 9, "y": 1 }, + { "matrix": [1, 9], "x": 10, "y": 1.125 }, + { "matrix": [1, 10], "x": 11, "y": 1.25 }, + { "matrix": [2, 4], "x": 0, "y": 2.25 }, + { "matrix": [2, 3], "x": 1, "y": 2.125 }, + { "matrix": [2, 2], "x": 2, "y": 2 }, + { "matrix": [2, 1], "x": 3, "y": 2.125 }, + { "matrix": [2, 0], "x": 4, "y": 2.25 }, + { "matrix": [0, 6], "x": 7, "y": 2.25 }, + { "matrix": [0, 7], "x": 8, "y": 2.125 }, + { "matrix": [0, 8], "x": 9, "y": 2 }, + { "matrix": [0, 9], "x": 10, "y": 2.125 }, + { "matrix": [0, 10], "x": 11, "y": 2.25 }, + { "matrix": [2, 5], "x": 2.5, "y": 3.25 }, + { "matrix": [1, 5], "x": 3.5, "y": 3.5 }, + { "matrix": [0, 5], "x": 4.5, "y": 3.75 }, + { "matrix": [2, 11], "x": 6.5, "y": 3.75 }, + { "matrix": [1, 11], "x": 7.5, "y": 3.5 }, + { "matrix": [0, 11], "x": 8.5, "y": 3.25 } + ] + } + } +} diff --git a/keyboards/cheapino/keymaps/aeby/keymap.json b/keyboards/cheapino/keymaps/aeby/keymap.json new file mode 100644 index 000000000000..afb09a8632a9 --- /dev/null +++ b/keyboards/cheapino/keymaps/aeby/keymap.json @@ -0,0 +1,163 @@ +{ + "version": 1, + "notes": "Cheapino aeby keymap", + "documentation": "\"This file is a QMK Configurator export. You can import this at . It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: \n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n", + "keyboard": "bastardkb/skeletyl/blackpill", + "keymap": "default", + "layout": "LAYOUT_split_3x5_3", + "layers": [ + [ + "KC_Q", + "KC_W", + "KC_E", + "KC_R", + "KC_T", + "KC_Y", + "KC_U", + "KC_I", + "KC_O", + "KC_P", + "LGUI_T(KC_A)", + "LALT_T(KC_S)", + "LCTL_T(KC_D)", + "LSFT_T(KC_F)", + "KC_G", + "KC_H", + "RSFT_T(KC_J)", + "RCTL_T(KC_K)", + "RALT_T(KC_L)", + "RGUI_T(KC_SCLN)", + "KC_Z", + "KC_X", + "KC_C", + "KC_V", + "KC_B", + "KC_N", + "KC_M", + "KC_COMM", + "KC_DOT", + "KC_SLSH", + "LT(1,KC_ESC)", + "LT(2,KC_SPC)", + "LT(3,KC_TAB)", + "LT(3,KC_DEL)", + "LT(2,KC_BSPC)", + "LT(1,KC_ENT)" + ], + [ + "KC_1", + "KC_2", + "KC_3", + "KC_4", + "KC_5", + "KC_6", + "KC_7", + "KC_8", + "KC_9", + "KC_0", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_NO", + "KC_LEFT", + "KC_DOWN", + "KC_UP", + "KC_RGHT", + "KC_TRNS", + "KC_NO", + "KC_NO", + "KC_HOME", + "KC_END", + "KC_NO", + "KC_NO", + "KC_PGDN", + "KC_PGUP", + "KC_NO", + "KC_NO", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS" + ], + [ + "KC_GRV", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_LBRC", + "KC_RBRC", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_BSLS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_LPRN", + "KC_RPRN", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "RGUI_T(KC_QUOT)", + "KC_NO", + "KC_NO", + "KC_TRNS", + "KC_TRNS", + "KC_LCBR", + "KC_RCBR", + "KC_TRNS", + "KC_MINS", + "KC_EQL", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS" + ], + [ + "KC_F1", + "KC_F2", + "KC_F3", + "KC_F4", + "KC_F5", + "KC_F6", + "KC_F7", + "KC_F8", + "KC_F9", + "KC_F10", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_F11", + "KC_F12", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_NO", + "KC_CUT", + "KC_COPY", + "KC_PSTE", + "KC_NO", + "KC_NO", + "KC_MPLY", + "KC_MRWD", + "KC_MFFD", + "KC_NO", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS" + ] + ], + "author": "ashton.eby@gmail.com" +} \ No newline at end of file diff --git a/keyboards/cheapino/keymaps/chad/keymap.json b/keyboards/cheapino/keymaps/chad/keymap.json new file mode 100644 index 000000000000..9cd3ce0b31b3 --- /dev/null +++ b/keyboards/cheapino/keymaps/chad/keymap.json @@ -0,0 +1,201 @@ +{ + "version": 1, + "notes": "Cheapino default keymap", + "documentation": "\"This file is a QMK Configurator export. You can import this at . It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: \n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n", + "keyboard": "bastardkb/skeletyl/blackpill", + "keymap": "default", + "layout": "LAYOUT_split_3x5_3", + "layers": [ + [ + "KC_Q", + "KC_W", + "KC_E", + "KC_R", + "KC_T", + "KC_Y", + "KC_U", + "KC_I", + "KC_O", + "KC_P", + "LGUI_T(KC_A)", + "LALT_T(KC_S)", + "LCTL_T(KC_D)", + "LSFT_T(KC_F)", + "KC_G", + "KC_H", + "RSFT_T(KC_J)", + "LCTL_T(KC_K)", + "LALT_T(KC_L)", + "LGUI_T(KC_SCLN)", + "KC_Z", + "KC_X", + "KC_C", + "KC_V", + "KC_B", + "KC_N", + "KC_M", + "KC_COMM", + "KC_DOT", + "KC_SLSH", + "LT(3,KC_ESC)", + "LT(2,KC_SPC)", + "LT(1,KC_TAB)", + "LT(1,KC_DEL)", + "LT(2,KC_BSPC)", + "LT(3,KC_ENT)" + ], + [ + "KC_1", + "KC_2", + "KC_3", + "KC_4", + "KC_5", + "KC_6", + "KC_7", + "KC_8", + "KC_9", + "KC_0", + "KC_PGUP", + "KC_HOME", + "KC_GRV", + "KC_MUTE", + "KC_MPLY", + "KC_VOLU", + "KC_LEFT", + "KC_DOWN", + "KC_UP", + "KC_RGHT", + "KC_PGDN", + "KC_END", + "KC_MINS", + "KC_EQL", + "TG(4)", + "KC_VOLD", + "KC_QUOT", + "KC_LPRN", + "KC_RPRN", + "KC_BSLS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS" + ], + [ + "KC_P7", + "KC_P8", + "KC_P9", + "KC_P0", + "KC_PMNS", + "KC_ESC", + "KC_HOME", + "KC_UP", + "KC_END", + "KC_PGUP", + "KC_P4", + "KC_P5", + "KC_P6", + "KC_PCMM", + "KC_PPLS", + "KC_ESC", + "KC_LEFT", + "KC_DOWN", + "KC_RGHT", + "KC_PGDN", + "KC_P1", + "KC_P2", + "KC_P3", + "KC_PENT", + "KC_PENT", + "KC_ENT", + "KC_ENT", + "KC_LBRC", + "KC_RBRC", + "LCTL(KC_Z)", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS" + ], + [ + "KC_F1", + "KC_F2", + "KC_F3", + "KC_F4", + "KC_F5", + "KC_F6", + "KC_F7", + "KC_F8", + "KC_F9", + "KC_F10", + "KC_TAB", + "KC_LCBR", + "KC_LBRC", + "KC_LPRN", + "KC_LT", + "KC_GT", + "KC_RPRN", + "KC_RBRC", + "KC_RCBR", + "KC_F11", + "LGUI(KC_Z)", + "LGUI(KC_X)", + "LGUI(KC_C)", + "LGUI(KC_V)", + "KC_ESC", + "KC_ESC", + "RCTL(KC_F)", + "KC_LCBR", + "KC_RCBR", + "KC_F12", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS" + ], + [ + "KC_P7", + "KC_P9", + "KC_ESC", + "KC_PMNS", + "KC_T", + "KC_G", + "KC_R", + "KC_S", + "KC_A", + "LCTL(KC_PMNS)", + "KC_P1", + "KC_P3", + "KC_P5", + "KC_PPLS", + "LSFT(KC_B)", + "KC_X", + "KC_Y", + "KC_Z", + "LGUI(KC_A)", + "LCTL(KC_PPLS)", + "KC_PDOT", + "KC_PSLS", + "KC_P0", + "KC_PENT", + "TG(4)", + "KC_H", + "RSFT(KC_H)", + "RALT(KC_H)", + "LCTL(KC_I)", + "KC_C", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS" + ] + ], + "author": "thomas.haukland@gmail.com" +} \ No newline at end of file diff --git a/keyboards/cheapino/keymaps/lars/config.h b/keyboards/cheapino/keymaps/lars/config.h new file mode 100644 index 000000000000..f735e9a60e20 --- /dev/null +++ b/keyboards/cheapino/keymaps/lars/config.h @@ -0,0 +1,51 @@ +/* +Copyright 2020 Pierre Chevalier + +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 . +*/ + +#pragma once +// Set the mouse settings to a comfortable speed/accuracy trade-off, +// assuming a screen refresh rate of 60 Htz or higher +// The default is 50. This makes the mouse ~3 times faster and more accurate +#define MOUSEKEY_INTERVAL 16 +// The default is 20. Since we made the mouse about 3 times faster with the previous setting, +// give it more time to accelerate to max speed to retain precise control over short distances. +#define MOUSEKEY_TIME_TO_MAX 40 +// The default is 300. Let's try and make this as low as possible while keeping the cursor responsive +#define MOUSEKEY_DELAY 100 +// It makes sense to use the same delay for the mouseweel +#define MOUSEKEY_WHEEL_DELAY 100 +// The default is 100 +#define MOUSEKEY_WHEEL_INTERVAL 50 +// The default is 40 +#define MOUSEKEY_WHEEL_TIME_TO_MAX 100 + +// Pick good defaults for enabling homerow modifiers +#undef TAPPING_TERM +#define TAPPING_TERM 200 +// #define PERMISSIVE_HOLD +#define IGNORE_MOD_TAP_INTERRUPT +#define TAPPING_FORCE_HOLD +//#define RETRO_TAPPING + +// Underglow configuration +#ifdef RGBLIGHT_ENABLE + #define RGBLIGHT_ANIMATIONS + #define RGBLIGHT_HUE_STEP 8 + #define RGBLIGHT_SAT_STEP 8 + #define RGBLIGHT_VAL_STEP 8 +#endif + +//#define UNICODE_SELECTED_MODES UC_MAC diff --git a/keyboards/cheapino/keymaps/lars/keymap.json b/keyboards/cheapino/keymaps/lars/keymap.json new file mode 100644 index 000000000000..a78df9d539e8 --- /dev/null +++ b/keyboards/cheapino/keymaps/lars/keymap.json @@ -0,0 +1,125 @@ +{ + "version": 1, + "notes": "My awesome keymap", + "documentation": "\"This file is a QMK Configurator export. You can import this at . It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: \n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n", + "keyboard": "bastardkb/skeletyl/blackpill", + "keymap": "default", + "layout": "LAYOUT_split_3x5_3", + "layers": [ + [ + "KC_Q", + "KC_W", + "KC_F", + "KC_P", + "KC_B", + "KC_J", + "KC_L", + "KC_U", + "KC_Y", + "KC_SCLN", + "KC_A", + "KC_R", + "KC_S", + "KC_T", + "KC_G", + "KC_M", + "KC_N", + "KC_E", + "KC_I", + "KC_O", + "LSFT_T(KC_Z)", + "LCTL_T(KC_X)", + "RALT_T(KC_C)", + "KC_D", + "KC_V", + "KC_K", + "KC_H", + "RALT_T(KC_COMM)", + "LCTL_T(KC_DOT)", + "LSFT_T(KC_SLSH)", + "TO(1)", + "KC_BSPC", + "KC_TAB", + "KC_LGUI", + "KC_SPC", + "KC_ENT" + ], + [ + "KC_TRNS", + "KC_7", + "KC_8", + "KC_9", + "KC_TRNS", + "KC_QUOT", + "KC_MINS", + "KC_EQL", + "KC_ASTR", + "KC_CIRC", + "KC_TRNS", + "KC_4", + "KC_5", + "KC_6", + "KC_0", + "KC_BSLS", + "KC_LPRN", + "KC_RPRN", + "KC_LBRC", + "KC_RBRC", + "KC_LSFT", + "KC_1", + "KC_2", + "KC_3", + "KC_TRNS", + "KC_PIPE", + "KC_GRV", + "KC_LALT", + "KC_LCTL", + "KC_RSFT", + "TO(2)", + "KC_BSPC", + "KC_TAB", + "KC_DEL", + "TO(0)", + "KC_ENT" + ], + [ + "KC_TRNS", + "KC_TRNS", + "KC_PGUP", + "KC_TRNS", + "KC_TRNS", + "ANY(UC(0xE6))", + "ANY(UC(0xF8))", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_LEFT", + "KC_UP", + "KC_DOWN", + "KC_RGHT", + "KC_TRNS", + "KC_TRNS", + "KC_LGUI", + "ANY(UC(0xE5))", + "LCTL(KC_LALT)", + "LCA(KC_LSFT)", + "KC_TRNS", + "KC_HOME", + "KC_PGDN", + "KC_END", + "KC_TRNS", + "KC_TRNS", + "KC_RBRC", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TAB", + "KC_DEL", + "TO(0)", + "KC_TRNS" + ] + ], + "author": "thomas.haukland@gmail.com" +} diff --git a/keyboards/cheapino/keymaps/tompi/keymap.json b/keyboards/cheapino/keymaps/tompi/keymap.json new file mode 100644 index 000000000000..99c58c8dc631 --- /dev/null +++ b/keyboards/cheapino/keymaps/tompi/keymap.json @@ -0,0 +1,277 @@ +{ + "version": 1, + "notes": "My awesome keymap", + "documentation": "\"This file is a QMK Configurator export. You can import this at . It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: \n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n", + "keyboard": "bastardkb/skeletyl/blackpill", + "keymap": "default", + "layout": "LAYOUT_split_3x5_3", + "layers": [ + [ + "KC_Q", + "KC_W", + "KC_F", + "KC_P", + "KC_B", + "KC_J", + "KC_L", + "KC_U", + "KC_Y", + "KC_SCLN", + "LGUI_T(KC_A)", + "LALT_T(KC_R)", + "LCTL_T(KC_S)", + "LSFT_T(KC_T)", + "KC_G", + "KC_M", + "RSFT_T(KC_N)", + "LCTL_T(KC_E)", + "LALT_T(KC_I)", + "LGUI_T(KC_O)", + "KC_Z", + "KC_X", + "KC_C", + "KC_D", + "LT(5,KC_V)", + "LT(1,KC_K)", + "KC_H", + "KC_COMM", + "KC_DOT", + "KC_SLSH", + "LT(6,KC_ESC)", + "LT(3,KC_SPC)", + "LT(5,KC_TAB)", + "LT(1,KC_DEL)", + "LT(2,KC_BSPC)", + "LT(4,KC_ENT)" + ], + [ + "KC_VOLU", + "KC_WH_L", + "KC_MS_U", + "KC_WH_U", + "KC_WH_R", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "QK_RBT", + "KC_MS_L", + "KC_BTN2", + "KC_BTN1", + "KC_MS_R", + "KC_MUTE", + "KC_NO", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_VOLD", + "KC_MNXT", + "KC_MS_D", + "KC_WH_D", + "KC_MPLY", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_TRNS", + "KC_TRNS", + "KC_NO", + "KC_NO", + "KC_NO" + ], + [ + "KC_NO", + "KC_HOME", + "KC_DEL", + "KC_PGUP", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_LEFT", + "KC_UP", + "KC_RGHT", + "KC_NO", + "KC_NO", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_NO", + "KC_END", + "KC_DOWN", + "KC_PGDN", + "KC_NO", + "KC_NO", + "KC_BTN1", + "KC_BTN2", + "KC_BTN3", + "KC_BTN4", + "KC_NO", + "KC_TRNS", + "KC_TRNS", + "KC_NO", + "KC_NO", + "KC_NO" + ], + [ + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_WH_U", + "KC_AT", + "KC_UNDS", + "KC_PIPE", + "KC_GRV", + "KC_PERC", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "RGB_TOG", + "KC_HASH", + "KC_TAB", + "KC_EXLM", + "KC_DQUO", + "KC_DLR", + "KC_BTN4", + "KC_BTN3", + "KC_BTN2", + "KC_BTN1", + "KC_WH_D", + "KC_TILD", + "KC_QUOT", + "KC_BSLS", + "KC_SLSH", + "KC_AMPR", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_TRNS", + "KC_TRNS", + "KC_NO" + ], + [ + "KC_EQL", + "KC_CIRC", + "KC_LT", + "KC_GT", + "KC_SCLN", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_LCBR", + "KC_RCBR", + "KC_LPRN", + "KC_RPRN", + "KC_AT", + "KC_NO", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_MINS", + "KC_EXLM", + "KC_LBRC", + "KC_RBRC", + "KC_TRNS", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_NO", + "KC_NO" + ], + [ + "QK_RBT", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_F7", + "KC_F8", + "KC_F9", + "KC_F10", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_NO", + "KC_NO", + "KC_F4", + "KC_F5", + "KC_F6", + "KC_F11", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_F1", + "KC_F2", + "KC_F3", + "KC_F12", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS" + ], + [ + "RGB_SPI", + "RGB_VAI", + "RGB_SAI", + "RGB_HUI", + "RGB_MOD", + "KC_PPLS", + "KC_P7", + "KC_P8", + "KC_P9", + "KC_PAST", + "EE_CLR", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "RGB_TOG", + "KC_PMNS", + "KC_P4", + "KC_P5", + "KC_P6", + "KC_PSLS", + "RGB_SPD", + "RGB_VAD", + "RGB_SAD", + "RGB_HUD", + "RGB_RMOD", + "KC_PDOT", + "KC_P1", + "KC_P2", + "KC_P3", + "KC_PEQL", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_0", + "KC_COMM", + "KC_P0" + ] + ], + "author": "thomas.haukland@gmail.com" +} \ No newline at end of file diff --git a/keyboards/cheapino/matrix.c b/keyboards/cheapino/matrix.c new file mode 100644 index 000000000000..852325202974 --- /dev/null +++ b/keyboards/cheapino/matrix.c @@ -0,0 +1,163 @@ +/* +Copyright 2012 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 . + + Copied from here: https://github.com/e3w2q/qmk_firmware/blob/762fe3e0a7cbea768245a75520f06ff5a2f00b9f/keyboards/2x3test/matrix.c +*/ + +/* + * scan matrix + */ +#include +#include +#include "wait.h" +#include "util.h" +#include "matrix.h" +#include "config.h" +#include "quantum.h" +#include "debounce.h" +#include "encoder.h" +#include "print.h" + +// How long the scanning code waits for changed io to settle. +#define MATRIX_IO_DELAY 30 + +#define COL_SHIFTER ((uint16_t)1) + +static const pin_t row_pins[] = MATRIX_ROW_PINS; +static const pin_t col_pins[] = MATRIX_COL_PINS; +static matrix_row_t previous_matrix[MATRIX_ROWS]; + +static void select_row(uint8_t row) { + setPinOutput(row_pins[row]); + writePinLow(row_pins[row]); +} + +static void unselect_row(uint8_t row) { setPinInputHigh(row_pins[row]); } + +static void unselect_rows(void) { + for (uint8_t x = 0; x < MATRIX_ROWS; x++) { + setPinInputHigh(row_pins[x]); + } +} + +static void select_col(uint8_t col) { + setPinOutput(col_pins[col]); + writePinLow(col_pins[col]); +} + +static void unselect_col(uint8_t col) { + setPinInputHigh(col_pins[col]); +} + +static void unselect_cols(void) { + for (uint8_t x = 0; x < MATRIX_COLS/2; x++) { + setPinInputHigh(col_pins[x*2]); + } +} + +static void read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { + // Select row and wait for row selection to stabilize + select_row(current_row); + wait_us(MATRIX_IO_DELAY); + + // For each col... + for (uint8_t col_index = 0; col_index < MATRIX_COLS / 2; col_index++) { + uint16_t column_index_bitmask = COL_SHIFTER << ((col_index * 2) + 1); + // Check row pin state + if (readPin(col_pins[col_index*2])) { + // Pin HI, clear col bit + current_matrix[current_row] &= ~column_index_bitmask; + } else { + // Pin LO, set col bit + current_matrix[current_row] |= column_index_bitmask; + } + } + + // Unselect row + unselect_row(current_row); +} + +static void read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { + // Select col and wait for col selection to stabilize + select_col(current_col*2); + wait_us(MATRIX_IO_DELAY); + + uint16_t column_index_bitmask = COL_SHIFTER << (current_col * 2); + // For each row... + for (uint8_t row_index = 0; row_index < MATRIX_ROWS-1; row_index++) { + // Check row pin state + if (readPin(row_pins[row_index])) { + // Pin HI, clear col bit + current_matrix[row_index] &= ~column_index_bitmask; + } else { + // Pin LO, set col bit + current_matrix[row_index] |= column_index_bitmask; + } + } + // Unselect col + unselect_col(current_col*2); +} + + +void matrix_init_custom(void) { + // initialize key pins + unselect_cols(); + unselect_rows(); + setPinInput(row_pins[MATRIX_ROWS-1]); + writePinHigh(row_pins[MATRIX_ROWS-1]); + debounce_init(MATRIX_ROWS); +} + +void store_old_matrix(matrix_row_t current_matrix[]) { + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + previous_matrix[i] = current_matrix[i]; + } +} + +bool has_matrix_changed(matrix_row_t current_matrix[]) { + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + if (previous_matrix[i] != current_matrix[i]) return true; + } + return false; +} + +// OK, this is nasty, still not sure why its happening, but +// this 3 key combo leads to ghosting of the 4th(the one missing from correct) +static const uint16_t ghost1_row2 = 0B0000010000100000; +static const uint16_t ghost1_row3 = 0B0000100000100000; +static const matrix_row_t ghost1_row3_correct = 0B0000100000000000; + +void fix_ghosting_issue(matrix_row_t current_matrix[]) { + if (current_matrix[1] == ghost1_row2 && current_matrix[2] == ghost1_row3) { + current_matrix[2] = ghost1_row3_correct; + } +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + store_old_matrix(current_matrix); + // Set row, read cols + for (uint8_t current_row = 0; current_row < MATRIX_ROWS-1; current_row++) { + read_cols_on_row(current_matrix, current_row); + } + // Set col, read rows + for (uint8_t current_col = 0; current_col < MATRIX_COLS/2; current_col++) { + read_rows_on_col(current_matrix, current_col); + } + + fix_ghosting_issue(current_matrix); + + fix_encoder_action(current_matrix); + + return has_matrix_changed(current_matrix); +} + diff --git a/keyboards/cheapino/mcuconf.h b/keyboards/cheapino/mcuconf.h new file mode 100644 index 000000000000..7ed3f874511e --- /dev/null +++ b/keyboards/cheapino/mcuconf.h @@ -0,0 +1,6 @@ + #pragma once + +#include_next + +#undef RP_I2C_USE_I2C1 +#define RP_I2C_USE_I2C1 TRUE diff --git a/keyboards/cheapino/readme.md b/keyboards/cheapino/readme.md new file mode 100644 index 000000000000..4901584a1ca7 --- /dev/null +++ b/keyboards/cheapino/readme.md @@ -0,0 +1,27 @@ +# cheapino + +![cheapino](imgur.com image replace me!) + +*A short description of the keyboard/project* + +* Keyboard Maintainer: [Thomas Haukland](https://github.com/tompi) +* Hardware Supported: *The PCBs, controllers supported* +* Hardware Availability: *Links to where you can find this hardware* + +Make example for this keyboard (after setting up your build environment): + + make cheapino:default + +Flashing example for this keyboard: + + make cheapino: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 3 ways: + +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard +* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead +* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available diff --git a/keyboards/cheapino/rules.mk b/keyboards/cheapino/rules.mk new file mode 100644 index 000000000000..3123102472d0 --- /dev/null +++ b/keyboards/cheapino/rules.mk @@ -0,0 +1,7 @@ +CAPS_WORD_ENABLE = yes +CUSTOM_MATRIX = lite +WS2812_DRIVER = vendor +RGBLIGHT_ENABLE = yes +DEFERRED_EXEC_ENABLE = yes +SRC += encoder.c +SRC += matrix.c \ No newline at end of file