Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
642f6cf14f | ||
|
|
f3bdd436a3 | ||
|
|
d04485e32c | ||
|
|
f61c99fdda | ||
|
|
cd369b7107 | ||
|
|
cc146e32dc | ||
|
|
68fad7b777 | ||
|
|
7c2bee8b88 | ||
|
|
1e1b55fbdf | ||
|
|
d7754a19b9 | ||
|
|
3a3de84e40 | ||
|
|
c22f3ba3a2 | ||
|
|
cc5c6b449a | ||
|
|
40e67a3074 | ||
|
|
7d8c629939 | ||
|
|
562c0d702a | ||
|
|
503e02db79 | ||
|
|
10cc423515 | ||
|
|
d30d5eeb27 | ||
|
|
039dde3a51 | ||
|
|
7cb8d3c7a7 | ||
|
|
b5b119544a | ||
|
|
cce8dfab39 | ||
|
|
14ed96aa06 | ||
|
|
5b7fc758d7 | ||
|
|
574fc6444b | ||
|
|
4d8733591f | ||
|
|
123608fb31 | ||
|
|
d0b691df0e | ||
|
|
3949ab322d | ||
|
|
39ca330f10 | ||
|
|
c9ba618654 | ||
|
|
d977daa8dc | ||
|
|
2bb2977c13 | ||
|
|
47c91fc7f7 | ||
|
|
a55c838961 | ||
|
|
e8e6268765 | ||
|
|
4db27a2c76 | ||
|
|
3cf7f7322c | ||
|
|
ac9b88e8cc | ||
|
|
714e0da960 | ||
|
|
c796944354 | ||
|
|
2758158a4b |
No files matched your search
@@ -2,30 +2,31 @@
|
|||||||
name: Bug report
|
name: Bug report
|
||||||
about: Create a report to help us improve the QMK Firmware
|
about: Create a report to help us improve the QMK Firmware
|
||||||
---
|
---
|
||||||
<!-- Provide a general summary of the bug in the Title above -->
|
<!-- Provide a general summary of the bug in the title above. -->
|
||||||
|
|
||||||
<!-- This template is entirely option and can be removed, but is here to help both you and us. -->
|
<!--- This template is entirely optional and can be removed, but is here to help both you and us. -->
|
||||||
<!-- This text and anything on lines wrapped like this one will not show up in the final text. This text is to help us and you. -->
|
<!--- Anything on lines wrapped in comments like these will not show up in the final text. -->
|
||||||
|
|
||||||
**Describe the bug**
|
## Describe the Bug
|
||||||
|
|
||||||
<!-- A clear and concise description of what the bug is. -->
|
<!-- A clear and concise description of what the bug is. -->
|
||||||
|
|
||||||
**System Information**
|
## System Information
|
||||||
|
|
||||||
- Keyboard:
|
- Keyboard:
|
||||||
- Revision (if applicable):
|
- Revision (if applicable):
|
||||||
- Operating System:
|
- Operating system:
|
||||||
- avr-gcc version:
|
- AVR GCC version:
|
||||||
<!-- Run `avr-gcc --version` to find out -->
|
<!-- Run `avr-gcc --version` to find this out. -->
|
||||||
- arm gcc version:
|
- ARM GCC version:
|
||||||
<!-- Run `arm-none-eabi-gcc --version` to find out -->
|
<!-- Run `arm-none-eabi-gcc --version` to find this out. -->
|
||||||
- QMK Firmware version:
|
- QMK Firmware version:
|
||||||
<!-- You can run `git describe --abbrev=0 --tags` to find this out -->
|
<!-- Run `git describe --abbrev=0 --tags` to find this out. -->
|
||||||
- Any keyboard related software installed?
|
- Any keyboard related software installed?
|
||||||
- [ ] Auto Hot Key
|
- [ ] AutoHotKey
|
||||||
- [ ] Karabiner
|
- [ ] Karabiner
|
||||||
- [ ] Other
|
- [ ] Other:
|
||||||
|
|
||||||
**Additional context**
|
## Additional Context
|
||||||
|
|
||||||
<!-- Add any other context about the problem here. -->
|
<!-- Add any other relevant information about the problem here. -->
|
||||||
@@ -2,18 +2,18 @@
|
|||||||
name: Feature request
|
name: Feature request
|
||||||
about: Suggest a new feature or changes to existing features
|
about: Suggest a new feature or changes to existing features
|
||||||
---
|
---
|
||||||
<!--- Provide a general summary of the changes you want in the Title above -->
|
<!--- Provide a general summary of the changes you want in the title above. -->
|
||||||
|
|
||||||
<!-- This template is entirely option and can be removed, but is here to help both you and us. -->
|
<!--- This template is entirely optional and can be removed, but is here to help both you and us. -->
|
||||||
<!-- This text and anything on lines wrapped like this one will not show up in the final text. This text is to help us and you. -->
|
<!--- Anything on lines wrapped in comments like these will not show up in the final text. -->
|
||||||
|
|
||||||
## Feature Request Type
|
## Feature Request Type
|
||||||
|
|
||||||
- [ ] Core Functionality
|
- [ ] Core functionality
|
||||||
- [ ] Add-on hardware support (e.g. audio, RGB, OLED screen, etc.)
|
- [ ] Add-on hardware support (eg. audio, RGB, OLED screen, etc.)
|
||||||
- [ ] Alteration (enhancement/optimization) of existing Feature(s)
|
- [ ] Alteration (enhancement/optimization) of existing feature(s)
|
||||||
- [ ] New behavior
|
- [ ] New behavior
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
<!-- A few sentences describing what it is that you'd like to see. Additional information (such as links to spec sheets, licensing info, other related issues or PR's, etc) would be helpful. -->
|
<!-- A few sentences describing what it is that you'd like to see in QMK. Additional information (such as links to spec sheets, licensing info, other related issues or PRs, etc) would be helpful. -->
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
name: Other issues
|
name: Other issues
|
||||||
about: Anything else that doesn't fall into the above categories.
|
about: Anything else that doesn't fall into the above categories.
|
||||||
---
|
---
|
||||||
<!--- Provide a general summary of the changes you want in the Title above -->
|
<!--- Provide a general summary of the changes you want in the title above. -->
|
||||||
|
|
||||||
<!-- This text and anything on lines wrapped like this one will not show up in the final text. This text is to help us and you. -->
|
<!--- Anything on lines wrapped in comments like these will not show up in the final text. -->
|
||||||
|
|
||||||
<!-- Please check https://docs.qmk.fm/#/support for additional resources first. If that doesn't answer your question, check the bug report option, as that may be more appropriate. -->
|
<!-- Please check https://docs.qmk.fm/#/support for additional resources first. If that doesn't answer your question, choose the bug report template instead, as that may be more appropriate. -->
|
||||||
@@ -1,32 +1,34 @@
|
|||||||
<!--- Provide a general summary of your changes in the Title above -->
|
<!--- Provide a general summary of your changes in the title above. -->
|
||||||
|
|
||||||
<!--- This template is entirely option and can be removed, but is here to help both you and us. -->
|
<!--- This template is entirely optional and can be removed, but is here to help both you and us. -->
|
||||||
<!--- This text and anything on lines wrapped like this one will not show up in the final text. This text is to help us and you. -->
|
<!--- Anything on lines wrapped in comments like these will not show up in the final text. -->
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
<!--- Describe your changes in detail -->
|
|
||||||
|
|
||||||
## Types of changes
|
<!--- Describe your changes in detail here. -->
|
||||||
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
|
|
||||||
|
## Types of Changes
|
||||||
|
|
||||||
|
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply. -->
|
||||||
- [ ] Core
|
- [ ] Core
|
||||||
- [ ] Bugfix
|
- [ ] Bugfix
|
||||||
- [ ] New Feature
|
- [ ] New feature
|
||||||
- [ ] Enhancement/Optimization
|
- [ ] Enhancement/optimization
|
||||||
- [ ] Keyboard (addition or update)
|
- [ ] Keyboard (addition or update)
|
||||||
- [ ] Keymap/Layout/Userspace (addition or update)
|
- [ ] Keymap/layout/userspace (addition or update)
|
||||||
- [ ] Documentation
|
- [ ] Documentation
|
||||||
|
|
||||||
|
## Issues Fixed or Closed by This PR
|
||||||
## Issues Fixed or Closed by this PR
|
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
||||||
## Checklist:
|
## Checklist
|
||||||
|
|
||||||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
|
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
|
||||||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
|
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
|
||||||
- [ ] My code follows the code style of this project.
|
- [ ] My code follows the code style of this project.
|
||||||
- [ ] My change requires a change to the documentation.
|
- [ ] My change requires a change to the documentation.
|
||||||
- [ ] I have updated the documentation accordingly.
|
- [ ] I have updated the documentation accordingly.
|
||||||
- [ ] I have read the **CONTRIBUTING** document. (https://docs.qmk.fm/#/contributing)
|
- [ ] I have read the [**CONTRIBUTING** document](https://docs.qmk.fm/#/contributing).
|
||||||
- [ ] I have added tests to cover my changes.
|
- [ ] I have added tests to cover my changes.
|
||||||
- [ ] I have tested the changes and verified that they work and don't break anything (as well as I can manage).
|
- [ ] I have tested the changes and verified that they work and don't break anything (as well as I can manage).
|
||||||
@@ -135,6 +135,10 @@ ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
|
|||||||
OPT_DEFS += -DCONVERT_TO_PROTON_C
|
OPT_DEFS += -DCONVERT_TO_PROTON_C
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(FORCE_LAYOUT),)
|
||||||
|
TARGET := $(TARGET)_$(FORCE_LAYOUT)
|
||||||
|
endif
|
||||||
|
|
||||||
include quantum/mcu_selection.mk
|
include quantum/mcu_selection.mk
|
||||||
|
|
||||||
ifdef MCU_FAMILY
|
ifdef MCU_FAMILY
|
||||||
|
|||||||
@@ -15,4 +15,13 @@ define SEARCH_LAYOUTS
|
|||||||
$$(foreach LAYOUTS_REPO,$$(LAYOUTS_REPOS),$$(eval $$(call SEARCH_LAYOUTS_REPO)))
|
$$(foreach LAYOUTS_REPO,$$(LAYOUTS_REPOS),$$(eval $$(call SEARCH_LAYOUTS_REPO)))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
ifneq ($(FORCE_LAYOUT),)
|
||||||
|
ifneq (,$(findstring $(FORCE_LAYOUT),$(LAYOUTS)))
|
||||||
|
$(info Forcing layout: $(FORCE_LAYOUT))
|
||||||
|
LAYOUTS := $(FORCE_LAYOUT)
|
||||||
|
else
|
||||||
|
$(error Forced layout does not exist)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
$(foreach LAYOUT,$(LAYOUTS),$(eval $(call SEARCH_LAYOUTS)))
|
$(foreach LAYOUT,$(LAYOUTS),$(eval $(call SEARCH_LAYOUTS)))
|
||||||
+13
-3
@@ -282,10 +282,20 @@ ifneq ($(strip $(CUSTOM_MATRIX)), yes)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Include the standard debounce code if needed
|
DEBOUNCE_DIR:= $(QUANTUM_DIR)/debounce
|
||||||
ifneq ($(strip $(CUSTOM_DEBOUNCE)), yes)
|
# Debounce Modules. If implemented in matrix.c, don't use these.
|
||||||
QUANTUM_SRC += $(QUANTUM_DIR)/debounce.c
|
DEBOUNCE_TYPE?= sym_g
|
||||||
|
VALID_DEBOUNCE_TYPES := sym_g eager_pk custom
|
||||||
|
ifeq ($(filter $(DEBOUNCE_TYPE),$(VALID_DEBOUNCE_TYPES)),)
|
||||||
|
$(error DEBOUNCE_TYPE="$(DEBOUNCE_TYPE)" is not a valid debounce algorithm)
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(strip $(DEBOUNCE_TYPE)), sym_g)
|
||||||
|
QUANTUM_SRC += $(DEBOUNCE_DIR)/debounce_sym_g.c
|
||||||
|
else ifeq ($(strip $(DEBOUNCE_TYPE)), eager_pk)
|
||||||
|
QUANTUM_SRC += $(DEBOUNCE_DIR)/debounce_eager_pk.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
|
ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
|
||||||
OPT_DEFS += -DSPLIT_KEYBOARD
|
OPT_DEFS += -DSPLIT_KEYBOARD
|
||||||
|
|||||||
@@ -165,18 +165,35 @@ In addition, it is possible to specify the brightness level of all LEDs with `er
|
|||||||
|
|
||||||
Ergodox boards also define `LED_BRIGHTNESS_LO` for the lowest brightness and `LED_BRIGHTNESS_HI` for the highest brightness (which is the default).
|
Ergodox boards also define `LED_BRIGHTNESS_LO` for the lowest brightness and `LED_BRIGHTNESS_HI` for the highest brightness (which is the default).
|
||||||
|
|
||||||
# Matrix Initialization Code
|
# Keyboard Initialization Code
|
||||||
|
|
||||||
Before a keyboard can be used the hardware must be initialized. QMK handles initialization of the keyboard matrix itself, but if you have other hardware like LEDs or i²c controllers you will need to set up that hardware before it can be used.
|
There are several steps in the keyboard initialization process. Depending on what you want to do, it will influence which function you should use.
|
||||||
|
|
||||||
|
These are the three main initialization functions, listed in the order that they're called.
|
||||||
|
|
||||||
### Example `matrix_init_user()` Implementation
|
* `keyboard_pre_init_*` - Happens before most anything is started. Good for hardware setup that you want running very early.
|
||||||
|
* `matrix_init_*` - Happens midway through the firmware's startup process. Hardware is initialized, but features may not be yet.
|
||||||
|
* `keyboard_post_init_*` - Happens at the end of the firmware's startup process. This is where you'd want to put "customization" code, for the most part.
|
||||||
|
|
||||||
|
!> For most people, the `keyboard_post_init_user` function is what you want to call. For instance, this is where you want to set up things for RGB Underglow.
|
||||||
|
|
||||||
|
## Keyboard Pre Initialization code
|
||||||
|
|
||||||
|
This runs very early during startup, even before the USB has been started.
|
||||||
|
|
||||||
|
Shortly after this, the matrix is initialized.
|
||||||
|
|
||||||
|
For most users, this shouldn't be used, as it's primarily for hardware oriented initialization.
|
||||||
|
|
||||||
|
However, if you have hardware stuff that you need initialized, this is the best place for it (such as initializing LED pins).
|
||||||
|
|
||||||
|
### Example `keyboard_pre_init_user()` Implementation
|
||||||
|
|
||||||
This example, at the keyboard level, sets up B1, B2, and B3 as LED pins.
|
This example, at the keyboard level, sets up B1, B2, and B3 as LED pins.
|
||||||
|
|
||||||
```c
|
```c
|
||||||
void matrix_init_user(void) {
|
void keyboard_pre_init_user(void) {
|
||||||
// Call the keymap level matrix init.
|
// Call the keyboard pre init code.
|
||||||
|
|
||||||
// Set our LED pins as output
|
// Set our LED pins as output
|
||||||
DDRB |= (1<<1);
|
DDRB |= (1<<1);
|
||||||
@@ -185,11 +202,47 @@ void matrix_init_user(void) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `keyboard_pre_init_*` Function Documentation
|
||||||
|
|
||||||
|
* Keyboard/Revision: `void keyboard_pre_init_kb(void)`
|
||||||
|
* Keymap: `void keyboard_pre_init_user(void)`
|
||||||
|
|
||||||
|
## Matrix Initialization Code
|
||||||
|
|
||||||
|
This is called when the matrix is initialized, and after some of the hardware has been set up, but before many of the features have been initialized.
|
||||||
|
|
||||||
|
This is useful for setting up stuff that you may need elsewhere, but isn't hardware related nor is dependant on where it's started.
|
||||||
|
|
||||||
|
|
||||||
### `matrix_init_*` Function Documentation
|
### `matrix_init_*` Function Documentation
|
||||||
|
|
||||||
* Keyboard/Revision: `void matrix_init_kb(void)`
|
* Keyboard/Revision: `void matrix_init_kb(void)`
|
||||||
* Keymap: `void matrix_init_user(void)`
|
* Keymap: `void matrix_init_user(void)`
|
||||||
|
|
||||||
|
|
||||||
|
## Keyboard Post Initialization code
|
||||||
|
|
||||||
|
This is ran as the very last task in the keyboard initialization process. This is useful if you want to make changes to certain features, as they should be initialized by this point.
|
||||||
|
|
||||||
|
|
||||||
|
### Example `keyboard_post_init_user()` Implementation
|
||||||
|
|
||||||
|
This example, running after everything else has initialized, sets up the rgb underglow configuration.
|
||||||
|
|
||||||
|
```c
|
||||||
|
void keyboard_post_init_user(void) {
|
||||||
|
// Call the post init code.
|
||||||
|
rgblight_enable_noeeprom(); // enables Rgb, without saving settings
|
||||||
|
rgblight_sethsv_noeeprom(180, 255, 255): // sets the color to teal/cyan without saving
|
||||||
|
rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); // sets mode to Fast breathing without saving
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### `keyboard_post_init_*` Function Documentation
|
||||||
|
|
||||||
|
* Keyboard/Revision: `void keyboard_post_init_kb(void)`
|
||||||
|
* Keymap: `void keyboard_post_init_user(void)`
|
||||||
|
|
||||||
# Matrix Scanning Code
|
# Matrix Scanning Code
|
||||||
|
|
||||||
Whenever possible you should customize your keyboard by using `process_record_*()` and hooking into events that way, to ensure that your code does not have a negative performance impact on your keyboard. However, in rare cases it is necessary to hook into the matrix scanning. Be extremely careful with the performance of code in these functions, as it will be called at least 10 times per second.
|
Whenever possible you should customize your keyboard by using `process_record_*()` and hooking into events that way, to ensure that your code does not have a negative performance impact on your keyboard. However, in rare cases it is necessary to hook into the matrix scanning. Be extremely careful with the performance of code in these functions, as it will be called at least 10 times per second.
|
||||||
@@ -229,10 +282,9 @@ void suspend_wakeup_init_user(void)
|
|||||||
{
|
{
|
||||||
rgb_matrix_set_suspend_state(false);
|
rgb_matrix_set_suspend_state(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### `keyboard_init_*` Function Documentation
|
### Keyboard suspend/wake Function Documentation
|
||||||
|
|
||||||
* Keyboard/Revision: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)`
|
* Keyboard/Revision: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)`
|
||||||
* Keymap: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)`
|
* Keymap: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)`
|
||||||
@@ -285,7 +337,7 @@ Keep in mind that EEPROM has a limited number of writes. While this is very high
|
|||||||
|
|
||||||
* If you don't understand the example, then you may want to avoid using this feature, as it is rather complicated.
|
* If you don't understand the example, then you may want to avoid using this feature, as it is rather complicated.
|
||||||
|
|
||||||
### Example Implementation
|
### Example Implementation
|
||||||
|
|
||||||
This is an example of how to add settings, and read and write it. We're using the user keymap for the example here. This is a complex function, and has a lot going on. In fact, it uses a lot of the above functions to work!
|
This is an example of how to add settings, and read and write it. We're using the user keymap for the example here. This is a complex function, and has a lot going on. In fact, it uses a lot of the above functions to work!
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
# Debounce algorithm
|
||||||
|
|
||||||
|
QMK supports multiple debounce algorithms through its debounce API.
|
||||||
|
|
||||||
|
The underlying debounce algorithm is determined by which matrix.c file you are using.
|
||||||
|
|
||||||
|
The logic for which debounce method called is below. It checks various defines that you have set in rules.mk
|
||||||
|
|
||||||
|
```
|
||||||
|
DEBOUNCE_TYPE?= sym_g
|
||||||
|
VALID_DEBOUNCE_TYPES := sym_g eager_pk custom
|
||||||
|
ifeq ($(filter $(DEBOUNCE_TYPE),$(VALID_DEBOUNCE_TYPES)),)
|
||||||
|
$(error DEBOUNCE_TYPE="$(DEBOUNCE_TYPE)" is not a valid debounce algorithm)
|
||||||
|
endif
|
||||||
|
ifeq ($(strip $(DEBOUNCE_TYPE)), sym_g)
|
||||||
|
QUANTUM_SRC += $(DEBOUNCE_DIR)/debounce_sym_g.c
|
||||||
|
else ifeq ($(strip $(DEBOUNCE_TYPE)), eager_pk)
|
||||||
|
QUANTUM_SRC += $(DEBOUNCE_DIR)/debounce_eager_pk.c
|
||||||
|
endif
|
||||||
|
```
|
||||||
|
|
||||||
|
# Debounce selection
|
||||||
|
|
||||||
|
| DEBOUNCE_ALGO | Description | What to do |
|
||||||
|
| ------------- | --------------------------------------------------- | ----------------------------- |
|
||||||
|
| Not defined | You are using the included matrix.c and debounce.c | Nothing. Debounce_sym_g will be compiled, and used if necessary |
|
||||||
|
| custom | Use your own debounce.c | ```SRC += debounce.c``` add your own debounce.c and implement necessary functions |
|
||||||
|
| sym_g / eager_pk | You are using the included matrix.c and debounce.c | Use an alternative debounce algorithm |
|
||||||
|
|
||||||
|
**Regarding split keyboards**:
|
||||||
|
The debounce code is compatible with split keyboards.
|
||||||
|
|
||||||
|
# Use your own debouncing code
|
||||||
|
* Set ```DEBOUNCE_TYPE = custom ```.
|
||||||
|
* Add ```SRC += debounce.c```
|
||||||
|
* Add your own ```debounce.c```. Look at included ```debounce_sym_g.c```s for sample implementations.
|
||||||
|
* Debouncing occurs after every raw matrix scan.
|
||||||
|
* Use num_rows rather than MATRIX_ROWS, so that split keyboards are supported correctly.
|
||||||
|
|
||||||
|
# Changing between included debouncing methods
|
||||||
|
You can either use your own code, by including your own debounce.c, or switch to another included one.
|
||||||
|
Included debounce methods are:
|
||||||
|
* debounce_eager_pk - debouncing per key. On any state change, response is immediate, followed by ```DEBOUNCE_DELAY``` millseconds of no further input for that key
|
||||||
|
* debounce_sym_g - debouncing per keyboard. On any state change, a global timer is set. When ```DEBOUNCE_DELAY``` milliseconds of no changes has occured, all input changes are pushed.
|
||||||
|
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ or `keymap.c`:
|
|||||||
} else {
|
} else {
|
||||||
tap_code(KC_PGUP);
|
tap_code(KC_PGUP);
|
||||||
}
|
}
|
||||||
} else if (index == 2) {
|
} else if (index == 1) { /* Second encoder
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
tap_code(KC_UP);
|
tap_code(KC_UP);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -4,7 +4,11 @@ If you're using a 60% keyboard, or any other layout with no F-row, you will have
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Replace the `KC_GRAVE` key in your keymap (usually to the left of the `1` key) with `KC_GESC`. When pressed it will behave like `KC_ESC`, but with Shift or GUI held it will send `KC_GRAVE`.
|
Replace the `KC_GRAVE` key in your keymap (usually to the left of the `1` key) with `KC_GESC`. Most of the time this key will output `KC_ESC` when pressed. However, when Shift or GUI are held down it will output `KC_GRV` instead.
|
||||||
|
|
||||||
|
## What Your OS Sees
|
||||||
|
|
||||||
|
If Mary presses GESC on her keyboard, the OS will see an KC_ESC character. Now if Mary holds Shift down and presses GESC it will output `~`, or a shifted backtick. Now if she holds GUI/CMD/WIN, it will output a simple <code>`</code> character.
|
||||||
|
|
||||||
## Keycodes
|
## Keycodes
|
||||||
|
|
||||||
@@ -12,6 +16,10 @@ Replace the `KC_GRAVE` key in your keymap (usually to the left of the `1` key) w
|
|||||||
|---------|-----------|------------------------------------------------------------------|
|
|---------|-----------|------------------------------------------------------------------|
|
||||||
|`KC_GESC`|`GRAVE_ESC`|Escape when pressed, <code>`</code> when Shift or GUI are held|
|
|`KC_GESC`|`GRAVE_ESC`|Escape when pressed, <code>`</code> when Shift or GUI are held|
|
||||||
|
|
||||||
|
### Caveats
|
||||||
|
|
||||||
|
* On macOS CMD/GUI + KC_GRV is actually mapped to a hot key so it will not output a backtick.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
There are several possible key combinations this will break, among them Control+Shift+Escape on Windows and Command+Option+Escape on macOS. To work around this, you can `#define` these options in your `config.h`:
|
There are several possible key combinations this will break, among them Control+Shift+Escape on Windows and Command+Option+Escape on macOS. To work around this, you can `#define` these options in your `config.h`:
|
||||||
|
|||||||
@@ -51,6 +51,35 @@ The folder name must be added to the keyboard's `rules.mk`:
|
|||||||
|
|
||||||
but the `LAYOUT_<layout>` variable must be defined in `<folder>.h` as well.
|
but the `LAYOUT_<layout>` variable must be defined in `<folder>.h` as well.
|
||||||
|
|
||||||
|
## Building a Keymap
|
||||||
|
|
||||||
|
You should be able to build the keyboard keymap with a command in this format:
|
||||||
|
|
||||||
|
make <keyboard>:<layout>
|
||||||
|
|
||||||
|
### Conflicting layouts
|
||||||
|
When a keyboard supports multiple layout options,
|
||||||
|
|
||||||
|
LAYOUTS = ortho_4x4 ortho_4x12
|
||||||
|
|
||||||
|
And a layout exists for both options,
|
||||||
|
```
|
||||||
|
layouts/
|
||||||
|
+ community/
|
||||||
|
| + ortho_4x4/
|
||||||
|
| | + <layout>/
|
||||||
|
| | | + ...
|
||||||
|
| + ortho_4x12/
|
||||||
|
| | + <layout>/
|
||||||
|
| | | + ...
|
||||||
|
| + ...
|
||||||
|
```
|
||||||
|
|
||||||
|
The FORCE_LAYOUT argument can be used to specify which layout to build
|
||||||
|
|
||||||
|
make <keyboard>:<layout> FORCE_LAYOUT=ortho_4x4
|
||||||
|
make <keyboard>:<layout> FORCE_LAYOUT=ortho_4x12
|
||||||
|
|
||||||
## Tips for Making Layouts Keyboard-Agnostic
|
## Tips for Making Layouts Keyboard-Agnostic
|
||||||
|
|
||||||
### Includes
|
### Includes
|
||||||
|
|||||||
+37
-31
@@ -148,37 +148,43 @@ const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90};
|
|||||||
|
|
||||||
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:
|
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 |
|
|Function |Description |
|
||||||
|-----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|--------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|`rgblight_enable()` |Turn LEDs on, based on their previous state |
|
|`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_enable_noeeprom()` |Turn LEDs on, based on their previous state (not written to EEPROM) |
|
||||||
|`rgblight_disable()` |Turn LEDs off |
|
|`rgblight_disable()` |Turn LEDs off |
|
||||||
|`rgblight_disable_noeeprom()` |Turn LEDs off (not written to EEPROM) |
|
|`rgblight_disable_noeeprom()` |Turn LEDs off (not written to EEPROM) |
|
||||||
|`rgblight_mode(x)` |Set the mode, if RGB animations are enabled |
|
|`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_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(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) |
|
|`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) |
|
||||||
|`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_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_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_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_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_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_toggle()` |Toggle all LEDs between on and off |
|
|`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_toggle_noeeprom()` |Toggle all LEDs between on and off (not written to EEPROM) |
|
|`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_step()` |Change the mode to the next RGB animation in the list of enabled RGB animations |
|
|`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_step_noeeprom()` |Change the mode to the next RGB animation in the list of enabled RGB animations (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_step_reverse()` |Change the mode to the previous RGB animation in the list of enabled RGB animations |
|
|`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_step_reverse_noeeprom()` |Change the mode to the previous RGB animation in the list of enabled RGB animations (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_increase_hue()` |Increase the hue for all LEDs. This wraps around at maximum hue |
|
|`rgblight_toggle()` |Toggle all LEDs between on and off |
|
||||||
|`rgblight_increase_hue_noeeprom()` |Increase the hue for all LEDs. This wraps around at maximum hue (not written to EEPROM) |
|
|`rgblight_toggle_noeeprom()` |Toggle all LEDs between on and off (not written to EEPROM) |
|
||||||
|`rgblight_decrease_hue()` |Decrease the hue for all LEDs. This wraps around at minimum hue |
|
|`rgblight_step()` |Change the mode to the next RGB animation in the list of enabled RGB animations |
|
||||||
|`rgblight_decrease_hue_noeeprom()` |Decrease the hue for all LEDs. This wraps around at minimum hue (not written to EEPROM) |
|
|`rgblight_step_noeeprom()` |Change the mode to the next RGB animation in the list of enabled RGB animations (not written to EEPROM) |
|
||||||
|`rgblight_increase_sat()` |Increase the saturation for all LEDs. This wraps around at maximum saturation |
|
|`rgblight_step_reverse()` |Change the mode to the previous RGB animation in the list of enabled RGB animations |
|
||||||
|`rgblight_increase_sat_noeeprom()` |Increase the saturation for all LEDs. This wraps around at maximum saturation (not written to EEPROM) |
|
|`rgblight_step_reverse_noeeprom()` |Change the mode to the previous RGB animation in the list of enabled RGB animations (not written to EEPROM) |
|
||||||
|`rgblight_decrease_sat()` |Decrease the saturation for all LEDs. This wraps around at minimum saturation |
|
|`rgblight_increase_hue()` |Increase the hue for all LEDs. This wraps around at maximum hue |
|
||||||
|`rgblight_decrease_sat_noeeprom()` |Decrease the saturation for all LEDs. This wraps around at minimum saturation (not written to EEPROM) |
|
|`rgblight_increase_hue_noeeprom()` |Increase the hue for all LEDs. This wraps around at maximum hue (not written to EEPROM) |
|
||||||
|`rgblight_increase_val()` |Increase the value for all LEDs. This wraps around at maximum value |
|
|`rgblight_decrease_hue()` |Decrease the hue for all LEDs. This wraps around at minimum hue |
|
||||||
|`rgblight_increase_val_noeeprom()` |Increase the value for all LEDs. This wraps around at maximum value (not written to EEPROM) |
|
|`rgblight_decrease_hue_noeeprom()` |Decrease the hue for all LEDs. This wraps around at minimum hue (not written to EEPROM) |
|
||||||
|`rgblight_decrease_val()` |Decrease the value for all LEDs. This wraps around at minimum value |
|
|`rgblight_increase_sat()` |Increase the saturation for all LEDs. This wraps around at maximum saturation |
|
||||||
|`rgblight_decrease_val_noeeprom()` |Decrease the value for all LEDs. This wraps around at minimum value (not written to EEPROM) |
|
|`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) |
|
||||||
|
|
||||||
Additionally, [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h) defines several predefined shortcuts for various colors. Feel free to add to this list!
|
Additionally, [`rgblight_list.h`](https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h) defines several predefined shortcuts for various colors. Feel free to add to this list!
|
||||||
|
|
||||||
|
|||||||
@@ -129,12 +129,12 @@ If you have trouble and want to ask for help, it is useful to generate a *Win_Ch
|
|||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
|
|
||||||
If this is a bit complex for you, Docker might be the turn-key solution you need. After installing [Docker CE](https://docs.docker.com/install/#supported-platforms), run the following command from the `qmk_firmware` directory to build a keyboard/keymap:
|
If this is a bit complex for you, Docker might be the turnkey solution you need. After installing [Docker CE](https://docs.docker.com/install/#supported-platforms), run the following command from the `qmk_firmware` directory to build a keyboard/keymap:
|
||||||
```bash
|
```bash
|
||||||
util/docker_build.sh keyboard:keymap
|
util/docker_build.sh keyboard:keymap
|
||||||
# For example: util/docker_build.sh ergodox_ez:steno
|
# For example: util/docker_build.sh ergodox_ez:steno
|
||||||
```
|
```
|
||||||
This will compile the targeted keyboard/keymap and leave the resulting `.hex` or `.bin` file in the QMK directory for you to flash. If `:keymap` is omitted, the `default` keymap is used. Note that the parameter format is the same as when building with `make`.
|
This will compile the desired keyboard/keymap and leave the resulting `.hex` or `.bin` file in the QMK directory for you to flash. If `:keymap` is omitted, the `default` keymap is used. Note that the parameter format is the same as when building with `make`.
|
||||||
|
|
||||||
You can also start the script without any parameters, in which case it will ask you to input the build parameters one by one, which you may find easier to use:
|
You can also start the script without any parameters, in which case it will ask you to input the build parameters one by one, which you may find easier to use:
|
||||||
```bash
|
```bash
|
||||||
@@ -147,7 +147,7 @@ There is also support for building _and_ flashing the keyboard straight from Doc
|
|||||||
util/docker_build.sh keyboard:keymap:target
|
util/docker_build.sh keyboard:keymap:target
|
||||||
# For example: util/docker_build.sh planck/rev6:default:dfu-util
|
# For example: util/docker_build.sh planck/rev6:default:dfu-util
|
||||||
```
|
```
|
||||||
If you're on Linux, this should work out of the box. On Windows and macOS, it requires [Docker Machine](http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos/) to be running. This is tedious to set up, so it's not recommended; use QMK Toolbox instead.
|
If you're on Linux, this should work out of the box. On Windows and macOS, it requires [Docker Machine](http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos/) to be running. This is tedious to set up, so it's not recommended; use [QMK Toolbox](https://github.com/qmk/qmk_toolbox) instead.
|
||||||
|
|
||||||
!> Docker for Windows requires [Hyper-V](https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v) to be enabled. This means that it cannot work on versions of Windows which don't have Hyper-V, such as Windows 7, Windows 8 and **Windows 10 Home**.
|
!> Docker for Windows requires [Hyper-V](https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v) to be enabled. This means that it cannot work on versions of Windows which don't have Hyper-V, such as Windows 7, Windows 8 and **Windows 10 Home**.
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,8 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
|||||||
MIDI_ENABLE = no # MIDI controls
|
MIDI_ENABLE = no # MIDI controls
|
||||||
AUDIO_ENABLE = no # Audio output on port C6
|
AUDIO_ENABLE = no # Audio output on port C6
|
||||||
UNICODE_ENABLE = no # Unicode
|
UNICODE_ENABLE = no # Unicode
|
||||||
UNICODEMAP_ENABLE = yes
|
|
||||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
||||||
PS2_USE_USART = yes
|
PS2_USE_USART = yes
|
||||||
API_SYSEX_ENABLE = no
|
API_SYSEX_ENABLE = no
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
|||||||
MIDI_ENABLE = no # MIDI controls
|
MIDI_ENABLE = no # MIDI controls
|
||||||
AUDIO_ENABLE = no # Audio output on port C6
|
AUDIO_ENABLE = no # Audio output on port C6
|
||||||
UNICODE_ENABLE = no # Unicode
|
UNICODE_ENABLE = no # Unicode
|
||||||
UNICODEMAP_ENABLE = yes
|
|
||||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
||||||
PS2_USE_USART = yes
|
PS2_USE_USART = yes
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
|||||||
MIDI_ENABLE = no # MIDI controls
|
MIDI_ENABLE = no # MIDI controls
|
||||||
AUDIO_ENABLE = no # Audio output on port C6
|
AUDIO_ENABLE = no # Audio output on port C6
|
||||||
UNICODE_ENABLE = no # Unicode
|
UNICODE_ENABLE = no # Unicode
|
||||||
UNICODEMAP_ENABLE = no
|
|
||||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
||||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
|||||||
MIDI_ENABLE = no # MIDI controls
|
MIDI_ENABLE = no # MIDI controls
|
||||||
AUDIO_ENABLE = no # Audio output on port C6
|
AUDIO_ENABLE = no # Audio output on port C6
|
||||||
UNICODE_ENABLE = no # Unicode
|
UNICODE_ENABLE = no # Unicode
|
||||||
UNICODEMAP_ENABLE = yes
|
|
||||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
||||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ SUBPROJECT_rev1 = yes
|
|||||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
|
|
||||||
CUSTOM_MATRIX = no
|
CUSTOM_MATRIX = no
|
||||||
CUSTOM_DEBOUNCE = yes
|
DEBOUNCE_TYPE = custom
|
||||||
|
|
||||||
LAYOUTS = split60
|
LAYOUTS = split60
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#include "rev1.h"
|
#include "rev1.h"
|
||||||
|
|
||||||
void led_set_kb(uint8_t usb_led) {
|
void led_set_kb(uint8_t usb_led) {
|
||||||
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
|
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
|
||||||
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
|
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
|
||||||
writePinHigh(B2);
|
|
||||||
} else {
|
|
||||||
writePinLow(B2);
|
writePinLow(B2);
|
||||||
|
} else {
|
||||||
|
writePinHigh(B2);
|
||||||
}
|
}
|
||||||
|
|
||||||
led_set_user(usb_led);
|
led_set_user(usb_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
void matrix_init_kb(void) {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#include "rev2.h"
|
#include "rev2.h"
|
||||||
|
|
||||||
void led_set_kb(uint8_t usb_led) {
|
void led_set_kb(uint8_t usb_led) {
|
||||||
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
|
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
|
||||||
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
|
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
|
||||||
writePinHigh(B2);
|
|
||||||
} else {
|
|
||||||
writePinLow(B2);
|
writePinLow(B2);
|
||||||
|
} else {
|
||||||
|
writePinHigh(B2);
|
||||||
}
|
}
|
||||||
|
|
||||||
led_set_user(usb_led);
|
led_set_user(usb_led);
|
||||||
}
|
}
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
void matrix_init_kb(void) {
|
||||||
|
|||||||
@@ -0,0 +1,431 @@
|
|||||||
|
#+Title: Samuel's Literate QMK Config
|
||||||
|
#+PROPERTY: header-args :tangle ~/qmk_firmware/keyboards/planck/keymaps/samuel/keymap.c
|
||||||
|
|
||||||
|
This is my qmk firmware for my keyboard. I grew tired of organizing the keycode
|
||||||
|
array in plain text so I made it a literate .org file. I've never done this
|
||||||
|
before, so bear with me.
|
||||||
|
|
||||||
|
* Keymap
|
||||||
|
|
||||||
|
#+BEGIN_COMMENT
|
||||||
|
#+NAME: empty-layer
|
||||||
|
| <6> | <6> | <6> | <6> | <6> | <6> | <6> | <6> | <6> | <6> | <6> | <6> |
|
||||||
|
|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
||||||
|
| - | - | - | - | - | - | - | - | - | - | - | - |
|
||||||
|
| - | - | - | - | - | - | - | - | - | - | - | - |
|
||||||
|
| - | - | - | - | - | - | - | - | - | - | - | - |
|
||||||
|
| - | - | - | - | - | - | - | - | - | - | - | - |
|
||||||
|
|--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
||||||
|
#+END_COMMENT
|
||||||
|
|
||||||
|
This is my "pretty" org mode organized table for my main dvorak layer. If you
|
||||||
|
don't use org mode, it won't be that exiting, but if you enjoy working in org
|
||||||
|
mode, you can edit this table directly, and this file is tangled to the actual
|
||||||
|
keymap. No more organizing spaces or converting to and from comments.
|
||||||
|
|
||||||
|
#+NAME: home-layer
|
||||||
|
|--------+--------+------+------+------+-----+-----+-----+------+-------+--------+--------|
|
||||||
|
| T_LRSE | QUOT | COMM | DOT | P | Y | F | G | C | R | L | T_RRSE |
|
||||||
|
| T_LSFT | A | O | E | U | I | D | H | T | N | S | T_RSFT |
|
||||||
|
| T_LCTL | SCLN | Q | J | K | X | B | M | W | V | Z | T_RCTL |
|
||||||
|
| T_LGUI | T_LALT | UP | DOWN | BSPC | TAB | ENT | SPC | LEFT | RIGHT | T_RALT | T_RGUI |
|
||||||
|
|--------+--------+------+------+------+-----+-----+-----+------+-------+--------+--------|
|
||||||
|
|
||||||
|
I tried to keep my layout bare bones, just what would be available on a normal
|
||||||
|
keyboard, minus some keys I never used. The bottom left copies a normal
|
||||||
|
keyboards symbols from shifted numbers, and the rest is placed where convenient,
|
||||||
|
with some considerations for one handed use, hence the shortcuts in the top
|
||||||
|
left.
|
||||||
|
|
||||||
|
#+TODO: qwerty layer for ma friends
|
||||||
|
|
||||||
|
#+NAME: secondary-layer
|
||||||
|
|----+--------+--------+--------+--------+------+------+----+--------+--------+-----+----|
|
||||||
|
| -- | EZUNDO | EZCOPY | EZCUT | EZPSTE | INS | EQL | 7 | 8 | 9 | F11 | -- |
|
||||||
|
| -- | ESC | CAPS | PGUP | PGDN | F4 | ASTR | 4 | 5 | 6 | 0 | -- |
|
||||||
|
| -- | EXLM | AT | HASH | DLR | PERC | CIRC | 1 | 2 | 3 | F12 | -- |
|
||||||
|
| -- | -- | EZUP | EZDOWN | -- | AMPR | PIPE | -- | EZLEFT | EZRGHT | -- | -- |
|
||||||
|
|----+--------+--------+--------+--------+------+------+----+--------+--------+-----+----|
|
||||||
|
|
||||||
|
But wait, we are missing several important keys!? yes, well, the modifier keys
|
||||||
|
all do other keys when tapped. More about that in the keymap section.
|
||||||
|
|
||||||
|
* Keymap Conversion in Python
|
||||||
|
|
||||||
|
This python can convert that table into the array needed for the keymap file. It
|
||||||
|
simply prepends every key with "KC_". I used to use a dictionary to convert some
|
||||||
|
keys from the table into qmk keycodes, but the double convertion was
|
||||||
|
unneccessary so I simply prepended all my macros with KC and moved all the
|
||||||
|
implementation to the `process-user-input` function.
|
||||||
|
|
||||||
|
#+NAME:layer-to-array
|
||||||
|
#+BEGIN_SRC python :var keys=secondary-layer :tangle no
|
||||||
|
results = "{"
|
||||||
|
row = 0
|
||||||
|
while row < len(keys):
|
||||||
|
results += '{ '
|
||||||
|
key = 0
|
||||||
|
while key < len(keys[row]):
|
||||||
|
keyName = str(keys[row][key])
|
||||||
|
if keyName == '--':
|
||||||
|
keyName = 'TRANSPARENT'
|
||||||
|
results += 'KC_' + keyName
|
||||||
|
if key != 11:
|
||||||
|
results += ', '
|
||||||
|
key+=1
|
||||||
|
results += '}'
|
||||||
|
if row != 3:
|
||||||
|
results += ','
|
||||||
|
results += '\n'
|
||||||
|
row+=1
|
||||||
|
results += '},\n'
|
||||||
|
return results
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
* keymap.c
|
||||||
|
|
||||||
|
Now that we have done all the hard work, lets layout our keymap file then define
|
||||||
|
our macros.
|
||||||
|
|
||||||
|
** Headers And Layer Declaration
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
extern keymap_config_t keymap_config;
|
||||||
|
|
||||||
|
static uint16_t tap_timers[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
char last_mod = -1;
|
||||||
|
|
||||||
|
enum planck_layers {
|
||||||
|
_DVORAK,
|
||||||
|
_RISE
|
||||||
|
};
|
||||||
|
|
||||||
|
// where the 'T_' communicates how the key does something different when tapped.
|
||||||
|
enum planck_keycodes {
|
||||||
|
DVORAK = SAFE_RANGE,
|
||||||
|
KC_T_LALT,
|
||||||
|
KC_T_RALT,
|
||||||
|
KC_T_LGUI,
|
||||||
|
KC_T_RGUI,
|
||||||
|
KC_T_LCTL,
|
||||||
|
KC_T_RCTL,
|
||||||
|
KC_T_LSFT,
|
||||||
|
KC_T_RSFT,
|
||||||
|
KC_T_LRSE,
|
||||||
|
KC_T_RRSE,
|
||||||
|
KC_EZRGHT,
|
||||||
|
KC_EZLEFT,
|
||||||
|
KC_EZUP,
|
||||||
|
KC_EZDOWN,
|
||||||
|
KC_EZUNDO,
|
||||||
|
KC_EZCOPY,
|
||||||
|
KC_EZCUT,
|
||||||
|
KC_EZPSTE
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Import Key table
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
[_DVORAK] =
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
<<layer-to-array(home-layer)>>
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
[_RISE] =
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
<<layer-to-array(secondary-layer)>>
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Process User Input
|
||||||
|
*** Tap Key Functionality
|
||||||
|
|
||||||
|
These methods define how I implemented the tap mechanic. Basically, I believe
|
||||||
|
that /pressing/ any other key should be grounds for the hold functionality to be
|
||||||
|
assumed. My natuaral typing style experiences no delays from my method.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
};
|
||||||
|
|
||||||
|
void mod_press(uint16_t hold_code, int id) {
|
||||||
|
tap_timers[id] = timer_read();
|
||||||
|
last_mod = id;
|
||||||
|
register_code(hold_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mod_lift(uint16_t tap_code, uint16_t hold_code, int id) {
|
||||||
|
unregister_code(hold_code);
|
||||||
|
if (last_mod == id && timer_elapsed(tap_timers[id]) < TAPPING_TERM) {
|
||||||
|
tap_code16(tap_code);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Set DVORAK layout
|
||||||
|
|
||||||
|
The function that filter's user inputs and applies macros, the begginning is
|
||||||
|
pretty basic, setting our main layer and configuring our secondary layer.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch (keycode) {
|
||||||
|
case DVORAK:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
set_single_persistent_default_layer(_DVORAK);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Alt and ()
|
||||||
|
|
||||||
|
Left and right alt are ( and ) when tapped. I put them on alt instead of a more
|
||||||
|
conveniant key like control because parentheses do not need to be shift modified
|
||||||
|
ever, unlike some other tap keys seen in the next sections.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
case KC_T_LALT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_LALT, 0);
|
||||||
|
} else {
|
||||||
|
mod_lift(S(KC_9), KC_LALT, 0);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RALT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_RALT, 1);
|
||||||
|
} else {
|
||||||
|
mod_lift(S(KC_0), KC_RALT, 1);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Gui and `\
|
||||||
|
|
||||||
|
I place gui in the bottom corner because I believe it is the hardest key to
|
||||||
|
reach, so gui seemed like a good fit for a dedicated key that I never want to
|
||||||
|
have to spam. For tap keys, I used equally unused keys that are not apart of the
|
||||||
|
number pad or shifted number keys.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
case KC_T_LGUI:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_LGUI, 2);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_GRAVE, KC_LGUI, 2);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RGUI:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_RGUI, 3);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_BSLASH, KC_RGUI, 3);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Ctrl and []
|
||||||
|
|
||||||
|
Left and right control are [] respectively when they are tapped, making { and }
|
||||||
|
also very convenient.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
case KC_T_LCTL:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_LCTL, 4);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_LBRACKET, KC_LCTL, 4);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RCTL:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_RCTL, 5);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_RBRACKET, KC_RCTL, 5);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Shft and =-
|
||||||
|
|
||||||
|
I place shift on the home row, so having '-' right of my pinkie is standard, and
|
||||||
|
it only felt natural to put its opposite, '=/+' on the other side. I put an
|
||||||
|
extra one on the right side in the secondary layer for the num pad.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
case KC_T_LSFT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_LSFT, 6);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_EQUAL, KC_LSFT, 6);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RSFT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_RSFT, 7);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_MINUS, KC_RSFT, 7);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Rise, DEL, and /
|
||||||
|
|
||||||
|
I use the top corners as rise because I decided that I do not like using layers
|
||||||
|
with my thumbs. It feels uncomfortable to hold keys down with the side of my
|
||||||
|
thumb, and backspace, tab, enter, and spacebar keep them satisfied. My pinky is
|
||||||
|
for holding modifiers, so it makes sense to put the layer key with the other
|
||||||
|
modifiers. Both my left and right layer keys activate the same layer which also
|
||||||
|
makes sense to me. You wouldn't want left and right shift to do different things
|
||||||
|
|
||||||
|
I used to have escape in the top left, but I use delete a lot more, and putting
|
||||||
|
escape under a layer has not been a problem at all. I put / in the top right
|
||||||
|
corner again mimicing a standard dvorak keyboard.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
case KC_T_LRSE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_timers[8] = timer_read();
|
||||||
|
last_mod = 8;
|
||||||
|
layer_on(_RISE);
|
||||||
|
} else {
|
||||||
|
layer_off(_RISE);
|
||||||
|
if (last_mod == 8 && timer_elapsed(tap_timers[8]) < TAPPING_TERM) {
|
||||||
|
tap_code16(KC_DELETE);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RRSE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_timers[9] = timer_read();
|
||||||
|
last_mod = 9;
|
||||||
|
layer_on(_RISE);
|
||||||
|
} else {
|
||||||
|
layer_off(_RISE);
|
||||||
|
if (last_mod == 9 && timer_elapsed(tap_timers[9]) < TAPPING_TERM) {
|
||||||
|
tap_code16(KC_SLASH);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** EZ keys
|
||||||
|
|
||||||
|
I use ctrl+shift+arrows keys a lot, so when the layer key is pressed they became
|
||||||
|
lazy versions of themselves with control and shift already pressed.
|
||||||
|
|
||||||
|
I also added undo, copy, paste, and cut to be easily available with only the
|
||||||
|
left hand like on a qwerty or colemek keyboard.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
case KC_EZRGHT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
tap_code16(S(KC_RGHT));
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZLEFT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
tap_code16(S(KC_LEFT));
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZDOWN:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
tap_code16(S(KC_DOWN));
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZUP:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
tap_code16(S(KC_UP));
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZUNDO:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_code16(C(KC_Z));
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZCOPY:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_code16(C(KC_C));
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZCUT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_code16(C(KC_X));
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZPSTE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_code16(C(KC_P));
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
*** Standard inputs interupt tap
|
||||||
|
|
||||||
|
Finally, if just a standard key is tapped, set the interupted flag.
|
||||||
|
|
||||||
|
#+BEGIN_SRC C :noweb yes
|
||||||
|
}
|
||||||
|
last_mod = -1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#+END_SRC
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
#define TAPPING_TERM 250
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
extern keymap_config_t keymap_config;
|
||||||
|
|
||||||
|
static uint16_t tap_timers[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
char last_mod = -1;
|
||||||
|
|
||||||
|
enum planck_layers {
|
||||||
|
_DVORAK,
|
||||||
|
_RISE
|
||||||
|
};
|
||||||
|
|
||||||
|
// where the 'T_' communicates how the key does something different when tapped.
|
||||||
|
enum planck_keycodes {
|
||||||
|
DVORAK = SAFE_RANGE,
|
||||||
|
KC_T_LALT,
|
||||||
|
KC_T_RALT,
|
||||||
|
KC_T_LGUI,
|
||||||
|
KC_T_RGUI,
|
||||||
|
KC_T_LCTL,
|
||||||
|
KC_T_RCTL,
|
||||||
|
KC_T_LSFT,
|
||||||
|
KC_T_RSFT,
|
||||||
|
KC_T_LRSE,
|
||||||
|
KC_T_RRSE,
|
||||||
|
KC_EZRGHT,
|
||||||
|
KC_EZLEFT,
|
||||||
|
KC_EZUP,
|
||||||
|
KC_EZDOWN,
|
||||||
|
KC_EZUNDO,
|
||||||
|
KC_EZCOPY,
|
||||||
|
KC_EZCUT,
|
||||||
|
KC_EZPSTE
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
[_DVORAK] =
|
||||||
|
|
||||||
|
{{ KC_T_LRSE, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_T_RRSE},
|
||||||
|
{ KC_T_LSFT, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_T_RSFT},
|
||||||
|
{ KC_T_LCTL, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_T_RCTL},
|
||||||
|
{ KC_T_LGUI, KC_T_LALT, KC_UP, KC_DOWN, KC_BSPC, KC_TAB, KC_ENT, KC_SPC, KC_LEFT, KC_RIGHT, KC_T_RALT, KC_T_RGUI}
|
||||||
|
},
|
||||||
|
|
||||||
|
[_RISE] =
|
||||||
|
|
||||||
|
{{ KC_TRANSPARENT, KC_EZUNDO, KC_EZCOPY, KC_EZCUT, KC_EZPSTE, KC_INS, KC_EQL, KC_7, KC_8, KC_9, KC_F11, KC_TRANSPARENT},
|
||||||
|
{ KC_TRANSPARENT, KC_ESC, KC_CAPS, KC_PGUP, KC_PGDN, KC_F4, KC_ASTR, KC_4, KC_5, KC_6, KC_0, KC_TRANSPARENT},
|
||||||
|
{ KC_TRANSPARENT, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_1, KC_2, KC_3, KC_F12, KC_TRANSPARENT},
|
||||||
|
{ KC_TRANSPARENT, KC_TRANSPARENT, KC_EZUP, KC_EZDOWN, KC_TRANSPARENT, KC_AMPR, KC_PIPE, KC_TRANSPARENT, KC_EZLEFT, KC_EZRGHT, KC_TRANSPARENT, KC_TRANSPARENT}
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
void mod_press(uint16_t hold_code, int id) {
|
||||||
|
tap_timers[id] = timer_read();
|
||||||
|
last_mod = id;
|
||||||
|
register_code(hold_code);
|
||||||
|
}
|
||||||
|
|
||||||
|
void mod_lift(uint16_t tap_code, uint16_t hold_code, int id) {
|
||||||
|
unregister_code(hold_code);
|
||||||
|
if (last_mod == id && timer_elapsed(tap_timers[id]) < TAPPING_TERM) {
|
||||||
|
tap_code16(tap_code);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
switch (keycode) {
|
||||||
|
case DVORAK:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
set_single_persistent_default_layer(_DVORAK);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KC_T_LALT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_LALT, 0);
|
||||||
|
} else {
|
||||||
|
mod_lift(S(KC_9), KC_LALT, 0);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RALT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_RALT, 1);
|
||||||
|
} else {
|
||||||
|
mod_lift(S(KC_0), KC_RALT, 1);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KC_T_LGUI:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_LGUI, 2);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_GRAVE, KC_LGUI, 2);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RGUI:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_RGUI, 3);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_BSLASH, KC_RGUI, 3);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KC_T_LCTL:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_LCTL, 4);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_LBRACKET, KC_LCTL, 4);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RCTL:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_RCTL, 5);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_RBRACKET, KC_RCTL, 5);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KC_T_LSFT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_LSFT, 6);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_EQUAL, KC_LSFT, 6);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RSFT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
mod_press(KC_RSFT, 7);
|
||||||
|
} else {
|
||||||
|
mod_lift(KC_MINUS, KC_RSFT, 7);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KC_T_LRSE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_timers[8] = timer_read();
|
||||||
|
last_mod = 8;
|
||||||
|
layer_on(_RISE);
|
||||||
|
} else {
|
||||||
|
layer_off(_RISE);
|
||||||
|
if (last_mod == 8 && timer_elapsed(tap_timers[8]) < TAPPING_TERM) {
|
||||||
|
tap_code16(KC_DELETE);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_T_RRSE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_timers[9] = timer_read();
|
||||||
|
last_mod = 9;
|
||||||
|
layer_on(_RISE);
|
||||||
|
} else {
|
||||||
|
layer_off(_RISE);
|
||||||
|
if (last_mod == 9 && timer_elapsed(tap_timers[9]) < TAPPING_TERM) {
|
||||||
|
tap_code16(KC_SLASH);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KC_EZRGHT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
tap_code16(S(KC_RGHT));
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZLEFT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
tap_code16(S(KC_LEFT));
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZDOWN:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
tap_code16(S(KC_DOWN));
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZUP:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
register_code(KC_LCTL);
|
||||||
|
tap_code16(S(KC_UP));
|
||||||
|
unregister_code(KC_LCTL);
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZUNDO:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_code16(C(KC_Z));
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZCOPY:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_code16(C(KC_C));
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZCUT:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_code16(C(KC_X));
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case KC_EZPSTE:
|
||||||
|
if (record->event.pressed) {
|
||||||
|
tap_code16(C(KC_P));
|
||||||
|
last_mod = -1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
last_mod = -1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
|
|
||||||
#include "matrix.h"
|
|
||||||
#include "timer.h"
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
#ifndef DEBOUNCING_DELAY
|
|
||||||
# define DEBOUNCING_DELAY 5
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void debounce_init(uint8_t num_rows) {
|
|
||||||
}
|
|
||||||
|
|
||||||
#if DEBOUNCING_DELAY > 0
|
|
||||||
|
|
||||||
static bool debouncing = false;
|
|
||||||
|
|
||||||
void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
|
|
||||||
static uint16_t debouncing_time;
|
|
||||||
|
|
||||||
if (changed) {
|
|
||||||
debouncing = true;
|
|
||||||
debouncing_time = timer_read();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) {
|
|
||||||
for (uint8_t i = 0; i < num_rows; i++) {
|
|
||||||
cooked[i] = raw[i];
|
|
||||||
}
|
|
||||||
debouncing = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool debounce_active(void) {
|
|
||||||
return debouncing;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
// no debounce
|
|
||||||
void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed) {
|
|
||||||
if (changed)
|
|
||||||
{
|
|
||||||
for (uint8_t i = 0; i < num_rows; i++) {
|
|
||||||
cooked[i] = raw[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool debounce_active(void) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
+1
-1
@@ -8,4 +8,4 @@ void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool
|
|||||||
|
|
||||||
bool debounce_active(void);
|
bool debounce_active(void);
|
||||||
|
|
||||||
void debounce_init(uint8_t num_rows);
|
void debounce_init(uint8_t num_rows);
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Alex Ong<[email protected]>
|
||||||
|
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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Basic per-key algorithm. Uses an 8-bit counter per key.
|
||||||
|
After pressing a key, it immediately changes state, and sets a counter.
|
||||||
|
No further inputs are accepted until DEBOUNCE milliseconds have occurred.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "matrix.h"
|
||||||
|
#include "timer.h"
|
||||||
|
#include "quantum.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifndef DEBOUNCE
|
||||||
|
#define DEBOUNCE 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if (MATRIX_COLS <= 8)
|
||||||
|
# define ROW_SHIFTER ((uint8_t)1)
|
||||||
|
#elif (MATRIX_COLS <= 16)
|
||||||
|
# define ROW_SHIFTER ((uint16_t)1)
|
||||||
|
#elif (MATRIX_COLS <= 32)
|
||||||
|
# define ROW_SHIFTER ((uint32_t)1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define debounce_counter_t uint8_t
|
||||||
|
|
||||||
|
static debounce_counter_t *debounce_counters;
|
||||||
|
|
||||||
|
#define DEBOUNCE_ELAPSED 251
|
||||||
|
#define MAX_DEBOUNCE (DEBOUNCE_ELAPSED - 1)
|
||||||
|
|
||||||
|
void update_debounce_counters(uint8_t num_rows, uint8_t current_time);
|
||||||
|
void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time);
|
||||||
|
|
||||||
|
//we use num_rows rather than MATRIX_ROWS to support split keyboards
|
||||||
|
void debounce_init(uint8_t num_rows)
|
||||||
|
{
|
||||||
|
debounce_counters = (debounce_counter_t*)malloc(num_rows*MATRIX_COLS * sizeof(debounce_counter_t));
|
||||||
|
int i = 0;
|
||||||
|
for (uint8_t r = 0; r < num_rows; r++)
|
||||||
|
{
|
||||||
|
for (uint8_t c = 0; c < MATRIX_COLS; c++)
|
||||||
|
{
|
||||||
|
debounce_counters[i++] = DEBOUNCE_ELAPSED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed)
|
||||||
|
{
|
||||||
|
uint8_t current_time = timer_read() % MAX_DEBOUNCE;
|
||||||
|
update_debounce_counters(num_rows, current_time);
|
||||||
|
transfer_matrix_values(raw, cooked, num_rows, current_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
//If the current time is > debounce counter, set the counter to enable input.
|
||||||
|
void update_debounce_counters(uint8_t num_rows, uint8_t current_time)
|
||||||
|
{
|
||||||
|
debounce_counter_t *debounce_pointer = debounce_counters;
|
||||||
|
for (uint8_t row = 0; row < num_rows; row++)
|
||||||
|
{
|
||||||
|
for (uint8_t col = 0; col < MATRIX_COLS; col++)
|
||||||
|
{
|
||||||
|
if (*debounce_pointer != DEBOUNCE_ELAPSED)
|
||||||
|
{
|
||||||
|
if (TIMER_DIFF(current_time, *debounce_pointer, MAX_DEBOUNCE) >= DEBOUNCE) {
|
||||||
|
*debounce_pointer = DEBOUNCE_ELAPSED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
debounce_pointer++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// upload from raw_matrix to final matrix;
|
||||||
|
void transfer_matrix_values(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, uint8_t current_time)
|
||||||
|
{
|
||||||
|
debounce_counter_t *debounce_pointer = debounce_counters;
|
||||||
|
for (uint8_t row = 0; row < num_rows; row++)
|
||||||
|
{
|
||||||
|
matrix_row_t existing_row = cooked[row];
|
||||||
|
matrix_row_t raw_row = raw[row];
|
||||||
|
|
||||||
|
for (uint8_t col = 0; col < MATRIX_COLS; col++)
|
||||||
|
{
|
||||||
|
matrix_row_t col_mask = (ROW_SHIFTER << col);
|
||||||
|
bool final_value = raw_row & col_mask;
|
||||||
|
bool existing_value = existing_row & col_mask;
|
||||||
|
if (*debounce_pointer == DEBOUNCE_ELAPSED &&
|
||||||
|
(existing_value != final_value))
|
||||||
|
{
|
||||||
|
*debounce_pointer = current_time;
|
||||||
|
existing_row ^= col_mask; //flip the bit.
|
||||||
|
}
|
||||||
|
debounce_pointer++;
|
||||||
|
}
|
||||||
|
cooked[row] = existing_row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool debounce_active(void)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Alex Ong<[email protected]>
|
||||||
|
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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Basic global debounce algorithm. Used in 99% of keyboards at time of implementation
|
||||||
|
When no state changes have occured for DEBOUNCE milliseconds, we push the state.
|
||||||
|
*/
|
||||||
|
#include "matrix.h"
|
||||||
|
#include "timer.h"
|
||||||
|
#include "quantum.h"
|
||||||
|
#ifndef DEBOUNCE
|
||||||
|
#define DEBOUNCE 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void debounce_init(uint8_t num_rows) {}
|
||||||
|
static bool debouncing = false;
|
||||||
|
|
||||||
|
#if DEBOUNCE > 0
|
||||||
|
static uint16_t debouncing_time;
|
||||||
|
void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed)
|
||||||
|
{
|
||||||
|
if (changed) {
|
||||||
|
debouncing = true;
|
||||||
|
debouncing_time = timer_read();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) {
|
||||||
|
for (int i = 0; i < num_rows; i++) {
|
||||||
|
cooked[i] = raw[i];
|
||||||
|
}
|
||||||
|
debouncing = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else //no debouncing.
|
||||||
|
void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool changed)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < num_rows; i++) {
|
||||||
|
cooked[i] = raw[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool debounce_active(void) {
|
||||||
|
return debouncing;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
Debounce algorithms belong in this folder.
|
||||||
|
Here are a few ideas
|
||||||
|
|
||||||
|
1) Global vs Per-Key vs Per-Row
|
||||||
|
* Global - one timer for all keys. Any key change state affects global timer
|
||||||
|
* Per key - one timer per key
|
||||||
|
* Per row - one timer per row
|
||||||
|
|
||||||
|
2) Eager vs symmetric vs assymetric
|
||||||
|
* Eager - any key change is reported immediately. All further inputs for DEBOUNCE ms are ignored.
|
||||||
|
* Symmetric - wait for no changes for DEBOUNCE ms before reporting change
|
||||||
|
* Assymetric - wait for different times depending on key-down/key-up. E.g. Eager key-down, DEBOUNCE ms key up.
|
||||||
|
|
||||||
|
3) Timestamp vs cycles
|
||||||
|
* old old old code waits n cycles, decreasing count by one each matrix_scan
|
||||||
|
* newer code stores the millisecond the change occurred, and does subraction to figure out time elapsed.
|
||||||
|
* Timestamps are superior, i don't think cycles will ever be used again once upgraded.
|
||||||
|
|
||||||
|
The default algorithm is symmetric and global.
|
||||||
|
Here are a few that could be implemented:
|
||||||
|
|
||||||
|
debounce_sym_g.c
|
||||||
|
debounce_sym_pk.c
|
||||||
|
debounce_sym_pr.c
|
||||||
|
debounce_sym_pr_cycles.c //currently used in ergo-dox
|
||||||
|
debounce_eager_g.c
|
||||||
|
debounce_eager_pk.c
|
||||||
|
debounce_eager_pr.c //could be used in ergo-dox!
|
||||||
+3
-28
@@ -51,10 +51,8 @@ static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* matrix state(1:on, 0:off) */
|
/* matrix state(1:on, 0:off) */
|
||||||
static matrix_row_t raw_matrix[MATRIX_ROWS];
|
static matrix_row_t raw_matrix[MATRIX_ROWS]; //raw values
|
||||||
|
static matrix_row_t matrix[MATRIX_ROWS]; //debounced values
|
||||||
static matrix_row_t matrix[MATRIX_ROWS];
|
|
||||||
|
|
||||||
|
|
||||||
#if (DIODE_DIRECTION == COL2ROW)
|
#if (DIODE_DIRECTION == COL2ROW)
|
||||||
static void init_cols(void);
|
static void init_cols(void);
|
||||||
@@ -108,30 +106,6 @@ uint8_t matrix_cols(void) {
|
|||||||
return MATRIX_COLS;
|
return MATRIX_COLS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// void matrix_power_up(void) {
|
|
||||||
// #if (DIODE_DIRECTION == COL2ROW)
|
|
||||||
// for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
|
|
||||||
// /* DDRxn */
|
|
||||||
// _SFR_IO8((row_pins[r] >> 4) + 1) |= _BV(row_pins[r] & 0xF);
|
|
||||||
// toggle_row(r);
|
|
||||||
// }
|
|
||||||
// for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
|
|
||||||
// /* PORTxn */
|
|
||||||
// _SFR_IO8((col_pins[c] >> 4) + 2) |= _BV(col_pins[c] & 0xF);
|
|
||||||
// }
|
|
||||||
// #elif (DIODE_DIRECTION == ROW2COL)
|
|
||||||
// for (int8_t c = MATRIX_COLS - 1; c >= 0; --c) {
|
|
||||||
// /* DDRxn */
|
|
||||||
// _SFR_IO8((col_pins[c] >> 4) + 1) |= _BV(col_pins[c] & 0xF);
|
|
||||||
// toggle_col(c);
|
|
||||||
// }
|
|
||||||
// for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) {
|
|
||||||
// /* PORTxn */
|
|
||||||
// _SFR_IO8((row_pins[r] >> 4) + 2) |= _BV(row_pins[r] & 0xF);
|
|
||||||
// }
|
|
||||||
// #endif
|
|
||||||
// }
|
|
||||||
|
|
||||||
void matrix_init(void) {
|
void matrix_init(void) {
|
||||||
|
|
||||||
// initialize row and col
|
// initialize row and col
|
||||||
@@ -175,6 +149,7 @@ uint8_t matrix_scan(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Deprecated.
|
||||||
bool matrix_is_modified(void)
|
bool matrix_is_modified(void)
|
||||||
{
|
{
|
||||||
if (debounce_active()) return false;
|
if (debounce_active()) return false;
|
||||||
|
|||||||
@@ -17,9 +17,6 @@
|
|||||||
#include "process_unicodemap.h"
|
#include "process_unicodemap.h"
|
||||||
#include "process_unicode_common.h"
|
#include "process_unicode_common.h"
|
||||||
|
|
||||||
__attribute__((weak))
|
|
||||||
const uint32_t PROGMEM unicode_map[] = {};
|
|
||||||
|
|
||||||
void register_hex32(uint32_t hex) {
|
void register_hex32(uint32_t hex) {
|
||||||
bool onzerostart = true;
|
bool onzerostart = true;
|
||||||
for(int i = 7; i >= 0; i--) {
|
for(int i = 7; i >= 0; i--) {
|
||||||
|
|||||||
@@ -19,5 +19,7 @@
|
|||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
#include "process_unicode_common.h"
|
#include "process_unicode_common.h"
|
||||||
|
|
||||||
|
extern const uint32_t PROGMEM unicode_map[];
|
||||||
|
|
||||||
void unicodemap_input_error(void);
|
void unicodemap_input_error(void);
|
||||||
bool process_unicodemap(uint16_t keycode, keyrecord_t *record);
|
bool process_unicodemap(uint16_t keycode, keyrecord_t *record);
|
||||||
+80
-2
@@ -58,6 +58,7 @@ const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90};
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
rgblight_config_t rgblight_config;
|
rgblight_config_t rgblight_config;
|
||||||
|
bool is_rgblight_initialized = false;
|
||||||
|
|
||||||
LED_TYPE led[RGBLED_NUM];
|
LED_TYPE led[RGBLED_NUM];
|
||||||
bool rgblight_timer_enabled = false;
|
bool rgblight_timer_enabled = false;
|
||||||
@@ -123,6 +124,35 @@ void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1) {
|
|||||||
(*led1).b = b;
|
(*led1).b = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rgblight_check_config(void) {
|
||||||
|
/* Add some out of bound checks for RGB light config */
|
||||||
|
|
||||||
|
if (rgblight_config.mode < RGBLIGHT_MODE_STATIC_LIGHT) {
|
||||||
|
rgblight_config.mode = RGBLIGHT_MODE_STATIC_LIGHT;
|
||||||
|
}
|
||||||
|
else if (rgblight_config.mode > RGBLIGHT_MODES) {
|
||||||
|
rgblight_config.mode = RGBLIGHT_MODES;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rgblight_config.hue < 0) {
|
||||||
|
rgblight_config.hue = 0;
|
||||||
|
} else if (rgblight_config.hue > 360) {
|
||||||
|
rgblight_config.hue %= 360;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rgblight_config.sat < 0) {
|
||||||
|
rgblight_config.sat = 0;
|
||||||
|
} else if (rgblight_config.sat > 255) {
|
||||||
|
rgblight_config.sat = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rgblight_config.val < 0) {
|
||||||
|
rgblight_config.val = 0;
|
||||||
|
} else if (rgblight_config.val > RGBLIGHT_LIMIT_VAL) {
|
||||||
|
rgblight_config.val = RGBLIGHT_LIMIT_VAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t eeconfig_read_rgblight(void) {
|
uint32_t eeconfig_read_rgblight(void) {
|
||||||
#if defined(__AVR__) || defined(STM32_EEPROM_ENABLE) || defined(PROTOCOL_ARM_ATSAM) || defined(EEPROM_SIZE)
|
#if defined(__AVR__) || defined(STM32_EEPROM_ENABLE) || defined(PROTOCOL_ARM_ATSAM) || defined(EEPROM_SIZE)
|
||||||
@@ -131,13 +161,14 @@ uint32_t eeconfig_read_rgblight(void) {
|
|||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void eeconfig_update_rgblight(uint32_t val) {
|
void eeconfig_update_rgblight(uint32_t val) {
|
||||||
#if defined(__AVR__) || defined(STM32_EEPROM_ENABLE) || defined(PROTOCOL_ARM_ATSAM) || defined(EEPROM_SIZE)
|
#if defined(__AVR__) || defined(STM32_EEPROM_ENABLE) || defined(PROTOCOL_ARM_ATSAM) || defined(EEPROM_SIZE)
|
||||||
if (eeconfig_read_rgblight() != val) {
|
rgblight_check_config();
|
||||||
eeprom_update_dword(EECONFIG_RGBLIGHT, val);
|
eeprom_update_dword(EECONFIG_RGBLIGHT, val);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void eeconfig_update_rgblight_default(void) {
|
void eeconfig_update_rgblight_default(void) {
|
||||||
//dprintf("eeconfig_update_rgblight_default\n");
|
//dprintf("eeconfig_update_rgblight_default\n");
|
||||||
rgblight_config.enable = 1;
|
rgblight_config.enable = 1;
|
||||||
@@ -148,6 +179,7 @@ void eeconfig_update_rgblight_default(void) {
|
|||||||
rgblight_config.speed = 0;
|
rgblight_config.speed = 0;
|
||||||
eeconfig_update_rgblight(rgblight_config.raw);
|
eeconfig_update_rgblight(rgblight_config.raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void eeconfig_debug_rgblight(void) {
|
void eeconfig_debug_rgblight(void) {
|
||||||
dprintf("rgblight_config eprom\n");
|
dprintf("rgblight_config eprom\n");
|
||||||
dprintf("rgblight_config.enable = %d\n", rgblight_config.enable);
|
dprintf("rgblight_config.enable = %d\n", rgblight_config.enable);
|
||||||
@@ -159,6 +191,11 @@ void eeconfig_debug_rgblight(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void rgblight_init(void) {
|
void rgblight_init(void) {
|
||||||
|
/* if already initialized, don't do it again.
|
||||||
|
If you must do it again, extern this and set to false, first.
|
||||||
|
This is a dirty, dirty hack until proper hooks can be added for keyboard startup. */
|
||||||
|
if (is_rgblight_initialized) { return; }
|
||||||
|
|
||||||
debug_enable = 1; // Debug ON!
|
debug_enable = 1; // Debug ON!
|
||||||
dprintf("rgblight_init called.\n");
|
dprintf("rgblight_init called.\n");
|
||||||
dprintf("rgblight_init start!\n");
|
dprintf("rgblight_init start!\n");
|
||||||
@@ -173,6 +210,8 @@ void rgblight_init(void) {
|
|||||||
eeconfig_update_rgblight_default();
|
eeconfig_update_rgblight_default();
|
||||||
rgblight_config.raw = eeconfig_read_rgblight();
|
rgblight_config.raw = eeconfig_read_rgblight();
|
||||||
}
|
}
|
||||||
|
rgblight_check_config();
|
||||||
|
|
||||||
eeconfig_debug_rgblight(); // display current eeprom values
|
eeconfig_debug_rgblight(); // display current eeprom values
|
||||||
|
|
||||||
#ifdef RGBLIGHT_USE_TIMER
|
#ifdef RGBLIGHT_USE_TIMER
|
||||||
@@ -182,6 +221,9 @@ void rgblight_init(void) {
|
|||||||
if (rgblight_config.enable) {
|
if (rgblight_config.enable) {
|
||||||
rgblight_mode_noeeprom(rgblight_config.mode);
|
rgblight_mode_noeeprom(rgblight_config.mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_rgblight_initialized = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgblight_update_dword(uint32_t dword) {
|
void rgblight_update_dword(uint32_t dword) {
|
||||||
@@ -569,6 +611,42 @@ void rgblight_sethsv_at(uint16_t hue, uint8_t sat, uint8_t val, uint8_t index) {
|
|||||||
rgblight_setrgb_at(tmp_led.r, tmp_led.g, tmp_led.b, index);
|
rgblight_setrgb_at(tmp_led.r, tmp_led.g, tmp_led.b, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8_t end) {
|
||||||
|
if (!rgblight_config.enable || start < 0 || start >= end || end > RGBLED_NUM) { return; }
|
||||||
|
|
||||||
|
for (uint8_t i = start; i < end; i++) {
|
||||||
|
led[i].r = r;
|
||||||
|
led[i].g = g;
|
||||||
|
led[i].b = b;
|
||||||
|
}
|
||||||
|
rgblight_set();
|
||||||
|
wait_ms(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_sethsv_range(uint16_t hue, uint8_t sat, uint8_t val, uint8_t start, uint8_t end) {
|
||||||
|
if (!rgblight_config.enable) { return; }
|
||||||
|
|
||||||
|
LED_TYPE tmp_led;
|
||||||
|
sethsv(hue, sat, val, &tmp_led);
|
||||||
|
rgblight_setrgb_range(tmp_led.r, tmp_led.g, tmp_led.b, start, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_setrgb_master(uint8_t r, uint8_t g, uint8_t b) {
|
||||||
|
rgblight_setrgb_range(r, g, b, 0 , (uint8_t) RGBLED_NUM/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_setrgb_slave(uint8_t r, uint8_t g, uint8_t b) {
|
||||||
|
rgblight_setrgb_range(r, g, b, (uint8_t) RGBLED_NUM/2, (uint8_t) RGBLED_NUM);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_sethsv_master(uint16_t hue, uint8_t sat, uint8_t val) {
|
||||||
|
rgblight_sethsv_range(hue, sat, val, 0, (uint8_t) RGBLED_NUM/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgblight_sethsv_slave(uint16_t hue, uint8_t sat, uint8_t val) {
|
||||||
|
rgblight_sethsv_range(hue, sat, val, (uint8_t) RGBLED_NUM/2, (uint8_t) RGBLED_NUM);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef RGBLIGHT_CUSTOM_DRIVER
|
#ifndef RGBLIGHT_CUSTOM_DRIVER
|
||||||
void rgblight_set(void) {
|
void rgblight_set(void) {
|
||||||
if (rgblight_config.enable) {
|
if (rgblight_config.enable) {
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ extern const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[3] PROGMEM;
|
|||||||
extern const uint8_t RGBLED_SNAKE_INTERVALS[3] PROGMEM;
|
extern const uint8_t RGBLED_SNAKE_INTERVALS[3] PROGMEM;
|
||||||
extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM;
|
extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM;
|
||||||
extern const uint16_t RGBLED_RGBTEST_INTERVALS[1] PROGMEM;
|
extern const uint16_t RGBLED_RGBTEST_INTERVALS[1] PROGMEM;
|
||||||
|
extern bool is_rgblight_initialized;
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
uint32_t raw;
|
uint32_t raw;
|
||||||
@@ -186,6 +187,12 @@ uint8_t rgblight_get_val(void);
|
|||||||
void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b);
|
void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b);
|
||||||
void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index);
|
void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index);
|
||||||
void rgblight_sethsv_at(uint16_t hue, uint8_t sat, uint8_t val, uint8_t index);
|
void rgblight_sethsv_at(uint16_t hue, uint8_t sat, uint8_t val, uint8_t index);
|
||||||
|
void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8_t end);
|
||||||
|
void rgblight_sethsv_range(uint16_t hue, uint8_t sat, uint8_t val, uint8_t start, uint8_t end);
|
||||||
|
void rgblight_setrgb_master(uint8_t r, uint8_t g, uint8_t b);
|
||||||
|
void rgblight_setrgb_slave(uint8_t r, uint8_t g, uint8_t b);
|
||||||
|
void rgblight_sethsv_master(uint16_t hue, uint8_t sat, uint8_t val);
|
||||||
|
void rgblight_sethsv_slave(uint16_t hue, uint8_t sat, uint8_t val);
|
||||||
|
|
||||||
uint32_t eeconfig_read_rgblight(void);
|
uint32_t eeconfig_read_rgblight(void);
|
||||||
void eeconfig_update_rgblight(uint32_t val);
|
void eeconfig_update_rgblight(uint32_t val);
|
||||||
|
|||||||
+6
-2
@@ -39,9 +39,13 @@ include $(STARTUP_MK)
|
|||||||
# HAL-OSAL files (optional).
|
# HAL-OSAL files (optional).
|
||||||
include $(CHIBIOS)/os/hal/hal.mk
|
include $(CHIBIOS)/os/hal/hal.mk
|
||||||
|
|
||||||
PLATFORM_MK = $(CHIBIOS)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/platform.mk
|
ifeq ("$(PLATFORM_NAME)","")
|
||||||
|
PLATFORM_NAME = platform
|
||||||
|
endif
|
||||||
|
|
||||||
|
PLATFORM_MK = $(CHIBIOS)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/$(PLATFORM_NAME).mk
|
||||||
ifeq ("$(wildcard $(PLATFORM_MK))","")
|
ifeq ("$(wildcard $(PLATFORM_MK))","")
|
||||||
PLATFORM_MK = $(CHIBIOS_CONTRIB)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/platform.mk
|
PLATFORM_MK = $(CHIBIOS_CONTRIB)/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)/$(PLATFORM_NAME).mk
|
||||||
endif
|
endif
|
||||||
include $(PLATFORM_MK)
|
include $(PLATFORM_MK)
|
||||||
|
|
||||||
|
|||||||
@@ -142,20 +142,20 @@ static void power_down(uint8_t wdto) {
|
|||||||
#endif
|
#endif
|
||||||
suspend_power_down_kb();
|
suspend_power_down_kb();
|
||||||
|
|
||||||
// TODO: more power saving
|
// TODO: more power saving
|
||||||
// See PicoPower application note
|
// See PicoPower application note
|
||||||
// - I/O port input with pullup
|
// - I/O port input with pullup
|
||||||
// - prescale clock
|
// - prescale clock
|
||||||
// - BOD disable
|
// - BOD disable
|
||||||
// - Power Reduction Register PRR
|
// - Power Reduction Register PRR
|
||||||
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
|
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
|
||||||
sleep_enable();
|
sleep_enable();
|
||||||
sei();
|
sei();
|
||||||
sleep_cpu();
|
sleep_cpu();
|
||||||
sleep_disable();
|
sleep_disable();
|
||||||
|
|
||||||
// Disable watchdog after sleep
|
// Disable watchdog after sleep
|
||||||
wdt_disable();
|
wdt_disable();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+38
-15
@@ -139,6 +139,40 @@ __attribute__ ((weak))
|
|||||||
void matrix_setup(void) {
|
void matrix_setup(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** \brief keyboard_pre_init_user
|
||||||
|
*
|
||||||
|
* FIXME: needs doc
|
||||||
|
*/
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void keyboard_pre_init_user(void) { }
|
||||||
|
|
||||||
|
/** \brief keyboard_pre_init_kb
|
||||||
|
*
|
||||||
|
* FIXME: needs doc
|
||||||
|
*/
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void keyboard_pre_init_kb(void) {
|
||||||
|
keyboard_pre_init_user();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief keyboard_post_init_user
|
||||||
|
*
|
||||||
|
* FIXME: needs doc
|
||||||
|
*/
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void keyboard_post_init_user() {}
|
||||||
|
|
||||||
|
/** \brief keyboard_post_init_kb
|
||||||
|
*
|
||||||
|
* FIXME: needs doc
|
||||||
|
*/
|
||||||
|
|
||||||
|
__attribute__ ((weak))
|
||||||
|
void keyboard_post_init_kb(void) {
|
||||||
|
keyboard_post_init_user();
|
||||||
|
}
|
||||||
|
|
||||||
/** \brief keyboard_setup
|
/** \brief keyboard_setup
|
||||||
*
|
*
|
||||||
* FIXME: needs doc
|
* FIXME: needs doc
|
||||||
@@ -146,6 +180,7 @@ void matrix_setup(void) {
|
|||||||
void keyboard_setup(void) {
|
void keyboard_setup(void) {
|
||||||
disable_jtag();
|
disable_jtag();
|
||||||
matrix_setup();
|
matrix_setup();
|
||||||
|
keyboard_pre_init_kb();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief is_keyboard_master
|
/** \brief is_keyboard_master
|
||||||
@@ -199,6 +234,7 @@ void keyboard_init(void) {
|
|||||||
#if defined(NKRO_ENABLE) && defined(FORCE_NKRO)
|
#if defined(NKRO_ENABLE) && defined(FORCE_NKRO)
|
||||||
keymap_config.nkro = 1;
|
keymap_config.nkro = 1;
|
||||||
#endif
|
#endif
|
||||||
|
keyboard_post_init_kb(); /* Always keep this last */
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Keyboard task: Do keyboard routine jobs
|
/** \brief Keyboard task: Do keyboard routine jobs
|
||||||
@@ -216,9 +252,6 @@ void keyboard_init(void) {
|
|||||||
void keyboard_task(void)
|
void keyboard_task(void)
|
||||||
{
|
{
|
||||||
static matrix_row_t matrix_prev[MATRIX_ROWS];
|
static matrix_row_t matrix_prev[MATRIX_ROWS];
|
||||||
#ifdef MATRIX_HAS_GHOST
|
|
||||||
// static matrix_row_t matrix_ghost[MATRIX_ROWS];
|
|
||||||
#endif
|
|
||||||
static uint8_t led_status = 0;
|
static uint8_t led_status = 0;
|
||||||
matrix_row_t matrix_row = 0;
|
matrix_row_t matrix_row = 0;
|
||||||
matrix_row_t matrix_change = 0;
|
matrix_row_t matrix_change = 0;
|
||||||
@@ -227,24 +260,14 @@ void keyboard_task(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
matrix_scan();
|
matrix_scan();
|
||||||
|
|
||||||
if (is_keyboard_master()) {
|
if (is_keyboard_master()) {
|
||||||
for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
|
for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
|
||||||
matrix_row = matrix_get_row(r);
|
matrix_row = matrix_get_row(r);
|
||||||
matrix_change = matrix_row ^ matrix_prev[r];
|
matrix_change = matrix_row ^ matrix_prev[r];
|
||||||
if (matrix_change) {
|
if (matrix_change) {
|
||||||
#ifdef MATRIX_HAS_GHOST
|
#ifdef MATRIX_HAS_GHOST
|
||||||
if (has_ghost_in_row(r, matrix_row)) {
|
if (has_ghost_in_row(r, matrix_row)) { continue; }
|
||||||
/* Keep track of whether ghosted status has changed for
|
|
||||||
* debugging. But don't update matrix_prev until un-ghosted, or
|
|
||||||
* the last key would be lost.
|
|
||||||
*/
|
|
||||||
//if (debug_matrix && matrix_ghost[r] != matrix_row) {
|
|
||||||
// matrix_print();
|
|
||||||
//}
|
|
||||||
//matrix_ghost[r] = matrix_row;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//matrix_ghost[r] = matrix_row;
|
|
||||||
#endif
|
#endif
|
||||||
if (debug_matrix) matrix_print();
|
if (debug_matrix) matrix_print();
|
||||||
for (uint8_t c = 0; c < MATRIX_COLS; c++) {
|
for (uint8_t c = 0; c < MATRIX_COLS; c++) {
|
||||||
|
|||||||
@@ -70,6 +70,11 @@ void keyboard_set_leds(uint8_t leds);
|
|||||||
/* it runs whenever code has to behave differently on a slave */
|
/* it runs whenever code has to behave differently on a slave */
|
||||||
bool is_keyboard_master(void);
|
bool is_keyboard_master(void);
|
||||||
|
|
||||||
|
void keyboard_pre_init_kb(void);
|
||||||
|
void keyboard_pre_init_user(void);
|
||||||
|
void keyboard_post_init_kb(void);
|
||||||
|
void keyboard_post_init_user(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
CPU_PRESCALE(0);
|
CPU_PRESCALE(0);
|
||||||
|
|
||||||
// DDRD = _BV(PD5);
|
// DDRD = _BV(PD5);
|
||||||
// DDRB = _BV(PB0);
|
// DDRB = _BV(PB0);
|
||||||
|
|
||||||
// PORTD = _BV(PD5);
|
// PORTD = _BV(PD5);
|
||||||
// PORTB = _BV(PB0);
|
// PORTB = _BV(PB0);
|
||||||
|
|
||||||
@@ -59,22 +59,23 @@ int main(void)
|
|||||||
// while (!usb_configured()) /* wait */
|
// while (!usb_configured()) /* wait */
|
||||||
|
|
||||||
|
|
||||||
|
keyboard_setup();
|
||||||
|
|
||||||
dprintf("Initializing keyboard...\n");
|
dprintf("Initializing keyboard...\n");
|
||||||
keyboard_init();
|
keyboard_init();
|
||||||
|
|
||||||
// This implementation is pretty simplistic... if the USB connection
|
// This implementation is pretty simplistic... if the USB connection
|
||||||
// is not configured, choose the Bluefruit, otherwise use USB
|
// is not configured, choose the Bluefruit, otherwise use USB
|
||||||
// Definitely would prefer to have this driven by an input pin and make
|
// Definitely would prefer to have this driven by an input pin and make
|
||||||
// it switch dynamically - BCG
|
// it switch dynamically - BCG
|
||||||
// if (!usb_configured()) {
|
// if (!usb_configured()) {
|
||||||
|
|
||||||
// // Send power to Bluefruit... Adafruit says it takes 27 mA, I think
|
// // Send power to Bluefruit... Adafruit says it takes 27 mA, I think
|
||||||
// // the pins should provide 40 mA, but just in case I switch the
|
// // the pins should provide 40 mA, but just in case I switch the
|
||||||
// // Bluefruit using a transistor - BCG
|
// // Bluefruit using a transistor - BCG
|
||||||
// DDRB = _BV(PB6);
|
// DDRB = _BV(PB6);
|
||||||
// PORTB |= _BV(PB6);
|
// PORTB |= _BV(PB6);
|
||||||
|
|
||||||
dprintf("Setting host driver to bluefruit...\n");
|
dprintf("Setting host driver to bluefruit...\n");
|
||||||
host_set_driver(bluefruit_driver());
|
host_set_driver(bluefruit_driver());
|
||||||
|
|
||||||
@@ -131,7 +132,7 @@ int main(void)
|
|||||||
// usb_remote_wakeup();
|
// usb_remote_wakeup();
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// keyboard_task();
|
// keyboard_task();
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|||||||
@@ -119,6 +119,8 @@ int main(void) {
|
|||||||
// TESTING
|
// TESTING
|
||||||
// chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
|
// chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
|
||||||
|
|
||||||
|
keyboard_setup();
|
||||||
|
|
||||||
/* Init USB */
|
/* Init USB */
|
||||||
init_usb_driver(&USB_DRIVER);
|
init_usb_driver(&USB_DRIVER);
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ int main(void)
|
|||||||
#ifndef NO_UART
|
#ifndef NO_UART
|
||||||
uart_init(UART_BAUD_RATE);
|
uart_init(UART_BAUD_RATE);
|
||||||
#endif
|
#endif
|
||||||
|
keyboard_setup();
|
||||||
|
|
||||||
keyboard_init();
|
keyboard_init();
|
||||||
host_set_driver(vusb_driver());
|
host_set_driver(vusb_driver());
|
||||||
|
|||||||
@@ -39,11 +39,12 @@ if [ -n "$target" ]; then
|
|||||||
else
|
else
|
||||||
echo "Error: target requires docker-machine to work on your platform" >&2
|
echo "Error: target requires docker-machine to work on your platform" >&2
|
||||||
echo "See http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos" >&2
|
echo "See http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos" >&2
|
||||||
|
echo "Consider flashing with QMK Toolbox (https://github.com/qmk/qmk_toolbox) instead" >&2
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows
|
dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows
|
||||||
|
|
||||||
# Run container and build firmware
|
# Run container and build firmware
|
||||||
docker run --rm $usb_args -v "$dir":/qmk_firmware qmkfm/qmk_firmware \
|
docker run --rm -it $usb_args -v "$dir":/qmk_firmware qmkfm/qmk_firmware \
|
||||||
make "$keyboard${keymap:+:$keymap}${target:+:$target}"
|
make "$keyboard${keymap:+:$keymap}${target:+:$target}"
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
TRAVIS_BRANCH="${TRAVIS_BRANCH:master}"
|
source util/travis_push.sh
|
||||||
TRAVIS_PULL_REQUEST="${TRAVIS_PULL_REQUEST:false}"
|
|
||||||
TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}"
|
|
||||||
TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}"
|
|
||||||
|
|
||||||
set -o errexit -o nounset
|
set -o errexit -o nounset
|
||||||
|
|
||||||
@@ -12,17 +9,6 @@ echo "Using git hash ${rev}"
|
|||||||
|
|
||||||
if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; then
|
if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; then
|
||||||
|
|
||||||
git config --global user.name "QMK Bot"
|
|
||||||
git config --global user.email "[email protected]"
|
|
||||||
|
|
||||||
openssl aes-256-cbc -K $encrypted_b0ee987fd0fc_key -iv $encrypted_b0ee987fd0fc_iv -in secrets.tar.enc -out secrets.tar -d
|
|
||||||
tar xvf secrets.tar
|
|
||||||
|
|
||||||
chmod 600 id_rsa_qmk_firmware
|
|
||||||
chmod 600 id_rsa_qmk.fm
|
|
||||||
eval `ssh-agent -s`
|
|
||||||
ssh-add id_rsa_qmk_firmware
|
|
||||||
|
|
||||||
# convert to unix line-endings
|
# convert to unix line-endings
|
||||||
git checkout master
|
git checkout master
|
||||||
git diff --diff-filter=M --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | xargs -0 dos2unix
|
git diff --diff-filter=M --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | xargs -0 dos2unix
|
||||||
|
|||||||
+10
-8
@@ -5,13 +5,15 @@ TRAVIS_PULL_REQUEST="${TRAVIS_PULL_REQUEST:false}"
|
|||||||
TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}"
|
TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}"
|
||||||
TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}"
|
TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}"
|
||||||
|
|
||||||
git config --global user.name "QMK Bot"
|
if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; then
|
||||||
git config --global user.email "[email protected]"
|
git config --global user.name "QMK Bot"
|
||||||
|
git config --global user.email "[email protected]"
|
||||||
|
|
||||||
openssl aes-256-cbc -K $encrypted_b0ee987fd0fc_key -iv $encrypted_b0ee987fd0fc_iv -in secrets.tar.enc -out secrets.tar -d
|
openssl aes-256-cbc -K $encrypted_b0ee987fd0fc_key -iv $encrypted_b0ee987fd0fc_iv -in secrets.tar.enc -out secrets.tar -d
|
||||||
tar xvf secrets.tar
|
tar xvf secrets.tar
|
||||||
|
|
||||||
chmod 600 id_rsa_qmk_firmware
|
chmod 600 id_rsa_qmk_firmware
|
||||||
chmod 600 id_rsa_qmk.fm
|
chmod 600 id_rsa_qmk.fm
|
||||||
eval `ssh-agent -s`
|
eval `ssh-agent -s`
|
||||||
ssh-add id_rsa_qmk_firmware
|
ssh-add id_rsa_qmk_firmware
|
||||||
|
fi
|
||||||
Reference in new issue
Block a user