diff options
-rw-r--r-- | keyboards/miiiw/blackio83/blackio83.c | 189 | ||||
-rw-r--r-- | keyboards/miiiw/blackio83/blackio83.h | 30 | ||||
-rw-r--r-- | keyboards/miiiw/blackio83/config.h | 56 | ||||
-rw-r--r-- | keyboards/miiiw/blackio83/halconf.h | 32 | ||||
-rw-r--r-- | keyboards/miiiw/blackio83/info.json | 216 | ||||
-rw-r--r-- | keyboards/miiiw/blackio83/keymaps/default/keymap.c | 71 | ||||
-rw-r--r-- | keyboards/miiiw/blackio83/keymaps/via/keymap.c | 71 | ||||
-rw-r--r-- | keyboards/miiiw/blackio83/keymaps/via/rules.mk | 2 | ||||
-rw-r--r-- | keyboards/miiiw/blackio83/matrix.c | 139 | ||||
-rw-r--r-- | keyboards/miiiw/blackio83/mcuconf.h | 33 | ||||
-rw-r--r-- | keyboards/miiiw/blackio83/readme.md | 30 | ||||
-rw-r--r-- | keyboards/miiiw/blackio83/rev_0100/config.h | 70 | ||||
-rw-r--r-- | keyboards/miiiw/blackio83/rev_0100/rev_0100.c | 17 | ||||
-rw-r--r-- | keyboards/miiiw/blackio83/rev_0100/rules.mk | 7 | ||||
-rw-r--r-- | keyboards/miiiw/common/shift_register.c | 90 | ||||
-rw-r--r-- | keyboards/miiiw/common/shift_register.h | 34 |
16 files changed, 1087 insertions, 0 deletions
diff --git a/keyboards/miiiw/blackio83/blackio83.c b/keyboards/miiiw/blackio83/blackio83.c new file mode 100644 index 0000000000..0d8412624e --- /dev/null +++ b/keyboards/miiiw/blackio83/blackio83.c @@ -0,0 +1,189 @@ +/* Copyright 2023 ArthurCyy <https://github.com/ArthurCyy> + * + * 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 "blackio83.h" +#include "usb_main.h" +#include "usb_util.h" + +#define LOOP_10HZ_PERIOD 100 +deferred_token loop10hz_token = INVALID_DEFERRED_TOKEN; +uint32_t loop_10Hz(uint32_t trigger_time, void *cb_arg); + +static const SerialConfig mwproto_uart_config = { + .speed = MWPROTO_BITRATE, +}; + +static void POWER_EnterSleep(void) { + /* Clear Wake-up flag */ + PWR->CR |= PWR_CR_CWUF | PWR_CR_CSBF; + /* Select Sleep mode */ + /* PWR->CR |= PWR_CR_PDDS | PWR_CR_LPDS; */ + /* Set SLEEPDEEP bit of Cortex System Control Register */ + SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; + /* Request Wait For Interrupt */ + __WFI(); + /* Reset SLEEPDEEP bit of Cortex System Control Register */ + SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk; + NVIC_SystemReset(); +} + +extern void ws2812_poweron(void); +extern void ws2812_poweroff(void); + +static bool p_setup = false; +static bool s_init = false; +void ws2812_poweron(void) { + if(p_setup) return; + p_setup = true; + s_init = false; + setPinOutput(RGB_EN_PIN); + writePinHigh(RGB_EN_PIN); +} + +void ws2812_poweroff(void) { + if(!p_setup) return; + p_setup = false; + setPinInputLow(WS2812_DI_PIN); + writePinLow(RGB_EN_PIN); +} + +void keyboard_pre_init_kb() { + keyboard_pre_init_user(); + + setPinInputLow(MWPROTO_STATUS_PIN); + setPinOutput(MWPROTO_WAKEUP_PIN); + writePinLow(MWPROTO_WAKEUP_PIN); + wait_ms(2); + writePinHigh(MWPROTO_WAKEUP_PIN); + + palSetLineMode(MWPROTO_TX_PIN, PAL_MODE_ALTERNATE(MWPROTO_TX_PAL_MODE) | PAL_OUTPUT_TYPE_OPENDRAIN); + sdStart(&MWPROTO_DRIVER, &mwproto_uart_config); +} + +void keyboard_post_init_kb(void) { + keyboard_post_init_user(); + + print(/* clang-format off */ + "\n<--QMK Keyboard-->\n" + "Vendor: " STR(MANUFACTURER) "(" STR(VENDOR_ID) ")\n" + "Product: " STR(PRODUCT) " (" STR(PRODUCT_ID) ")\n" + "Version: " STR(DEVICE_VER) "\n" + "BUILD: " __DATE__ "\n" + ); /* clang-format on */ + + writePinLow(MWPROTO_WAKEUP_PIN); + wait_ms(50); + sdPutI(&MWPROTO_DRIVER, 0xA5); + sdPutI(&MWPROTO_DRIVER, 0x12); + sdPutI(&MWPROTO_DRIVER, 0x01); + sdPutI(&MWPROTO_DRIVER, 0x02); + sdPutI(&MWPROTO_DRIVER, 0xB4); + writePinHigh(MWPROTO_WAKEUP_PIN); + + ws2812_poweron(); + loop10hz_token = defer_exec(LOOP_10HZ_PERIOD, loop_10Hz, NULL); +} + +__attribute__((weak)) void shutdown_user(void) { +#ifdef RGB_MATRIX_ENABLE + rgb_matrix_set_suspend_state(true); +#endif // RGB_MATRIX_ENABLE + wait_ms(10); + ws2812_poweroff(); +} + +#ifdef DIP_SWITCH_ENABLE +bool dip_switch_update_mask_kb(uint32_t state) { + if (!dip_switch_update_mask_user(state)) { return false; } + + if(state & 0x01) { + led_suspend(); + usbDisconnectBus(&USB_DRIVER); + usbStop(&USB_DRIVER); + shutdown_user(); + setPinInputHigh(POWER_SWITCH_PIN); + palEnableLineEvent(POWER_SWITCH_PIN, PAL_EVENT_MODE_RISING_EDGE); + POWER_EnterSleep(); + } + + return true; +} +#endif + +uint32_t loop_10Hz(uint32_t trigger_time, void *cb_arg) { + + if(last_input_activity_elapsed() > 1000) { + static uint32_t pmu_timer = 0; + if(timer_elapsed32(pmu_timer) > 3000) { + pmu_timer = timer_read32(); + writePinLow(MWPROTO_WAKEUP_PIN); + if(readPin(MWPROTO_STATUS_PIN)) + wait_us(500); + else + wait_us(1500); + sdPutI(&MWPROTO_DRIVER, 0xA5); + sdPutI(&MWPROTO_DRIVER, 0x28); + sdPutI(&MWPROTO_DRIVER, 0x00); + sdPutI(&MWPROTO_DRIVER, 0x8D); + writePinHigh(MWPROTO_WAKEUP_PIN); + } + } + + extern matrix_row_t matrix[MATRIX_ROWS]; + static uint32_t restore_tick = 0; + if(matrix[0] == 0x4000 && matrix[1] == 0 && + matrix[2] == 0 && matrix[3] == 0 && matrix[4] == 0 && matrix[5] == 0x201) { + if(restore_tick++ > 50) { + restore_tick = 0; + writePinLow(MWPROTO_WAKEUP_PIN); + if(readPin(MWPROTO_STATUS_PIN)) + wait_us(500); + else + wait_us(1500); + sdPutI(&MWPROTO_DRIVER, 0xA5); + sdPutI(&MWPROTO_DRIVER, 0x1F); + sdPutI(&MWPROTO_DRIVER, 0x01); + sdPutI(&MWPROTO_DRIVER, 0x0F); + sdPutI(&MWPROTO_DRIVER, 0xB4); + writePinHigh(MWPROTO_WAKEUP_PIN); + wait_ms(50); + eeconfig_init(); + #ifdef RGB_MATRIX_ENABLE + extern void rgb_matrix_update_pwm_buffers(void); + for(int i = 0; i < 5; i++) { + rgb_matrix_set_color_all(RGB_WHITE); + rgb_matrix_update_pwm_buffers(); + wait_ms(500); + rgb_matrix_set_color_all(RGB_OFF); + rgb_matrix_update_pwm_buffers(); + wait_ms(500); + } + #endif + wait_ms(500); + soft_reset_keyboard(); + } + } else { + restore_tick = 0; + } + + static uint32_t debug_tick = 0; + if (debug_tick++ > 9 ) { + dprintf("trigger %d\n", trigger_time); + debug_tick = 0; + } + + return LOOP_10HZ_PERIOD; +} diff --git a/keyboards/miiiw/blackio83/blackio83.h b/keyboards/miiiw/blackio83/blackio83.h new file mode 100644 index 0000000000..ea371443e3 --- /dev/null +++ b/keyboards/miiiw/blackio83/blackio83.h @@ -0,0 +1,30 @@ +/* Copyright 2023 ArthurCyy <https://github.com/ArthurCyy> + * + * 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 XXX KC_NO + +enum custom_keycodes { + DEV_BT1 = QK_KB, + DEV_BT2, + DEV_BT3, + DEV_RF24, + ALT_TAB, + RGB_RST, +};
\ No newline at end of file diff --git a/keyboards/miiiw/blackio83/config.h b/keyboards/miiiw/blackio83/config.h new file mode 100644 index 0000000000..73c98722e9 --- /dev/null +++ b/keyboards/miiiw/blackio83/config.h @@ -0,0 +1,56 @@ +/* Copyright 2023 ArthurCyy <https://github.com/ArthurCyy> + * + * 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 + +// EEPROM i2c chip +#define EEPROM_I2C_24LC256 + +/* Disable the animations you don't want/need. You will need to disable a good number of these * + * because they take up a lot of space. Disable until you can successfully compile your firmware. */ +// RGB Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects +// # define ENABLE_RGB_MATRIX_ALPHAS_MODS +# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_BREATHING +# define ENABLE_RGB_MATRIX_BAND_SAT +# define ENABLE_RGB_MATRIX_BAND_VAL +# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT +# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL +# define ENABLE_RGB_MATRIX_CYCLE_ALL +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# define ENABLE_RGB_MATRIX_DUAL_BEACON +# define ENABLE_RGB_MATRIX_RAINBOW_BEACON +# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS +# define ENABLE_RGB_MATRIX_RAINDROPS +# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +# define ENABLE_RGB_MATRIX_HUE_BREATHING +# define ENABLE_RGB_MATRIX_HUE_PENDULUM +# define ENABLE_RGB_MATRIX_HUE_WAVE +# define ENABLE_RGB_MATRIX_PIXEL_RAIN +# define ENABLE_RGB_MATRIX_PIXEL_FLOW +# define ENABLE_RGB_MATRIX_PIXEL_FRACTAL +#define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_SOLID_COLOR diff --git a/keyboards/miiiw/blackio83/halconf.h b/keyboards/miiiw/blackio83/halconf.h new file mode 100644 index 0000000000..037108a392 --- /dev/null +++ b/keyboards/miiiw/blackio83/halconf.h @@ -0,0 +1,32 @@ +/* Copyright 2020 QMK + * + * 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/>. + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/geekboards/macropad_v2/halconf.h -r platforms/chibios/common/configs/halconf.h` + */ + +#pragma once + +#define HAL_USE_SERIAL TRUE + +#define HAL_USE_I2C TRUE + +// This enables interrupt-driven mode +#define PAL_USE_WAIT TRUE +#define USB_USE_WAIT TRUE + +#include_next <halconf.h> diff --git a/keyboards/miiiw/blackio83/info.json b/keyboards/miiiw/blackio83/info.json new file mode 100644 index 0000000000..40fc6b7d89 --- /dev/null +++ b/keyboards/miiiw/blackio83/info.json @@ -0,0 +1,216 @@ +{ + "manufacturer": "MIIIW", + "keyboard_name": "MIIIW BlackIO 83", + "maintainer": "ArthurCyy", + "bootloader": "stm32-dfu", + "debounce": 3, + "diode_direction": "COL2ROW", + "features": { + "backlight": false, + "bootmagic": true, + "command": false, + "console": false, + "deferred_exec": true, + "dip_switch": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "rgb_matrix": true, + "rgblight": false + }, + "indicators": { + "caps_lock": "B2", + "num_lock": "B14" + }, + "matrix_pins": { + "cols": ["H0", "H1", "H2", "H3", "H4", "H5", "H6", "H7", "H8", "H9", "H10", "H11", "H12", "H13", "H14", "H15"], + "rows": ["A7", "A6", "A5", "A4", "A3", "A2"] + }, + "processor": "STM32F072", + "rgb_matrix": { + "driver": "ws2812", + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0, "flags": 4}, + {"matrix": [0, 2], "x": 10, "y": 0, "flags": 4}, + {"matrix": [0, 3], "x": 18, "y": 0, "flags": 4}, + {"matrix": [0, 4], "x": 26, "y": 0, "flags": 4}, + {"matrix": [0, 5], "x": 34, "y": 0, "flags": 4}, + {"matrix": [0, 6], "x": 44, "y": 0, "flags": 4}, + {"matrix": [0, 7], "x": 52, "y": 0, "flags": 4}, + {"matrix": [0, 8], "x": 60, "y": 0, "flags": 4}, + {"matrix": [0, 9], "x": 68, "y": 0, "flags": 4}, + {"matrix": [0, 10], "x": 78, "y": 0, "flags": 4}, + {"matrix": [0, 11], "x": 86, "y": 0, "flags": 4}, + {"matrix": [0, 12], "x": 94, "y": 0, "flags": 4}, + {"matrix": [0, 13], "x": 102, "y": 0, "flags": 4}, + {"matrix": [0, 14], "x": 112, "y": 0, "flags": 4}, + {"matrix": [0, 15], "x": 124, "y": 0, "flags": 4}, + {"matrix": [1, 0], "x": 124, "y": 20, "flags": 4}, + {"matrix": [1, 1], "x": 108, "y": 20, "flags": 4}, + {"matrix": [1, 2], "x": 96, "y": 20, "flags": 4}, + {"matrix": [1, 3], "x": 88, "y": 20, "flags": 4}, + {"matrix": [1, 4], "x": 80, "y": 20, "flags": 4}, + {"matrix": [1, 5], "x": 72, "y": 20, "flags": 4}, + {"matrix": [1, 6], "x": 64, "y": 20, "flags": 4}, + {"matrix": [1, 7], "x": 56, "y": 20, "flags": 4}, + {"matrix": [1, 8], "x": 48, "y": 20, "flags": 4}, + {"matrix": [1, 9], "x": 40, "y": 20, "flags": 4}, + {"matrix": [1, 10], "x": 32, "y": 20, "flags": 4}, + {"matrix": [1, 11], "x": 24, "y": 20, "flags": 4}, + {"matrix": [1, 12], "x": 16, "y": 20, "flags": 4}, + {"matrix": [1, 13], "x": 8, "y": 20, "flags": 4}, + {"matrix": [1, 15], "x": 0, "y": 20, "flags": 4}, + {"matrix": [2, 0], "x": 2, "y": 36, "flags": 4}, + {"matrix": [2, 1], "x": 12, "y": 36, "flags": 4}, + {"matrix": [2, 2], "x": 20, "y": 36, "flags": 4}, + {"matrix": [2, 3], "x": 28, "y": 36, "flags": 4}, + {"matrix": [2, 4], "x": 36, "y": 36, "flags": 4}, + {"matrix": [2, 5], "x": 44, "y": 36, "flags": 4}, + {"matrix": [2, 6], "x": 52, "y": 36, "flags": 4}, + {"matrix": [2, 7], "x": 60, "y": 36, "flags": 4}, + {"matrix": [2, 8], "x": 68, "y": 36, "flags": 4}, + {"matrix": [2, 9], "x": 76, "y": 36, "flags": 4}, + {"matrix": [2, 10], "x": 84, "y": 36, "flags": 4}, + {"matrix": [2, 11], "x": 92, "y": 36, "flags": 4}, + {"matrix": [2, 12], "x": 100, "y": 36, "flags": 4}, + {"matrix": [2, 13], "x": 110, "y": 36, "flags": 4}, + {"matrix": [2, 15], "x": 124, "y": 36, "flags": 4}, + {"matrix": [3, 0], "x": 124, "y": 52, "flags": 4}, + {"matrix": [3, 1], "x": 107, "y": 52, "flags": 4}, + {"matrix": [3, 2], "x": 94, "y": 52, "flags": 4}, + {"matrix": [3, 3], "x": 86, "y": 52, "flags": 4}, + {"matrix": [3, 4], "x": 78, "y": 52, "flags": 4}, + {"matrix": [3, 5], "x": 70, "y": 52, "flags": 4}, + {"matrix": [3, 6], "x": 62, "y": 52, "flags": 4}, + {"matrix": [3, 7], "x": 54, "y": 52, "flags": 4}, + {"matrix": [3, 8], "x": 46, "y": 52, "flags": 4}, + {"matrix": [3, 9], "x": 38, "y": 52, "flags": 4}, + {"matrix": [3, 10], "x": 30, "y": 52, "flags": 4}, + {"matrix": [3, 11], "x": 22, "y": 52, "flags": 4}, + {"matrix": [3, 12], "x": 14, "y": 52, "flags": 4}, + {"matrix": [3, 15], "x": 3, "y": 52, "flags": 4}, + {"matrix": [4, 0], "x": 5, "y": 68, "flags": 4}, + {"matrix": [4, 1], "x": 18, "y": 68, "flags": 4}, + {"matrix": [4, 2], "x": 26, "y": 68, "flags": 4}, + {"matrix": [4, 3], "x": 34, "y": 68, "flags": 4}, + {"matrix": [4, 4], "x": 42, "y": 68, "flags": 4}, + {"matrix": [4, 5], "x": 50, "y": 68, "flags": 4}, + {"matrix": [4, 6], "x": 58, "y": 68, "flags": 4}, + {"matrix": [4, 7], "x": 66, "y": 68, "flags": 4}, + {"matrix": [4, 8], "x": 74, "y": 68, "flags": 4}, + {"matrix": [4, 9], "x": 82, "y": 68, "flags": 4}, + {"matrix": [4, 10], "x": 90, "y": 68, "flags": 4}, + {"matrix": [4, 11], "x": 104, "y": 68, "flags": 4}, + {"matrix": [4, 13], "x": 114, "y": 68, "flags": 4}, + {"matrix": [4, 15], "x": 124, "y": 68, "flags": 4}, + {"matrix": [5, 0], "x": 122, "y": 84, "flags": 4}, + {"matrix": [5, 1], "x": 114, "y": 84, "flags": 4}, + {"matrix": [5, 2], "x": 106, "y": 84, "flags": 4}, + {"matrix": [5, 5], "x": 96, "y": 84, "flags": 4}, + {"matrix": [5, 8], "x": 88, "y": 84, "flags": 4}, + {"matrix": [5, 9], "x": 80, "y": 84, "flags": 4}, + {"matrix": [5, 10], "x": 50, "y": 84, "flags": 4}, + {"matrix": [5, 12], "x": 20, "y": 88, "flags": 4}, + {"matrix": [5, 13], "x": 10, "y": 88, "flags": 4}, + {"matrix": [5, 14], "x": 1, "y": 88, "flags": 4} + ] + }, + "url": "https://github.com/ArthurCyy", + "usb": { + "device_version": "0.0.1", + "pid": "0x83A1", + "vid": "0x3044" + }, + "ws2812": { + "pin": "B15" + }, + "layouts": { + "LAYOUT": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0}, + {"matrix": [0, 2], "x": 1.25, "y": 0}, + {"matrix": [0, 3], "x": 2.25, "y": 0}, + {"matrix": [0, 4], "x": 3.25, "y": 0}, + {"matrix": [0, 5], "x": 4.25, "y": 0}, + {"matrix": [0, 6], "x": 5.5, "y": 0}, + {"matrix": [0, 7], "x": 6.5, "y": 0}, + {"matrix": [0, 8], "x": 7.5, "y": 0}, + {"matrix": [0, 9], "x": 8.5, "y": 0}, + {"matrix": [0, 10], "x": 9.75, "y": 0}, + {"matrix": [0, 11], "x": 10.75, "y": 0}, + {"matrix": [0, 12], "x": 11.75, "y": 0}, + {"matrix": [0, 13], "x": 12.75, "y": 0}, + {"matrix": [0, 14], "x": 14, "y": 0}, + {"matrix": [0, 15], "x": 15.25, "y": 0}, + {"matrix": [1, 0], "x": 0, "y": 1}, + {"matrix": [1, 1], "x": 1, "y": 1}, + {"matrix": [1, 2], "x": 2, "y": 1}, + {"matrix": [1, 3], "x": 3, "y": 1}, + {"matrix": [1, 4], "x": 4, "y": 1}, + {"matrix": [1, 5], "x": 5, "y": 1}, + {"matrix": [1, 6], "x": 6, "y": 1}, + {"matrix": [1, 7], "x": 7, "y": 1}, + {"matrix": [1, 8], "x": 8, "y": 1}, + {"matrix": [1, 9], "x": 9, "y": 1}, + {"matrix": [1, 10], "x": 10, "y": 1}, + {"matrix": [1, 11], "x": 11, "y": 1}, + {"matrix": [1, 12], "x": 12, "y": 1}, + {"matrix": [1, 13], "x": 13, "y": 1, "w": 2}, + {"matrix": [1, 15], "x": 15.25, "y": 1}, + {"matrix": [2, 0], "x": 0, "y": 2, "w": 1.5}, + {"matrix": [2, 1], "x": 1.5, "y": 2}, + {"matrix": [2, 2], "x": 2.5, "y": 2}, + {"matrix": [2, 3], "x": 3.5, "y": 2}, + {"matrix": [2, 4], "x": 4.5, "y": 2}, + {"matrix": [2, 5], "x": 5.5, "y": 2}, + {"matrix": [2, 6], "x": 6.5, "y": 2}, + {"matrix": [2, 7], "x": 7.5, "y": 2}, + {"matrix": [2, 8], "x": 8.5, "y": 2}, + {"matrix": [2, 9], "x": 9.5, "y": 2}, + {"matrix": [2, 10], "x": 10.5, "y": 2}, + {"matrix": [2, 11], "x": 11.5, "y": 2}, + {"matrix": [2, 12], "x": 12.5, "y": 2}, + {"matrix": [2, 13], "x": 13.5, "y": 2, "w": 1.5}, + {"matrix": [2, 15], "x": 15.25, "y": 2}, + {"matrix": [3, 0], "x": 0, "y": 3, "w": 1.75}, + {"matrix": [3, 1], "x": 1.75, "y": 3}, + {"matrix": [3, 2], "x": 2.75, "y": 3}, + {"matrix": [3, 3], "x": 3.75, "y": 3}, + {"matrix": [3, 4], "x": 4.75, "y": 3}, + {"matrix": [3, 5], "x": 5.75, "y": 3}, + {"matrix": [3, 6], "x": 6.75, "y": 3}, + {"matrix": [3, 7], "x": 7.75, "y": 3}, + {"matrix": [3, 8], "x": 8.75, "y": 3}, + {"matrix": [3, 9], "x": 9.75, "y": 3}, + {"matrix": [3, 10], "x": 10.75, "y": 3}, + {"matrix": [3, 11], "x": 11.75, "y": 3}, + {"matrix": [3, 12], "x": 12.75, "y": 3, "w": 2.25}, + {"matrix": [3, 15], "x": 15.25, "y": 3}, + {"matrix": [4, 0], "x": 0, "y": 4, "w": 2.25}, + {"matrix": [4, 1], "x": 2.25, "y": 4}, + {"matrix": [4, 2], "x": 3.25, "y": 4}, + {"matrix": [4, 3], "x": 4.25, "y": 4}, + {"matrix": [4, 4], "x": 5.25, "y": 4}, + {"matrix": [4, 5], "x": 6.25, "y": 4}, + {"matrix": [4, 6], "x": 7.25, "y": 4}, + {"matrix": [4, 7], "x": 8.25, "y": 4}, + {"matrix": [4, 8], "x": 9.25, "y": 4}, + {"matrix": [4, 9], "x": 10.25, "y": 4}, + {"matrix": [4, 10], "x": 11.25, "y": 4}, + {"matrix": [4, 11], "x": 12.25, "y": 4, "w": 1.75}, + {"matrix": [4, 13], "x": 14.25, "y": 4.5}, + {"matrix": [4, 15], "x": 15.25, "y": 4.25}, + {"matrix": [5, 0], "x": 0, "y": 5, "w": 1.25}, + {"matrix": [5, 1], "x": 1.25, "y": 5, "w": 1.25}, + {"matrix": [5, 2], "x": 2.5, "y": 5, "w": 1.25}, + {"matrix": [5, 5], "x": 3.75, "y": 5, "w": 6.25}, + {"matrix": [5, 8], "x": 10, "y": 5}, + {"matrix": [5, 9], "x": 11, "y": 5}, + {"matrix": [5, 10], "x": 12, "y": 5}, + {"matrix": [5, 12], "x": 13.25, "y": 5.5}, + {"matrix": [5, 13], "x": 14.25, "y": 5.5}, + {"matrix": [5, 14], "x": 15.25, "y": 5.5} + ] + } + } +}
\ No newline at end of file diff --git a/keyboards/miiiw/blackio83/keymaps/default/keymap.c b/keyboards/miiiw/blackio83/keymaps/default/keymap.c new file mode 100644 index 0000000000..dc906f7e2c --- /dev/null +++ b/keyboards/miiiw/blackio83/keymaps/default/keymap.c @@ -0,0 +1,71 @@ +/* Copyright 2023 ArthurCyy <https://github.com/ArthurCyy> + * + * 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 + +// Defines names for use in layer keycodes and the keymap +enum keymap_layers { + WIN_BL, + WIN_FL, + MAC_BL, + MAC_FL, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap WIN_BL: Win Base Layer (Default Layer) + */ + [WIN_BL] = 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_DEL, KC_PSCR, + KC_GRV, 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_BSPC, KC_HOME, + 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_BSLS, KC_END, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FL), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Keymap WIN_FL: Win Function Layer + */ + [WIN_FL] = LAYOUT( + RGB_RST, KC_BRID, KC_BRIU, ALT_TAB, G(KC_D), KC_WBAK, KC_WSCH, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, QK_BOOT, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, _______, + _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_MOD + ), + + /* Keymap MAC_BL: Mac Base Layer + */ + [MAC_BL] = LAYOUT( + KC_ESC, KC_BRID, KC_BRIU,C(KC_UP),C(KC_DOWN),KC_F11,G(KC_SPC),KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_PSCR, + KC_GRV, 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_BSPC, KC_HOME, + 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_BSLS, KC_END, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FL), KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Keymap MAC_FL: Mac Function Layer + */ + [MAC_FL] = LAYOUT( + RGB_RST, 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_DEL, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, QK_BOOT, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, _______, + _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_MOD + ), +}; diff --git a/keyboards/miiiw/blackio83/keymaps/via/keymap.c b/keyboards/miiiw/blackio83/keymaps/via/keymap.c new file mode 100644 index 0000000000..dc906f7e2c --- /dev/null +++ b/keyboards/miiiw/blackio83/keymaps/via/keymap.c @@ -0,0 +1,71 @@ +/* Copyright 2023 ArthurCyy <https://github.com/ArthurCyy> + * + * 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 + +// Defines names for use in layer keycodes and the keymap +enum keymap_layers { + WIN_BL, + WIN_FL, + MAC_BL, + MAC_FL, +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap WIN_BL: Win Base Layer (Default Layer) + */ + [WIN_BL] = 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_DEL, KC_PSCR, + KC_GRV, 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_BSPC, KC_HOME, + 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_BSLS, KC_END, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FL), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Keymap WIN_FL: Win Function Layer + */ + [WIN_FL] = LAYOUT( + RGB_RST, KC_BRID, KC_BRIU, ALT_TAB, G(KC_D), KC_WBAK, KC_WSCH, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, QK_BOOT, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, _______, + _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_MOD + ), + + /* Keymap MAC_BL: Mac Base Layer + */ + [MAC_BL] = LAYOUT( + KC_ESC, KC_BRID, KC_BRIU,C(KC_UP),C(KC_DOWN),KC_F11,G(KC_SPC),KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, KC_PSCR, + KC_GRV, 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_BSPC, KC_HOME, + 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_BSLS, KC_END, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FL), KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* Keymap MAC_FL: Mac Function Layer + */ + [MAC_FL] = LAYOUT( + RGB_RST, 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_DEL, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, QK_BOOT, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, _______, + _______, _______, _______, _______, _______, _______, _______, RGB_RMOD, RGB_VAD, RGB_MOD + ), +}; diff --git a/keyboards/miiiw/blackio83/keymaps/via/rules.mk b/keyboards/miiiw/blackio83/keymaps/via/rules.mk new file mode 100644 index 0000000000..36b7ba9cbc --- /dev/null +++ b/keyboards/miiiw/blackio83/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +LTO_ENABLE = yes diff --git a/keyboards/miiiw/blackio83/matrix.c b/keyboards/miiiw/blackio83/matrix.c new file mode 100644 index 0000000000..841ff3c16e --- /dev/null +++ b/keyboards/miiiw/blackio83/matrix.c @@ -0,0 +1,139 @@ +/* Copyright 2023 ArthurCyy <https://github.com/ArthurCyy> + * + * 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" +#include "matrix.h" +#include "common/shift_register.h" + +static uint8_t read_rows(void); +static void init_cols(void); +static void select_col(uint8_t col); +static void unselect_col(uint8_t col); +static void unselect_cols(void); + +static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +#ifdef DIP_SWITCH_PINS +# define NUMBER_OF_DIP_SWITCHES (sizeof(dip_switch_pad) / sizeof(pin_t)) +static pin_t dip_switch_pad[] = DIP_SWITCH_PINS; +#endif + +void matrix_init_custom(void) { + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + setPinInputLow(row_pins[row]); + } + + shift_init(); + init_cols(); +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + bool changed = false; + + for (uint8_t col = 0; col < MATRIX_COLS; col++) { + select_col(col); + waitInputPinDelay(); + uint8_t rows = read_rows(); + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + bool prev_bit = ((uint32_t)(current_matrix[row]) & (matrix_row_t)(1UL << col)) ? 1 : 0; + bool curr_bit = ((uint32_t)rows & (uint32_t)(1UL << row)) ? 1 : 0; + if (prev_bit != curr_bit) { |