1d321ac7eb
into 1fa84ea83c
@ -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 "quantum.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(); | |||
} | |||
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); | |||
} | |||
bool shutdown_kb(bool jump_to_bootloader) { | |||
if (shutdown_user(jump_to_bootloader)) { | |||
#ifdef RGB_MATRIX_ENABLE | |||
rgb_matrix_set_suspend_state(true); | |||
#endif // RGB_MATRIX_ENABLE | |||
wait_ms(10); | |||
} | |||
ws2812_poweroff(); | |||
return true; | |||
} | |||
#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(true); | |||
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,20 @@ | |||
/* 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 |
@ -0,0 +1,14 @@ | |||
// Copyright 2024 QMK | |||
// SPDX-License-Identifier: GPL-2.0-or-later | |||
#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,297 @@ | |||
{ | |||
"manufacturer": "MIIIW", | |||
"keyboard_name": "MIIIW BlackIO 98", | |||
"maintainer": "ArthurCyy", | |||
"bootloader": "stm32-dfu", | |||
"debounce": 3, | |||
"diode_direction": "COL2ROW", | |||
"features": { | |||
"bootmagic": true, | |||
"command": false, | |||
"console": false, | |||
"deferred_exec": true, | |||
"dip_switch": true, | |||
"extrakey": true, | |||
"mousekey": true, | |||
"nkro": true, | |||
"rgb_matrix": true | |||
}, | |||
"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", "B3", "B4"], | |||
"rows": ["A7", "A6", "A5", "A4", "A3", "A2"] | |||
}, | |||
"dip_switch": { | |||
"pins": ["B0", "B1", "B8", "B12"] | |||
}, | |||
"processor": "STM32F072", | |||
"rgb_matrix": { | |||
"animations": { | |||
"band_pinwheel_sat": true, | |||
"band_pinwheel_val": true, | |||
"band_sat": true, | |||
"band_spiral_sat": true, | |||
"band_spiral_val": true, | |||
"band_val": true, | |||
"breathing": true, | |||
"cycle_all": true, | |||
"cycle_left_right": true, | |||
"cycle_out_in": true, | |||
"cycle_out_in_dual": true, | |||
"cycle_pinwheel": true, | |||
"cycle_spiral": true, | |||
"cycle_up_down": true, | |||
"digital_rain": true, | |||
"dual_beacon": true, | |||
"gradient_left_right": true, | |||
"gradient_up_down": true, | |||
"hue_breathing": true, | |||
"hue_pendulum": true, | |||
"hue_wave": true, | |||
"jellybean_raindrops": true, | |||
"multisplash": true, | |||
"pixel_flow": true, | |||
"pixel_fractal": true, | |||
"pixel_rain": true, | |||
"rainbow_beacon": true, | |||
"rainbow_moving_chevron": true, | |||
"rainbow_pinwheels": true, | |||
"raindrops": true, | |||
"solid_multisplash": true, | |||
"solid_reactive": true, | |||
"solid_reactive_cross": true, | |||
"solid_reactive_multicross": true, | |||
"solid_reactive_multinexus": true, | |||
"solid_reactive_multiwide": true, | |||
"solid_reactive_nexus": true, | |||
"solid_reactive_simple": true, | |||
"solid_reactive_wide": true, | |||
"solid_splash": true, | |||
"splash": true, | |||
"typing_heatmap": true | |||
}, | |||
"center_point": [74, 42], | |||
"default": { | |||
"animation": "solid_color" | |||
}, | |||
"driver": "ws2812", | |||
"layout": [ | |||
{"matrix": [0, 0], "x": 0, "y": 0, "flags": 4}, | |||
{"matrix": [0, 2], "x": 16, "y": 0, "flags": 4}, | |||
{"matrix": [0, 3], "x": 24, "y": 0, "flags": 4}, | |||
{"matrix": [0, 4], "x": 32, "y": 0, "flags": 4}, | |||
{"matrix": [0, 5], "x": 40, "y": 0, "flags": 4}, | |||
{"matrix": [0, 6], "x": 52, "y": 0, "flags": 4}, | |||
{"matrix": [0, 7], "x": 60, "y": 0, "flags": 4}, | |||
{"matrix": [0, 8], "x": 68, "y": 0, "flags": 4}, | |||
{"matrix": [0, 9], "x": 76, "y": 0, "flags": 4}, | |||
{"matrix": [0, 10], "x": 88, "y": 0, "flags": 4}, | |||
{"matrix": [0, 11], "x": 96, "y": 0, "flags": 4}, | |||
{"matrix": [0, 12], "x": 104, "y": 0, "flags": 4}, | |||
{"matrix": [0, 13], "x": 112, "y": 0, "flags": 4}, | |||
{"matrix": [0, 14], "x": 124, "y": 0, "flags": 4}, | |||
{"matrix": [0, 15], "x": 132, "y": 0, "flags": 4}, | |||
{"matrix": [0, 16], "x": 140, "y": 0, "flags": 4}, | |||
{"matrix": [0, 17], "x": 148, "y": 0, "flags": 4}, | |||
{"matrix": [1, 17], "x": 148, "y": 20, "flags": 4}, | |||
{"matrix": [1, 16], "x": 140, "y": 20, "flags": 4}, | |||
{"matrix": [1, 15], "x": 132, "y": 20, "flags": 4}, | |||
{"matrix": [1, 14], "x": 124, "y": 20, "flags": 4}, | |||
{"matrix": [1, 13], "x": 108, "y": 20, "flags": 4}, | |||
{"matrix": [1, 12], "x": 96, "y": 20, "flags": 4}, | |||
{"matrix": [1, 11], "x": 88, "y": 20, "flags": 4}, | |||
{"matrix": [1, 10], "x": 80, "y": 20, "flags": 4}, | |||
{"matrix": [1, 9], "x": 72, "y": 20, "flags": 4}, | |||
{"matrix": [1, 8], "x": 64, "y": 20, "flags": 4}, | |||
{"matrix": [1, 7], "x": 56, "y": 20, "flags": 4}, | |||
{"matrix": [1, 6], "x": 48, "y": 20, "flags": 4}, | |||
{"matrix": [1, 5], "x": 40, "y": 20, "flags": 4}, | |||
{"matrix": [1, 4], "x": 32, "y": 20, "flags": 4}, | |||
{"matrix": [1, 3], "x": 24, "y": 20, "flags": 4}, | |||
{"matrix": [1, 2], "x": 16, "y": 20, "flags": 4}, | |||
{"matrix": [1, 1], "x": 8, "y": 20, "flags": 4}, | |||
{"matrix": [1, 0], "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, 14], "x": 124, "y": 36, "flags": 4}, | |||
{"matrix": [2, 15], "x": 132, "y": 36, "flags": 4}, | |||
{"matrix": [2, 16], "x": 140, "y": 36, "flags": 4}, | |||
{"matrix": [3, 17], "x": 148, "y": 44, "flags": 4}, | |||
{"matrix": [3, 16], "x": 140, "y": 52, "flags": 4}, | |||
{"matrix": [3, 15], "x": 132, "y": 52, "flags": 4}, | |||
{"matrix": [3, 14], "x": 124, "y": 52, "flags": 4}, | |||
{"matrix": [3, 12], "x": 107, "y": 52, "flags": 4}, | |||
{"matrix": [3, 11], "x": 94, "y": 52, "flags": 4}, | |||
{"matrix": [3, 10], "x": 86, "y": 52, "flags": 4}, | |||
{"matrix": [3, 9], "x": 78, "y": 52, "flags": 4}, | |||
{"matrix": [3, 8], "x": 70, "y": 52, "flags": 4}, | |||
{"matrix": [3, 7], "x": 62, "y": 52, "flags": 4}, | |||
{"matrix": [3, 6], "x": 54, "y": 52, "flags": 4}, | |||
{"matrix": [3, 5], "x": 46, "y": 52, "flags": 4}, | |||
{"matrix": [3, 4], "x": 38, "y": 52, "flags": 4}, | |||
{"matrix": [3, 3], "x": 30, "y": 52, "flags": 4}, | |||
{"matrix": [3, 2], "x": 22, "y": 52, "flags": 4}, | |||
{"matrix": [3, 1], "x": 14, "y": 52, "flags": 4}, | |||
{"matrix": [3, 0], "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, 12], "x": 114, "y": 68, "flags": 4}, | |||
{"matrix": [4, 14], "x": 124, "y": 68, "flags": 4}, | |||
{"matrix": [4, 15], "x": 132, "y": 68, "flags": 4}, | |||
{"matrix": [4, 16], "x": 140, "y": 68, "flags": 4}, | |||
{"matrix": [5, 17], "x": 148, "y": 76, "flags": 4}, | |||
{"matrix": [5, 16], "x": 140, "y": 84, "flags": 4}, | |||
{"matrix": [5, 15], "x": 132, "y": 84, "flags": 4}, | |||
{"matrix": [5, 13], "x": 122, "y": 88, "flags": 4}, | |||
{"matrix": [5, 12], "x": 114, "y": 88, "flags": 4}, | |||
{"matrix": [5, 11], "x": 106, "y": 88, "flags": 4}, | |||
{"matrix": [5, 10], "x": 96, "y": 84, "flags": 4}, | |||
{"matrix": [5, 9], "x": 88, "y": 84, "flags": 4}, | |||
{"matrix": [5, 8], "x": 80, "y": 84, "flags": 4}, | |||
{"matrix": [5, 5], "x": 50, "y": 84, "flags": 4}, | |||
{"matrix": [5, 2], "x": 20, "y": 84, "flags": 4}, | |||
{"matrix": [5, 1], "x": 10, "y": 84, "flags": 4}, | |||
{"matrix": [5, 0], "x": 1, "y": 84, "flags": 4} | |||
], | |||
"max_brightness": 160 | |||
}, | |||
"url": "https://github.com/ArthurCyy", | |||
"usb": { | |||
"device_version": "0.0.1", | |||
"force_nkro": true, | |||
"pid": "0x98A1", | |||
"vid": "0x3044" | |||
}, | |||
"ws2812": { | |||
"pin": "B15" | |||
}, | |||
"layouts": { | |||
"LAYOUT": { | |||
"layout": [ | |||
{"matrix": [0, 0], "x": 0, "y": 0}, | |||
{"matrix": [0, 2], "x": 2, "y": 0}, | |||
{"matrix": [0, 3], "x": 3, "y": 0}, | |||
{"matrix": [0, 4], "x": 4, "y": 0}, | |||
{"matrix": [0, 5], "x": 5, "y": 0}, | |||
{"matrix": [0, 6], "x": 6.5, "y": 0}, | |||
{"matrix": [0, 7], "x": 7.5, "y": 0}, | |||
{"matrix": [0, 8], "x": 8.5, "y": 0}, | |||
{"matrix": [0, 9], "x": 9.5, "y": 0}, | |||
{"matrix": [0, 10], "x": 11, "y": 0}, | |||
{"matrix": [0, 11], "x": 12, "y": 0}, | |||
{"matrix": [0, 12], "x": 13, "y": 0}, | |||
{"matrix": [0, 13], "x": 14, "y": 0}, | |||
{"matrix": [0, 14], "x": 15.5, "y": 0}, | |||
{"matrix": [0, 15], "x": 16.5, "y": 0}, | |||
{"matrix": [0, 16], "x": 17.5, "y": 0}, | |||
{"matrix": [0, 17], "x": 18.5, "y": 0}, | |||
{"matrix": [1, 0], "x": 0, "y": 1.5}, | |||
{"matrix": [1, 1], "x": 1, "y": 1.5}, | |||
{"matrix": [1, 2], "x": 2, "y": 1.5}, | |||
{"matrix": [1, 3], "x": 3, "y": 1.5}, | |||
{"matrix": [1, 4], "x": 4, "y": 1.5}, | |||
{"matrix": [1, 5], "x": 5, "y": 1.5}, | |||
{"matrix": [1, 6], "x": 6, "y": 1.5}, | |||
{"matrix": [1, 7], "x": 7, "y": 1.5}, | |||
{"matrix": [1, 8], "x": 8, "y": 1.5}, | |||
{"matrix": [1, 9], "x": 9, "y": 1.5}, | |||
{"matrix": [1, 10], "x": 10, "y": 1.5}, | |||
{"matrix": [1, 11], "x": 11, "y": 1.5}, | |||
{"matrix": [1, 12], "x": 12, "y": 1.5}, | |||
{"matrix": [1, 13],"x": 13, "y": 1.5, "w": 2}, | |||
{"matrix": [1, 14], "x": 15.5, "y": 1.5}, | |||
{"matrix": [1, 15], "x": 16.5, "y": 1.5}, | |||
{"matrix": [1, 16], "x": 17.5, "y": 1.5}, | |||
{"matrix": [1, 17], "x": 18.5, "y": 1.5}, | |||
{"matrix": [2, 0], "x": 0, "y": 2.5, "w": 1.5}, | |||
{"matrix": [2, 1], "x": 1.5, "y": 2.5}, | |||
{"matrix": [2, 2], "x": 2.5, "y": 2.5}, | |||
{"matrix": [2, 3], "x": 3.5, "y": 2.5}, | |||
{"matrix": [2, 4], "x": 4.5, "y": 2.5}, | |||
{"matrix": [2, 5], "x": 5.5, "y": 2.5}, | |||
{"matrix": [2, 6], "x": 6.5, "y": 2.5}, | |||
{"matrix": [2, 7], "x": 7.5, "y": 2.5}, | |||
{"matrix": [2, 8], "x": 8.5, "y": 2.5}, | |||
{"matrix": [2, 9], "x": 9.5, "y": 2.5}, | |||
{"matrix": [2, 10], "x": 10.5, "y": 2.5}, | |||
{"matrix": [2, 11], "x": 11.5, "y": 2.5}, | |||
{"matrix": [2, 12], "x": 12.5, "y": 2.5}, | |||
{"matrix": [2, 13], "x": 13.5, "y": 2.5, "w": 1.5}, | |||
{"matrix": [2, 14], "x": 15.5, "y": 2.5}, | |||
{"matrix": [2, 15], "x": 16.5, "y": 2.5}, | |||
{"matrix": [2, 16], "x": 17.5, "y": 2.5}, | |||
{"matrix": [3, 0], "x": 0, "y": 3.5, "w": 1.75}, | |||
{"matrix": [3, 1], "x": 1.75, "y": 3.5}, | |||
{"matrix": [3, 2], "x": 2.75, "y": 3.5}, | |||
{"matrix": [3, 3], "x": 3.75, "y": 3.5}, | |||
{"matrix": [3, 4], "x": 4.75, "y": 3.5}, | |||
{"matrix": [3, 5], "x": 5.75, "y": 3.5}, | |||
{"matrix": [3, 6], "x": 6.75, "y": 3.5}, | |||
{"matrix": [3, 7], "x": 7.75, "y": 3.5}, | |||
{"matrix": [3, 8], "x": 8.75, "y": 3.5}, | |||
{"matrix": [3, 9], "x": 9.75, "y": 3.5}, | |||
{"matrix": [3, 10], "x": 10.75, "y": 3.5}, | |||
{"matrix": [3, 11], "x": 11.75, "y": 3.5}, | |||
{"matrix": [3, 12], "x": 12.75, "y": 3.5, "w": 2.25}, | |||
{"matrix": [3, 14], "x": 15.5, "y": 3.5}, | |||
{"matrix": [3, 15], "x": 16.5, "y": 3.5}, | |||
{"matrix": [3, 16], "x": 17.5, "y": 3.5}, | |||
{"matrix": [3, 17], "x": 18.5, "y": 2.5, "h": 2}, | |||
{"matrix": [4, 0], "x": 0, "y": 4.5, "w": 2.25}, | |||
{"matrix": [4, 1], "x": 2.25, "y": 4.5}, | |||
{"matrix": [4, 2], "x": 3.25, "y": 4.5}, | |||
{"matrix": [4, 3], "x": 4.25, "y": 4.5}, | |||
{"matrix": [4, 4], "x": 5.25, "y": 4.5}, | |||
{"matrix": [4, 5], "x": 6.25, "y": 4.5}, | |||
{"matrix": [4, 6], "x": 7.25, "y": 4.5}, | |||
{"matrix": [4, 7], "x": 8.25, "y": 4.5}, | |||
{"matrix": [4, 8], "x": 9.25, "y": 4.5}, | |||
{"matrix": [4, 9], "x": 10.25, "y": 4.5}, | |||
{"matrix": [4, 10], "x": 11.25, "y": 4.5}, | |||
{"matrix": [4, 11], "x": 12.25, "y": 4.5, "w": 1.75}, | |||
{"matrix": [4, 12], "x": 14.25, "y": 4.75}, | |||
{"matrix": [4, 14], "x": 15.5, "y": 4.5}, | |||
{"matrix": [4, 15], "x": 16.5, "y": 4.5}, | |||
{"matrix": [4, 16], "x": 17.5, "y": 4.5}, | |||
{"matrix": [5, 0], "x": 0, "y": 5.5, "w": 1.25}, | |||
{"matrix": [5, 1], "x": 1.25, "y": 5.5, "w": 1.25}, | |||
{"matrix": [5, 2], "x": 2.5, "y": 5.5, "w": 1.25}, | |||
{"matrix": [5, 5], "x": 3.75, "y": 5.5, "w": 6.25}, | |||
{"matrix": [5, 8], "x": 10, "y": 5.5}, | |||
{"matrix": [5, 9], "x": 11, "y": 5.5}, | |||
{"matrix": [5, 10], "x": 12, "y": 5.5}, | |||
{"matrix": [5, 11], "x": 13.25, "y": 5.75}, | |||
{"matrix": [5, 12], "x": 14.25, "y": 5.75}, | |||
{"matrix": [5, 13], "x": 15.25, "y": 5.75}, | |||
{"matrix": [5, 15], "x": 16.5, "y": 5.5}, | |||
{"matrix": [5, 16], "x": 17.5, "y": 5.5}, | |||
{"matrix": [5, 17], "x": 18.5, "y": 4.5, "h": 2} | |||
] | |||
} | |||
} | |||
} |
@ -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_INS, KC_PGUP, KC_PGDN, | |||
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_NUM, KC_PSLS, KC_PAST, KC_PMNS, | |||
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_P7, KC_P8, KC_P9, | |||
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_P4, KC_P5, KC_P6, KC_PPLS, | |||
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_P1, KC_P2, KC_P3, | |||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FL), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT | |||
), | |||
/* Keymap WIN_FL: Win Function Layer | |||
*/ | |||
[WIN_FL] = LAYOUT( | |||
_______, KC_BRID, KC_BRIU, _______, G(KC_D), KC_WBAK, KC_WSCH, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, KC_PSCR, KC_HOME, KC_END, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 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_INS, KC_PGUP, KC_PGDN, | |||
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_NUM, KC_PSLS, KC_PAST, KC_PMNS, | |||
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_P7, KC_P8, KC_P9, | |||
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_P4, KC_P5, KC_P6, KC_PPLS, | |||
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_P1, KC_P2, KC_P3, | |||
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FL), KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT | |||
), | |||
/* Keymap MAC_FL: Mac Function Layer | |||
*/ | |||
[MAC_FL] = LAYOUT( | |||
_______, 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_PSCR, KC_HOME, KC_END, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 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_INS, KC_PGUP, KC_PGDN, | |||
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_NUM, KC_PSLS, KC_PAST, KC_PMNS, | |||
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_P7, KC_P8, KC_P9, | |||
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_P4, KC_P5, KC_P6, KC_PPLS, | |||
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_P1, KC_P2, KC_P3, | |||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(WIN_FL), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT | |||
), | |||
/* Keymap WIN_FL: Win Function Layer | |||
*/ | |||
[WIN_FL] = LAYOUT( | |||
_______, KC_BRID, KC_BRIU, _______, G(KC_D), KC_WBAK, KC_WSCH, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, KC_PSCR, KC_HOME, KC_END, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 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_INS, KC_PGUP, KC_PGDN, | |||
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_NUM, KC_PSLS, KC_PAST, KC_PMNS, | |||
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_P7, KC_P8, KC_P9, | |||
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_P4, KC_P5, KC_P6, KC_PPLS, | |||
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_P1, KC_P2, KC_P3, | |||
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, MO(MAC_FL), KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT | |||
), | |||
/* Keymap MAC_FL: Mac Function Layer | |||
*/ | |||
[MAC_FL] = LAYOUT( | |||
_______, 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_PSCR, KC_HOME, KC_END, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 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 "matrix.h" | |||
#include "wait.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 BlackIO98 | |||
![BlackIO98](https://i.imgur.com/XY3AahE.jpg) | |||
![BlackIO98](https://i.imgur.com/WlWAeC9.jpg) | |||
A customizable 98-keys keyboard. | |||
* Keyboard Maintainer: [ArthurCyy](https://github.com/ArthurCyy) | |||
* Hardware Supported: BlackIO98 rev_0100 | |||
* Hardware Availability: [MIIIW](https://www.miiiw.com/) | |||
Make example for this keyboard (after setting up your build environment): | |||
make miiiw/blackio98/rev_0100:default | |||
Flashing example for this keyboard: | |||
make miiiw/blackio98/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,54 @@ | |||
/* 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 | |||
#define POWER_SWITCH_PIN B0 | |||
/* 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 | |||
// 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,7 @@ | |||
CUSTOM_MATRIX = lite | |||
WS2812_DRIVER_REQUIRED := yes | |||
# Project specific files | |||
SRC += matrix.c \ | |||
common/shift_register.c |