diff options
-rw-r--r-- | keyboards/om60/config.h | 104 | ||||
-rw-r--r-- | keyboards/om60/info.json | 16 | ||||
-rw-r--r-- | keyboards/om60/keymaps/default/keymap.c | 70 | ||||
-rw-r--r-- | keyboards/om60/keymaps/default/rules.mk | 2 | ||||
-rw-r--r-- | keyboards/om60/keymaps/via/keymap.c | 84 | ||||
-rw-r--r-- | keyboards/om60/keymaps/via/rules.mk | 3 | ||||
-rw-r--r-- | keyboards/om60/matrix.c | 166 | ||||
-rw-r--r-- | keyboards/om60/om60.c | 19 | ||||
-rw-r--r-- | keyboards/om60/om60.h | 41 | ||||
-rw-r--r-- | keyboards/om60/readme.md | 27 | ||||
-rw-r--r-- | keyboards/om60/rules.mk | 24 |
11 files changed, 556 insertions, 0 deletions
diff --git a/keyboards/om60/config.h b/keyboards/om60/config.h new file mode 100644 index 0000000000..624579be7e --- /dev/null +++ b/keyboards/om60/config.h @@ -0,0 +1,104 @@ +/* +Copyright 2021 Salicylic_Acid +Copyright 2021 3araht +Copyright 2022 jun10000 + +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" + + +/* key matrix size */ +#define MATRIX_ROWS 10 +#define MATRIX_COLS 8 + +// wiring of each half +#define MATRIX_ROW_PINS { D1, D0, D4, C6, D7 } +#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2, E6 } + +/* Set 0 if debouncing isn't 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 + +/* ws2812 RGB LED */ +#define RGB_DI_PIN D3 + +#ifndef RGBLED_NUM + #define RGBLED_NUM 69 + #define RGBLIGHT_LED_MAP { \ + 0, 1, 2, 3, \ + 8, 7, 6, 5, 4, \ + 9,10,11,12,13, \ + 18,17,16,15,14, \ + 19,20,21,22,23, \ + 28,27,26,25,24, \ + 29,30,31,32,33, \ + 38,37,36,35,34, \ + 39,40,41,42,43, \ + 48,47,46,45,44, \ + 49,50,51,52,53, \ + 58,57,56,55,54, \ + 59,60,61,62,63, \ + 68,67,66,65,64 \ + } + + #define RGBLIGHT_SLEEP +#endif + +#define RGBLIGHT_EFFECT_BREATHING +#define RGBLIGHT_EFFECT_RAINBOW_MOOD +#define RGBLIGHT_EFFECT_RAINBOW_SWIRL +#define RGBLIGHT_EFFECT_SNAKE +#define RGBLIGHT_EFFECT_KNIGHT +#define RGBLIGHT_EFFECT_CHRISTMAS +#define RGBLIGHT_EFFECT_STATIC_GRADIENT +#define RGBLIGHT_EFFECT_RGB_TEST +#define RGBLIGHT_EFFECT_ALTERNATING +#define RGBLIGHT_EFFECT_TWINKLE + +#ifndef IOS_DEVICE_ENABLE + #define RGBLIGHT_LIMIT_VAL 90 + #define RGBLIGHT_VAL_STEP 17 +#else + #define RGBLIGHT_LIMIT_VAL 30 + #define RGBLIGHT_VAL_STEP 4 +#endif +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 + +#if defined(RGBLIGHT_ENABLE) && !defined(IOS_DEVICE_ENABLE) +// USB_MAX_POWER_CONSUMPTION value for naked48 keyboard +// 120 RGBoff, OLEDoff +// 120 OLED +// 330 RGB 6 +// 300 RGB 32 +// 310 OLED & RGB 32 + #define USB_MAX_POWER_CONSUMPTION 400 +#else + // fix iPhone and iPad power adapter issue + // iOS device need lessthan 100 + #define USB_MAX_POWER_CONSUMPTION 100 +#endif + +#define TAP_CODE_DELAY 10 + +#define ENCODERS_PAD_A { B4 } +#define ENCODERS_PAD_B { B5 } diff --git a/keyboards/om60/info.json b/keyboards/om60/info.json new file mode 100644 index 0000000000..319dca0071 --- /dev/null +++ b/keyboards/om60/info.json @@ -0,0 +1,16 @@ +{ + "keyboard_name": "OM60", + "manufacturer": "jun10000", + "url": "https://github.com/jun10000", + "maintainer": "jun10000", + "usb": { + "vid": "0x6A6E", + "pid": "0x0001", + "device_version": "1.0.0" + }, + "layouts": { + "LAYOUT": { + "layout": [{"label":"0,0", "x":0, "y":0}, {"label":"4,0", "x":1.5, "y":0}, {"label":"4,1", "x":2.5, "y":0}, {"label":"4,2", "x":3.5, "y":0}, {"label":"4,3", "x":4.5, "y":0}, {"label":"4,4", "x":5.5, "y":0}, {"label":"4,5", "x":6.5, "y":0}, {"label":"4,6", "x":7.5, "y":0}, {"label":"4,7", "x":8.5, "y":0}, {"label":"9,0", "x":9.5, "y":0}, {"label":"9,1", "x":10.5, "y":0}, {"label":"9,2", "x":11.5, "y":0}, {"label":"9,3", "x":12.5, "y":0}, {"label":"9,4", "x":13.5, "y":0}, {"label":"0,1", "x":1.5, "y":1}, {"label":"0,2", "x":2.5, "y":1}, {"label":"0,3", "x":3.5, "y":1}, {"label":"0,4", "x":4.5, "y":1}, {"label":"0,5", "x":5.5, "y":1}, {"label":"0,6", "x":6.5, "y":1}, {"label":"0,7", "x":7.5, "y":1}, {"label":"5,0", "x":8.5, "y":1}, {"label":"5,1", "x":9.5, "y":1}, {"label":"5,2", "x":10.5, "y":1}, {"label":"5,3", "x":11.5, "y":1}, {"label":"5,4", "x":12.5, "y":1}, {"label":"5,5", "x":13.5, "y":1}, {"label":"1,0", "x":0, "y":2}, {"label":"1,1", "x":1.5, "y":2}, {"label":"1,2", "x":2.5, "y":2}, {"label":"1,3", "x":3.5, "y":2}, {"label":"1,4", "x":4.5, "y":2}, {"label":"1,5", "x":5.5, "y":2}, {"label":"1,6", "x":6.5, "y":2}, {"label":"1,7", "x":7.5, "y":2}, {"label":"6,0", "x":8.5, "y":2}, {"label":"6,1", "x":9.5, "y":2}, {"label":"6,2", "x":10.5, "y":2}, {"label":"6,3", "x":11.5, "y":2}, {"label":"6,4", "x":12.5, "y":2}, {"label":"6,5", "x":13.5, "y":2}, {"label":"2,0", "x":0, "y":3}, {"label":"2,1", "x":1.5, "y":3}, {"label":"2,2", "x":2.5, "y":3}, {"label":"2,3", "x":3.5, "y":3}, {"label":"2,4", "x":4.5, "y":3}, {"label":"2,5", "x":5.5, "y":3}, {"label":"2,6", "x":6.5, "y":3}, {"label":"2,7", "x":7.5, "y":3}, {"label":"7,0", "x":8.5, "y":3}, {"label":"7,1", "x":9.5, "y":3}, {"label":"7,2", "x":10.5, "y":3}, {"label":"7,3", "x":11.5, "y":3}, {"label":"7,4", "x":12.5, "y":3}, {"label":"7,5", "x":13.5, "y":3}, {"label":"3,0", "x":0, "y":4}, {"label":"3,1", "x":1.5, "y":4}, {"label":"3,2", "x":2.5, "y":4}, {"label":"3,3", "x":3.5, "y":4}, {"label":"3,4", "x":4.5, "y":4}, {"label":"3,5", "x":5.5, "y":4}, {"label":"3,6", "x":6.5, "y":4}, {"label":"3,7", "x":7.5, "y":4}, {"label":"8,0", "x":8.5, "y":4}, {"label":"8,1", "x":9.5, "y":4}, {"label":"8,2", "x":10.5, "y":4}, {"label":"8,3", "x":11.5, "y":4}, {"label":"8,4", "x":12.5, "y":4}, {"label":"8,5", "x":13.5, "y":4}] + } + } +}
\ No newline at end of file diff --git a/keyboards/om60/keymaps/default/keymap.c b/keyboards/om60/keymaps/default/keymap.c new file mode 100644 index 0000000000..336b98d3bf --- /dev/null +++ b/keyboards/om60/keymaps/default/keymap.c @@ -0,0 +1,70 @@ +/* +Copyright 2021 Salicylic_Acid +Copyright 2021 3araht +Copyright 2022 jun10000 + +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 QMK_KEYBOARD_H + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [1] = { ENCODER_CCW_CW(_______, _______) }, + [2] = { ENCODER_CCW_CW(_______, _______) }, +}; +#endif + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + //,-----------------------------------------------------------------------------------------------------------------------------. + KC_MUTE, 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_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, KC_BSPC, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(0), KC_GRV, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(1), KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, KC_RSFT, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(2),KC_LCTRL, KC_LGUI, KC_LALT, KC_DEL, KC_LBRC, KC_SPC, KC_SPC, KC_RBRC, KC_RALT, KC_CAPS, KC_LEFT, KC_DOWN, KC_RGHT + //|-----------------------------------------------------------------------------------------------------------------------------' + ), + [1] = 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_SLSH, KC_ASTR, KC_MINS, KC_PLUS, KC_BSPC, _______, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(0), _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_EQL, _______, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(1), _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DOT, KC_ENT, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(2), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + //|-----------------------------------------------------------------------------------------------------------------------------' + ), + [2] = LAYOUT( + //,-----------------------------------------------------------------------------------------------------------------------------. + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, EE_CLR, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + _______, _______, _______, KC_UP, _______, _______, _______,RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(0), _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(1), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(2), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + //|-----------------------------------------------------------------------------------------------------------------------------' + ) +}; diff --git a/keyboards/om60/keymaps/default/rules.mk b/keyboards/om60/keymaps/default/rules.mk new file mode 100644 index 0000000000..8acf3d642b --- /dev/null +++ b/keyboards/om60/keymaps/default/rules.mk @@ -0,0 +1,2 @@ +LTO_ENABLE = yes +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/om60/keymaps/via/keymap.c b/keyboards/om60/keymaps/via/keymap.c new file mode 100644 index 0000000000..beb4ab962b --- /dev/null +++ b/keyboards/om60/keymaps/via/keymap.c @@ -0,0 +1,84 @@ +/* +Copyright 2021 Salicylic_Acid +Copyright 2021 3araht +Copyright 2022 jun10000 + +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 QMK_KEYBOARD_H + +#if defined(ENCODER_MAP_ENABLE) +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [1] = { ENCODER_CCW_CW(_______, _______) }, + [2] = { ENCODER_CCW_CW(_______, _______) }, + [3] = { ENCODER_CCW_CW(_______, _______) }, +}; +#endif + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + //,-----------------------------------------------------------------------------------------------------------------------------. + KC_MUTE, 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_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, KC_BSPC, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(0), KC_GRV, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(1), KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, KC_RSFT, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(2),KC_LCTRL, KC_LGUI, KC_LALT, KC_DEL, KC_LBRC, KC_SPC, KC_SPC, KC_RBRC, KC_RALT, KC_CAPS, KC_LEFT, KC_DOWN, KC_RGHT + //|-----------------------------------------------------------------------------------------------------------------------------' + ), + [1] = 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_SLSH, KC_ASTR, KC_MINS, KC_PLUS, KC_BSPC, _______, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(0), _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_EQL, _______, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(1), _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DOT, KC_ENT, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(2), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + //|-----------------------------------------------------------------------------------------------------------------------------' + ), + [2] = LAYOUT( + //,-----------------------------------------------------------------------------------------------------------------------------. + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, EE_CLR, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + _______, _______, _______, KC_UP, _______, _______, _______,RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(0), _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(1), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(2), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + //|-----------------------------------------------------------------------------------------------------------------------------' + ), + [3] = LAYOUT( + //,-----------------------------------------------------------------------------------------------------------------------------. + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(0), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(1), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + //|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------| + TO(2), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + //|-----------------------------------------------------------------------------------------------------------------------------' + ) +}; diff --git a/keyboards/om60/keymaps/via/rules.mk b/keyboards/om60/keymaps/via/rules.mk new file mode 100644 index 0000000000..1189f4ad19 --- /dev/null +++ b/keyboards/om60/keymaps/via/rules.mk @@ -0,0 +1,3 @@ +VIA_ENABLE = yes +LTO_ENABLE = yes +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/om60/matrix.c b/keyboards/om60/matrix.c new file mode 100644 index 0000000000..3686780468 --- /dev/null +++ b/keyboards/om60/matrix.c @@ -0,0 +1,166 @@ +/* +Copyright 2012-2018 Jun Wako, Jack Humbert, Yiancar +Copyright 2022 jun10000 + +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" + +#if (MATRIX_COLS <= 8) +# define ROW_SHIFTER ((uint8_t)1) +#elif (MATRIX_COLS <= 16) +# define ROW_SHIFTER ((uint16_t)1) +#elif (MATRIX_COLS <= 32) +# define ROW_SHIFTER ((uint32_t)1) +#endif + +static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +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; x++) { + setPinInputHigh(col_pins[x]); + } +} + +static void init_pins(void) { + unselect_rows(); + unselect_cols(); + for (uint8_t x = 0; x < MATRIX_COLS; x++) { + setPinInputHigh(col_pins[x]); + } + for (uint8_t x = 0; x < MATRIX_ROWS; x++) { + setPinInputHigh(row_pins[x]); + } +} + +static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) +{ + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[current_row]; + + // Clear data in matrix row + current_matrix[current_row] = 0; + + // Select row and wait for row selecton to stabilize + select_row(current_row); + wait_us(30); + + // For each col... + for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { + + // Select the col pin to read (active low) + uint8_t pin_state = readPin(col_pins[col_index]); + + // Populate the matrix row with the state of the col pin + current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); + } + + // Unselect row + unselect_row(current_row); + + return (last_row_value != current_matrix[current_row]); +} + +static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) +{ + bool matrix_changed = false; + + // Select col and wait for col selecton to stabilize + select_col(current_col); + wait_us(30); + + // For each row... + for(uint8_t row_index = 0; row_index < MATRIX_ROWS/2; row_index++) + { + uint8_t tmp = row_index + MATRIX_ROWS/2; + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[tmp]; + + // Check row pin state + if (readPin(row_pins[row_index]) == 0) + { + // Pin LO, set col bit + current_matrix[tmp] |= (ROW_SHIFTER << current_col); + } + else + { + // Pin HI, clear col bit + current_matrix[tmp] &= ~(ROW_SHIFTER << current_col); + } + + // Determine if the matrix changed state + if ((last_row_value != current_matrix[tmp]) && !(matrix_changed)) + { + matrix_changed = true; + } + } + + // Unselect col + unselect_col(current_col); + + return matrix_changed; +} + +void matrix_init_custom(void) { + // initialize key pins + init_pins(); +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) +{ + bool changed = false; + + // Set row, read cols + for (uint8_t current_row = 0; current_row < MATRIX_ROWS / 2; current_row++) { + changed |= read_cols_on_row(current_matrix, current_row); + } + //else + // Set col, read rows + for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { + changed |= read_rows_on_col(current_matrix, current_col); + } + + return (uint8_t)changed; +} diff --git a/keyboards/om60/om60.c b/keyboards/om60/om60.c new file mode 100644 index 0000000000..9e66d6721c --- /dev/null +++ b/keyboards/om60/om60.c @@ -0,0 +1,19 @@ +/* +Copyright 2021 Salicylic_Acid +Copyright 2022 jun10000 + +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 "om60.h" diff --git a/keyboards/om60/om60.h b/keyboards/om60/om60.h new file mode 100644 index 0000000000..669a610031 --- /dev/null +++ b/keyboards/om60/om60.h @@ -0,0 +1,41 @@ +/* +Copyright 2021 Salicylic_Acid +Copyright 2022 jun10000 + +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( \ + L01, L05, L10, L15, L20, L25, L30, L35, L40, R45, R50, R55, R60, R65, \ + L06, L11, L16, L21, L26, L31, L36, R41, R46, R51, R56, R61, R66, \ + L02, L07, L12, L17, L22, L27, L32, L37, R42, R47, R52, R57, R62, R67, \ + L03, L08, L13, L18, L23, L28, L33, L38, R43, R48, R53, R58, R63, R68, \ + L04, L09, L14, L19, L24, L29, L34, L39, R44, R49, R54, R59, R64, R69 \ + ) \ + { \ + { L01, L06, L11, L16, L21, L26, L31, L36 }, \ + { L02, L07, L12, L17, L22, L27, L32, L37 }, \ + { L03, L08, L13, L18, L23, L28, L33, L38 }, \ + { L04, L09, L14, L19, L24, L29, L34, L39 }, \ + { L05, L10, L15, L20, L25, L30, L35, L40 }, \ + { R41, R46, R51, R56, R61, R66, KC_NO, KC_NO }, \ + { R42, R47, R52, R57, R62, R67, KC_NO, KC_NO }, \ + { R43, R48, R53, R58, R63, R68, KC_NO, KC_NO }, \ + { R44, R49, R54, R59, R64, R69, KC_NO, KC_NO }, \ + { R45, R50, R55, R60, R65, KC_NO, KC_NO, KC_NO } \ + } diff --git a/keyboards/om60/readme.md b/keyboards/om60/readme.md new file mode 100644 index 0000000000..5d9d096d56 --- /dev/null +++ b/keyboards/om60/readme.md @@ -0,0 +1,27 @@ +# OM60 + +![OM60](https://i.imgur.com/WoO8oezh.jpg) + +The 60% Poker compatible Ortholinear keyboard or jumbo Macropad. + +* Keyboard Maintainer: [jun10000](https://github.com/jun10000) +* Hardware Supported: OM60 PCB, Pro Micro +* Hardware Availability: [junsgamingstore.booth.pm](https://junsgamingstore.booth.pm/) + +Make example for this keyboard (after setting up your build environment): + + make om60:default + +Flashing example for this keyboard: + + make om60: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
\ No newline at end of file diff --git a/keyboards/om60/rules.mk b/keyboards/om60/rules.mk new file mode 100644 index 0000000000..9dc673edbf --- /dev/null +++ b/keyboards/om60/rules.mk @@ -0,0 +1,24 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # 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 = no # 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 + +CUSTOM_MATRIX = lite + +SRC += matrix.c |