diff options
| author | QMK Bot <hello@qmk.fm> | 2023-03-23 10:10:35 +0000 |
|---|---|---|
| committer | QMK Bot <hello@qmk.fm> | 2023-03-23 10:10:35 +0000 |
| commit | b72b487b4dcfff01ebdd1c7ad697af20e7180354 (patch) | |
| tree | 910d514b80fe4f1fdcae9901a94ccbe5c081deac | |
| parent | c7756f53263f33352ba2a76cc1e674965d4d0137 (diff) | |
| parent | 15cb7ded76794a94fa7be3c2b8d3bad1607582aa (diff) | |
Merge remote-tracking branch 'origin/master' into develop
29 files changed, 1675 insertions, 0 deletions
diff --git a/keyboards/cipulot/ec_prox/ansi_iso/config.h b/keyboards/cipulot/ec_prox/ansi_iso/config.h new file mode 100644 index 0000000000..b659097656 --- /dev/null +++ b/keyboards/cipulot/ec_prox/ansi_iso/config.h | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #define MATRIX_ROWS 5 | ||
| 20 | #define MATRIX_COLS 15 | ||
| 21 | |||
| 22 | /* Custom matrix pins and port select array */ | ||
| 23 | #define MATRIX_ROW_PINS \ | ||
| 24 | { A7, B0, A4, A5, A6 } | ||
| 25 | #define MATRIX_COL_CHANNELS \ | ||
| 26 | { 0, 3, 1, 2, 5, 7, 6, 4 } | ||
| 27 | #define MUX_SEL_PINS \ | ||
| 28 | { B4, B5, B6 } | ||
| 29 | |||
| 30 | /* Hardware peripherals pins */ | ||
| 31 | #define APLEX_EN_PIN_0 B7 | ||
| 32 | #define APLEX_EN_PIN_1 B3 | ||
| 33 | #define DISCHARGE_PIN A2 | ||
| 34 | #define ANALOG_PORT A1 | ||
| 35 | |||
| 36 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
| 37 | #define LOCKING_SUPPORT_ENABLE | ||
| 38 | |||
| 39 | /* Locking resynchronize hack */ | ||
| 40 | #define LOCKING_RESYNC_ENABLE | ||
| 41 | |||
| 42 | #define DEFAULT_ACTUATION_LEVEL 550 | ||
| 43 | #define DEFAULT_RELEASE_LEVEL 500 | ||
| 44 | |||
| 45 | #define DISCHARGE_TIME 10 | ||
diff --git a/keyboards/cipulot/ec_prox/ansi_iso/ec_switch_matrix.c b/keyboards/cipulot/ec_prox/ansi_iso/ec_switch_matrix.c new file mode 100644 index 0000000000..d45e8c3281 --- /dev/null +++ b/keyboards/cipulot/ec_prox/ansi_iso/ec_switch_matrix.c | |||
| @@ -0,0 +1,183 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "ec_switch_matrix.h" | ||
| 18 | #include "analog.h" | ||
| 19 | #include "atomic_util.h" | ||
| 20 | #include "print.h" | ||
| 21 | #include "wait.h" | ||
| 22 | |||
| 23 | /* Pin and port array */ | ||
| 24 | const uint32_t row_pins[] = MATRIX_ROW_PINS; | ||
| 25 | const uint8_t col_channels[] = MATRIX_COL_CHANNELS; | ||
| 26 | const uint32_t mux_sel_pins[] = MUX_SEL_PINS; | ||
| 27 | |||
| 28 | static ecsm_config_t config; | ||
| 29 | static uint16_t ecsm_sw_value[MATRIX_ROWS][MATRIX_COLS]; | ||
| 30 | |||
| 31 | static adc_mux adcMux; | ||
| 32 | |||
| 33 | static inline void discharge_capacitor(void) { | ||
| 34 | writePinLow(DISCHARGE_PIN); | ||
| 35 | } | ||
| 36 | static inline void charge_capacitor(uint8_t row) { | ||
| 37 | writePinHigh(DISCHARGE_PIN); | ||
| 38 | writePinHigh(row_pins[row]); | ||
| 39 | } | ||
| 40 | |||
| 41 | static inline void init_mux_sel(void) { | ||
| 42 | for (int idx = 0; idx < 3; idx++) { | ||
| 43 | setPinOutput(mux_sel_pins[idx]); | ||
| 44 | } | ||
| 45 | } | ||
| 46 | |||
| 47 | static inline void select_mux(uint8_t col) { | ||
| 48 | uint8_t ch = col_channels[col]; | ||
| 49 | writePin(mux_sel_pins[0], ch & 1); | ||
| 50 | writePin(mux_sel_pins[1], ch & 2); | ||
| 51 | writePin(mux_sel_pins[2], ch & 4); | ||
| 52 | } | ||
| 53 | |||
| 54 | static inline void init_row(void) { | ||
| 55 | for (int idx = 0; idx < MATRIX_ROWS; idx++) { | ||
| 56 | setPinOutput(row_pins[idx]); | ||
| 57 | writePinLow(row_pins[idx]); | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | /* Initialize the peripherals pins */ | ||
| 62 | int ecsm_init(ecsm_config_t const* const ecsm_config) { | ||
| 63 | // Initialize config | ||
| 64 | config = *ecsm_config; | ||
| 65 | |||
| 66 | palSetLineMode(ANALOG_PORT, PAL_MODE_INPUT_ANALOG); | ||
| 67 | adcMux = pinToMux(ANALOG_PORT); | ||
| 68 | |||
| 69 | // Dummy call to make sure that adcStart() has been called in the appropriate state | ||
| 70 | adc_read(adcMux); | ||
| 71 | |||
| 72 | // Initialize discharge pin as discharge mode | ||
| 73 | writePinLow(DISCHARGE_PIN); | ||
| 74 | setPinOutputOpenDrain(DISCHARGE_PIN); | ||
| 75 | |||
| 76 | // Initialize drive lines | ||
| 77 | init_row(); | ||
| 78 | |||
| 79 | // Initialize multiplexer select pin | ||
| 80 | init_mux_sel(); | ||
| 81 | |||
| 82 | // Enable AMUX | ||
| 83 | setPinOutput(APLEX_EN_PIN_0); | ||
| 84 | writePinLow(APLEX_EN_PIN_0); | ||
| 85 | setPinOutput(APLEX_EN_PIN_1); | ||
| 86 | writePinLow(APLEX_EN_PIN_1); | ||
| 87 | |||
| 88 | return 0; | ||
| 89 | } | ||
| 90 | |||
| 91 | int ecsm_update(ecsm_config_t const* const ecsm_config) { | ||
| 92 | // Save config | ||
| 93 | config = *ecsm_config; | ||
| 94 | return 0; | ||
| 95 | } | ||
| 96 | |||
| 97 | // Read the capacitive sensor value | ||
| 98 | uint16_t ecsm_readkey_raw(uint8_t channel, uint8_t row, uint8_t col) { | ||
| 99 | uint16_t sw_value = 0; | ||
| 100 | |||
| 101 | // Select the multiplexer | ||
| 102 | if (channel == 0) { | ||
| 103 | writePinHigh(APLEX_EN_PIN_0); | ||
| 104 | select_mux(col); | ||
| 105 | writePinLow(APLEX_EN_PIN_0); | ||
| 106 | } else { | ||
| 107 | writePinHigh(APLEX_EN_PIN_1); | ||
| 108 | select_mux(col); | ||
| 109 | writePinLow(APLEX_EN_PIN_1); | ||
| 110 | } | ||
| 111 | |||
| 112 | // Set strobe pins to low state | ||
| 113 | writePinLow(row_pins[row]); | ||
| 114 | ATOMIC_BLOCK_FORCEON { | ||
| 115 | // Set the row pin to high state and have capacitor charge | ||
| 116 | charge_capacitor(row); | ||
| 117 | // Read the ADC value | ||
| 118 | sw_value = adc_read(adcMux); | ||
| 119 | } | ||
| 120 | // Discharge peak hold capacitor | ||
| 121 | discharge_capacitor(); | ||
| 122 | // Waiting for the ghost capacitor to discharge fully | ||
| 123 | wait_us(DISCHARGE_TIME); | ||
| 124 | |||
| 125 | return sw_value; | ||
| 126 | } | ||
| 127 | |||
| 128 | // Update press/release state of key | ||
| 129 | bool ecsm_update_key(matrix_row_t* current_row, uint8_t row, uint8_t col, uint16_t sw_value) { | ||
| 130 | bool current_state = (*current_row >> col) & 1; | ||
| 131 | |||
| 132 | // Press to release | ||
| 133 | if (current_state && sw_value < config.ecsm_actuation_threshold) { | ||
| 134 | *current_row &= ~(1 << col); | ||
| 135 | return true; | ||
| 136 | } | ||
| 137 | |||
| 138 | // Release to press | ||
| 139 | if ((!current_state) && sw_value > config.ecsm_release_threshold) { | ||
| 140 | *current_row |= (1 << col); | ||
| 141 | return true; | ||
| 142 | } | ||
| 143 | |||
| 144 | return false; | ||
| 145 | } | ||
| 146 | |||
| 147 | // Scan key values and update matrix state | ||
| 148 | bool ecsm_matrix_scan(matrix_row_t current_matrix[]) { | ||
| 149 | bool updated = false; | ||
| 150 | |||
| 151 | // Disable AMUX of channel 1 | ||
| 152 | writePinHigh(APLEX_EN_PIN_1); | ||
| 153 | for (int col = 0; col < sizeof(col_channels); col++) { | ||
| 154 | for (int row = 0; row < MATRIX_ROWS; row++) { | ||
| 155 | ecsm_sw_value[row][col] = ecsm_readkey_raw(0, row, col); | ||
| 156 | updated |= ecsm_update_key(¤t_matrix[row], row, col, ecsm_sw_value[row][col]); | ||
| 157 | } | ||
| 158 | } | ||
| 159 | |||
| 160 | // Disable AMUX of channel 1 | ||
| 161 | writePinHigh(APLEX_EN_PIN_0); | ||
| 162 | for (int col = 0; col < (sizeof(col_channels) - 1); col++) { | ||
| 163 | for (int row = 0; row < MATRIX_ROWS; row++) { | ||
| 164 | ecsm_sw_value[row][col + 8] = ecsm_readkey_raw(1, row, col); | ||
| 165 | updated |= ecsm_update_key(¤t_matrix[row], row, col + 8, ecsm_sw_value[row][col + 8]); | ||
| 166 | } | ||
| 167 | } | ||
| 168 | return updated; | ||
| 169 | } | ||
| 170 | |||
| 171 | // Debug print key values | ||
| 172 | void ecsm_print_matrix(void) { | ||
| 173 | for (int row = 0; row < MATRIX_ROWS; row++) { | ||
| 174 | for (int col = 0; col < MATRIX_COLS; col++) { | ||
| 175 | uprintf("%4d", ecsm_sw_value[row][col]); | ||
| 176 | if (col < (MATRIX_COLS - 1)) { | ||
| 177 | print(","); | ||
| 178 | } | ||
| 179 | } | ||
| 180 | print("\n"); | ||
| 181 | } | ||
| 182 | print("\n"); | ||
| 183 | } | ||
diff --git a/keyboards/cipulot/ec_prox/ansi_iso/ec_switch_matrix.h b/keyboards/cipulot/ec_prox/ansi_iso/ec_switch_matrix.h new file mode 100644 index 0000000000..9dcb216caa --- /dev/null +++ b/keyboards/cipulot/ec_prox/ansi_iso/ec_switch_matrix.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #include <stdint.h> | ||
| 20 | #include <stdbool.h> | ||
| 21 | |||
| 22 | #include "matrix.h" | ||
| 23 | |||
| 24 | typedef struct { | ||
| 25 | uint16_t ecsm_actuation_threshold; // threshold for key release | ||
| 26 | uint16_t ecsm_release_threshold; // threshold for key press | ||
| 27 | } ecsm_config_t; | ||
| 28 | |||
| 29 | ecsm_config_t ecsm_config; | ||
| 30 | |||
| 31 | int ecsm_init(ecsm_config_t const* const ecsm_config); | ||
| 32 | int ecsm_update(ecsm_config_t const* const ecsm_config); | ||
| 33 | bool ecsm_matrix_scan(matrix_row_t current_matrix[]); | ||
| 34 | uint16_t ecsm_readkey_raw(uint8_t channel, uint8_t row, uint8_t col); | ||
| 35 | bool ecsm_update_key(matrix_row_t* current_row, uint8_t row, uint8_t col, uint16_t sw_value); | ||
| 36 | void ecsm_print_matrix(void); | ||
diff --git a/keyboards/cipulot/ec_prox/ansi_iso/halconf.h b/keyboards/cipulot/ec_prox/ansi_iso/halconf.h new file mode 100644 index 0000000000..5b71acecbb --- /dev/null +++ b/keyboards/cipulot/ec_prox/ansi_iso/halconf.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #define HAL_USE_ADC TRUE | ||
| 20 | |||
| 21 | #include_next <halconf.h> | ||
diff --git a/keyboards/cipulot/ec_prox/ansi_iso/info.json b/keyboards/cipulot/ec_prox/ansi_iso/info.json new file mode 100644 index 0000000000..df1ad3ba6b --- /dev/null +++ b/keyboards/cipulot/ec_prox/ansi_iso/info.json | |||
| @@ -0,0 +1,182 @@ | |||
| 1 | { | ||
| 2 | "manufacturer": "Cipulot", | ||
| 3 | "keyboard_name": "EC Pro X ANSI/ISO", | ||
| 4 | "maintainer": "Cipulot", | ||
| 5 | "bootloader": "stm32-dfu", | ||
| 6 | "build": { | ||
| 7 | "lto": true | ||
| 8 | }, | ||
| 9 | "diode_direction": "COL2ROW", | ||
| 10 | "features": { | ||
| 11 | "audio": false, | ||
| 12 | "backlight": false, | ||
| 13 | "bootmagic": true, | ||
| 14 | "command": false, | ||
| 15 | "console": true, | ||
| 16 | "extrakey": true, | ||
| 17 | "mousekey": true, | ||
| 18 | "nkro": true, | ||
| 19 | "rgblight": true | ||
| 20 | }, | ||
| 21 | "mouse_key": { | ||
| 22 | "enabled": true | ||
| 23 | }, | ||
| 24 | "processor": "STM32F401", | ||
| 25 | "rgblight": { | ||
| 26 | "led_count": 22, | ||
| 27 | "pin": "B12", | ||
| 28 | "animations": { | ||
| 29 | "alternating": true, | ||
| 30 | "breathing": true, | ||
| 31 | "christmas": true, | ||
| 32 | "knight": true, | ||
| 33 | "rainbow_mood": true, | ||
| 34 | "rainbow_swirl": true, | ||
| 35 | "rgb_test": true, | ||
| 36 | "snake": true, | ||
| 37 | "static_gradient": true, | ||
| 38 | "twinkle": true | ||
| 39 | } | ||
| 40 | }, | ||
| 41 | "url": "https://www.github.com/Cipulot/EC-Pro-X", | ||
| 42 | "usb": { | ||
| 43 | "device_version": "0.0.1", | ||
| 44 | "pid": "0x6B98", | ||
| 45 | "shared_endpoint": { | ||
| 46 | "keyboard": true | ||
| 47 | }, | ||
| 48 | "vid": "0x6369" | ||
| 49 | }, | ||
| 50 | "layouts": { | ||
| 51 | "LAYOUT_all": { | ||
| 52 | "layout": [ | ||
| 53 | { "label": "0,0", "matrix": [0, 0], "x": 0, "y": 0 }, | ||
| 54 | { "label": "0,1", "matrix": [0, 1], "x": 1, "y": 0 }, | ||
| 55 | { "label": "0,2", "matrix": [0, 2], "x": 2, "y": 0 }, | ||
| 56 | { "label": "0,3", "matrix": [0, 3], "x": 3, "y": 0 }, | ||
| 57 | { "label": "0,4", "matrix": [0, 4], "x": 4, "y": 0 }, | ||
| 58 | { "label": "0,5", "matrix": [0, 5], "x": 5, "y": 0 }, | ||
| 59 | { "label": "0,6", "matrix": [0, 6], "x": 6, "y": 0 }, | ||
| 60 | { "label": "0,7", "matrix": [0, 7], "x": 7, "y": 0 }, | ||
| 61 | { "label": "0,8", "matrix": [0, 8], "x": 8, "y": 0 }, | ||
| 62 | { "label": "0,9", "matrix": [0, 9], "x": 9, "y": 0 }, | ||
| 63 | { "label": "0,10", "matrix": [0, 10], "x": 10, "y": 0 }, | ||
| 64 | { "label": "0,11", "matrix": [0, 11], "x": 11, "y": 0 }, | ||
| 65 | { "label": "0,12", "matrix": [0, 12], "x": 12, "y": 0 }, | ||
| 66 | { "label": "0,13", "matrix": [0, 13], "x": 13, "y": 0 }, | ||
| 67 | { "label": "0,14", "matrix": [0, 14], "x": 14, "y": 0 }, | ||
| 68 | { "label": "1,0", "matrix": [1, 0], "w": 1.5, "x": 0, "y": 1 }, | ||
| 69 | { "label": "1,1", "matrix": [1, 1], "x": 1.5, "y": 1 }, | ||
| 70 | { "label": "1,2", "matrix": [1, 2], "x": 2.5, "y": 1 }, | ||
| 71 | { "label": "1,3", "matrix": [1, 3], "x": 3.5, "y": 1 }, | ||
| 72 | { "label": "1,4", "matrix": [1, 4], "x": 4.5, "y": 1 }, | ||
| 73 | { "label": "1,5", "matrix": [1, 5], "x": 5.5, "y": 1 }, | ||
| 74 | { "label": "1,6", "matrix": [1, 6], "x": 6.5, "y": 1 }, | ||
| 75 | { "label": "1,7", "matrix": [1, 7], "x": 7.5, "y": 1 }, | ||
| 76 | { "label": "1,8", "matrix": [1, 8], "x": 8.5, "y": 1 }, | ||
| 77 | { "label": "1,9", "matrix": [1, 9], "x": 9.5, "y": 1 }, | ||
| 78 | { "label": "1,10", "matrix": [1, 10], "x": 10.5, "y": 1 }, | ||
| 79 | { "label": "1,11", "matrix": [1, 11], "x": 11.5, "y": 1 }, | ||
| 80 | { "label": "1,12", "matrix": [1, 12], "x": 12.5, "y": 1 }, | ||
| 81 | { "label": "1,13", "matrix": [1, 13], "w": 1.5, "x": 13.5, "y": 1 }, | ||
| 82 | { "label": "2,0", "matrix": [2, 0], "w": 1.75, "x": 0, "y": 2 }, | ||
| 83 | { "label": "2,1", "matrix": [2, 1], "x": 1.75, "y": 2 }, | ||
| 84 | { "label": "2,2", "matrix": [2, 2], "x": 2.75, "y": 2 }, | ||
| 85 | { "label": "2,3", "matrix": [2, 3], "x": 3.75, "y": 2 }, | ||
| 86 | { "label": "2,4", "matrix": [2, 4], "x": 4.75, "y": 2 }, | ||
| 87 | { "label": "2,5", "matrix": [2, 5], "x": 5.75, "y": 2 }, | ||
| 88 | { "label": "2,6", "matrix": [2, 6], "x": 6.75, "y": 2 }, | ||
| 89 | { "label": "2,7", "matrix": [2, 7], "x": 7.75, "y": 2 }, | ||
| 90 | { "label": "2,8", "matrix": [2, 8], "x": 8.75, "y": 2 }, | ||
| 91 | { "label": "2,9", "matrix": [2, 9], "x": 9.75, "y": 2 }, | ||
| 92 | { "label": "2,10", "matrix": [2, 10], "x": 10.75, "y": 2 }, | ||
| 93 | { "label": "2,11", "matrix": [2, 11], "x": 11.75, "y": 2 }, | ||
| 94 | { "label": "2,12", "matrix": [2, 12], "x": 12.75, "y": 2 }, | ||
| 95 | { "label": "2,13", "matrix": [2, 13], "w": 1.25, "x": 13.75, "y": 2 }, | ||
| 96 | { "label": "3,0", "matrix": [3, 0], "w": 1.25, "x": 0, "y": 3 }, | ||
| 97 | { "label": "3,1", "matrix": [3, 1], "x": 1.25, "y": 3 }, | ||
| 98 | { "label": "3,2", "matrix": [3, 2], "x": 2.25, "y": 3 }, | ||
| 99 | { "label": "3,3", "matrix": [3, 3], "x": 3.25, "y": 3 }, | ||
| 100 | { "label": "3,4", "matrix": [3, 4], "x": 4.25, "y": 3 }, | ||
| 101 | { "label": "3,5", "matrix": [3, 5], "x": 5.25, "y": 3 }, | ||
| 102 | { "label": "3,6", "matrix": [3, 6], "x": 6.25, "y": 3 }, | ||
| 103 | { "label": "3,7", "matrix": [3, 7], "x": 7.25, "y": 3 }, | ||
| 104 | { "label": "3,8", "matrix": [3, 8], "x": 8.25, "y": 3 }, | ||
| 105 | { "label": "3,9", "matrix": [3, 9], "x": 9.25, "y": 3 }, | ||
| 106 | { "label": "3,10", "matrix": [3, 10], "x": 10.25, "y": 3 }, | ||
| 107 | { "label": "3,11", "matrix": [3, 11], "x": 11.25, "y": 3 }, | ||
| 108 | { "label": "3,13", "matrix": [3, 13], "w": 1.75, "x": 12.25, "y": 3 }, | ||
| 109 | { "label": "3,14", "matrix": [3, 14], "x": 14, "y": 3 }, | ||
| 110 | { "label": "4,1", "matrix": [4, 1], "x": 1.5, "y": 4 }, | ||
| 111 | { "label": "4,2", "matrix": [4, 2], "w": 1.5, "x": 2.5, "y": 4 }, | ||
| 112 | { "label": "4,6", "matrix": [4, 6], "w": 6, "x": 4, "y": 4 }, | ||
| 113 | { "label": "4,9", "matrix": [4, 9], "w": 1.5, "x": 10, "y": 4 }, | ||
| 114 | { "label": "4,10", "matrix": [4, 10], "x": 11.5, "y": 4 } | ||
| 115 | ] | ||
| 116 | }, | ||
| 117 | "LAYOUT_60_hhkb": { | ||
| 118 | "layout": [ | ||
| 119 | { "label": "0,0", "matrix": [0, 0], "x": 0, "y": 0 }, | ||
| 120 | { "label": "0,1", "matrix": [0, 1], "x": 1, "y": 0 }, | ||
| 121 | { "label": "0,2", "matrix": [0, 2], "x": 2, "y": 0 }, | ||
| 122 | { "label": "0,3", "matrix": [0, 3], "x": 3, "y": 0 }, | ||
| 123 | { "label": "0,4", "matrix": [0, 4], "x": 4, "y": 0 }, | ||
| 124 | { "label": "0,5", "matrix": [0, 5], "x": 5, "y": 0 }, | ||
| 125 | { "label": "0,6", "matrix": [0, 6], "x": 6, "y": 0 }, | ||
| 126 | { "label": "0,7", "matrix": [0, 7], "x": 7, "y": 0 }, | ||
| 127 | { "label": "0,8", "matrix": [0, 8], "x": 8, "y": 0 }, | ||
| 128 | { "label": "0,9", "matrix": [0, 9], "x": 9, "y": 0 }, | ||
| 129 | { "label": "0,10", "matrix": [0, 10], "x": 10, "y": 0 }, | ||
| 130 | { "label": "0,11", "matrix": [0, 11], "x": 11, "y": 0 }, | ||
| 131 | { "label": "0,12", "matrix": [0, 12], "x": 12, "y": 0 }, | ||
| 132 | { "label": "0,13", "matrix": [0, 13], "x": 13, "y": 0 }, | ||
| 133 | { "label": "0,14", "matrix": [0, 14], "x": 14, "y": 0 }, | ||
| 134 | { "label": "1,0", "matrix": [1, 0], "w": 1.5, "x": 0, "y": 1 }, | ||
| 135 | { "label": "1,1", "matrix": [1, 1], "x": 1.5, "y": 1 }, | ||
| 136 | { "label": "1,2", "matrix": [1, 2], "x": 2.5, "y": 1 }, | ||
| 137 | { "label": "1,3", "matrix": [1, 3], "x": 3.5, "y": 1 }, | ||
| 138 | { "label": "1,4", "matrix": [1, 4], "x": 4.5, "y": 1 }, | ||
| 139 | { "label": "1,5", "matrix": [1, 5], "x": 5.5, "y": 1 }, | ||
| 140 | { "label": "1,6", "matrix": [1, 6], "x": 6.5, "y": 1 }, | ||
| 141 | { "label": "1,7", "matrix": [1, 7], "x": 7.5, "y": 1 }, | ||
| 142 | { "label": "1,8", "matrix": [1, 8], "x": 8.5, "y": 1 }, | ||
| 143 | { "label": "1,9", "matrix": [1, 9], "x": 9.5, "y": 1 }, | ||
| 144 | { "label": "1,10", "matrix": [1, 10], "x": 10.5, "y": 1 }, | ||
| 145 | { "label": "1,11", "matrix": [1, 11], "x": 11.5, "y": 1 }, | ||
| 146 | { "label": "1,12", "matrix": [1, 12], "x": 12.5, "y": 1 }, | ||
| 147 | { "label": "1,13", "matrix": [1, 13], "w": 1.5, "x": 13.5, "y": 1 }, | ||
| 148 | { "label": "2,0", "matrix": [2, 0], "w": 1.75, "x": 0, "y": 2 }, | ||
| 149 | { "label": "2,1", "matrix": [2, 1], "x": 1.75, "y": 2 }, | ||
| 150 | { "label": "2,2", "matrix": [2, 2], "x": 2.75, "y": 2 }, | ||
| 151 | { "label": "2,3", "matrix": [2, 3], "x": 3.75, "y": 2 }, | ||
| 152 | { "label": "2,4", "matrix": [2, 4], "x": 4.75, "y": 2 }, | ||
| 153 | { "label": "2,5", "matrix": [2, 5], "x": 5.75, "y": 2 }, | ||
| 154 | { "label": "2,6", "matrix": [2, 6], "x": 6.75, "y": 2 }, | ||
| 155 | { "label": "2,7", "matrix": [2, 7], "x": 7.75, "y": 2 }, | ||
| 156 | { "label": "2,8", "matrix": [2, 8], "x": 8.75, "y": 2 }, | ||
| 157 | { "label": "2,9", "matrix": [2, 9], "x": 9.75, "y": 2 }, | ||
| 158 | { "label": "2,10", "matrix": [2, 10], "x": 10.75, "y": 2 }, | ||
| 159 | { "label": "2,11", "matrix": [2, 11], "x": 11.75, "y": 2 }, | ||
| 160 | { "label": "2,13", "matrix": [2, 13], "w": 2.25, "x": 12.75, "y": 2 }, | ||
| 161 | { "label": "3,0", "matrix": [3, 0], "w": 2.25, "x": 0, "y": 3 }, | ||
| 162 | { "label": "3,2", "matrix": [3, 2], "x": 2.25, "y": 3 }, | ||
| 163 | { "label": "3,3", "matrix": [3, 3], "x": 3.25, "y": 3 }, | ||
| 164 | { "label": "3,4", "matrix": [3, 4], "x": 4.25, "y": 3 }, | ||
| 165 | { "label": "3,5", "matrix": [3, 5], "x": 5.25, "y": 3 }, | ||
| 166 | { "label": "3,6", "matrix": [3, 6], "x": 6.25, "y": 3 }, | ||
| 167 | { "label": "3,7", "matrix": [3, 7], "x": 7.25, "y": 3 }, | ||
| 168 | { "label": "3,8", "matrix": [3, 8], "x": 8.25, "y": 3 }, | ||
| 169 | { "label": "3,9", "matrix": [3, 9], "x": 9.25, "y": 3 }, | ||
| 170 | { "label": "3,10", "matrix": [3, 10], "x": 10.25, "y": 3 }, | ||
| 171 | { "label": "3,11", "matrix": [3, 11], "x": 11.25, "y": 3 }, | ||
| 172 | { "label": "3,13", "matrix": [3, 13], "w": 1.75, "x": 12.25, "y": 3 }, | ||
| 173 | { "label": "3,14", "matrix": [3, 14], "x": 14, "y": 3 }, | ||
| 174 | { "label": "4,1", "matrix": [4, 1], "x": 1.5, "y": 4 }, | ||
| 175 | { "label": "4,2", "matrix": [4, 2], "w": 1.5, "x": 2.5, "y": 4 }, | ||
| 176 | { "label": "4,6", "matrix": [4, 6], "w": 6, "x": 4, "y": 4 }, | ||
| 177 | { "label": "4,9", "matrix": [4, 9], "w": 1.5, "x": 10, "y": 4 }, | ||
| 178 | { "label": "4,10", "matrix": [4, 10], "x": 11.5, "y": 4 } | ||
| 179 | ] | ||
| 180 | } | ||
| 181 | } | ||
| 182 | } | ||
diff --git a/keyboards/cipulot/ec_prox/ansi_iso/keymaps/60_hhkb/keymap.c b/keyboards/cipulot/ec_prox/ansi_iso/keymaps/60_hhkb/keymap.c new file mode 100644 index 0000000000..10c7ffb65f --- /dev/null +++ b/keyboards/cipulot/ec_prox/ansi_iso/keymaps/60_hhkb/keymap.c | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include QMK_KEYBOARD_H | ||
| 18 | |||
| 19 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 20 | // clang-format off | ||
| 21 | [0] = LAYOUT_60_hhkb( | ||
| 22 | 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, | ||
| 23 | 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_DEL, | ||
| 24 | 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_ENTER, | ||
| 25 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1), | ||
| 26 | KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI), | ||
| 27 | |||
| 28 | [1] = LAYOUT_60_hhkb( | ||
| 29 | _______, 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, | ||
| 30 | KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SCRL, KC_PAUSE, KC_UP, _______, KC_BSPC, | ||
| 31 | _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, _______, S(KC_8), KC_SLSH, KC_HOME, KC_PGUP, KC_LEFT, KC_RIGHT, _______, | ||
| 32 | _______, _______, _______, _______, _______, _______, S(KC_EQL), KC_MINS, KC_END, KC_PGDN, KC_DOWN, _______, _______, | ||
| 33 | _______, _______, _______, _______, MO(2)), | ||
| 34 | |||
| 35 | [2] = LAYOUT_60_hhkb( | ||
| 36 | RGB_TOG, RGB_VAD, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, QK_BOOT, | ||
| 37 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 38 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 39 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 40 | _______, _______, _______, _______, _______), | ||
| 41 | [3] = LAYOUT_60_hhkb( | ||
| 42 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 43 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 44 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 45 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 46 | _______, _______, _______, _______, _______) | ||
| 47 | // clang-format on | ||
| 48 | }; | ||
diff --git a/keyboards/cipulot/ec_prox/ansi_iso/keymaps/default/keymap.c b/keyboards/cipulot/ec_prox/ansi_iso/keymaps/default/keymap.c new file mode 100644 index 0000000000..430ed0bafa --- /dev/null +++ b/keyboards/cipulot/ec_prox/ansi_iso/keymaps/default/keymap.c | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include QMK_KEYBOARD_H | ||
| 18 | |||
| 19 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 20 | // clang-format off | ||
| 21 | [0] = LAYOUT_all( | ||
| 22 | 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, | ||
| 23 | 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_DEL, | ||
| 24 | 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_ENTER, | ||
| 25 | KC_LSFT, KC_BSLS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1), | ||
| 26 | KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI), | ||
| 27 | |||
| 28 | [1] = LAYOUT_all( | ||
| 29 | _______, 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, | ||
| 30 | KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SCRL, KC_PAUSE, KC_UP, _______, KC_BSPC, | ||
| 31 | _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, _______, S(KC_8), KC_SLSH, KC_HOME, KC_PGUP, KC_LEFT, KC_RIGHT, _______, _______, | ||
| 32 | _______, _______, _______, _______, _______, _______, _______, S(KC_EQL), KC_MINS, KC_END, KC_PGDN, KC_DOWN, _______, _______, | ||
| 33 | _______, _______, _______, _______, _______), | ||
| 34 | |||
| 35 | [2] = LAYOUT_all( | ||
| 36 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 37 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 38 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 39 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 40 | _______, _______, _______, _______, _______), | ||
| 41 | |||
| 42 | [3] = LAYOUT_all( | ||
| 43 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 44 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 45 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 46 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 47 | _______, _______, _______, _______, _______) | ||
| 48 | // clang-format on | ||
| 49 | }; | ||
diff --git a/keyboards/cipulot/ec_prox/ansi_iso/keymaps/via/config.h b/keyboards/cipulot/ec_prox/ansi_iso/keymaps/via/config.h new file mode 100644 index 0000000000..ebf954d07a --- /dev/null +++ b/keyboards/cipulot/ec_prox/ansi_iso/keymaps/via/config.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | // This is the size of the EEPROM for the custom VIA-specific data | ||
| 20 | #define EECONFIG_USER_DATA_SIZE 4 | ||
diff --git a/keyboards/cipulot/ec_prox/ansi_iso/keymaps/via/keymap.c b/keyboards/cipulot/ec_prox/ansi_iso/keymaps/via/keymap.c new file mode 100644 index 0000000000..430ed0bafa --- /dev/null +++ b/keyboards/cipulot/ec_prox/ansi_iso/keymaps/via/keymap.c | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include QMK_KEYBOARD_H | ||
| 18 | |||
| 19 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 20 | // clang-format off | ||
| 21 | [0] = LAYOUT_all( | ||
| 22 | 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, | ||
| 23 | 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_DEL, | ||
| 24 | 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_ENTER, | ||
| 25 | KC_LSFT, KC_BSLS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1), | ||
| 26 | KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI), | ||
| 27 | |||
| 28 | [1] = LAYOUT_all( | ||
| 29 | _______, 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, | ||
| 30 | KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SCRL, KC_PAUSE, KC_UP, _______, KC_BSPC, | ||
| 31 | _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, _______, S(KC_8), KC_SLSH, KC_HOME, KC_PGUP, KC_LEFT, KC_RIGHT, _______, _______, | ||
| 32 | _______, _______, _______, _______, _______, _______, _______, S(KC_EQL), KC_MINS, KC_END, KC_PGDN, KC_DOWN, _______, _______, | ||
| 33 | _______, _______, _______, _______, _______), | ||
| 34 | |||
| 35 | [2] = LAYOUT_all( | ||
| 36 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 37 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 38 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 39 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 40 | _______, _______, _______, _______, _______), | ||
| 41 | |||
| 42 | [3] = LAYOUT_all( | ||
| 43 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 44 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 45 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 46 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 47 | _______, _______, _______, _______, _______) | ||
| 48 | // clang-format on | ||
| 49 | }; | ||
diff --git a/keyboards/cipulot/ec_prox/ansi_iso/keymaps/via/rules.mk b/keyboards/cipulot/ec_prox/ansi_iso/keymaps/via/rules.mk new file mode 100644 index 0000000000..520b11f203 --- /dev/null +++ b/keyboards/cipulot/ec_prox/ansi_iso/keymaps/via/rules.mk | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | VIA_ENABLE = yes | ||
| 2 | |||
| 3 | SRC += via_apc.c | ||
diff --git a/keyboards/cipulot/ec_prox/ansi_iso/keymaps/via/via_apc.c b/keyboards/cipulot/ec_prox/ansi_iso/keymaps/via/via_apc.c new file mode 100644 index 0000000000..5ea77af44c --- /dev/null +++ b/keyboards/cipulot/ec_prox/ansi_iso/keymaps/via/via_apc.c | |||
| @@ -0,0 +1,156 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "ec_switch_matrix.h" | ||
| 18 | #include "action.h" | ||
| 19 | #include "via.h" | ||
| 20 | |||
| 21 | void apc_init_thresholds(void); | ||
| 22 | void apc_set_threshold(bool is_for_actuation); | ||
| 23 | |||
| 24 | // Declaring an _apc_config_t struct that will store our data | ||
| 25 | typedef struct _apc_config_t { | ||
| 26 | uint16_t actuation_threshold; | ||
| 27 | uint16_t release_threshold; | ||
| 28 | } apc_config; | ||
| 29 | |||
| 30 | // Check if the size of the reserved persistent memory is the same as the size of struct apc_config | ||
| 31 | _Static_assert(sizeof(apc_config) == EECONFIG_USER_DATA_SIZE, "Mismatch in keyboard EECONFIG stored data"); | ||
| 32 | |||
| 33 | // Declaring a new variable apc of type apc_config | ||
| 34 | apc_config apc; | ||
| 35 | |||
| 36 | // Declaring enums for VIA config menu | ||
| 37 | enum via_apc_enums { | ||
| 38 | // clang-format off | ||
| 39 | id_apc_actuation_threshold = 1, | ||
| 40 | id_apc_release_threshold = 2 | ||
| 41 | // clang-format on | ||
| 42 | }; | ||
| 43 | |||
| 44 | // Initializing persistent memory configuration: default values are declared and stored in PMEM | ||
| 45 | void eeconfig_init_user(void) { | ||
| 46 | // Default values | ||
| 47 | apc.actuation_threshold = DEFAULT_ACTUATION_LEVEL; | ||
| 48 | apc.release_threshold = DEFAULT_RELEASE_LEVEL; | ||
| 49 | // Write default value to EEPROM now | ||
| 50 | eeconfig_update_user_datablock(&apc); | ||
| 51 | } | ||
| 52 | |||
| 53 | // On Keyboard startup | ||
| 54 | void keyboard_post_init_user(void) { | ||
| 55 | // Read custom menu variables from memory | ||
| 56 | eeconfig_read_user_datablock(&apc); | ||
| 57 | apc_init_thresholds(); | ||
| 58 | } | ||
| 59 | |||
| 60 | // Handle the data received by the keyboard from the VIA menus | ||
| 61 | void apc_config_set_value(uint8_t *data) { | ||
| 62 | // data = [ value_id, value_data ] | ||
| 63 | uint8_t *value_id = &(data[0]); | ||
| 64 | uint8_t *value_data = &(data[1]); | ||
| 65 | |||
| 66 | switch (*value_id) { | ||
| 67 | case id_apc_actuation_threshold: { | ||
| 68 | apc.actuation_threshold = value_data[1] | (value_data[0] << 8); | ||
| 69 | apc_set_threshold(true); | ||
| 70 | break; | ||
| 71 | } | ||
| 72 | case id_apc_release_threshold: { | ||
| 73 | apc.release_threshold = value_data[1] | (value_data[0] << 8); | ||
| 74 | apc_set_threshold(false); | ||
| 75 | break; | ||
| 76 | } | ||
| 77 | } | ||
| 78 | } | ||
| 79 | |||
| 80 | // Handle the data sent by the keyboard to the VIA menus | ||
| 81 | void apc_config_get_value(uint8_t *data) { | ||
| 82 | // data = [ value_id, value_data ] | ||
| 83 | uint8_t *value_id = &(data[0]); | ||
| 84 | uint8_t *value_data = &(data[1]); | ||
| 85 | |||
| 86 | switch (*value_id) { | ||
| 87 | case id_apc_actuation_threshold: { | ||
| 88 | value_data[0] = apc.actuation_threshold >> 8; | ||
| 89 | value_data[1] = apc.actuation_threshold & 0xFF; | ||
| 90 | break; | ||
| 91 | } | ||
| 92 | case id_apc_release_threshold: { | ||
| 93 | value_data[0] = apc.release_threshold >> 8; | ||
| 94 | value_data[1] = apc.release_threshold & 0xFF; | ||
| 95 | break; | ||
| 96 | } | ||
| 97 | } | ||
| 98 | } | ||
| 99 | |||
| 100 | // Save the data to persistent memory after changes are made | ||
| 101 | void apc_config_save(void) { | ||
| 102 | eeconfig_update_user_datablock(&apc); | ||
| 103 | } | ||
| 104 | |||
| 105 | void via_custom_value_command_kb(uint8_t *data, uint8_t length) { | ||
| 106 | // data = [ command_id, channel_id, value_id, value_data ] | ||
| 107 | uint8_t *command_id = &(data[0]); | ||
| 108 | uint8_t *channel_id = &(data[1]); | ||
| 109 | uint8_t *value_id_and_data = &(data[2]); | ||
| 110 | |||
| 111 | if (*channel_id == id_custom_channel) { | ||
| 112 | switch (*command_id) { | ||
| 113 | case id_custom_set_value: { | ||
| 114 | apc_config_set_value(value_id_and_data); | ||
| 115 | break; | ||
| 116 | } | ||
| 117 | case id_custom_get_value: { | ||
| 118 | apc_config_get_value(value_id_and_data); | ||
| 119 | break; | ||
| 120 | } | ||
| 121 | case id_custom_save: { | ||
| 122 | apc_config_save(); | ||
| 123 | break; | ||
| 124 | } | ||
| 125 | default: { | ||
| 126 | // Unhandled message. | ||
| 127 | *command_id = id_unhandled; | ||
| 128 | break; | ||
| 129 | } | ||
| 130 | } | ||
| 131 | return; | ||
| 132 | } | ||
| 133 | |||
| 134 | *command_id = id_unhandled; | ||
| 135 | } | ||
| 136 | |||
| 137 | // Initialize the thresholds | ||
| 138 | void apc_init_thresholds(void) { | ||
| 139 | ecsm_config.ecsm_actuation_threshold = apc.actuation_threshold; | ||
| 140 | ecsm_config.ecsm_release_threshold = apc.release_threshold; | ||
| 141 | |||
| 142 | // Update the ecsm_config | ||
| 143 | ecsm_update(&ecsm_config); | ||
| 144 | } | ||
| 145 | |||
| 146 | // Set the thresholds | ||
| 147 | void apc_set_threshold(bool is_for_actuation) { | ||
| 148 | if (is_for_actuation) { | ||
| 149 | ecsm_config.ecsm_actuation_threshold = apc.actuation_threshold; | ||
| 150 | |||
| 151 | } else { | ||
| 152 | ecsm_config.ecsm_release_threshold = apc.release_threshold; | ||
| 153 | } | ||
| 154 | // Update the ecsm_config | ||
| 155 | ecsm_update(&ecsm_config); | ||
| 156 | } | ||
diff --git a/keyboards/cipulot/ec_prox/ansi_iso/matrix.c b/keyboards/cipulot/ec_prox/ansi_iso/matrix.c new file mode 100644 index 0000000000..1850acf264 --- /dev/null +++ b/keyboards/cipulot/ec_prox/ansi_iso/matrix.c | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "ec_switch_matrix.h" | ||
| 18 | #include "matrix.h" | ||
| 19 | |||
| 20 | /* matrix state(1:on, 0:off) */ | ||
| 21 | extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values | ||
| 22 | extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values | ||
| 23 | |||
| 24 | void matrix_init_custom(void) { | ||
| 25 | // Default values, overwritten by VIA if enabled later | ||
| 26 | ecsm_config.ecsm_actuation_threshold = DEFAULT_ACTUATION_LEVEL; | ||
| 27 | ecsm_config.ecsm_release_threshold = DEFAULT_RELEASE_LEVEL; | ||
| 28 | |||
| 29 | ecsm_init(&ecsm_config); | ||
| 30 | } | ||
| 31 | |||
| 32 | bool matrix_scan_custom(matrix_row_t current_matrix[]) { | ||
| 33 | bool updated = ecsm_matrix_scan(current_matrix); | ||
| 34 | |||
| 35 | // RAW matrix values on console | ||
| 36 | #ifdef CONSOLE_ENABLE | ||
| 37 | static int cnt = 0; | ||
| 38 | if (cnt++ == 350) { | ||
| 39 | cnt = 0; | ||
| 40 | ecsm_print_matrix(); | ||
| 41 | } | ||
| 42 | #endif | ||
| 43 | return updated; | ||
| 44 | } | ||
diff --git a/keyboards/cipulot/ec_prox/ansi_iso/mcuconf.h b/keyboards/cipulot/ec_prox/ansi_iso/mcuconf.h new file mode 100644 index 0000000000..d91f576bd4 --- /dev/null +++ b/keyboards/cipulot/ec_prox/ansi_iso/mcuconf.h | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #include_next <mcuconf.h> | ||
| 20 | |||
| 21 | #undef STM32_ADC_USE_ADC1 | ||
| 22 | #define STM32_ADC_USE_ADC1 TRUE | ||
diff --git a/keyboards/cipulot/ec_prox/ansi_iso/readme.md b/keyboards/cipulot/ec_prox/ansi_iso/readme.md new file mode 100644 index 0000000000..2afa33514a --- /dev/null +++ b/keyboards/cipulot/ec_prox/ansi_iso/readme.md | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | # EC Pro X ANSI/ISO | ||
| 2 | |||
| 3 |  | ||
| 4 | |||
| 5 | Open source replacement PCB kit for the HHKB Pro 2 and Pro 3 keyboards using the ANSI case. | ||
| 6 | |||
| 7 | * Keyboard Maintainer: [cipulot](https://github.com/cipulot) | ||
| 8 | * Hardware Supported: EC Pro X ANSI_ISO PCB | ||
| 9 | * Hardware Availability: [EC Pro X](https://github.com/cipulot/EC-Pro-X) | ||
| 10 | |||
| 11 | Make example for this keyboard (after setting up your build environment): | ||
| 12 | |||
| 13 | make cipulot/ec_prox/ansi_iso:default | ||
| 14 | |||
| 15 | Flashing example for this keyboard: | ||
| 16 | |||
| 17 | make cipulot/ec_prox/ansi_iso:default:flash | ||
| 18 | |||
| 19 | 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). | ||
| 20 | |||
| 21 | ## Bootloader | ||
| 22 | |||
| 23 | Enter the bootloader in 3 ways: | ||
| 24 | |||
| 25 | * **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard | ||
| 26 | * **Physical Boot0 pins**: Short the Boot0 pins on the back of the PCB while plugging in the keyboard | ||
| 27 | * **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available | ||
diff --git a/keyboards/cipulot/ec_prox/ansi_iso/rules.mk b/keyboards/cipulot/ec_prox/ansi_iso/rules.mk new file mode 100644 index 0000000000..ed348e8618 --- /dev/null +++ b/keyboards/cipulot/ec_prox/ansi_iso/rules.mk | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | CUSTOM_MATRIX = lite | ||
| 2 | QUANTUM_LIB_SRC += analog.c | ||
| 3 | SRC += matrix.c ec_switch_matrix.c | ||
diff --git a/keyboards/cipulot/ec_prox/jis/config.h b/keyboards/cipulot/ec_prox/jis/config.h new file mode 100644 index 0000000000..1c6a836867 --- /dev/null +++ b/keyboards/cipulot/ec_prox/jis/config.h | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #define MATRIX_ROWS 5 | ||
| 20 | #define MATRIX_COLS 14 | ||
| 21 | |||
| 22 | /* Custom matrix pins and port select array */ | ||
| 23 | #define MATRIX_ROW_PINS \ | ||
| 24 | { A7, B0, A4, A5, A6 } | ||
| 25 | #define MATRIX_COL_CHANNELS \ | ||
| 26 | { 2, 1, 0, 3, 5, 7, 4, 6 } | ||
| 27 | #define MUX_SEL_PINS \ | ||
| 28 | { B4, B5, B6 } | ||
| 29 | |||
| 30 | /* Hardware peripherals pins */ | ||
| 31 | #define APLEX_EN_PIN_0 B7 | ||
| 32 | #define APLEX_EN_PIN_1 B3 | ||
| 33 | #define DISCHARGE_PIN A2 | ||
| 34 | #define ANALOG_PORT A1 | ||
| 35 | |||
| 36 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
| 37 | #define LOCKING_SUPPORT_ENABLE | ||
| 38 | |||
| 39 | /* Locking resynchronize hack */ | ||
| 40 | #define LOCKING_RESYNC_ENABLE | ||
| 41 | |||
| 42 | #define DEFAULT_ACTUATION_LEVEL 550 | ||
| 43 | #define DEFAULT_RELEASE_LEVEL 500 | ||
| 44 | |||
| 45 | #define DISCHARGE_TIME 10 | ||
diff --git a/keyboards/cipulot/ec_prox/jis/ec_switch_matrix.c b/keyboards/cipulot/ec_prox/jis/ec_switch_matrix.c new file mode 100644 index 0000000000..81003dd36a --- /dev/null +++ b/keyboards/cipulot/ec_prox/jis/ec_switch_matrix.c | |||
| @@ -0,0 +1,183 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "ec_switch_matrix.h" | ||
| 18 | #include "analog.h" | ||
| 19 | #include "atomic_util.h" | ||
| 20 | #include "print.h" | ||
| 21 | #include "wait.h" | ||
| 22 | |||
| 23 | /* Pin and port array */ | ||
| 24 | const uint32_t row_pins[] = MATRIX_ROW_PINS; | ||
| 25 | const uint8_t col_channels[] = MATRIX_COL_CHANNELS; | ||
| 26 | const uint32_t mux_sel_pins[] = MUX_SEL_PINS; | ||
| 27 | |||
| 28 | static ecsm_config_t config; | ||
| 29 | static uint16_t ecsm_sw_value[MATRIX_ROWS][MATRIX_COLS]; | ||
| 30 | |||
| 31 | static adc_mux adcMux; | ||
| 32 | |||
| 33 | static inline void discharge_capacitor(void) { | ||
| 34 | writePinLow(DISCHARGE_PIN); | ||
| 35 | } | ||
| 36 | static inline void charge_capacitor(uint8_t row) { | ||
| 37 | writePinHigh(DISCHARGE_PIN); | ||
| 38 | writePinHigh(row_pins[row]); | ||
| 39 | } | ||
| 40 | |||
| 41 | static inline void init_mux_sel(void) { | ||
| 42 | for (int idx = 0; idx < 3; idx++) { | ||
| 43 | setPinOutput(mux_sel_pins[idx]); | ||
| 44 | } | ||
| 45 | } | ||
| 46 | |||
| 47 | static inline void select_mux(uint8_t col) { | ||
| 48 | uint8_t ch = col_channels[col]; | ||
| 49 | writePin(mux_sel_pins[0], ch & 1); | ||
| 50 | writePin(mux_sel_pins[1], ch & 2); | ||
| 51 | writePin(mux_sel_pins[2], ch & 4); | ||
| 52 | } | ||
| 53 | |||
| 54 | static inline void init_row(void) { | ||
| 55 | for (int idx = 0; idx < MATRIX_ROWS; idx++) { | ||
| 56 | setPinOutput(row_pins[idx]); | ||
| 57 | writePinLow(row_pins[idx]); | ||
| 58 | } | ||
| 59 | } | ||
| 60 | |||
| 61 | /* Initialize the peripherals pins */ | ||
| 62 | int ecsm_init(ecsm_config_t const* const ecsm_config) { | ||
| 63 | // Initialize config | ||
| 64 | config = *ecsm_config; | ||
| 65 | |||
| 66 | palSetLineMode(ANALOG_PORT, PAL_MODE_INPUT_ANALOG); | ||
| 67 | adcMux = pinToMux(ANALOG_PORT); | ||
| 68 | |||
| 69 | //Dummy call to make sure that adcStart() has been called in the appropriate state | ||
| 70 | adc_read(adcMux); | ||
| 71 | |||
| 72 | // Initialize discharge pin as discharge mode | ||
| 73 | writePinLow(DISCHARGE_PIN); | ||
| 74 | setPinOutputOpenDrain(DISCHARGE_PIN); | ||
| 75 | |||
| 76 | // Initialize drive lines | ||
| 77 | init_row(); | ||
| 78 | |||
| 79 | // Initialize multiplexer select pin | ||
| 80 | init_mux_sel(); | ||
| 81 | |||
| 82 | // Enable AMUX | ||
| 83 | setPinOutput(APLEX_EN_PIN_0); | ||
| 84 | writePinLow(APLEX_EN_PIN_0); | ||
| 85 | setPinOutput(APLEX_EN_PIN_1); | ||
| 86 | writePinLow(APLEX_EN_PIN_1); | ||
| 87 | |||
| 88 | return 0; | ||
| 89 | } | ||
| 90 | |||
| 91 | int ecsm_update(ecsm_config_t const* const ecsm_config) { | ||
| 92 | // Save config | ||
| 93 | config = *ecsm_config; | ||
| 94 | return 0; | ||
| 95 | } | ||
| 96 | |||
| 97 | // Read the capacitive sensor value | ||
| 98 | uint16_t ecsm_readkey_raw(uint8_t channel, uint8_t row, uint8_t col) { | ||
| 99 | uint16_t sw_value = 0; | ||
| 100 | |||
| 101 | // Select the multiplexer | ||
| 102 | if (channel == 0) { | ||
| 103 | writePinHigh(APLEX_EN_PIN_0); | ||
| 104 | select_mux(col); | ||
| 105 | writePinLow(APLEX_EN_PIN_0); | ||
| 106 | } else { | ||
| 107 | writePinHigh(APLEX_EN_PIN_1); | ||
| 108 | select_mux(col); | ||
| 109 | writePinLow(APLEX_EN_PIN_1); | ||
| 110 | } | ||
| 111 | |||
| 112 | // Set strobe pins to low state | ||
| 113 | writePinLow(row_pins[row]); | ||
| 114 | ATOMIC_BLOCK_FORCEON { | ||
| 115 | // Set the row pin to high state and have capacitor charge | ||
| 116 | charge_capacitor(row); | ||
| 117 | // Read the ADC value | ||
| 118 | sw_value = adc_read(adcMux); | ||
| 119 | } | ||
| 120 | // Discharge peak hold capacitor | ||
| 121 | discharge_capacitor(); | ||
| 122 | // Waiting for the ghost capacitor to discharge fully | ||
| 123 | wait_us(DISCHARGE_TIME); | ||
| 124 | |||
| 125 | return sw_value; | ||
| 126 | } | ||
| 127 | |||
| 128 | // Update press/release state of key | ||
| 129 | bool ecsm_update_key(matrix_row_t* current_row, uint8_t row, uint8_t col, uint16_t sw_value) { | ||
| 130 | bool current_state = (*current_row >> col) & 1; | ||
| 131 | |||
| 132 | // Press to release | ||
| 133 | if (current_state && sw_value < config.ecsm_actuation_threshold) { | ||
| 134 | *current_row &= ~(1 << col); | ||
| 135 | return true; | ||
| 136 | } | ||
| 137 | |||
| 138 | // Release to press | ||
| 139 | if ((!current_state) && sw_value > config.ecsm_release_threshold) { | ||
| 140 | *current_row |= (1 << col); | ||
| 141 | return true; | ||
| 142 | } | ||
| 143 | |||
| 144 | return false; | ||
| 145 | } | ||
| 146 | |||
| 147 | // Scan key values and update matrix state | ||
| 148 | bool ecsm_matrix_scan(matrix_row_t current_matrix[]) { | ||
| 149 | bool updated = false; | ||
| 150 | |||
| 151 | // Disable AMUX of channel 1 | ||
| 152 | writePinHigh(APLEX_EN_PIN_1); | ||
| 153 | for (int col = 0; col < sizeof(col_channels); col++) { | ||
| 154 | for (int row = 0; row < MATRIX_ROWS; row++) { | ||
| 155 | ecsm_sw_value[row][col] = ecsm_readkey_raw(0, row, col); | ||
| 156 | updated |= ecsm_update_key(¤t_matrix[row], row, col, ecsm_sw_value[row][col]); | ||
| 157 | } | ||
| 158 | } | ||
| 159 | |||
| 160 | // Disable AMUX of channel 1 | ||
| 161 | writePinHigh(APLEX_EN_PIN_0); | ||
| 162 | for (int col = 0; col < (sizeof(col_channels) - 2); col++) { | ||
| 163 | for (int row = 0; row < MATRIX_ROWS; row++) { | ||
| 164 | ecsm_sw_value[row][col + 8] = ecsm_readkey_raw(1, row, col); | ||
| 165 | updated |= ecsm_update_key(¤t_matrix[row], row, col + 8, ecsm_sw_value[row][col + 8]); | ||
| 166 | } | ||
| 167 | } | ||
| 168 | return updated; | ||
| 169 | } | ||
| 170 | |||
| 171 | // Debug print key values | ||
| 172 | void ecsm_print_matrix(void) { | ||
| 173 | for (int row = 0; row < MATRIX_ROWS; row++) { | ||
| 174 | for (int col = 0; col < MATRIX_COLS; col++) { | ||
| 175 | uprintf("%4d", ecsm_sw_value[row][col]); | ||
| 176 | if (col < (MATRIX_COLS - 1)) { | ||
| 177 | print(","); | ||
| 178 | } | ||
| 179 | } | ||
| 180 | print("\n"); | ||
| 181 | } | ||
| 182 | print("\n"); | ||
| 183 | } | ||
diff --git a/keyboards/cipulot/ec_prox/jis/ec_switch_matrix.h b/keyboards/cipulot/ec_prox/jis/ec_switch_matrix.h new file mode 100644 index 0000000000..9dcb216caa --- /dev/null +++ b/keyboards/cipulot/ec_prox/jis/ec_switch_matrix.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #include <stdint.h> | ||
| 20 | #include <stdbool.h> | ||
| 21 | |||
| 22 | #include "matrix.h" | ||
| 23 | |||
| 24 | typedef struct { | ||
| 25 | uint16_t ecsm_actuation_threshold; // threshold for key release | ||
| 26 | uint16_t ecsm_release_threshold; // threshold for key press | ||
| 27 | } ecsm_config_t; | ||
| 28 | |||
| 29 | ecsm_config_t ecsm_config; | ||
| 30 | |||
| 31 | int ecsm_init(ecsm_config_t const* const ecsm_config); | ||
| 32 | int ecsm_update(ecsm_config_t const* const ecsm_config); | ||
| 33 | bool ecsm_matrix_scan(matrix_row_t current_matrix[]); | ||
| 34 | uint16_t ecsm_readkey_raw(uint8_t channel, uint8_t row, uint8_t col); | ||
| 35 | bool ecsm_update_key(matrix_row_t* current_row, uint8_t row, uint8_t col, uint16_t sw_value); | ||
| 36 | void ecsm_print_matrix(void); | ||
diff --git a/keyboards/cipulot/ec_prox/jis/halconf.h b/keyboards/cipulot/ec_prox/jis/halconf.h new file mode 100644 index 0000000000..5b71acecbb --- /dev/null +++ b/keyboards/cipulot/ec_prox/jis/halconf.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #define HAL_USE_ADC TRUE | ||
| 20 | |||
| 21 | #include_next <halconf.h> | ||
diff --git a/keyboards/cipulot/ec_prox/jis/info.json b/keyboards/cipulot/ec_prox/jis/info.json new file mode 100644 index 0000000000..bcb5a11a12 --- /dev/null +++ b/keyboards/cipulot/ec_prox/jis/info.json | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | { | ||
| 2 | "manufacturer": "Cipulot", | ||
| 3 | "keyboard_name": "EC Pro X JIS", | ||
| 4 | "maintainer": "Cipulot", | ||
| 5 | "bootloader": "stm32-dfu", | ||
| 6 | "build": { | ||
| 7 | "lto": true | ||
| 8 | }, | ||
| 9 | "diode_direction": "COL2ROW", | ||
| 10 | "features": { | ||
| 11 | "audio": false, | ||
| 12 | "backlight": false, | ||
| 13 | "bootmagic": true, | ||
| 14 | "command": false, | ||
| 15 | "console": true, | ||
| 16 | "extrakey": true, | ||
| 17 | "mousekey": true, | ||
| 18 | "nkro": true, | ||
| 19 | "rgblight": true | ||
| 20 | }, | ||
| 21 | "mouse_key": { | ||
| 22 | "enabled": true | ||
| 23 | }, | ||
| 24 | "processor": "STM32F401", | ||
| 25 | "rgblight": { | ||
| 26 | "led_count": 22, | ||
| 27 | "pin": "B12", | ||
| 28 | "animations": { | ||
| 29 | "alternating": true, | ||
| 30 | "breathing": true, | ||
| 31 | "christmas": true, | ||
| 32 | "knight": true, | ||
| 33 | "rainbow_mood": true, | ||
| 34 | "rainbow_swirl": true, | ||
| 35 | "rgb_test": true, | ||
| 36 | "snake": true, | ||
| 37 | "static_gradient": true, | ||
| 38 | "twinkle": true | ||
| 39 | } | ||
| 40 | }, | ||
| 41 | "url": "https://www.github.com/Cipulot/EC-Pro-X", | ||
| 42 | "usb": { | ||
| 43 | "device_version": "0.0.1", | ||
| 44 | "pid": "0x6B99", | ||
| 45 | "shared_endpoint": { | ||
| 46 | "keyboard": true | ||
| 47 | }, | ||
| 48 | "vid": "0x6369" | ||
| 49 | }, | ||
| 50 | "layouts": { | ||
| 51 | "LAYOUT_jp": { | ||
| 52 | "layout": [ | ||
| 53 | { "label": "0,0", "matrix": [0, 0], "x": 0.0, "y": 0.0 }, | ||
| 54 | { "label": "0,1", "matrix": [0, 1], "x": 1.0, "y": 0.0 }, | ||
| 55 | { "label": "0,2", "matrix": [0, 2], "x": 2.0, "y": 0.0 }, | ||
| 56 | { "label": "0,3", "matrix": [0, 3], "x": 3.0, "y": 0.0 }, | ||
| 57 | { "label": "0,4", "matrix": [0, 4], "x": 4.0, "y": 0.0 }, | ||
| 58 | { "label": "0,5", "matrix": [0, 5], "x": 5.0, "y": 0.0 }, | ||
| 59 | { "label": "0,6", "matrix": [0, 6], "x": 6.0, "y": 0.0 }, | ||
| 60 | { "label": "0,7", "matrix": [0, 7], "x": 7.0, "y": 0.0 }, | ||
| 61 | { "label": "0,8", "matrix": [0, 8], "x": 8.0, "y": 0.0 }, | ||
| 62 | { "label": "0,9", "matrix": [0, 9], "x": 9.0, "y": 0.0 }, | ||
| 63 | { "label": "0,10", "matrix": [0, 10], "x": 10.0, "y": 0.0 }, | ||
| 64 | { "label": "0,11", "matrix": [0, 11], "x": 11.0, "y": 0.0 }, | ||
| 65 | { "label": "0,12", "matrix": [0, 12], "x": 12.0, "y": 0.0 }, | ||
| 66 | { "label": "0,13", "matrix": [0, 13], "x": 13.0, "y": 0.0 }, | ||
| 67 | { "label": "1,13", "matrix": [1, 13], "x": 14.0, "y": 0.0 }, | ||
| 68 | { "label": "1,0", "matrix": [1, 0], "w": 1.5, "x": 0.0, "y": 1.0 }, | ||
| 69 | { "label": "1,1", "matrix": [1, 1], "x": 1.5, "y": 1.0 }, | ||
| 70 | { "label": "1,2", "matrix": [1, 2], "x": 2.5, "y": 1.0 }, | ||
| 71 | { "label": "1,3", "matrix": [1, 3], "x": 3.5, "y": 1.0 }, | ||
| 72 | { "label": "1,4", "matrix": [1, 4], "x": 4.5, "y": 1.0 }, | ||
| 73 | { "label": "1,5", "matrix": [1, 5], "x": 5.5, "y": 1.0 }, | ||
| 74 | { "label": "1,6", "matrix": [1, 6], "x": 6.5, "y": 1.0 }, | ||
| 75 | { "label": "1,7", "matrix": [1, 7], "x": 7.5, "y": 1.0 }, | ||
| 76 | { "label": "1,8", "matrix": [1, 8], "x": 8.5, "y": 1.0 }, | ||
| 77 | { "label": "1,9", "matrix": [1, 9], "x": 9.5, "y": 1.0 }, | ||
| 78 | { "label": "1,10", "matrix": [1, 10], "x": 10.5, "y": 1.0 }, | ||
| 79 | { "label": "1,11", "matrix": [1, 11], "x": 11.5, "y": 1.0 }, | ||
| 80 | { "label": "1,12", "matrix": [1, 12], "x": 12.5, "y": 1.0 }, | ||
| 81 | { "h": 2, "label": "2,13", "matrix": [2, 13], "w": 1.25, "x": 13.75, "y": 1.0 }, | ||
| 82 | { "label": "2,0", "matrix": [2, 0], "w": 1.75, "x": 0.0, "y": 2.0 }, | ||
| 83 | { "label": "2,1", "matrix": [2, 1], "x": 1.75, "y": 2.0 }, | ||
| 84 | { "label": "2,2", "matrix": [2, 2], "x": 2.75, "y": 2.0 }, | ||
| 85 | { "label": "2,3", "matrix": [2, 3], "x": 3.75, "y": 2.0 }, | ||
| 86 | { "label": "2,4", "matrix": [2, 4], "x": 4.75, "y": 2.0 }, | ||
| 87 | { "label": "2,5", "matrix": [2, 5], "x": 5.75, "y": 2.0 }, | ||
| 88 | { "label": "2,6", "matrix": [2, 6], "x": 6.75, "y": 2.0 }, | ||
| 89 | { "label": "2,7", "matrix": [2, 7], "x": 7.75, "y": 2.0 }, | ||
| 90 | { "label": "2,8", "matrix": [2, 8], "x": 8.75, "y": 2.0 }, | ||
| 91 | { "label": "2,9", "matrix": [2, 9], "x": 9.75, "y": 2.0 }, | ||
| 92 | { "label": "2,10", "matrix": [2, 10], "x": 10.75, "y": 2.0 }, | ||
| 93 | { "label": "2,11", "matrix": [2, 11], "x": 11.75, "y": 2.0 }, | ||
| 94 | { "label": "2,12", "matrix": [2, 12], "x": 12.75, "y": 2.0 }, | ||
| 95 | { "label": "3,0", "matrix": [3, 0], "w": 2, "x": 0.0, "y": 3.0 }, | ||
| 96 | { "label": "3,1", "matrix": [3, 1], "x": 2.0, "y": 3.0 }, | ||
| 97 | { "label": "3,2", "matrix": [3, 2], "x": 3.0, "y": 3.0 }, | ||
| 98 | { "label": "3,3", "matrix": [3, 3], "x": 4.0, "y": 3.0 }, | ||
| 99 | { "label": "3,4", "matrix": [3, 4], "x": 5.0, "y": 3.0 }, | ||
| 100 | { "label": "3,5", "matrix": [3, 5], "x": 6.0, "y": 3.0 }, | ||
| 101 | { "label": "3,6", "matrix": [3, 6], "x": 7.0, "y": 3.0 }, | ||
| 102 | { "label": "3,7", "matrix": [3, 7], "x": 8.0, "y": 3.0 }, | ||
| 103 | { "label": "3,8", "matrix": [3, 8], "x": 9.0, "y": 3.0 }, | ||
| 104 | { "label": "3,9", "matrix": [3, 9], "x": 10.0, "y": 3.0 }, | ||
| 105 | { "label": "3,10", "matrix": [3, 10], "x": 11.0, "y": 3.0 }, | ||
| 106 | { "label": "3,11", "matrix": [3, 11], "x": 12.0, "y": 3.0 }, | ||
| 107 | { "label": "3,12", "matrix": [3, 12], "x": 13.0, "y": 3.0 }, | ||
| 108 | { "label": "3,13", "matrix": [3, 13], "x": 14.0, "y": 3.0 }, | ||
| 109 | { "label": "4,0", "matrix": [4, 0], "x": 0.0, "y": 4.0 }, | ||
| 110 | { "label": "4,1", "matrix": [4, 1], "x": 1.25, "y": 4.0 }, | ||
| 111 | { "label": "4,2", "matrix": [4, 2], "x": 2.25, "y": 4.0 }, | ||
| 112 | { "label": "4,3", "matrix": [4, 3], "x": 3.25, "y": 4.0 }, | ||
| 113 | { "label": "4,4", "matrix": [4, 4], "x": 4.25, "y": 4.0 }, | ||
| 114 | { "label": "4,5", "matrix": [4, 5], "w": 2.5, "x": 5.25, "y": 4.0 }, | ||
| 115 | { "label": "4,7", "matrix": [4, 7], "x": 7.75, "y": 4.0 }, | ||
| 116 | { "label": "4,8", "matrix": [4, 8], "x": 8.75, "y": 4.0 }, | ||
| 117 | { "label": "4,9", "matrix": [4, 9], "x": 9.75, "y": 4.0 }, | ||
| 118 | { "label": "4,10", "matrix": [4, 10], "x": 10.75, "y": 4.0 }, | ||
| 119 | { "label": "4,11", "matrix": [4, 11], "x": 12.0, "y": 4.0 }, | ||
| 120 | { "label": "4,12", "matrix": [4, 12], "x": 13.0, "y": 4.0 }, | ||
| 121 | { "label": "4,13", "matrix": [4, 13], "x": 14.0, "y": 4.0 } | ||
| 122 | ] | ||
| 123 | } | ||
| 124 | } | ||
| 125 | } | ||
diff --git a/keyboards/cipulot/ec_prox/jis/keymaps/default/keymap.c b/keyboards/cipulot/ec_prox/jis/keymaps/default/keymap.c new file mode 100644 index 0000000000..979319a622 --- /dev/null +++ b/keyboards/cipulot/ec_prox/jis/keymaps/default/keymap.c | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include QMK_KEYBOARD_H | ||
| 18 | |||
| 19 | #include "keymap_japanese.h" | ||
| 20 | |||
| 21 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 22 | // clang-format off | ||
| 23 | [0] = LAYOUT_jp( | ||
| 24 | 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, JP_YEN, KC_BSPC, | ||
| 25 | 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, | ||
| 26 | 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_BSLS, KC_ENT, | ||
| 27 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, JP_UNDS, KC_UP, KC_RSFT, | ||
| 28 | MO(1), JP_ZKHK, KC_LGUI, KC_LALT, JP_MHEN, KC_SPC, JP_HENK, JP_KANA, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT), | ||
| 29 | |||
| 30 | [1] = LAYOUT_jp( | ||
| 31 | _______, 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, | ||
| 32 | KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SCRL, KC_PAUS, KC_UP, _______, | ||
| 33 | _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, KC_PENT, | ||
| 34 | _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______, | ||
| 35 | _______, _______, _______, _______, _______, _______, _______, _______, MO(2), _______, _______, _______, _______), | ||
| 36 | |||
| 37 | [2] = LAYOUT_jp( | ||
| 38 | RGB_TOG, RGB_VAD, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, QK_BOOT, | ||
| 39 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 40 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 41 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 42 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), | ||
| 43 | |||
| 44 | [3] = LAYOUT_jp( | ||
| 45 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 46 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 47 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 48 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 49 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) | ||
| 50 | // clang-format on | ||
| 51 | }; | ||
diff --git a/keyboards/cipulot/ec_prox/jis/keymaps/via/config.h b/keyboards/cipulot/ec_prox/jis/keymaps/via/config.h new file mode 100644 index 0000000000..ebf954d07a --- /dev/null +++ b/keyboards/cipulot/ec_prox/jis/keymaps/via/config.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | // This is the size of the EEPROM for the custom VIA-specific data | ||
| 20 | #define EECONFIG_USER_DATA_SIZE 4 | ||
diff --git a/keyboards/cipulot/ec_prox/jis/keymaps/via/keymap.c b/keyboards/cipulot/ec_prox/jis/keymaps/via/keymap.c new file mode 100644 index 0000000000..cc9382531d --- /dev/null +++ b/keyboards/cipulot/ec_prox/jis/keymaps/via/keymap.c | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include QMK_KEYBOARD_H | ||
| 18 | |||
| 19 | #include "keymap_japanese.h" | ||
| 20 | |||
| 21 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 22 | // clang-format off | ||
| 23 | [0] = LAYOUT_jp( | ||
| 24 | 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, JP_YEN, KC_BSPC, | ||
| 25 | 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_ENT, | ||
| 26 | 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_BSLS, | ||
| 27 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, JP_UNDS, KC_UP, KC_RSFT, | ||
| 28 | MO(1), JP_ZKHK, KC_LGUI, KC_LALT, JP_MHEN, KC_SPC, JP_HENK, JP_KANA, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT), | ||
| 29 | |||
| 30 | [1] = LAYOUT_jp( | ||
| 31 | _______, 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, | ||
| 32 | KC_CAPS, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SCRL, KC_PAUS, KC_UP, _______, KC_PENT, | ||
| 33 | _______, KC_VOLD, KC_VOLU, KC_MUTE, _______, _______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, _______, | ||
| 34 | _______, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______, | ||
| 35 | _______, _______, _______, _______, _______, _______, _______, _______, MO(2), _______, _______, _______, _______), | ||
| 36 | |||
| 37 | [2] = LAYOUT_jp( | ||
| 38 | RGB_TOG, RGB_VAD, RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, QK_BOOT, | ||
| 39 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 40 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 41 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 42 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______), | ||
| 43 | |||
| 44 | [3] = LAYOUT_jp( | ||
| 45 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 46 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 47 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 48 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 49 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______) | ||
| 50 | // clang-format on | ||
| 51 | }; | ||
diff --git a/keyboards/cipulot/ec_prox/jis/keymaps/via/rules.mk b/keyboards/cipulot/ec_prox/jis/keymaps/via/rules.mk new file mode 100644 index 0000000000..520b11f203 --- /dev/null +++ b/keyboards/cipulot/ec_prox/jis/keymaps/via/rules.mk | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | VIA_ENABLE = yes | ||
| 2 | |||
| 3 | SRC += via_apc.c | ||
diff --git a/keyboards/cipulot/ec_prox/jis/keymaps/via/via_apc.c b/keyboards/cipulot/ec_prox/jis/keymaps/via/via_apc.c new file mode 100644 index 0000000000..5ea77af44c --- /dev/null +++ b/keyboards/cipulot/ec_prox/jis/keymaps/via/via_apc.c | |||
| @@ -0,0 +1,156 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "ec_switch_matrix.h" | ||
| 18 | #include "action.h" | ||
| 19 | #include "via.h" | ||
| 20 | |||
| 21 | void apc_init_thresholds(void); | ||
| 22 | void apc_set_threshold(bool is_for_actuation); | ||
| 23 | |||
| 24 | // Declaring an _apc_config_t struct that will store our data | ||
| 25 | typedef struct _apc_config_t { | ||
| 26 | uint16_t actuation_threshold; | ||
| 27 | uint16_t release_threshold; | ||
| 28 | } apc_config; | ||
| 29 | |||
| 30 | // Check if the size of the reserved persistent memory is the same as the size of struct apc_config | ||
| 31 | _Static_assert(sizeof(apc_config) == EECONFIG_USER_DATA_SIZE, "Mismatch in keyboard EECONFIG stored data"); | ||
| 32 | |||
| 33 | // Declaring a new variable apc of type apc_config | ||
| 34 | apc_config apc; | ||
| 35 | |||
| 36 | // Declaring enums for VIA config menu | ||
| 37 | enum via_apc_enums { | ||
| 38 | // clang-format off | ||
| 39 | id_apc_actuation_threshold = 1, | ||
| 40 | id_apc_release_threshold = 2 | ||
| 41 | // clang-format on | ||
| 42 | }; | ||
| 43 | |||
| 44 | // Initializing persistent memory configuration: default values are declared and stored in PMEM | ||
| 45 | void eeconfig_init_user(void) { | ||
| 46 | // Default values | ||
| 47 | apc.actuation_threshold = DEFAULT_ACTUATION_LEVEL; | ||
| 48 | apc.release_threshold = DEFAULT_RELEASE_LEVEL; | ||
| 49 | // Write default value to EEPROM now | ||
| 50 | eeconfig_update_user_datablock(&apc); | ||
| 51 | } | ||
| 52 | |||
| 53 | // On Keyboard startup | ||
| 54 | void keyboard_post_init_user(void) { | ||
| 55 | // Read custom menu variables from memory | ||
| 56 | eeconfig_read_user_datablock(&apc); | ||
| 57 | apc_init_thresholds(); | ||
| 58 | } | ||
| 59 | |||
| 60 | // Handle the data received by the keyboard from the VIA menus | ||
| 61 | void apc_config_set_value(uint8_t *data) { | ||
| 62 | // data = [ value_id, value_data ] | ||
| 63 | uint8_t *value_id = &(data[0]); | ||
| 64 | uint8_t *value_data = &(data[1]); | ||
| 65 | |||
| 66 | switch (*value_id) { | ||
| 67 | case id_apc_actuation_threshold: { | ||
| 68 | apc.actuation_threshold = value_data[1] | (value_data[0] << 8); | ||
| 69 | apc_set_threshold(true); | ||
| 70 | break; | ||
| 71 | } | ||
| 72 | case id_apc_release_threshold: { | ||
| 73 | apc.release_threshold = value_data[1] | (value_data[0] << 8); | ||
| 74 | apc_set_threshold(false); | ||
| 75 | break; | ||
| 76 | } | ||
| 77 | } | ||
| 78 | } | ||
| 79 | |||
| 80 | // Handle the data sent by the keyboard to the VIA menus | ||
| 81 | void apc_config_get_value(uint8_t *data) { | ||
| 82 | // data = [ value_id, value_data ] | ||
| 83 | uint8_t *value_id = &(data[0]); | ||
| 84 | uint8_t *value_data = &(data[1]); | ||
| 85 | |||
| 86 | switch (*value_id) { | ||
| 87 | case id_apc_actuation_threshold: { | ||
| 88 | value_data[0] = apc.actuation_threshold >> 8; | ||
| 89 | value_data[1] = apc.actuation_threshold & 0xFF; | ||
| 90 | break; | ||
| 91 | } | ||
| 92 | case id_apc_release_threshold: { | ||
| 93 | value_data[0] = apc.release_threshold >> 8; | ||
| 94 | value_data[1] = apc.release_threshold & 0xFF; | ||
| 95 | break; | ||
| 96 | } | ||
| 97 | } | ||
| 98 | } | ||
| 99 | |||
| 100 | // Save the data to persistent memory after changes are made | ||
| 101 | void apc_config_save(void) { | ||
| 102 | eeconfig_update_user_datablock(&apc); | ||
| 103 | } | ||
| 104 | |||
| 105 | void via_custom_value_command_kb(uint8_t *data, uint8_t length) { | ||
| 106 | // data = [ command_id, channel_id, value_id, value_data ] | ||
| 107 | uint8_t *command_id = &(data[0]); | ||
| 108 | uint8_t *channel_id = &(data[1]); | ||
| 109 | uint8_t *value_id_and_data = &(data[2]); | ||
| 110 | |||
| 111 | if (*channel_id == id_custom_channel) { | ||
| 112 | switch (*command_id) { | ||
| 113 | case id_custom_set_value: { | ||
| 114 | apc_config_set_value(value_id_and_data); | ||
| 115 | break; | ||
| 116 | } | ||
| 117 | case id_custom_get_value: { | ||
| 118 | apc_config_get_value(value_id_and_data); | ||
| 119 | break; | ||
| 120 | } | ||
| 121 | case id_custom_save: { | ||
| 122 | apc_config_save(); | ||
| 123 | break; | ||
| 124 | } | ||
| 125 | default: { | ||
| 126 | // Unhandled message. | ||
| 127 | *command_id = id_unhandled; | ||
| 128 | break; | ||
| 129 | } | ||
| 130 | } | ||
| 131 | return; | ||
| 132 | } | ||
| 133 | |||
| 134 | *command_id = id_unhandled; | ||
| 135 | } | ||
| 136 | |||
| 137 | // Initialize the thresholds | ||
| 138 | void apc_init_thresholds(void) { | ||
| 139 | ecsm_config.ecsm_actuation_threshold = apc.actuation_threshold; | ||
| 140 | ecsm_config.ecsm_release_threshold = apc.release_threshold; | ||
| 141 | |||
| 142 | // Update the ecsm_config | ||
| 143 | ecsm_update(&ecsm_config); | ||
| 144 | } | ||
| 145 | |||
| 146 | // Set the thresholds | ||
| 147 | void apc_set_threshold(bool is_for_actuation) { | ||
| 148 | if (is_for_actuation) { | ||
| 149 | ecsm_config.ecsm_actuation_threshold = apc.actuation_threshold; | ||
| 150 | |||
| 151 | } else { | ||
| 152 | ecsm_config.ecsm_release_threshold = apc.release_threshold; | ||
| 153 | } | ||
| 154 | // Update the ecsm_config | ||
| 155 | ecsm_update(&ecsm_config); | ||
| 156 | } | ||
diff --git a/keyboards/cipulot/ec_prox/jis/matrix.c b/keyboards/cipulot/ec_prox/jis/matrix.c new file mode 100644 index 0000000000..1850acf264 --- /dev/null +++ b/keyboards/cipulot/ec_prox/jis/matrix.c | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "ec_switch_matrix.h" | ||
| 18 | #include "matrix.h" | ||
| 19 | |||
| 20 | /* matrix state(1:on, 0:off) */ | ||
| 21 | extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values | ||
| 22 | extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values | ||
| 23 | |||
| 24 | void matrix_init_custom(void) { | ||
| 25 | // Default values, overwritten by VIA if enabled later | ||
| 26 | ecsm_config.ecsm_actuation_threshold = DEFAULT_ACTUATION_LEVEL; | ||
| 27 | ecsm_config.ecsm_release_threshold = DEFAULT_RELEASE_LEVEL; | ||
| 28 | |||
| 29 | ecsm_init(&ecsm_config); | ||
| 30 | } | ||
| 31 | |||
| 32 | bool matrix_scan_custom(matrix_row_t current_matrix[]) { | ||
| 33 | bool updated = ecsm_matrix_scan(current_matrix); | ||
| 34 | |||
| 35 | // RAW matrix values on console | ||
| 36 | #ifdef CONSOLE_ENABLE | ||
| 37 | static int cnt = 0; | ||
| 38 | if (cnt++ == 350) { | ||
| 39 | cnt = 0; | ||
| 40 | ecsm_print_matrix(); | ||
| 41 | } | ||
| 42 | #endif | ||
| 43 | return updated; | ||
| 44 | } | ||
diff --git a/keyboards/cipulot/ec_prox/jis/mcuconf.h b/keyboards/cipulot/ec_prox/jis/mcuconf.h new file mode 100644 index 0000000000..d91f576bd4 --- /dev/null +++ b/keyboards/cipulot/ec_prox/jis/mcuconf.h | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | /* Copyright 2023 Cipulot | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #include_next <mcuconf.h> | ||
| 20 | |||
| 21 | #undef STM32_ADC_USE_ADC1 | ||
| 22 | #define STM32_ADC_USE_ADC1 TRUE | ||
diff --git a/keyboards/cipulot/ec_prox/jis/readme.md b/keyboards/cipulot/ec_prox/jis/readme.md new file mode 100644 index 0000000000..f1fa471cc9 --- /dev/null +++ b/keyboards/cipulot/ec_prox/jis/readme.md | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | # EC Pro X JIS | ||
| 2 | |||
| 3 |  | ||
| 4 | |||
| 5 | Open source replacement PCB kit for the HHKB Pro 2 and Pro 3 keyboards using the JIS case. | ||
| 6 | |||
| 7 | * Keyboard Maintainer: [cipulot](https://github.com/cipulot) | ||
| 8 | * Hardware Supported: EC Pro X JP PCB | ||
| 9 | * Hardware Availability: [EC Pro X](https://github.com/cipulot/EC-Pro-X) | ||
| 10 | |||
| 11 | Make example for this keyboard (after setting up your build environment): | ||
| 12 | |||
| 13 | make cipulot/ec_prox/jis:default | ||
| 14 | |||
| 15 | Flashing example for this keyboard: | ||
| 16 | |||
| 17 | make cipulot/ec_prox/jis:default:flash | ||
| 18 | |||
| 19 | 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). | ||
| 20 | |||
| 21 | ## Bootloader | ||
| 22 | |||
| 23 | Enter the bootloader in 3 ways: | ||
| 24 | |||
| 25 | * **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard | ||
| 26 | * **Physical Boot0 pins**: Short the Boot0 pins on the back of the PCB while plugging in the keyboard | ||
| 27 | * **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available | ||
diff --git a/keyboards/cipulot/ec_prox/jis/rules.mk b/keyboards/cipulot/ec_prox/jis/rules.mk new file mode 100644 index 0000000000..ed348e8618 --- /dev/null +++ b/keyboards/cipulot/ec_prox/jis/rules.mk | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | CUSTOM_MATRIX = lite | ||
| 2 | QUANTUM_LIB_SRC += analog.c | ||
| 3 | SRC += matrix.c ec_switch_matrix.c | ||
