forked from Lotlab/nrf52-keyboard
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Lotlab:master' into master
- Loading branch information
Showing
21 changed files
with
989 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# 此工程的根目录 | ||
ROOT_DIR := ../.. | ||
|
||
# 特殊目录控制 | ||
# SDK_ROOT := /var/nrf52/nRF52_SDK | ||
# TEMPLATE_PATH := /var/nrf52/template | ||
|
||
# 配置项:主控芯片类型 | ||
# 可选:nrf52810 或 nrf52832 | ||
NRF_CHIP := nrf52832 | ||
|
||
# 配置文件文件名 | ||
CONFIG_H = config.h | ||
CONFIG_H_DIR = . | ||
SRC_FILES += keymap_plain.c | ||
SRC_FILES += user_evt.c | ||
|
||
# 配置项:功能选项 | ||
# 关于更多的可配置项目,请参考doc目录下的相应文档 | ||
BOOTMAGIC_ENABLE = no # 启用Bootmagic | ||
BOOTCHECK_ENABLE = yes # 启用Bootchek | ||
EXTRAKEY_ENABLE = yes # 启用媒体键功能 | ||
NKRO_ENABLE = yes # 启用USB的全键无冲功能 | ||
USB_6KRO_ENABLE = yes # 启用USB的六键无冲功能 | ||
THREE_LED_STATUS = yes # 3LED 状态灯 | ||
RGBLIGHT_ENABLE = yes # LED RGB 灯 | ||
ONBOARD_CMSIS_DAP = yes # 启用板载调试器 | ||
ONE_RGB_LED = yes # RGB 三色 | ||
########## STOP HERE ########## | ||
# 除非你知道下面这些配置项是干什么的,否则不要去动它 | ||
|
||
INC_FOLDERS += . | ||
|
||
APP_MAIN_DIR := $(ROOT_DIR)/application/main | ||
TMK_CORE_DIR := $(ROOT_DIR)/tmk/tmk_core | ||
USB_SOURCE_DIR := $(ROOT_DIR)/usb | ||
|
||
APP_PROJ_DIR := $(APP_MAIN_DIR)/project | ||
APP_SRC_DIR := $(APP_MAIN_DIR)/src | ||
|
||
all: merge_softdevice usb | ||
|
||
include $(APP_PROJ_DIR)/kbd.mk | ||
include $(USB_SOURCE_DIR)/usb.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# 键盘配置模板 | ||
|
||
这是一份通用的60%键盘的模板。复制后并在其基础上进行修改即可增加键盘的配置。 | ||
|
||
修改完毕后,在这里输入一些键盘的描述,诸如功能、大小、硬件开源情况等等。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/* | ||
Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
Copyright 2019 Jim Jiang <jim@lotlab.org> | ||
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 <stdint.h> | ||
|
||
/* USB和蓝牙的显示参数 */ | ||
// USB的VID和PID,自行修改 | ||
#define VENDOR_ID 0x1209 /* USB VID */ | ||
#define PRODUCT_ID 0x122C /* USB PID */ | ||
// 配置协议使用的VID和PID,自行修改。ID组合不得重复。 | ||
#define CONF_VENDOR_ID 0x3613 /* 配置协议使用的VendorID */ | ||
#define CONF_PRODUCT_ID 0x122C /* 配置协议使用的ProductID */ | ||
#define DEVICE_VER 0x0000 /* 硬件版本 */ | ||
#define MANUFACTURER "AMX123" /* 硬件制造商,用于USB和蓝牙显示 */ | ||
#define PRODUCT "AMX60" /* 硬件名称,用于USB和蓝牙显示 */ | ||
#define MACADDR_SEPRATOR '_' /* 蓝牙名称后地址的分隔符。若不设置则不显示蓝牙名称后面的地址 */ | ||
|
||
/* USB HID report parameter */ | ||
#define KEYBOARD_EPSIZE 8 /* 键盘上传端点大小,请不要修改 */ | ||
#define NKRO_EPSIZE 28 /* 键盘NKRO端点大小,请不要修改 */ | ||
|
||
// 定义Bootmagic/Bootcheck按键 | ||
#define BOOTMAGIC_KEY_BOOT KC_U /* 开机 */ | ||
#define BOOTMAGIC_KEY_ERASE_BOND KC_E /* 删除所有绑定 */ | ||
|
||
// 键盘省电参数 | ||
#define SLEEP_SLOW_TIMEOUT 15 // 键盘闲置多久后转入慢速扫描模式 (s) | ||
#define SLEEP_OFF_TIMEOUT 600 // 键盘闲置多久后转入自动关机 (s) | ||
#define KEYBOARD_SCAN_INTERVAL 1 // 键盘最小时间单位TICK (ms) | ||
#define KEYBOARD_FAST_SCAN_INTERVAL 10 // 通常模式下,多久扫描一次键盘 (ms) | ||
#define KEYBOARD_SLOW_SCAN_INTERVAL 100 // 慢速模式下,多久扫描一次键盘 (ms) | ||
#define LED_AUTOOFF_TIME 5 /* LED自动熄灭时长(s),设为0则不自动熄灭 */ | ||
|
||
// 键盘额外功能 | ||
#define DYNAMIC_TX_POWER /* 启用自动发射功率调整 */ | ||
// #define PASSKEY_REQUIRED /* 需要输入配对码 */ | ||
#define ENABLE_WATCHDOG /* 启用看门狗 */ | ||
#define HIGH_TX_POWER /* 更改发射功率到+4dBm */ | ||
#define MULTI_DEVICE_SWITCH /*启用多设备切换 */ | ||
#define KEYMAP_STORAGE /* 启用keymap存储 */ | ||
// #define MACRO_BLOCKING_MODE /* 在宏播放时禁用其他按键输入 */ | ||
#define MACRO_STORAGE /* 启用宏存储功能 */ | ||
#define CONFIG_STORAGE /* 启用配置存储功能 */ | ||
// #define BUTTONLESS_DFU /* 启用免按钮DFU */ | ||
|
||
// #define DEBUG_SKIP_PWRON_CHECK /* 直接开机而跳过开机条件检测,用于调试 */ | ||
|
||
/* TMK固件内置功能 */ | ||
/* disable action features */ | ||
//#define NO_ACTION_LAYER | ||
//#define NO_ACTION_TAPPING | ||
//#define NO_ACTION_ONESHOT | ||
//#define NO_ACTION_MACRO | ||
//#define NO_ACTION_FUNCTION | ||
|
||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
#define LOCKING_SUPPORT_ENABLE | ||
/* Locking resynchronize hack */ | ||
#define LOCKING_RESYNC_ENABLE | ||
|
||
/* key combination for command */ | ||
#define IS_COMMAND() ( \ | ||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) | ||
|
||
// LED 配置 | ||
// #define LED_NUM 22 | ||
// #define LED_CAPS 4 | ||
// #define LED_SCLK 23 | ||
#define LED_RGB_R 5 | ||
#define LED_RGB_G 6 | ||
#define LED_RGB_B 7 | ||
#define LED_POSITIVE // LED上拉驱动 | ||
// #define LED_NO_DEINIT // 不要deinit端口,可以避免部分IO灯光无法关闭的问题 | ||
|
||
// Bootloader 指示灯 | ||
#define RGB_DI_PIN 10 //WS2812 RGB信号输入 | ||
#define RGBLED_NUM 6 //WS2812灯数量 | ||
#define RGBLIGHT_ANIMATIONS //开启RGB动态灯效 | ||
|
||
// 多用途 Bootloader 按钮 | ||
// #define NRF_BL_DFU_MULTI_ROLE_BTN 3 | ||
|
||
// USB UART 传输配置 | ||
#define HAS_USB // 启用与CH554的通信支持 | ||
#define UART_RXD 8 // UART_RX口IO | ||
#define UART_TXD 9 // UART_TX口IO | ||
// #define UART_DET 19 // UART 检测引脚,若此脚被拉低,则说明USB正在工作。若不配置则使用RX口作为检测引脚 | ||
#define UART_BAUDRATE NRF_UART_BAUDRATE_115200 // 通信波特率,请不要修改 | ||
|
||
// 电量检测配置 | ||
#define BATTERY_ADC_PIN NRF_SAADC_INPUT_AIN0 // 电量检测引脚 | ||
|
||
// 充电检测配置 | ||
// #define PIN_CHARGING !UCC1 // CH554的充电检测。当UCC1拉低时表示正在充电。若不配置则禁用USB下发充电事件 | ||
// #define PIN_STANDBY !UCC2 // CH554的充电检测。当UCC2拉低时表示充电完成。若不配置则只使用PIN_CHARGING作为是否充电的检测标志 | ||
|
||
// 按键阵列配置 | ||
#define MATRIX_ROWS 5 /* 硬件阵列行数 */ | ||
#define MATRIX_COLS 15 /* 硬件阵列列数 */ | ||
static const uint8_t row_pin_array[MATRIX_ROWS] = { 27, 26, 30, 20, 19 }; | ||
static const uint8_t column_pin_array[MATRIX_COLS] = { 21, 22, 23, 24, 25, 28, 29, 11, 12, 13, 14, 15, 16, 17, 18 }; | ||
#define ROW_IN // 键盘阵列的二极管方向是从COL->ROW | ||
|
||
/* define if matrix has ghost */ | ||
// #define MATRIX_HAS_GHOST /* 按键阵列是否出现Ghost Key,若没有加二极管则需要启用这个项目 */ | ||
|
||
#define DEBOUNCE 5 /* 硬件消抖次数,设置为0则不消抖 */ | ||
#define MATRIX_SCAN_DELAY_CYCLE 36 /* 按键扫描等待IO稳定的延时时长 */ | ||
|
||
// 板载调试器设置 | ||
#define SWD_CLK_IO T2EX | ||
#define SWD_CLK_MASK bT2EX | ||
#define SWD_CLK_PORT P1 | ||
#define SWD_DAT_IO T2 | ||
#define SWD_DAT_MASK bT2 | ||
#define SWD_DAT_PORT P1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
Copyright 2012,2013 Jun Wako <wakojun@gmail.com> | ||
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/>. | ||
*/ | ||
|
||
/** | ||
* 键盘矩阵基配置文件 | ||
* | ||
* 定义各个按键的位置,方便编写Keymap | ||
*/ | ||
#pragma once | ||
|
||
#include <stdint.h> | ||
#include "keymap.h" | ||
#include "config.h" | ||
|
||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | ||
extern const action_t fn_actions[]; | ||
|
||
/* GH60 keymap definition macro | ||
* K2C, K31 and K3C are extra keys for ISO | ||
*/ | ||
#define KEYMAP( \ | ||
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \ | ||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ | ||
K20, K21, K22, K23, K24, K25, K26, K28, K29, K2A, K2B, K2C, K2D, K2E, \ | ||
K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \ | ||
K41, K42, K44, K46, K47, K4A, K4C, K4D, K4E \ | ||
) { \ | ||
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E }, \ | ||
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E }, \ | ||
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_NO , KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E }, \ | ||
{ KC_NO , KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E }, \ | ||
{ KC_NO , KC_##K41, KC_##K42, KC_NO , KC_##K44, KC_NO, KC_##K46, KC_##K47, KC_NO , KC_NO, KC_##K4A, KC_NO, KC_##K4C, KC_##K4D, KC_##K4E } \ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
Copyright (C) 2018,2019 Jim Jiang <jim@lotlab.org> | ||
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 3 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 <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "keymap_common.h" | ||
#include "keyboard_fn.h" | ||
|
||
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
/* 0: qwerty */ | ||
KEYMAP( | ||
ESC, GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ | ||
PGUP, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ | ||
PGDN, CAPS, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, \ | ||
LSFT, Z, X, C, V, B, B, N, M, COMM,DOT, SLSH, UP, RSFT, \ | ||
LCTL, LGUI, LALT, SPC, SPC, FN0, LEFT,DOWN,RIGHT) | ||
}; | ||
const action_t fn_actions[] = { | ||
/* Poker Layout */ | ||
ACTION_LAYER_MOMENTARY(1), // to Fn overlay | ||
ACTION_FUNCTION(KEYBOARD_CONTROL), // sleep | ||
ACTION_FUNCTION(SWITCH_DEVICE) // switch between usb and ble | ||
}; | ||
|
Oops, something went wrong.