409350800b
into de4d28cd60
@ -0,0 +1,339 @@ | |||
/* Copyright 2024 albert-zheng | |||
* | |||
* 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 "uart.h" | |||
#include "keyboard.h" | |||
#include "analog.h" | |||
#include "print.h" | |||
#include "usb_main.h" | |||
#include "usb_util.h" | |||
#include "usb_driver.h" | |||
#include "os_detection.h" | |||
#include "albert_smart84.h" | |||
#define LED1 A9 | |||
#define LED2 A10 | |||
#define LED_EN A15 | |||
#define LOOP_10HZ_PERIOD 100 | |||
deferred_token loop10hz_token = INVALID_DEFERRED_TOKEN; | |||
uint32_t loop_10Hz(uint32_t trigger_time, void *cb_arg); | |||
uint8_t blink_period = 5; | |||
uint8_t blink_count = 0; | |||
uint8_t blink_time = 0; | |||
uint8_t reset_buff = 0; | |||
static uint8_t reset_flag = 0; | |||
static uint32_t reset_press_timer = 0; | |||
uint8_t lock_win=0; | |||
uint8_t change_mac = 0; | |||
bool win_lock = 0; | |||
static uint8_t default_layer; | |||
/* 用于记忆现在在那个层 */ | |||
layer_state_t default_layer_state_set_kb(layer_state_t state){ | |||
default_layer = state; | |||
return default_layer_state_set_user(state); | |||
} | |||
/* MAC&WINDOWS切换 */ | |||
uint8_t mac_flag = 2; | |||
void get_mac_win(void){ | |||
if(readPin(B14)){ | |||
mac_flag = 3; | |||
if (default_layer != 1){ | |||
set_single_persistent_default_layer(0); | |||
} | |||
} | |||
else{ | |||
mac_flag = 2; | |||
if(default_layer != 4){ | |||
change_mac = 1; | |||
set_single_persistent_default_layer(2); | |||
} | |||
} | |||
} | |||
/* 休眠 */ | |||
uint8_t sleep = 0; | |||
bool usb_suspend_flag = false; | |||
static uint32_t usb_suspend_time; | |||
static void POWER_EnterSleep(void) { | |||
sleep = 5; | |||
setPinInput(LED1); | |||
setPinInput(LED2); | |||
setPinInput(LED_EN); | |||
cancel_deferred_exec(loop10hz_token); | |||
#if (DIODE_DIRECTION == ROW2COL) | |||
pin_t col_pins[] = MATRIX_COL_PINS; | |||
for(uint8_t x=0; x<MATRIX_COLS; x++){ | |||
pin_t pin; | |||
pin = col_pins[x]; | |||
if (pin != NO_PIN){ | |||
setPinOutput(pin); | |||
writePinLow(pin); | |||
} | |||
} | |||
const long unsigned int row_pins[] = MATRIX_ROW_PINS; | |||
for(uint8_t x=0; x<MATRIX_ROWS; x++){ | |||
pin_t pin; | |||
pin = row_pins[x]; | |||
if (pin != NO_PIN){ | |||
setPinInputHigh(pin); | |||
palEnableLineEvent(pin, PAL_EVENT_MODE_BOTH_EDGES); | |||
} | |||
} | |||
#else | |||
const long unsigned int row_pins[] = MATRIX_ROW_PINS; | |||
for(uint8_t x=0; x<MATRIX_ROWS; x++){ | |||
pin_t pin; | |||
pin = row_pins[x]; | |||
if (pin != NO_PIN){ | |||
setPinOutput(pin); | |||
writePinLow(pin); | |||
} | |||
} | |||
const long unsigned int col_pins[] = MATRIX_COL_PINS; | |||
for(uint8_t x=0; x<MATRIX_COLS; x++){ | |||
pin_t pin; | |||
pin = col_pins[x]; | |||
setPinInputHigh(pin); | |||
palEnableLineEvent(pin, PAL_EVENT_MODE_BOTH_EDGES); | |||
} | |||
#endif | |||
/* going to anabiosis*/ | |||
//chSysLock(); | |||
/* Clear Wake-up flag */ | |||
palEnableLineEvent(A6, PAL_EVENT_MODE_BOTH_EDGES); | |||
palEnableLineEvent(B14, PAL_EVENT_MODE_BOTH_EDGES); | |||
_pal_lld_enablepadevent(0,18,PAL_EVENT_MODE_BOTH_EDGES); | |||
PWR->CR |= PWR_CR_CWUF | PWR_CR_CSBF; | |||
/* Select Sleep mode */ | |||
//PWR->CR |= PWR_CR_PDDS | PWR_CR_LPDS; // Can NOT wake up | |||
/* Set SLEEPDEEP bit of Cortex System Control Register */ | |||
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; | |||
/* Request Wait For Interrupt */ | |||
__WFI(); | |||
EXTI->IMR &= ~(1<<18); | |||
EXTI->EMR &= ~(1<<18); | |||
EXTI->RTSR &= ~(1<<18); | |||
EXTI->FTSR &= ~(1<<18); | |||
EXTI->PR = 1<<18; | |||
/* Reset SLEEPDEEP bit of Cortex System Control Register */ | |||
SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk; | |||
stm32_clock_init(); | |||
matrix_init(); | |||
usbWakeupHost(&USB_DRIVER); //解决休眠无法唤醒的问题 | |||
restart_usb_driver(&USB_DRIVER); | |||
setPinOutput(LED1); | |||
setPinOutput(LED2); | |||
setPinOutput(LED_EN); | |||
loop10hz_token = defer_exec(LOOP_10HZ_PERIOD, loop_10Hz, NULL); | |||
} | |||
uint8_t sleep_flag = 0; | |||
void sleep_mode(void){ | |||
if(usb_suspend_flag == true){ | |||
if(timer_elapsed32(usb_suspend_time) > 500){ | |||
POWER_EnterSleep(); | |||
usb_suspend_flag = false; | |||
} | |||
} | |||
if(USB_DRIVER.state == USB_SUSPENDED){ | |||
if(sleep_flag == 1){ | |||
usb_suspend_time = timer_read32(); | |||
sleep_flag = 0; | |||
usb_suspend_flag = true; | |||
} | |||
} | |||
if(USB_DRIVER.state == USB_ACTIVE){ | |||
// usb_suspend_flag = false; | |||
sleep_flag = 1; | |||
} | |||
else{ | |||
sleep_flag = 2; | |||
} | |||
} | |||
void keyboard_pre_init_kb(void) { | |||
setPinInputLow(A9); | |||
setPinInputLow(A10); | |||
setPinInput(LED_EN); | |||
setPinInputHigh(A7); | |||
setPinInputHigh(A6); | |||
} | |||
void keyboard_post_init_kb(void) { | |||
AFIO->MAPR = (AFIO->MAPR & ~AFIO_MAPR_SWJ_CFG_Msk); | |||
AFIO->MAPR|= AFIO_MAPR_SWJ_CFG_DISABLE; | |||
setPinOutput(LED1); | |||
setPinOutput(LED2); | |||
setPinOutput(LED_EN); | |||
writePinLow(LED_EN); | |||
writePinLow(LED1); | |||
writePinLow(LED2); | |||
setPinInputHigh(B14); | |||
lock_win = dynamic_keymap_get_keycode(0,6,3); | |||
loop10hz_token = defer_exec(LOOP_10HZ_PERIOD, loop_10Hz, NULL); | |||
} | |||
uint32_t loop_10Hz(uint32_t trigger_time, void *cb_arg){ | |||
sleep_mode(); | |||
get_mac_win(); | |||
blink_count = (blink_count+1) % (blink_period*2); | |||
if(default_layer == 4)keymap_config.no_gui=false; | |||
if(blink_count == 0){ | |||
if(sleep>0){ | |||
if(USB_DRIVER.state == USB_ACTIVE){ | |||
sleep--; | |||
report_keyboard_t send_report; | |||
memset(&send_report, 0, sizeof(report_keyboard_t)); | |||
host_keyboard_send(&send_report); | |||
} | |||
} | |||
if(blink_time > 0){ | |||
blink_time--; | |||
} | |||
} | |||
/* LOCK WIN */ | |||
if((host_keyboard_leds() & 0x2)==0x2 && reset_buff == 0){ | |||
setPinOutput(LED_EN); | |||
writePinHigh(LED1); | |||
} | |||
else{ | |||
writePinLow(LED1); | |||
} | |||
/* scroll锁上时,亮白灯 */ | |||
if((host_keyboard_leds() & 0x4)==0x4 && reset_buff == 0){ | |||
setPinOutput(LED_EN); | |||
writePinHigh(LED2); | |||
} | |||
else{ | |||
writePinLow(LED2); | |||
} | |||
if (timer_elapsed32(reset_press_timer) > 3000){ | |||
if(reset_flag == 1){ | |||
blink_time = 3; | |||
reset_flag = 0; | |||
blink_count = 0; | |||
writePinLow(LED1); | |||
writePinLow(LED2); | |||
blink_period = 2; | |||
} | |||
if(blink_time > 0){ | |||
if(reset_buff == 0){ | |||
reset_buff = 1; | |||
} | |||
if (blink_count<blink_period){ | |||
writePinLow(LED1); | |||
writePinLow(LED2); | |||
} | |||
else{ | |||
writePinHigh(LED1); | |||
writePinHigh(LED2); | |||
} | |||
} | |||
else{ | |||
if(reset_buff ==1){ | |||
reset_buff = 0; | |||
win_lock = 0; | |||
lock_win = win_lock; | |||
dynamic_keymap_set_keycode(0, 6, 3, lock_win); | |||
eeconfig_init(); | |||
mcu_reset(); | |||
} | |||
} | |||
} | |||
return LOOP_10HZ_PERIOD; | |||
} | |||
bool process_record_kb(uint16_t keycode, keyrecord_t* record) { | |||
/* 恢复出厂设置 */ | |||
if(keycode == KC_RESET){ | |||
if (record->event.pressed){ | |||
reset_press_timer=timer_read32(); | |||
reset_flag = 1; | |||
} | |||
else{ | |||
if(timer_elapsed32(reset_press_timer) < 3000){ | |||
reset_flag = 0; | |||
} | |||
} | |||
} | |||
if(keycode == GU_TOG){ | |||
if(record->event.pressed){ | |||
win_lock = !win_lock; | |||
if(win_lock) lock_win = 2; | |||
else lock_win = 0; | |||
dynamic_keymap_set_keycode(0,6,3,lock_win); | |||
} | |||
} | |||
if(keycode == KC_LGUI){ | |||
if(record->event.pressed){ | |||
if((win_lock || lock_win== 2) && mac_flag == 3){ | |||
win_lock = 1; | |||
return false; | |||
} | |||
else{ | |||
return true; | |||
} | |||
} | |||
} | |||
return process_record_user(keycode, record); | |||
} | |||
@ -0,0 +1,27 @@ | |||
/* Copyright 2024 albet-zheng | |||
* | |||
* 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" | |||
enum custom_keycodes { | |||
KC_USB = QK_KB_0, | |||
KC_MAC, | |||
KC_WIN, | |||
KC_RESET, | |||
GU_TOG | |||
}; |
@ -0,0 +1,35 @@ | |||
/* Copyright 2024 albert-zheng | |||
* | |||
* 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 RGB_MATRIX_KEYPRESSES // reacts to keypresses | |||
#define RGB_MATRIX_SOLID_REACTIVE_GRADIENT_MODE | |||
/* UART Config */ | |||
#define SERIAL_DRIVER SD1 | |||
#define SD1_TX_PAL_MODE PAL_MODE_ALTERNATE_OPENDRAIN | |||
/*DEBUG CONFIG*/ | |||
#define DEBUG_MATRIX_SCAN_RATE | |||
#define MOUSEKEY_INTERVAL 5 | |||
#define WEAR_LEVELING_LOGICAL_SIZE 4096 | |||
#define WEAR_LEVELING_BACKING_SIZE (WEAR_LEVELING_LOGICAL_SIZE * 2) | |||
@ -0,0 +1,30 @@ | |||
/* Copyright 2024 albert-zheng | |||
* | |||
* 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 HAL_USE_SPI TRUE | |||
#define SPI_USE_WAIT TRUE | |||
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD | |||
#define HAL_USE_ADC TRUE | |||
/* This enables interrupt-driven mode */ | |||
#define PAL_USE_WAIT TRUE | |||
#define USB_USE_WAIT TRUE | |||
#define HAL_USE_SERIAL TRUE | |||
#include_next <halconf.h> |
@ -0,0 +1,154 @@ | |||
{ | |||
"keyboard_name": "smart84", | |||
"usb": { | |||
"pid": "0x0084", | |||
"device_version": "1.0.0", | |||
"wait_for": false, | |||
"no_startup_check": true | |||
}, | |||
"diode_direction": "ROW2COL", | |||
"matrix_pins": { | |||
"cols": ["B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9", "B10", "B11", "B12", "B13"], | |||
"rows": ["A0", "A1", "A2", "A3", "A4","A5","A8"] | |||
}, | |||
"features": { | |||
"bootmagic": true, | |||
"command": false, | |||
"console": true, | |||
"deferred_exec":true, | |||
"extrakey": true, | |||
"mousekey": true, | |||
"nkro": true, | |||
"rgblight": false, | |||
"rgb_matrix":false | |||
}, | |||
"rgb_matrix":{ | |||
"animations":{ | |||
"solid_color":true | |||
}, | |||
"driver":"aw20216s", | |||
"sleep":true, | |||
"timeout":0, | |||
"layout":[ | |||
{"flags": 2, "x":0, "y":0}, | |||
{"flags": 2, "x":0, "y":1} | |||
] | |||
}, | |||
"encoder": { | |||
"rotary": [ | |||
{ "pin_a": "A6", "pin_b": "A7", "resolution": 4} | |||
] | |||
}, | |||
"layouts": { | |||
"LAYOUT": { | |||
"layout": [ | |||
{"matrix":[0, 0],"x": 0,"y": 0}, | |||
{"matrix":[0, 1],"x": 1, "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, "y": 0}, | |||
{"matrix":[0, 7],"x": 7, "y": 0}, | |||
{"matrix":[0, 8],"x": 8, "y": 0}, | |||
{"matrix":[0, 9],"x": 9, "y": 0}, | |||
{"matrix":[0, 10],"x": 10, "y": 0}, | |||
{"matrix":[0, 11],"x": 11, "y": 0}, | |||
{"matrix":[0, 12],"x": 12, "y": 0}, | |||
{"matrix":[0, 13], "x": 13, "y": 0}, | |||
{"matrix":[3, 13], "x": 14, "y": 0}, | |||
{"matrix":[4, 12], "x": 15, "y": 0}, | |||
{"matrix":[6, 12],"x":16, "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":[4, 13],"x": 15, "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": 11.5, "y": 2}, | |||
{"matrix":[2, 13], "x": 13.5, "y": 2,"w": 1.5}, | |||
{"matrix":[5, 11], "x": 15, "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,"w":2.25}, | |||
{"matrix":[3, 12],"x": 14, "y": 3}, | |||
{"matrix":[5, 12], "x": 15, "y": 3}, | |||
{"matrix":[4, 0],"x": 0, "y": 3, "w": 2.25}, | |||
{"matrix":[4, 1],"x": 2.25, "y": 3}, | |||
{"matrix":[4, 2],"x": 3.25, "y": 3}, | |||
{"matrix":[4, 3],"x": 4.25, "y": 3}, | |||
{"matrix":[4, 4],"x": 5.25, "y": 3}, | |||
{"matrix":[4, 5],"x": 6.25, "y": 3}, | |||
{"matrix":[4, 6],"x": 7.25, "y": 3}, | |||
{"matrix":[4, 7],"x": 8.25, "y": 3}, | |||
{"matrix":[4, 8],"x": 9.25, "y": 3}, | |||
{"matrix":[4, 9],"x": 10.25, "y": 3}, | |||
{"matrix":[4, 10],"x": 11.25, "y": 3}, | |||
{"matrix":[4, 11],"x": 12.25, "y": 3,"w":1.75}, | |||
{"matrix":[5, 7],"x": 14, "y": 3}, | |||
{"matrix":[5, 13], "x": 15, "y": 3}, | |||
{"matrix":[5, 0], "x": 0, "y": 4, "w": 1.25}, | |||
{"matrix":[5, 1],"x": 1.25, "y": 4,"w": 1.25}, | |||
{"matrix":[5, 2],"x": 2.5, "y": 4,"w": 1.25}, | |||
{"matrix":[5, 3],"x": 3.75, "y": 4,"w": 6.25}, | |||
{"matrix":[5, 4],"x": 10, "y": 4}, | |||
{"matrix":[5, 5],"x": 11, "y": 4}, | |||
{"matrix":[5, 6], "x": 12,"y": 4}, | |||
{"matrix":[5, 8], "x": 13, "y": 4}, | |||
{"matrix":[5, 9], "x": 14, "y": 4}, | |||
{"matrix":[5, 10], "x": 15, "y": 4}, | |||
{"matrix":[6, 3],"x":17, "y": 0} | |||
] | |||
} | |||
} | |||
} | |||
@ -0,0 +1,62 @@ | |||
/* Copyright 2024 albert-zheng | |||
* | |||
* 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 | |||
#ifdef ENCODER_MAP_ENABLE | |||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { | |||
[0] = { | |||
ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, | |||
[1] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, | |||
[2] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, | |||
[3] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)} | |||
}; | |||
#endif | |||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
[0] = 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_PSCR, KC_SCRL, KC_PAUS, KC_MUTE, | |||
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_DEL, | |||
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(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT, _______ | |||
), | |||
[1] = LAYOUT( | |||
_______, KC_MSEL, KC_VOLD, KC_VOLU, KC_MUTE, KC_MSTP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MAIL, KC_WHOM, KC_MYCM, KC_CALC, _______, _______, _______, _______, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_END, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_SCRL, | |||
_______, GU_TOG, _______, KC_RESET, _______, _______, _______, _______, _______, _______, _______ | |||
), | |||
[2] = LAYOUT( | |||
KC_ESC, KC_BRID, KC_BRIU, RCTL(KC_UP), KC_F11, KC_F5, KC_F6, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_SCRL, KC_PAUS, KC_MUTE, | |||
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_DEL, | |||
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(3), KC_RALT, KC_LEFT, KC_DOWN, KC_RIGHT, _______ | |||
), | |||
[3] = 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_INS, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_END, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_SCRL, | |||
_______, _______, _______, KC_RESET, _______, _______, _______, _______, _______, _______, _______ | |||
) | |||
}; |
@ -0,0 +1 @@ | |||
ENCODER_MAP_ENABLE = yes |
@ -0,0 +1,62 @@ | |||
/* Copyright 2024 albert-zheng | |||
* | |||
* 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 | |||
#ifdef ENCODER_MAP_ENABLE | |||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { | |||
[0] = { | |||
ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, | |||
[1] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, | |||
[2] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)}, | |||
[3] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)} | |||
}; | |||
#endif | |||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
[0] = 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_PSCR, KC_SCRL, KC_PAUS, KC_MUTE, | |||
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_DEL, | |||
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(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT, _______ | |||
), | |||
[1] = LAYOUT( | |||
_______, KC_MSEL, KC_VOLD, KC_VOLU, KC_MUTE, KC_MSTP, KC_MPRV, KC_MPLY, KC_MNXT, KC_MAIL, KC_WHOM, KC_MYCM, KC_CALC, _______, _______, _______, _______, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_END, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_SCRL, | |||
_______, GU_TOG, _______, KC_RESET, _______, _______, _______, _______, _______, _______, _______ | |||
), | |||
[2] = LAYOUT( | |||
KC_ESC, KC_BRID, KC_BRIU, RCTL(KC_UP), KC_F11, KC_F5, KC_F6, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, KC_PSCR, KC_SCRL, KC_PAUS, KC_MUTE, | |||
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_DEL, | |||
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(3), KC_RALT, KC_LEFT, KC_DOWN, KC_RIGHT, _______ | |||
), | |||
[3] = 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_INS, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_END, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, | |||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_SCRL, | |||
_______, _______, _______, KC_RESET, _______, _______, _______, _______, _______, _______, _______ | |||
) | |||
}; |
@ -0,0 +1,3 @@ | |||
VIA_ENABLE = yes | |||
LTO_ENABLE = yes | |||
ENCODER_MAP_ENABLE = yes |
@ -0,0 +1,28 @@ | |||
/* Copyright 2024 albert-zheng | |||
* | |||
* 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_next <mcuconf.h> | |||
#undef STM32_SPI_USE_SPI1 | |||
#define STM32_SPI_USE_SPI1 TRUE | |||
#undef STM32_SERIAL_USE_USART1 | |||
#define STM32_SERIAL_USE_USART1 TRUE | |||
#undef STM32_ADC_USE_ADC1 | |||
#define STM32_ADC_USE_ADC1 TRUE |
@ -0,0 +1,26 @@ | |||
# Smart84 | |||
![Smart84](https://i.imgur.com/D07mXuI.png) | |||
A compact 75% (16x6) ortholinear keyboard kit made and sold by alber. [More info on albert_zheng/qmk_firmware](https://github.com/alber-Zheng/qmk_firmware) | |||
* Keyboard Maintainer: [alber-Zheng](https://github.com/alber-Zheng/qmk_firmware) | |||
* Hardware Supported: Smart84 PCB rev1 | |||
Make example for this keyboard (after setting up your build environment): | |||
qmk compile -kb albert_smart/albert_smart84 -km via | |||
Flashing example for this keyboard(use qmk toolbox): | |||
make albert_smart/albert_smart84:via:flash | |||
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). | |||
## Bootloader | |||
Enter the bootloader in 3 ways: | |||
* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard | |||
* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead | |||
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available |
@ -0,0 +1,7 @@ | |||
MCU_LDSCRIPT = STM32F103xB | |||
DYNAMIC_KEYMAP_ENABLE = yes | |||
SRC += analog.c | |||
DEBOUNCE_TYPE = sym_eager_pr |
@ -0,0 +1,12 @@ | |||
{ | |||
"manufacturer": "albert-zheng", | |||
"maintainer": "albert-zheng", | |||
"url": "", | |||
"bootloader": "stm32duino", | |||
"bootloader_instructions": "Press ESC(ROW0COL0), Plug USB. ", | |||
"processor": "STM32F103", | |||
"board": "STM32_F103_STM32DUINO", | |||
"usb": { | |||
"vid": "0x5343" | |||
} | |||
} |