Merge branch 'master' of https://github.com/qmk/qmk_firmware
This commit is contained in:
commit
71493b2f9b
2121 changed files with 90821 additions and 9389 deletions
|
@ -13,7 +13,7 @@ BinPackParameters: 'true'
|
|||
ColumnLimit: '1000'
|
||||
IndentCaseLabels: 'true'
|
||||
IndentPPDirectives: AfterHash
|
||||
IndentWidth: '2'
|
||||
IndentWidth: '4'
|
||||
MaxEmptyLinesToKeep: '1'
|
||||
PointerAlignment: Right
|
||||
SortIncludes: 'false'
|
||||
|
|
|
@ -19,9 +19,11 @@ indent_size = 4
|
|||
# Make these match what we have in .gitattributes
|
||||
[*.mk]
|
||||
end_of_line = lf
|
||||
indent_style = tab
|
||||
|
||||
[Makefile]
|
||||
end_of_line = lf
|
||||
indent_style = tab
|
||||
|
||||
[*.sh]
|
||||
end_of_line = lf
|
||||
|
|
24
.travis.yml
24
.travis.yml
|
@ -11,31 +11,21 @@ env:
|
|||
global:
|
||||
- secure: vBTSL34BDPxDilKUuTXqU4CJ26Pv5hogD2nghatkxSQkI1/jbdnLj/DQdPUrMJFDIY6TK3AltsBx72MaMsLQ1JO/Ou24IeHINHXzUC1FlS9yQa48cpxnhX5kzXNyGs3oa0qaFbvnr7RgYRWtmD52n4bIZuSuW+xpBv05x2OCizdT2ZonH33nATaHGFasxROm4qYZ241VfzcUv766V6RVHgL4x9V08warugs+RENVkfzxxwhk3NmkrISabze0gSVJLHBPHxroZC6EUcf/ocobcuDrCwFqtEt90i7pNIAFUE7gZsN2uE75LmpzAWin21G7lLPcPL2k4FJVd8an1HiP2WmscJU6U89fOfMb2viObnKcCzebozBCmKGtHEuXZo9FcReOx49AnQSpmESJGs+q2dL/FApkTjQiyT4J6O5dJpoww0/r57Wx0cmmqjETKBb5rSgXM51Etk3wO09mvcPHsEwrT7qH8r9XWdyCDoEn7FCLX3/LYnf/D4SmZ633YPl5gv3v9XEwxR5+04akjgnvWDSNIaDbWBdxHNb7l4pMc+WR1bwCyMyA7KXj0RrftEGOrm9ZRLe6BkbT4cycA+j77nbPOMcyZChliV9pPQos+4TOJoTzcK2L8yWVoY409aDNVuAjdP6Yum0R2maBGl/etLmIMpJC35C5/lZ+dUNjJAM=
|
||||
- MAKEFLAGS="-j3 --output-sync"
|
||||
services:
|
||||
- docker
|
||||
before_install:
|
||||
- wget http://ww1.microchip.com/downloads/en/DeviceDoc/avr8-gnu-toolchain-3.5.4.1709-linux.any.x86_64.tar.gz || wget http://qmk.fm/avr8-gnu-toolchain-3.5.4.1709-linux.any.x86_64.tar.gz
|
||||
# Need DFU > .5 for dfu-suffix
|
||||
- sudo add-apt-repository --yes ppa:tormodvolden/ppa
|
||||
- sudo apt-get update -qq
|
||||
- docker build -t qmkfm/qmk_firmware .
|
||||
install:
|
||||
- tar -zxf avr8-gnu-toolchain-3.5.4.1709-linux.any.x86_64.tar.gz
|
||||
- export PATH="$PATH:$TRAVIS_BUILD_DIR/avr8-gnu-toolchain-linux_x86_64/bin"
|
||||
- npm install -g moxygen
|
||||
- sudo apt-get -y --force-yes install dfu-util
|
||||
before_script:
|
||||
- avr-gcc --version
|
||||
script:
|
||||
- git rev-parse --short HEAD
|
||||
- bash util/travis_test.sh
|
||||
- bash util/travis_build.sh
|
||||
- bash util/travis_docs.sh
|
||||
- git rev-parse --short HEAD
|
||||
- bash util/travis_test.sh
|
||||
- bash util/travis_build.sh
|
||||
- bash util/travis_docs.sh
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- dfu-programmer
|
||||
- pandoc
|
||||
- gcc-arm-none-eabi
|
||||
- binutils-arm-none-eabi
|
||||
- libnewlib-arm-none-eabi
|
||||
- diffutils
|
||||
- dos2unix
|
||||
- doxygen
|
||||
|
|
|
@ -9,7 +9,6 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
|
|||
dfu-programmer \
|
||||
dfu-util \
|
||||
gcc \
|
||||
gcc-arm-none-eabi \
|
||||
gcc-avr \
|
||||
git \
|
||||
libnewlib-arm-none-eabi \
|
||||
|
@ -19,11 +18,12 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
|
|||
zip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV KEYBOARD=ergodox_ez
|
||||
ENV KEYMAP=default
|
||||
# upgrade gcc-arm-none-eabi from the default 5.4.1 to 6.3.1 due to ARM runtime issues
|
||||
RUN wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 -O - | \
|
||||
tar xj --strip-components=1 -C /
|
||||
|
||||
VOLUME /qmk_firmware
|
||||
WORKDIR /qmk_firmware
|
||||
COPY . .
|
||||
|
||||
CMD make $KEYBOARD:$KEYMAP
|
||||
CMD make all:default
|
||||
|
|
4
Vagrantfile
vendored
4
Vagrantfile
vendored
|
@ -7,6 +7,8 @@ Vagrant.configure(2) do |config|
|
|||
|
||||
# VMware/Virtualbox ( and also Hyperv/Parallels) 64 bit
|
||||
config.vm.box = "generic/debian9"
|
||||
|
||||
config.vm.synced_folder '.', '/vagrant'
|
||||
|
||||
# This section allows you to customize the Virtualbox VM
|
||||
# settings, ie showing the GUI or upping the memory
|
||||
|
@ -64,7 +66,7 @@ Vagrant.configure(2) do |config|
|
|||
# If this causes issues you can run a 'vagrant destroy' and then
|
||||
# add a # before ,run: (or change "always" to "once") and run 'vagrant up' to get a working
|
||||
# non-updated box and then attempt to troubleshoot or open a Github issue
|
||||
config.vm.provision "shell", inline: "/bin/sh -c 'yes | /vagrant/util/qmk_install.sh'", run: "always"
|
||||
config.vm.provision "shell", inline: "/vagrant/util/qmk_install.sh", run: "always"
|
||||
|
||||
config.vm.post_up_message = <<-EOT
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ ifeq ($(strip $(LED_MATRIX_ENABLE)), IS31FL3731)
|
|||
OPT_DEFS += -DIS31FL3731
|
||||
COMMON_VPATH += $(DRIVER_PATH)/issi
|
||||
SRC += is31fl3731-simple.c
|
||||
SRC += i2c_master.c
|
||||
QUANTUM_LIB_SRC += i2c_master.c
|
||||
endif
|
||||
|
||||
RGB_MATRIX_ENABLE ?= no
|
||||
|
@ -157,21 +157,21 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3731)
|
|||
OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
||||
COMMON_VPATH += $(DRIVER_PATH)/issi
|
||||
SRC += is31fl3731.c
|
||||
SRC += i2c_master.c
|
||||
QUANTUM_LIB_SRC += i2c_master.c
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3733)
|
||||
OPT_DEFS += -DIS31FL3733 -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
||||
COMMON_VPATH += $(DRIVER_PATH)/issi
|
||||
SRC += is31fl3733.c
|
||||
SRC += i2c_master.c
|
||||
QUANTUM_LIB_SRC += i2c_master.c
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3737)
|
||||
OPT_DEFS += -DIS31FL3737 -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
||||
COMMON_VPATH += $(DRIVER_PATH)/issi
|
||||
SRC += is31fl3737.c
|
||||
SRC += i2c_master.c
|
||||
QUANTUM_LIB_SRC += i2c_master.c
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(RGB_MATRIX_ENABLE)), WS2812)
|
||||
|
@ -271,7 +271,7 @@ ifeq ($(strip $(HAPTIC_ENABLE)), DRV2605L)
|
|||
COMMON_VPATH += $(DRIVER_PATH)/haptic
|
||||
SRC += haptic.c
|
||||
SRC += DRV2605L.c
|
||||
SRC += i2c_master.c
|
||||
QUANTUM_LIB_SRC += i2c_master.c
|
||||
OPT_DEFS += -DHAPTIC_ENABLE
|
||||
OPT_DEFS += -DDRV2605L
|
||||
endif
|
||||
|
|
|
@ -52,18 +52,21 @@
|
|||
* [Backlight](feature_backlight.md)
|
||||
* [Bluetooth](feature_bluetooth.md)
|
||||
* [Bootmagic](feature_bootmagic.md)
|
||||
* [Combos](feature_combo)
|
||||
* [Combos](feature_combo.md)
|
||||
* [Command](feature_command.md)
|
||||
* [Debounce API](feature_debounce_type.md)
|
||||
* [Dynamic Macros](feature_dynamic_macros.md)
|
||||
* [Encoders](feature_encoders.md)
|
||||
* [Grave Escape](feature_grave_esc.md)
|
||||
* [Haptic Feedback](feature_haptic_feedback.md)
|
||||
* [HD44780 LCD Controller](feature_hd44780.md)
|
||||
* [Key Lock](feature_key_lock.md)
|
||||
* [Layouts](feature_layouts.md)
|
||||
* [Leader Key](feature_leader_key.md)
|
||||
* [LED Matrix](feature_led_matrix.md)
|
||||
* [Macros](feature_macros.md)
|
||||
* [Mouse Keys](feature_mouse_keys.md)
|
||||
* [OLED Driver](feature_oled_driver)
|
||||
* [OLED Driver](feature_oled_driver.md)
|
||||
* [One Shot Keys](feature_advanced_keycodes.md#one-shot-keys)
|
||||
* [Pointing Device](feature_pointing_device.md)
|
||||
* [PS/2 Mouse](feature_ps2_mouse.md)
|
||||
|
|
|
@ -76,14 +76,14 @@ This is a C header file that is one of the first things included, and will persi
|
|||
* `#define B7_AUDIO`
|
||||
* enables audio on pin B7 (duophony is enables if one of B[5-7]\_AUDIO is enabled along with one of C[4-6]\_AUDIO)
|
||||
* `#define BACKLIGHT_PIN B7`
|
||||
* pin of the backlight - B5, B6, B7 use PWM, others use softPWM
|
||||
* pin of the backlight - `B5`, `B6`, `B7` and `C6` (and `D4` on ATmega32A) use hardware PWM, others use software implementation
|
||||
* `#define BACKLIGHT_LEVELS 3`
|
||||
* number of levels your backlight will have (maximum 15 excluding off)
|
||||
* `#define BACKLIGHT_BREATHING`
|
||||
* enables backlight breathing (only works with backlight pins B5, B6 and B7)
|
||||
* enables backlight breathing
|
||||
* `#define BREATHING_PERIOD 6`
|
||||
* the length of one backlight "breath" in seconds
|
||||
* `#define DEBOUNCING_DELAY 5`
|
||||
* `#define DEBOUNCE 5`
|
||||
* the delay when reading the value of the pin (5 is default)
|
||||
* `#define LOCKING_SUPPORT_ENABLE`
|
||||
* mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
|
||||
|
@ -93,8 +93,8 @@ This is a C header file that is one of the first things included, and will persi
|
|||
* key combination that allows the use of magic commands (useful for debugging)
|
||||
* `#define USB_MAX_POWER_CONSUMPTION`
|
||||
* sets the maximum power (in mA) over USB for the device (default: 500)
|
||||
* `#define SCL_CLOCK 100000L`
|
||||
* sets the SCL_CLOCK speed for split keyboards. The default is `100000L` but some boards can be set to `400000L`.
|
||||
* `#define F_SCL 100000L`
|
||||
* sets the I2C clock rate speed for keyboards using I2C. The default is `400000L`, except for keyboards using `split_common`, where the default is `100000L`.
|
||||
|
||||
## Features That Can Be Disabled
|
||||
|
||||
|
@ -171,6 +171,8 @@ If you define these options you will enable the associated feature, which may in
|
|||
* how long for the Combo keys to be detected. Defaults to `TAPPING_TERM` if not defined.
|
||||
* `#define TAP_CODE_DELAY 100`
|
||||
* Sets the delay between `register_code` and `unregister_code`, if you're having issues with it registering properly (common on VUSB boards). The value is in milliseconds.
|
||||
* `#define TAP_HOLD_CAPS_DELAY 200`
|
||||
* Sets the delay for Tap Hold keys (`LT`, `MT`) when using `KC_CAPSLOCK` keycode, as this has some special handling on MacOS. The value is in milliseconds, and defaults to 200ms if not defined.
|
||||
|
||||
## RGB Light Configuration
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ You should use this function if you need custom matrix scanning code. It can als
|
|||
|
||||
If the board supports it, it can be "idled", by stopping a number of functions. A good example of this is RGB lights or backlights. This can save on power consumption, or may be better behavior for your keyboard.
|
||||
|
||||
This is controlled by two functions: `suspend_power_down_*` and `suspend_wakeup_init_*`, which are called when the system is board is idled and when it wakes up, respectively.
|
||||
This is controlled by two functions: `suspend_power_down_*` and `suspend_wakeup_init_*`, which are called when the system board is idled and when it wakes up, respectively.
|
||||
|
||||
|
||||
### Example suspend_power_down_user() and suspend_wakeup_init_user() Implementation
|
||||
|
|
|
@ -140,8 +140,8 @@ For now, you need to rollback avr-gcc to 7 in brew.
|
|||
|
||||
```
|
||||
brew uninstall --force avr-gcc
|
||||
brew install avr-gcc@7
|
||||
brew link --force avr-gcc@7
|
||||
brew install avr-gcc@8
|
||||
brew link --force avr-gcc@8
|
||||
```
|
||||
|
||||
### I just flashed my keyboard and it does nothing/keypresses don't register - it's also ARM (rev6 planck, clueboard 60, hs60v2, etc...) (Feb 2019)
|
||||
|
|
|
@ -256,10 +256,10 @@ If you press a Mod Tap key, tap another key (press and release) and then release
|
|||
|
||||
For Instance:
|
||||
|
||||
- `SHFT_T(KC_A)` Down
|
||||
- `SFT_T(KC_A)` Down
|
||||
- `KC_X` Down
|
||||
- `KC_X` Up
|
||||
- `SHFT_T(KC_A)` Up
|
||||
- `SFT_T(KC_A)` Up
|
||||
|
||||
Normally, if you do all this within the `TAPPING_TERM` (default: 200ms) this will be registered as `ax` by the firmware and host system. With permissive hold enabled, this modifies how this is handled by considering the Mod Tap keys as a Mod if another key is tapped, and would registered as `X` (`SHIFT`+`x`).
|
||||
|
||||
|
@ -279,9 +279,9 @@ Setting `Ignore Mod Tap Interrupt` requires holding both keys for the `TAPPING_
|
|||
|
||||
For Instance:
|
||||
|
||||
- `SHFT_T(KC_A)` Down
|
||||
- `SFT_T(KC_A)` Down
|
||||
- `KC_X` Down
|
||||
- `SHFT_T(KC_A)` Up
|
||||
- `SFT_T(KC_A)` Up
|
||||
- `KC_X` Up
|
||||
|
||||
Normally, this would send `X` (`SHIFT`+`x`). With `Ignore Mod Tap Interrupt` enabled, holding both keys are required for the `TAPPING_TERM` to register the hold action. A quick tap will output `ax` in this case, while a hold on both will still output `X` (`SHIFT`+`x`).
|
||||
|
@ -303,11 +303,11 @@ When the user holds a key after tap, this repeats the tapped key rather to hold
|
|||
|
||||
Example:
|
||||
|
||||
- SHFT_T(KC_A) Down
|
||||
- SHFT_T(KC_A) Up
|
||||
- SHFT_T(KC_A) Down
|
||||
- SFT_T(KC_A) Down
|
||||
- SFT_T(KC_A) Up
|
||||
- SFT_T(KC_A) Down
|
||||
- wait more than tapping term...
|
||||
- SHFT_T(KC_A) Up
|
||||
- SFT_T(KC_A) Up
|
||||
|
||||
With default settings, `a` will be sent on the first release, then `a` will be sent on the second press allowing the computer to trigger its auto repeat function.
|
||||
|
||||
|
|
|
@ -175,8 +175,9 @@ You can configure the default, min and max frequencies, the stepping and built i
|
|||
| `AUDIO_CLICKY_FREQ_DEFAULT` | 440.0f | Sets the default/starting audio frequency for the clicky sounds. |
|
||||
| `AUDIO_CLICKY_FREQ_MIN` | 65.0f | Sets the lowest frequency (under 60f are a bit buggy). |
|
||||
| `AUDIO_CLICKY_FREQ_MAX` | 1500.0f | Sets the the highest frequency. Too high may result in coworkers attacking you. |
|
||||
| `AUDIO_CLICKY_FREQ_FACTOR` | 1.18921f| Sets the stepping of UP/DOWN key codes. |
|
||||
| `AUDIO_CLICKY_FREQ_FACTOR` | 1.18921f| Sets the stepping of UP/DOWN key codes. This is a multiplicative factor. The default steps the frequency up/down by a musical minor third. |
|
||||
| `AUDIO_CLICKY_FREQ_RANDOMNESS` | 0.05f | Sets a factor of randomness for the clicks, Setting this to `0f` will make each click identical, and `1.0f` will make this sound much like the 90's computer screen scrolling/typing effect. |
|
||||
| `AUDIO_CLICKY_DELAY_DURATION` | 1 | An integer note duration where 1 is 1/16th of the tempo, or a sixty-fourth note (see `quantum/audio/musical_notes.h` for implementation details). The main clicky effect will be delayed by this duration. Adjusting this to values around 6-12 will help compensate for loud switches. |
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -34,13 +34,14 @@ Hardware PWM is only supported on certain pins of the MCU, so if the backlightin
|
|||
|
||||
Hardware PWM is supported according to the following table:
|
||||
|
||||
| Backlight Pin | Hardware timer |
|
||||
|---------------|----------------|
|
||||
|`B5` | Timer 1 |
|
||||
|`B6` | Timer 1 |
|
||||
|`B7` | Timer 1 |
|
||||
|`C6` | Timer 3 |
|
||||
| other | Software PWM |
|
||||
| Backlight Pin | Hardware timer |
|
||||
|---------------|-------------------------|
|
||||
|`B5` | Timer 1 |
|
||||
|`B6` | Timer 1 |
|
||||
|`B7` | Timer 1 |
|
||||
|`C6` | Timer 3 |
|
||||
|`D4` | Timer 1 (ATmega32A only)|
|
||||
| other | Software PWM |
|
||||
|
||||
The [audio feature](feature_audio.md) also uses hardware timers. Please refer to the following table to know what hardware timer the software PWM will use depending on the audio configuration:
|
||||
|
||||
|
@ -63,11 +64,17 @@ To change the behaviour of the backlighting, `#define` these in your `config.h`:
|
|||
|Define |Default |Description |
|
||||
|---------------------|-------------|-------------------------------------------------------------------------------------------------------------|
|
||||
|`BACKLIGHT_PIN` |`B7` |The pin that controls the LEDs. Unless you are designing your own keyboard, you shouldn't need to change this|
|
||||
|`BACKLIGHT_PINS` |*Not defined*|experimental: see below for more information|
|
||||
|`BACKLIGHT_PINS` |*Not defined*|experimental: see below for more information |
|
||||
|`BACKLIGHT_LEVELS` |`3` |The number of brightness levels (maximum 15 excluding off) |
|
||||
|`BACKLIGHT_CAPS_LOCK`|*Not defined*|Enable Caps Lock indicator using backlight (for keyboards without dedicated LED) |
|
||||
|`BACKLIGHT_BREATHING`|*Not defined*|Enable backlight breathing, if supported |
|
||||
|`BACKLIGHT_BREATHING`|*Not defined*|Enable backlight breathing, if supported |
|
||||
|`BREATHING_PERIOD` |`6` |The length of one backlight "breath" in seconds |
|
||||
|`BACKLIGHT_ON_STATE` |`0` |The state of the backlight pin when the backlight is "on" - `1` for high, `0` for low |
|
||||
|
||||
## Backlight On State
|
||||
|
||||
Most backlight circuits are driven by an N-channel MOSFET or NPN transistor. This means that to turn the transistor *on* and light the LEDs, you must drive the backlight pin, connected to the gate or base, *low*.
|
||||
Sometimes, however, a P-channel MOSFET, or a PNP transistor is used. In this case you must `#define BACKLIGHT_ON_STATE 1`, so that when the transistor is on, the pin is driven *high* instead.
|
||||
|
||||
## Multiple backlight pins
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ To replace the function, all you need to do is add something like this to your c
|
|||
```c
|
||||
void bootmagic_lite(void) {
|
||||
matrix_scan();
|
||||
wait_ms(DEBOUNCING_DELAY * 2);
|
||||
wait_ms(DEBOUNCE * 2);
|
||||
matrix_scan();
|
||||
|
||||
if (matrix_get_row(BOOTMAGIC_LITE_ROW) & (1 << BOOTMAGIC_LITE_COLUMN)) {
|
||||
|
|
|
@ -29,6 +29,7 @@ enum combos {
|
|||
AB_ESC,
|
||||
JK_TAB
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM ab_combo[] = {KC_A, KC_B, COMBO_END};
|
||||
const uint16_t PROGMEM jk_combo[] = {KC_J, KC_K, COMBO_END};
|
||||
|
||||
|
@ -44,7 +45,7 @@ For a more complicated implementation, you can use the `process_combo_event` fun
|
|||
enum combo_events {
|
||||
ZC_COPY,
|
||||
XV_PASTE
|
||||
};
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM copy_combo[] = {KC_Z, KC_C, COMBO_END};
|
||||
const uint16_t PROGMEM paste_combo[] = {KC_X, KC_V, COMBO_END};
|
||||
|
|
|
@ -38,7 +38,7 @@ or `keymap.c`:
|
|||
} else {
|
||||
tap_code(KC_PGUP);
|
||||
}
|
||||
} else if (index == 1) { /* Second encoder
|
||||
} else if (index == 1) { /* Second encoder */
|
||||
if (clockwise) {
|
||||
tap_code(KC_UP);
|
||||
} else {
|
||||
|
|
|
@ -2,9 +2,19 @@
|
|||
|
||||
## OLED Supported Hardware
|
||||
|
||||
128x32 OLED modules using SSD1306 driver IC over I2C. Supported on AVR based keyboards. Possible but untested hardware includes ARM based keyboards and other sized OLED modules using SSD1306 over I2C, such as 128x64.
|
||||
OLED modules using SSD1306 or SH1106 driver ICs, communicating over I2C.
|
||||
Tested combinations:
|
||||
|
||||
!> Warning: This OLED Driver currently uses the new i2c_master driver from split common code. If your split keyboard uses i2c to communication between sides this driver could cause an address conflict (serial is fine). Please contact your keyboard vendor and ask them to migrate to the latest split common code to fix this.
|
||||
| IC driver | Size | Keyboard Platform | Notes |
|
||||
|-----------|--------|-------------------|--------------------------|
|
||||
| SSD1306 | 128x32 | AVR | Primary support |
|
||||
| SSD1306 | 128x64 | AVR | Verified working |
|
||||
| SSD1306 | 128x32 | ARM | |
|
||||
| SH1106 | 128x64 | AVR | No rotation or scrolling |
|
||||
|
||||
Hardware configurations using ARM-based microcontrollers or different sizes of OLED modules may be compatible, but are untested.
|
||||
|
||||
!> Warning: This OLED Driver currently uses the new i2c_master driver from split common code. If your split keyboard uses I2C to communicate between sides, this driver could cause an address conflict (serial is fine). Please contact your keyboard vendor and ask them to migrate to the latest split common code to fix this. In addition, the display timeout system to reduce OLED burn-in also uses split common to detect keypresses, so you will need to implement custom timeout logic for non-split common keyboards.
|
||||
|
||||
## Usage
|
||||
|
||||
|
@ -86,17 +96,17 @@ void oled_task_user(void) {
|
|||
|
||||
## Basic Configuration
|
||||
|
||||
|Define |Default |Description |
|
||||
|-----------------------|---------------|------------------------------------------------|
|
||||
|`OLED_DISPLAY_ADDRESS` |`0x3C` |The i2c address of the OLED Display |
|
||||
|`OLED_FONT_H` |`"glcdfont.c"` |The font code file to use for custom fonts |
|
||||
|`OLED_FONT_START` |`0` |The starting characer index for custom fonts |
|
||||
|`OLED_FONT_END` |`224` |The ending characer index for custom fonts |
|
||||
|`OLED_FONT_WIDTH` |`6` |The font width |
|
||||
|`OLED_FONT_HEIGHT` |`8` |The font height (untested) |
|
||||
|`OLED_DISABLE_TIMEOUT` |*Not defined* |Disables the built in OLED timeout feature. Useful when implementing custom timeout rules.|
|
||||
|
||||
|
||||
| Define | Default | Description |
|
||||
|------------------------|-------------------|----------------------------------------------------------------------------------------------------------------------------|
|
||||
| `OLED_DISPLAY_ADDRESS` | `0x3C` | The i2c address of the OLED Display |
|
||||
| `OLED_FONT_H` | `"glcdfont.c"` | The font code file to use for custom fonts |
|
||||
| `OLED_FONT_START` | `0` | The starting characer index for custom fonts |
|
||||
| `OLED_FONT_END` | `224` | The ending characer index for custom fonts |
|
||||
| `OLED_FONT_WIDTH` | `6` | The font width |
|
||||
| `OLED_FONT_HEIGHT` | `8` | The font height (untested) |
|
||||
| `OLED_DISABLE_TIMEOUT` | *Not defined* | Disables the built in OLED timeout feature. Useful when implementing custom timeout rules. |
|
||||
| `OLED_IC` | `OLED_IC_SSD1306` | Set to `OLED_IC_SH1106` if you're using the SH1106 OLED controller. |
|
||||
| `OLED_COLUMN_OFFSET` | `0` | (SH1106 only.) Shift output to the right this many pixels.<br />Useful for 128x64 displays centered on a 132x64 SH1106 IC. |
|
||||
|
||||
## 128x64 & Custom sized OLED Displays
|
||||
|
||||
|
@ -108,16 +118,19 @@ void oled_task_user(void) {
|
|||
|`OLED_DISPLAY_CUSTOM` |*Not defined* |Changes the display defines for use with custom displays.<br />Requires user to implement the below defines. |
|
||||
|`OLED_DISPLAY_WIDTH` |`128` |The width of the OLED display. |
|
||||
|`OLED_DISPLAY_HEIGHT` |`32` |The height of the OLED display. |
|
||||
|`OLED_MATRIX_SIZE` |`512` |The local buffer size to allocate.<br />`(OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH)`|
|
||||
|`OLED_BLOCK_TYPE` |`uint16_t` |The unsigned integer type to use for dirty rendering.|
|
||||
|`OLED_BLOCK_COUNT` |`16` |The number of blocks the display is divided into for dirty rendering.<br />`(sizeof(OLED_BLOCK_TYPE) * 8)`|
|
||||
|`OLED_BLOCK_SIZE` |`32` |The size of each block for dirty rendering<br />`(OLED_MATRIX_SIZE / OLED_BLOCK_COUNT)`|
|
||||
|`OLED_MATRIX_SIZE` |`512` |The local buffer size to allocate.<br />`(OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH)`. |
|
||||
|`OLED_BLOCK_TYPE` |`uint16_t` |The unsigned integer type to use for dirty rendering. |
|
||||
|`OLED_BLOCK_COUNT` |`16` |The number of blocks the display is divided into for dirty rendering.<br />`(sizeof(OLED_BLOCK_TYPE) * 8)`. |
|
||||
|`OLED_BLOCK_SIZE` |`32` |The size of each block for dirty rendering<br />`(OLED_MATRIX_SIZE / OLED_BLOCK_COUNT)`. |
|
||||
|`OLED_COM_PINS` |`COM_PINS_SEQ` |How the SSD1306 chip maps it's memory to display.<br />Options are `COM_PINS_SEQ`, `COM_PINS_ALT`, `COM_PINS_SEQ_LR`, & `COM_PINS_ALT_LR`. |
|
||||
|`OLED_SOURCE_MAP` |`{ 0, ... N }` |Precalculated source array to use for mapping source buffer to target OLED memory in 90 degree rendering. |
|
||||
|`OLED_TARGET_MAP` |`{ 24, ... N }`|Precalculated target array to use for mapping source buffer to target OLED memory in 90 degree rendering. |
|
||||
|
||||
|
||||
### 90 Degree Rotation - Technical Mumbo Jumbo
|
||||
|
||||
!> Rotation is unsupported on the SH1106.
|
||||
|
||||
```C
|
||||
// OLED Rotation enum values are flags
|
||||
typedef enum {
|
||||
|
@ -249,6 +262,8 @@ uint8_t oled_max_chars(void);
|
|||
uint8_t oled_max_lines(void);
|
||||
```
|
||||
|
||||
!> Scrolling and rotation are unsupported on the SH1106.
|
||||
|
||||
## SSD1306.h driver conversion guide
|
||||
|
||||
|Old API |Recommended New API |
|
||||
|
|
|
@ -30,9 +30,11 @@ Configure the hardware via your `config.h`:
|
|||
#define DRIVER_COUNT 2
|
||||
#define DRIVER_1_LED_TOTAL 25
|
||||
#define DRIVER_2_LED_TOTAL 24
|
||||
#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL
|
||||
#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
|
||||
```
|
||||
|
||||
!> Note the parentheses, this is so when `DRIVER_LED_TOTAL` is used in code and expanded, the values are added together before any additional math is applied to them. As an example, `rand() % (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)` will give very different results than `rand() % DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL`.
|
||||
|
||||
Currently only 2 drivers are supported, but it would be trivial to support all 4 combinations.
|
||||
|
||||
Define these arrays listing all the LEDs in your `<keyboard>.c`:
|
||||
|
@ -40,11 +42,11 @@ Define these arrays listing all the LEDs in your `<keyboard>.c`:
|
|||
```C
|
||||
const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
|
||||
/* Refer to IS31 manual for these locations
|
||||
* driver
|
||||
* | R location
|
||||
* | | G location
|
||||
* | | | B location
|
||||
* | | | | */
|
||||
* driver
|
||||
* | R location
|
||||
* | | G location
|
||||
* | | | B location
|
||||
* | | | | */
|
||||
{0, C1_3, C2_3, C3_3},
|
||||
....
|
||||
}
|
||||
|
@ -91,11 +93,11 @@ Define these arrays listing all the LEDs in your `<keyboard>.c`:
|
|||
```C
|
||||
const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
|
||||
/* Refer to IS31 manual for these locations
|
||||
* driver
|
||||
* | R location
|
||||
* | | G location
|
||||
* | | | B location
|
||||
* | | | | */
|
||||
* driver
|
||||
* | R location
|
||||
* | | G location
|
||||
* | | | B location
|
||||
* | | | | */
|
||||
{0, B_1, A_1, C_1},
|
||||
....
|
||||
}
|
||||
|
@ -142,14 +144,16 @@ const led_config_t g_led_config = { {
|
|||
} };
|
||||
```
|
||||
|
||||
The first part, `// Key Matrix to LED Index`, tells the system what key this LED represents by using the key's electrical matrix row & col. The second part, `// LED Index to Physical Position` represents the LED's physical position on the keyboard. The first value, `x`, is between 0-224 (inclusive), and the second value, `y`, is between 0-64 (inclusive). This range is due to effect that calculate the center or halves for their animations. The easiest way to calculate these positions is imagine your keyboard is a grid, and the top left of the keyboard represents x, y coordinate 0, 0 and the bottom right of your keyboard represents 224, 64. Using this as a basis, you can use the following formula to calculate the physical position:
|
||||
The first part, `// Key Matrix to LED Index`, tells the system what key this LED represents by using the key's electrical matrix row & col. The second part, `// LED Index to Physical Position` represents the LED's physical `{ x, y }` position on the keyboard. The default expected range of values for `{ x, y }` is the inclusive range `{ 0..224, 0..64 }`. This default expected range is due to effects that calculate the center of the keyboard for their animations. The easiest way to calculate these positions is imagine your keyboard is a grid, and the top left of the keyboard represents `{ x, y }` coordinate `{ 0, 0 }` and the bottom right of your keyboard represents `{ 224, 64 }`. Using this as a basis, you can use the following formula to calculate the physical position:
|
||||
|
||||
```C
|
||||
x = 224 / (NUMBER_OF_COLS - 1) * COL_POSITION
|
||||
y = 64 / (NUMBER_OF_ROWS - 1) * ROW_POSITION
|
||||
```
|
||||
|
||||
Where NUMBER_OF_COLS, NUMBER_OF_ROWS, COL_POSITION, & ROW_POSITION are all based on the physical layout of your keyboard, not the electrical layout.
|
||||
Where NUMBER_OF_COLS, NUMBER_OF_ROWS, COL_POSITION, & ROW_POSITION are all based on the physical layout of your keyboard, not the electrical layout.
|
||||
|
||||
As mentioned earlier, the center of the keyboard by default is expected to be `{ 112, 32 }`, but this can be changed if you want to more accurately calculate the LED's physical `{ x, y }` positions. Keyboard designers can implement `#define RGB_MATRIX_CENTER { 112, 32 }` in their config.h file with the new center point of the keyboard, or where they want it to be allowing more possibilities for the `{ x, y }` values. Do note that the maximum value for x or y is 255, and the recommended maximum is 224 as this gives animations runoff room before they reset.
|
||||
|
||||
`// LED Index to Flag` is a bitmask, whether or not a certain LEDs is of a certain type. It is recommended that LEDs are set to only 1 type.
|
||||
|
||||
|
@ -192,10 +196,20 @@ enum rgb_matrix_effects {
|
|||
RGB_MATRIX_ALPHAS_MODS, // Static dual hue, speed is hue for secondary hue
|
||||
RGB_MATRIX_GRADIENT_UP_DOWN, // Static gradient top to bottom, speed controls how much gradient changes
|
||||
RGB_MATRIX_BREATHING, // Single hue brightness cycling animation
|
||||
RGB_MATRIX_BAND_SAT, // Single hue band fading saturation scrolling left to right
|
||||
RGB_MATRIX_BAND_VAL, // Single hue band fading brightness scrolling left to right
|
||||
RGB_MATRIX_BAND_PINWHEEL_SAT, // Single hue 3 blade spinning pinwheel fades saturation
|
||||
RGB_MATRIX_BAND_PINWHEEL_VAL, // Single hue 3 blade spinning pinwheel fades brightness
|
||||
RGB_MATRIX_BAND_SPIRAL_SAT, // Single hue spinning spiral fades saturation
|
||||
RGB_MATRIX_BAND_SPIRAL_VAL, // Single hue spinning spiral fades brightness
|
||||
RGB_MATRIX_CYCLE_ALL, // Full keyboard solid hue cycling through full gradient
|
||||
RGB_MATRIX_CYCLE_LEFT_RIGHT, // Full gradient scrolling left to right
|
||||
RGB_MATRIX_CYCLE_UP_DOWN, // Full gradient scrolling top to bottom
|
||||
RGB_MATRIX_CYCLE_OUT_IN, // Full gradient scrolling out to in
|
||||
RGB_MATRIX_CYCLE_OUT_IN_DUAL, // Full dual gradients scrolling out to in
|
||||
RGB_MATRIX_RAINBOW_MOVING_CHEVRON, // Full gradent Chevron shapped scrolling left to right
|
||||
RGB_MATRIX_CYCLE_PINWHEEL, // Full gradient spinning pinwheel around center of keyboard
|
||||
RGB_MATRIX_CYCLE_SPIRAL, // Full gradient spinning spiral around center of keyboard
|
||||
RGB_MATRIX_DUAL_BEACON, // Full gradient spinning around center of keyboard
|
||||
RGB_MATRIX_RAINBOW_BEACON, // Full tighter gradient spinning around center of keyboard
|
||||
RGB_MATRIX_RAINBOW_PINWHEELS, // Full dual gradients spinning two halfs of keyboard
|
||||
|
@ -231,11 +245,21 @@ You can disable a single effect by defining `DISABLE_[EFFECT_NAME]` in your `con
|
|||
|`#define DISABLE_RGB_MATRIX_ALPHAS_MODS` |Disables `RGB_MATRIX_ALPHAS_MODS` |
|
||||
|`#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN` |Disables `RGB_MATRIX_GRADIENT_UP_DOWN` |
|
||||
|`#define DISABLE_RGB_MATRIX_BREATHING` |Disables `RGB_MATRIX_BREATHING` |
|
||||
|`#define DISABLE_RGB_MATRIX_BAND_SAT` |Disables `RGB_MATRIX_BAND_SAT` |
|
||||
|`#define DISABLE_RGB_MATRIX_BAND_VAL` |Disables `RGB_MATRIX_BAND_VAL` |
|
||||
|`#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT` |Disables `RGB_MATRIX_BAND_PINWHEEL_SAT` |
|
||||
|`#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL` |Disables `RGB_MATRIX_BAND_PINWHEEL_VAL` |
|
||||
|`#define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT` |Disables `RGB_MATRIX_BAND_SPIRAL_SAT` |
|
||||
|`#define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL` |Disables `RGB_MATRIX_BAND_SPIRAL_VAL` |
|
||||
|`#define DISABLE_RGB_MATRIX_CYCLE_ALL` |Disables `RGB_MATRIX_CYCLE_ALL` |
|
||||
|`#define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT` |Disables `RGB_MATRIX_CYCLE_LEFT_RIGHT` |
|
||||
|`#define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN` |Disables `RGB_MATRIX_CYCLE_UP_DOWN` |
|
||||
|`#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN` |Disables `RGB_MATRIX_CYCLE_OUT_IN` |
|
||||
|`#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL` |Disables `RGB_MATRIX_CYCLE_OUT_IN_DUAL` |
|
||||
|`#define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON` |Disables `RGB_MATRIX_RAINBOW_MOVING_CHEVRON` |
|
||||
|`#define DISABLE_RGB_MATRIX_DUAL_BEACON` |Disables `RGB_MATRIX_DUAL_BEACON` |
|
||||
|`#define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL` |Disables `RGB_MATRIX_CYCLE_PINWHEEL` |
|
||||
|`#define DISABLE_RGB_MATRIX_CYCLE_SPIRAL` |Disables `RGB_MATRIX_CYCLE_SPIRAL` |
|
||||
|`#define DISABLE_RGB_MATRIX_RAINBOW_BEACON` |Disables `RGB_MATRIX_RAINBOW_BEACON` |
|
||||
|`#define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS` |Disables `RGB_MATRIX_RAINBOW_PINWHEELS` |
|
||||
|`#define DISABLE_RGB_MATRIX_RAINDROPS` |Disables `RGB_MATRIX_RAINDROPS` |
|
||||
|
|
|
@ -129,7 +129,7 @@ The following options are used to tweak the various animations:
|
|||
|`RGBLIGHT_EFFECT_KNIGHT_LED_NUM` |`RGBLED_NUM` |The number of LEDs to have the "Knight" animation travel |
|
||||
|`RGBLIGHT_EFFECT_KNIGHT_LENGTH` |`3` |The number of LEDs to light up for the "Knight" animation |
|
||||
|`RGBLIGHT_EFFECT_KNIGHT_OFFSET` |`0` |The number of LEDs to start the "Knight" animation from the start of the strip by |
|
||||
|`RGBLIGHT_RAINBOW_SWIRL_RANGE` |`360` |Range adjustment for the rainbow swirl effect to get different swirls |
|
||||
|`RGBLIGHT_RAINBOW_SWIRL_RANGE` |`255` |Range adjustment for the rainbow swirl effect to get different swirls |
|
||||
|`RGBLIGHT_EFFECT_SNAKE_LENGTH` |`4` |The number of LEDs to light up for the "Snake" animation |
|
||||
|
||||
### Example Usage to Reduce Memory Footprint
|
||||
|
@ -176,44 +176,100 @@ const uint8_t RGBLED_GRADIENT_RANGES[] PROGMEM = {255, 170, 127, 85, 64};
|
|||
|
||||
If you need to change your RGB lighting in code, for example in a macro to change the color whenever you switch layers, QMK provides a set of functions to assist you. See [`rgblight.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight.h) for the full list, but the most commonly used functions include:
|
||||
|
||||
|Function |Description |
|
||||
|--------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
|`rgblight_enable()` |Turn LEDs on, based on their previous state |
|
||||
|`rgblight_enable_noeeprom()` |Turn LEDs on, based on their previous state (not written to EEPROM) |
|
||||
|`rgblight_disable()` |Turn LEDs off |
|
||||
|`rgblight_disable_noeeprom()` |Turn LEDs off (not written to EEPROM) |
|
||||
|`rgblight_mode(x)` |Set the mode, if RGB animations are enabled |
|
||||
|`rgblight_mode_noeeprom(x)` |Set the mode, if RGB animations are enabled (not written to EEPROM) |
|
||||
|`rgblight_setrgb(r, g, b)` |Set all LEDs to the given RGB value where `r`/`g`/`b` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_setrgb_at(r, g, b, led)` |Set a single LED to the given RGB value, where `r`/`g`/`b` are between 0 and 255 and `led` is between 0 and `RGBLED_NUM` (not written to EEPROM) |
|
||||
### Utility Functions
|
||||
|Function |Description |
|
||||
|--------------------------------------------|-------------------------------------------------------------------|
|
||||
|`sethsv(hue, sat, val, ledbuf)` |Set ledbuf to the given HSV value |
|
||||
|`sethsv_raw(hue, sat, val, ledbuf)` |Set ledbuf to the given HSV value without RGBLIGHT_LIMIT_VAL check |
|
||||
|`setrgb(r, g, b, ledbuf)` |Set ledbuf to the given RGB value where `r`/`g`/`b` |
|
||||
|
||||
### Low level Functions
|
||||
|Function |Description |
|
||||
|--------------------------------------------|-------------------------------------------|
|
||||
|`rgblight_set()` |Flash out led buffers to LEDs |
|
||||
|`rgblight_set_clipping_range(pos, num)` |Set clipping Range. see [Clipping Range](#clipping-range) |
|
||||
|
||||
Example:
|
||||
```c
|
||||
sethsv(HSV_WHITE, (LED_TYPE *)&led[0]); // led 0
|
||||
sethsv(HSV_RED, (LED_TYPE *)&led[1]); // led 1
|
||||
sethsv(HSV_GREEN, (LED_TYPE *)&led[2]); // led 2
|
||||
rgblight_set(); // Utility functions do not call rgblight_set() automatically, so they need to be called explicitly.
|
||||
```
|
||||
|
||||
### Effects and Animations Functions
|
||||
#### effect range setting
|
||||
|Function |Description |
|
||||
|--------------------------------------------|------------------|
|
||||
|`rgblight_set_effect_range(pos, num)` |Set Effects Range |
|
||||
|
||||
#### direct operation
|
||||
|Function |Description |
|
||||
|--------------------------------------------|-------------|
|
||||
|`rgblight_setrgb_at(r, g, b, index)` |Set a single LED to the given RGB value, where `r`/`g`/`b` are between 0 and 255 and `index` is between 0 and `RGBLED_NUM` (not written to EEPROM) |
|
||||
|`rgblight_sethsv_at(h, s, v, index)` |Set a single LED to the given HSV value, where `h`/`s`/`v` are between 0 and 255, and `index` is between 0 and `RGBLED_NUM` (not written to EEPROM) |
|
||||
|`rgblight_setrgb_range(r, g, b, start, end)`|Set a continuous range of LEDs to the given RGB value, where `r`/`g`/`b` are between 0 and 255 and `start`(included) and `stop`(excluded) are between 0 and `RGBLED_NUM` (not written to EEPROM)|
|
||||
|`rgblight_setrgb_master(r, g, b)` |Set the LEDs on the master side to the given RGB value, where `r`/`g`/`b` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_setrgb_slave(r, g, b)` |Set the LEDs on the slave side to the given RGB value, where `r`/`g`/`b` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_sethsv(h, s, v)` |Set all LEDs to the given HSV value where `h` is between 0 and 360 and `s`/`v` are between 0 and 255 |
|
||||
|`rgblight_sethsv_noeeprom(h, s, v)` |Set all LEDs to the given HSV value where `h` is between 0 and 360 and `s`/`v` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_sethsv_at(h, s, v, led)` |Set a single LED to the given HSV value, where `h` is between 0 and 360, `s`/`v` are between 0 and 255, and `led` is between 0 and `RGBLED_NUM` (not written to EEPROM)|
|
||||
|`rgblight_sethsv_range(h, s, v, start, end)`|Set a continuous range of LEDs to the given HSV value, where `h` is between 0 and 360, `s`/`v` are between 0 and 255, and `start`(included) and `stop`(excluded) are between 0 and `RGBLED_NUM` (not written to EEPROM)|
|
||||
|`rgblight_sethsv_master(h, s, v)` |Set the LEDs on the master side to the given HSV value, where `h` is between 0 and 360, `s`/`v` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_sethsv_slave(h, s, v)` |Set the LEDs on the slave side to the given HSV value, where `h` is between 0 and 360, `s`/`v` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_toggle()` |Toggle all LEDs between on and off |
|
||||
|`rgblight_toggle_noeeprom()` |Toggle all LEDs between on and off (not written to EEPROM) |
|
||||
|`rgblight_step()` |Change the mode to the next RGB animation in the list of enabled RGB animations |
|
||||
|`rgblight_step_noeeprom()` |Change the mode to the next RGB animation in the list of enabled RGB animations (not written to EEPROM) |
|
||||
|`rgblight_step_reverse()` |Change the mode to the previous RGB animation in the list of enabled RGB animations |
|
||||
|`rgblight_step_reverse_noeeprom()` |Change the mode to the previous RGB animation in the list of enabled RGB animations (not written to EEPROM) |
|
||||
|`rgblight_increase_hue()` |Increase the hue for all LEDs. This wraps around at maximum hue |
|
||||
|`rgblight_increase_hue_noeeprom()` |Increase the hue for all LEDs. This wraps around at maximum hue (not written to EEPROM) |
|
||||
|`rgblight_decrease_hue()` |Decrease the hue for all LEDs. This wraps around at minimum hue |
|
||||
|`rgblight_decrease_hue_noeeprom()` |Decrease the hue for all LEDs. This wraps around at minimum hue (not written to EEPROM) |
|
||||
|`rgblight_increase_sat()` |Increase the saturation for all LEDs. This wraps around at maximum saturation |
|
||||
|`rgblight_increase_sat_noeeprom()` |Increase the saturation for all LEDs. This wraps around at maximum saturation (not written to EEPROM) |
|
||||
|`rgblight_decrease_sat()` |Decrease the saturation for all LEDs. This wraps around at minimum saturation |
|
||||
|`rgblight_decrease_sat_noeeprom()` |Decrease the saturation for all LEDs. This wraps around at minimum saturation (not written to EEPROM) |
|
||||
|`rgblight_increase_val()` |Increase the value for all LEDs. This wraps around at maximum value |
|
||||
|`rgblight_increase_val_noeeprom()` |Increase the value for all LEDs. This wraps around at maximum value (not written to EEPROM) |
|
||||
|`rgblight_decrease_val()` |Decrease the value for all LEDs. This wraps around at minimum value |
|
||||
|`rgblight_decrease_val_noeeprom()` |Decrease the value for all LEDs. This wraps around at minimum value (not written to EEPROM) |
|
||||
|`rgblight_set_clipping_range(pos, num)` |Set clipping Range |
|
||||
|`rgblight_sethsv_range(h, s, v, start, end)`|Set a continuous range of LEDs to the given HSV value, where `h`/`s`/`v` are between 0 and 255, and `start`(included) and `stop`(excluded) are between 0 and `RGBLED_NUM` (not written to EEPROM)|
|
||||
|`rgblight_setrgb(r, g, b)` |Set effect range LEDs to the given RGB value where `r`/`g`/`b` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_setrgb_master(r, g, b)` |Set the LEDs on the master side to the given RGB value, where `r`/`g`/`b` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_setrgb_slave(r, g, b)` |Set the LEDs on the slave side to the given RGB value, where `r`/`g`/`b` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_sethsv_master(h, s, v)` |Set the LEDs on the master side to the given HSV value, where `h`/`s`/`v` are between 0 and 255 (not written to EEPROM) |
|
||||
|`rgblight_sethsv_slave(h, s, v)` |Set the LEDs on the slave side to the given HSV value, where `h`/`s`/`v` are between 0 and 255 (not written to EEPROM) |
|
||||
|
||||
Example:
|
||||
```c
|
||||
rgblight_sethsv(HSV_WHITE, 0); // led 0
|
||||
rgblight_sethsv(HSV_RED, 1); // led 1
|
||||
rgblight_sethsv(HSV_GREEN, 2); // led 2
|
||||
// The above functions automatically calls rgblight_set(), so there is no need to call it explicitly.
|
||||
// Note that it is inefficient to call repeatedly.
|
||||
```
|
||||
|
||||
#### effect mode change
|
||||
|Function |Description |
|
||||
|--------------------------------------------|-------------|
|
||||
|`rgblight_mode(x)` |Set the mode, if RGB animations are enabled |
|
||||
|`rgblight_mode_noeeprom(x)` |Set the mode, if RGB animations are enabled (not written to EEPROM) |
|
||||
|`rgblight_step()` |Change the mode to the next RGB animation in the list of enabled RGB animations |
|
||||
|`rgblight_step_noeeprom()` |Change the mode to the next RGB animation in the list of enabled RGB animations (not written to EEPROM) |
|
||||
|`rgblight_step_reverse()` |Change the mode to the previous RGB animation in the list of enabled RGB animations |
|
||||
|`rgblight_step_reverse_noeeprom()` |Change the mode to the previous RGB animation in the list of enabled RGB animations (not written to EEPROM) |
|
||||
|
||||
#### effects mode disable/enable
|
||||
|Function |Description |
|
||||
|--------------------------------------------|-------------|
|
||||
|`rgblight_toggle()` |Toggle effect range LEDs between on and off |
|
||||
|`rgblight_toggle_noeeprom()` |Toggle effect range LEDs between on and off (not written to EEPROM) |
|
||||
|`rgblight_enable()` |Turn effect range LEDs on, based on their previous state |
|
||||
|`rgblight_enable_noeeprom()` |Turn effect range LEDs on, based on their previous state (not written to EEPROM) |
|
||||
|`rgblight_disable()` |Turn effect range LEDs off |
|
||||
|`rgblight_disable_noeeprom()` |Turn effect range LEDs off (not written to EEPROM) |
|
||||
|
||||
#### hue, sat, val change
|
||||
|Function |Description |
|
||||
|--------------------------------------------|-------------|
|
||||
|`rgblight_increase_hue()` |Increase the hue for effect range LEDs. This wraps around at maximum hue |
|
||||
|`rgblight_increase_hue_noeeprom()` |Increase the hue for effect range LEDs. This wraps around at maximum hue (not written to EEPROM) |
|
||||
|`rgblight_decrease_hue()` |Decrease the hue for effect range LEDs. This wraps around at minimum hue |
|
||||
|`rgblight_decrease_hue_noeeprom()` |Decrease the hue for effect range LEDs. This wraps around at minimum hue (not written to EEPROM) |
|
||||
|`rgblight_increase_sat()` |Increase the saturation for effect range LEDs. This wraps around at maximum saturation |
|
||||
|`rgblight_increase_sat_noeeprom()` |Increase the saturation for effect range LEDs. This wraps around at maximum saturation (not written to EEPROM) |
|
||||
|`rgblight_decrease_sat()` |Decrease the saturation for effect range LEDs. This wraps around at minimum saturation |
|
||||
|`rgblight_decrease_sat_noeeprom()` |Decrease the saturation for effect range LEDs. This wraps around at minimum saturation (not written to EEPROM) |
|
||||
|`rgblight_increase_val()` |Increase the value for effect range LEDs. This wraps around at maximum value |
|
||||
|`rgblight_increase_val_noeeprom()` |Increase the value for effect range LEDs. This wraps around at maximum value (not written to EEPROM) |
|
||||
|`rgblight_decrease_val()` |Decrease the value for effect range LEDs. This wraps around at minimum value |
|
||||
|`rgblight_decrease_val_noeeprom()` |Decrease the value for effect range LEDs. This wraps around at minimum value (not written to EEPROM) |
|
||||
|`rgblight_sethsv(h, s, v)` |Set effect range LEDs to the given HSV value where `h`/`s`/`v` are between 0 and 255 |
|
||||
|`rgblight_sethsv_noeeprom(h, s, v)` |Set effect range LEDs to the given HSV value where `h`/`s`/`v` are between 0 and 255 (not written to EEPROM) |
|
||||
|
||||
#### query
|
||||
|Function |Description |
|
||||
|-----------------------|-----------------|
|
||||
|`rgblight_get_mode()` |Get current mode |
|
||||
|`rgblight_get_hue()` |Get current hue |
|
||||
|`rgblight_get_sat()` |Get current sat |
|
||||
|`rgblight_get_val()` |Get current val |
|
||||
|
||||
## Colors
|
||||
|
||||
|
@ -324,4 +380,6 @@ In addition to setting the Clipping Range, you can use `RGBLIGHT_LED_MAP` togeth
|
|||
```
|
||||
<img src="https://user-images.githubusercontent.com/2170248/55743747-119e4c00-5a6e-11e9-91e5-013203ffae8a.JPG" alt="clip mapped" width="70%"/>
|
||||
|
||||
## Hardware Modification
|
||||
|
||||
If your keyboard lacks onboard underglow LEDs, you may often be able to solder on an RGB LED strip yourself. You will need to find an unused pin to wire to the data pin of your LED strip. Some keyboards may break out unused pins from the MCU to make soldering easier. The other two pins, VCC and GND, must also be connected to the appropriate power pins.
|
||||
|
|
|
@ -20,7 +20,7 @@ Firstly, in your keymap, do one of the following:
|
|||
|`KC_RCPC` |Right Control when held, `)` when tapped |
|
||||
|`KC_LAPO` |Left Alt when held, `(` when tapped |
|
||||
|`KC_RAPC` |Right Alt when held, `)` when tapped |
|
||||
|`KC_SFTENT`|Right Shift when held, `Enter` when tapped |
|
||||
|`KC_SFTENT`|Right Shift when held, Enter when tapped |
|
||||
|
||||
## Caveats
|
||||
|
||||
|
@ -38,11 +38,12 @@ By default Space Cadet assumes a US ANSI layout, but if your layout uses differe
|
|||
|----------------|-------------------------------|---------------------------------------------------------------------------------|
|
||||
|`LSPO_KEYS` |`KC_LSFT, LSPO_MOD, LSPO_KEY` |Send `KC_LSFT` when held, the mod and key defined by `LSPO_MOD` and `LSPO_KEY`. |
|
||||
|`RSPC_KEYS` |`KC_RSFT, RSPC_MOD, RSPC_KEY` |Send `KC_RSFT` when held, the mod and key defined by `RSPC_MOD` and `RSPC_KEY`. |
|
||||
|`LCPO_KEYS` |`KC_LCTL, KC_LCTL, KC_9` |Send `KC_LCTL` when held, the mod `KC_LCTL` with the key `KC_9` when tapped. |
|
||||
|`RCPC_KEYS` |`KC_RCTL, KC_RCTL, KC_0` |Send `KC_RCTL` when held, the mod `KC_RCTL` with the key `KC_0` when tapped. |
|
||||
|`LAPO_KEYS` |`KC_LALT, KC_LALT, KC_9` |Send `KC_LALT` when held, the mod `KC_LALT` with the key `KC_9` when tapped. |
|
||||
|`RAPC_KEYS` |`KC_RALT, KC_RALT, KC_0` |Send `KC_RALT` when held, the mod `KC_RALT` with the key `KC_0` when tapped. |
|
||||
|`LCPO_KEYS` |`KC_LCTL, KC_LSFT, KC_9` |Send `KC_LCTL` when held, the mod `KC_LSFT` with the key `KC_9` when tapped. |
|
||||
|`RCPC_KEYS` |`KC_RCTL, KC_RSFT, KC_0` |Send `KC_RCTL` when held, the mod `KC_RSFT` with the key `KC_0` when tapped. |
|
||||
|`LAPO_KEYS` |`KC_LALT, KC_LSFT, KC_9` |Send `KC_LALT` when held, the mod `KC_LSFT` with the key `KC_9` when tapped. |
|
||||
|`RAPC_KEYS` |`KC_RALT, KC_RSFT, KC_0` |Send `KC_RALT` when held, the mod `KC_RSFT` with the key `KC_0` when tapped. |
|
||||
|`SFTENT_KEYS` |`KC_RSFT, KC_TRNS, SFTENT_KEY` |Send `KC_RSFT` when held, no mod with the key `SFTENT_KEY` when tapped. |
|
||||
|`SPACE_CADET_MODIFIER_CARRYOVER` |*Not defined* |Store current modifiers before the hold mod is pressed and use them with the tap mod and keycode. Useful for when you frequently release a modifier before triggering Space Cadet. |
|
||||
|
||||
|
||||
## Obsolete Configuration
|
||||
|
|
|
@ -1,28 +1,44 @@
|
|||
# Unicode Support
|
||||
|
||||
There are three Unicode keymap definition methods available in QMK:
|
||||
Unicode characters can be input straight from your keyboard! There are some limitations, however.
|
||||
|
||||
## `UNICODE_ENABLE`
|
||||
QMK has three different methods for enabling Unicode input and defining keycodes:
|
||||
|
||||
Supports Unicode up to `0x7FFF`. This covers characters for most modern languages, as well as symbols, but it doesn't cover emoji. The keycode function is `UC(c)` in the keymap, where _c_ is the code point's number (preferably hexadecimal, up to 4 digits long). For example: `UC(0x45B)`, `UC(0x30C4)`.
|
||||
## Basic Unicode
|
||||
|
||||
## `UNICODEMAP_ENABLE`
|
||||
This method supports Unicode code points up to `0x7FFF`. This covers characters for most modern languages, as well as symbols, but it doesn't cover emoji.
|
||||
|
||||
Supports Unicode up to `0x10FFFF` (all possible code points). You need to maintain a separate mapping table `const uint32_t PROGMEM unicode_map[] = {...}` in your keymap file. The keycode function is `X(i)`, where _i_ is an array index into the mapping table. The table may contain at most 16384 entries.
|
||||
Add the following to your `rules.mk`:
|
||||
|
||||
You may want to have an enum to make referencing easier. So, you could add something like this to your keymap file:
|
||||
```make
|
||||
UNICODE_ENABLE = yes
|
||||
```
|
||||
|
||||
Then add `UC(c)` keycodes to your keymap, where _c_ is the code point (preferably in hexadecimal, up to 4 digits long). For example: `UC(0x45B)`, `UC(0x30C4)`.
|
||||
|
||||
## Unicode Map
|
||||
|
||||
This method supports all possible code points (up to `0x10FFFF`); however, you need to maintain a separate mapping table in your keymap file, which may contain at most 16384 entries.
|
||||
|
||||
Add the following to your `rules.mk`:
|
||||
|
||||
```make
|
||||
UNICODEMAP_ENABLE = yes
|
||||
```
|
||||
|
||||
Then add `X(i)` keycodes to your keymap, where _i_ is an array index into the mapping table:
|
||||
|
||||
```c
|
||||
enum unicode_names {
|
||||
BANG,
|
||||
IRONY,
|
||||
SNEK,
|
||||
BANG,
|
||||
IRONY,
|
||||
SNEK
|
||||
};
|
||||
|
||||
const uint32_t PROGMEM unicode_map[] = {
|
||||
[BANG] = 0x203D, // ‽
|
||||
[IRONY] = 0x2E2E, // ⸮
|
||||
[SNEK] = 0x1F40D, // 🐍
|
||||
[BANG] = 0x203D, // ‽
|
||||
[IRONY] = 0x2E2E, // ⸮
|
||||
[SNEK] = 0x1F40D, // 🐍
|
||||
};
|
||||
```
|
||||
|
||||
|
@ -30,27 +46,33 @@ Then you can use `X(BANG)`, `X(SNEK)` etc. in your keymap.
|
|||
|
||||
### Lower and Upper Case
|
||||
|
||||
Characters often come in lower and upper case pairs, for example: å, Å. To make inputting these characters easier, you can use `XP(i, j)` in your keymap, where _i_ and _j_ are the mapping table indices of the lower and upper case character, respectively. If you're holding down Shift or have Caps Lock turned on when you press the key, the second (upper case) character will be inserted; otherwise, the first (lower case) version will appear.
|
||||
Characters often come in lower and upper case pairs, such as å and Å. To make inputting these characters easier, you can use `XP(i, j)` in your keymap, where _i_ and _j_ are the mapping table indices of the lower and upper case character, respectively. If you're holding down Shift or have Caps Lock turned on when you press the key, the second (upper case) character will be inserted; otherwise, the first (lower case) version will appear.
|
||||
|
||||
This is most useful when creating a keymap for an international layout with special characters. Instead of having to put the lower and upper case versions of a character on separate keys, you can have them both on the same key by using `XP`. This blends Unicode keys in with regular alphas.
|
||||
This is most useful when creating a keymap for an international layout with special characters. Instead of having to put the lower and upper case versions of a character on separate keys, you can have them both on the same key by using `XP()`. This helps blend Unicode keys in with regular alphas.
|
||||
|
||||
Due to keycode size constraints, _i_ and _j_ can each only refer to one of the first 128 characters in your `unicode_map`. In other words, 0 ≤ _i_ ≤ 127 and 0 ≤ _j_ ≤ 127. This is enough for most use cases, but if you'd like to customize the index calculation, you can override the [`unicodemap_index()`](https://github.com/qmk/qmk_firmware/blob/71f640d47ee12c862c798e1f56392853c7b1c1a8/quantum/process_keycode/process_unicodemap.c#L40) function. This also allows you to, say, check Ctrl instead of Shift/Caps.
|
||||
|
||||
## `UCIS_ENABLE`
|
||||
## UCIS
|
||||
|
||||
Supports Unicode up to `0x10FFFF` (all possible code points). As with `UNICODEMAP`, you need to maintain a mapping table in your keymap file. However, there are no built-in keycodes for this feature — you have to add a keycode or function that calls `qk_ucis_start()`. Once this function has been called, you can type the corresponding mnemonic for your character, then hit Space or Enter to complete it, or Esc to cancel. If the mnemonic matches an entry in your table, the typed text will automatically be erased and the corresponding Unicode character inserted.
|
||||
This method also supports all possible code points. As with the Unicode Map method, you need to maintain a mapping table in your keymap file. However, there are no built-in keycodes for this feature — you have to create a custom keycode or function that invokes this functionality.
|
||||
|
||||
For instance, you could define a table like this in your keymap file:
|
||||
Add the following to your `rules.mk`:
|
||||
|
||||
```make
|
||||
UCIS_ENABLE = yes
|
||||
```
|
||||
|
||||
Then define a table like this in your keymap file:
|
||||
|
||||
```c
|
||||
const qk_ucis_symbol_t ucis_symbol_table[] = UCIS_TABLE(
|
||||
UCIS_SYM("poop", 0x1F4A9), // 💩
|
||||
UCIS_SYM("rofl", 0x1F923), // 🤣
|
||||
UCIS_SYM("kiss", 0x1F619) // 😙
|
||||
UCIS_SYM("poop", 0x1F4A9), // 💩
|
||||
UCIS_SYM("rofl", 0x1F923), // 🤣
|
||||
UCIS_SYM("kiss", 0x1F619) // 😙
|
||||
);
|
||||
```
|
||||
|
||||
To use it, call `qk_ucis_start()`, then type "rofl" and hit Enter. QMK should erase the "rofl" text and insert the laughing emoji.
|
||||
To use it, call `qk_ucis_start()`. Then, type the mnemonic for the character (such as "rofl"), and hit Space or Enter. QMK should erase the "rofl" text and insert the laughing emoji.
|
||||
|
||||
### Customization
|
||||
|
||||
|
@ -68,7 +90,7 @@ Unicode input in QMK works by inputting a sequence of characters to the OS, sort
|
|||
|
||||
The following input modes are available:
|
||||
|
||||
* **`UC_OSX`**: macOS built-in Unicode hex input. Supports code points up to `0xFFFF` (`0x10FFFF` with `UNICODEMAP`).
|
||||
* **`UC_OSX`**: macOS built-in Unicode hex input. Supports code points up to `0xFFFF` (`0x10FFFF` with Unicode Map).
|
||||
|
||||
To enable, go to _System Preferences > Keyboard > Input Sources_, add _Unicode Hex Input_ to the list (it's under _Other_), then activate it from the input dropdown in the Menu Bar.
|
||||
By default, this mode uses the left Option key (`KC_LALT`) for Unicode input, but this can be changed by defining [`UNICODE_KEY_OSX`](#input-key-configuration) with another keycode.
|
||||
|
@ -112,7 +134,7 @@ You can also switch the input mode by calling `set_unicode_input_mode(x)` in you
|
|||
|
||||
```c
|
||||
void eeconfig_init_user(void) {
|
||||
set_unicode_input_mode(UC_LNX);
|
||||
set_unicode_input_mode(UC_LNX);
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ QMK has a bunch of [functions](custom_quantum_functions.md) that have [`_quantum
|
|||
However, you can actually add support for keymap version, so that you can use it in both your userspace and your keymap!
|
||||
|
||||
|
||||
For instance, lets looks at the `layer_state_set_user` function. Lets enable the [Tri Layer State](ref_functions.md#olkb-tri-layers) functionalitly to all of our boards, and then still have your `keymap.c` still able to use this functionality.
|
||||
For instance, let's look at the `layer_state_set_user()` function. You can enable the [Tri Layer State](ref_functions.md#olkb-tri-layers) functionality on all of your boards, while also retaining the Tri Layer functionality in your `keymap.c` files.
|
||||
|
||||
In your `<name.c>` file, you'd want to add this:
|
||||
```c
|
||||
|
|
|
@ -7,12 +7,15 @@ QMK has a staggering number of features for building your keyboard. It can take
|
|||
* [Audio](feature_audio.md) - Connect a speaker to your keyboard for audio feedback, midi support, and music mode.
|
||||
* [Auto Shift](feature_auto_shift.md) - Tap for the normal key, hold slightly longer for its shifted state.
|
||||
* [Backlight](feature_backlight.md) - LED lighting support for your keyboard.
|
||||
* [Bluetooth](feature_bluetooth.md) - BlueTooth support for your keyboard.
|
||||
* [Bootmagic](feature_bootmagic.md) - Adjust the behavior of your keyboard using hotkeys.
|
||||
* [Combos](feature_combo.md) - Custom actions for multiple key holds.
|
||||
* [Command](feature_command.md) - Runtime version of bootmagic (Formerly known as "Magic").
|
||||
* [Debounce API](feature_debounce_type.md) - Customization of debouncing algorithms, and the ability to add more/custom debouncing.
|
||||
* [Dynamic Macros](feature_dynamic_macros.md) - Record and playback macros from the keyboard itself.
|
||||
* [Encoders](feature_encoders.md) - Rotary encoders!
|
||||
* [Grave Escape](feature_grave_esc.md) - Lets you use a single key for Esc and Grave.
|
||||
* [Haptic Feedback](feature_haptic_feedback.md) - Add haptic feedback drivers to your board.
|
||||
* [HD44780 LCD Display](feature_hd44780.md) - Support for LCD character displays using the HD44780 standard.
|
||||
* [Key Lock](feature_key_lock.md) - Lock a key in the "down" state.
|
||||
* [Layouts](feature_layouts.md) - Use one keymap with any keyboard that supports your layout.
|
||||
|
@ -20,7 +23,8 @@ QMK has a staggering number of features for building your keyboard. It can take
|
|||
* [LED Matrix](feature_led_matrix.md) - LED Matrix single color lights for per key lighting (Single Color, not RGB).
|
||||
* [Macros](feature_macros.md) - Send multiple key presses when pressing only one physical key.
|
||||
* [Mouse keys](feature_mouse_keys.md) - Control your mouse pointer from your keyboard.
|
||||
* [One Shot Keys](feature_advanced_keycodes.md#one-shot-keys) - Sticky Keys, lets hit a key rather than holding it.
|
||||
* [OLED Driver](feature_oled_driver.md) - Add OLED screens to your keyboard.
|
||||
* [One Shot Keys](feature_advanced_keycodes.md#one-shot-keys) - Sticky Keys, lets you hit a key rather than holding it.
|
||||
* [Pointing Device](feature_pointing_device.md) - Framework for connecting your custom pointing device to your keyboard.
|
||||
* [PS2 Mouse](feature_ps2_mouse.md) - Driver for connecting a PS/2 mouse directly to your keyboard.
|
||||
* [RGB Light](feature_rgblight.md) - RGB lighting for your keyboard.
|
||||
|
@ -33,3 +37,4 @@ QMK has a staggering number of features for building your keyboard. It can take
|
|||
* [Thermal Printer](feature_thermal_printer.md) - Connect a thermal printer to your keyboard to be able to toggle on a printed log of everything you type.
|
||||
* [Unicode](feature_unicode.md) - Unicode input support.
|
||||
* [Userspace](feature_userspace.md) - Share code between different keymaps and keyboards.
|
||||
* [Velocikey](feature_velocikey.md) - Allows changes in RGB animation speed based on WPM/Typing speed.
|
||||
|
|
|
@ -62,14 +62,14 @@ If you're using [homebrew,](http://brew.sh/) you can use the following commands:
|
|||
brew tap osx-cross/avr
|
||||
brew tap PX4/homebrew-px4
|
||||
brew update
|
||||
brew install avr-gcc@7
|
||||
brew link --force avr-gcc@7
|
||||
brew install avr-gcc@8
|
||||
brew link --force avr-gcc@8
|
||||
brew install dfu-programmer
|
||||
brew install dfu-util
|
||||
brew install gcc-arm-none-eabi
|
||||
brew install avrdude
|
||||
|
||||
This is the recommended method. If you don't have homebrew, [install it!](http://brew.sh/) It's very much worth it for anyone who works in the command line. Note that the `make` and `make install` portion during the homebrew installation of `avr-gcc@7` can take over 20 minutes and exhibit high CPU usage.
|
||||
This is the recommended method. If you don't have homebrew, [install it!](http://brew.sh/) It's very much worth it for anyone who works in the command line. Note that the `make` and `make install` portion during the homebrew installation of `avr-gcc@8` can take over 20 minutes and exhibit high CPU usage.
|
||||
|
||||
## Windows with msys2 (recommended)
|
||||
|
||||
|
|
|
@ -12,11 +12,17 @@ Within the folder `users` is a directory for each user. This is a place for user
|
|||
|
||||
### Keyboard Project Structure
|
||||
|
||||
Within the folder `keyboards` and its subfolder `handwired` is a directory for each keyboard project, for example `qmk_firmware/keyboards/clueboard`. Within it you'll find the following structure:
|
||||
Within the folder `keyboards`, its subfolder `handwired` and its vendor and manufacture subdirectories e.g. `clueboard` is a directory for each keyboard project, for example `qmk_firmware/keyboards/clueboard/2x1800`. Within it, you'll find the following structure:
|
||||
|
||||
* `keymaps/`: Different keymaps that can be built
|
||||
* `rules.mk`: The file that sets the default "make" options. Do not edit this file directly, instead use a keymap specific `rules.mk`.
|
||||
* `config.h`: The file that sets the default compile time options. Do not edit this file directly, instead use a keymap specific `config.h`.
|
||||
* `info.json`: The file used for setting layout for QMK Configurator. See [Configurator Support](reference_configurator_support.md) for more information.
|
||||
* `readme.md`: A brief overview of the keyboard.
|
||||
* `<keyboardName>.h`: This file is where the keyboard layout is defined against the keyboard's switch matrix.
|
||||
* `<keyboardName>.c`: This file is where you can find custom code for the keyboard.
|
||||
|
||||
For more information on project structure, see [QMK Keyboard Guidelines](hardware_keyboard_guidelines.md).
|
||||
|
||||
### Keymap Structure
|
||||
|
||||
|
|
|
@ -63,10 +63,10 @@ You may wonder why a keyboard layout containing all of Unicode is not devised th
|
|||
|
||||
## How to (Maybe) Enter Unicode Characters
|
||||
|
||||
You can have the firmware send *sequences of keys* to use the [software Unicode Input Method](https://en.wikipedia.org/wiki/Unicode_input#Hexadecimal_code_input) of the target operating system, thus effectively entering characters independently of the layout defined in the OS.
|
||||
You can have the firmware send *sequences of keys* to use the [software Unicode Input Method](https://en.wikipedia.org/wiki/Unicode_input#Hexadecimal_input) of the target operating system, thus effectively entering characters independently of the layout defined in the OS.
|
||||
|
||||
Yet, it does come with multiple disadvantages:
|
||||
|
||||
- Tied to a specific OS a a time (need recompilation when changing OS);
|
||||
- Tied to a specific OS at a time (need recompilation when changing OS);
|
||||
- Within a given OS, does not work in all software;
|
||||
- Limited to a subset of Unicode on some systems.
|
||||
|
|
|
@ -65,11 +65,30 @@ By default the I2C1 hardware driver is assumed to be used. If another hardware d
|
|||
|
||||
STM32 MCUs allows a variety of pins to be configured as I2C pins depending on the hardware driver used. By default B6 and B7 are set to I2C. You can use these defines to set your i2c pins:
|
||||
|
||||
| Variable | Description | Default |
|
||||
|-------------|----------------------------------------------|---------|
|
||||
| `I2C1_BANK` | The bank of pins (`GPIOA`, `GPIOB`, `GPIOC`) | `GPIOB` |
|
||||
| `I2C1_SCL` | The pin number for the SCL pin (0-9) | `6` |
|
||||
| `I2C1_SDA` | The pin number for the SDA pin (0-9) | `7` |
|
||||
| Variable | Description | Default |
|
||||
|--------------------------|----------------------------------------------------------------------------------------------|---------|
|
||||
| `I2C1_SCL_BANK` | The bank of pins (`GPIOA`, `GPIOB`, `GPIOC`) to use for SCL | `GPIOB` |
|
||||
| `I2C1_SDA_BANK` | The bank of pins (`GPIOA`, `GPIOB`, `GPIOC`) to use for SDA | `GPIOB` |
|
||||
| `I2C1_SCL` | The pin number for the SCL pin (0-9) | `6` |
|
||||
| `I2C1_SDA` | The pin number for the SDA pin (0-9) | `7` |
|
||||
| `I2C1_BANK` (deprecated) | The bank of pins (`GPIOA`, `GPIOB`, `GPIOC`), superceded by `I2C1_SCL_BANK`, `I2C1_SDA_BANK` | `GPIOB` |
|
||||
|
||||
STM32 MCUs allow for different timing parameters when configuring I2C. These can be modified using the following parameters, using https://www.st.com/en/embedded-software/stsw-stm32126.html as a reference:
|
||||
|
||||
| Variable | Default |
|
||||
|-----------------------|---------|
|
||||
| `I2C1_TIMINGR_PRESC` | `15U` |
|
||||
| `I2C1_TIMINGR_SCLDEL` | `4U` |
|
||||
| `I2C1_TIMINGR_SDADEL` | `2U` |
|
||||
| `I2C1_TIMINGR_SCLH` | `15U` |
|
||||
| `I2C1_TIMINGR_SCLL` | `21U` |
|
||||
|
||||
STM32 MCUs allow for different "alternate function" modes when configuring GPIO pins. These are required to switch the pins used to I2C mode. See the respective datasheet for the appropriate values for your MCU.
|
||||
|
||||
| Variable | Default |
|
||||
|---------------------|---------|
|
||||
| `I2C1_SCL_PAL_MODE` | `4` |
|
||||
| `I2C1_SDA_PAL_MODE` | `4` |
|
||||
|
||||
You can also overload the `void i2c_init(void)` function, which has a weak attribute. If you do this the configuration variables above will not be used. Please consult the datasheet of your MCU for the available GPIO configurations. The following is an example initialization function:
|
||||
|
||||
|
|
|
@ -5,7 +5,13 @@
|
|||
<title>QMK Firmware</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="description" content="Description">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta property="og:title" content="QMK Firmware Docs">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:description" content="The full documenation of the open-source firmware">
|
||||
<meta property="og:image" content="https://i.imgur.com/svjvIrw.jpg">
|
||||
<meta property="og:url" content="https://docs.qmk.fm">
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css" title="light">
|
||||
<link rel="stylesheet" href="qmk.css" title="dark" disabled>
|
||||
<link rel="stylesheet" href="sidebar.css" />
|
||||
|
|
|
@ -216,6 +216,11 @@ This is a reference only. Each group of keys links to the page documenting their
|
|||
|`KC_GESC` |`GRAVE_ESC`|Escape when tapped, <code>`</code> when pressed with Shift or GUI|
|
||||
|`KC_LSPO` | |Left Shift when held, `(` when tapped |
|
||||
|`KC_RSPC` | |Right Shift when held, `)` when tapped |
|
||||
|`KC_LCPO` | |Left Control when held, `(` when tapped |
|
||||
|`KC_RCPC` | |Right Control when held, `)` when tapped |
|
||||
|`KC_LAPO` | |Left Alt when held, `(` when tapped |
|
||||
|`KC_RAPC` | |Right Alt when held, `)` when tapped |
|
||||
|`KC_SFTENT` | |Right Shift when held, Enter when tapped |
|
||||
|`KC_LEAD` | |The [Leader key](feature_leader_key.md) |
|
||||
|`KC_LOCK` | |The [Lock key](feature_key_lock.md) |
|
||||
|`FUNC(n)` |`F(n)` |Call `fn_action(n)` (deprecated) |
|
||||
|
@ -293,7 +298,7 @@ This is a reference only. Each group of keys links to the page documenting their
|
|||
|`LM(layer, mod)`|Momentarily turn on `layer` (like MO) with `mod` active as well. Where `mod` is a mods_bit. Mods can be viewed [here](https://docs.qmk.fm/#/feature_advanced_keycodes?id=mod-tap). Example Implementation: `LM(LAYER_1, MOD_LALT)`|
|
||||
|`LT(layer, kc)` |Turn on `layer` when held, `kc` when tapped |
|
||||
|`TG(layer)` |Toggle `layer` on or off |
|
||||
|`TO(layer)` |Turn on `layer` when pressed |
|
||||
|`TO(layer)` |Turns on `layer` and turns off all other layers, except the default layer |
|
||||
|`TT(layer)` |Normally acts like MO unless it's tapped multiple times, which toggles `layer` on |
|
||||
|
||||
## [Mouse Keys](feature_mouse_keys.md)
|
||||
|
@ -339,23 +344,24 @@ This is a reference only. Each group of keys links to the page documenting their
|
|||
|
||||
## [Mod-Tap Keys](feature_advanced_keycodes.md#mod-tap)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|------------|-----------------------------------------------------------------|-------------------------------------------------------|
|
||||
|`LCTL_T(kc)`|`CTL_T(kc)` |Left Control when held, `kc` when tapped |
|
||||
|`LSFT_T(kc)`|`SFT_T(kc)` |Left Shift when held, `kc` when tapped |
|
||||
|`LALT_T(kc)`|`ALT_T(kc)` |Left Alt when held, `kc` when tapped |
|
||||
|`LGUI_T(kc)`|`LCMD_T(kc)`, `LWIN_T(kc)`, `GUI_T(kc)`, `CMD_T(kc)`, `WIN_T(kc)`|Left GUI when held, `kc` when tapped |
|
||||
|`RCTL_T(kc)`| |Right Control when held, `kc` when tapped |
|
||||
|`RSFT_T(kc)`| |Right Shift when held, `kc` when tapped |
|
||||
|`RALT_T(kc)`|`ALGR_T(kc)` |Right Alt when held, `kc` when tapped |
|
||||
|`RGUI_T(kc)`|`RCMD_T(kc)`, `RWIN_T(kc)` |Right GUI when held, `kc` when tapped |
|
||||
|`SGUI_T(kc)`|`SCMD_T(kc)`, `SWIN_T(kc)` |Left Shift and GUI when held, `kc` when tapped |
|
||||
|`LCA_T(kc)` | |Left Control and Alt when held, `kc` when tapped |
|
||||
|`LCAG_T(kc)`| |Left Control, Alt and GUI when held, `kc` when tapped |
|
||||
|`RCAG_T(kc)`| |Right Control, Alt and GUI when held, `kc` when tapped |
|
||||
|`C_S_T(kc)` | |Left Control and Shift when held, `kc` when tapped |
|
||||
|`MEH_T(kc)` | |Left Control, Shift and Alt when held, `kc` when tapped|
|
||||
|`HYPR_T(kc)`|`ALL_T(kc)` |Left Control, Shift, Alt and GUI when held, `kc` when tapped - more info [here](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)|
|
||||
|Key |Aliases |Description |
|
||||
|-------------|-----------------------------------------------------------------|-------------------------------------------------------|
|
||||
|`MT(mod, kc)`| |`mod` when held, `kc` when tapped |
|
||||
|`LCTL_T(kc)` |`CTL_T(kc)` |Left Control when held, `kc` when tapped |
|
||||
|`LSFT_T(kc)` |`SFT_T(kc)` |Left Shift when held, `kc` when tapped |
|
||||
|`LALT_T(kc)` |`ALT_T(kc)` |Left Alt when held, `kc` when tapped |
|
||||
|`LGUI_T(kc)` |`LCMD_T(kc)`, `LWIN_T(kc)`, `GUI_T(kc)`, `CMD_T(kc)`, `WIN_T(kc)`|Left GUI when held, `kc` when tapped |
|
||||
|`RCTL_T(kc)` | |Right Control when held, `kc` when tapped |
|
||||
|`RSFT_T(kc)` | |Right Shift when held, `kc` when tapped |
|
||||
|`RALT_T(kc)` |`ALGR_T(kc)` |Right Alt when held, `kc` when tapped |
|
||||
|`RGUI_T(kc)` |`RCMD_T(kc)`, `RWIN_T(kc)` |Right GUI when held, `kc` when tapped |
|
||||
|`SGUI_T(kc)` |`SCMD_T(kc)`, `SWIN_T(kc)` |Left Shift and GUI when held, `kc` when tapped |
|
||||
|`LCA_T(kc)` | |Left Control and Alt when held, `kc` when tapped |
|
||||
|`LCAG_T(kc)` | |Left Control, Alt and GUI when held, `kc` when tapped |
|
||||
|`RCAG_T(kc)` | |Right Control, Alt and GUI when held, `kc` when tapped |
|
||||
|`C_S_T(kc)` | |Left Control and Shift when held, `kc` when tapped |
|
||||
|`MEH_T(kc)` | |Left Control, Shift and Alt when held, `kc` when tapped|
|
||||
|`HYPR_T(kc)` |`ALL_T(kc)` |Left Control, Shift, Alt and GUI when held, `kc` when tapped - more info [here](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)|
|
||||
|
||||
## [RGB Lighting](feature_rgblight.md)
|
||||
|
||||
|
|
|
@ -127,9 +127,7 @@ Once it does this, you'll want to reset the controller. It should then show out
|
|||
>>> dfu-programmer atmega32u4 reset
|
||||
```
|
||||
|
||||
If you have any issues with this, you may need to this:
|
||||
|
||||
sudo make <my_keyboard>:<my_keymap>:dfu
|
||||
?> If you have any issues with this - such as `dfu-programmer: no device present` - please see the [Frequently Asked Build Questions](faq_build.md).
|
||||
|
||||
#### DFU commands
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Quantum Keycodes
|
||||
|
||||
Quantum keycodes allow for easier customisation of your keymap than the basic ones provide, without having to define custom actions.
|
||||
Quantum keycodes allow for easier customization of your keymap than the basic ones provide, without having to define custom actions.
|
||||
|
||||
All keycodes within quantum are numbers between `0x0000` and `0xFFFF`. Within your `keymap.c` it may look like you have functions and other special cases, but ultimately the C preprocessor will translate those into a single 4 byte integer. QMK has reserved `0x0000` through `0x00FF` for standard keycodes. These are keycodes such as `KC_A`, `KC_1`, and `KC_LCTL`, which are basic keys defined in the USB HID specification.
|
||||
|
||||
|
@ -16,6 +16,11 @@ On this page we have documented keycodes between `0x00FF` and `0xFFFF` which are
|
|||
|`KC_GESC` |`GRAVE_ESC`|Escape when tapped, <code>`</code> when pressed with Shift or GUI|
|
||||
|`KC_LSPO` | |Left Shift when held, `(` when tapped |
|
||||
|`KC_RSPC` | |Right Shift when held, `)` when tapped |
|
||||
|`KC_LCPO` | |Left Control when held, `(` when tapped |
|
||||
|`KC_RCPC` | |Right Control when held, `)` when tapped |
|
||||
|`KC_LAPO` | |Left Alt when held, `(` when tapped |
|
||||
|`KC_RAPC` | |Right Alt when held, `)` when tapped |
|
||||
|`KC_SFTENT` | |Right Shift when held, Enter when tapped |
|
||||
|`KC_LEAD` | |The [Leader key](feature_leader_key.md) |
|
||||
|`KC_LOCK` | |The [Lock key](feature_key_lock.md) |
|
||||
|`FUNC(n)` |`F(n)` |Call `fn_action(n)` (deprecated) |
|
||||
|
|
|
@ -89,7 +89,7 @@ Once the layout is as desired, move to the Raw Data tab in KLE, and copy the con
|
|||
|
||||
To convert this data into our JSON, go to the [QMK KLE-JSON Converter](https://qmk.fm/converter/), paste the Raw Data into the Input field, and click the Convert button. After a moment, our JSON data will appear in the Output field. Copy the contents to a new text document, and name the document `info.json`, saving it in the same folder that contains `numpad.h`.
|
||||
|
||||
Use the `keyboard_name` object to set the name of the keyboard. The `bootloader` object is deprecated, so it can be deleted. For instruction purposes, we will put each key's object on its own line. This is only to make the file more human-readable, and does not affect the Configurator's functionality.
|
||||
Use the `keyboard_name` object to set the name of the keyboard. For instruction purposes, we will put each key's object on its own line. This is only to make the file more human-readable, and does not affect the Configurator's functionality.
|
||||
|
||||
```json
|
||||
{
|
||||
|
|
|
@ -7,27 +7,27 @@
|
|||
* [学习资源](newbs_learn_more_resources.md)
|
||||
|
||||
* [QMK基础](README.md)
|
||||
* [QMK 简介](getting_started_introduction.md)
|
||||
* [贡献 QMK](contributing.md)
|
||||
* [QMK简介](getting_started_introduction.md)
|
||||
* [向QMK贡献](contributing.md)
|
||||
* [如何使用Github](getting_started_github.md)
|
||||
* [获得帮助](getting_started_getting_help.md)
|
||||
|
||||
* [问题解答](faq.md)
|
||||
* [一般问题](faq_general.md)
|
||||
* [构建/编译QMK](faq_build.md)
|
||||
* [调试/故障排除 QMK](faq_debug.md)
|
||||
* [键盘布局](faq_keymap.md)
|
||||
* [构建/编译](faq_build.md)
|
||||
* [调试/故障排除](faq_debug.md)
|
||||
* [键盘映射](faq_keymap.md)
|
||||
|
||||
* 详细指南
|
||||
* [安装构建工具](getting_started_build_tools.md)
|
||||
* [流浪者指南](getting_started_vagrant.md)
|
||||
* [vagrant指南](getting_started_vagrant.md)
|
||||
* [构建/编译指令](getting_started_make_guide.md)
|
||||
* [刷新固件](flashing.md)
|
||||
* [定制功能](custom_quantum_functions.md)
|
||||
* [布局概述](keymap.md)
|
||||
* [映射概述](keymap.md)
|
||||
|
||||
* [硬件](hardware.md)
|
||||
* [AVR 处理器](hardware_avr.md)
|
||||
* [AVR处理器](hardware_avr.md)
|
||||
* [驱动](hardware_drivers.md)
|
||||
|
||||
* 参考
|
||||
|
@ -35,8 +35,8 @@
|
|||
* [配置选项](config_options.md)
|
||||
* [键码](keycodes.md)
|
||||
* [记录最佳实践](documentation_best_practices.md)
|
||||
* [文档指南](documentation_templates.md)
|
||||
* [词汇表](reference_glossary.md)
|
||||
* [文档模板](documentation_templates.md)
|
||||
* [术语表](reference_glossary.md)
|
||||
* [单元测试](unit_testing.md)
|
||||
* [有用的功能](ref_functions.md)
|
||||
* [配置器支持](reference_configurator_support.md)
|
||||
|
@ -44,35 +44,35 @@
|
|||
|
||||
* [特性](features.md)
|
||||
* [基本键码](keycodes_basic.md)
|
||||
* [US ANSI 控制键](keycodes_us_ansi_shifted.md)
|
||||
* [US ANSI控制码](keycodes_us_ansi_shifted.md)
|
||||
* [量子键码](quantum_keycodes.md)
|
||||
* [高级键码](feature_advanced_keycodes.md)
|
||||
* [音频](feature_audio.md)
|
||||
* [自动控制](feature_auto_shift.md)
|
||||
* [自动shift](feature_auto_shift.md)
|
||||
* [背光](feature_backlight.md)
|
||||
* [蓝牙](feature_bluetooth.md)
|
||||
* [Bootmagic](feature_bootmagic.md)
|
||||
* [热改键](feature_bootmagic.md)
|
||||
* [组合](feature_combo)
|
||||
* [命令](feature_command.md)
|
||||
* [动态宏指令](feature_dynamic_macros.md)
|
||||
* [编码器](feature_encoders.md)
|
||||
* [Grave Escape](feature_grave_esc.md)
|
||||
* [键锁](feature_key_lock.md)
|
||||
* [层](feature_layouts.md)
|
||||
* [引导键](feature_leader_key.md)
|
||||
* [LED 阵列](feature_led_matrix.md)
|
||||
* [重音号Esc复合键](feature_grave_esc.md)
|
||||
* [自锁键](feature_key_lock.md)
|
||||
* [布局](feature_layouts.md)
|
||||
* [前导键](feature_leader_key.md)
|
||||
* [LED阵列](feature_led_matrix.md)
|
||||
* [宏指令](feature_macros.md)
|
||||
* [鼠标键](feature_mouse_keys.md)
|
||||
* [一键功能](feature_advanced_keycodes.md#one-shot-keys)
|
||||
* [指针设备](feature_pointing_device.md)
|
||||
* [PS/2 鼠标](feature_ps2_mouse.md)
|
||||
* [RGB 光](feature_rgblight.md)
|
||||
* [RGB 矩阵](feature_rgb_matrix.md)
|
||||
* [PS/2鼠标](feature_ps2_mouse.md)
|
||||
* [RGB灯光](feature_rgblight.md)
|
||||
* [RGB矩阵](feature_rgb_matrix.md)
|
||||
* [空格候补换挡](feature_space_cadet_shift.md)
|
||||
* [空格候补换挡回车](feature_space_cadet_shift_enter.md)
|
||||
* [速录机](feature_stenography.md)
|
||||
* [换手](feature_swap_hands.md)
|
||||
* [踢踏舞](feature_tap_dance.md)
|
||||
* [多击键](feature_tap_dance.md)
|
||||
* [终端](feature_terminal.md)
|
||||
* [热敏打印机](feature_thermal_printer.md)
|
||||
* [Unicode](feature_unicode.md)
|
||||
|
@ -80,16 +80,16 @@
|
|||
* [速度键](feature_velocikey.md)
|
||||
|
||||
* 针对制造者和定制者
|
||||
* [飞线指南](hand_wire.md)
|
||||
* [ISP 刷新指南](isp_flashing_guide.md)
|
||||
* [ARM 调试指南](arm_debugging.md)
|
||||
* [I2C 驱动](i2c_driver.md)
|
||||
* [GPIO 控制器](internals_gpio_control.md)
|
||||
* [Proton C 转换](proton_c_conversion.md)
|
||||
* [手工连线指南](hand_wire.md)
|
||||
* [ISP刷新指南](isp_flashing_guide.md)
|
||||
* [ARM调试指南](arm_debugging.md)
|
||||
* [I2C驱动](i2c_driver.md)
|
||||
* [GPIO控制器](internals_gpio_control.md)
|
||||
* [Proton C转换](proton_c_conversion.md)
|
||||
|
||||
* 深入了解
|
||||
* [键盘如何工作](how_keyboards_work.md)
|
||||
* [理解 QMK](understanding_qmk.md)
|
||||
* [理解QMK](understanding_qmk.md)
|
||||
|
||||
* 其他话题
|
||||
* [使用Eclipse开发QMK](other_eclipse.md)
|
||||
|
@ -99,8 +99,8 @@
|
|||
* QMK 内构 (正在编写)
|
||||
* [定义](internals_defines.md)
|
||||
* [输入回调寄存器](internals_input_callback_reg.md)
|
||||
* [Midi 设备](internals_midi_device.md)
|
||||
* [Midi 设备设置过程](internals_midi_device_setup_process.md)
|
||||
* [Midi 工具库](internals_midi_util.md)
|
||||
* [Midi设备](internals_midi_device.md)
|
||||
* [Midi设备设置过程](internals_midi_device_setup_process.md)
|
||||
* [Midi工具库](internals_midi_util.md)
|
||||
* [发送函数](internals_send_functions.md)
|
||||
* [Sysex 工具](internals_sysex_tools.md)
|
||||
* [Sysex工具](internals_sysex_tools.md)
|
||||
|
|
205
docs/zh-cn/contributing.md
Normal file
205
docs/zh-cn/contributing.md
Normal file
|
@ -0,0 +1,205 @@
|
|||
# 如何做贡献
|
||||
|
||||
👍🎉 首先感谢各位百忙之中抽空阅读本文档,并为我们无私奉献。给您点赞啦! 🎉👍
|
||||
|
||||
第三方的帮助让Q酱成长了许多呢,Q酱也从你们那学到了不少新东西。Q酱希望每一个想帮助我的人都能很方便的做出有用的贡献。在这里我给摩拳擦掌的你们写了一点引导,让你们的代码在不对我做重大改动的情况下都能成功的被采纳哦。
|
||||
|
||||
* [项目概况](#项目概况)
|
||||
* [代码规范](#代码规范)
|
||||
* [一般教程](#一般教程)
|
||||
* [行为守则对于我来说有何意义?](#行为守则对于我来说有何意义?)
|
||||
|
||||
## 这文章巨长无比不想读啊! 我就想问个问题而已!
|
||||
|
||||
您要是想问关于Q酱的问题的话可以在[OLKB Subreddit](https://reddit.com/r/olkb)或者是[Discord](https://discord.gg/Uq7gcHh)随意问。
|
||||
|
||||
请记住:
|
||||
|
||||
* 维护Q酱的小可爱有的时候可能会有点忙,不能及时回答您的问题,耐心等等,他们都是很nice的人呀。
|
||||
* 维护Q酱的人都是很无私的善良的人。无论是贡献代码还是回答问题,都是义务的。有时见到他们努力回答各种问题,解决各种BUG,Q酱也是很心疼的。
|
||||
* 您可以看看下面的教程,可以让您的问题浅显易懂,更容易回答:
|
||||
* https://opensource.com/life/16/10/how-ask-technical-questions
|
||||
* http://www.catb.org/esr/faqs/smart-questions.html
|
||||
|
||||
# 项目概况
|
||||
|
||||
Q酱很大一部分是用C语言组成的,不过有一小部分特性是C++的。怎么说呢,都是我的一部分,两个我都爱。Q酱一般是在键盘上的嵌入式处理器那里工作的,尤其与AVR([LUFA](http://www.fourwalledcubicle.com/LUFA.php))和ARM ([ChibiOS](http://www.chibios.com))两小哥哥搭配,干活不累,嘻嘻。如果您精通Arduino的话您会发现很多熟悉的概念,但也有点不爽,因为您以前的经验可能没法用来帮助Q酱。
|
||||
|
||||
<!-- 需要修正: 这里放些学习C语言的资源。另外感谢修正的小可爱。谢谢您了。-->
|
||||
|
||||
# Q酱,我在哪能帮助你嘞?
|
||||
|
||||
您要是有问题的话可以 [提出一个issue](https://github.com/qmk/qmk_firmware/issues) 或 [在Discord上交流一下](https://discord.gg/Uq7gcHh).
|
||||
|
||||
# Q酱,我如何帮助你?
|
||||
|
||||
您以前是否没为开源贡献过代码,而又想知道帮助Q酱是怎么一回事? 稍安勿躁,咱给您总结一下!
|
||||
|
||||
0. 先注册一个 [GitHub](https://github.com) 账户。
|
||||
1. 做好一个你要贡献的布局,那就要 [找一个你想解决的问题](https://github.com/qmk/qmk_firmware/issues),或者 [找一个你想添加的特性](https://github.com/qmk/qmk_firmware/issues?q=is%3Aopen+is%3Aissue+label%3Afeature)。
|
||||
2. 把关联着问题的仓库分叉(fork)到你的仓库。这样你在`你的GitHub用户名/qmk_firmware`就有一个仓库备份啦。
|
||||
3. 使用 `git clone https://github.com/此处添GitHub用户名/此处添仓库名.git`这个命令把仓库同步到你的电脑中。
|
||||
4. 您要是想开发一个新特性的话可以先创建一个issue和Q酱的维护者讨论一下您要做什么。
|
||||
5. 使用`git checkout -b 此处写分支名字(别用汉字)`命令来创建一个分支(branch)用于开发。
|
||||
6. 对要解决的问题或要添加的特性进行适当的更改。
|
||||
7. 使用 `git add 把改变的文件的目录写这里` 可以添加改变的文件内容到git用于管理工程状态的索引(快照)里。
|
||||
8. 使用 `git commit -m "这里写修改的相关信息"` 来描述你做出了什么修改。
|
||||
9. 使用 `git push origin 此处写分支名字`来把你的更改同步到GitHub库里(反正不是打篮球那个库里)。
|
||||
10. 提交一个[QMK 固件的pull request](https://github.com/qmk/qmk_firmware/pull/new/master)。
|
||||
11. 给你的pull request拟一个标题,包括简短的描述和问题或错误代码。比如, 你可以起一个这样的"Added more log outputting to resolve #4352"(最好用英语,毕竟Q酱的中文也不是那么的溜,有可能会看不懂中文)。
|
||||
12. 在描述(description)里面写你做了哪些更改,你的代码里还存在什么问题, 或者你想问维护的小可爱们的问题。你的your pull request有点小问题无伤大雅(本来也没有完美的代码嘛), 维护的小可爱们会竭尽全力帮您改进的!
|
||||
13. 维护人员审查代码可能需要一些时间。
|
||||
14. 维护人员会通知您要更改什么地方,然后您就按照建议改一改。
|
||||
15. 预祝您合并成功!
|
||||
|
||||
# 代码规范
|
||||
|
||||
其实也没有什么特别严格的规范啦,但是俗话说的好:没有规矩,不成方圆。您可以看一下您的要改动的代码周围的画风,然后保持队形。如果你感觉周围都不知道是什么牛鬼蛇神的话就看看下面的建议:
|
||||
|
||||
* 我们用肆(4)个空格来缩进(软件中也可以设置到Tab键)
|
||||
* 我们使用改良的1TBS(允许单行样式)
|
||||
* 左大括号: 在开放性语句块那行的末尾
|
||||
* 右大括号: 和开放性语句块第一个字母对齐
|
||||
* Else If: 将右大括号放在行的开头,下一个左大括号放在同一行的结尾
|
||||
* 可选大括号: 可选大括号是必选的
|
||||
* 应该这样: if (condition) { return false; }
|
||||
* 不应该这样: if (condition) return false;
|
||||
* 建议使用C语言风格的注释: `/* */`
|
||||
* 把注释想象成一个描述特征的故事
|
||||
* 充分使用注释来描述你为何这样修改
|
||||
* 有些公认的东西就不要写到注释里面了
|
||||
* 如果你不知道注释是否多余,看下面
|
||||
* 一般不要主动换行,主动换行的话每行不要超过76列
|
||||
* 要把 `#pragma once` 放到头文件的开始哦,抛弃老土的(`#ifndef THIS_FILE_H`, `#define THIS_FILE_H`, ..., `#endif`)吧
|
||||
* 下面两种预处理命令都可以用: `#ifdef DEFINED` 还有 `#if defined(DEFINED)`
|
||||
* 以上那句对处女座不是很友好哈,处女座的朋友们就别纠结了,直接 `#if defined(DEFINED)` 。
|
||||
* 还有就是选好一种风格就一直用,一直用一直爽,不要朝三暮四, 除非你要变化到多重条件的 `#if`。
|
||||
* `#` 和 `if`要挨在一起哦,再让本空格在中间冒充电灯泡本空格会生气的。
|
||||
* 以下是缩进规则:
|
||||
* 首先考虑可读性,强迫症的朋友们总想要保持代码的高一致性,这样可不好。
|
||||
* 保证文件已有风格不变。如果代码本来就是杂糅风格,那就见机行事,让你的修改更有意义些。
|
||||
* 其实你也可以在缩进的时候看看周围其他代码,然后范水模山,预处理命令可以有自己的缩进风格。
|
||||
|
||||
可以参照下面:
|
||||
|
||||
```c
|
||||
/* foo 的 Enums*/
|
||||
enum foo_state {
|
||||
FOO_BAR,
|
||||
FOO_BAZ,
|
||||
};
|
||||
|
||||
/* 有返回值的情况 */
|
||||
int foo(void) {
|
||||
if (some_condition) {
|
||||
return FOO_BAR;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
# Clang-format的自动格式化
|
||||
[Clang-format](https://clang.llvm.org/docs/ClangFormat.html) 是LLVM的一部分,可以帮你自动格式化代码。我们给你准备好了一个适用于以上规范的配置文件,会帮你调整缩进和换行,你只需要写好括号就好。有了它,你再也不用担心调整代码格式太耗时,没有时间陪伴自己(虚构)的另一半了。
|
||||
|
||||
使用[LLVM 完整安装](http://llvm.org/builds/)可以在Windows上安装clang-format, Ubuntu用户要用`sudo apt install clang-format`。
|
||||
|
||||
命令行的朋友们, 加上 `-style=file`选项就会自动在QMK的根目录寻找.clang-format配置文件了。
|
||||
|
||||
VSCode用户, 标准的 C/C++ 插件就支持clang-format, 或者可以用[独立扩展](https://marketplace.visualstudio.com/items?itemName=LLVMExtensions.ClangFormat)也行。
|
||||
|
||||
有些东西(比如LAYOUT宏) 会被clang-format打乱,所以那些文件就别用clang-format了,这里就教您一个小窍门,在`// clang-format off` 和 `//clang-format on`之间装上会被搞乱的代码就好了。
|
||||
|
||||
# 一般教程
|
||||
|
||||
你可以给Q酱的不同部分添砖加瓦,但也要用不同的方法严谨检查。不论你修改哪里最好还是看看下边。
|
||||
|
||||
* 将PR(pull request)分成一个个的逻辑单元。 比如,不要一次将两个新特性PR出去。要添加的特性排好队,一个一个来。
|
||||
* 提交之前看一眼,`git diff --check`的空格一定要写对了
|
||||
* 确定你的代码能通过编译
|
||||
* 布局: 确定`make keyboard:your_new_keymap` 不返回错误
|
||||
* 键盘: 确定 `make keyboard:all` 不返回错误
|
||||
* 核心代码: 确定 `make all` 不返回错误
|
||||
* 提交的信息尽量明确。第一行写点简短介绍(每行不多于70个英文字母), 第二行空着,第三行和后面就要写些必要的细节了。最好用英文写,比如:
|
||||
|
||||
```
|
||||
Adjust the fronzlebop for the kerpleplork
|
||||
|
||||
The kerpleplork was intermittently failing with error code 23. The root cause was the fronzlebop setting, which causes the kerpleplork to activate every N iterations.
|
||||
|
||||
Limited experimentation on the devices I have available shows that 7 is high enough to avoid confusing the kerpleplork, but I'd like to get some feedback from people with ARM devices to be sure.
|
||||
```
|
||||
|
||||
## 文档
|
||||
|
||||
想帮助Q酱当然是先看文档最简单了。找到这个文档哪里错了然后改正它对于你来说超级简单! 我们也对有写文档能力的人求贤若渴,如果你是对的人[点这个](#Q酱,我在哪能帮助你嘞?)!
|
||||
|
||||
文档呢,都静静的放在`qmk_firmware/docs` 目录里, 也或者您想为网页做贡献的话也是可以的哦。
|
||||
|
||||
在文档中附代码案例时, 先观察文档其他地方的命名规范。比如, 把enums的名字都改成像`my_layers`或者`my_keycodes`来防止名字不一致的enums被当作特务枪毙:
|
||||
|
||||
```c
|
||||
enum my_layers {
|
||||
_FIRST_LAYER,
|
||||
_SECOND_LAYER
|
||||
};
|
||||
|
||||
enum my_keycodes {
|
||||
FIRST_LAYER = SAFE_RANGE,
|
||||
SECOND_LAYER
|
||||
};
|
||||
```
|
||||
|
||||
## 布局
|
||||
|
||||
大多数QMK新手都从创建一个自己的布局开始。我们尽力保证布局规范宽松 (毕竟布局是个性的体现) 不过建议遵守以下准则,这样可以让别人更好理解你的代码
|
||||
|
||||
* 用 [模板](documentation_templates.md)写个`readme.md`。
|
||||
* 所有的布局PR都会被squash, 如果你想知道你的提交是怎么被squash的那你就自己来吧
|
||||
* 不要把新特性和布局一起PR。可以分别PR他们
|
||||
* 布局文件夹就不要放`Makefile`了,这个操作都过时啦
|
||||
* 更新文件头部的copyrights(看`%YOUR_NAME%`那)
|
||||
|
||||
## 键盘
|
||||
|
||||
QMK的最终归宿是键盘。有些键盘是社区维护的,有一些是制作这些键盘的人维护的。`readme.md`会告诉你是谁维护了这个键盘,如果你对某个键盘有疑问,可以 [创建一个Issue](https://github.com/qmk/qmk_firmware/issues) 来问一问维护者。
|
||||
|
||||
我们建议你按下面的来操作:
|
||||
|
||||
* 用[模板](documentation_templates.md)写`readme.md`。
|
||||
* 提交数量尽量合理,不然我们可就要把你的PR给squash了。
|
||||
* 不要把新特性和新键盘一起PR。可以分别PR他们
|
||||
* 用父文件夹的名字命名 `.c`/`.h`文件, 比如`/keyboards/<kb1>/<kb2>/<kb2>.[ch]`
|
||||
* 键盘文件夹就不要放`Makefile`了,这个操作都过时啦
|
||||
* 更新文件头部的copyrights(看`%YOUR_NAME%`那)
|
||||
|
||||
## Quantum/TMK 核心
|
||||
|
||||
在您废寝忘食地开发Q酱新特性或者帮Q酱驱虫之前,一定要确保你的工作是有意义的。看看[了解QMK](understanding_qmk.md)你会对Q酱有更深的了解,这个文档将带你领略QMK的程序流程。现在你应该和维护团对谈谈来了解实现你想法的最佳方法了。一下渠道都可以:
|
||||
|
||||
* [在Discord交流](https://discord.gg/Uq7gcHh)
|
||||
* [建立一个Issue](https://github.com/qmk/qmk_firmware/issues/new)
|
||||
|
||||
新特性和BUG的修复影响所有键盘。开发组也在翻修QMK。所以,在实施重大返修之前一定要讨论一下。如果你在没有事先与维护团队沟通的情况下提交了一个PR,而且你的选择与维护团队的计划方向不符,那你可能要面临大改了。
|
||||
|
||||
修复BUG或者开发新特性之前看看这个:
|
||||
|
||||
* **默认不启用** - QMK运行的芯片多数内存有限,所以首要考虑的还应该是布局不要被破坏,于是特性默认是不启用的。你喜欢什么特性的话就打开它,如果你觉得有些特性应该默认开启或者你能帮助缩减代码,那就联系维护组吧。
|
||||
* **提交之前在本地编译** - 这个简直就是家喻户晓了,但是也确实需要编译啊! 我们的Travis系统会发现一切问题,但是自己编译一下可要比在线等快多了。
|
||||
* **注意版本和芯片平台** - 有那么几个键盘有支持不同配置甚至是不同芯片的版本。试着写一个能AVR和ARM两个平台运行的特性,或者在不支持的平台自动禁用。
|
||||
* **解释你的新特性** - 在`docs/`写个文档, 你可以创建新文档或者写到现有文档中。如果你不把它记录下来,其他人就无法从你的努力中获益。
|
||||
|
||||
也可以看看以下建议:
|
||||
|
||||
* 提交数量尽量合理,不然我们可就要把你的PR给squash了。
|
||||
* 不要把新特性、布局和键盘一起PR。可以分别PR他们。
|
||||
* 给你的特性写[单元测试](unit_testing.md)。
|
||||
* 你编辑的文件风格要一致,如果风格不明确或者是混搭风的,你就要先看看[代码规范](#代码规范)确认情况。
|
||||
|
||||
## 重构
|
||||
|
||||
为了保持QMK脉络清晰,Q酱打算深入规划重构一下自己,然后让合作者进行修改。如果你有重构的思路或建议[创建一个issue](https://github.com/qmk/qmk_firmware/issues), Q酱很乐意讨论一下怎么改进一下。
|
||||
|
||||
# 行为守则对于我来说有何意义?
|
||||
|
||||
我们的[行为守则](https://github.com/qmk/qmk_firmware/blob/master/CODE_OF_CONDUCT.md) 是说明您有责任尊重和礼貌地对待项目中的每个人,无论他们的身份如何。 如果你是我们行为准则所描述的不当行为的受害者,我们将站在你这边,并按照行为准则对施暴者进行适当谴责。
|
490
docs/zh-cn/custom_quantum_functions.md
Normal file
490
docs/zh-cn/custom_quantum_functions.md
Normal file
|
@ -0,0 +1,490 @@
|
|||
# 如何定制你键盘的功能
|
||||
|
||||
对于很多人来说客制化键盘可不只是向你的电脑发送你按了那个件这么简单。你肯定想实现比简单按键和宏更复杂的功能。QMK有能让你注入代码的钩子, 覆盖功能, 另外,还可以自定义键盘在不同情况下的行为。
|
||||
|
||||
本页不假定任何特殊的QMK知识,但阅读[理解QMK](understanding_qmk.md)将会在更基础的层面帮你理解发生了什么。
|
||||
|
||||
## A Word on Core vs 键盘 vs 布局
|
||||
|
||||
我们把qmk组织成一个层次结构:
|
||||
|
||||
* Core (`_quantum`)
|
||||
* Keyboard/Revision (`_kb`)
|
||||
* Keymap (`_user`)
|
||||
|
||||
下面描述的每一个函数都可以在定义上加一个`_kb()`或 `_user()` 后缀。 建议在键盘/修订层使用`_kb()`后缀,在布局层使用`_user()`后缀。
|
||||
|
||||
在键盘/修订层定义函数时,`_kb()`在执行任何代码前先调用`_user()`是必要的,不然布局层函数就不要被调用。
|
||||
<!-- 翻译问题:上面那句翻译的不太好-->
|
||||
# 自定义键码
|
||||
|
||||
到目前为止,最常见的任务是更改现有键码的行为或创建新的键码。从代码角度来看这些操作都很相似。
|
||||
|
||||
## 定义一个新键码
|
||||
|
||||
创建键码第一步,先枚举出它全部,也就是给键码起个名字并分配唯一数值。QMK没有直接限制最大键码值大小,而是提供了一个`SAFE_RANGE`宏。你可以在枚举时用`SAFE_RANGE`来保证你取得了唯一的键码值。
|
||||
|
||||
|
||||
这有枚举两个键码的例子。把这块加到`keymap.c`的话你就在布局中能用`FOO`和`BAR`了。
|
||||
|
||||
```c
|
||||
enum my_keycodes {
|
||||
FOO = SAFE_RANGE,
|
||||
BAR
|
||||
};
|
||||
```
|
||||
|
||||
## 为键码的行为编程
|
||||
|
||||
当你覆盖一个已存在按键的行为时,或将这个行为赋给新键时,你要用`process_record_kb()`和`process_record_user()`函数。这俩函数在键处理中真实键事件被处理前被QMK调用。如果这俩函数返回`true`,QMK将会用正常的方式处理键码。这样可以很方便的扩展键码的功能而不是替换它。如果函数返回`false` QMK会跳过正常键处理,然后发送键子抬起还是按下事件就由你决定了。
|
||||
|
||||
当某个键按下或释放时这俩函数会被调用。
|
||||
|
||||
### process_record_user()`函数示例实现
|
||||
|
||||
这个例子做了两个事。自定义了一个叫做`FOO`的键码的行为,并补充了在按下回车时播放音符。
|
||||
|
||||
```c
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case FOO:
|
||||
if (record->event.pressed) {
|
||||
// 按下时做些什么
|
||||
} else {
|
||||
// 释放时做些什么
|
||||
}
|
||||
return false; // 跳过此键的所有进一步处理
|
||||
case KC_ENTER:
|
||||
// 当按下回车时播放音符
|
||||
if (record->event.pressed) {
|
||||
PLAY_NOTE_ARRAY(tone_qwerty);
|
||||
}
|
||||
return true; // 让QMK触发回车按下/释放事件
|
||||
default:
|
||||
return true; // 正常处理其他键码
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### `process_record_*` 函数文档
|
||||
|
||||
* 键盘/修订: `bool process_record_kb(uint16_t keycode, keyrecord_t *record)`
|
||||
* 布局: `bool process_record_user(uint16_t keycode, keyrecord_t *record)`
|
||||
|
||||
`keycode(键码)`参数是在布局上定义的,比如`MO(1)`, `KC_L`, 等等。 你要用 `switch...case` 块来处理这些事件。
|
||||
|
||||
`record`参数含有实际按键的信息:
|
||||
|
||||
```c
|
||||
keyrecord_t record {
|
||||
keyevent_t event {
|
||||
keypos_t key {
|
||||
uint8_t col
|
||||
uint8_t row
|
||||
}
|
||||
bool pressed
|
||||
uint16_t time
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
# LED控制
|
||||
|
||||
qmk提供了读取HID规范包含的5个LED的方法。:
|
||||
|
||||
* `USB_LED_NUM_LOCK`
|
||||
* `USB_LED_CAPS_LOCK`
|
||||
* `USB_LED_SCROLL_LOCK`
|
||||
* `USB_LED_COMPOSE`
|
||||
* `USB_LED_KANA`
|
||||
|
||||
这五个常量对应于主机LED状态的位置位。
|
||||
有两种方法可以获得主机LED状态:
|
||||
|
||||
* 通过执行 `led_set_user()`
|
||||
* 通过调用 `host_keyboard_leds()`
|
||||
|
||||
## `led_set_user()`
|
||||
|
||||
当5个LED中任何一个的状态需要改变时,此函数将被调用。此函数通过参数输入LED参数。
|
||||
使用`IS_LED_ON(usb_led, led_name)`和`IS_LED_OFF(usb_led, led_name)`这两个宏来检查LED状态。
|
||||
|
||||
!> `host_keyboard_leds()`可能会在`led_set_user()`被调用前返回新值。
|
||||
|
||||
### `led_set_user()`函数示例实现
|
||||
|
||||
```c
|
||||
void led_set_user(uint8_t usb_led) {
|
||||
if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
|
||||
writePinLow(B0);
|
||||
} else {
|
||||
writePinHigh(B0);
|
||||
}
|
||||
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
|
||||
writePinLow(B1);
|
||||
} else {
|
||||
writePinHigh(B1);
|
||||
}
|
||||
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
|
||||
writePinLow(B2);
|
||||
} else {
|
||||
writePinHigh(B2);
|
||||
}
|
||||
if (IS_LED_ON(usb_led, USB_LED_COMPOSE)) {
|
||||
writePinLow(B3);
|
||||
} else {
|
||||
writePinHigh(B3);
|
||||
}
|
||||
if (IS_LED_ON(usb_led, USB_LED_KANA)) {
|
||||
writePinLow(B4);
|
||||
} else {
|
||||
writePinHigh(B4);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### `led_set_*`函数文档
|
||||
|
||||
* 键盘/修订: `void led_set_kb(uint8_t usb_led)`
|
||||
* 布局: `void led_set_user(uint8_t usb_led)`
|
||||
|
||||
## `host_keyboard_leds()`
|
||||
|
||||
调用这个函数会返回最后收到的LED状态。这个函数在`led_set_*`之外读取LED状态时很有用,比如在[`matrix_scan_user()`](#矩阵扫描代码).
|
||||
为了便捷,你可以用`IS_HOST_LED_ON(led_name)`和`IS_HOST_LED_OFF(led_name)` 宏,而不直接调用和检查`host_keyboard_leds()`。
|
||||
|
||||
## 设置物理LED状态
|
||||
|
||||
一些键盘实现了为设置物理LED的状态提供了方便的方法。
|
||||
|
||||
### Ergodox Boards
|
||||
|
||||
Ergodox实现了提供`ergodox_right_led_1`/`2`/`3_on`/`off()`来让每个LED开或关, 也可以用 `ergodox_right_led_on`/`off(uint8_t led)` 按索引打开或关闭他们。
|
||||
|
||||
此外,还可以使用`ergodox_led_all_set(uint8_t n)`指定所有LED的亮度级别;针对每个LED用`ergodox_right_led_1`/`2`/`3_set(uint8_t n)`;使用索引的话用`ergodox_right_led_set(uint8_t led, uint8_t n)`。
|
||||
|
||||
Ergodox boards 同时定义了最低亮度级别`LED_BRIGHTNESS_LO`和最高亮度级别`LED_BRIGHTNESS_HI`(默认最高).
|
||||
|
||||
# 键盘初始化代码
|
||||
|
||||
键盘初始化过程有几个步骤。你是用那个函数取决于你想要做什么。
|
||||
|
||||
有三个主要初始化函数,按调用顺序列出。
|
||||
|
||||
* `keyboard_pre_init_*` - 会在大多数其他东西运行前运行。适用于哪些需要提前运行的硬件初始化。
|
||||
* `matrix_init_*` - 在固件启动过程中间被调用。此时硬件已初始化,功能尚未初始化。
|
||||
* `keyboard_post_init_*` - 在固件启动过程最后被调用。大多数情况下,你的“客制化”代码都可以放在这里。
|
||||
|
||||
!> 对于大多数人来说`keyboard_post_init_user`是你想要调用的函数。例如, 此时你可以设置RGB灯发光。
|
||||
|
||||
## 键盘预初始化代码
|
||||
|
||||
这代码极早运行,甚至都在USB初始化前运行。
|
||||
|
||||
在这之后不久矩阵就被初始化了。
|
||||
|
||||
对于大多数用户来说,这用不到,因为它主要是用于面向硬件的初始化。
|
||||
|
||||
但如果你有硬件初始化的话放在这里再好不过了(比如初始化LED引脚一类的).
|
||||
|
||||
### `keyboard_pre_init_user()`函数示例实现
|
||||
|
||||
本例中在键盘级别,设定 B0, B1, B2, B3, 和 B4 是LED引脚。
|
||||
|
||||
```c
|
||||
void keyboard_pre_init_user(void) {
|
||||
// 调用键盘预初始化代码
|
||||
|
||||
// 设置LED引脚为输出模式
|
||||
setPinOutput(B0);
|
||||
setPinOutput(B1);
|
||||
setPinOutput(B2);
|
||||
setPinOutput(B3);
|
||||
setPinOutput(B4);
|
||||
}
|
||||
```
|
||||
|
||||
### `keyboard_pre_init_*` 函数文档
|
||||
|
||||
* 键盘/修订: `void keyboard_pre_init_kb(void)`
|
||||
* 布局: `void keyboard_pre_init_user(void)`
|
||||
|
||||
## 矩阵初始化代码
|
||||
|
||||
这将会在矩阵初始化时被调用,在某些硬件设置好后,但在一些功能被初始化前。
|
||||
|
||||
这在你设置其他地方会用到的东西的时候会很有用,但与硬件无关,也不依赖于它的启动位置。
|
||||
|
||||
|
||||
### `matrix_init_*`函数文档
|
||||
|
||||
* 键盘/修订: `void matrix_init_kb(void)`
|
||||
* 布局: `void matrix_init_user(void)`
|
||||
|
||||
|
||||
## 键盘后初始化代码
|
||||
|
||||
这是键盘初始化过程中的最后一个任务。如果您想更改某些特性,这会很有用,因为此时应该对它们进行初始化。
|
||||
|
||||
|
||||
### `keyboard_post_init_user()`示例实现
|
||||
|
||||
本示例在所有初始化完成后运行,配置RGB灯。
|
||||
|
||||
```c
|
||||
void keyboard_post_init_user(void) {
|
||||
// 调用后初始化代码
|
||||
rgblight_enable_noeeprom(); // 使能Rgb,不保存设置
|
||||
rgblight_sethsv_noeeprom(180, 255, 255); // 将颜色设置到蓝绿色(青色)不保存
|
||||
rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); // 设置快速呼吸模式不保存
|
||||
}
|
||||
```
|
||||
|
||||
### `keyboard_post_init_*` 函数文档
|
||||
|
||||
* 键盘/修订: `void keyboard_post_init_kb(void)`
|
||||
* 布局: `void keyboard_post_init_user(void)`
|
||||
|
||||
# 矩阵扫描代码
|
||||
|
||||
可能的话你要用`process_record_*()`自定义键盘,以这种方式连接到事件中,以确保代码不会对键盘产生负面的性能影响。然而,在极少数情况下,有必要进行矩阵扫描。在这些函数中要特别注意代码的性能,因为它每秒至少被调用10次。
|
||||
|
||||
### `matrix_scan_*`示例实现
|
||||
|
||||
这个例子被故意省略了。在hook这样一个对性能及其敏感的区域之前,您应该足够了解qmk的内部结构,以便在没有示例的情况下编写。如果你需要帮助,请[建立一个issue](https://github.com/qmk/qmk_firmware/issues/new)或[在Discord上与我们交流](https://discord.gg/Uq7gcHh).
|
||||
|
||||
### `matrix_scan_*` 函数文档
|
||||
|
||||
* 键盘/修订: `void matrix_scan_kb(void)`
|
||||
* 布局: `void matrix_scan_user(void)`
|
||||
|
||||
该函数在每次矩阵扫描时被调用,这基本与MCU处理能力上限相同。在这里写代码要谨慎,因为它会运行很多次。
|
||||
|
||||
你会在自定义矩阵扫描代码时用到这个函数。这也可以用作自定义状态输出(比如LED灯或者屏幕)或者其他即便用户不输入你也想定期运行的功能。
|
||||
|
||||
|
||||
# 键盘 空闲/唤醒 代码
|
||||
|
||||
如果键盘支持就可以通过停止一大票功能来达到"空闲"。RGB灯和背光就是很好的例子。这可以节约能耗,也可能让你键盘风味更佳。
|
||||
|
||||
用两个函数控制: `suspend_power_down_*`和`suspend_wakeup_init_*`, 分别在系统板空闲和唤醒时调用。
|
||||
|
||||
|
||||
### suspend_power_down_user()和suspend_wakeup_init_user()示例实现
|
||||
|
||||
|
||||
```c
|
||||
void suspend_power_down_user(void) {
|
||||
rgb_matrix_set_suspend_state(true);
|
||||
}
|
||||
|
||||
void suspend_wakeup_init_user(void) {
|
||||
rgb_matrix_set_suspend_state(false);
|
||||
}
|
||||
```
|
||||
|
||||
### 键盘 挂起/唤醒 函数文档
|
||||
|
||||
* 键盘/修订: `void suspend_power_down_kb(void)` 和`void suspend_wakeup_init_user(void)`
|
||||
* 布局: `void suspend_power_down_kb(void)` 和 `void suspend_wakeup_init_user(void)`
|
||||
|
||||
# 层改变代码
|
||||
|
||||
每当层改变这个就运行代码。这对于层指示或自定义层处理很有用。
|
||||
|
||||
### `layer_state_set_*` 示例实现
|
||||
|
||||
本例使用了Planck键盘示范了如何设置 [RGB背光灯](feature_rgblight.md)使之与层对应
|
||||
|
||||
```c
|
||||
uint32_t layer_state_set_user(uint32_t state) {
|
||||
switch (biton32(state)) {
|
||||
case _RAISE:
|
||||
rgblight_setrgb (0x00, 0x00, 0xFF);
|
||||
break;
|
||||
case _LOWER:
|
||||
rgblight_setrgb (0xFF, 0x00, 0x00);
|
||||
break;
|
||||
case _PLOVER:
|
||||
rgblight_setrgb (0x00, 0xFF, 0x00);
|
||||
break;
|
||||
case _ADJUST:
|
||||
rgblight_setrgb (0x7A, 0x00, 0xFF);
|
||||
break;
|
||||
default: // for any other layers, or the default layer
|
||||
rgblight_setrgb (0x00, 0xFF, 0xFF);
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
```
|
||||
### `layer_state_set_*` 函数文档
|
||||
|
||||
* 键盘/修订: `uint32_t layer_state_set_kb(uint32_t state)`
|
||||
* 布局: `uint32_t layer_state_set_user(uint32_t state)`
|
||||
|
||||
|
||||
该`状态`是活动层的bitmask, 详见[布局概述](keymap.md#布局的层状态)
|
||||
|
||||
|
||||
# 掉电保存配置 (EEPROM)
|
||||
|
||||
这会让你的配置长期的保存在键盘中。这些配置保存在你主控的EEPROM里,掉电不会消失。 设置可以用`eeconfig_read_kb`和`eeconfig_read_user`读取,可以用`eeconfig_update_kb`和`eeconfig_update_user`写入。这对于您希望能够切换的功能很有用(比如切换RGB层指示。此外,你可以用`eeconfig_init_kb`和`eeconfig_init_user`来设置EEPROM默认值。
|
||||
|
||||
最复杂的部分可能是,有很多方法可以通过EEPROM存储和访问数据,并且并没有用哪种方法是“政治正确”的。你每个功能只有一个双字(四字节)空间。
|
||||
|
||||
记住EEPROM是有写入寿命的。尽管写入寿命很高,但是并不是只有设置写道EEPROM中。如果你写入频繁,你的MCU寿命将会变短。
|
||||
|
||||
* 如果您不理解这个例子,那么您可能希望避免使用这个特性,因为它相当复杂。
|
||||
|
||||
### 示例实现
|
||||
|
||||
本例讲解了如何添加设置,并且读写。本里使用了用户布局。这是一个复杂的函数,有很多事情要做。实际上,它使用了很多上述函数来工作!
|
||||
|
||||
|
||||
在你的keymap.c文件中,将以下代码添加至顶部:
|
||||
```c
|
||||
typedef union {
|
||||
uint32_t raw;
|
||||
struct {
|
||||
bool rgb_layer_change :1;
|
||||
};
|
||||
} user_config_t;
|
||||
|
||||
user_config_t user_config;
|
||||
```
|
||||
|
||||
以上代码建立了一个结构体,该结构体可以存储设置并可用于写入EEPROM。如此这般将无需定义变量,因为在结构体中已然定义。要记住`bool` (布尔)值使用1位, `uint8_t`使用8位, `uint16_t`使用16位。你可以混合搭配使用,但是顺序记错可能会招致麻烦,因为那会改变写入写出的值。
|
||||
|
||||
`layer_state_set_*`函数中使用了`rgb_layer_change`,使用了`keyboard_post_init_user`和`process_record_user`来配置一切。
|
||||
|
||||
首先要使用`keyboard_post_init_user,你要加入`eeconfig_read_user()`来填充你刚刚创建的结构体。然后您可以立即使用这个结构来控制您的布局中的功能。就像这样:
|
||||
```c
|
||||
void keyboard_post_init_user(void) {
|
||||
// 调用布局级别的矩阵初始化
|
||||
|
||||
// 从EEPROM读用户配置
|
||||
user_config.raw = eeconfig_read_user();
|
||||
|
||||
// 如使能,设置默认层
|
||||
if (user_config.rgb_layer_change) {
|
||||
rgblight_enable_noeeprom();
|
||||
rgblight_sethsv_noeeprom_cyan();
|
||||
rgblight_mode_noeeprom(1);
|
||||
}
|
||||
}
|
||||
```
|
||||
以上函数会在读EEPROM配置后立即使用该设置来设置默认层RGB颜色。"raw"的值是从你上面基于"union"创建的结构体中转换来的。
|
||||
|
||||
```c
|
||||
uint32_t layer_state_set_user(uint32_t state) {
|
||||
switch (biton32(state)) {
|
||||
case _RAISE:
|
||||
if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_magenta(); rgblight_mode_noeeprom(1); }
|
||||
break;
|
||||
case _LOWER:
|
||||
if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_red(); rgblight_mode_noeeprom(1); }
|
||||
break;
|
||||
case _PLOVER:
|
||||
if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_green(); rgblight_mode_noeeprom(1); }
|
||||
break;
|
||||
case _ADJUST:
|
||||
if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_white(); rgblight_mode_noeeprom(1); }
|
||||
break;
|
||||
default: // 针对其他层或默认层
|
||||
if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_cyan(); rgblight_mode_noeeprom(1); }
|
||||
break;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
```
|
||||
这样仅在值使能时会改变RGB背光灯。现在配置这个值, 为`process_record_user`创建一个新键码叫做`RGB_LYR`。我们要确保,如果使用正常的RGB代码,使用上面的示例将其关闭,请将其设置为:
|
||||
```c
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case FOO:
|
||||
if (record->event.pressed) {
|
||||
// 按下时做点什么
|
||||
} else {
|
||||
// 释放时做点什么
|
||||
}
|
||||
return false; // 跳过此键的进一步处理
|
||||
case KC_ENTER:
|
||||
// 在按下回车时播放音符
|
||||
if (record->event.pressed) {
|
||||
PLAY_NOTE_ARRAY(tone_qwerty);
|
||||
}
|
||||
return true; // 让QMK产生回车按下/释放事件
|
||||
case RGB_LYR: // 本句让underglow作为层指示,或正常使用。
|
||||
if (record->event.pressed) {
|
||||
user_config.rgb_layer_change ^= 1; // 切换状态
|
||||
eeconfig_update_user(user_config.raw); // 向EEPROM写入新状态
|
||||
if (user_config.rgb_layer_change) { // 如果层状态被使能
|
||||
layer_state_set(layer_state); // 那么立刻更新层颜色
|
||||
}
|
||||
}
|
||||
return false; break;
|
||||
case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // 对于所有的RGB代码 (see quantum_keycodes.h, L400 可以参考)
|
||||
if (record->event.pressed) { //本句失能层指示,假设你改变了这个…你要把它禁用
|
||||
if (user_config.rgb_layer_change) { // 仅当使能时
|
||||
user_config.rgb_layer_change = false; // 失能,然后
|
||||
eeconfig_update_user(user_config.raw); // 向EEPROM写入设置
|
||||
}
|
||||
}
|
||||
return true; break;
|
||||
default:
|
||||
return true; // 按其他键正常
|
||||
}
|
||||
}
|
||||
```
|
||||
最后你要加入`eeconfig_init_user`函数,所以当EEPROM重置时,可以指定默认值, 甚至自定义操作。想强制重置EEPROM,请用`EEP_RST`键码或[Bootmagic](feature_bootmagic.md)函数。比如,如果要在默认情况下设置RGB层指示,并保存默认值
|
||||
|
||||
```c
|
||||
void eeconfig_init_user(void) { // EEPROM正被重置
|
||||
user_config.raw = 0;
|
||||
user_config.rgb_layer_change = true; // 我们想要默认使能
|
||||
eeconfig_update_user(user_config.raw); // 向EEPROM写入默认值
|
||||
|
||||
// use the non noeeprom versions, 还要向EEPROM写入这些值
|
||||
rgblight_enable(); // 默认使能RGB
|
||||
rgblight_sethsv_cyan(); // 默认设置青色
|
||||
rgblight_mode(1); // 默认设置长亮
|
||||
}
|
||||
```
|
||||
|
||||
然后就完事了。RGB层指示会在你想让它工作时工作。这个设置会一直保存,即便你拔下键盘。如果你使用其他RGB代码,层指示将失能,现在它可以做你所想了。
|
||||
|
||||
### 'EECONFIG' 函数文档
|
||||
|
||||
* 键盘/修订: `void eeconfig_init_kb(void)`, `uint32_t eeconfig_read_kb(void)`和`void eeconfig_update_kb(uint32_t val)`
|
||||
* 布局: `void eeconfig_init_user(void)`, `uint32_t eeconfig_read_user(void)`和`void eeconfig_update_user(uint32_t val)`
|
||||
|
||||
`val` 是你想写入EEPROM的值,`eeconfig_read_*`函数会从EEPROM返回一个32位(双字)的值。
|
||||
|
||||
# 自定义击键-长按临界值(TAPPING_TERM)
|
||||
默认情况下,击键-长按临界值是全球统一的,并且不能通过键进行配置。对于大多数用户来说这很好。但是在有些情况下,对于`LT`键来说按键延时对双功能键的提升更大,可能是因为有些键比其他的键更容易按住。为了不给每个都自定义键码,本功能可以为每个键定义`TAPPING_TERM`。
|
||||
|
||||
想使能这个功能的话, 要先在`config.h`加上`#define TAPPING_TERM_PER_KEY`。
|
||||
|
||||
|
||||
## `get_tapping_term`示例实现
|
||||
|
||||
想要修改基于键码的`TAPPING TERM`,你要向`keymap.c`文件添加如下代码:
|
||||
|
||||
```c
|
||||
uint16_t get_tapping_term(uint16_t keycode) {
|
||||
switch (keycode) {
|
||||
case SFT_T(KC_SPC):
|
||||
return TAPPING_TERM + 1250;
|
||||
case LT(1, KC_GRV):
|
||||
return 130;
|
||||
default:
|
||||
return TAPPING_TERM;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### `get_tapping_term` 函数文档
|
||||
|
||||
不像这篇的其他功能,这个不需要quantum或者键盘级别的函数,只要用户级函数即可。
|
6
docs/zh-cn/faq.md
Normal file
6
docs/zh-cn/faq.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
# 常见问题
|
||||
|
||||
* [一般问题](faq_general.md)
|
||||
* [构建和编译QMK](faq_build.md)
|
||||
* [QMK调试和故障排除](faq_debug.md)
|
||||
* [布局问题](faq_keymap.md)
|
150
docs/zh-cn/faq_build.md
Normal file
150
docs/zh-cn/faq_build.md
Normal file
|
@ -0,0 +1,150 @@
|
|||
# 关于构建的常见问题
|
||||
|
||||
本页所写是QMK构建的常见问题.如果你还没有进行过编译,就看一下[构建环境搭建](getting_started_build_tools.md) 和 [make的说明](getting_started_make_guide.md).
|
||||
|
||||
## 如果您不能在Linux上编程
|
||||
您需要适当的权限才能操作设备。对于Linux用户, 请参阅下方有关`udev`规则的说明。如果您对`udev`有问题,解决方法是用`sudo`命令。如果您不熟悉此命令,使用`man sudo`查看其手册或[看这个网页](https://linux.die.net/man/8/sudo).
|
||||
|
||||
在你的主控是ATMega32u4时,以下是使用`sudo`命令的样例:
|
||||
|
||||
$ sudo dfu-programmer atmega32u4 erase --force
|
||||
$ sudo dfu-programmer atmega32u4 flash your.hex
|
||||
$ sudo dfu-programmer atmega32u4 reset
|
||||
|
||||
或只用;
|
||||
|
||||
$ sudo make <keyboard>:<keymap>:dfu
|
||||
|
||||
使用`sudo`运行`make`一般来说**不**推荐,如果可能,尽量使用前一种方法之一。
|
||||
|
||||
### Linux `udev` 规则
|
||||
在Linux上,您需要适当的权限才能访问MCU。你也可以在刷新固件时使用 `sudo`,或把这些文件放到`/etc/udev/rules.d/`。
|
||||
|
||||
**/etc/udev/rules.d/50-atmel-dfu.rules:**
|
||||
```
|
||||
# Atmel ATMega32U4
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff4", MODE:="0666"
|
||||
# Atmel USBKEY AT90USB1287
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ffb", MODE:="0666"
|
||||
# Atmel ATMega32U2
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff0", MODE:="0666"
|
||||
```
|
||||
|
||||
**/etc/udev/rules.d/52-tmk-keyboard.rules:**
|
||||
```
|
||||
# tmk键盘产品 https://github.com/tmk/tmk_keyboard
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="feed", MODE:="0666"
|
||||
```
|
||||
**/etc/udev/rules.d/54-input-club-keyboard.rules:**
|
||||
|
||||
```
|
||||
# Input Club keyboard bootloader
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1c11", MODE:="0666"
|
||||
```
|
||||
|
||||
### 串行设备在Linux上检测不到bootloader模式
|
||||
确保您的内核对您的设备有相应的支持。 如果你的设备是 USB ACM, 比如Pro Micro (Atmega32u4),就要加上`CONFIG_USB_ACM=y`. 其他设备可能需要`USB_SERIAL` 及其任何子选项。
|
||||
|
||||
## DFU Bootloader的未知设备
|
||||
|
||||
如果您在使用Windows来刷新键盘的时候碰到了问题,检查设备管理器。如果在键盘处于 "bootloader模式"时你看到 "未知设备",说明你可能面临设备问题。
|
||||
|
||||
重新运行MSYS2上的安装脚本或许会凑效(比如在MSYS2/WSL运行 `./util/qmk_install.sh`) 或者重新安装QMK工具箱也可能会解决你的问题。
|
||||
|
||||
如果以上方法还是短针攻疽,那您可能需要使用[Zadig Utility](https://zadig.akeo.ie/)。下载此程序, 找到设备问题, 然后选择 `WinUSB`选项, 然后点击"Reinstall driver"。完成后再试试刷新你的键盘。倘若依然徒劳无功,那就尝试所有选项直到好用为止。
|
||||
|
||||
?> 事实上没有一个驱动的最佳选择,有些选项就是和某些系统相辅相成。但libUSB和WinUSB似乎也算是这里的最佳选择了。
|
||||
如果bootloader在设备列表中没有显示,你可能要使能 "List all devices"选项在选项菜单中`Options`,然后找到有问题的bootloader设备。(译者注:在win10中可能为 查看-显示隐藏的设备)
|
||||
|
||||
|
||||
## WINAVR已淘汰
|
||||
不再推荐使用WINAVR,使用可能会导致问题
|
||||
详情请见[TMK Issue #99](https://github.com/tmk/tmk_keyboard/issues/99).
|
||||
|
||||
## USB VID 和 PID
|
||||
你可以在编辑`config.h`时使用任何你想用的ID值。实际上,使用任何可能未使用的ID都没有问题,除了有极低的与其他产品发生冲突的可能性。
|
||||
|
||||
大多数QMK主板使用`0xFEED`作为vendor ID。您应该查看其他键盘,以确保选择了唯一的Product ID。
|
||||
|
||||
也要看看这个。
|
||||
https://github.com/tmk/tmk_keyboard/issues/150
|
||||
|
||||
一也可以在下方链接购买一个唯一的VID:PID。不过个人使用似乎用不着这个。
|
||||
- http://www.obdev.at/products/vusb/license.html
|
||||
- http://www.mcselec.com/index.php?page=shop.product_details&flypage=shop.flypage&product_id=92&option=com_phpshop&Itemid=1
|
||||
|
||||
## Cortex: `cstddef: No such file or directory`
|
||||
在Ubuntu 14.04上的GCC 4.8 会出现这种问题需要用这个PPA升级到4.9。
|
||||
https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded
|
||||
|
||||
https://github.com/tmk/tmk_keyboard/issues/212
|
||||
https://github.com/tmk/tmk_keyboard/wiki/mbed-cortex-porting#compile-error-cstddef
|
||||
https://developer.mbed.org/forum/mbed/topic/5205/
|
||||
|
||||
## `clock_prescale_set` and `clock_div_1` Not Available
|
||||
你的工具链太旧了不支持MCU。比如WinAVR 20100110就不支持ATMega32u2.
|
||||
|
||||
```
|
||||
Compiling C: ../../tmk_core/protocol/lufa/lufa.c
|
||||
avr-gcc -c -mmcu=atmega32u2 -gdwarf-2 -DF_CPU=16000000UL -DINTERRUPT_CONTROL_ENDPOINT -DBOOTLOADER_SIZE=4096 -DF_USB=16000000UL -DARCH=ARCH_AVR8 -DUSB_DEVICE_ONLY -DUSE_FLASH_DESCRIPTORS -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DPROTOCOL_LUFA -DEXTRAKEY_ENABLE -DCONSOLE_ENABLE -DCOMMAND_ENABLE -DVERSION=unknown -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fdata-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_alps64/protocol/lufa/lufa.lst -I. -I../../tmk_core -I../../tmk_core/protocol/lufa -I../../tmk_core/protocol/lufa/LUFA-git -I../../tmk_core/common -std=gnu99 -include config.h -MMD -MP -MF .dep/obj_alps64_protocol_lufa_lufa.o.d ../../tmk_core/protocol/lufa/lufa.c -o obj_alps64/protocol/lufa/lufa.o
|
||||
../../tmk_core/protocol/lufa/lufa.c: In function 'setup_mcu':
|
||||
../../tmk_core/protocol/lufa/lufa.c:575: warning: implicit declaration of function 'clock_prescale_set'
|
||||
../../tmk_core/protocol/lufa/lufa.c:575: error: 'clock_div_1' undeclared (first use in this function)
|
||||
../../tmk_core/protocol/lufa/lufa.c:575: error: (Each undeclared identifier is reported only once
|
||||
../../tmk_core/protocol/lufa/lufa.c:575: error: for each function it appears in.)
|
||||
make: *** [obj_alps64/protocol/lufa/lufa.o] Error 1
|
||||
```
|
||||
|
||||
|
||||
## AVR的BOOTLOADER_SIZE
|
||||
注意Teensy2.0++ bootloader的大小是2048字节。有些Makefile注释错了。
|
||||
|
||||
```
|
||||
# Boot Section Size in *bytes*
|
||||
# Teensy halfKay 512
|
||||
# Teensy++ halfKay 2048
|
||||
# Atmel DFU loader 4096 (TMK Alt Controller)
|
||||
# LUFA bootloader 4096
|
||||
# USBaspLoader 2048
|
||||
OPT_DEFS += -DBOOTLOADER_SIZE=2048
|
||||
```
|
||||
|
||||
## 在MacOS上 `avr-gcc: internal compiler error: Abort trap: 6 (program cc1)`
|
||||
这是brew更新的问题,导致AVR GCC依赖的符号链接被损坏。
|
||||
|
||||
解决方案是移除并重新安装所有受影响的模块。
|
||||
|
||||
```
|
||||
brew rm avr-gcc
|
||||
brew rm dfu-programmer
|
||||
brew rm dfu-util
|
||||
brew rm gcc-arm-none-eabi
|
||||
brew rm avrdude
|
||||
brew install avr-gcc
|
||||
brew install dfu-programmer
|
||||
brew install dfu-util
|
||||
brew install gcc-arm-none-eabi
|
||||
brew install avrdude
|
||||
```
|
||||
|
||||
### avr-gcc 8.1 和 LUFA
|
||||
|
||||
如果你把avr-gcc升级到7以上你可能会遇到关于LUFA的问题。比如:
|
||||
|
||||
`lib/lufa/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h:380:5: error: 'const' attribute on function returning 'void'`
|
||||
|
||||
那你就需要在brew中把avr-gcc回退到7。
|
||||
|
||||
```
|
||||
brew uninstall --force avr-gcc
|
||||
brew install avr-gcc@8
|
||||
brew link --force avr-gcc@8
|
||||
```
|
||||
|
||||
### 我刷新了我的键盘但是键盘不工作/按键没有注册 - 而且还是ARM的 (rev6 planck, clueboard 60, hs60v2, etc...) (Feb 2019)
|
||||
由于EEPROM在基于ARM的芯片上的工作原理,保存的设置可能不再有效。这会影响默认层,而且*或许*在某些情况下,会使键盘不好用,我们仍在调查这些情况。重置EEPROM将解决此问题。
|
||||
|
||||
[Planck rev6键盘重置EEPROM](https://cdn.discordapp.com/attachments/473506116718952450/539284620861243409/planck_rev6_default.bin) 是用于强制重置EEPROM的。刷入这个文件后,再次刷入正常固件,这会将键盘恢复到_正常_工作状态。
|
||||
[Preonic rev3键盘重置EEPROM](https://cdn.discordapp.com/attachments/473506116718952450/537849497313738762/preonic_rev3_default.bin)
|
||||
|
||||
如果以任何形式启用了bootmagic, 那么您还需要(看[Bootmagic文档](feature_bootmagic.md) 以及键盘信息,以了解如何执行此操作的详细信息).
|
233
docs/zh-cn/faq_debug.md
Normal file
233
docs/zh-cn/faq_debug.md
Normal file
|
@ -0,0 +1,233 @@
|
|||
# 调试的常见问题
|
||||
|
||||
本篇详细介绍了人们在键盘故障排除时的各种常见问题。
|
||||
|
||||
# 调试控制台
|
||||
|
||||
## `hid_listen` 无法识别设备
|
||||
当设备的调试控制台未就绪时,您将看到如下内容:
|
||||
|
||||
```
|
||||
Waiting for device:.........
|
||||
```
|
||||
|
||||
插入设备后,*hid_listen*找到该设备,您将收到以下消息:
|
||||
|
||||
```
|
||||
Waiting for new device:.........................
|
||||
Listening:
|
||||
```
|
||||
|
||||
如果您无法获得这条“Listening:”消息,请尝试在[Makefile]中使用 `CONSOLE_ENABLE=yes`
|
||||
|
||||
在Linux这样的操作系统上,你可能需要一些权限。
|
||||
- 使用`sudo hid_listen`
|
||||
|
||||
## 控制台没有返回消息
|
||||
检查:
|
||||
- *hid_listen* 找到了你的设备。看前面。
|
||||
- 输入**Magic**+d打开调试。详见[Magic Commands](https://github.com/tmk/tmk_keyboard#magic-commands)。
|
||||
- 设置`debug_enable=true` ,一般存在于**matrix.c**的`matrix_init()`中。
|
||||
- 尝试使用'print'函数而不要用调试输出。详见**common/print.h**。
|
||||
- 断开其他有控制台功能的设备。 详见[Issue #97](https://github.com/tmk/tmk_keyboard/issues/97)。
|
||||
|
||||
## Linux或UNIX这样的系统如何请求超级用户权限
|
||||
用'sudo'来执行*hid_listen*就有权限了。
|
||||
```
|
||||
$ sudo hid_listen
|
||||
```
|
||||
|
||||
或者把一个文件放到规则文件夹来为TMK设备添加*udev规则*,不同系统的目录可能有所不同。
|
||||
|
||||
文件: /etc/udev/rules.d/52-tmk-keyboard.rules(在Ubuntu系统的情况下)
|
||||
```
|
||||
# tmk keyboard products https://github.com/tmk/tmk_keyboard
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="feed", MODE:="0666"
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# 其他
|
||||
## 安全注意事项
|
||||
|
||||
你应该不想要把你的键盘变成"砖头"吧,就是变成没法重写固件的那种。
|
||||
下面讲解一些参数来告诉你什么风险很大(其实也不是很大)。
|
||||
|
||||
- 假如你键盘表面没有设计重置键"RESET", 那你要进入bootloader的话就要按PCB上的RESET了。
|
||||
按PCB上的RESET要拧开键盘底部。
|
||||
- 如果 tmk_core / common 里面的文件丢失键盘可能失灵。
|
||||
- .hex太大可能不太好; `make dfu` 会删除块,检验大小(咦?好像反了...)。
|
||||
一但出错,刷新键盘失败的话就困在DFU出不去了。
|
||||
- 所以, 要知道大小限制。 Planck键盘上.hex文件最大大小是 is 7000h (十进制是28672)
|
||||
|
||||
```
|
||||
Linking: .build/planck_rev4_cbbrowne.elf [OK]
|
||||
Creating load file for Flash: .build/planck_rev4_cbbrowne.hex [OK]
|
||||
|
||||
Size after:
|
||||
text data bss dec hex filename
|
||||
0 22396 0 22396 577c planck_rev4_cbbrowne.hex
|
||||
```
|
||||
|
||||
- 上面那个文件大小是 22396/577ch,比28672/7000h小
|
||||
- 当你有一个合适的.hex文件时,你就要重试加载那个了
|
||||
- 您在键盘Makefile中的某些选项可能消耗额外内存;注意以下这几个
|
||||
BOOTMAGIC_ENABLE, MOUSEKEY_ENABLE, EXTRAKEY_ENABLE, CONSOLE_ENABLE, API_SYSEX_ENABLE
|
||||
- DFU 工具/不/可以写入bootloader (unless you throw in extra fruit salad of options),
|
||||
所以还是有点危险的
|
||||
- EEPROM大概有100000次循环寿命。不要总是频繁重写固件;EEPROM会玩坏的。
|
||||
## 全键无冲不好用
|
||||
首先你要在**Makefile**用如下命令编译固件`NKRO_ENABLE`。
|
||||
|
||||
全键无冲还不好用的话试着用`Magic` **N** 命令(默认是`LShift+RShift+N`)。这个命令会在**全键无冲**和**六键无冲**之间临时切换。有些情况**全键无冲**不好用你就需要使用**六键无冲**模式,尤其是在BIOS中。
|
||||
|
||||
如果你的固件使用`BOOTMAGIC_ENABLE`编译的你要用`BootMagic` **N** 命令(默认`Space+N`)打开开关。这个设置保存在EEPROM中并保存在电源循环中。
|
||||
<!--翻译问题:上面这句翻译的不贴切 -->
|
||||
|
||||
https://github.com/tmk/tmk_keyboard#boot-magic-configuration---virtual-dip-switch
|
||||
|
||||
|
||||
## 指点杆需要复位电路(PS/2 鼠标支持)
|
||||
如果没有复位电路,由于硬件初始化不正确,您将得到不一致的结果。查看TPM754复位电路。
|
||||
|
||||
- http://geekhack.org/index.php?topic=50176.msg1127447#msg1127447
|
||||
- http://www.mikrocontroller.net/attachment/52583/tpm754.pdf
|
||||
|
||||
|
||||
## 矩阵不可读16以上的列
|
||||
当列超过16时[matrix.h]的`read_cols()`中,用`1UL<<16`而不要用`1<<16`。
|
||||
|
||||
在C语言中`1` 是一个[int] 类型的[16 bit]值,在AVR中你不能左移大于15次。如果你使用`1<<16`的话会得到意外的零。你要用 [unsigned long]类型,比如`1UL`。
|
||||
|
||||
http://deskthority.net/workshop-f7/rebuilding-and-redesigning-a-classic-thinkpad-keyboard-t6181-60.html#p146279
|
||||
|
||||
|
||||
## Bootloader跳转不好用
|
||||
在**Makefile**中正确配置**Makefile**大小。如果分区大小不正确,引导加载程序可能无法从**Magic command**和**Boot Magic**加载。
|
||||
```
|
||||
# bootloader字节数:
|
||||
# Atmel DFU loader(ATmega32U4) 4096
|
||||
# Atmel DFU loader(AT90USB128) 8192
|
||||
# LUFA bootloader(ATmega32U4) 4096
|
||||
# Arduino Caterina(ATmega32U4) 4096
|
||||
# USBaspLoader(ATmega***) 2048
|
||||
# Teensy halfKay(ATmega32U4) 512
|
||||
# Teensy++ halfKay(AT90USB128) 2048
|
||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
||||
```
|
||||
AVR引导大小是通过**BOOTSZ**熔丝位来设置的。查阅你单片机的datasheet。
|
||||
记住,datasheet用的是**Word**(2字节)表示大小和地址,TMK用的是**Byte**。
|
||||
|
||||
AVR引导部分位于闪存的末尾,如下所示(Application是应用区,Bootloader是引导区)。
|
||||
```
|
||||
byte Atmel/LUFA(ATMega32u4) byte Atmel(AT90SUB1286)
|
||||
0x0000 +---------------+ 0x00000 +---------------+
|
||||
| | | |
|
||||
| | | |
|
||||
| Application | | Application |
|
||||
| | | |
|
||||
= = = =
|
||||
| | 32KB-4KB | | 128KB-8KB
|
||||
0x6000 +---------------+ 0x1E000 +---------------+
|
||||
| Bootloader | 4KB | Bootloader | 8KB
|
||||
0x7FFF +---------------+ 0x1FFFF +---------------+
|
||||
|
||||
|
||||
byte Teensy(ATMega32u4) byte Teensy++(AT90SUB1286)
|
||||
0x0000 +---------------+ 0x00000 +---------------+
|
||||
| | | |
|
||||
| | | |
|
||||
| Application | | Application |
|
||||
| | | |
|
||||
= = = =
|
||||
| | 32KB-512B | | 128KB-2KB
|
||||
0x7E00 +---------------+ 0x1FC00 +---------------+
|
||||
| Bootloader | 512B | Bootloader | 2KB
|
||||
0x7FFF +---------------+ 0x1FFFF +---------------+
|
||||
```
|
||||
|
||||
详情请见下方issue。
|
||||
https://github.com/tmk/tmk_keyboard/issues/179
|
||||
|
||||
如果你使用TeensyUSB, 有一个[已知bug](https://github.com/qmk/qmk_firmware/issues/164)硬件重置按钮阻止软件定义重置键工作。重新插拔键盘就好了。
|
||||
|
||||
## 特殊额外键不起作用(系统,音频控制键)
|
||||
你要在`rules.mk`定义`EXTRAKEY_ENABLE`在QMK中使用它们。
|
||||
|
||||
```
|
||||
EXTRAKEY_ENABLE = yes # 音频控制和系统控制
|
||||
```
|
||||
|
||||
## 睡眠唤醒不好用
|
||||
|
||||
在Windows查看设备管理器中该键盘设备属性中电源管理选项卡中的`允许此设备唤醒计算机(O)`是否勾选。同时看一眼BIOS设置。
|
||||
|
||||
在主机睡眠时按下任何键都可以唤醒了。
|
||||
|
||||
## 使用Arduino?
|
||||
|
||||
**注意Arduino的针脚名字和主控芯片的不一样。** 比如, Arduino的`D0`并不是`PD0`。自己用原理图捋一下电路。
|
||||
|
||||
- http://arduino.cc/en/uploads/Main/arduino-leonardo-schematic_3b.pdf
|
||||
- http://arduino.cc/en/uploads/Main/arduino-micro-schematic.pdf
|
||||
|
||||
Arduino Leonardo和micro使用**ATMega32U4**,该芯片TMK可用,但Arduino的bootloader会导致问题。
|
||||
|
||||
|
||||
## 在USB AVR使用PF4-7针脚?
|
||||
你要置位MCUCR寄存器JTD位来将PF4-7设置为GPIO。这些针脚默认是JTAG功能。 像ATMega*U* or AT90USB*这样的MCU会受影响。
|
||||
|
||||
如果是用Teensy的话就不需要了。Tennsy自带JTAGEN位未编程来失能该功能。
|
||||
<!--翻译问题:上句可能有错,原文为:Teensy is shipped with JTAGEN fuse bit unprogrammed to disable the function. -->
|
||||
代码如下。
|
||||
```
|
||||
// F接口JTAG失能。在四个周期内写入两次JTD位。
|
||||
MCUCR |= (1<<JTD);
|
||||
MCUCR |= (1<<JTD);
|
||||
```
|
||||
https://github.com/tmk/tmk_keyboard/blob/master/keyboard/hbkb/matrix.c#L67
|
||||
|
||||
阅读ATMega32U4的datasheet中的**26.5.1 MCU Control Register – MCUCR**。
|
||||
|
||||
|
||||
## 为锁定键添加指示灯
|
||||
你要自制CapsLock, ScrollLock 和 NumLock指示灯?见下文。
|
||||
|
||||
http://deskthority.net/workshop-f7/tmk-keyboard-firmware-collection-t4478-120.html#p191560
|
||||
|
||||
## 为Arduino Micro/Leonardo编程
|
||||
按下重置键然后在8秒内运行下方这样的命令。
|
||||
|
||||
```
|
||||
avrdude -patmega32u4 -cavr109 -b57600 -Uflash:w:adb_usb.hex -P/dev/ttyACM0
|
||||
```
|
||||
|
||||
设备名称因系统而异。
|
||||
|
||||
http://arduino.cc/en/Main/ArduinoBoardMicro
|
||||
https://geekhack.org/index.php?topic=14290.msg1563867#msg1563867
|
||||
|
||||
|
||||
## USB 3 兼容性
|
||||
据传说有些人用USB3接口会有问题,用USB2的试试。
|
||||
|
||||
|
||||
## Mac 兼容性
|
||||
### OS X 10.11 和集线器
|
||||
https://geekhack.org/index.php?topic=14290.msg1884034#msg1884034
|
||||
|
||||
|
||||
## 对于BIOS (UEFI)/恢复(睡眠和唤醒)/重新启动 有问题
|
||||
有人说他们的键盘在BIOS中,或许是恢复(睡眠和唤醒)后不工作.
|
||||
|
||||
截止至目前,其根本原因未知,不排除与某些构建选项有关。试着在Makefile中失能`CONSOLE_ENABLE`, `NKRO_ENABLE`, `SLEEP_LED_ENABLE`这样的选项,也试试其他的。
|
||||
|
||||
https://github.com/tmk/tmk_keyboard/issues/266
|
||||
https://geekhack.org/index.php?topic=41989.msg1967778#msg1967778
|
||||
|
||||
|
||||
|
||||
## FLIP 不工作
|
||||
### `AtLibUsbDfu.dll` 未找到
|
||||
从设备管理器中删除当前驱动程序并在设备管理器重新安装一个FLIP提供的程序。
|
||||
http://imgur.com/a/bnwzy
|
19
docs/zh-cn/faq_general.md
Normal file
19
docs/zh-cn/faq_general.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
# 常见问题
|
||||
|
||||
## QMK是什么?
|
||||
|
||||
[QMK](https://github.com/qmk), 是量子机械键盘(Quantum Mechanical Keyboard)的缩写,是一群开源爱好者为定制键盘开发的工具。我们从[QMK固件](https://github.com/qmk/qmk_firmware)开始,这是[TMK](https://github.com/tmk/tmk_keyboard)的魔改分叉。
|
||||
|
||||
### 为什么叫量子(Quantum)?
|
||||
|
||||
<!-- 待修复 译者吐槽:文档作者竟然也不知道为啥。。。 -->
|
||||
|
||||
## QMK和TMK有什么区别?
|
||||
|
||||
TMK最初由[Jun Wako](https://github.com/tmk)设计和执行。QMK始于[Jack Humbert](https://github.com/jackhumbert)为Planck键盘创建的TMK分叉。一段时间后,Jack的分叉就和TMK相去甚远了,于是在2015年,Jack决定改名QMK。
|
||||
|
||||
从技术观点来讲,QMK是TMK添加一些新功能而成的。尤其是QMK扩展了可用的键码,使高级功能进一步丰富比如 `S()`, `LCTL()`, 和 `MO()`。全部键码见[键码](keycodes.md).
|
||||
|
||||
从工程的社区管理来讲TMK自己维护了所有官方支持的键盘,只有很小一部分社区支持。独立社区维护已存在分叉或为其他键盘创建的分叉。默认支持很少的键码,所以用户通常不会与他人分享布局。QMK鼓励通过集中管理仓库分享布局和键盘,我们会采纳所有符合质量标准的PR。这就极大的保证了社区维护,同时QMK小组也会在必要时给予帮助。
|
||||
|
||||
这两种方法都有其优点和缺点,并且代码在有意义时在TMK和QMK之间自由流动。
|
212
docs/zh-cn/faq_keymap.md
Normal file
212
docs/zh-cn/faq_keymap.md
Normal file
|
@ -0,0 +1,212 @@
|
|||
# 布局常见问题
|
||||
|
||||
本页本页包含人们经常遇到的关于布局的问题。如果你觉得没什么问题,请先看[布局概览](keymap.md)。
|
||||
|
||||
## 我能用什么键码?
|
||||
看[键码](keycodes.md)你可以找到你能用的键码索引。可以的话这些链接可以连接到更广泛的文档。
|
||||
|
||||
键码实际上定义在[common/keycode.h](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/keycode.h).
|
||||
|
||||
## 默认的键码什么样?
|
||||
|
||||
世界上有三种标准键盘设计,分别是:ANSI, ISO, and JIS. 主要是北美用ANSI(译者注:中国很多键盘使用这个), 欧洲和非洲主要使用ISO,日本使用JIS。未提及的区域通常使用ANSI或ISO。与这些设计对应的键代码如下所示:
|
||||
|
||||
<!-- 该图片的来源: http://www.keyboard-layout-editor.com/#/gists/bf431647d1001cff5eff20ae55621e9a -->
|
||||
![键盘设计图](https://i.imgur.com/5wsh5wM.png)
|
||||
|
||||
## 我有一些键变成了其他功能或者不工作了
|
||||
|
||||
QMK有两个功能,Bootmagic和命令行,它允许您在运行中更改键盘的行为。该功能包括但不仅限于, 交换Ctrl/Caps,关闭界面,交换Alt/Gui,交换 Backspace/Backslash,禁用所有键,以及其他的行为改变。
|
||||
|
||||
快速解决方法是插入键盘时按住`Space`+`Backspace`。该操作将重置已保存设置,让这些键回复初始功能。这招不好用的话参阅下方:
|
||||
|
||||
* [Bootmagic](feature_bootmagic.md)
|
||||
* [命令](feature_command.md)
|
||||
|
||||
## 菜单键不好用
|
||||
|
||||
现在大多数键盘 `KC_RGUI`和`KC_RCTL`中间的键子叫做`KC_APP`。这是因为在这个键子发明之前相关标准里就已经有键叫做`MENU(菜单)`了,所以微软叫他`APP(应用)`键。
|
||||
|
||||
## `KC_SYSREQ` 不工作
|
||||
使用抓屏的键码(`KC_PSCREEN`或`KC_PSCR`)而不用`KC_SYSREQ`。组合键'Alt + Print Screen'会被当作'System request'。
|
||||
|
||||
见[issue #168](https://github.com/tmk/tmk_keyboard/issues/168)和
|
||||
* http://en.wikipedia.org/wiki/Magic_SysRq_key
|
||||
* http://en.wikipedia.org/wiki/System_request
|
||||
|
||||
## 电源键不工作
|
||||
|
||||
这有点让人困惑,QMK有两个"Power(电源)"键码: `KC_POWER` 在键盘/小键盘的HID使用页面中,`KC_SYSTEM_POWER` (或者叫`KC_PWR`)在用户页。
|
||||
|
||||
前者只能被macOS识别,但是后者,即`KC_SLEP`和`KC_WAKE`三大主要操作系统全都支持,所以推荐使用这两个。Windows下这些键立即生效,macOS要长按直到弹出对话框。
|
||||
|
||||
## 自动大小写锁定
|
||||
可以解决'the'问题(正常应为The)。我经常在输入'The'时不慎输入了'the'或者'THe'。自动大小写锁定可以修正此类问题。详见下方链接。
|
||||
https://github.com/tmk/tmk_keyboard/issues/67
|
||||
|
||||
## 修改 键/层 卡住
|
||||
除非正确配置层切换,否则修改键或层可能会卡住。
|
||||
对于修改键和图层操作,必须把`KC_TRANS`放到目标层的相同位置,用于注销修改键或在释放事件时返回到上一层。
|
||||
* https://github.com/tmk/tmk_core/blob/master/doc/keymap.md#31-momentary-switching
|
||||
* http://geekhack.org/index.php?topic=57008.msg1492604#msg1492604
|
||||
* https://github.com/tmk/tmk_keyboard/issues/248
|
||||
|
||||
|
||||
## 机械自锁开关支持Mechanical Lock Switch Support
|
||||
|
||||
本功能用于*机械自锁开关*比如[this Alps one](http://deskthority.net/wiki/Alps_SKCL_Lock)。你可以通过向`config.h`添加以下宏来使能该功能:
|
||||
|
||||
```
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
#define LOCKING_RESYNC_ENABLE
|
||||
```
|
||||
|
||||
在使能该功能后,要在键盘中使用`KC_LCAP`, `KC_LNUM` 和 `KC_LSCR`这三个键码。
|
||||
|
||||
远古机械键盘偶尔会有自锁机械开关,现在几乎没有了。***大多数情况下你不需要使用该功能,且要使用`KC_CAPS`, `KC_NLCK`和`KC_SLCK`这三个键码。***
|
||||
|
||||
## 输入ASCII之外的特殊字符比如Cédille 'Ç'
|
||||
没有在所有系统中输入这个的通用方法。你要定义针对你的特定操作系统或布局的**宏**。
|
||||
|
||||
比如看这个**宏**代码的文章。
|
||||
|
||||
http://deskthority.net/workshop-f7/tmk-keyboard-firmware-collection-t4478-120.html#p195620
|
||||
<!--翻译问题:下方维基百科链接应全部替换为中文链接,暂未找到全部-->
|
||||
在**Windows**上,可以用`AltGr`键或**Alt码**。
|
||||
* http://en.wikipedia.org/wiki/AltGr_key
|
||||
* https://zh.wikipedia.org/wiki/Alt%E7%A0%81
|
||||
|
||||
在**Mac OS**定义`Option`键组合。
|
||||
* https://zh.wikipedia.org/wiki/Option%E9%94%AE#%E6%9B%BF%E4%BB%A3%E9%94%AE%E7%9B%98%E8%BE%93%E5%85%A5
|
||||
|
||||
在**Xorg**可以改用`compose`键。
|
||||
* http://en.wikipedia.org/wiki/Compose_key
|
||||
|
||||
下方链接查看**Unicode**输入。
|
||||
* http://en.wikipedia.org/wiki/Unicode_input
|
||||
|
||||
## macOS上的`Fn`
|
||||
|
||||
不像大多数FN键,苹果上那个有自己的键码...呃,基本上算吧。 他取缔了基本6键无冲HID报告的第六个键码 -- 所以苹果键盘其实是5键无冲的。
|
||||
|
||||
技术上说QMK可以发送这个键。但是,这样做需要修改报告格式以添加FN键的状态。这还不是最糟糕的,你的键盘的VID和PID和真的苹果键盘不一样的话还不会被识别。
|
||||
QMK官方支持这个会被律师函的,所以就当我没说过。
|
||||
|
||||
详见[issue#2179](https://github.com/qmk/qmk_firmware/issues/2179)。
|
||||
|
||||
|
||||
## Mac OSX的媒体控制键
|
||||
#### KC_MNXT 和 KC_MPRV 在Mac上不好用
|
||||
使用 `KC_MFFD`(`KC_MEDIA_FAST_FORWARD`) 和 `KC_MRWD`(`KC_MEDIA_REWIND`),不要用 `KC_MNXT` 和 `KC_MPRV`.
|
||||
详见 https://github.com/tmk/tmk_keyboard/issues/195
|
||||
|
||||
|
||||
## Mac OSX中支持那些键?
|
||||
你可以从此源码中获知在OSX中支持哪些键码
|
||||
|
||||
`usb_2_adb_keymap` 阵列映射 键盘/小键盘 页用于ADB扫描码(OSX内部键码).
|
||||
|
||||
https://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-606.1.7/IOHIDFamily/Cosmo_USB2ADB.c
|
||||
|
||||
`IOHIDConsumer::dispatchConsumerEvent`会处理用户页面用法。
|
||||
<!--翻译问题:上面那两句翻译的不好-> handles Consumer page usages. -->
|
||||
https://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-606.1.7/IOHIDFamily/IOHIDConsumer.cpp
|
||||
|
||||
|
||||
## Mac OSX中的JIS键
|
||||
岛国特别键比如`無変換(Muhenkan)`, `変換(Henkan)`, `ひらがな(hiragana)`OSX是不是别的。You can use **Seil** to enable those keys, try following options.
|
||||
<!--翻译问题:以上“岛国特别键”没有任何地域歧视的意思 -->
|
||||
* 在电脑键盘上使能NFER键
|
||||
* 在电脑键盘上使能XFER键
|
||||
* 在电脑键盘上使能KATAKAN键
|
||||
|
||||
https://pqrs.org/osx/karabiner/seil.html
|
||||
|
||||
|
||||
## RN-42蓝牙模块与Karabiner不能有效协同工作
|
||||
Karabiner - Mac OSX的改键软件 - 默认RN-42模块是不会被响应的。想要Karabiner和你的键盘协同工作你要使能此选项:
|
||||
https://github.com/tekezo/Karabiner/issues/403#issuecomment-102559237
|
||||
|
||||
此问题详见下方链接。
|
||||
https://github.com/tmk/tmk_keyboard/issues/213
|
||||
https://github.com/tekezo/Karabiner/issues/403
|
||||
|
||||
|
||||
## Esc 和 <code>`</code> 双功能键
|
||||
|
||||
请见[Grave Escape](feature_grave_esc.md)功能。
|
||||
|
||||
## 右侧双角色修改键(诸如Shift、Alt等有修改其他键作用的键)变箭头键
|
||||
右侧修改键单击时会变为箭头键,长按就还是修改键。在TMK中双角色键称之为**TAP**.
|
||||
```
|
||||
|
||||
#include "keymap_common.h"
|
||||
|
||||
|
||||
/* 用TMK双角色键功能实现右侧修改键改箭头键
|
||||
*
|
||||
* https://github.com/tmk/tmk_core/blob/master/doc/keymap.md#213-modifier-with-tap-keydual-role
|
||||
* https://en.wikipedia.org/wiki/Modifier_key#Dual-role_keys
|
||||
*/
|
||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* 0: qwerty */
|
||||
[0] = LAYOUT( \
|
||||
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NUHS,BSPC, \
|
||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \
|
||||
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \
|
||||
LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,FN0, ESC, \
|
||||
FN4, LGUI,LALT, SPC, APP, FN2, FN1, FN3),
|
||||
[1] = LAYOUT( \
|
||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS,TRNS, \
|
||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,\
|
||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \
|
||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,FN5, TRNS, \
|
||||
TRNS,TRNS,TRNS, TRNS, TRNS,FN7, FN6, FN8),
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM fn_actions[] = {
|
||||
[0] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_UP),
|
||||
[1] = ACTION_MODS_TAP_KEY(MOD_RGUI, KC_DOWN),
|
||||
[2] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_LEFT),
|
||||
[3] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_RIGHT),
|
||||
[4] = ACTION_LAYER_MOMENTARY(1),
|
||||
[5] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_PGUP),
|
||||
[6] = ACTION_MODS_TAP_KEY(MOD_RGUI, KC_PGDN),
|
||||
[7] = ACTION_MODS_TAP_KEY(MOD_RALT, KC_HOME),
|
||||
[8] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_END),
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
双角色键说明: https://en.wikipedia.org/wiki/Modifier_key#Dual-role_keys
|
||||
|
||||
|
||||
## Mac OSX的弹出键
|
||||
`KC_EJCT` 键码在OSX可以使用 https://github.com/tmk/tmk_keyboard/issues/250
|
||||
似乎Windows10会忽略该键码,Linux/Xorg可以识别该键码但默认不映射。
|
||||
|
||||
目前尚不清楚如何在真正的苹果键盘按出弹出键。HHKB使用`F20`用于弹出键(`Fn+f`),该功能在MAC模式有效但不保证与苹果弹出键码相符。
|
||||
|
||||
|
||||
## `action_util.c`中的 `weak_mods`和`real_mods`是什么
|
||||
___待改善___
|
||||
|
||||
real_mods 用于保存实际(物理)修改键的实际状态。
|
||||
weak_mods 用于保存虚拟或临时修改键,它将不会影响实际修改键。
|
||||
|
||||
以按下左侧Shift键然后输入ACTION_MODS_KEY(LSHIFT, KC_A)为例,
|
||||
|
||||
在weak_mods时,
|
||||
* (1) 按下不抬起左Shift: real_mods |= MOD_BIT(LSHIFT)
|
||||
* (2) 按 ACTION_MODS_KEY(LSHIFT, KC_A): weak_mods |= MOD_BIT(LSHIFT)
|
||||
* (3) 抬起 ACTION_MODS_KEY(LSHIFT, KC_A): weak_mods &= ~MOD_BIT(LSHIFT)
|
||||
real_mods 还是保持在修改状态。
|
||||
|
||||
在没有weak_mods时,
|
||||
* (1) 按下不抬起左Shift: real_mods |= MOD_BIT(LSHIFT)
|
||||
* (2) 按 ACTION_MODS_KEY(LSHIFT, KC_A): real_mods |= MOD_BIT(LSHIFT)
|
||||
* (3) 抬起 ACTION_MODS_KEY(LSHIFT, KC_A): real_mods &= ~MOD_BIT(LSHIFT)
|
||||
此时real_mods失去‘实际左Shift’的状态。
|
||||
|
||||
weak_mods和real_mods现已全部加入键盘数据包发送豪华套餐。
|
||||
https://github.com/tmk/tmk_core/blob/master/common/action_util.c#L57
|
15
docs/zh-cn/getting_started_getting_help.md
Normal file
15
docs/zh-cn/getting_started_getting_help.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# 获得帮助
|
||||
|
||||
有很多方法来获得关于QMK的帮助.
|
||||
|
||||
## 实时聊天
|
||||
|
||||
你可以在我们的主要[Discord服务器](https://discord.gg/Uq7gcHh)找到QMK的开发者和用户。有很多讨论固件的不同频道, 工具箱(Toolbox), 硬件,配置工具(configurator).
|
||||
|
||||
## OLKB Subreddit
|
||||
|
||||
QMK的官方论坛是[/r/olkb](https://reddit.com/r/olkb) 在[reddit.com](https://reddit.com)上.
|
||||
|
||||
## Github的Issue
|
||||
|
||||
你可以在GitHub上 [提出issue](https://github.com/qmk/qmk_firmware/issues).当您的问题需要长期讨论或调试时,这尤其方便。
|
59
docs/zh-cn/getting_started_github.md
Normal file
59
docs/zh-cn/getting_started_github.md
Normal file
|
@ -0,0 +1,59 @@
|
|||
# 如何在QMK中使用Github
|
||||
|
||||
Github can be a little tricky to those that aren't familiar with it - this guide will walk through each step of forking, cloning, and submitting a pull request with QMK.
|
||||
|
||||
?> 本教程假设您已安装GitHub,并且您喜欢使用命令行工作。
|
||||
|
||||
首先 [Github上的QMK页面](https://github.com/qmk/qmk_firmware), 您能看到右上方有个按钮写着"Fork":
|
||||
|
||||
![从Github上分叉](http://i.imgur.com/8Toomz4.jpg)
|
||||
|
||||
如果你是某组织成员,你将需要选择分叉到哪个账户。一般情况下, 你是想要分叉到你的私人账户下。当你完成分叉 (有时需要等一会), 点击"Clone or Download" 按钮:
|
||||
|
||||
!从Github下载](http://i.imgur.com/N1NYcSz.jpg)
|
||||
|
||||
你要选择 "HTTPS", 然后选择链接复制:
|
||||
|
||||
![HTTPS链接](http://i.imgur.com/eGO0ohO.jpg)
|
||||
|
||||
然后,在命令行输入`git clone `,然后粘贴你的链接:
|
||||
|
||||
```
|
||||
user@computer:~$ git clone https://github.com/whoeveryouare/qmk_firmware.git
|
||||
Cloning into 'qmk_firmware'...
|
||||
remote: Counting objects: 46625, done.
|
||||
remote: Compressing objects: 100% (2/2), done.
|
||||
remote: Total 46625 (delta 0), reused 0 (delta 0), pack-reused 46623
|
||||
Receiving objects: 100% (46625/46625), 84.47 MiB | 3.14 MiB/s, done.
|
||||
Resolving deltas: 100% (29362/29362), done.
|
||||
Checking out files: 100% (2799/2799), done.
|
||||
```
|
||||
|
||||
现在你本地计算机有QMK的分叉了,你可以添加你的布局了, 为你的键盘编译并刷新固件吧。如果你觉得你的修改很不错, 你可以添加,提交,然后想你的分叉推出(pull)你的改变,像这样:
|
||||
|
||||
```
|
||||
user@computer:~$ git add .
|
||||
user@computer:~$ git commit -m "adding my keymap"
|
||||
[master cccb1608] adding my keymap
|
||||
1 file changed, 1 insertion(+)
|
||||
create mode 100644 keyboards/planck/keymaps/mine/keymap.c
|
||||
user@computer:~$ git push
|
||||
Counting objects: 1, done.
|
||||
Delta compression using up to 4 threads.
|
||||
Compressing objects: 100% (1/1), done.
|
||||
Writing objects: 100% (1/1), 1.64 KiB | 0 bytes/s, done.
|
||||
Total 1 (delta 1), reused 0 (delta 0)
|
||||
remote: Resolving deltas: 100% (1/1), completed with 1 local objects.
|
||||
To https://github.com/whoeveryouare/qmk_firmware.git
|
||||
+ 20043e64...7da94ac5 master -> master
|
||||
```
|
||||
|
||||
现在你的改动已经在你Github上的分支中了 - 如果你回到这 (`https://github.com/你的GitHub账户名/qmk_firmware`) ,你可以点击下方所示按钮创建 "New Pull Request":
|
||||
|
||||
![新的 Pull Request](http://i.imgur.com/DxMHpJ8.jpg)
|
||||
|
||||
现在你可以看到你所做的一切 - 如果看起来不错, 就可以点击 "Create Pull Request"定稿了:
|
||||
|
||||
![创建Pull Request](http://i.imgur.com/Ojydlaj.jpg)
|
||||
|
||||
提交后,我们会开跟你说你的改动,要求您进行更改, 并最终接受您的更改!感谢您为QMK做的贡献 :)
|
23
docs/zh-cn/newbs.md
Normal file
23
docs/zh-cn/newbs.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
# QMK菜鸟教程
|
||||
|
||||
QMK是为你机械硬盘设计的的一个强大的开源固件。使用QMK可以很简单的让你的定制键盘变得强大。看完这篇文章,无论你是菜鸟还是大佬,都可以顺利的使用QMK来定制键盘。
|
||||
|
||||
你是否为不知道你的键盘能不能运行QMK而苦恼? 如果你的机械键盘是你自己做的,那么这把键盘一般可以运行QMK。我们提供了[一大堆自制键盘](http://qmk.fm/keyboards/), 所以即便你的键盘不能运行QMK你也很容易能找到满足你需求的键盘。
|
||||
|
||||
## 概览
|
||||
|
||||
这个教程有7个主要部分:
|
||||
|
||||
* [新手上路](newbs_getting_started.md)
|
||||
* [用命令行构建你的第一个固件](newbs_building_firmware.md)
|
||||
* [用在线界面构建你的第一个固件](newbs_building_firmware_configurator.md)
|
||||
* [刷新固件](newbs_flashing.md)
|
||||
* [测试和调试](newbs_testing_debugging.md)
|
||||
* [Git最佳实践](newbs_best_practices.md)
|
||||
* [其他学习资源](newbs_learn_more_resources.md)
|
||||
|
||||
这份教程旨在帮助没有固件构建经验的人,也是根据该目的做出选择和建议。这些程序有很多替代方法,大部分替代我们都支持。如果你对完成一个任务有疑问,可以[向我们寻求帮助](getting_started_getting_help.md).
|
||||
|
||||
## 其他资源
|
||||
|
||||
* [Thomas Baart的 QMK基础博客](https://thomasbaart.nl/category/mechanical-keyboards/firmware/qmk/qmk-basics/) – 这是一个用户创建的博客,涵盖了为新手准备的使用QMK的基础知识。
|
170
docs/zh-cn/reference_glossary.md
Normal file
170
docs/zh-cn/reference_glossary.md
Normal file
|
@ -0,0 +1,170 @@
|
|||
# QMK术语表
|
||||
|
||||
## ARM
|
||||
多家公司生产的32位单片机系列,例如Atmel, Cypress, Kinetis, NXP, ST, 和 TI等公司。
|
||||
|
||||
## AVR
|
||||
[Atmel](http://www.microchip.com/)公司的单片机系列。 AVR是TMK的初始支持平台。
|
||||
|
||||
## AZERTY
|
||||
Français (法国)标准键盘布局。用键盘的前六个字母命名。
|
||||
|
||||
## Backlight(背光)
|
||||
键盘上照明的通称。背光通常是一组LED灯,通过键帽或者按轴发光,但也不总是这样。
|
||||
|
||||
## Bluetooth(蓝牙)
|
||||
一种短距离点对点无线协议。许多多无线键盘使用此协议。
|
||||
|
||||
## Bootloader(引导加载程序)
|
||||
一种写到你单片机的保护区的特殊的程序,该程序可以使单片机升级自己的固件,通常是通过USB来升级。
|
||||
|
||||
## Bootmagic(热改键)
|
||||
允许各种键盘行为动态变化的功能,如交换或禁用常用键。
|
||||
|
||||
## C
|
||||
一种适用于系统代码的低级编程语言。大多数qmk代码是用C编写的。
|
||||
|
||||
## Colemak
|
||||
一种流行的键盘布局。
|
||||
|
||||
## Compile(编译)
|
||||
把人可读的代码转换成你的单片机可以运行的机器代码的过程。
|
||||
|
||||
## Dvorak
|
||||
一个由August Dvorak博士在20世纪30年代创建的布局。Dvorak简化键盘(Dvorak Simplified Keyboard)的缩写。
|
||||
|
||||
## Dynamic Macro(动态宏)
|
||||
一种记录在键盘上的宏,当键盘拔出或计算机重新启动时,宏将丢失。
|
||||
|
||||
* [动态宏文档](feature_dynamic_macros.md)
|
||||
|
||||
## Eclipse
|
||||
是一种受C语言开发者追捧的集成开发环境(IDE)。
|
||||
|
||||
* [Eclipse安装说明](eclipse.md)
|
||||
|
||||
## Firmware(固件)
|
||||
用来控制单片机的软件。
|
||||
|
||||
## FLIP
|
||||
爱特梅尔(Atmel)提供的AVR器件刷写软件。我们一般推荐 [QMK刷写工具](https://github.com/qmk/qmk_flasher),但是对于一些高级用例,需要FLIP。
|
||||
|
||||
## git
|
||||
命令行版本控制软件
|
||||
|
||||
## GitHub
|
||||
负责大多数QMK项目的网站。它是Git、问题跟踪和其他帮助我们运行qmk的功能的集成平台。
|
||||
|
||||
## ISP(在系统编程)
|
||||
在系统编程(In-system programming), 使用外部硬件和JTAG管脚对AVR芯片进行编程的一种方法。
|
||||
|
||||
## hid_listen
|
||||
从键盘接收调试消息的接口。 您可以使用[QMK Flasher](https://github.com/qmk/qmk_flasher)或[PJRC's hid_listen](https://www.pjrc.com/teensy/hid_listen.html)查看这些消息
|
||||
|
||||
## Keycode(键码)
|
||||
表示特定键的2字节数据。`0x00`-`0xFF`用于[基本键码](keycodes_basic.md)而`0x100`-`0xFFFF`用于[量子键码](quantum_keycodes.md).
|
||||
|
||||
## Key Down
|
||||
一个键按下尚未抬起时触发的事件。
|
||||
|
||||
## Key Up
|
||||
一个键抬起时触发的事件。
|
||||
|
||||
## Keymap(键映射)
|
||||
映射到物理键盘布局的一组键码,在按键和按键释放时进行处理。有时翻译为布局,意为软件上表示的布局,即映射。
|
||||
|
||||
## Layer(层)
|
||||
为了让一个键实现多个功能的抽象结构。最高活动层有限。
|
||||
|
||||
## Leader Key(前导键、设置菜单键)
|
||||
本功能允许您点击前导键,然后按顺序按1-3个键子来激活按键或其他量子功能。
|
||||
|
||||
* [前导键文档](feature_leader_key.md)
|
||||
|
||||
## LED
|
||||
发光二极管,键盘上最常用的指示灯装置。
|
||||
|
||||
## Make
|
||||
用于编译所有源文件的软件包。可以使用`make`命令和其他参数来编译你的固件。
|
||||
|
||||
## Matrix(矩阵)
|
||||
一种由列和行组成的接线模式,使单片机能够用较少的引脚检测按键。矩阵通常包含二极管,以达到全键无冲。
|
||||
|
||||
## Macro(宏)
|
||||
本功能可以在敲击单个键后发送多个按键事件(hid报告)。
|
||||
|
||||
* [宏文档](feature_macros.md)
|
||||
|
||||
## MCU(单片机、微控制单元)
|
||||
微控制单元,键盘的处理器。
|
||||
|
||||
## Modifier(修改键、修饰键、功能键)
|
||||
按住该键将会改变其他键的功能,修饰键包括 Ctrl, Alt, 和 Shift。
|
||||
|
||||
## Mousekeys(鼠标键)
|
||||
本功能在您敲击键盘时会控制鼠标光标。
|
||||
|
||||
* [鼠标键文档](feature_mouse_keys.md)
|
||||
|
||||
## N-Key Rollover (NKRO、全键无冲)
|
||||
一种术语,适用于能够同时报告任意数量按键的键盘。
|
||||
|
||||
## Oneshot Modifier(粘滞键)
|
||||
一种能让你的功能键一直保持按下,直到你按下其他键的功能。它叫做粘滞键或叫做粘连键,该功能由软件实现而非机械结构。
|
||||
|
||||
## ProMicro
|
||||
一种低成本AVR开发板。这种板子很容易在购物网站找到(价格不到20RMB),但是据说刷写pro micro有点令人抓狂。
|
||||
|
||||
## Pull Request(拉请求、PR)
|
||||
向QMK请求提交代码。我们鼓励所有用户提交你们自己的键盘的代码。
|
||||
|
||||
## QWERTY
|
||||
标准英文键盘,通常也用于其他语言,例如中文。是用键盘前6个字母命名的。
|
||||
|
||||
## QWERTZ
|
||||
标准Deutsche(德语)键盘布局。使用前6个字母明名。
|
||||
|
||||
## Rollover(允许翻转、无冲形式)
|
||||
该术语表示在一个键已按下时按下另一个键。形式包括2KRO(双键无冲),6KRO(6键无冲),和NKRO(全键无冲),无冲表示可同时按下而不产生冲突的键的数量。
|
||||
|
||||
## Scancode(扫描码)
|
||||
HID报告中的一个1字节的数字,表示一个键子。这些数字在下列文档中[HID Usage Tables](https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf)该文档发布于[USB-IF](http://www.usb.org/)。
|
||||
|
||||
## Space Cadet键盘的shift键
|
||||
一种特使的shift设置,能让你通过敲击左或右shift一次或多次键入不同的括号。
|
||||
|
||||
* [Space Cadet键盘文档](feature_space_cadet.md)
|
||||
|
||||
## Tap(敲击、单击)
|
||||
按下并释放一个键。在某些情况下您需要区分键按下和键抬起,但是单击把两个事件都包括了。
|
||||
|
||||
## Tap Dance(多击键)
|
||||
本功能允许向同一个键子分配多个键码,并根据按键次数区分。
|
||||
|
||||
* [多击键文档](feature_tap_dance.md)
|
||||
|
||||
## Teensy
|
||||
一种低成本AVR开发板<!--译者吐槽:我怎么感觉成本不低。好吧,我穷。 -->,通常用于手工连线键盘。这个teensy是有点小贵但是halfkay bootloader会让它刷写十分简单,所以也很常用。
|
||||
|
||||
## Underlight(背光)
|
||||
用于照亮电路板底面的LED的总称。这些LED通常从印刷电路板的底部向键盘所在的表面发光。
|
||||
|
||||
## Unicode
|
||||
在较大的计算机世界中,Unicode是一组编码方案,用于表示任何语言中的字符。 与qmk相关的是,它意味着使用各种操作系统方案来发送Unicode代码点,而不是扫描码。
|
||||
|
||||
* [Unicode文档](feature_unicode.md)
|
||||
|
||||
## Unit Testing(单元测试)
|
||||
针对qmk的自动运行测试框架。单元测试帮助我们确信我们的更改不会破坏任何东西。
|
||||
|
||||
* [单元测试文档](unit_testing.md)
|
||||
|
||||
## USB
|
||||
通用串行总线,键盘最常见的有线接口。
|
||||
|
||||
## USB 主机 (或简易主机)
|
||||
USB诸暨市你的电脑,或者你的键盘所插的任何设备。
|
||||
|
||||
# 并没有找到你想找到的术语?
|
||||
|
||||
[建立一个issue](https://github.com/qmk/qmk_firmware/issues) ,想好你的问题,或许你所问的术语就会添加到这里。创建一个PR帮我们添加需要添加的术语当然坠吼了:)
|
|
@ -32,12 +32,10 @@
|
|||
|
||||
static uint8_t i2c_address;
|
||||
|
||||
// This configures the I2C clock to 400khz assuming a 72Mhz clock
|
||||
// For more info : https://www.st.com/en/embedded-software/stsw-stm32126.html
|
||||
static const I2CConfig i2cconfig = {
|
||||
STM32_TIMINGR_PRESC(15U) |
|
||||
STM32_TIMINGR_SCLDEL(4U) | STM32_TIMINGR_SDADEL(2U) |
|
||||
STM32_TIMINGR_SCLH(15U) | STM32_TIMINGR_SCLL(21U),
|
||||
STM32_TIMINGR_PRESC(I2C1_TIMINGR_PRESC) |
|
||||
STM32_TIMINGR_SCLDEL(I2C1_TIMINGR_SCLDEL) | STM32_TIMINGR_SDADEL(I2C1_TIMINGR_SDADEL) |
|
||||
STM32_TIMINGR_SCLH(I2C1_TIMINGR_SCLH) | STM32_TIMINGR_SCLL(I2C1_TIMINGR_SCLL),
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
@ -58,13 +56,13 @@ __attribute__ ((weak))
|
|||
void i2c_init(void)
|
||||
{
|
||||
// Try releasing special pins for a short time
|
||||
palSetPadMode(I2C1_BANK, I2C1_SCL, PAL_MODE_INPUT);
|
||||
palSetPadMode(I2C1_BANK, I2C1_SDA, PAL_MODE_INPUT);
|
||||
palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_INPUT);
|
||||
palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_INPUT);
|
||||
|
||||
chThdSleepMilliseconds(10);
|
||||
|
||||
palSetPadMode(I2C1_BANK, I2C1_SCL, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN);
|
||||
palSetPadMode(I2C1_BANK, I2C1_SDA, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN);
|
||||
palSetPadMode(I2C1_SCL_BANK, I2C1_SCL, PAL_MODE_ALTERNATE(I2C1_SCL_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
|
||||
palSetPadMode(I2C1_SDA_BANK, I2C1_SDA, PAL_MODE_ALTERNATE(I2C1_SDA_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
|
||||
|
||||
//i2cInit(); //This is invoked by halInit() so no need to redo it.
|
||||
}
|
||||
|
|
|
@ -26,9 +26,19 @@
|
|||
#include "ch.h"
|
||||
#include <hal.h>
|
||||
|
||||
#ifndef I2C1_BANK
|
||||
#define I2C1_BANK GPIOB
|
||||
#ifdef I2C1_BANK
|
||||
#define I2C1_SCL_BANK I2C1_BANK
|
||||
#define I2C1_SDA_BANK I2C1_BANK
|
||||
#endif
|
||||
|
||||
#ifndef I2C1_SCL_BANK
|
||||
#define I2C1_SCL_BANK GPIOB
|
||||
#endif
|
||||
|
||||
#ifndef I2C1_SDA_BANK
|
||||
#define I2C1_SDA_BANK GPIOB
|
||||
#endif
|
||||
|
||||
#ifndef I2C1_SCL
|
||||
#define I2C1_SCL 6
|
||||
#endif
|
||||
|
@ -36,6 +46,32 @@
|
|||
#define I2C1_SDA 7
|
||||
#endif
|
||||
|
||||
// The default PAL alternate modes are used to signal that the pins are used for I2C
|
||||
#ifndef I2C1_SCL_PAL_MODE
|
||||
#define I2C1_SCL_PAL_MODE 4
|
||||
#endif
|
||||
#ifndef I2C1_SDA_PAL_MODE
|
||||
#define I2C1_SDA_PAL_MODE 4
|
||||
#endif
|
||||
|
||||
// The default timing values below configures the I2C clock to 400khz assuming a 72Mhz clock
|
||||
// For more info : https://www.st.com/en/embedded-software/stsw-stm32126.html
|
||||
#ifndef I2C1_TIMINGR_PRESC
|
||||
#define I2C1_TIMINGR_PRESC 15U
|
||||
#endif
|
||||
#ifndef I2C1_TIMINGR_SCLDEL
|
||||
#define I2C1_TIMINGR_SCLDEL 4U
|
||||
#endif
|
||||
#ifndef I2C1_TIMINGR_SDADEL
|
||||
#define I2C1_TIMINGR_SDADEL 2U
|
||||
#endif
|
||||
#ifndef I2C1_TIMINGR_SCLH
|
||||
#define I2C1_TIMINGR_SCLH 15U
|
||||
#endif
|
||||
#ifndef I2C1_TIMINGR_SCLL
|
||||
#define I2C1_TIMINGR_SCLL 21U
|
||||
#endif
|
||||
|
||||
#ifndef I2C_DRIVER
|
||||
#define I2C_DRIVER I2CD1
|
||||
#endif
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#include "rgblight_types.h"
|
||||
#include "color.h"
|
||||
|
||||
|
||||
/* User Interface
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
//#include "ws2812_config.h"
|
||||
//#include "i2cmaster.h"
|
||||
|
||||
#include "rgblight_types.h"
|
||||
#include "quantum/color.h"
|
||||
|
||||
/* User Interface
|
||||
*
|
||||
|
|
|
@ -75,10 +75,10 @@ uint8_t g_twi_transfer_buffer[20];
|
|||
// buffers and the transfers in IS31FL3733_write_pwm_buffer() but it's
|
||||
// probably not worth the extra complexity.
|
||||
uint8_t g_pwm_buffer[DRIVER_COUNT][192];
|
||||
bool g_pwm_buffer_update_required = false;
|
||||
bool g_pwm_buffer_update_required[DRIVER_COUNT] = { false };
|
||||
|
||||
uint8_t g_led_control_registers[DRIVER_COUNT][24] = { { 0 }, { 0 } };
|
||||
bool g_led_control_registers_update_required = false;
|
||||
bool g_led_control_registers_update_required[DRIVER_COUNT] = { false };
|
||||
|
||||
void IS31FL3733_write_register( uint8_t addr, uint8_t reg, uint8_t data )
|
||||
{
|
||||
|
@ -123,12 +123,13 @@ void IS31FL3733_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer )
|
|||
}
|
||||
}
|
||||
|
||||
void IS31FL3733_init( uint8_t addr )
|
||||
void IS31FL3733_init( uint8_t addr, uint8_t sync)
|
||||
{
|
||||
// In order to avoid the LEDs being driven with garbage data
|
||||
// in the LED driver's PWM registers, shutdown is enabled last.
|
||||
// Set up the mode and other settings, clear the PWM registers,
|
||||
// then disable software shutdown.
|
||||
// Sync is passed so set it according to the datasheet.
|
||||
|
||||
// Unlock the command register.
|
||||
IS31FL3733_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 );
|
||||
|
@ -161,7 +162,7 @@ void IS31FL3733_init( uint8_t addr )
|
|||
// Set global current to maximum.
|
||||
IS31FL3733_write_register( addr, ISSI_REG_GLOBALCURRENT, 0xFF );
|
||||
// Disable software shutdown.
|
||||
IS31FL3733_write_register( addr, ISSI_REG_CONFIGURATION, 0x01 );
|
||||
IS31FL3733_write_register( addr, ISSI_REG_CONFIGURATION, (sync << 6) | 0x01 );
|
||||
|
||||
// Wait 10ms to ensure the device has woken up.
|
||||
#ifdef __AVR__
|
||||
|
@ -179,7 +180,7 @@ void IS31FL3733_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
|
|||
g_pwm_buffer[led.driver][led.r] = red;
|
||||
g_pwm_buffer[led.driver][led.g] = green;
|
||||
g_pwm_buffer[led.driver][led.b] = blue;
|
||||
g_pwm_buffer_update_required = true;
|
||||
g_pwm_buffer_update_required[led.driver] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,35 +219,34 @@ void IS31FL3733_set_led_control_register( uint8_t index, bool red, bool green, b
|
|||
g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b);
|
||||
}
|
||||
|
||||
g_led_control_registers_update_required = true;
|
||||
g_led_control_registers_update_required[led.driver] = true;
|
||||
|
||||
}
|
||||
|
||||
void IS31FL3733_update_pwm_buffers( uint8_t addr1, uint8_t addr2 )
|
||||
void IS31FL3733_update_pwm_buffers( uint8_t addr, uint8_t index )
|
||||
{
|
||||
if ( g_pwm_buffer_update_required )
|
||||
if ( g_pwm_buffer_update_required[index] )
|
||||
{
|
||||
// Firstly we need to unlock the command register and select PG1
|
||||
IS31FL3733_write_register( addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 );
|
||||
IS31FL3733_write_register( addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM );
|
||||
IS31FL3733_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 );
|
||||
IS31FL3733_write_register( addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM );
|
||||
|
||||
IS31FL3733_write_pwm_buffer( addr1, g_pwm_buffer[0] );
|
||||
//IS31FL3733_write_pwm_buffer( addr2, g_pwm_buffer[1] );
|
||||
IS31FL3733_write_pwm_buffer( addr, g_pwm_buffer[index] );
|
||||
}
|
||||
g_pwm_buffer_update_required = false;
|
||||
g_pwm_buffer_update_required[index] = false;
|
||||
}
|
||||
|
||||
void IS31FL3733_update_led_control_registers( uint8_t addr1, uint8_t addr2 )
|
||||
void IS31FL3733_update_led_control_registers( uint8_t addr, uint8_t index )
|
||||
{
|
||||
if ( g_led_control_registers_update_required )
|
||||
if ( g_led_control_registers_update_required[index] )
|
||||
{
|
||||
// Firstly we need to unlock the command register and select PG0
|
||||
IS31FL3733_write_register( addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 );
|
||||
IS31FL3733_write_register( addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL );
|
||||
IS31FL3733_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 );
|
||||
IS31FL3733_write_register( addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL );
|
||||
for ( int i=0; i<24; i++ )
|
||||
{
|
||||
IS31FL3733_write_register(addr1, i, g_led_control_registers[0][i] );
|
||||
//IS31FL3733_write_register(addr2, i, g_led_control_registers[1][i] );
|
||||
IS31FL3733_write_register(addr, i, g_led_control_registers[index][i] );
|
||||
}
|
||||
}
|
||||
g_led_control_registers_update_required[index] = false;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ typedef struct is31_led {
|
|||
|
||||
extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
|
||||
|
||||
void IS31FL3733_init( uint8_t addr );
|
||||
void IS31FL3733_init( uint8_t addr, uint8_t sync );
|
||||
void IS31FL3733_write_register( uint8_t addr, uint8_t reg, uint8_t data );
|
||||
void IS31FL3733_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer );
|
||||
|
||||
|
@ -45,8 +45,8 @@ void IS31FL3733_set_led_control_register( uint8_t index, bool red, bool green, b
|
|||
// (eg. from a timer interrupt).
|
||||
// Call this while idle (in between matrix scans).
|
||||
// If the buffer is dirty, it will update the driver with the buffer.
|
||||
void IS31FL3733_update_pwm_buffers( uint8_t addr1, uint8_t addr2 );
|
||||
void IS31FL3733_update_led_control_registers( uint8_t addr1, uint8_t addr2 );
|
||||
void IS31FL3733_update_pwm_buffers( uint8_t addr, uint8_t index );
|
||||
void IS31FL3733_update_led_control_registers( uint8_t addr, uint8_t index );
|
||||
|
||||
#define A_1 0x00
|
||||
#define A_2 0x01
|
||||
|
|
|
@ -33,6 +33,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#endif // defined(__AVR__)
|
||||
|
||||
// Used commands from spec sheet: https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf
|
||||
// for SH1106: https://www.velleman.eu/downloads/29/infosheets/sh1106_datasheet.pdf
|
||||
|
||||
// Fundamental Commands
|
||||
#define CONTRAST 0x81
|
||||
#define DISPLAY_ALL_ON 0xA5
|
||||
|
@ -40,6 +42,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define NORMAL_DISPLAY 0xA6
|
||||
#define DISPLAY_ON 0xAF
|
||||
#define DISPLAY_OFF 0xAE
|
||||
#define NOP 0xE3
|
||||
|
||||
// Scrolling Commands
|
||||
#define ACTIVATE_SCROLL 0x2F
|
||||
|
@ -53,6 +56,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define MEMORY_MODE 0x20
|
||||
#define COLUMN_ADDR 0x21
|
||||
#define PAGE_ADDR 0x22
|
||||
#define PAM_SETCOLUMN_LSB 0x00
|
||||
#define PAM_SETCOLUMN_MSB 0x10
|
||||
#define PAM_PAGE_ADDR 0xB0 // 0xb0 -- 0xb7
|
||||
|
||||
// Hardware Configuration Commands
|
||||
#define DISPLAY_START_LINE 0x40
|
||||
|
@ -63,6 +69,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define COM_SCAN_DEC 0xC8
|
||||
#define DISPLAY_OFFSET 0xD3
|
||||
#define COM_PINS 0xDA
|
||||
#define COM_PINS_SEQ 0x02
|
||||
#define COM_PINS_ALT 0x12
|
||||
#define COM_PINS_SEQ_LR 0x22
|
||||
#define COM_PINS_ALT_LR 0x32
|
||||
|
||||
// Timing & Driving Commands
|
||||
#define DISPLAY_CLOCK 0xD5
|
||||
|
@ -154,7 +164,11 @@ bool oled_init(uint8_t rotation) {
|
|||
DISPLAY_OFFSET, 0x00,
|
||||
DISPLAY_START_LINE | 0x00,
|
||||
CHARGE_PUMP, 0x14,
|
||||
MEMORY_MODE, 0x00, }; // Horizontal addressing mode
|
||||
#if (OLED_IC != OLED_IC_SH1106)
|
||||
// MEMORY_MODE is unsupported on SH1106 (Page Addressing only)
|
||||
MEMORY_MODE, 0x00, // Horizontal addressing mode
|
||||
#endif
|
||||
};
|
||||
if (I2C_TRANSMIT_P(display_setup1) != I2C_STATUS_SUCCESS) {
|
||||
print("oled_init cmd set 1 failed\n");
|
||||
return false;
|
||||
|
@ -182,7 +196,7 @@ bool oled_init(uint8_t rotation) {
|
|||
|
||||
static const uint8_t PROGMEM display_setup2[] = {
|
||||
I2C_CMD,
|
||||
COM_PINS, 0x02,
|
||||
COM_PINS, OLED_COM_PINS,
|
||||
CONTRAST, 0x8F,
|
||||
PRE_CHARGE_PERIOD, 0xF1,
|
||||
VCOM_DETECT, 0x40,
|
||||
|
@ -215,10 +229,25 @@ void oled_clear(void) {
|
|||
|
||||
static void calc_bounds(uint8_t update_start, uint8_t* cmd_array)
|
||||
{
|
||||
cmd_array[1] = OLED_BLOCK_SIZE * update_start % OLED_DISPLAY_WIDTH;
|
||||
cmd_array[4] = OLED_BLOCK_SIZE * update_start / OLED_DISPLAY_WIDTH;
|
||||
// Calculate commands to set memory addressing bounds.
|
||||
uint8_t start_page = OLED_BLOCK_SIZE * update_start / OLED_DISPLAY_WIDTH;
|
||||
uint8_t start_column = OLED_BLOCK_SIZE * update_start % OLED_DISPLAY_WIDTH;
|
||||
#if (OLED_IC == OLED_IC_SH1106)
|
||||
// Commands for Page Addressing Mode. Sets starting page and column; has no end bound.
|
||||
// Column value must be split into high and low nybble and sent as two commands.
|
||||
cmd_array[0] = PAM_PAGE_ADDR | start_page;
|
||||
cmd_array[1] = PAM_SETCOLUMN_LSB | ((OLED_COLUMN_OFFSET + start_column) & 0x0f);
|
||||
cmd_array[2] = PAM_SETCOLUMN_MSB | ((OLED_COLUMN_OFFSET + start_column) >> 4 & 0x0f);
|
||||
cmd_array[3] = NOP;
|
||||
cmd_array[4] = NOP;
|
||||
cmd_array[5] = NOP;
|
||||
#else
|
||||
// Commands for use in Horizontal Addressing mode.
|
||||
cmd_array[1] = start_column;
|
||||
cmd_array[4] = start_page;
|
||||
cmd_array[2] = (OLED_BLOCK_SIZE + OLED_DISPLAY_WIDTH - 1) % OLED_DISPLAY_WIDTH + cmd_array[1];
|
||||
cmd_array[5] = (OLED_BLOCK_SIZE + OLED_DISPLAY_WIDTH - 1) / OLED_DISPLAY_WIDTH - 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void calc_bounds_90(uint8_t update_start, uint8_t* cmd_array)
|
||||
|
|
|
@ -19,22 +19,47 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
// an enumeration of the chips this driver supports
|
||||
#define OLED_IC_SSD1306 0
|
||||
#define OLED_IC_SH1106 1
|
||||
|
||||
#if defined(OLED_DISPLAY_CUSTOM)
|
||||
// Expected user to implement the necessary defines
|
||||
#elif defined(OLED_DISPLAY_128X64)
|
||||
// Double height 128x64
|
||||
#ifndef OLED_DISPLAY_WIDTH
|
||||
#define OLED_DISPLAY_WIDTH 128
|
||||
#endif
|
||||
#ifndef OLED_DISPLAY_HEIGHT
|
||||
#define OLED_DISPLAY_HEIGHT 64
|
||||
#endif
|
||||
#ifndef OLED_MATRIX_SIZE
|
||||
#define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 1024 (compile time mathed)
|
||||
#define OLED_BLOCK_TYPE uint32_t
|
||||
#endif
|
||||
#ifndef OLED_BLOCK_TYPE
|
||||
#define OLED_BLOCK_TYPE uint16_t
|
||||
#endif
|
||||
#ifndef OLED_BLOCK_COUNT
|
||||
#define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 32 (compile time mathed)
|
||||
#endif
|
||||
#ifndef OLED_BLOCK_SIZE
|
||||
#define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed)
|
||||
#endif
|
||||
#ifndef OLED_COM_PINS
|
||||
#define OLED_COM_PINS COM_PINS_ALT
|
||||
#endif
|
||||
|
||||
// For 90 degree rotation, we map our internal matrix to oled matrix using fixed arrays
|
||||
// The OLED writes to it's memory horizontally, starting top left, but our memory starts bottom left in this mode
|
||||
#define OLED_SOURCE_MAP { 32, 40, 48, 56 }
|
||||
#define OLED_TARGET_MAP { 24, 16, 8, 0 }
|
||||
#ifndef OLED_SOURCE_MAP
|
||||
#define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 }
|
||||
#endif
|
||||
#ifndef OLED_TARGET_MAP
|
||||
#define OLED_TARGET_MAP { 56, 48, 40, 32, 24, 16, 8, 0 }
|
||||
#endif
|
||||
// If OLED_BLOCK_TYPE is uint32_t, these tables would look like:
|
||||
// #define OLED_SOURCE_MAP { 32, 40, 48, 56 }
|
||||
// #define OLED_TARGET_MAP { 24, 16, 8, 0 }
|
||||
// If OLED_BLOCK_TYPE is uint16_t, these tables would look like:
|
||||
// #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 }
|
||||
// #define OLED_TARGET_MAP { 56, 48, 40, 32, 24, 16, 8, 0 }
|
||||
|
@ -43,23 +68,51 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// #define OLED_TARGET_MAP { 56, 120, 48, 112, 40, 104, 32, 96, 24, 88, 16, 80, 8, 72, 0, 64 }
|
||||
#else // defined(OLED_DISPLAY_128X64)
|
||||
// Default 128x32
|
||||
#ifndef OLED_DISPLAY_WIDTH
|
||||
#define OLED_DISPLAY_WIDTH 128
|
||||
#endif
|
||||
#ifndef OLED_DISPLAY_HEIGHT
|
||||
#define OLED_DISPLAY_HEIGHT 32
|
||||
#endif
|
||||
#ifndef OLED_MATRIX_SIZE
|
||||
#define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 512 (compile time mathed)
|
||||
#endif
|
||||
#ifndef OLED_BLOCK_TYPE
|
||||
#define OLED_BLOCK_TYPE uint16_t // Type to use for segmenting the oled display for smart rendering, use unsigned types only
|
||||
#endif
|
||||
#ifndef OLED_BLOCK_COUNT
|
||||
#define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 16 (compile time mathed)
|
||||
#endif
|
||||
#ifndef OLED_BLOCK_SIZE
|
||||
#define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed)
|
||||
#endif
|
||||
#ifndef OLED_COM_PINS
|
||||
#define OLED_COM_PINS COM_PINS_SEQ
|
||||
#endif
|
||||
|
||||
// For 90 degree rotation, we map our internal matrix to oled matrix using fixed arrays
|
||||
// The OLED writes to it's memory horizontally, starting top left, but our memory starts bottom left in this mode
|
||||
#ifndef OLED_SOURCE_MAP
|
||||
#define OLED_SOURCE_MAP { 0, 8, 16, 24 }
|
||||
#endif
|
||||
#ifndef OLED_TARGET_MAP
|
||||
#define OLED_TARGET_MAP { 24, 16, 8, 0 }
|
||||
#endif
|
||||
// If OLED_BLOCK_TYPE is uint8_t, these tables would look like:
|
||||
// #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 }
|
||||
// #define OLED_TARGET_MAP { 48, 32, 16, 0, 56, 40, 24, 8 }
|
||||
#endif // defined(OLED_DISPLAY_CUSTOM)
|
||||
|
||||
// Address to use for tthe i2d oled communication
|
||||
#if !defined(OLED_IC)
|
||||
#define OLED_IC OLED_IC_SSD1306
|
||||
#endif
|
||||
|
||||
// the column address corresponding to the first column in the display hardware
|
||||
#if !defined(OLED_COLUMN_OFFSET)
|
||||
#define OLED_COLUMN_OFFSET 0
|
||||
#endif
|
||||
|
||||
// Address to use for the i2c oled communication
|
||||
#if !defined(OLED_DISPLAY_ADDRESS)
|
||||
#define OLED_DISPLAY_ADDRESS 0x3C
|
||||
#endif
|
||||
|
|
|
@ -2,9 +2,7 @@ ifneq ($(strip $(QWIIC_ENABLE)),)
|
|||
COMMON_VPATH += $(DRIVER_PATH)/qwiic
|
||||
OPT_DEFS += -DQWIIC_ENABLE
|
||||
SRC += qwiic.c
|
||||
ifeq ($(filter "i2c_master.c", $(SRC)),)
|
||||
SRC += i2c_master.c
|
||||
endif
|
||||
QUANTUM_LIB_SRC += i2c_master.c
|
||||
endif
|
||||
|
||||
ifneq ($(filter JOYSTIIC, $(QWIIC_ENABLE)),)
|
||||
|
|
|
@ -59,10 +59,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define RGBLIGHT_HUE_STEP 8
|
||||
#define RGBLIGHT_SAT_STEP 8
|
||||
#define RGBLIGHT_VAL_STEP 8
|
||||
#define RGBLIGHT_SLEEP
|
||||
#endif
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
|
|
@ -47,7 +47,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#endif
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
|
@ -62,4 +62,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define RGBLIGHT_HUE_STEP 8
|
||||
#define RGBLIGHT_SAT_STEP 8
|
||||
#define RGBLIGHT_VAL_STEP 8
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#endif
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
|
|
|
@ -37,11 +37,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
RAISE, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, RGB, KC_RCTL
|
||||
),
|
||||
// raise layer to handle function & nav keys
|
||||
[_raise] = LAYOUT_all
|
||||
[_raise] = LAYOUT_all
|
||||
(
|
||||
KC_GRV, 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_DEL,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_CALC, KC_PGUP, KC_UP, KC_PGDN, KC_PSCR, KC_LSCR, KC_PAUSE, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_LEFT, KC_DOWN, KC_RIGHT, KC_INS, KC_DEL, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_MPRV, KC_MPLY, KC_MNXT, KC_TRNS, KC_TRNS, KC_CALC, KC_PGUP, KC_UP, KC_PGDN, KC_PSCR, KC_LSCR, KC_PAUSE, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_HOME, KC_LEFT, KC_DOWN, KC_RIGHT, KC_INS, KC_DEL, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_APP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||
),
|
||||
|
|
|
@ -80,7 +80,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#endif
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#endif
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
|
@ -45,4 +45,3 @@
|
|||
#define RGBLIGHT_SAT_STEP 8
|
||||
#define RGBLIGHT_VAL_STEP 8
|
||||
#endif
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
// #endif
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
// #define BACKLIGHT_LEVELS 3
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
// #endif
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
// #endif
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
// #endif
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#endif
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
|
|
13
keyboards/40percentclub/gherkin/keymaps/michel/config.h
Normal file
13
keyboards/40percentclub/gherkin/keymaps/michel/config.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#undef RGB_DI_PIN
|
||||
#undef RGBLED_NUM
|
||||
#define RGB_DI_PIN D3
|
||||
#define RGBLIGHT_ANIMATIONS
|
||||
#define RGBLED_NUM 10
|
||||
|
||||
/* Make layout upside down = USB port on left side */
|
||||
#undef MATRIX_ROW_PINS
|
||||
#undef MATRIX_COL_PINS
|
||||
#define MATRIX_ROW_PINS { B6, B2, B3, B1, F7 }
|
||||
#define MATRIX_COL_PINS { D0, D4, C6, D7, E6, B4 }
|
8
keyboards/40percentclub/gherkin/keymaps/michel/keymap.c
Normal file
8
keyboards/40percentclub/gherkin/keymaps/michel/keymap.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include QMK_KEYBOARD_H
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT_ortho_3x10(KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, LT(1, KC_ENT), LSFT_T(KC_Z), LALT_T(KC_X), LGUI_T(KC_C), KC_V, KC_BSPC, KC_SPC, RGUI_T(KC_B), LT(3, KC_N), LT(2, KC_M), KC_RSFT),
|
||||
[1] = LAYOUT_ortho_3x10(KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT),
|
||||
[2] = LAYOUT_ortho_3x10(KC_ESC, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LBRC, KC_NO, KC_SCLN, KC_NO, KC_QUOT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_RSFT),
|
||||
[3] = LAYOUT_ortho_3x10(KC_TAB, KC_UP, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT, KC_DOWN, KC_RGHT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO)
|
||||
};
|
3
keyboards/40percentclub/gherkin/keymaps/michel/rules.mk
Normal file
3
keyboards/40percentclub/gherkin/keymaps/michel/rules.mk
Normal file
|
@ -0,0 +1,3 @@
|
|||
BACKLIGHT_ENABLE = no
|
||||
AUDIO_ENABLE = no
|
||||
RGBLIGHT_ENABLE = yes
|
24
keyboards/40percentclub/gherkin/keymaps/midi/config.h
Normal file
24
keyboards/40percentclub/gherkin/keymaps/midi/config.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
Copyright 2012 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#undef TAPPING_TERM
|
||||
#define TAPPING_TERM 190
|
||||
|
||||
#define MUSIC_MASK (keycode != KC_NO)
|
||||
#define MIDI_ADVANCED
|
115
keyboards/40percentclub/gherkin/keymaps/midi/keymap.c
Normal file
115
keyboards/40percentclub/gherkin/keymaps/midi/keymap.c
Normal file
|
@ -0,0 +1,115 @@
|
|||
#include QMK_KEYBOARD_H
|
||||
|
||||
enum layer_number {
|
||||
_IONIAN = 0,
|
||||
_DORIAN,
|
||||
_PHRYGIAN,
|
||||
_LYDIAN,
|
||||
_MIXOLYDIAN,
|
||||
_AEOLIAN,
|
||||
_LOCRIAN,
|
||||
_MENU
|
||||
};
|
||||
|
||||
enum custom_keycodes {
|
||||
IONIAN = SAFE_RANGE,
|
||||
DORIAN,
|
||||
PHRYGIAN,
|
||||
LYDIAN,
|
||||
MIXOLYDIAN,
|
||||
AEOLIAN,
|
||||
LOCRIAN,
|
||||
};
|
||||
|
||||
#define MENU MO(_MENU)
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[_IONIAN] = LAYOUT_ortho_3x10(
|
||||
MI_C_1, MI_F_1, MI_B_1, MI_E_2, MI_A_2, MI_D_3, MI_G_3, MI_C_4, MI_OCTD, MI_OCTU,
|
||||
MI_D_1, MI_G_1, MI_C_2, MI_F_2, MI_B_2, MI_E_3, MI_A_3, MI_D_4, MI_TRNSD, MI_TRNSU,
|
||||
MI_E_1, MI_A_1, MI_D_2, MI_G_2, MI_C_3, MI_F_3, MI_B_3, MI_E_4, MI_SUS, MENU
|
||||
),
|
||||
|
||||
[_DORIAN] = LAYOUT_ortho_3x10(
|
||||
MI_C_1, MI_F_1, MI_As_1, MI_Ds_2, MI_A_2, MI_D_3, MI_G_3, MI_C_4, _______, _______,
|
||||
MI_D_1, MI_G_1, MI_C_2, MI_F_2, MI_As_2, MI_Ds_3, MI_A_3, MI_D_4, _______, _______,
|
||||
MI_Ds_1, MI_A_1, MI_D_2, MI_G_2, MI_C_3, MI_F_3, MI_As_3, MI_Ds_4, _______, _______
|
||||
),
|
||||
|
||||
[_PHRYGIAN] = LAYOUT_ortho_3x10(
|
||||
MI_C_1, MI_F_1, MI_As_1, MI_Ds_2, MI_Gs_2, MI_Cs_3, MI_G_3, MI_C_4, _______, _______,
|
||||
MI_Cs_1, MI_G_1, MI_C_2, MI_F_2, MI_As_2, MI_Ds_3, MI_Gs_3, MI_Cs_4, _______, _______,
|
||||
MI_Ds_1, MI_Gs_1, MI_Cs_2, MI_G_2, MI_C_3, MI_F_3, MI_As_3, MI_Ds_4, _______, _______
|
||||
),
|
||||
|
||||
[_LYDIAN] = LAYOUT_ortho_3x10(
|
||||
MI_C_1, MI_Fs_1, MI_B_1, MI_E_2, MI_A_2, MI_D_3, MI_G_3, MI_C_4, _______, _______,
|
||||
MI_D_1, MI_G_1, MI_C_2, MI_Fs_2, MI_B_2, MI_E_3, MI_A_3, MI_D_4, _______, _______,
|
||||
MI_E_1, MI_A_1, MI_D_2, MI_G_2, MI_C_3, MI_Fs_3, MI_B_3, MI_E_4, _______, _______
|
||||
),
|
||||
|
||||
[_MIXOLYDIAN] = LAYOUT_ortho_3x10(
|
||||
MI_C_1, MI_F_1, MI_As_1, MI_E_2, MI_A_2, MI_D_3, MI_G_3, MI_C_4, _______, _______,
|
||||
MI_D_1, MI_G_1, MI_C_2, MI_F_2, MI_As_2, MI_E_3, MI_A_3, MI_D_4, _______, _______,
|
||||
MI_E_1, MI_A_1, MI_D_2, MI_G_2, MI_C_3, MI_F_3, MI_As_3, MI_E_4, _______, _______
|
||||
),
|
||||
|
||||
[_AEOLIAN] = LAYOUT_ortho_3x10(
|
||||
MI_C_1, MI_F_1, MI_As_1, MI_Ds_2, MI_Gs_2, MI_D_3, MI_G_3, MI_C_4, _______, _______,
|
||||
MI_D_1, MI_G_1, MI_C_2, MI_F_2, MI_As_2, MI_Ds_3, MI_Gs_3, MI_D_4, _______, _______,
|
||||
MI_Ds_1, MI_Gs_1, MI_D_2, MI_G_2, MI_C_3, MI_F_3, MI_As_3, MI_Ds_4, _______, _______
|
||||
),
|
||||
|
||||
[_LOCRIAN] = LAYOUT_ortho_3x10(
|
||||
MI_C_1, MI_F_1, MI_As_1, MI_Ds_2, MI_Gs_2, MI_Cs_3, MI_Fs_3, MI_C_4, _______, _______,
|
||||
MI_Cs_1, MI_Fs_1, MI_C_2, MI_F_2, MI_As_2, MI_Ds_3, MI_Gs_3, MI_Cs_4, _______, _______,
|
||||
MI_Ds_1, MI_Gs_1, MI_Cs_2, MI_Fs_2, MI_C_3, MI_F_3, MI_As_3, MI_Ds_4, _______, _______
|
||||
),
|
||||
|
||||
[_MENU] = LAYOUT_ortho_3x10(
|
||||
IONIAN, LYDIAN, LOCRIAN, _______, _______, _______, _______, _______, _______, _______,
|
||||
DORIAN, MIXOLYDIAN, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
PHRYGIAN, AEOLIAN, _______, _______, _______, _______, _______, _______, RESET, _______
|
||||
)
|
||||
};
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case IONIAN:
|
||||
if (record->event.pressed) {
|
||||
set_single_persistent_default_layer(_IONIAN);
|
||||
}
|
||||
break;
|
||||
case DORIAN:
|
||||
if (record->event.pressed) {
|
||||
set_single_persistent_default_layer(_DORIAN);
|
||||
}
|
||||
break;
|
||||
case PHRYGIAN:
|
||||
if (record->event.pressed) {
|
||||
set_single_persistent_default_layer(_PHRYGIAN);
|
||||
}
|
||||
break;
|
||||
case LYDIAN:
|
||||
if (record->event.pressed) {
|
||||
set_single_persistent_default_layer(_LYDIAN);
|
||||
}
|
||||
break;
|
||||
case MIXOLYDIAN:
|
||||
if (record->event.pressed) {
|
||||
set_single_persistent_default_layer(_MIXOLYDIAN);
|
||||
}
|
||||
break;
|
||||
case AEOLIAN:
|
||||
if (record->event.pressed) {
|
||||
set_single_persistent_default_layer(_AEOLIAN);
|
||||
}
|
||||
break;
|
||||
case LOCRIAN:
|
||||
if (record->event.pressed) {
|
||||
set_single_persistent_default_layer(_LOCRIAN);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
14
keyboards/40percentclub/gherkin/keymaps/midi/readme.md
Normal file
14
keyboards/40percentclub/gherkin/keymaps/midi/readme.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
### Gherkin Midi
|
||||
A gherkin midi layout that should cover most midi note playing needs.
|
||||
|
||||
A 3x8 grid of notes written bottom left to right upwards as notes for the selected mode, with octave and transpose note controls at the top. Menu accesses other mode layouts, persisted to keyboard settings, and a reset for firmware programming.
|
||||
|
||||
Modes are set by pressing Menu and their corresponding note from the C Ionian layout. That is, for Aeolian, press Menu and A 1. For Phrygian, press Menu and E 1.
|
||||
|
||||
#### Keyboard Default Layout
|
||||
![](https://i.imgur.com/VNc0GsI.jpg)
|
||||
|
||||
Keyboard Editor Gist [link](https://gist.github.com/scottsheffield/c57859fe1a85d703f5387bf8ce41028c)
|
||||
|
||||
#### Glamour Shot
|
||||
![](https://i.imgur.com/B3Q4JoU.jpg)
|
8
keyboards/40percentclub/gherkin/keymaps/midi/rules.mk
Normal file
8
keyboards/40percentclub/gherkin/keymaps/midi/rules.mk
Normal file
|
@ -0,0 +1,8 @@
|
|||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = no # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
RGBLIGHT_ENABLE = no
|
||||
MIDI_ENABLE = yes
|
|
@ -81,7 +81,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// #endif
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#define DESCRIPTION i75 15x5 ortholinear keyboard
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#endif
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
|
|
|
@ -75,7 +75,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// #endif
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
|
239
keyboards/40percentclub/nein/config.h
Normal file
239
keyboards/40percentclub/nein/config.h
Normal file
|
@ -0,0 +1,239 @@
|
|||
/* Copyright 2019
|
||||
*
|
||||
* 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 "config_common.h"
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0xFEED
|
||||
#define PRODUCT_ID 0x0A0C
|
||||
#define DEVICE_VER 0x9999
|
||||
#define MANUFACTURER di0ib
|
||||
#define PRODUCT The nein Keyboard
|
||||
#define DESCRIPTION 9 key macropad
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 3
|
||||
#define MATRIX_COLS 3
|
||||
|
||||
/* Keyboard Matrix Assignments */
|
||||
#define DIRECT_PINS { \
|
||||
{ F4, F5, F6 }, \
|
||||
{ F7, B1, B3 }, \
|
||||
{ B2, B6, B5 } \
|
||||
}
|
||||
#define UNUSED_PINS
|
||||
|
||||
/*
|
||||
* Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
|
||||
*/
|
||||
// #define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
|
||||
|
||||
// #define BACKLIGHT_PIN B7
|
||||
// #define BACKLIGHT_BREATHING
|
||||
// #define BACKLIGHT_LEVELS 3
|
||||
|
||||
// #define RGB_DI_PIN E2
|
||||
// #ifdef RGB_DI_PIN
|
||||
// #define RGBLED_NUM 16
|
||||
// #define RGBLIGHT_HUE_STEP 8
|
||||
// #define RGBLIGHT_SAT_STEP 8
|
||||
// #define RGBLIGHT_VAL_STEP 8
|
||||
// #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
|
||||
// #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
|
||||
// /*== all animations enable ==*/
|
||||
// #define RGBLIGHT_ANIMATIONS
|
||||
// /*== or choose animations ==*/
|
||||
// #define RGBLIGHT_EFFECT_BREATHING
|
||||
// #define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||
// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||
// #define RGBLIGHT_EFFECT_SNAKE
|
||||
// #define RGBLIGHT_EFFECT_KNIGHT
|
||||
// #define RGBLIGHT_EFFECT_CHRISTMAS
|
||||
// #define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||
// #define RGBLIGHT_EFFECT_RGB_TEST
|
||||
// #define RGBLIGHT_EFFECT_ALTERNATING
|
||||
// /*== customize breathing effect ==*/
|
||||
// /*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
|
||||
// #define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
|
||||
// /*==== use exp() and sin() ====*/
|
||||
// #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
|
||||
// #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
|
||||
// #endif
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
||||
/* number of backlight levels */
|
||||
|
||||
/* 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
|
||||
|
||||
/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
|
||||
* This is userful for the Windows task manager shortcut (ctrl+shift+esc).
|
||||
*/
|
||||
// #define GRAVE_ESC_CTRL_OVERRIDE
|
||||
|
||||
/*
|
||||
* Force NKRO
|
||||
*
|
||||
* Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
|
||||
* state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
|
||||
* makefile for this to work.)
|
||||
*
|
||||
* If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
|
||||
* until the next keyboard reset.
|
||||
*
|
||||
* NKRO may prevent your keystrokes from being detected in the BIOS, but it is
|
||||
* fully operational during normal computer usage.
|
||||
*
|
||||
* For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
|
||||
* or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
|
||||
* bootmagic, NKRO mode will always be enabled until it is toggled again during a
|
||||
* power-up.
|
||||
*
|
||||
*/
|
||||
//#define FORCE_NKRO
|
||||
|
||||
/*
|
||||
* Magic Key Options
|
||||
*
|
||||
* Magic keys are hotkey commands that allow control over firmware functions of
|
||||
* the keyboard. They are best used in combination with the HID Listen program,
|
||||
* found here: https://www.pjrc.com/teensy/hid_listen.html
|
||||
*
|
||||
* The options below allow the magic key functionality to be changed. This is
|
||||
* useful if your keyboard/keypad is missing keys and you want magic key support.
|
||||
*
|
||||
*/
|
||||
|
||||
/* key combination for magic key command */
|
||||
/* defined by default; to change, uncomment and set to the combination you want */
|
||||
// #define IS_COMMAND() (get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
|
||||
|
||||
/* control how magic key switches layers */
|
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
|
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
|
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
|
||||
|
||||
/* override magic key keymap */
|
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
|
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
|
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
|
||||
//#define MAGIC_KEY_HELP H
|
||||
//#define MAGIC_KEY_HELP_ALT SLASH
|
||||
//#define MAGIC_KEY_DEBUG D
|
||||
//#define MAGIC_KEY_DEBUG_MATRIX X
|
||||
//#define MAGIC_KEY_DEBUG_KBD K
|
||||
//#define MAGIC_KEY_DEBUG_MOUSE M
|
||||
//#define MAGIC_KEY_VERSION V
|
||||
//#define MAGIC_KEY_STATUS S
|
||||
//#define MAGIC_KEY_CONSOLE C
|
||||
//#define MAGIC_KEY_LAYER0 0
|
||||
//#define MAGIC_KEY_LAYER0_ALT GRAVE
|
||||
//#define MAGIC_KEY_LAYER1 1
|
||||
//#define MAGIC_KEY_LAYER2 2
|
||||
//#define MAGIC_KEY_LAYER3 3
|
||||
//#define MAGIC_KEY_LAYER4 4
|
||||
//#define MAGIC_KEY_LAYER5 5
|
||||
//#define MAGIC_KEY_LAYER6 6
|
||||
//#define MAGIC_KEY_LAYER7 7
|
||||
//#define MAGIC_KEY_LAYER8 8
|
||||
//#define MAGIC_KEY_LAYER9 9
|
||||
//#define MAGIC_KEY_BOOTLOADER B
|
||||
//#define MAGIC_KEY_BOOTLOADER_ALT ESC
|
||||
//#define MAGIC_KEY_LOCK CAPS
|
||||
//#define MAGIC_KEY_EEPROM E
|
||||
//#define MAGIC_KEY_EEPROM_CLEAR BSPACE
|
||||
//#define MAGIC_KEY_NKRO N
|
||||
//#define MAGIC_KEY_SLEEP_LED Z
|
||||
|
||||
/*
|
||||
* Feature disable options
|
||||
* These options are also useful to firmware size reduction.
|
||||
*/
|
||||
|
||||
/* disable debug print */
|
||||
//#define NO_DEBUG
|
||||
|
||||
/* disable print */
|
||||
//#define NO_PRINT
|
||||
|
||||
/* disable action features */
|
||||
//#define NO_ACTION_LAYER
|
||||
//#define NO_ACTION_TAPPING
|
||||
//#define NO_ACTION_ONESHOT
|
||||
//#define NO_ACTION_MACRO
|
||||
//#define NO_ACTION_FUNCTION
|
||||
|
||||
/*
|
||||
* MIDI options
|
||||
*/
|
||||
|
||||
/* Prevent use of disabled MIDI features in the keymap */
|
||||
//#define MIDI_ENABLE_STRICT 1
|
||||
|
||||
/* enable basic MIDI features:
|
||||
- MIDI notes can be sent when in Music mode is on
|
||||
*/
|
||||
//#define MIDI_BASIC
|
||||
|
||||
/* enable advanced MIDI features:
|
||||
- MIDI notes can be added to the keymap
|
||||
- Octave shift and transpose
|
||||
- Virtual sustain, portamento, and modulation wheel
|
||||
- etc.
|
||||
*/
|
||||
//#define MIDI_ADVANCED
|
||||
|
||||
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
|
||||
//#define MIDI_TONE_KEYCODE_OCTAVES 1
|
||||
|
||||
/*
|
||||
* HD44780 LCD Display Configuration
|
||||
*/
|
||||
/*
|
||||
#define LCD_LINES 2 //< number of visible lines of the display
|
||||
#define LCD_DISP_LENGTH 16 //< visibles characters per line of the display
|
||||
#define LCD_IO_MODE 1 //< 0: memory mapped mode, 1: IO port mode
|
||||
#if LCD_IO_MODE
|
||||
#define LCD_PORT PORTB //< port for the LCD lines
|
||||
#define LCD_DATA0_PORT LCD_PORT //< port for 4bit data bit 0
|
||||
#define LCD_DATA1_PORT LCD_PORT //< port for 4bit data bit 1
|
||||
#define LCD_DATA2_PORT LCD_PORT //< port for 4bit data bit 2
|
||||
#define LCD_DATA3_PORT LCD_PORT //< port for 4bit data bit 3
|
||||
#define LCD_DATA0_PIN 4 //< pin for 4bit data bit 0
|
||||
#define LCD_DATA1_PIN 5 //< pin for 4bit data bit 1
|
||||
#define LCD_DATA2_PIN 6 //< pin for 4bit data bit 2
|
||||
#define LCD_DATA3_PIN 7 //< pin for 4bit data bit 3
|
||||
#define LCD_RS_PORT LCD_PORT //< port for RS line
|
||||
#define LCD_RS_PIN 3 //< pin for RS line
|
||||
#define LCD_RW_PORT LCD_PORT //< port for RW line
|
||||
#define LCD_RW_PIN 2 //< pin for RW line
|
||||
#define LCD_E_PORT LCD_PORT //< port for Enable line
|
||||
#define LCD_E_PIN 1 //< pin for Enable line
|
||||
#endif
|
||||
*/
|
||||
|
||||
/* Bootmagic Lite key configuration */
|
||||
// #define BOOTMAGIC_LITE_ROW 0
|
||||
// #define BOOTMAGIC_LITE_COLUMN 0
|
22
keyboards/40percentclub/nein/info.json
Normal file
22
keyboards/40percentclub/nein/info.json
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"keyboard_name": "nein",
|
||||
"url": "",
|
||||
"maintainer": "qmk",
|
||||
"width": 3,
|
||||
"height": 3,
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
{"x":0, "y":0},
|
||||
{"x":1, "y":0},
|
||||
{"x":2, "y":0},
|
||||
{"x":0, "y":1},
|
||||
{"x":1, "y":1},
|
||||
{"x":2, "y":1},
|
||||
{"x":0, "y":2},
|
||||
{"x":1, "y":2},
|
||||
{"x":2, "y":2}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
29
keyboards/40percentclub/nein/keymaps/default/keymap.c
Normal file
29
keyboards/40percentclub/nein/keymaps/default/keymap.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* Copyright 2019
|
||||
*
|
||||
* 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
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT_ortho_3x3(
|
||||
KC_MUTE, KC_HOME, KC_MPLY, \
|
||||
MO(1), KC_UP, KC_END, \
|
||||
KC_LEFT, KC_DOWN, KC_RGHT \
|
||||
),
|
||||
[1] = LAYOUT_ortho_3x3(
|
||||
RESET, _______, KC_STOP, \
|
||||
_______, _______, RGB_MOD, \
|
||||
KC_MPRV, _______, KC_MNXT \
|
||||
),
|
||||
};
|
16
keyboards/40percentclub/nein/nein.c
Normal file
16
keyboards/40percentclub/nein/nein.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* Copyright 2019
|
||||
*
|
||||
* 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 "nein.h"
|
37
keyboards/40percentclub/nein/nein.h
Normal file
37
keyboards/40percentclub/nein/nein.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
/* Copyright 2019
|
||||
*
|
||||
* 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"
|
||||
|
||||
/* This a shortcut to help you visually see your layout.
|
||||
*
|
||||
* The first section contains all of the arguments representing the physical
|
||||
* layout of the board and position of the keys.
|
||||
*
|
||||
* The second converts the arguments into a two-dimensional array which
|
||||
* represents the switch matrix.
|
||||
*/
|
||||
#define LAYOUT_ortho_3x3( \
|
||||
k00, k01, k02, \
|
||||
k10, k11, k12, \
|
||||
k20, k21, k22 \
|
||||
) \
|
||||
{ \
|
||||
{ k00, k01, k02 }, \
|
||||
{ k10, k11, k12 }, \
|
||||
{ k20, k21, k22 } \
|
||||
}
|
18
keyboards/40percentclub/nein/readme.md
Normal file
18
keyboards/40percentclub/nein/readme.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
# nein
|
||||
|
||||
![nein](https://2.bp.blogspot.com/-avYV4grcAPQ/XL9a67SxgKI/AAAAAAACVCE/GSGVYRThaEEDd14M3LG34gQTv5ZabRI0QCEwYBhgL/s640/a.jpg)
|
||||
===
|
||||
|
||||
A 9 key macropad.
|
||||
|
||||
Powered by a Pro Micro and can fit any of the various different sized variations of Pro Micro.
|
||||
|
||||
Keyboard Maintainer: QMK Community
|
||||
Hardware Supported: nein PCB
|
||||
Hardware Availability: [nein project on 40% Keyboards](https://www.40percent.club/2019/04/nein.html)
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make 40percentclub/nein:default
|
||||
|
||||
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).
|
80
keyboards/40percentclub/nein/rules.mk
Normal file
80
keyboards/40percentclub/nein/rules.mk
Normal file
|
@ -0,0 +1,80 @@
|
|||
# MCU name
|
||||
MCU = atmega32u4
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
#
|
||||
# This will be an integer division of F_USB below, as it is sourced by
|
||||
# F_USB after it has run through any CPU prescalers. Note that this value
|
||||
# does not *change* the processor frequency - it should merely be updated to
|
||||
# reflect the processor speed set externally so that the code can use accurate
|
||||
# software delays.
|
||||
F_CPU = 16000000
|
||||
|
||||
|
||||
#
|
||||
# LUFA specific
|
||||
#
|
||||
# Target architecture (see library "Board Types" documentation).
|
||||
ARCH = AVR8
|
||||
|
||||
# Input clock frequency.
|
||||
# This will define a symbol, F_USB, in all source code files equal to the
|
||||
# input clock frequency (before any prescaling is performed) in Hz. This value may
|
||||
# differ from F_CPU if prescaling is used on the latter, and is required as the
|
||||
# raw input clock is fed directly to the PLL sections of the AVR for high speed
|
||||
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
|
||||
# at the end, this will be done automatically to create a 32-bit value in your
|
||||
# source code.
|
||||
#
|
||||
# If no clock division is performed on the input clock inside the AVR (via the
|
||||
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
|
||||
F_USB = $(F_CPU)
|
||||
|
||||
# Interrupt driven control endpoint task(+60)
|
||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
|
||||
|
||||
# Bootloader selection
|
||||
# Teensy halfkay
|
||||
# Pro Micro caterina
|
||||
# Atmel DFU atmel-dfu
|
||||
# LUFA DFU lufa-dfu
|
||||
# QMK DFU qmk-dfu
|
||||
# atmega32a bootloadHID
|
||||
BOOTLOADER = caterina
|
||||
|
||||
|
||||
# If you don't know the bootloader type, then you can specify the
|
||||
# Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line
|
||||
# Teensy halfKay 512
|
||||
# Teensy++ halfKay 1024
|
||||
# Atmel DFU loader 4096
|
||||
# LUFA bootloader 4096
|
||||
# USBaspLoader 2048
|
||||
# OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
||||
|
||||
|
||||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
|
||||
UNICODE_ENABLE = no # Unicode
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||
AUDIO_ENABLE = no # Audio output on port C6
|
||||
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
||||
HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)
|
|
@ -60,7 +60,7 @@
|
|||
#define RGBLIGHT_VAL_STEP 8
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#define DIODE_DIRECTION COL2ROW
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* Locking resynchronize hack */
|
||||
#define LOCKING_RESYNC_ENABLE
|
||||
|
|
|
@ -43,7 +43,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// #define BACKLIGHT_LEVELS 3
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
|
1
keyboards/8pack/8pack.c
Normal file
1
keyboards/8pack/8pack.c
Normal file
|
@ -0,0 +1 @@
|
|||
#include "8pack.h"
|
11
keyboards/8pack/8pack.h
Normal file
11
keyboards/8pack/8pack.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#ifdef KEYBOARD_8pack_rev11
|
||||
#include "rev11.h"
|
||||
#endif
|
||||
|
||||
#ifdef KEYBOARD_8pack_rev12
|
||||
#include "rev12.h"
|
||||
#endif
|
39
keyboards/8pack/config.h
Normal file
39
keyboards/8pack/config.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
#pragma once
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0xFEED
|
||||
#define PRODUCT_ID 0x2171
|
||||
#define MANUFACTURER Charles Garcia
|
||||
#define PRODUCT 8-Pack
|
||||
|
||||
/* COL2ROW or ROW2COL */
|
||||
#define DIODE_DIRECTION COL2ROW
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* 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 matrix size */
|
||||
#define MATRIX_ROWS 2
|
||||
#define MATRIX_COLS 4
|
||||
|
||||
/* key matrix pins */
|
||||
|
||||
#define DIRECT_PINS { { F4, F5, F6, F7 }, { B1, B3, B2, B6 } }
|
||||
|
||||
#define BACKLIGHT_LED_COUNT 8
|
||||
#undef BACKLIGHT_PIN
|
||||
#define BACKLIGHT_PINS { D1, D0, D4, C6, D7, E6, B4, B5 }
|
||||
#define BACKLIGHT_LEVELS 8
|
||||
|
||||
// ws2812 options
|
||||
#define RGB_DI_PIN D2 // pin the DI on the ws2812 is hooked-up to
|
||||
#define RGBLED_NUM 8 // number of LEDs
|
||||
#define RGBLIGHT_ANIMATIONS
|
21
keyboards/8pack/info.json
Normal file
21
keyboards/8pack/info.json
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"keyboard_name": "8-Pack",
|
||||
"url": "https://github.com/cgarcia2097/8-Pack",
|
||||
"maintainer": "Charles Garcia",
|
||||
"width": 4,
|
||||
"height": 2,
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
{"x":0, "y":0},
|
||||
{"x":1, "y":0},
|
||||
{"x":2, "y":0},
|
||||
{"x":3, "y":0},
|
||||
{"x":0, "y":1},
|
||||
{"x":1, "y":1},
|
||||
{"x":2, "y":1},
|
||||
{"x":3, "y":1}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
12
keyboards/8pack/keymaps/default/keymap.c
Normal file
12
keyboards/8pack/keymaps/default/keymap.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include QMK_KEYBOARD_H
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT(
|
||||
KC_V, KC_C, KC_X, MO(1),
|
||||
KC_A, KC_S, KC_D, KC_F
|
||||
),
|
||||
[1] = LAYOUT(
|
||||
RGB_TOG, RGB_RMOD, RGB_MOD, KC_NO,
|
||||
RESET, BL_DEC, BL_INC, BL_TOGG
|
||||
)
|
||||
};
|
13
keyboards/8pack/readme.md
Normal file
13
keyboards/8pack/readme.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
# 8-Pack Macropad
|
||||
|
||||
An open source 2x4 macropad designed by Charles Garcia.
|
||||
|
||||
Keyboard Maintainer: [Charles Garcia](https://github.com/cgarcia2097)
|
||||
Hardware Supported: 8-Pack Macropad PCB
|
||||
Hardware Availability: [8-Pack Github](https://github.com/cgarcia2097/8-Pack)
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make 8pack:default
|
||||
|
||||
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).
|
3
keyboards/8pack/rev11/config.h
Normal file
3
keyboards/8pack/rev11/config.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#define DEVICE_VER 0x0001
|
1
keyboards/8pack/rev11/rev11.c
Normal file
1
keyboards/8pack/rev11/rev11.c
Normal file
|
@ -0,0 +1 @@
|
|||
#include "rev11.h"
|
11
keyboards/8pack/rev11/rev11.h
Normal file
11
keyboards/8pack/rev11/rev11.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include "8pack.h"
|
||||
|
||||
#define LAYOUT( \
|
||||
K00, K01, K02, K03, \
|
||||
K10, K11, K12, K13 \
|
||||
) { \
|
||||
{ K13, K12, K11, K10 }, \
|
||||
{ K03, K02, K01, K00 } \
|
||||
}
|
3
keyboards/8pack/rev12/config.h
Normal file
3
keyboards/8pack/rev12/config.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#define DEVICE_VER 0x0002
|
1
keyboards/8pack/rev12/rev12.c
Normal file
1
keyboards/8pack/rev12/rev12.c
Normal file
|
@ -0,0 +1 @@
|
|||
#include "rev12.h"
|
11
keyboards/8pack/rev12/rev12.h
Normal file
11
keyboards/8pack/rev12/rev12.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include "8pack.h"
|
||||
|
||||
#define LAYOUT( \
|
||||
K00, K01, K02, K03, \
|
||||
K10, K11, K12, K13 \
|
||||
) { \
|
||||
{ K03, K02, K01, K00 }, \
|
||||
{ K13, K12, K11, K10 } \
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue