diff --git a/keyboards/cheapino/encoder.c b/keyboards/cheapino/encoder.c index 4ca688443d..e5920dce49 100644 --- a/keyboards/cheapino/encoder.c +++ b/keyboards/cheapino/encoder.c @@ -4,11 +4,11 @@ #define COL_SHIFTER ((uint16_t)1) #define ENC_ROW 3 -#define ENC_A_COL 3 -#define ENC_B_COL 5 -#define ENC_BUTTON_COL 1 +#define ENC_A_COL 2 +#define ENC_B_COL 4 +#define ENC_BUTTON_COL 0 -static bool colABpressed = false; +static bool colABPressed = false; static bool encoderPressed = false; void clicked(void) { @@ -21,42 +21,18 @@ void turned(bool clockwise) { } else if (IS_LAYER_ON(3)) { tap_code16(clockwise ? LCTL(KC_TAB) : LCTL(LSFT(KC_TAB))); } else if (IS_LAYER_ON(5)) { - tap_code(clockwise ? KC_MS_WH_DOWN : KC_MS_WH_UP); - } else { tap_code16(clockwise ? LGUI(KC_Y) : LGUI(KC_Z)); + } else { + tap_code16(clockwise ? KC_PGDN : KC_PGUP); } } -// Dead code for now, not sure if there's edge cases that needed it -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; row_index++) { - current_matrix[row_index] &= ~column_index_bitmask; - } -} - -// Dead code for now, not sure if there's edge cases that needed it -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; 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[]) { matrix_row_t encoder_row = current_matrix[ENC_ROW]; - // 7th column means encoder was pressed if (encoder_row & (COL_SHIFTER << ENC_BUTTON_COL)) { encoderPressed = true; - // blank_column(current_matrix, 7); - current_matrix[3] |= COL_SHIFTER << 1; } else { - current_matrix[3] &= ~COL_SHIFTER << 1; // Only trigger click on release if (encoderPressed) { encoderPressed = false; @@ -64,22 +40,24 @@ void fix_encoder_action(matrix_row_t current_matrix[]) { } } - // Check if the pin is pressed, as from observation when encoder is spun - // it doesn't result in all of the columns to turn on anymore + // Check which way the encoder is turned: bool colA = encoder_row & (COL_SHIFTER << ENC_A_COL); bool colB = encoder_row & (COL_SHIFTER << ENC_B_COL); if (colA && colB) { - colABpressed = true; + colABPressed = true; } else if (colA) { - if (colABpressed) { - colABpressed = false; + if (colABPressed) { + // A+B followed by A means clockwise + colABPressed = false; turned(true); } } else if (colB) { - if (colABpressed) { - colABpressed = false; + if (colABPressed) { + // A+B followed by B means counter-clockwise + colABPressed = false; turned(false); } } + current_matrix[ENC_ROW] = 0; } diff --git a/keyboards/cheapino/info.json b/keyboards/cheapino/info.json index ed251a4c12..74ba93df96 100644 --- a/keyboards/cheapino/info.json +++ b/keyboards/cheapino/info.json @@ -41,52 +41,52 @@ "layouts": { "LAYOUT_split_3x5_3": { "layout": [ - { "matrix": [4, 11], "x": 0, "y": 0.25 }, - { "matrix": [4, 8], "x": 1, "y": 0.125 }, - { "matrix": [4, 9], "x": 2, "y": 0 }, - { "matrix": [4, 6], "x": 3, "y": 0.125 }, - { "matrix": [4, 7], "x": 4, "y": 0.25 }, + { "matrix": [4, 10], "x": 0, "y": 0.25 }, + { "matrix": [4, 9], "x": 1, "y": 0.125 }, + { "matrix": [4, 8], "x": 2, "y": 0 }, + { "matrix": [4, 7], "x": 3, "y": 0.125 }, + { "matrix": [4, 6], "x": 4, "y": 0.25 }, - { "matrix": [0, 1], "x": 7, "y": 0.25 }, - { "matrix": [0, 0], "x": 8, "y": 0.125 }, - { "matrix": [0, 3], "x": 9, "y": 0 }, - { "matrix": [0, 2], "x": 10, "y": 0.125 }, - { "matrix": [0, 5], "x": 11, "y": 0.25 }, + { "matrix": [0, 0], "x": 7, "y": 0.25 }, + { "matrix": [0, 1], "x": 8, "y": 0.125 }, + { "matrix": [0, 2], "x": 9, "y": 0 }, + { "matrix": [0, 3], "x": 10, "y": 0.125 }, + { "matrix": [0, 4], "x": 11, "y": 0.25 }, - { "matrix": [5, 11], "x": 0, "y": 1.25 }, - { "matrix": [5, 8], "x": 1, "y": 1.125 }, - { "matrix": [5, 9], "x": 2, "y": 1 }, - { "matrix": [5, 6], "x": 3, "y": 1.125 }, - { "matrix": [5, 7], "x": 4, "y": 1.25 }, + { "matrix": [5, 10], "x": 0, "y": 1.25 }, + { "matrix": [5, 9], "x": 1, "y": 1.125 }, + { "matrix": [5, 8], "x": 2, "y": 1 }, + { "matrix": [5, 7], "x": 3, "y": 1.125 }, + { "matrix": [5, 6], "x": 4, "y": 1.25 }, - { "matrix": [1, 1], "x": 7, "y": 1.25 }, - { "matrix": [1, 0], "x": 8, "y": 1.125 }, - { "matrix": [1, 3], "x": 9, "y": 1 }, - { "matrix": [1, 2], "x": 10, "y": 1.125 }, - { "matrix": [1, 5], "x": 11, "y": 1.25 }, + { "matrix": [1, 0], "x": 7, "y": 1.25 }, + { "matrix": [1, 1], "x": 8, "y": 1.125 }, + { "matrix": [1, 2], "x": 9, "y": 1 }, + { "matrix": [1, 3], "x": 10, "y": 1.125 }, + { "matrix": [1, 4], "x": 11, "y": 1.25 }, - { "matrix": [6, 11], "x": 0, "y": 2.25 }, - { "matrix": [6, 8], "x": 1, "y": 2.125 }, - { "matrix": [6, 9], "x": 2, "y": 2 }, - { "matrix": [6, 6], "x": 3, "y": 2.125 }, - { "matrix": [6, 7], "x": 4, "y": 2.25 }, + { "matrix": [6, 10], "x": 0, "y": 2.25 }, + { "matrix": [6, 9], "x": 1, "y": 2.125 }, + { "matrix": [6, 8], "x": 2, "y": 2 }, + { "matrix": [6, 7], "x": 3, "y": 2.125 }, + { "matrix": [6, 6], "x": 4, "y": 2.25 }, - { "matrix": [2, 1], "x": 7, "y": 2.25 }, - { "matrix": [2, 0], "x": 8, "y": 2.125 }, - { "matrix": [2, 3], "x": 9, "y": 2 }, - { "matrix": [2, 2], "x": 10, "y": 2.125 }, - { "matrix": [2, 5], "x": 11, "y": 2.25 }, + { "matrix": [2, 0], "x": 7, "y": 2.25 }, + { "matrix": [2, 1], "x": 8, "y": 2.125 }, + { "matrix": [2, 2], "x": 9, "y": 2 }, + { "matrix": [2, 3], "x": 10, "y": 2.125 }, + { "matrix": [2, 4], "x": 11, "y": 2.25 }, - { "matrix": [6, 10], "x": 2.5, "y": 3.25 }, - { "matrix": [5, 10], "x": 3.5, "y": 3.5 }, - { "matrix": [4, 10], "x": 4.5, "y": 3.75 }, + { "matrix": [6, 11], "x": 2.5, "y": 3.25 }, + { "matrix": [5, 11], "x": 3.5, "y": 3.5 }, + { "matrix": [4, 11], "x": 4.5, "y": 3.75 }, - { "matrix": [0, 4], "x": 6.5, "y": 3.75 }, - { "matrix": [1, 4], "x": 7.5, "y": 3.5 }, - { "matrix": [2, 4], "x": 8.5, "y": 3.25 } + { "matrix": [0, 5], "x": 6.5, "y": 3.75 }, + { "matrix": [1, 5], "x": 7.5, "y": 3.5 }, + { "matrix": [2, 5], "x": 8.5, "y": 3.25 } ] } } diff --git a/keyboards/cheapino/v2/info.json b/keyboards/cheapino/v2/info.json deleted file mode 100644 index 8804435fa9..0000000000 --- a/keyboards/cheapino/v2/info.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "manufacturer": "Thomas Haukland", - "keyboard_name": "cheapino2", - "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", "GP14", "GP14", "GP15", "GP15", "GP26", "GP26"], - "rows": ["GP3", "GP4", "GP5", "GP6", "GP27", "GP28", "GP29", "GP8"] - }, - "processor": "RP2040", - "url": "", - "usb": { - "device_version": "1.0.0", - "pid": "0x0000", - "vid": "0xFEE3" - }, - "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/v2/rules.mk b/keyboards/cheapino/v2/rules.mk deleted file mode 100644 index e69de29bb2..0000000000