[Keyboard] Add MIIIW BlackIO83 (#21970)
* Add MIIIW BlackIO83 * Improve the code * Updated instructions for entering the bootloader * Update keyboards/miiiw/blackio83/rev_0100/config.h * Update keyboards/miiiw/blackio83/rev_0100/config.h * Update keyboards/miiiw/blackio83/config.h * Update config.h
This commit is contained in:
parent
509a2b40b7
commit
6dafcac713
|
@ -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;
|
||||
}
|
|
@ -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,
|
||||
};
|
|
@ -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
|
|
@ -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>
|
|
@ -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}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
),
|
||||
};
|
|
@ -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
|
||||
),
|
||||
};
|
|
@ -0,0 +1,2 @@
|
|||
VIA_ENABLE = yes
|
||||
LTO_ENABLE = yes
|
|
@ -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) {
|
||||
current_matrix[row] = (uint32_t)(current_matrix[row]) ^ (uint32_t)(1UL << col);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
unselect_col(col);
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
void matrix_power_up(void) {
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
palDisableLineEvent(row_pins[row]);
|
||||
setPinInputLow(row_pins[row]);
|
||||
}
|
||||
init_cols();
|
||||
#ifdef DIP_SWITCH_PINS
|
||||
for (uint8_t i = 1; i < NUMBER_OF_DIP_SWITCHES; i++) {
|
||||
setPinInputHigh(dip_switch_pad[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void matrix_power_down(void) {
|
||||
unselect_cols();
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
setPinInputLow(row_pins[row]);
|
||||
palEnableLineEvent(row_pins[row], PAL_EVENT_MODE_RISING_EDGE);
|
||||
}
|
||||
#ifdef DIP_SWITCH_PINS
|
||||
for (uint8_t i = 1; i < NUMBER_OF_DIP_SWITCHES; i++) {
|
||||
setPinInputLow(dip_switch_pad[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint8_t read_rows(void) {
|
||||
uint8_t row_value = 0;
|
||||
for(uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
row_value |= (readPin(row_pins[row]) << row);
|
||||
}
|
||||
return row_value;
|
||||
}
|
||||
|
||||
static void init_cols(void) {
|
||||
shift_writeAll(0);
|
||||
for(uint8_t col = 0; col < MATRIX_COLS; col++) {
|
||||
if(col_pins[col] < H0) {
|
||||
setPinOutput(col_pins[col]);
|
||||
writePinLow(col_pins[col]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void select_col(uint8_t col) {
|
||||
if(col_pins[col] < H0){
|
||||
writePinHigh(col_pins[col]);
|
||||
waitInputPinDelay();
|
||||
waitInputPinDelay();
|
||||
waitInputPinDelay();
|
||||
waitInputPinDelay();
|
||||
waitInputPinDelay();
|
||||
waitInputPinDelay();
|
||||
}else{
|
||||
shift_writePin(col_pins[col], 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void unselect_col(uint8_t col) {
|
||||
if(col_pins[col] < H0){
|
||||
writePinLow(col_pins[col]);
|
||||
}else{
|
||||
shift_writePin(col_pins[col], 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void unselect_cols(void) {
|
||||
shift_writeAll(1);
|
||||
for(uint8_t col = 0; col < MATRIX_COLS; col++) {
|
||||
if(col_pins[col] < H0) {
|
||||
setPinOutput(col_pins[col]);
|
||||
writePinHigh(col_pins[col]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/* 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/mcuconf.h -r platforms/chibios/GENERIC_STM32_F072XB/configs/mcuconf.h`
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_SERIAL_USE_USART1
|
||||
#define STM32_SERIAL_USE_USART1 TRUE
|
||||
|
||||
#undef STM32_I2C_USE_I2C1
|
||||
#define STM32_I2C_USE_I2C1 TRUE
|
||||
|
||||
#undef STM32_I2C_USE_DMA
|
||||
#define STM32_I2C_USE_DMA FALSE
|
|
@ -0,0 +1,30 @@
|
|||
# MIIIW BlackIO83
|
||||
|
||||
![BlackIO83](https://i.imgur.com/jZ7HrTCh.jpg)
|
||||
![BlackIO83](https://i.imgur.com/AnlUIfph.jpg)
|
||||
|
||||
A customizable 75% keyboard.
|
||||
|
||||
* Keyboard Maintainer: [ArthurCyy](https://github.com/ArthurCyy)
|
||||
* Hardware Supported: BlackIO83 rev_0100
|
||||
* Hardware Availability: [MIIIW](https://www.miiiw.com/)
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make miiiw/blackio83/rev_0100:default
|
||||
|
||||
Flashing example for this keyboard:
|
||||
|
||||
make miiiw/blackio83/rev_0100:default:flash
|
||||
|
||||
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
|
||||
|
||||
## Bootloader
|
||||
|
||||
Enter the bootloader in 3 ways:
|
||||
|
||||
* **Bootmagic reset**: With the power switch off, hold down the key at (0,0) in the matrix (Escape) and plug in the keyboard.
|
||||
* **Physical button**: With the power switch off, hold the small metal button on the right side under the spacebar keycap and plug in the keyboard.
|
||||
* **Keycode in layout**:
|
||||
* (Official firmware only) With the power switch on, press and hold the left Shift+ Fn+ upper right DEL.
|
||||
* (Unofficial firmware) With the power switch on, press the key mapped to `QK_BOOT` if it is available.
|
|
@ -0,0 +1,70 @@
|
|||
/* 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
|
||||
|
||||
/*
|
||||
* Keyboard Matrix Assignments
|
||||
*
|
||||
* Change this to how you wired your keyboard
|
||||
* COLS: AVR pins used for columns, left to right
|
||||
* ROWS: AVR pins used for rows, top to bottom
|
||||
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
|
||||
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
|
||||
*
|
||||
*/
|
||||
|
||||
/* Dip Switch */
|
||||
#define POWER_SWITCH_PIN B0
|
||||
#define DIP_SWITCH_PINS { B0, B1, B8, B12 }
|
||||
|
||||
/* 16 with dummy columns for shift registers */
|
||||
#define SHR_SERIES_NUM 2
|
||||
#define SHR_CLOCK_PIN A0
|
||||
#define SHR_DATA_PIN A1
|
||||
#define SHR_LATCH_PIN C15
|
||||
|
||||
/* MIIIW Protocol Driver */
|
||||
#define MWPROTO_BITRATE 256000
|
||||
#define MWPROTO_DRIVER SD1
|
||||
#define MWPROTO_TX_PIN A9
|
||||
#define MWPROTO_TX_PAL_MODE 1
|
||||
#define MWPROTO_RX_PIN A10
|
||||
#define MWPROTO_RX_PAL_MODE 1
|
||||
#define MWPROTO_WAKEUP_PIN A15
|
||||
#define MWPROTO_STATUS_PIN C13
|
||||
|
||||
/* RGB Matrix config */
|
||||
#define RGB_EN_PIN A8
|
||||
#define RGBLED_NUM 83
|
||||
#define RGB_MATRIX_LED_COUNT 83
|
||||
#define RGB_MATRIX_CENTER { 62, 42 }
|
||||
|
||||
// PWM RGB Underglow Defines
|
||||
#define WS2812_BYTE_ORDER WS2812_BYTE_ORDER_GRB
|
||||
#define WS2812_TRST_US 200
|
||||
|
||||
// I2C config
|
||||
#define I2C_DRIVER I2CD1
|
||||
#define I2C1_SCL_PIN B6
|
||||
#define I2C1_SDA_PIN B7
|
||||
#define I2C1_SCL_PAL_MODE 1
|
||||
#define I2C1_SDA_PAL_MODE 1
|
||||
#define I2C1_TIMINGR_PRESC 0x00U
|
||||
#define I2C1_TIMINGR_SCLDEL 0x03U
|
||||
#define I2C1_TIMINGR_SDADEL 0x01U
|
||||
#define I2C1_TIMINGR_SCLH 0x03U
|
||||
#define I2C1_TIMINGR_SCLL 0x09U
|
|
@ -0,0 +1,17 @@
|
|||
/* 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"
|
|
@ -0,0 +1,7 @@
|
|||
CUSTOM_MATRIX = lite
|
||||
|
||||
WS2812_DRIVER_REQUIRED := yes
|
||||
|
||||
# Project specific files
|
||||
SRC += matrix.c \
|
||||
common/shift_register.c
|
|
@ -0,0 +1,90 @@
|
|||
/* 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 "shift_register.h"
|
||||
|
||||
static void shift_out(void);
|
||||
|
||||
static uint8_t shift_values[SHR_SERIES_NUM] = {0};
|
||||
|
||||
void shift_init(void) {
|
||||
#ifdef SHR_OE_PIN
|
||||
setPinOutput(SHR_OE_PIN);
|
||||
writePinHigh(SHR_OE_PIN);
|
||||
#endif
|
||||
setPinOutput(SHR_DATA_PIN);
|
||||
setPinOutput(SHR_LATCH_PIN);
|
||||
setPinOutput(SHR_CLOCK_PIN);
|
||||
}
|
||||
|
||||
void shift_enable(void) {
|
||||
#ifdef SHR_OE_PIN
|
||||
writePinLow(SHR_OE_PIN);
|
||||
#endif
|
||||
writePinLow(SHR_DATA_PIN);
|
||||
writePinLow(SHR_LATCH_PIN);
|
||||
writePinLow(SHR_CLOCK_PIN);
|
||||
}
|
||||
|
||||
void shift_disable(void) {
|
||||
#ifdef SHR_OE_PIN
|
||||
writePinHigh(SHR_OE_PIN);
|
||||
#endif
|
||||
writePinLow(SHR_DATA_PIN);
|
||||
writePinLow(SHR_LATCH_PIN);
|
||||
writePinLow(SHR_CLOCK_PIN);
|
||||
}
|
||||
|
||||
void shift_writePin(pin_t pin, int level) {
|
||||
uint8_t group = (pin - H0) >> 3;
|
||||
uint8_t bit = 0x01 << ((pin - H0)&0x07);
|
||||
|
||||
if(group >= SHR_SERIES_NUM)
|
||||
return;
|
||||
|
||||
if(level)
|
||||
shift_values[group] |= bit;
|
||||
else
|
||||
shift_values[group] &= ~bit;
|
||||
shift_out();
|
||||
}
|
||||
|
||||
void shift_writeGroup(int group, uint8_t value) {
|
||||
if(group >= SHR_SERIES_NUM)
|
||||
return;
|
||||
|
||||
shift_values[group] = value;
|
||||
shift_out();
|
||||
}
|
||||
|
||||
void shift_writeAll(int level) {
|
||||
memset(shift_values, level ? 0xFF : 0, sizeof(shift_values));
|
||||
shift_out();
|
||||
}
|
||||
|
||||
static void shift_out(void) {
|
||||
uint8_t n = SHR_SERIES_NUM;
|
||||
writePinLow(SHR_LATCH_PIN);
|
||||
while(n--){
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
writePinLow(SHR_CLOCK_PIN);
|
||||
writePin(SHR_DATA_PIN, shift_values[n] & (0x80 >> i));
|
||||
writePinHigh(SHR_CLOCK_PIN);
|
||||
}
|
||||
}
|
||||
writePinHigh(SHR_LATCH_PIN);
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/* 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 "gpio.h"
|
||||
|
||||
#ifndef GPIOH_BASE
|
||||
# define GPIOH_BASE (0xFF595A00U)
|
||||
#endif
|
||||
|
||||
#ifndef SHR_SERIES_NUM
|
||||
# define SHR_SERIES_NUM 1
|
||||
#endif
|
||||
|
||||
extern void shift_init(void);
|
||||
extern void shift_enable(void);
|
||||
extern void shift_disable(void);
|
||||
extern void shift_writePin(pin_t pin, int level);
|
||||
extern void shift_writeGroup(int group, uint8_t value);
|
||||
extern void shift_writeAll(int level);
|
Loading…
Reference in New Issue