This commit is contained in:
Jack Humbert 2018-10-26 17:45:28 -04:00
commit f39a21cae1
1377 changed files with 42701 additions and 8075 deletions

2
Vagrantfile vendored
View file

@ -59,7 +59,7 @@ Vagrant.configure(2) do |config|
# add a # before ,args: and run 'vagrant up' to get a working
# non-updated box and then attempt to troubleshoot or open a Github issue
config.vm.provision "shell", run: "always", path: "./util/install_dependencies.sh", args: "-update"
config.vm.provision "shell", run: "always", path: "./util/qmk_install.sh", args: "-update"
config.vm.post_up_message = <<-EOT

View file

@ -110,8 +110,28 @@ ifneq ("$(wildcard $(KEYBOARD_C_1))","")
KEYBOARD_SRC += $(KEYBOARD_C_1)
endif
OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE)
# Generate KEYBOARD_name_subname for all levels of the keyboard folder
KEYBOARD_FILESAFE_1 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_1)))
KEYBOARD_FILESAFE_2 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_2)))
KEYBOARD_FILESAFE_3 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_3)))
KEYBOARD_FILESAFE_4 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_4)))
KEYBOARD_FILESAFE_5 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_5)))
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/)","")
OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_5)
endif
ifneq ("$(wildcard $(KEYBOARD_PATH_4)/)","")
OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_4)
endif
ifneq ("$(wildcard $(KEYBOARD_PATH_3)/)","")
OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_3)
endif
ifneq ("$(wildcard $(KEYBOARD_PATH_2)/)","")
OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_2)
endif
ifneq ("$(wildcard $(KEYBOARD_PATH_1)/)","")
OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_1)
endif
# Setup the define for QMK_KEYBOARD_H. This is used inside of keymaps so
# that the same keymap may be used on multiple keyboards.

View file

@ -114,37 +114,35 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
endif
endif
ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
RGB_MATRIX_ENABLE ?= no
VALID_MATRIX_TYPES := yes IS31FL3731 IS31FL3733 custom
ifneq ($(strip $(RGB_MATRIX_ENABLE)), no)
ifeq ($(filter $(RGB_MATRIX_ENABLE),$(VALID_MATRIX_TYPES)),)
$(error RGB_MATRIX_ENABLE="$(RGB_MATRIX_ENABLE)" is not a valid matrix type)
endif
OPT_DEFS += -DRGB_MATRIX_ENABLE
OPT_DEFS += -DIS31FL3731
COMMON_VPATH += $(DRIVER_PATH)/issi
SRC += is31fl3731.c
SRC += i2c_master.c
SRC += $(QUANTUM_DIR)/color.c
SRC += $(QUANTUM_DIR)/rgb_matrix.c
SRC += $(QUANTUM_DIR)/rgb_matrix_drivers.c
CIE1931_CURVE = yes
endif
ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
RGB_MATRIX_ENABLE = IS31FL3731
endif
ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3731)
OPT_DEFS += -DRGB_MATRIX_ENABLE
OPT_DEFS += -DIS31FL3731
COMMON_VPATH += $(DRIVER_PATH)/issi
SRC += is31fl3731.c
SRC += i2c_master.c
SRC += $(QUANTUM_DIR)/color.c
SRC += $(QUANTUM_DIR)/rgb_matrix.c
CIE1931_CURVE = yes
endif
ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3733)
OPT_DEFS += -DRGB_MATRIX_ENABLE
OPT_DEFS += -DIS31FL3733
COMMON_VPATH += $(DRIVER_PATH)/issi
SRC += is31fl3733.c
SRC += i2c_master.c
SRC += $(QUANTUM_DIR)/color.c
SRC += $(QUANTUM_DIR)/rgb_matrix.c
CIE1931_CURVE = yes
endif
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
@ -221,6 +219,11 @@ ifeq ($(strip $(USB_HID_ENABLE)), yes)
include $(TMK_DIR)/protocol/usb_hid.mk
endif
ifeq ($(strip $(ENCODER_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/encoder.c
OPT_DEFS += -DENCODER_ENABLE
endif
ifeq ($(strip $(HD44780_ENABLE)), yes)
SRC += drivers/avr/hd44780.c
OPT_DEFS += -DHD44780_ENABLE

View file

@ -3,6 +3,8 @@
* [Building Your First Firmware](newbs_building_firmware.md)
* [Flashing Firmware](newbs_flashing.md)
* [Testing and Debugging](newbs_testing_debugging.md)
* [Best Practices](newbs_best_practices.md)
* [Learning Resources](newbs_learn_more_resources.md)
* [QMK Basics](README.md)
* [QMK Introduction](getting_started_introduction.md)
@ -47,8 +49,10 @@
* [Backlight](feature_backlight.md)
* [Bluetooth](feature_bluetooth.md)
* [Bootmagic](feature_bootmagic.md)
* [Combos](feature_combo)
* [Command](feature_command.md)
* [Dynamic Macros](feature_dynamic_macros.md)
* [Encoders](feature_encoders.md)
* [Grave Escape](feature_grave_esc.md)
* [Key Lock](feature_key_lock.md)
* [Layouts](feature_layouts.md)
@ -74,6 +78,7 @@
* For Makers and Modders
* [Hand Wiring Guide](hand_wire.md)
* [ISP Flashing Guide](isp_flashing_guide.md)
* [ARM Debugging Guide](arm_debugging.md)
* For a Deeper Understanding
* [How Keyboards Work](how_keyboards_work.md)

View file

@ -3,6 +3,8 @@
* [Building Your First Firmware](newbs_building_firmware.md)
* [Flashing Firmware](newbs_flashing.md)
* [Testing and Debugging](newbs_testing_debugging.md)
* [Best Practices](newbs_best_practices.md)
* [Learning Resources](newbs_learn_more_resources.md)
* [QMK Basics](README.md)
* [QMK Introduction](getting_started_introduction.md)
@ -47,8 +49,10 @@
* [Backlight](feature_backlight.md)
* [Bluetooth](feature_bluetooth.md)
* [Bootmagic](feature_bootmagic.md)
* [Combos](feature_combo)
* [Command](feature_command.md)
* [Dynamic Macros](feature_dynamic_macros.md)
* [Encoders](feature_encoders.md)
* [Grave Escape](feature_grave_esc.md)
* [Key Lock](feature_key_lock.md)
* [Layouts](feature_layouts.md)
@ -74,6 +78,7 @@
* For Makers and Modders
* [Hand Wiring Guide](hand_wire.md)
* [ISP Flashing Guide](isp_flashing_guide.md)
* [ARM Debugging Guide](arm_debugging.md)
* For a Deeper Understanding
* [How Keyboards Work](how_keyboards_work.md)

87
docs/arm_debugging.md Normal file
View file

@ -0,0 +1,87 @@
# ARM Debugging usign Eclipse
This page describes how to setup debugging for ARM MCUs using an SWD adapter and open-source/free tools. In this guide we will install GNU MCU Eclipse IDE for C/C++ Developers and OpenOCD together with all the necessary dependencies.
This guide is catered towards advance users and assumes you can compile an ARM compatible keyboard on your machine using the MAKE flow.
## Installing the software
The main objective here is to get the MCU Eclipse IDE correcly installed on our machine. The necesarry instructions are derived from [this](https://gnu-mcu-eclipse.github.io/install/) install guide.
### The xPack Manager
This tool is a software package manager and it is used to help us get the necesarry depencencies.
XPM runs using Node.js so grab that form [here](https://nodejs.org/en/). After installation, open a terminal and type `npm -v`. A reply with the version number means that the instalation was successful.
XPM instalation instructions can be found [here](https://www.npmjs.com/package/xpm) and are OS specific. Entering `xpm --version` to your terminal should return the software version.
### The ARM Toolchain
Using XPM it is very easy to install the ARM toolchain. Enter the command `xpm install --global @gnu-mcu-eclipse/arm-none-eabi-gcc`.
### Windows build tools
If you are using windows you need to install this!
`xpm install --global @gnu-mcu-eclipse/windows-build-tools`
### Programer/Debugger Drivers
Now its the time to install your programer's drivers. This tutorial was made using an ST-Link v2 which you can get from almost anywhere.
If you have an ST-Link the drivers can be found [here](https://www.st.com/en/development-tools/stsw-link009.html) otherwise consult the manufuturer of your tool.
### OpenOCD
This dependency allows SWD access from GDB and it is essential for debugging. Run `xpm install --global @gnu-mcu-eclipse/openocd`.
### Java
Java is needed by Eclipse so please download it from [here](https://www.oracle.com/technetwork/java/javase/downloads/index.html).
### GNU MCU Eclipse IDE
Now its finally time to install the IDE. Use the Release page [here](https://github.com/gnu-mcu-eclipse/org.eclipse.epp.packages/releases/) to get the latest version.
## Configuring Eclipse
Open up the Eclipse IDE we just downloaded. To import our QMK directory select File -> Import -> C/C++ -> Existing code as Makefile Project. Select next and use Browse to select your QMK folder. In the tool-chain list select ARM Cross GCC and select Finish.
Now you can see the QMK folder on the left hand side. Right click it and select Properties. On the left hand side, expand MCU and select ARM Toolchain Paths. Press xPack and OK. Repeat for OpenOCD Path and if you are on windows for Build Tool Path. Select Apply and Close.
Now its time to install the necessary MCU packages. Go to Packs perspective by selecting Window -> Open Perspective -> Others -> Packs. Now select the yellow refresh symbol next to the Packs tab. This will take a long time as it is requesting the MCU definitions from various places. If some of the links fail you can probably select Ignore.
When this finishes you must find the MCU which we will be building/debugging for. In this example I will be using the STM32F3 series MCUs. On the left, select STMicroelectonics -> STM32F3 Series. On the middle window we can see the pack. Right click and select Install. Once that is done we can go back to the default perspective, Window -> Open Perspective -> Others -> C/C++.
We need to let eclipse know the device we intent to build QMK on. Right click on the QMK folder -> Properties -> C/C++ Build -> Settings. Select the Devices tab and under devices select the appropriate variant of your MCU. For my example it is STM32F303CC
While we are here let's setup the build command as well. Select C/C++ Build and then the Behavior tab. On the build command, replace `all` with your necessary make command. For example for a rev6 Planck with the default keymap this would be `planck/rev6:default`. Select Apply and Close.
## Building
If you have setup everything correctly pressing the hammer button should build the firmware for you and a .bin file should appear.
## Debugging
### Connecting the Debugger
ARM MCUs use the Single Wire Debug (SWD) protocol which comprises of the clock (SWCLK) signal and the data (SWDIO) signal. Connecting this two wires and ground should be enough to allow full manipulation of the MCU. Here we assume that the keyboard will be powered though USB. The RESET signal is not necessary as we can manually assert it using the reset button. For a more advance setup, the SWO signal can be used which pipes printf and scanf asynchronously to the host but for our setup we will ignore it.
NOTE: Make sure the SWCLK and SWDIO pins are not used in the matrix of your keyboard. If they are you can temporarily switch them for some other pins.
### Configuring the Debugger
Right click on your QMK folder, select Debug As -> Debug Configuration. Here double click on GDB OpenOCD Debugging. Select the debugger tab and enter the configuration necessary for your MCU. This might take some fiddling and googleing to find out. The default script for the STM32F3 is called stm32f3discovery.cfg. To let OpenOCD know, in the Config options enter `-f board/stm32f3discovery.cfg`.
NOTE: In my case this configuration script requires editing to disable the reset assertion. The locations of the scripts can be found in the actual executable field usually under the path `openocd/version/.content/scripts/board`. Here I edited `reset_config srst_only` to `reset_config none`.
Select Apply and Close.
### Running the Debugger.
Reset your keyboard.
Press the bug icon and if all goes well you should soon find yourself in the debug perspective. Here the program counter will pause at the beginning of the main function and way for you to press Play. Most of the features of all debuggers work on ARM MCUs but for exact details google is your friend!
Happy debugging!

View file

@ -155,6 +155,10 @@ If you define these options you will enable the associated feature, which may in
going to produce the 500 keystrokes a second needed to actually get more than a
few ms of delay from this. But if you're doing chording on something with 3-4ms
scan times? You probably want this.
* `#define COMBO_COUNT 2`
* Set this to the number of combos that you're using in the [Combo](feature_combo.md) feature.
* `#define COMBO_TERM 200`
* how long for the Combo keys to be detected. Defaults to `TAPPING_TERM` if not defined.
## RGB Light Configuration
@ -234,6 +238,8 @@ Use these to enable or disable building certain features. The more you have enab
* Console for debug(+400)
* `COMMAND_ENABLE`
* Commands for debug and configuration
* `COMBO_ENABLE`
* Key combo feature
* `NKRO_ENABLE`
* USB N-Key Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
* `AUDIO_ENABLE`
@ -245,7 +251,9 @@ Use these to enable or disable building certain features. The more you have enab
* `UNICODE_ENABLE`
* Unicode
* `BLUETOOTH_ENABLE`
* Enable Bluetooth with the Adafruit EZ-Key HID
* Legacy option to Enable Bluetooth with the Adafruit EZ-Key HID. See BLUETOOTH
* `BLUETOOTH`
* Current options are AdafruitEzKey, AdafruitBLE, RN42
* `SPLIT_KEYBOARD`
* Enables split keyboard support (dual MCU like the let's split and bakingpy's boards) and includes all necessary files located at quantum/split_common
* `WAIT_FOR_USB`

View file

@ -57,14 +57,14 @@ Never made an open source contribution before? Wondering how contributions work
Most of our style is pretty easy to pick up on, but right now it's not entirely consistent. You should match the style of the code surrounding your change, but if that code is inconsistent or unclear use the following guidelines:
* We indent using two spaces (soft tabs)
* We use One True Brace Style
* We use a modified One True Brace Style
* Opening Brace: At the end of the same line as the statement that opens the block
* Closing Brace: Lined up with the first character of the statement that opens the block
* Else If: Place the closing brace at the beginning of the line and the next opening brace at the end of the same line.
* Optional Braces: Always include optional braces.
* Good: if (condition) { return false; }
* Bad: if (condition) return false;
* We use C style comments: `/* */`
* We encourage use of C style comments: `/* */`
* Think of them as a story describing the feature
* Use them liberally to explain why particular decisions were made.
* Do not write obvious comments
@ -72,6 +72,25 @@ Most of our style is pretty easy to pick up on, but right now it's not entirely
* In general we don't wrap lines, they can be as long as needed. If you do choose to wrap lines please do not wrap any wider than 76 columns.
* We use `#pragma once` at the start of header files rather than old-style include guards (`#ifndef THIS_FILE_H`, `#define THIS_FILE_H`, ..., `#endif`)
Here is an example for easy reference:
```c
/* Enums for foo */
enum foo_state {
FOO_BAR,
FOO_BAZ,
};
/* Returns a value */
int foo(void) {
if (some_condition) {
return FOO_BAR;
} else {
return -1;
}
}
```
# General Guidelines
We have a few different types of changes in QMK, each requiring a different level of rigor. We'd like you to keep the following guidelines in mind no matter what type of change you're making.

View file

@ -27,7 +27,7 @@ The first step to creating your own custom keycode(s) is to enumerate them. This
Here is an example of enumerating 2 keycodes. After adding this block to your `keymap.c` you will be able to use `FOO` and `BAR` inside your keymap.
```
```c
enum my_keycodes {
FOO = SAFE_RANGE,
BAR
@ -44,7 +44,7 @@ These function are called every time a key is pressed or released.
This example does two things. It defines the behavior for a custom keycode called `FOO`, and it supplements our Enter key by playing a tone whenever it is pressed.
```
```c
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case FOO:
@ -75,16 +75,16 @@ The `keycode` argument is whatever is defined in your keymap, eg `MO(1)`, `KC_L`
The `record` argument contains information about the actual press:
```
```c
keyrecord_t record {
+-keyevent_t event {
| +-keypos_t key {
| | +-uint8_t col
| | +-uint8_t row
| | }
| +-bool pressed
| +-uint16_t time
| }
keyevent_t event {
keypos_t key {
uint8_t col
uint8_t row
}
bool pressed
uint16_t time
}
}
```
@ -100,7 +100,7 @@ This allows you to control the 5 LED's defined as part of the USB Keyboard spec.
### Example `led_set_user()` Implementation
```
```c
void led_set_user(uint8_t usb_led) {
if (usb_led & (1<<USB_LED_NUM_LOCK)) {
PORTB |= (1<<0);
@ -117,12 +117,12 @@ void led_set_user(uint8_t usb_led) {
} else {
PORTB &= ~(1<<2);
}
if (usb_led & (1<<USB_LED_COMPOSE_LOCK)) {
if (usb_led & (1<<USB_LED_COMPOSE)) {
PORTB |= (1<<3);
} else {
PORTB &= ~(1<<3);
}
if (usb_led & (1<<USB_LED_KANA_LOCK)) {
if (usb_led & (1<<USB_LED_KANA)) {
PORTB |= (1<<4);
} else {
PORTB &= ~(1<<4);
@ -138,14 +138,14 @@ void led_set_user(uint8_t usb_led) {
# Matrix 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 LED's or i&#xb2;c controllers you will need to set up that hardware before it can be used.
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 LED's or i&#xb2;c controllers you will need to set up that hardware before it can be used.
### Example `matrix_init_user()` Implementation
This example, at the keyboard level, sets up B1, B2, and B3 as LED pins.
```
```c
void matrix_init_user(void) {
// Call the keymap level matrix init.
@ -181,16 +181,16 @@ You should use this function if you need custom matrix scanning code. It can als
# Keyboard Idling/Wake Code
If the board supports it, it can be "idled", by stopping a number of functions. A good example of this is RGB lights or backlights. This can save on power consumption, or may be better behavior for your keyboard.
If the board supports it, it can be "idled", by stopping a number of functions. A good example of this is RGB lights or backlights. This can save on power consumption, or may be better behavior for your keyboard.
This is controlled by two functions: `suspend_power_down_*` and `suspend_wakeup_init_*`, which are called when the system is board is idled and when it wakes up, respectively.
This is controlled by two functions: `suspend_power_down_*` and `suspend_wakeup_init_*`, which are called when the system is board is idled and when it wakes up, respectively.
### Example suspend_power_down_user() and suspend_wakeup_init_user() Implementation
This example, at the keyboard level, sets up B1, B2, and B3 as LED pins.
```
```c
void suspend_power_down_user(void)
{
rgb_matrix_set_suspend_state(true);
@ -210,13 +210,13 @@ void suspend_wakeup_init_user(void)
# Layer Change Code
This runs code every time that the layers get changed. This can be useful for layer indication, or custom layer handling.
This runs code every time that the layers get changed. This can be useful for layer indication, or custom layer handling.
### Example `layer_state_set_*` Implementation
This example shows how to set the [RGB Underglow](feature_rgblight.md) lights based on the layer, using the Planck as an example
```
```c
uint32_t layer_state_set_user(uint32_t state) {
switch (biton32(state)) {
case _RAISE:
@ -244,3 +244,143 @@ uint32_t layer_state_set_user(uint32_t state) {
* Keymap: `uint32_t layer_state_set_user(uint32_t state)`
The `state` is the bitmask of the active layers, as explained in the [Keymap Overview](keymap.md#keymap-layer-status)
# Persistent Configuration (EEPROM)
This allows you to configure persistent settings for your keyboard. These settings are stored in the EEPROM of your controller, and are retained even after power loss. The settings can be read with `eeconfig_read_kb` and `eeconfig_read_user`, and can be written to using `eeconfig_update_kb` and `eeconfig_update_user`. This is useful for features that you want to be able to toggle (like toggling rgb layer indication). Additionally, you can use `eeconfig_init_kb` and `eeconfig_init_user` to set the default values for the EEPROM.
The complicated part here, is that there are a bunch of ways that you can store and access data via EEPROM, and there is no "correct" way to do this. However, you only have a DWORD (4 bytes) for each function.
Keep in mind that EEPROM has a limited number of writes. While this is very high, it's not the only thing writing to the EEPROM, and if you write too often, you can potentially drastically shorten the life of your MCU.
* If you don't understand the example, then you may want to avoid using this feature, as it is rather complicated.
### 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!
In your keymap.c file, add this to the top:
```
typedef union {
uint32_t raw;
struct {
bool rgb_layer_change :1;
};
} user_config_t;
user_config_t user_config;
```
This sets up a 32 bit structure that we can store settings with in memory, and write to the EEPROM. Using this removes the need to define variables, since they're defined in this structure. Remember that `bool` (boolean) values use 1 bit, `uint8_t` uses 8 bits, `uint16_t` uses up 16 bits. You can mix and match, but changing the order can cause issues, as it will change the values that are read and written.
We're using `rgb_layer_change`, for the `layer_state_set_*` function, and use `matrix_init_user` and `process_record_user` to configure everything.
Now, using the `matrix_init_user` code above, you want to add `eeconfig_read_user()` to it, to populate the structure you've just created. And you can then immediately use this structure to control functionality in your keymap. And It should look like:
```
void matrix_init_user(void) {
// Call the keymap level matrix init.
// Read the user config from EEPROM
user_config.raw = eeconfig_read_user();
// Set default layer, if enabled
if (user_config.rgb_layer_change) {
rgblight_enable_noeeprom();
rgblight_sethsv_noeeprom_cyan();
rgblight_mode_noeeprom(1);
}
}
```
The above function will use the EEPROM config immediately after reading it, to set the default layer's RGB color. The "raw" value of it is converted in a usable structure based on the "union" that you created above.
```
uint32_t layer_state_set_user(uint32_t state) {
switch (biton32(state)) {
case _RAISE:
if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_magenta(); rgblight_mode_noeeprom(1); }
break;
case _LOWER:
if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_red(); rgblight_mode_noeeprom(1); }
break;
case _PLOVER:
if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_green(); rgblight_mode_noeeprom(1); }
break;
case _ADJUST:
if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_white(); rgblight_mode_noeeprom(1); }
break;
default: // for any other layers, or the default layer
if (user_config.rgb_layer_change) { rgblight_sethsv_noeeprom_cyan(); rgblight_mode_noeeprom(1); }
break;
}
return state;
}
```
This will cause the RGB underglow to be changed ONLY if the value was enabled. Now to configure this value, create a new keycode for `process_record_user` called `RGB_LYR` and `EPRM`. Additionally, we want to make sure that if you use the normal RGB codes, that it turns off Using the example above, make it look this:
```
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case FOO:
if (record->event.pressed) {
// Do something when pressed
} else {
// Do something else when release
}
return false; // Skip all further processing of this key
case KC_ENTER:
// Play a tone when enter is pressed
if (record->event.pressed) {
PLAY_NOTE_ARRAY(tone_qwerty);
}
return true; // Let QMK send the enter press/release events
case EPRM:
if (record->event.pressed) {
eeconfig_init(); // resets the EEPROM to default
}
return false;
case RGB_LYR: // This allows me to use underglow as layer indication, or as normal
if (record->event.pressed) {
user_config.rgb_layer_change ^= 1; // Toggles the status
eeconfig_update_user(user_config.raw); // Writes the new status to EEPROM
if (user_config.rgb_layer_change) { // if layer state indication is enabled,
layer_state_set(layer_state); // then immediately update the layer color
}
}
return false; break;
case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // For any of the RGB codes (see quantum_keycodes.h, L400 for reference)
if (record->event.pressed) { //This disables layer indication, as it's assumed that if you're changing this ... you want that disabled
if (user_config.rgb_layer_change) { // only if this is enabled
user_config.rgb_layer_change = false; // disable it, and
eeconfig_update_user(user_config.raw); // write the setings to EEPROM
}
}
return true; break;
default:
return true; // Process all other keycodes normally
}
}
```
And lastly, you want to add the `eeconfig_init_user` function, so that when the EEPROM is reset, you can specify default values, and even custom actions. For example, if you want to set rgb layer indication by default, and save the default valued.
```
void eeconfig_init_user(void) { // EEPROM is getting reset!
user_config.rgb_layer_change = true; // We want this enabled by default
eeconfig_update_user(user_config.raw); // Write default value to EEPROM now
// use the non noeeprom versions, to write these values to EEPROM too
rgblight_enable(); // Enable RGB by default
rgblight_sethsv_cyan(); // Set it to CYAN by default
rgblight_mode(1); // set to solid by default
}
```
And you're done. The RGB layer indication will only work if you want it to. And it will be saved, even after unplugging the board. And if you use any of the RGB codes, it will disable the layer indication, so that it stays on the mode and color that you set it to.
### 'EECONFIG' Function Documentation
* Keyboard/Revision: `void eeconfig_init_kb(void)`, `uint32_t eeconfig_read_kb(void)` and `void eeconfig_update_kb(uint32_t val)`
* Keymap: `void eeconfig_init_user(void)`, `uint32_t eeconfig_read_user(void)` and `void eeconfig_update_user(uint32_t val)`
The `val` is the value of the data that you want to write to EEPROM. And the `eeconfig_read_*` function return a 32 bit (DWORD) value from the EEPROM.

View file

@ -36,7 +36,7 @@ Make example for this keyboard (after setting up your build environment):
make planck/rev4:default
See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
```
There needs to be two spaces at the end of the `Keyboard Maintainer` and `Hardware Supported` lines for it to render correctly with Markdown.

View file

@ -17,7 +17,7 @@ or just:
Note that running `make` with `sudo` is generally *not* a good idea, and you should use one of the former methods, if possible.
## Linux `udev` Rules
### Linux `udev` Rules
On Linux, you'll need proper privileges to access the MCU. You can either use
`sudo` when flashing firmware, or place these files in `/etc/udev/rules.d/`.
@ -37,6 +37,14 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff0", MODE:="066
SUBSYSTEMS=="usb", ATTRS{idVendor}=="feed", MODE:="0666"
```
## Unknown Device for DFU Bootloader
If you're using Windows to flash your keyboard, and you are running into issues, check the Device Manager. If you see an "Unknown Device" when the keyboard is in "bootloader mode", then you may have a driver issue.
Re-running the installation script for MSYS2 may help (eg run `./util/qmk_install.sh` from MSYS2/WSL) or reinstalling the QMK Toolbox may fix the issue.
If that doesn't work, then you may need to grab the [Zadig Utility](https://zadig.akeo.ie/). Download this, find the device in question, and select the `WinUS(libusb-1.0)` option, and hit "Reinstall driver". Once you've done that, try flashing your board, again.
## WINAVR is Obsolete
It is no longer recommended and may cause some problem.
See [TMK Issue #99](https://github.com/tmk/tmk_keyboard/issues/99).
@ -97,10 +105,12 @@ The solution is to remove and reinstall all affected modules.
```
brew rm avr-gcc
brew rm dfu-programmer
brew rm dfu-util
brew rm gcc-arm-none-eabi
brew rm avrdude
brew install avr-gcc
brew install dfu-programmer
brew install dfu-util
brew install gcc-arm-none-eabi
brew install avrdude
```

View file

@ -2,7 +2,7 @@
Your keymap can include keycodes that are more advanced than normal, for example keys that switch layers or send modifiers when held, but send regular keycodes when tapped. This page documents the functions that are available to you.
### Assigning Custom Names
## Assigning Custom Names
People often define custom names using `#define`. For example:
@ -13,7 +13,7 @@ People often define custom names using `#define`. For example:
This will allow you to use `FN_CAPS` and `ALT_TAB` in your `KEYMAP()`, keeping it more readable.
### Caveats
## Caveats
Currently, `LT()` and `MT()` are limited to the [Basic Keycode set](keycodes_basic.md), meaning you can't use keycodes like `LCTL()`, `KC_TILD`, or anything greater than `0xFF`. Modifiers specified as part of a Layer Tap or Mod Tap's keycode will be ignored.
@ -26,7 +26,8 @@ These functions allow you to activate layers in various ways. Note that layers a
* `DF(layer)` - switches the default layer. The default layer is the always-active base layer that other layers stack on top of. See below for more about the default layer. This might be used to switch from QWERTY to Dvorak layout. (Note that this is a temporary switch that only persists until the keyboard loses power. To modify the default layer in a persistent way requires deeper customization, such as calling the `set_single_persistent_default_layer` function inside of [process_record_user](custom_quantum_functions.md#programming-the-behavior-of-any-keycode).)
* `MO(layer)` - momentarily activates *layer*. As soon as you let go of the key, the layer is deactivated.
* `LM(layer, mod)` - Momentarily activates *layer* (like `MO`), but with modifier(s) *mod* active. Only supports layers 0-15 and the left modifiers.
* `LT(layer, kc)` - momentarily activates *layer* when held, and sends *kc* when tapped.
* `LT(layer, kc)` - momentarily activates *layer* when held, and sends *kc* when tapped. Only supports layers 0-15.
* `OSL(layer)` - momentarily activates *layer* until the next key is pressed. See [One Shot Keys](#one-shot-keys) for details and additional functionality.
* `TG(layer)` - toggles *layer*, activating it if it's inactive and vice versa
* `TO(layer)` - activates *layer* and de-activates all other layers (except your default layer). This function is special, because instead of just adding/removing one layer to your active layer stack, it will completely replace your current active layers, uniquely allowing you to replace higher layers with a lower one. This is activated on keydown (as soon as the key is pressed).
* `TT(layer)` - Layer Tap-Toggle. If you hold the key down, *layer* is activated, and then is de-activated when you let go (like `MO`). If you repeatedly tap it, the layer will be toggled on or off (like `TG`). It needs 5 taps by default, but you can change this by defining `TAPPING_TOGGLE` -- for example, `#define TAPPING_TOGGLE 2` to toggle on just two taps.
@ -35,7 +36,7 @@ These functions allow you to activate layers in various ways. Note that layers a
Care must be taken when switching layers, it's possible to lock yourself into a layer with no way to deactivate that layer (without unplugging your keyboard.) We've created some guidelines to help users avoid the most common problems.
### Beginners
## Beginners
If you are just getting started with QMK you will want to keep everything simple. Follow these guidelines when setting up your layers:
@ -43,11 +44,11 @@ If you are just getting started with QMK you will want to keep everything simple
* Arrange your layers in a "tree" layout, with layer 0 as the root. Do not try to enter the same layer from more than one other layer.
* In a layer's keymap, only reference higher-numbered layers. Because layers are processed from the highest-numbered (topmost) active layer down, modifying the state of lower layers can be tricky and error-prone.
### Intermediate Users
## Intermediate Users
Sometimes you need more than one base layer. For example, if you want to switch between QWERTY and Dvorak, switch between layouts for different countries, or switch your layout for different videogames. Your base layers should always be the lowest numbered layers. When you have multiple base layers you should always treat them as mutually exclusive. When one base layer is on the others are off.
### Advanced Users
## Advanced Users
Once you have a good feel for how layers work and what you can do, you can get more creative. The rules listed in the beginner section will help you be successful by avoiding some of the tricker details but they can be constraining, especially for ultra-compact keyboard users. Understanding how layers work will allow you to use them in more advanced ways.
@ -125,6 +126,14 @@ For convenience, QMK includes some Mod-Tap shortcuts to make common combinations
|`SGUI_T(kc)`|`SCMD_T(kc)`, `SWIN_T(kc)` |Left Shift and GUI when held, `kc` when tapped |
|`LCA_T(kc)` | |Left Control and Alt when held, `kc` when tapped |
## Caveats
Unfortunately, these keycodes cannot be used in Mod-Taps or Layer-Taps, since any modifiers specified in the keycode are ignored.
Additionally, you may run into issues when using Remote Desktop Connection on Windows. Because these codes send shift very fast, Remote Desktop may miss the codes.
To fix this, open Remote Desktop Connection, click on "Show Options", open the the "Local Resources" tab. In the keyboard section, change the drop down to "On this Computer". This will fix the issue, and allow the characters to work correctly.
# One Shot Keys
One shot keys are keys that remain active until the next key is pressed, and then are released. This allows you to type keyboard combinations without pressing more than one key at a time. These keys are usually called "Sticky keys" or "Dead keys".
@ -145,7 +154,7 @@ You can control the behavior of one shot keys by defining these in `config.h`:
Sometimes, you want to activate a one-shot layer as part of a macro or tap dance routine. To do this, you need to call `set_oneshot_layer(LAYER, ONESHOT_START)` on key down, and `set_oneshot_layer(ONESHOT_PRESSED)` on key up. If you want to cancel the oneshot, call `reset_oneshot_layer()`. For more complicated actions, take a look at the oneshot implementation in [`process_record`](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/action.c#L429).
If you're having issues with OSM translating over Remote Desktop Connection, this can be fixed by opening the settings, going to the "Local Resources" tap, and in the keyboard section, change the drop down to "On this Computer". This will fix the issue and allow OSM to function properly over Remote Desktop.
If you're having issues with OSM translating over Remote Desktop Connection, this can be fixed by clicking on "Show Options", going to the "Local Resources" tab, and in the keyboard section, change the drop down to "On this Computer". This will fix the issue and allow OSM to function properly over Remote Desktop.
# Permissive Hold

View file

@ -119,22 +119,22 @@ You can completely disable Music Mode as well. This is useful, if you're pressed
#define NO_MUSIC_MODE
## Faux Click
## Audio Click
This adds a click sound each time you hit a button, to simulate click sounds from the keyboard. And the sounds are slightly different for each keypress, so it doesn't sound like a single long note, if you type rapidly.
* `CK_TOGG` - Toggles the status (will play sound if enabled)
* `CK_RST` - Resets the frequency to the default state
* `CK_UP` - Increases the frequency of the clicks
* `CK_DOWN` - Decreases the frequency of the clicks
* `CK_ON` - Turns on Audio Click (plays sound)
* `CK_OFF` - Turns off Audio Click (doesn't play sound)
* `CK_RST` - Resets the frequency to the default state (plays sound at default frequency)
* `CK_UP` - Increases the frequency of the clicks (plays sound at new frequency)
* `CK_DOWN` - Decreases the frequency of the clicks (plays sound at new frequency)
The feature is disabled by default, to save space. To enable it, add this to your `config.h`:
#define AUDIO_CLICKY
Additionally, even when enabled, the feature is not enabled by default, so you would need to turn it on first. And since we don't use EEPROM to store the setting (yet), you can default this to on by adding this to your `config.h`:
#define AUDIO_CLICKY_ON
You can configure the default, min and max frequencies, the stepping and built in randomness by defining these values:
@ -144,7 +144,7 @@ You can configure the default, min and max frequencies, the stepping and built i
| `AUDIO_CLICKY_FREQ_MIN` | 65.0f | Sets the lowest frequency (under 60f are a bit buggy). |
| `AUDIO_CLICKY_FREQ_MAX` | 1500.0f | Sets the the highest frequency. Too high may result in coworkers attacking you. |
| `AUDIO_CLICKY_FREQ_FACTOR` | 1.18921f| Sets the stepping of UP/DOWN key codes. |
| `AUDIO_CLICKY_FREQ_RANDOMNESS` | 0.05f | Sets a factor of randomness for the clicks, Setting this to `0f` will make each click identical. |
| `AUDIO_CLICKY_FREQ_RANDOMNESS` | 0.05f | Sets a factor of randomness for the clicks, Setting this to `0f` will make each click identical, and `1.0f` will make this sound much like the 90's computer screen scrolling/typing effect. |

View file

@ -61,7 +61,7 @@ In this handler, the value of an incrementing counter is mapped onto a precomput
|`backlight_increase()` |Increase the backlight level |
|`backlight_decrease()` |Decrease the backlight level |
|`backlight_level(x)` |Sets the backlight level to specified level |
|`get_backlight_level()`|Toggle backlight breathing |
|`get_backlight_level()`|Return the current backlight level |
### Backlight Breathing Functions

View file

@ -1,10 +1,40 @@
# Bluetooth
## Bluetooth Functionality
## Bluetooth Known Supported Hardware
Currently Bluetooth support is limited to AVR based chips. For Bluetooth 2.1 Qmk has support for RN-42 HID Firmware and Bluefruit EZ Key the later of which is not produced anymore. For more recent BLE protocols currently only the Adafruit Bluefruit SPI friend is directly supported. BLE is needed to connect to iOS devices. Note iOS does not support Mouse Input.
|Board |Bluetooth Protocol |Connection Type |Rules.mk |Bluetooth Chip|
|----------------------------------------------------------------|----------------------------|----------------|---------------------------|--------------|
|[Adafruit EzKey HID]("https://www.adafruit.com/product/1535") |Bluetooth Classic | UART | BLUETOOTH = AdafruitEZKey | |
|Rover Networks RN-42 (Sparkfun Bluesmirf) |Bluetooth Classic | UART | BLUETOOTH = RN42 | RN-42 |
|[Bluefruit LE SPI Friend](https://www.adafruit.com/product/2633)|Bluetooth Low Energy | SPI | BLUETOOTH = AdafruitBLE | nRF5182 |
Not Supported Yet but possible:
* [Bluefruit LE UART Friend](https://www.adafruit.com/product/2479). [Possible tmk implementation found in](https://github.com/tmk/tmk_keyboard/issues/514)
* HC-05 boards flashed with RN-42 firmware. They apparently both use the CSR BC417 Chip. Flashing it with RN-42 firmware gives it HID capability.
* [Sparkfun Bluetooth mate](https://www.sparkfun.com/products/14839)
* HM-13 based boards
### Adafruit BLE SPI Friend
Currently The only bluetooth chipset supported by QMK is the Adafruit Bluefruit SPI Friend. It's a Nordic nRF5182 based chip running Adafruit's custom firmware. Data is transmitted via Adafruit's SDEP over Hardware SPI. The [Feather 32u4 Bluefruit LE](https://www.adafruit.com/product/2829) is supported as it's an AVR mcu connected via SPI to the Nordic BLE chip with Adafruit firmware. If Building a custom board with the SPI friend it would be easiest to just use the pin selection that the 32u4 feather uses but you can change the pins in the config.h options with the following defines:
* #define AdafruitBleResetPin D4
* #define AdafruitBleCSPin B4
* #define AdafruitBleIRQPin E6
A Bluefruit UART friend can be converted to an SPI friend, however this [requires](https://github.com/qmk/qmk_firmware/issues/2274) some reflashing and soldering directly to the MDBT40 chip.
## Adafruit EZ-Key hid
This requires [some hardware changes](https://www.reddit.com/r/MechanicalKeyboards/comments/3psx0q/the_planck_keyboard_with_bluetooth_guide_and/?ref=search_posts), but can be enabled via the Makefile. The firmware will still output characters via USB, so be aware of this when charging via a computer. It would make sense to have a switch on the Bluefruit to turn it off at will.
<!-- FIXME: Document bluetooth support more completely. -->
## Bluetooth Rules.mk Options
Use only one of these
* BLUETOOTH_ENABLE = yes (Legacy Option)
* BLUETOOTH = RN42
* BLUETOOTH = AdafruitEZKey
* BLUETOOTH = AdafruitBLE
## Bluetooth Keycodes

88
docs/feature_combo.md Normal file
View file

@ -0,0 +1,88 @@
# Combos
The Combo feature is a chording type solution for adding custom actions. It lets you hit multiple keys at once and produce a different effect. For instance, hitting `A` and `S` within the tapping term would hit `ESC` instead, or have it perform even more complex tasks.
To enable this feature, yu need to add `COMBO_ENABLE = yes` to your `rules.mk`.
Additionally, in your `config.h`, you'll need to specify the number of combos that you'll be using, by adding `#define COMBO_COUNT 1` (replacing 1 with the number that you're using).
<!-- At this time, this is necessary -->
Also, by default, the tapping term for the Combos is set to the same value as `TAPPING_TERM` (200 by default on most boards). But you can specify a different value by defining it in your `config.h`. For instance: `#define COMBO_TERM 300` would set the time out period for combos to 300ms.
Then, your `keymap.c` file, you'll need to define a sequence of keys, terminated with `COMBO_END`, and a structure to list the combination of keys, and it's resulting action.
```c
const uint16_t PROGMEM test_combo[] = {KC_A, KC_B, COMBO_END};
combo_t key_combos[COMBO_COUNT] = {COMBO(test_combo, KC_ESC)};
```
This will send "Escape" if you hit the A and B keys.
!> This method only supports [basic keycodes](keycodes_basic.md). See the examples for more control.
## Examples
If you want to add a list, then you'd use something like this:
```c
enum combos {
AB_ESC,
JK_TAB
}
const uint16_t PROGMEM ab_combo[] = {KC_A, KC_B, COMBO_END};
const uint16_t PROGMEM jk_combo[] = {KC_J, KC_K, COMBO_END};
combo_t key_combos[COMBO_COUNT] = {
[AB_ESC] = COMBO(ab_combo, KC_ESC),
[JK_TAB] = COMBO(jk_combo, KC_TAB)
};
```
For a more complicated implementation, you can use the `process_combo_event` function to add custom handling.
```c
enum combo_events {
ZC_COPY,
ZV_PASTE
};
const uint16_t PROGMEM copy_combo[] = {KC_Z, KC_C, COMBO_END};
const uint16_t PROGMEM paste_combo[] = {KC_Z, KC_V, COMBO_END};
combo_t key_combos[COMBO_COUNT] = {
[ZC_COPY] = COMBO_ACTION(copy_combo),
[ZV_PASTE] = COMBO_ACTION(paste_combo),
};
void process_combo_event(uint8_t combo_index, bool pressed) {
switch(combo_index) {
case ZC_COPY:
if (pressed) {
register_code(KC_LCTL);
register_code(KC_C);
unregister_code(KC_C);
unregister_code(KC_LCTL);
}
break;
case ZV_PASTE:
if (pressed) {
register_code(KC_LCTL);
register_code(KC_V);
unregister_code(KC_V);
unregister_code(KC_LCTL);
}
break;
}
}
```
This will send Ctrl+C if you hit Z and C, and Ctrl+V if you hit Z and V. But you could change this to do stuff like change layers, play sounds, or change settings.
## Additional Configuration
If you're using long combos, or even longer combos, you may run into issues with this, as the structure may not be large enough to accommodate what you're doing.
In this case, you can add either `#define EXTRA_LONG_COMBOS` or `#define EXTRA_EXTRA_LONG_COMBOS` in your `config.h` file.
You may also be able to enable action keys by defining `COMBO_ALLOW_ACTION_KEYS`.

48
docs/feature_encoders.md Normal file
View file

@ -0,0 +1,48 @@
# Encoders
Basic encoders are supported by adding this to your `rules.mk`:
ENCODER_ENABLE = yes
and this to your `config.h`:
#define NUMBER_OF_ENCODERS 1
#define ENCODERS_PAD_A { B12 }
#define ENCODERS_PAD_B { B13 }
Each PAD_A/B variable defines an array so multiple encoders can be defined, e.g.:
#define ENCODERS_PAD_A { encoder1a, encoder2a }
#define ENCODERS_PAD_B { encoder1a, encoder2b }
If your encoder's clockwise directions are incorrect, you can swap the A & B pad definitions.
Additionally, the resolution can be specified in the same file (the default & suggested is 4):
#define ENCODER_RESOLUTION 4
## Callbacks
The callback functions can be inserted into your `<keyboard>.c`:
void encoder_update_kb(uint8_t index, bool clockwise) {
encoder_update_user(index, clockwise);
}
or `keymap.c`:
void encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (clockwise) {
register_code(KC_PGDN);
unregister_code(KC_PGDN);
} else {
register_code(KC_PGUP);
unregister_code(KC_PGUP);
}
}
}
## Hardware
The A an B lines of the encoders should be wired directly to the MCU, and the C/common lines should be wired to ground.

View file

@ -228,6 +228,10 @@ This sends the `<kc>` keydown event to the computer. Some examples would be `KC_
Parallel to `register_code` function, this sends the `<kc>` keyup event to the computer. If you don't use this, the key will be held down until it's sent.
### `tap_code(<kc>);`
This will send `register_code(<kc>)` and then `unregister_code(<kc>)`. This is useful if you want to send both the press and release events ("tap" the key, rather than hold it).
### `clear_keyboard();`
This will clear all mods and keys currently pressed.

View file

@ -6,6 +6,24 @@ To hook up a Trackpoint, you need to obtain a Trackpoint module (i.e. harvest fr
There are three available modes for hooking up PS/2 devices: USART (best), interrupts (better) or busywait (not recommended).
### The Cirtuitry between Trackpoint and Controller
To get the things working, a 4.7K drag is needed between the two lines DATA and CLK and the line 5+.
```
DATA ----------+--------- PIN
|
4.7K
|
MODULE 5+ --------+--+--------- PWR CONTROLLER
|
4.7K
|
CLK ------+------------ PIN
```
### Busywait Version
Note: This is not recommended, you may encounter jerky movement or unsent inputs. Please use interrupt or USART version if possible.

View file

@ -140,6 +140,7 @@ These are the effects that are currently available:
RGB_MATRIX_RAINBOW_PINWHEELS,
RGB_MATRIX_RAINBOW_MOVING_CHEVRON,
RGB_MATRIX_JELLYBEAN_RAINDROPS,
RGB_MATRIX_DIGITAL_RAIN,
#ifdef RGB_MATRIX_KEYPRESSES
RGB_MATRIX_SOLID_REACTIVE,
RGB_MATRIX_SPLASH,

View file

@ -96,9 +96,10 @@ if `RGBLIGHT_EFFECT_xxxx` or `RGBLIGHT_ANIMATIONS` is defined, you also have a n
|`RGBLIGHT_MODE_RGB_TEST` | *None* |RGB Test |
|`RGBLIGHT_MODE_ALTERNATING` | *None* |Alternating |
Check out [this video](https://youtube.com/watch?v=VKrpPAHlisY) for a demonstration.
Note: For versions older than 0.6.117, The mode numbers were written directly. In `quantum/rgblight.h` there is a contrast table between the old mode number and the current symbol.
The following options can be used to tweak the various animations:
|Define |Default |Description |

View file

@ -4,40 +4,108 @@ There are three Unicode keymap definition method available in QMK:
## UNICODE_ENABLE
Supports Unicode input up to 0xFFFF. The keycode function is `UC(n)` in
keymap file, where *n* is a 4 digit hexadecimal.
Supports Unicode input up to 0xFFFF. The keycode function is `UC(n)` in keymap file, where *n* is a 4 digit hexadecimal.
## UNICODEMAP_ENABLE
Supports Unicode up to 0xFFFFFFFF. You need to maintain a separate mapping
table `const uint32_t PROGMEM unicode_map[] = {...}` in your keymap file.
The keycode function is `X(n)` where *n* is the array index of the mapping
table.
Supports Unicode up to 0xFFFFFFFF. You need to maintain a separate mapping table `const uint32_t PROGMEM unicode_map[] = {...}` in your keymap file. The keycode function is `X(n)` where *n* is the array index of the mapping table.
And you may want to have an enum to make reference easier. So you'd want to add something like this to your keymap:
```c
enum unicode_name {
BANG, // ‽
IRONY, // ⸮
SNEK // snke 🐍
};
const uint32_t PROGMEM unicode_map[] = {
[BANG] = 0x0203D, // ‽
[IRONY] = 0x02E2E, // ⸮
[SNEK] = 0x1F40D // snke 🐍
}:
```
Make sure that the order for both matches.
## UCIS_ENABLE
TBD
Supports Unicode up to 0xFFFFFFFF. As with `UNICODE_MAP`, you may want to main a mapping table in your keymap file. However, there is no keycodes for this feature, you will have to add a keycode or function to call `qk_ucis_start()`. Once you've run that, you can just type the text for your unicode, and then hit space or enter to complete it, or ESC to cancel it. And if it matches an entry in your table, it will automatically "backspace" the trigger word (from your table) and then will input the unicode sequence.
Unicode input in QMK works by inputing a sequence of characters to the OS,
sort of like macro. Unfortunately, each OS has different ideas on how Unicode is inputted.
For instance, you would need to have a table like this in your keymap:
```c
const qk_ucis_symbol_t ucis_symbol_table[] = UCIS_TABLE
(
UCIS_SYM("poop", 0x1f4a9),
UCIS_SYM("rofl", 0x1f923),
UCIS_SYM("kiss", 0x1f619)
);
```
You run the function, and then type "rofl" and hit enter, it should backspace remove "rofl" and input the `0x1f923` unicode.
### Customization
There are several functions that you can add to your keymap to customize the functionality of this feature.
* `void qk_ucis_start_user(void)` - This runs when you run the "start" function, and can be used to provide feedback. By default, it types out a keyboard emoji.
* `void qk_ucis_success(uint8_t symbol_index)` - This runs when the unicode input has matched something, and has completed. Default doesn't do anything.
* `void qk_ucis_symbol_fallback (void)` - This runs if the input text doesn't match anything. The default function falls back to trying that input as a unicode code.
The default code for these are:
```c
void qk_ucis_start_user(void) { // outputs keyboard emoji
unicode_input_start();
register_hex(0x2328);
unicode_input_finish();
}
void qk_ucis_success(uint8_t symbol_index) {
}
void qk_ucis_symbol_fallback (void) { // falls back to manual unicode entry
for (uint8_t i = 0; i < qk_ucis_state.count - 1; i++) {
uint8_t code = qk_ucis_state.codes[i];
register_code(code);
unregister_code(code);
wait_ms(UNICODE_TYPE_DELAY);
}
}
```
## Unicode Input methods
Unicode input in QMK works by inputting a sequence of characters to the OS,
sort of like macro. Unfortunately, each OS has different ideas on how Unicode is input.
This is the current list of Unicode input method in QMK:
* UC_OSX: MacOS Unicode Hex Input support. Works only up to 0xFFFF. Disabled by default. To enable: go to System Preferences -> Keyboard -> Input Sources, and enable Unicode Hex.
* UC_OSX_RALT: Same as UC_OSX, but sends the Right Alt key for unicode input
* UC_LNX: Unicode input method under Linux. Works up to 0xFFFFF. Should work almost anywhere on ibus enabled distros. Without ibus, this works under GTK apps, but rarely anywhere else.
* UC_WIN: (not recommended) Windows built-in Unicode input. To enable: create registry key under `HKEY_CURRENT_USER\Control Panel\Input Method\EnableHexNumpad` of type `REG_SZ` called `EnableHexNumpad`, set its value to 1, and reboot. This method is not recommended because of reliability and compatibility issue, use WinCompose method below instead.
* UC_WINC: Windows Unicode input using WinCompose. Requires [WinCompose](https://github.com/samhocevar/wincompose). Works reliably under many (all?) variations of Windows.
* __UC_OSX__: MacOS Unicode Hex Input support. Works only up to 0xFFFF. Disabled by default. To enable: go to System Preferences -> Keyboard -> Input Sources, and enable Unicode Hex.
* __UC_OSX_RALT__: Same as UC_OSX, but sends the Right Alt key for unicode input
* __UC_LNX__: Unicode input method under Linux. Works up to 0xFFFFF. Should work almost anywhere on ibus enabled distros. Without ibus, this works under GTK apps, but rarely anywhere else.
* __UC_WIN__: (not recommended) Windows built-in Unicode input. To enable: create registry key under `HKEY_CURRENT_USER\Control Panel\Input Method\EnableHexNumpad` of type `REG_SZ` called `EnableHexNumpad`, set its value to 1, and reboot. This method is not recommended because of reliability and compatibility issue, use WinCompose method below instead.
* __UC_WINC__: Windows Unicode input using WinCompose. Requires [WinCompose](https://github.com/samhocevar/wincompose). Works reliably under many (all?) variations of Windows.
# Additional Language Support
At some point, you need to call `set_unicode_input_mode(x)` to set the correct unicode method. This sets the method that is used to send the unicode, and stores it in EEPROM, so you only need to call this once.
## `send_unicode_hex_string`
To type multiple characters for things like (ノಠ痊ಠ)ノ彡┻━┻, you can use `send_unicode_hex_string()` much like `SEND_STRING()` except you would use hex values separate by spaces.
For example, the table flip seen above would be `send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B")`
There are many ways to get a hex code, but an easy one is [this site](https://r12a.github.io/app-conversion/). Just make sure to convert to hexadecimal, and that is your string.
## Additional Language Support
In `quantum/keymap_extras/`, you'll see various language files - these work the same way as the alternative layout ones do. Most are defined by their two letter country/language code followed by an underscore and a 4-letter abbreviation of its name. `FR_UGRV` which will result in a `ù` when using a software-implemented AZERTY layout. It's currently difficult to send such characters in just the firmware.
# International Characters on Windows
## International Characters on Windows
[AutoHotkey](https://autohotkey.com) allows Windows users to create custom hotkeys among others.
### AutoHotkey allows Windows users to create custom hotkeys among others.
The method does not require Unicode support in the keyboard itself but depends instead of AutoHotkey running in the background.
The method does not require Unicode support in the keyboard itself but depends instead of [AutoHotkey](https://autohotkey.com) running in the background.
First you need to select a modifier combination that is not in use by any of your programs.
CtrlAltWin is not used very widely and should therefore be perfect for this.
@ -52,3 +120,11 @@ In the default script of AutoHotkey you can define custom hotkeys.
The hotkeys above are for the combination CtrlAltGui and CtrlAltGuiShift plus the letter a.
AutoHotkey inserts the Text right of `Send, ` when this combination is pressed.
### US International
If you enable the US International layout on the system, it will use punctuation to accent the characters.
For instance, typing "`a" will result in à.
You can find details on how to enable this [here](https://support.microsoft.com/en-us/help/17424/windows-change-keyboard-layout).

View file

@ -5,15 +5,12 @@ If you use more than one keyboard with a similar keymap, you might see the benef
* `/users/<name>/` (added to the path automatically)
* `readme.md` (optional, recommended)
* `rules.mk` (included automatically)
* `config.h` (included automatically)
* `<name>.h` (optional)
* `<name>.c` (optional)
* `config.h` (optional)
* `cool_rgb_stuff.c` (optional)
* `cool_rgb_stuff.h` (optional)
`<name>.c` will need to be added to the SRC in `rules.mk` like this:
SRC += <name>.c
Additional files may be added in the same way - it's recommended you have one named `<name>`.c/.h though.
All this only happens when you build a keymap named `<name>`, like this:
@ -23,82 +20,179 @@ For example,
make planck:jack
Will include the `/users/jack/` folder in the path, along with `/users/jack/rules.mk`.
Will include the `/users/jack/` folder in the path, along with `/users/jack/rules.mk`.
!> This `name` can be [overridden](#override-default-userspace), if needed.
## `Rules.mk`
The `rules.mk` is one of the two files that gets processed automatically. This is how you add additional source files (such as `<name>.c`) will be added when compiling.
It's highly recommended that you use `<name>.c` as the default source file to be added. And to add it, you need to add it the SRC in `rules.mk` like this:
SRC += <name>.c
Additional files may be added in the same way - it's recommended you have one named `<name>`.c/.h to start off with, though.
The `/users/<name>/rules.mk` file will be included in the build _after_ the `rules.mk` from your keymap. This allows you to have features in your userspace `rules.mk` that depend on individual QMK features that may or may not be available on a specific keyboard.
For example, if you have RGB control features shared between all your keyboards that support RGB lighting, you can add support for that if the RGBLIGHT feature is enabled:
```make
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
# Include my fancy rgb functions source here
SRC += cool_rgb_stuff.c
endif
```
Alternatively, you can `define RGB_ENABLE` in your keymap's `rules.mk` and then check for the variable in your userspace's `rules.mk` like this:
```make
ifdef RGB_ENABLE
# Include my fancy rgb functions source here
SRC += cool_rgb_stuff.c
endif
```
### Override default userspace
By default the userspace used will be the same as the keymap name. In some situations this isn't desirable. For instance, if you use the [layout](feature_layouts.md) feature you can't use the same name for different keymaps (e.g. ANSI and ISO). You can name your layouts `mylayout-ansi` and `mylayout-iso` and add the following line to your layout's `rules.mk`:
```
USER_NAME := mylayout
```
This is also useful if you have multiple different keyboards with different features physically present on the board (such as one with RGB Lights, and one with Audio, or different number of LEDs, or connected to a different PIN on the controller).
## Configuration Options (`config.h`)
Additionally, `config.h` here will be processed like the same file in your keymap folder. This is handled separately from the `<name>.h` file.
The reason for this, is that `<name>.h` won't be added in time to add settings (such as `#define TAPPING_TERM 100`), and including the `<name.h>` file in any `config.h` files will result in compile issues.
So you should use the `config.h` for QMK settings, and the `<name>.h` file for user or keymap specific settings.
!>You should use the `config.h` for [configuration options](config_options.md), and the `<name>.h` file for user or keymap specific settings (such as the enum for layer or keycodes)
`/users/<name>/rules.mk` will be included in the build _after_ the `rules.mk` from your keymap. This allows you to have features in your userspace `rules.mk` that depend on individual QMK features that may or may not be available on a specific keyboard. For example, if you have RGB control features shared between all your keyboards that support RGB lighting, you can `define RGB_ENABLE` in your keymap `rules.mk` and then check for the variable in your userspace `rules.mk` like this:
```make
ifdef RGB_ENABLE
# Include my fancy rgb functions source here
endif
```
Because of this, any time you turn on QMK features in your `users/<name>/rules.mk`, you should conditionally enable them only if the flag isn't already defined, like this:
```make
ifndef TAP_DANCE_ENABLE
TAP_DANCE_ENABLE = yes
endif
```
This will ensure that you can explicitly turn off features for an individual keymap.
## Readme
## Readme (`readme.md`)
Please include authorship (your name, github username, email), and optionally [a license that's GPL compatible](https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses).
## `Config.h`
You can use this as a template:
```
Copyright <year> <name> <email> @<github_username>
If you do add a `config,h` file, you want to make sure that it only gets processed once. So you may want to start off with something like this:
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.
```c
#ifndef USERSPACE_CONFIG_H
#define USERSPACE_CONFIG_H
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.
// Put normal config.h settings here:
#endif // !USERSPACE_CONFIG_H
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
```
You can use any option hre that you could use in your keymap's `config.h` file. You can find a list of vales [here](config_options.md).
You'd want to replace the year, name, email and github username with your info.
## Example
Additionally, this is a good place to document your code, if you wish to share it with others.
For a brief example, checkout `/users/_example/` , or for a more detailed examples check out [`template.h`](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/template.h) and [`template.c`](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/template.c) in `/users/drashna/` .
# Examples
### Consolidated Macros
For a brief example, checkout [`/users/_example/`](https://github.com/qmk/qmk_firmware/tree/master/users/drashna).
For a more complicated example, checkout [`/users/drashna/`](https://github.com/qmk/qmk_firmware/tree/master/users/drashna)'s userspace.
If you wanted to consolidate macros and other functions into your userspace for all of your keymaps, you can do that. The issue is that you then cannot call any function defined in your userspace, or it gets complicated. To better handle this, you can call the functions here and create new functions to use in individual keymaps.
## Customized Functions
QMK has a bunch of [functions](custom_quantum_functions.md) that have [`_quantum`, `_kb`, and `_user` versions](custom_quantum_functions.md#a-word-on-core-vs-keyboards-vs-keymap) that you can use. You will pretty much always want to use the user version of these functions. But the problem is that if you use them in your userspace, then you don't have a version that you can use in your keymap.
However, you can actually add support for keymap version, so that you can use it in both your userspace and your keymap!
For instance, lets looks at the `layer_state_set_user` function. Lets enable the [Tri Layer State](ref_functions.md#olkb-tri-layers) functionalitly to all of our boards, and then still have your `keymap.c` still able to use this functionality.
In your `<name.c>` file, you'd want to add this:
```c
__attribute__ ((weak))
uint32_t layer_state_set_keymap (uint32_t state) {
return state;
}
uint32_t layer_state_set_user (uint32_t state) {
state = update_tri_layer_state(state, 2, 3, 5);
return layer_state_set_keymap (state);
}
```
The `__attribute__ ((weak))` part tells the compiler that this is a placeholder function that can then be replaced by a version in your `keymap.c`. That way, you don't need to add it to your `keymap.c`, but if you do, you won't get any conflicts because the function is the same name.
The `_keymap` part here doesn't matter, it just needs to be something other than `_quantum`, `_kb`, or `_user`, since those are already in use. So you could use `layer_state_set_mine`, `layer_state_set_fn`, or anything else.
You can see a list of this and other common functions in [`template.c`](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/template.c) in [`users/drashna`](https://github.com/qmk/qmk_firmware/tree/master/users/drashna).
## Custom Features
Since the Userspace feature can support a staggering number of boards, you may have boards that you want to enable certain functionality for, but not for others. And you can actually create "features" that you can enable or disable in your own userspace.
For instance, if you wanted to have a bunch of macros available, but only on certain boards (to save space), you could "hide" them being a `#ifdef MACROS_ENABLED`, and then enable it per board. To do this, add this to your rules.mk
```make
ifeq ($(strip $(MACROS_ENABLED)), yes)
OPT_DEFS += -DMACROS_ENABLED
endif
```
The `OPT_DEFS` setting causes `MACROS_ENABLED` to be defined for your keyboards (note the `-D` in front of the name), and you could use `#ifdef MACROS_ENABLED` to check the status in your c/h files, and handle that code based on that.
Then you add `MACROS_ENABLED = yes` to the `rules.mk` for you keymap to enable this feature and the code in your userspace.
And in your `process_record_user` function, you'd do something like this:
```c
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
#ifdef MACROS_ENABLED
case MACRO1:
if (!record->event.pressed) {
SEND_STRING("This is macro 1!");
}
break;
case MACRO2:
if (!record->event.pressed) {
SEND_STRING("This is macro 2!");
}
break;
#endif
}
return true;
}
```
## Consolidated Macros
If you wanted to consolidate macros and other functions into your userspace for all of your keymaps, you can do that. This builds upon the [Customized Functions](#customized-functions) example above. This lets you maintain a bunch of macros that are shared between the different keyboards, and allow for keyboard specific macros, too.
First, you'd want to go through all of your `keymap.c` files and replace `process_record_user` with `process_record_keymap` instead. This way, you can still use keyboard specific codes on those boards, and use your custom "global" keycodes as well. You'll also want to replace `SAFE_RANGE` with `NEW_SAFE_RANGE` so that you wont have any overlapping keycodes
Then add `#include <name.h>` to all of your keymap.c files. This allows you to use these new keycodes without having to redefine them in each keymap.
Once you've done that, you'll want to set the keycode definitions that you need to the `<name>.h` file. For instance:
```
#ifndef USERSPACE
#define USERSPACE
```c
#pragma once
#include "quantum.h"
#include "action.h"
#include "version.h"
// Define all of
enum custom_keycodes {
KC_MAKE = SAFE_RANGE,
NEW_SAFE_RANGE //use "NEW_SAFE_RANGE" for keymap specific codes
};
#endif
```
Now you want to create the `<name>.c` file, and add this content to it:
```
```c
#include "<name>.h"
#include "quantum.h"
#include "action.h"
#include "version.h"
__attribute__ ((weak))
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
@ -126,14 +220,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
```
This will add a new `KC_MAKE` keycode that can be used in any of your keymaps. And this keycode will output `make <keyboard>:<keymap">`, making frequent compiling easier. And this will work with any keyboard and any keymap as it will output the current boards info, so that you don't have to type this out every time.
This will add a new `KC_MAKE` keycode that can be used in any of your keymaps. And this keycode will output `make <keyboard>:<keymap>`, making frequent compiling easier. And this will work with any keyboard and any keymap as it will output the current boards info, so that you don't have to type this out every time.
Additionally, this should flash the newly compiled firmware automatically, using the correct utility, based on the bootloader settings (or default to just generating the HEX file). However, it should be noted that this may not work on all systems. AVRDUDE doesn't work on WSL, namely (and will dump the HEX in the ".build" folder instead).
## Override default userspace
By default the userspace used will be the same as the keymap name. In some situations this isn't desirable. For instance, if you use the [layout](feature_layouts.md) feature you can't use the same name for different keymaps (e.g. ANSI and ISO). You can name your layouts `mylayout-ansi` and `mylayout-iso` and add the following line to your layout's `rules.mk`:
```
USER_NAME := mylayout
```

View file

@ -2,7 +2,7 @@
There are quite a few different types of bootloaders that keyboards use, and just about all of the use a different flashing method. Luckily, projects like the [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) aim to be compatible with all the different types without having to think about it much, but this article will describe the different types of bootloaders, and available methods for flashing them.
If you have a bootloader selected with the `BOOTLOADER` variable in your `rules.mk`, QMK will automatically calculate if your .hex file is the right size to be flashed to the device, and output the total size it bytes (along with the max). To run this process manually, compile with the target `check-size`, eg `make planck/rev4:default:check-size`.
If you have a bootloader selected with the `BOOTLOADER` variable in your `rules.mk`, QMK will automatically calculate if your .hex file is the right size to be flashed to the device, and output the total size in bytes (along with the max). To run this process manually, compile with the target `check-size`, eg `make planck/rev4:default:check-size`.
## DFU
@ -78,6 +78,12 @@ or
make <keyboard>:<keymap>:avrdude
or if you want to flash multiple boards, use the following command
make <keyboard>:<keymap>:avrdude-loop
When you're done flashing boards, you'll need to hit Ctrl + C or whatever the correct keystroke is for your operating system to break the loop.
## Halfkay
Halfkay is a super-slim protocol developed by PJRC that uses HID, and come on all Teensys (namely the 2.0).

View file

@ -8,7 +8,7 @@ Note: If it is your first time here, Check out the "Complete Newbs guide" instea
## Linux
To ensure you are always up to date, you can just run `sudo util/install_dependencies.sh`. That should always install all the dependencies needed. **This will run `apt-get upgrade`.**
To ensure you are always up to date, you can just run `sudo util/qmk_install.sh`. That should always install all the dependencies needed. **This will run `apt-get upgrade`.**
You can also install things manually, but this documentation might not be always up to date with all requirements.
@ -58,10 +58,11 @@ If you're using [homebrew,](http://brew.sh/) you can use the following commands:
brew update
brew install avr-gcc@7
brew install dfu-programmer
brew install dfu-util
brew install gcc-arm-none-eabi
brew install avrdude
This is the recommended method. If you don't have homebrew, [install it!](http://brew.sh/) It's very much worth it for anyone who works in the command line. Note that the `make` and `make install` portion during the homebrew installation of avr-libc can take over 20 minutes and exhibit high CPU usage.
This is the recommended method. If you don't have homebrew, [install it!](http://brew.sh/) It's very much worth it for anyone who works in the command line. Note that the `make` and `make install` portion during the homebrew installation of `avr-gcc@7` can take over 20 minutes and exhibit high CPU usage.
## Windows with msys2 (recommended)
@ -69,9 +70,9 @@ The best environment to use, for Windows Vista through any later version (tested
* Install msys2 by downloading it and following the instructions here: http://www.msys2.org
* Open the ``MSYS2 MingGW 64-bit`` shortcut
* Navigate to your qmk checkout. For example, if it's in the root of your c drive:
* Navigate to your QMK repository. For example, if it's in the root of your c drive:
* `$ cd /c/qmk_firmware`
* Run `util/msys2_install.sh` and follow the prompts
* Run `util/qmk_install.sh` and follow the prompts
## Windows 10 (deprecated)
These are the old instructions for Windows 10. We recommend you use [MSYS2 as outlined above](#windows-with-msys2-recommended).

View file

@ -8,7 +8,7 @@ Start on the [QMK Github page](https://github.com/qmk/qmk_firmware), and you'll
![Fork on Github](http://i.imgur.com/8Toomz4.jpg)
If you're apart of an organization, you'll need to choose which account to fork it to. In most circumstances, you'll want to fork it to your personal account. Once your fork is completed (sometimes this takes a little while), click the "Clone or Download" button:
If you're a part of an organization, you'll need to choose which account to fork it to. In most circumstances, you'll want to fork it to your personal account. Once your fork is completed (sometimes this takes a little while), click the "Clone or Download" button:
![Download from Github](http://i.imgur.com/N1NYcSz.jpg)

View file

@ -8,7 +8,7 @@ If you have not yet you should read the [Keyboard Guidelines](hardware_keyboard_
QMK has a number of features to simplify working with AVR keyboards. For most keyboards you don't have to write a single line of code. To get started run the `util/new_project.sh` script:
```
```bash
$ util/new_project.sh my_awesome_keyboard
######################################################
# /keyboards/my_awesome_keyboard project created. To start
@ -30,7 +30,7 @@ This is where all the custom logic for your keyboard goes. Many keyboards do not
This is the file you define your [Layout Macro(s)](feature_layouts.md) in. At minimum you should have a `#define LAYOUT` for your keyboard that looks something like this:
```
```c
#define LAYOUT( \
k00, k01, k02, \
k10, k11 \
@ -57,7 +57,7 @@ At the top of the `config.h` you'll find USB related settings. These control how
Do change the `MANUFACTURER`, `PRODUCT`, and `DESCRIPTION` lines to accurately reflect your keyboard.
```
```c
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
@ -66,20 +66,20 @@ Do change the `MANUFACTURER`, `PRODUCT`, and `DESCRIPTION` lines to accurately r
#define DESCRIPTION A custom keyboard
```
?> Note: On Windows and macOS the `MANUFACTURER`, `PRODUCT`, and `DESCRIPTION` fields will be displayed in the list of USB devices. On Linux these values will not be visible in `lsusb`, since Linux takes that information from the list published by the USB-IF.
?> Note: On Windows and macOS the `MANUFACTURER`, `PRODUCT`, and `DESCRIPTION` fields will be displayed in the list of USB devices. ?> On Linux these values will not be visible in lsusb by default, since Linux takes the information from the list maintained by [USB ID Repository](http://www.linux-usb.org/usb-ids.html) by default. lsusb will show the information reported by the device when executed with -v option. It is also present in kernel logs after plugging in the device.
### Keyboard Matrix Configuration
The next section of the `config.h` file deals with your keyboard's matrix. The first thing you should set is the matrix's size. This is usually, but not always, the same number of rows and columns as the physical key arrangement.
```
```c
#define MATRIX_ROWS 2
#define MATRIX_COLS 3
```
Once you've defined the size of your matrix you need to define which pins on your MCU are connected to rows and columns. To do so simply specify the names of those pins:
```
```c
#define MATRIX_ROW_PINS { D0, D5 }
#define MATRIX_COL_PINS { F1, F0, B0 }
#define UNUSED_PINS
@ -89,7 +89,7 @@ The number of `MATRIX_ROW_PINS` entries must be the same as the number you assig
Finally, you can specify the direction your diodes point. This can be `COL2ROW`, `ROW2COL`, or `CUSTOM_MATRIX`.
```
```c
#define DIODE_DIRECTION COL2ROW
```
@ -97,16 +97,14 @@ Finally, you can specify the direction your diodes point. This can be `COL2ROW`,
By default QMK supports backlighting on pins `B5`, `B6`, and `B7`. If you are using one of those you can simply enable it here. For more details see the [Backlight Documentation](feature_backlight.md).
```
```c
#define BACKLIGHT_PIN B7
#define BACKLIGHT_LEVELS 3
#define BACKLIGHT_BREATHING
#define BREATHING_PERIOD 6
```
{% hint style='info' %}
You can use backlighting on any pin you like, but you will have to do more work to support that. See the [Backlight Documentation](feature_backlight.md) for more details.
{% endhint %}
?> You can use backlighting on any pin you like, but you will have to do more work to support that. See the [Backlight Documentation](feature_backlight.md) for more details.
### Other Configuration Options
@ -120,7 +118,7 @@ You use the `rules.mk` file to tell QMK what files to build and what features to
These options tell the build system what CPU to build for. Be very careful if you change any of these settings, you can render your keyboard inoperable.
```
```make
MCU = atmega32u4
F_CPU = 16000000
ARCH = AVR8
@ -128,26 +126,26 @@ F_USB = $(F_CPU)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
```
### Bootloader Size
### Bootloaders
The bootloader is a special section of your MCU that allows you to upgrade the code stored on the MCU. Think of it like a Rescue Partition for your keyboard. If you are using a teensy 2.0, or a device like the Ergodox EZ that uses the teensy bootloader you should set this to `512`. Most other bootloaders should be set to `4096`, but `1024` and `2048` are other possible values you may encounter.
The bootloader is a special section of your MCU that allows you to upgrade the code stored on the MCU. Think of it like a Rescue Partition for your keyboard.
#### Teensy 2.0 Bootloader Example
#### Teensy Bootloader Example
```
OPT_DEFS += -DBOOTLOADER_SIZE=512
```
#### Teensy 2.0++ Bootloader Example
```
OPT_DEFS += -DBOOTLOADER_SIZE=1024
```make
BOOTLOADER = halfkay
```
#### Atmel DFU Loader Example
```make
BOOTLOADER = atmel-dfu
```
OPT_DEFS += -DBOOTLOADER_SIZE=4096
#### Pro Micro Bootloader Example
```make
BOOTLOADER = caterina
```
### Build Options

View file

@ -27,17 +27,17 @@ This usually happens with a periodic scan of key presses. This speed often is li
## 2. What the Firmware Sends
The [HID specification](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf) tells what a keyboard can actually send through USB to have a chance to be properly recognised. This includes a pre-defined list of scancodes which are simple numbers from `0x00` to `0xE7`. The firmware assigns a scancode to each key of the keyboard.
The [HID specification](https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf) tells what a keyboard can actually send through USB to have a chance to be properly recognised. This includes a pre-defined list of scancodes which are simple numbers from `0x00` to `0xE7`. The firmware assigns a scancode to each key of the keyboard.
The firmware does not send actually letters or characters, but only scancodes.
Thus, by modifying the firmware, you only can modify what scancode is sent over
The firmware does not send actual letters or characters, but only scancodes.
Thus, by modifying the firmware, you can only modify what scancode is sent over
USB for a given key.
## 3. What the Operating System Does
Once the keycode reaches the operating system, a piece of software has to have
it match an actual character thanks to a keyboard layout. For example, if your
layout is set to QWERTY, a sample of the matching table is as follow:
layout is set to QWERTY, a sample of the matching table is as follows:
| keycode | character |
|---------|-----------|
@ -55,11 +55,11 @@ As the layout is generally fixed (unless you create your own), the firmware can
## List of Characters You Can Send
Putting aside shortcuts, having a limited set of keycodes mapped to a limited layout means that **the list of characters you can assign to a given key only is the ones present in the layout**.
Putting aside shortcuts, having a limited set of keycodes mapped to a limited layout means that **the list of characters you can assign to a given key are only the ones present in the layout**.
For example, this means that if you have a QWERTY US layout, and you want to assign 1 key to produce `€` (euro currency symbol), you are unable to do so, because the QWERTY US layout does not have such mapping. You could fix that by using a QWERTY UK layout, or a QWERTY US International.
For example, this means that if you have a QWERTY US layout, and you want to assign one key to produce `€` (euro currency symbol), you are unable to do so, because the QWERTY US layout does not have such mapping. You could fix that by using a QWERTY UK layout, or a QWERTY US International.
You may wonder why a keyboard layout containing all of Unicode is not devised then? The limited number of keycode available through USB simply disallow such a thing.
You may wonder why a keyboard layout containing all of Unicode is not devised then? The limited number of keycodes available through USB simply disallows such a thing.
## How to (Maybe) Enter Unicode Characters

View file

@ -0,0 +1,23 @@
# GPIO Control
QMK has a GPIO control abstraction layer which is micro-controller agnostic. This is done to allow easy access to pin control across different platforms.
## Functions
The following functions can provide basic control of GPIOs and are found in `quantum/quantum.h`.
|Function |Description |
|----------------------|------------------------------------------------------------------|
|`setPinInput(pin)` |Set pin as input with high impedance (High-Z) |
|`setPinInputHigh(pin)`|Set pin as input with build in pull-up |
|`setPinInputLow(pin)` |Set pin as input with build in pull-down (Supported only on STM32)|
|`setPinOutput(pin)` |Set pin as output |
|`writePinHige(pin)` |Set pin level as high, assuming it is an output |
|`writePinLow(pin)` |Set pin level as low, assuming it is an output |
|`writePin(pin, level)`|Set pin level, assuming it is an output |
|`readPin(pin)` |Returns the level of the pin |
## Advance settings
Each micro-controller can have multiple advance settings regarding its GPIO. This abstraction layer does not limit the use of architecture specific functions. Advance users should consult the datasheet of there desired device and include any needed libraries. For AVR the standard avr/io.h library is used and for STM32 the Chibios [PAL library](http://chibios.sourceforge.net/docs3/hal/group___p_a_l.html) is used.

View file

@ -1,6 +1,6 @@
# Basic Keycodes
The basic set of keycodes are based on the [HID Keyboard/Keypad Usage Page (0x07)](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf) with the exception of `KC_NO`, `KC_TRNS` and keycodes in the `0xA5-DF` range. See below for more details.
The basic set of keycodes are based on the [HID Keyboard/Keypad Usage Page (0x07)](https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf) with the exception of `KC_NO`, `KC_TRNS` and keycodes in the `0xA5-DF` range. See below for more details.
## Letters and Numbers

View file

@ -6,6 +6,10 @@ These keycodes correspond to characters that are "shifted" on a standard US ANSI
Unfortunately, these keycodes cannot be used in Mod-Taps or Layer-Taps, since any modifiers specified in the keycode are ignored.
Additionally, you may run into issues when using Remote Desktop Connection on Windows. Because these codes send shift very fast, Remote Desktop may miss the codes.
To fix this, open Remote Desktop Connection, click on "Show Options", open the the "Local Resources" tab. In the keyboard section, change the drop down to "On this Computer". This will fix the issue, and allow the characters to work correctly.
## Keycodes
|Key |Aliases |Description |

View file

@ -89,11 +89,15 @@ There are 3 main sections of a `keymap.c` file you'll want to concern yourself w
At the top of the file you'll find this:
#include "clueboard.h"
#include QMK_KEYBOARD_H
// Helpful defines
#define GRAVE_MODS (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)|MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
#define _______ KC_TRNS
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* You can use _______ in place for KC_TRNS (transparent) *
* Or you can use XXXXXXX for KC_NO (NOOP) *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// Each layer gets a name for readability.
// The underscores don't mean anything - you can
@ -105,7 +109,9 @@ At the top of the file you'll find this:
#define _FL 1
#define _CL 2
These are some handy definitions we can use when building our keymap and our custom function. The `GRAVE_MODS` definition will be used later in our custom function. The `_______` define makes it easier to see what keys a layer is overriding, while the `_BL`, `_FL`, and `_CL` defines make it easier to refer to each of our layers.
These are some handy definitions we can use when building our keymap and our custom function. The `GRAVE_MODS` definition will be used later in our custom function, and the following `_BL`, `_FL`, and `_CL` defines make it easier to refer to each of our layers.
Note: You may also find some older keymap files may also have a define(s) for `_______` and/or `XXXXXXX`. These can be used in place for `KC_TRNS` and `KC_NO` respectively, making it easier to see what keys a layer is overriding. These definitions are now unecessary, as they are included by default.
### Layers and Keymaps

View file

@ -6,13 +6,13 @@ Not sure if your keyboard can run QMK? If it's a mechanical keyboard you built y
## Overview
There are 4 main sections to this guide:
There are 5 main sections to this guide:
* [Getting Started](newbs_getting_started.md)
* [Building Your First Firmware](newbs_building_firmware.md)
* [Flashing Firmware](newbs_flashing.md)
* [Testing and Debugging](newbs_testing_debugging.md)
* [Best Practices](newbs_best_practices.md)
* [Learn More with these Resources](newbs_learn_more_resources.md)
This guide is focused on helping someone who has never compiled software before. It makes choices and recommendations based on that viewpoint. There are alternative methods for many of these procedures, and we support most of those alternatives. If you have any doubt about how to accomplish a task you can [ask us for guidance](getting_started_getting_help.md).

View file

@ -0,0 +1,163 @@
# Best Practices
## Or, "How I Learned to Stop Worrying and Love Git."
This document aims to instruct novices in the best ways to have a smooth experience in contributing to QMK. We will walk through the process of contributing to QMK, detailing some ways to make this task easier, and then later we'll break some things in order to teach you how to fix them.
This document assumes a few things:
1. You have a GitHub account, and have [forked the qmk_firmware repository](getting_started_github.md) to your account.
2. You've [set up your build environment](newbs_getting_started.md?id=environment-setup).
## Your fork's master: Update Often, Commit Never
It is highly recommended for QMK development, regardless of what is being done or where, to keep your `master` branch updated, but ***never*** commit to it. Instead, do all your changes in a development branch and issue pull requests from your branches when you're developing.
To reduce the chances of merge conflicts &mdash; instances where two or more users have edited the same part of a file concurrently &mdash; keep your `master` branch relatively up-to-date, and start any new developments by creating a new branch.
### Updating your master branch
To keep your `master` branch updated, it is recommended to add the QMK Firmware repository ("repo") as a remote repository in git. To do this, open your Git command line interface and enter:
```
git remote add upstream https://github.com/qmk/qmk_firmware.git
```
To verify that the repository has been added, run `git remote -v`, which should return the following:
```
$ git remote -v
origin https://github.com/<your_username>/qmk_firmware.git (fetch)
origin https://github.com/<your_username>/qmk_firmware.git (push)
upstream https://github.com/qmk/qmk_firmware.git (fetch)
upstream https://github.com/qmk/qmk_firmware.git (push)
```
Now that this is done, you can check for updates to the repo by running `git fetch upstream`. This retrieves the branches and tags &mdash; collectively referred to as "refs" &mdash; from the QMK repo, which now has the nickname `upstream`. We can now compare the data on our fork `origin` to that held by QMK.
To update your fork's master, run the following, hitting the Enter key after each line:
```
git checkout master
git fetch upstream
git pull upstream master
git push origin master
```
This switches you to your `master` branch, retrieves the refs from the QMK repo, downloads the current QMK `master` branch to your computer, and then uploads it to your fork.
### Making Changes
To make changes, create a new branch by entering:
```
git checkout -b dev_branch
git push --set-upstream origin dev_branch
```
This creates a new branch named `dev_branch`, checks it out, and then saves the new branch to your fork. The `--set-upstream` argument tells git to use your fork and the `dev_branch` branch every time you use `git push` or `git pull` from this branch. It only needs to be used on the first push; after that, you can safely use `git push` or `git pull`, without the rest of the arguments.
!> With `git push`, you can use `-u` in place of `--set-upstream` &mdash; `-u` is an alias for `--set-upstream`.
You can name your branch nearly anything you want, though it is recommended to name it something related to the changes you are going to make.
By default `git checkout -b` will base your new branch on the branch that is checked out. You can base your new branch on an existing branch that is not checked out by adding the name of the existing branch to the command:
```
git checkout -b dev_branch master
```
Now that you have a development branch, open your text editor and make whatever changes you need to make. It is recommended to make many small commits to your branch; that way, any change that causes issues can be more easily traced and undone if needed. To make your changes, edit and save any files that need to be updated, add them to Git's *staging area*, and then commit them to your branch:
```
git add path/to/updated_file
git commit -m "My commit message."
```
`git add` adds files that have been changed to Git's *staging area*, which is Git's "loading zone." This contains the changes that are going to be *committed* by `git commit`, which saves the changes to the repo. Use descriptive commit messages so you can know what was changed at a glance.
!> If you've changed a lot of files, but all the files are part of the same change, you can use `git add .` to add all the changed files that are in your current directory, rather than having to add each file individually.
### Publishing Your Changes
The last step is to push your changes to your fork. To do this, enter `git push`. Git now publishes the current state of `dev_branch` to your fork.
## Resolving Merge Conflicts
Sometimes when your work in a branch takes a long time to complete, changes that have been made by others conflict with changes you have made to your branch when you open a pull request. This is called a *merge conflict*, and is what happens when multiple people edit the same parts of the same files.
### Rebasing Your Changes
A *rebase* is Git's way of taking changes that were applied at one point, reversing them, and then applying the same changes to another point. In the case of a merge conflict, you can rebase your branch to grab the changes that were made between when you created your branch and the present time.
To start, run the following:
```
git fetch upstream
git rev-list --left-right --count HEAD...upstream/master
```
The `git rev-list` command entered here returns the number of commits that differ between the current branch and QMK's master branch. We run `git fetch` first to make sure we have the refs that represent the current state of the upstream repo. The output of the `git rev-list` command entered returns two numbers:
```
$ git rev-list --left-right --count HEAD...upstream/master
7 35
```
The first number represents the number of commits on the current branch since it was created, and the second number is the number of commits made to `upstream/master` since the current branch was created, and thus, the changes that are not recorded in the current branch.
Now that the current states of both the current branch and the upstream repo are known, we can start a rebase operation:
```
git rebase upstream/master
```
This tells Git to undo the commits on the current branch, and then reapply them against QMK's master branch.
```
$ git rebase upstream/master
First, rewinding head to replay your work on top of it...
Applying: Commit #1
Using index info to reconstruct a base tree...
M conflicting_file_1.txt
Falling back to patching base and 3-way merge...
Auto-merging conflicting_file_1.txt
CONFLICT (content): Merge conflict in conflicting_file_1.txt
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0001 Commit #1
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
```
This tells us that we have a merge conflict, and gives the name of the file with the conflict. Open the conflicting file in your text editor, and somewhere in the file, you'll find something like this:
```
<<<<<<< HEAD
<p>For help with any issues, email us at support@webhost.us.</p>
=======
<p>Need help? Email support@webhost.us.</p>
>>>>>>> Commit #1
```
The line `<<<<<<< HEAD` marks the beginning of a merge conflict, and the `>>>>>>> Commit #1` line marks the end, with the conflicting sections separated by `=======`. The part on the `HEAD` side is from the QMK master version of the file, and the part marked with the commit message is from the current branch and commit.
Because Git tracks *changes to files* rather than the contents of the files directly, if Git can't find the text that was in the file previous to the commit that was made, it won't know how to edit the file. Re-editing the file will solve the conflict. Make your changes, and then save the file.
```
<p>Need help? Email support@webhost.us.</p>
```
Now run:
```
git add conflicting_file_1.txt
git rebase --continue
```
Git logs the changes to the conflicting file, and continues applying the commits from our branch until it reaches the end.

View file

@ -16,7 +16,7 @@ Start by navigating to the `keymaps` folder for your keyboard.
?> Windows:
start keyboards/<keyboard_folder>/keymaps
start .\\keyboards\\<keyboard_folder>\\keymaps
## Create a Copy Of The `default` Keymap

View file

@ -1,13 +1,15 @@
# Learning Resources
These resources are aimed at giving new members in the qmk community more understanding to the information provided in the newbs docs.
These resources are aimed at giving new members in the QMK community more understanding to the information provided in the Newbs docs.
Git resources:
*
*[Great General Tutorial](https://www.codecademy.com/learn/learn-git)
*[Git Game To Learn From Examples](https://learngitbranching.js.org/)
*[Git Resources to Learn More About Github](getting_started_github.md)
*[Git Resources Aimed Specificly toward QMK](contributing.md)
* [Great General Tutorial](https://www.codecademy.com/learn/learn-git)
* [Git Game To Learn From Examples](https://learngitbranching.js.org/)
* [Git Resources to Learn More About Github](getting_started_github.md)
* [Git Resources Aimed Specifically toward QMK](contributing.md)
Command Line resources:
*[Good General Tutorial on Command Line](https://www.codecademy.com/learn/learn-the-command-line)
* [Good General Tutorial on Command Line](https://www.codecademy.com/learn/learn-the-command-line)

View file

@ -1,28 +1,79 @@
# List of Useful Core Functions To Make Your Keyboard Better
There are a lot of hidden functions in QMK that are incredible useful, or may add a bit of functionality that you've been wanting. Functions that are specific to certain features are not included here, as those will be on their respective feature page.
There are a lot of hidden functions in QMK that are incredible useful, or may add a bit of functionality that you've been wanting. Functions that are specific to certain features are not included here, as those will be on their respective feature page.
## (OLKB) Tri Layers
There are actually separate functions that you can use there, depending on what you're after.
There are actually separate functions that you can use there, depending on what you're after.
The first is the `update_tri_layer(x, y, z)` function. This function check to see if layers `x` and `y` are both on. If they are both on, then it runs on layer `z`. Otherwise, if both `x` and `y` are not both on (either only one is, or neither is), then it runs off layer `z`.
### `update_tri_layer(x, y, z)`
This function is useful if you want to create specific keys that have this functionality, but other layer keycodes won't do this.
The first is the `update_tri_layer(x, y, z)` function. This function check to see if layers `x` and `y` are both on. If they are both on, then it runs on layer `z`. Otherwise, if both `x` and `y` are not both on (either only one is, or neither is), then it runs off layer `z`.
The other function is `update_tri_layer_state(state, x, y, z)`. This function is meant to be called from they [`layer_state_set_*` functions](custom_quantum_functions.md#layer-change-code). This means that any time that you use a keycode to change the layer, this will be checked. So you could use `LT(layer, kc)` to change the layer and it will trigger the same layer check.
This function is useful if you want to create specific keys that have this functionality, but other layer keycodes won't do this.
The caveat to this method is that you cannot access the `z` layer without having `x` and `y` layers on, since if you try to activate just layer `z`, it will run this code and turn off layer `z` before you could use it.
#### Example
```c
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
case RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
}
return true;
}
```
### `update_tri_layer_state(state, x, y, z)`
The other function is `update_tri_layer_state(state, x, y, z)`. This function is meant to be called from they [`layer_state_set_*` functions](custom_quantum_functions.md#layer-change-code). This means that any time that you use a keycode to change the layer, this will be checked. So you could use `LT(layer, kc)` to change the layer and it will trigger the same layer check.
The caveat to this method is that you cannot access the `z` layer without having `x` and `y` layers on, since if you try to activate just layer `z`, it will run this code and turn off layer `z` before you could use it.
#### Example
```c
uint32_t layer_state_set_user(uint32_t state) {
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
}
```
Alternatively, you don't have to immediately "return" the value. This is useful if you want to add multiple tri layers, or if you want to add additional effects.
```c
uint32_t layer_state_set_user(uint32_t state) {
state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
state = update_tri_layer_state(state, _RAISE, _SYMB, _SPECIAL);
return state;
}
```
## Setting the Persistent Default Layer
Do you want to set the default layer, so that it's retained even after you unplug the board? If so, this is the function for you.
Do you want to set the default layer, so that it's retained even after you unplug the board? If so, this is the function for you.
To use this, you would use `set_single_persistent_default_layer(layer)`. If you have a name defined for your layer, you can use that instead (such as _QWERTY, _DVORAK or _COLEMAK).
To use this, you would use `set_single_persistent_default_layer(layer)`. If you have a name defined for your layer, you can use that instead (such as _QWERTY, _DVORAK or _COLEMAK).
This will set the default layer, update the persistent settings, and play a tune if you have [Audio](feature_audio.md) enabled on your board, and the default layer sounds set.
This will set the default layer, update the persistent settings, and play a tune if you have [Audio](feature_audio.md) enabled on your board, and the default layer sounds set.
To configure the default layer sounds, you would want to define this in your `config.h` file, like this:
To configure the default layer sounds, you would want to define this in your `config.h` file, like this:
```c
#define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
@ -36,13 +87,12 @@ To configure the default layer sounds, you would want to define this in your `co
## Reseting the keyboard
There is the `RESET` quantum keycode that you can use. But if you want to reset the board as part of a macro, rather than hitting a key separately, you can do that.
There is the `RESET` quantum keycode that you can use. But if you want to reset the board as part of a macro, rather than hitting a key separately, you can do that.
And to do so, add `reset_keyboard()` to your function or macro, and this will reset to bootloader.
## Wiping the EEPROM (Persistent Storage)
If you're having issues with Audio, RGB Underglow, backlighting or keys acting weird, then you can reset the EEPROM (persistent setting storage). Bootmagic is one way to do this, but if that isn't enabled, then you can use a custom macro to do so.
To wipe the EEPROM, run `eeconfig_init()` from your function or macro to reset most of the settings to default.
If you're having issues with Audio, RGB Underglow, backlighting or keys acting weird, then you can reset the EEPROM (persistent setting storage). Bootmagic is one way to do this, but if that isn't enabled, then you can use a custom macro to do so.
To wipe the EEPROM, run `eeconfig_init()` from your function or macro to reset most of the settings to default.

View file

@ -128,7 +128,7 @@ The standard Deutsche (German) keyboard layout. Named for the first 6 letters on
The term for pressing a key while a key is already held down. Variants include 2KRO, 6KRO, and NKRO.
## Scancode
A 1 byte number that is sent as part of a HID report over USB that represents a single key. These numbers are documented in the [HID Usage Tables](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf) published by the [USB-IF](http://www.usb.org/).
A 1 byte number that is sent as part of a HID report over USB that represents a single key. These numbers are documented in the [HID Usage Tables](https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf) published by the [USB-IF](http://www.usb.org/).
## Space Cadet Shift
A special set of shift keys which allow you to type various types of braces by tapping the left or right shift one or more times.

View file

@ -8,7 +8,9 @@
#include "i2c_master.h"
#include "timer.h"
#ifndef F_SCL
#define F_SCL 400000UL // SCL frequency
#endif
#define Prescaler 1
#define TWBR_val ((((F_CPU / F_SCL) / Prescaler) - 16 ) / 2)

View file

@ -69,7 +69,4 @@ void ws2812_sendarray_mask(uint8_t *array,uint16_t length, uint8_t pinmask);
#define CONCAT_EXP(a, b) CONCAT(a, b)
#endif
// #define ws2812_PORTREG CONCAT_EXP(PORT,ws2812_port)
// #define ws2812_DDRREG CONCAT_EXP(DDR,ws2812_port)
#endif /* LIGHT_WS2812_H_ */

102
drivers/issi/is31fl3218.c Normal file
View file

@ -0,0 +1,102 @@
/* Copyright 2018 Jason Williams (Wilba)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "is31fl3218.h"
#include "i2c_master.h"
// This is the full 8-bit address
#define ISSI_ADDRESS 0b10101000
// These are the register addresses
#define ISSI_REG_SHUTDOWN 0x00
#define ISSI_REG_PWM 0x01
#define ISSI_REG_CONTROL 0x13
#define ISSI_REG_UPDATE 0x16
#define ISSI_REG_RESET 0x17
// Default timeout if no I2C response
#define ISSI_TIMEOUT 100
// Reusable buffer for transfers
uint8_t g_twi_transfer_buffer[20];
// IS31FL3218 has 18 PWM outputs and a fixed I2C address, so no chaining.
// If used as RGB LED driver, LEDs are assigned RGB,RGB,RGB,RGB,RGB,RGB
uint8_t g_pwm_buffer[18];
bool g_pwm_buffer_update_required = false;
void IS31FL3218_write_register( uint8_t reg, uint8_t data )
{
g_twi_transfer_buffer[0] = reg;
g_twi_transfer_buffer[1] = data;
i2c_transmit( ISSI_ADDRESS, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
}
void IS31FL3218_write_pwm_buffer( uint8_t *pwm_buffer )
{
g_twi_transfer_buffer[0] = ISSI_REG_PWM;
for ( int i=0; i<18; i++ ) {
g_twi_transfer_buffer[1+i] = pwm_buffer[i];
}
i2c_transmit( ISSI_ADDRESS, g_twi_transfer_buffer, 19, ISSI_TIMEOUT);
}
void IS31FL3218_init(void)
{
// In case we ever want to reinitialize (?)
IS31FL3218_write_register( ISSI_REG_RESET, 0x00 );
// Turn off software shutdown
IS31FL3218_write_register( ISSI_REG_SHUTDOWN, 0x01 );
// Set all PWM values to zero
for ( uint8_t i = 0; i < 18; i++ ) {
IS31FL3218_write_register( ISSI_REG_PWM+i, 0x00 );
}
// Enable all channels
for ( uint8_t i = 0; i < 3; i++ ) {
IS31FL3218_write_register( ISSI_REG_CONTROL+i, 0b00111111 );
}
// Load PWM registers and LED Control register data
IS31FL3218_write_register( ISSI_REG_UPDATE, 0x01 );
}
void IS31FL3218_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
{
g_pwm_buffer[index * 3 + 0] = red;
g_pwm_buffer[index * 3 + 1] = green;
g_pwm_buffer[index * 3 + 2] = blue;
g_pwm_buffer_update_required = true;
}
void IS31FL3218_set_color_all( uint8_t red, uint8_t green, uint8_t blue )
{
for ( int i = 0; i < 6; i++ ) {
IS31FL3218_set_color( i, red, green, blue );
}
}
void IS31FL3218_update_pwm_buffers(void)
{
if ( g_pwm_buffer_update_required ) {
IS31FL3218_write_pwm_buffer( g_pwm_buffer );
// Load PWM registers and LED Control register data
IS31FL3218_write_register( ISSI_REG_UPDATE, 0x01 );
}
g_pwm_buffer_update_required = false;
}

24
drivers/issi/is31fl3218.h Normal file
View file

@ -0,0 +1,24 @@
/* Copyright 2018 Jason Williams (Wilba)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stdint.h>
#include <stdbool.h>
void IS31FL3218_init(void);
void IS31FL3218_set_color( int index, uint8_t red, uint8_t green, uint8_t blue );
void IS31FL3218_set_color_all( uint8_t red, uint8_t green, uint8_t blue );
void IS31FL3218_update_pwm_buffers(void);

View file

@ -268,4 +268,3 @@ void IS31FL3731_update_led_control_registers( uint8_t addr1, uint8_t addr2 )
}
}
}

View file

@ -24,10 +24,10 @@
#include "wait.h"
#endif
#include "is31fl3733.h"
#include <string.h>
#include "i2c_master.h"
#include "progmem.h"
#include "rgb_matrix.h"
// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
@ -250,4 +250,3 @@ void IS31FL3733_update_led_control_registers( uint8_t addr1, uint8_t addr2 )
}
}
}

306
drivers/issi/is31fl3736.c Normal file
View file

@ -0,0 +1,306 @@
/* Copyright 2018 Jason Williams (Wilba)
*
* 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/>.
*/
#ifdef __AVR__
#include <avr/interrupt.h>
#include <avr/io.h>
#include <util/delay.h>
#else
#include "wait.h"
#endif
#include "is31fl3736.h"
#include <string.h>
#include "i2c_master.h"
#include "progmem.h"
// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
// The address will vary depending on your wiring:
// 00 <-> GND
// 01 <-> SCL
// 10 <-> SDA
// 11 <-> VCC
// ADDR1 represents A1:A0 of the 7-bit address.
// ADDR2 represents A3:A2 of the 7-bit address.
// The result is: 0b101(ADDR2)(ADDR1)
#define ISSI_ADDR_DEFAULT 0x50
#define ISSI_COMMANDREGISTER 0xFD
#define ISSI_COMMANDREGISTER_WRITELOCK 0xFE
#define ISSI_INTERRUPTMASKREGISTER 0xF0
#define ISSI_INTERRUPTSTATUSREGISTER 0xF1
#define ISSI_PAGE_LEDCONTROL 0x00 //PG0
#define ISSI_PAGE_PWM 0x01 //PG1
#define ISSI_PAGE_AUTOBREATH 0x02 //PG2
#define ISSI_PAGE_FUNCTION 0x03 //PG3
#define ISSI_REG_CONFIGURATION 0x00 //PG3
#define ISSI_REG_GLOBALCURRENT 0x01 //PG3
#define ISSI_REG_RESET 0x11// PG3
#define ISSI_REG_SWPULLUP 0x0F //PG3
#define ISSI_REG_CSPULLUP 0x10 //PG3
#ifndef ISSI_TIMEOUT
#define ISSI_TIMEOUT 100
#endif
#ifndef ISSI_PERSISTENCE
#define ISSI_PERSISTENCE 0
#endif
// Transfer buffer for TWITransmitData()
uint8_t g_twi_transfer_buffer[20];
// These buffers match the IS31FL3736 PWM registers.
// The control buffers match the PG0 LED On/Off registers.
// Storing them like this is optimal for I2C transfers to the registers.
// We could optimize this and take out the unused registers from these
// buffers and the transfers in IS31FL3736_write_pwm_buffer() but it's
// probably not worth the extra complexity.
uint8_t g_pwm_buffer[DRIVER_COUNT][192];
bool g_pwm_buffer_update_required = false;
uint8_t g_led_control_registers[DRIVER_COUNT][24] = { { 0 }, { 0 } };
bool g_led_control_registers_update_required = false;
void IS31FL3736_write_register( uint8_t addr, uint8_t reg, uint8_t data )
{
g_twi_transfer_buffer[0] = reg;
g_twi_transfer_buffer[1] = data;
#if ISSI_PERSISTENCE > 0
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0)
break;
}
#else
i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
#endif
}
void IS31FL3736_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer )
{
// assumes PG1 is already selected
// transmit PWM registers in 12 transfers of 16 bytes
// g_twi_transfer_buffer[] is 20 bytes
// iterate over the pwm_buffer contents at 16 byte intervals
for ( int i = 0; i < 192; i += 16 ) {
g_twi_transfer_buffer[0] = i;
// copy the data from i to i+15
// device will auto-increment register for data after the first byte
// thus this sets registers 0x00-0x0F, 0x10-0x1F, etc. in one transfer
for ( int j = 0; j < 16; j++ ) {
g_twi_transfer_buffer[1 + j] = pwm_buffer[i + j];
}
#if ISSI_PERSISTENCE > 0
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT) == 0)
break;
}
#else
i2c_transmit(addr << 1, g_twi_transfer_buffer, 17, ISSI_TIMEOUT);
#endif
}
}
void IS31FL3736_init( uint8_t addr )
{
// In order to avoid the LEDs being driven with garbage data
// in the LED driver's PWM registers, shutdown is enabled last.
// Set up the mode and other settings, clear the PWM registers,
// then disable software shutdown.
// Unlock the command register.
IS31FL3736_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 );
// Select PG0
IS31FL3736_write_register( addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL );
// Turn off all LEDs.
for ( int i = 0x00; i <= 0x17; i++ )
{
IS31FL3736_write_register( addr, i, 0x00 );
}
// Unlock the command register.
IS31FL3736_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 );
// Select PG1
IS31FL3736_write_register( addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM );
// Set PWM on all LEDs to 0
// No need to setup Breath registers to PWM as that is the default.
for ( int i = 0x00; i <= 0xBF; i++ )
{
IS31FL3736_write_register( addr, i, 0x00 );
}
// Unlock the command register.
IS31FL3736_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 );
// Select PG3
IS31FL3736_write_register( addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION );
// Set global current to maximum.
IS31FL3736_write_register( addr, ISSI_REG_GLOBALCURRENT, 0xFF );
// Disable software shutdown.
IS31FL3736_write_register( addr, ISSI_REG_CONFIGURATION, 0x01 );
// Wait 10ms to ensure the device has woken up.
#ifdef __AVR__
_delay_ms( 10 );
#else
wait_ms(10);
#endif
}
void IS31FL3736_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
{
if ( index >= 0 && index < DRIVER_LED_TOTAL ) {
is31_led led = g_is31_leds[index];
g_pwm_buffer[led.driver][led.r] = red;
g_pwm_buffer[led.driver][led.g] = green;
g_pwm_buffer[led.driver][led.b] = blue;
g_pwm_buffer_update_required = true;
}
}
void IS31FL3736_set_color_all( uint8_t red, uint8_t green, uint8_t blue )
{
for ( int i = 0; i < DRIVER_LED_TOTAL; i++ )
{
IS31FL3736_set_color( i, red, green, blue );
}
}
void IS31FL3736_set_led_control_register( uint8_t index, bool red, bool green, bool blue )
{
is31_led led = g_is31_leds[index];
// IS31FL3733
// The PWM register for a matrix position (0x00 to 0xBF) can be
// divided by 8 to get the LED control register (0x00 to 0x17),
// then mod 8 to get the bit position within that register.
// IS31FL3736
// The PWM register for a matrix position (0x00 to 0xBF) is interleaved, so:
// A1=0x00 A2=0x02 A3=0x04 A4=0x06 A5=0x08 A6=0x0A A7=0x0C A8=0x0E
// B1=0x10 B2=0x12 B3=0x14
// But also, the LED control registers (0x00 to 0x17) are also interleaved, so:
// A1-A4=0x00 A5-A8=0x01
// So, the same math applies.
uint8_t control_register_r = led.r / 8;
uint8_t control_register_g = led.g / 8;
uint8_t control_register_b = led.b / 8;
uint8_t bit_r = led.r % 8;
uint8_t bit_g = led.g % 8;
uint8_t bit_b = led.b % 8;
if ( red ) {
g_led_control_registers[led.driver][control_register_r] |= (1 << bit_r);
} else {
g_led_control_registers[led.driver][control_register_r] &= ~(1 << bit_r);
}
if ( green ) {
g_led_control_registers[led.driver][control_register_g] |= (1 << bit_g);
} else {
g_led_control_registers[led.driver][control_register_g] &= ~(1 << bit_g);
}
if ( blue ) {
g_led_control_registers[led.driver][control_register_b] |= (1 << bit_b);
} else {
g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b);
}
g_led_control_registers_update_required = true;
}
void IS31FL3736_mono_set_brightness( int index, uint8_t value )
{
if ( index >= 0 && index < 96 ) {
// Index in range 0..95 -> A1..A8, B1..B8, etc.
// Map index 0..95 to registers 0x00..0xBE (interleaved)
uint8_t pwm_register = index * 2;
g_pwm_buffer[0][pwm_register] = value;
g_pwm_buffer_update_required = true;
}
}
void IS31FL3736_mono_set_brightness_all( uint8_t value )
{
for ( int i = 0; i < 96; i++ )
{
IS31FL3736_mono_set_brightness( i, value );
}
}
void IS31FL3736_mono_set_led_control_register( uint8_t index, bool enabled )
{
// Index in range 0..95 -> A1..A8, B1..B8, etc.
// Map index 0..95 to registers 0x00..0xBE (interleaved)
uint8_t pwm_register = index * 2;
// Map register 0x00..0xBE (interleaved) into control register and bit
uint8_t control_register = pwm_register / 8;
uint8_t bit = pwm_register % 8;
if ( enabled ) {
g_led_control_registers[0][control_register] |= (1 << bit);
} else {
g_led_control_registers[0][control_register] &= ~(1 << bit);
}
g_led_control_registers_update_required = true;
}
void IS31FL3736_update_pwm_buffers( uint8_t addr1, uint8_t addr2 )
{
if ( g_pwm_buffer_update_required )
{
// Firstly we need to unlock the command register and select PG1
IS31FL3736_write_register( addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 );
IS31FL3736_write_register( addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM );
IS31FL3736_write_pwm_buffer( addr1, g_pwm_buffer[0] );
//IS31FL3736_write_pwm_buffer( addr2, g_pwm_buffer[1] );
}
g_pwm_buffer_update_required = false;
}
void IS31FL3736_update_led_control_registers( uint8_t addr1, uint8_t addr2 )
{
if ( g_led_control_registers_update_required )
{
// Firstly we need to unlock the command register and select PG0
IS31FL3736_write_register( addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 );
IS31FL3736_write_register( addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL );
for ( int i=0; i<24; i++ )
{
IS31FL3736_write_register(addr1, i, g_led_control_registers[0][i] );
//IS31FL3736_write_register(addr2, i, g_led_control_registers[1][i] );
}
}
}

172
drivers/issi/is31fl3736.h Normal file
View file

@ -0,0 +1,172 @@
/* Copyright 2018 Jason Williams (Wilba)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stdint.h>
#include <stdbool.h>
// Simple interface option.
// If these aren't defined, just define them to make it compile
#ifndef DRIVER_COUNT
#define DRIVER_COUNT 2
#endif
#ifndef DRIVER_LED_TOTAL
#define DRIVER_LED_TOTAL 96
#endif
typedef struct is31_led {
uint8_t driver:2;
uint8_t r;
uint8_t g;
uint8_t b;
} __attribute__((packed)) is31_led;
extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
void IS31FL3736_init( uint8_t addr );
void IS31FL3736_write_register( uint8_t addr, uint8_t reg, uint8_t data );
void IS31FL3736_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer );
void IS31FL3736_set_color( int index, uint8_t red, uint8_t green, uint8_t blue );
void IS31FL3736_set_color_all( uint8_t red, uint8_t green, uint8_t blue );
void IS31FL3736_set_led_control_register( uint8_t index, bool red, bool green, bool blue );
void IS31FL3736_mono_set_brightness( int index, uint8_t value );
void IS31FL3736_mono_set_brightness_all( uint8_t value );
void IS31FL3736_mono_set_led_control_register( uint8_t index, bool enabled );
// This should not be called from an interrupt
// (eg. from a timer interrupt).
// Call this while idle (in between matrix scans).
// If the buffer is dirty, it will update the driver with the buffer.
void IS31FL3736_update_pwm_buffers( uint8_t addr1, uint8_t addr2 );
void IS31FL3736_update_led_control_registers( uint8_t addr1, uint8_t addr2 );
#define A_1 0x00
#define A_2 0x02
#define A_3 0x04
#define A_4 0x06
#define A_5 0x08
#define A_6 0x0A
#define A_7 0x0C
#define A_8 0x0E
#define B_1 0x10
#define B_2 0x12
#define B_3 0x14
#define B_4 0x16
#define B_5 0x18
#define B_6 0x1A
#define B_7 0x1C
#define B_8 0x1E
#define C_1 0x20
#define C_2 0x22
#define C_3 0x24
#define C_4 0x26
#define C_5 0x28
#define C_6 0x2A
#define C_7 0x2C
#define C_8 0x2E
#define D_1 0x30
#define D_2 0x32
#define D_3 0x34
#define D_4 0x36
#define D_5 0x38
#define D_6 0x3A
#define D_7 0x3C
#define D_8 0x3E
#define E_1 0x40
#define E_2 0x42
#define E_3 0x44
#define E_4 0x46
#define E_5 0x48
#define E_6 0x4A
#define E_7 0x4C
#define E_8 0x4E
#define F_1 0x50
#define F_2 0x52
#define F_3 0x54
#define F_4 0x56
#define F_5 0x58
#define F_6 0x5A
#define F_7 0x5C
#define F_8 0x5E
#define G_1 0x60
#define G_2 0x62
#define G_3 0x64
#define G_4 0x66
#define G_5 0x68
#define G_6 0x6A
#define G_7 0x6C
#define G_8 0x6E
#define H_1 0x70
#define H_2 0x72
#define H_3 0x74
#define H_4 0x76
#define H_5 0x78
#define H_6 0x7A
#define H_7 0x7C
#define H_8 0x7E
#define I_1 0x80
#define I_2 0x82
#define I_3 0x84
#define I_4 0x86
#define I_5 0x88
#define I_6 0x8A
#define I_7 0x8C
#define I_8 0x8E
#define J_1 0x90
#define J_2 0x92
#define J_3 0x94
#define J_4 0x96
#define J_5 0x98
#define J_6 0x9A
#define J_7 0x9C
#define J_8 0x9E
#define K_1 0xA0
#define K_2 0xA2
#define K_3 0xA4
#define K_4 0xA6
#define K_5 0xA8
#define K_6 0xAA
#define K_7 0xAC
#define K_8 0xAE
#define L_1 0xB0
#define L_2 0xB2
#define L_3 0xB4
#define L_4 0xB6
#define L_5 0xB8
#define L_6 0xBA
#define L_7 0xBC
#define L_8 0xBE

View file

@ -0,0 +1,15 @@
#pragma once
/* tap dance stuff*/
#undef TAPPING_TERM
#define TAPPING_TERM 500
#define TAPPING_TOGGLE 2
#define EXAMPLESTRING1 "tapdance_1"
#define EXAMPLESTRING2 "tapdance_2"
#define EXAMPLESTRING3 "tapdance_3"
#define EXAMPLESTRING4 "tapdance_4"
#undef RGBLED_NUM
#define RGBLED_NUM 16

View file

@ -0,0 +1,215 @@
/*
tap danc eis turned on in the rules now...
*/
#include QMK_KEYBOARD_H
#define _EMOJI 0
#define _TAPLAND 1
#define _LEDCNTL 2
enum custom_keycodes {
SHRUG,
DISFACE,
FU,
TFLIP,
TFLIP2,
SAD_EYES,
TPUT,
HAPPYFACE,
HEARTFACE,
CLOUD,
CHANFACE,
CMDCLEAR
};
//Tap Dance Declarations
enum {
TD_EXAMPLE1 = 0,
TD_EXAMPLE2,
TD_EXAMPLE3,
TD_EXAMPLE4
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* EMOJI Pad
* ,-------------------------------.
* |TFLIP | TFlIP2|DISFACE| FU |
* |------+-------+-------+--------|
* | CLOUD| | | CLEAR |
* |------+-------+-------+--------|
* |SHRUG |DISFACE| HRTFAC| HAPPYF |
* |------+-------+-------+--------|
* | ENTER| |LEDCNTR| tapland|
* `-------------------------------'
*/
//purple
[_EMOJI] = LAYOUT_ortho_4x4(
TFLIP, TFLIP2, KC_NO, FU ,
CLOUD, KC_NO, KC_NO, CMDCLEAR,
SHRUG, DISFACE, HEARTFACE, HAPPYFACE,
KC_ENT, RGB_TOG, MO(_LEDCNTL), MO(_TAPLAND)
),
/* TapLand //
* ,-------------------------------.
* | str1 | str2 | str3 | str4 |
* |------+-------+-------+--------|
* | | | | |
* |------+-------+-------+--------|
* | | | | |
* |------+-------+-------+--------|
* | | | | |
* `-------------------------------'
*/
//blue
[_TAPLAND] = LAYOUT_ortho_4x4(
TD(TD_EXAMPLE1), TD(TD_EXAMPLE2), TD(TD_EXAMPLE3), TD(TD_EXAMPLE4),
KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO,
KC_NO, KC_NO, KC_NO, KC_NO
),
/* LEDControl Pad
* ,-------------------------------.
* | snake|breathe|rainbow|gradient|
* |------+-------+-------+--------|
* | xmas | Val+ | Sat+ | HUE+ |
* |------+-------+-------+--------|
* |kngrdr| Val- | Sat- | HUE- |
* |------+-------+-------+--------|
* | swirl| PLAIN | | ON/OFF |
* `-------------------------------'
*/
//blue
[_LEDCNTL] = LAYOUT_ortho_4x4(
RGB_M_SN, RGB_M_B, RGB_M_R, RGB_M_G,
RGB_M_X, RGB_VAI, RGB_SAI, RGB_HUI,
RGB_M_K, RGB_VAD, RGB_SAD, RGB_HUD,
RGB_M_SW, RGB_M_P, KC_NO, RGB_TOG
),
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch(keycode) {
case CLOUD: // (っ◕‿◕)っ
if(record->event.pressed){
send_unicode_hex_string("0028 3063 25D5 203F 25D5 0029 3063");
}
return false;
break;
case FU: // t(-_-t)
if(record->event.pressed){
SEND_STRING("t(-_-t)");
}
return false;
break;
case HAPPYFACE: // ʘ‿ʘ
if(record->event.pressed){
send_unicode_hex_string("0298 203F 0298");
}
return false;
break;
case CMDCLEAR:
if (record->event.pressed) {
register_code(KC_LGUI);
tap_code(KC_A);
unregister_code(KC_LGUI);
tap_code(KC_DEL);
}
return false;
break;
case SHRUG: // ¯\_(ツ)_/¯
if (record->event.pressed) {
send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF");
}
return false;
break;
case HEARTFACE: // ♥‿♥
if(record->event.pressed){
send_unicode_hex_string("2665 203F 2665");
}
return false;
break;
case DISFACE: // ಠ_ಠ
if(record->event.pressed){
send_unicode_hex_string("0CA0 005F 0CA0");
}
return false;
break;
case TFLIP: // (╯°□°)╯ ︵ ┻━┻
if(record->event.pressed){
send_unicode_hex_string("0028 256F 00B0 25A1 00B0 0029 256F 0020 FE35 0020 253B 2501 253B");
}
return false;
break;
case TFLIP2: // ┻━┻︵ \(°□°)/ ︵ ┻━┻
if(record->event.pressed){
send_unicode_hex_string("253B 2501 253B FE35 0020 005C 0028 00B0 25A1 00B0 0029 002F 0020 FE35 0020 253B 2501 253B");
}
return false;
break;
}
}
return true;
}
/* tap dance time */
void tdexample1(qk_tap_dance_state_t *state, void *user_data) {
if (state->count >= 2) {
SEND_STRING(EXAMPLESTRING1);
reset_tap_dance (state);
}
}
void tdexample2(qk_tap_dance_state_t *state, void *user_data) {
if (state->count >= 2) {
SEND_STRING(EXAMPLESTRING2);
reset_tap_dance (state);
}
}
void tdexample3(qk_tap_dance_state_t *state, void *user_data) {
if (state->count >= 2) {
SEND_STRING(EXAMPLESTRING3);
reset_tap_dance (state);
}
}
void tdexample4(qk_tap_dance_state_t *state, void *user_data) {
if (state->count >= 2) {
SEND_STRING(EXAMPLESTRING4);
reset_tap_dance (state);
}
}
qk_tap_dance_action_t tap_dance_actions[] = {
[TD_EXAMPLE1] = ACTION_TAP_DANCE_FN(tdexample1),
[TD_EXAMPLE2] = ACTION_TAP_DANCE_FN(tdexample2),
[TD_EXAMPLE3] = ACTION_TAP_DANCE_FN(tdexample3),
[TD_EXAMPLE4] = ACTION_TAP_DANCE_FN(tdexample4)
};
// Runs just one time when the keyboard initializes.
void matrix_scan_user(void) {
static bool has_ran_yet;
if (!has_ran_yet) {
has_ran_yet = true;
rgblight_setrgb (16, 0, 16);
}
}
uint32_t layer_state_set_user(uint32_t state) {
switch (biton32(state)) {
case _TAPLAND:
rgblight_setrgb(0, 16, 0); //green
break;
case _LEDCNTL:
rgblight_setrgb(0, 0, 16); //blue
break;
case _EMOJI:
rgblight_setrgb (16, 0, 16); //purple
break;
default: // for any other layers, or the default layer
rgblight_setrgb (16, 0, 16); //purple
break;
}
return state;
}

View file

@ -0,0 +1,10 @@
# Ridingtraffic's examples
===
This keymap has many features:
3 layers
Momentary layer switching
16 pixel neopixel
Unicode Enabled
Tap dance enabled
The rgb also updates depending on what layer you are on, and then flips back when done.

View file

@ -0,0 +1,5 @@
# turning on tap dance
TAP_DANCE_ENABLE = yes
RGBLIGHT_ENABLE = yes
MOUSEKEY_ENABLE = no
UNICODE_ENABLE = yes

View file

@ -43,7 +43,7 @@
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0a, K0b, ___, ___, ___, ___}, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1a, K1b, ___, ___, ___, ___}, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2a, K2b, ___, ___, ___, ___}, \
{ K30, K31, K32, K33, K34, K35, K35, K37, K38, K39, K3a, K3b, ___, ___, ___, ___} \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3a, K3b, ___, ___, ___, ___} \
}
#define LAYOUT_ortho_4x16( \
@ -56,7 +56,7 @@
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0a, K0b, K0c, K0d, K0e, K0f }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1a, K1b, K1c, K1d, K1e, K1f }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2a, K2b, K2c, K2d, K2e, K2f }, \
{ K30, K31, K32, K33, K34, K35, K35, K37, K38, K39, K3a, K3b, K3c, K3d, K3e, K3f } \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3a, K3b, K3c, K3d, K3e, K3f } \
}
#endif

View file

@ -35,7 +35,7 @@
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, ___, ___, ___, ___, ___}, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, ___, ___, ___, ___, ___}, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, ___, ___, ___, ___, ___}, \
{ K30, K31, K32, K33, K34, K35, K35, K37, K38, K39, ___, ___, ___, ___, ___}, \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, ___, ___, ___, ___, ___}, \
{ K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, ___, ___, ___, ___, ___} \
}
@ -50,7 +50,7 @@
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0a, K0b, K0c, K0d, K0e}, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1a, K1b, K1c, K1d, K1e}, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2a, K2b, K2c, K2d, K2e}, \
{ K30, K31, K32, K33, K34, K35, K35, K37, K38, K39, K3a, K3b, K3c, K3d, K3e}, \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3a, K3b, K3c, K3d, K3e}, \
{ K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4a, K4b, K4c, K4d, K4e} \
}

View file

@ -0,0 +1,6 @@
#include "68keys.h"
void matrix_init_kb(void)
{
matrix_init_user();
}

20
keyboards/68keys/68keys.h Normal file
View file

@ -0,0 +1,20 @@
#include "quantum.h"
#define LAYOUT_68_ansi( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K10, K11, K12, K13, K14, K15, K16, \
K17, K18, K20, K21, K22, K23, K24, K25, K26, K27, K28, K30, K31, K32, K33, K34, \
K35, K36, K37, K38, K40, K41, K42, K43, K44, K45, K46, K47, K48, \
K50, K51, K52, K53, K54, K55, K56, K57, K58, K60, K61, K62, K63, \
K64, K65, K66, K67, K68, K70, K71, K72, K73, K74) \
{ \
{K00, K01, K02, K03, K04, K05, K06, K07, K08}, \
{K10, K11, K12, K13, K14, K15, K16, K17, K18}, \
{K20, K21, K22, K23, K24, K25, K26, K27, K28}, \
{K30, K31, K32, K33, K34, K35, K36, K37, K38}, \
{K40, K41, K42, K43, K44, K45, K46, K47, K48}, \
{K50, K51, K52, K53, K54, K55, K56, K57, K58}, \
{K60, K61, K62, K63, K64, K65, K66, K67, K68}, \
{ \
K70, K71, K72, K73, K74 \
} \
}

View file

@ -0,0 +1,23 @@
# 68Keys.io
Custom [68Keys.io](https://68keys.io) DIY keyboard.
Keyboard Maintainer: [sbstjn](https://sbstjn.com)
Hardware Supported: Pro Micro
Hardware Availability: [DIY Guide](https://68keys.io)
Make example for this keyboard (after setting up your build environment):
```bash
$ > cd qmk_firmware/
$ > make 68keys:default
```
Example of flashing this keyboard:
```bash
$ > cd qmk_firmware/
$ > make 68keys:default:avrdude
```
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).

42
keyboards/68keys/config.h Normal file
View file

@ -0,0 +1,42 @@
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x0A0C
#define DEVICE_VER 0x0068
#define MANUFACTURER 68Keys.io
#define PRODUCT The 68Keys.io Keyboard
#define DESCRIPTION A 68 keys mechanical keyboard
/* key matrix size */
#define MATRIX_ROWS 8
#define MATRIX_COLS 9
#define MATRIX_ROW_PINS \
{ \
B6, B2, B3, B1, F7, F6, F5, F4 \
}
#define MATRIX_COL_PINS \
{ \
D3, D2, D1, D0, D4, C6, D7, E6, B4 \
}
#define UNUSED_PINS
#define DIODE_DIRECTION COL2ROW
#define BACKLIGHT_PIN B5
#define BACKLIGHT_BREATHING
#define BACKLIGHT_LEVELS 3
#define DEBOUNCING_DELAY 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* key combination for magic key command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))

View file

@ -0,0 +1,81 @@
{
"keyboard_name": "68Keys.io",
"url": "https://68keys.io",
"maintainer": "qmk",
"width": 17.25,
"height": 5,
"layouts": {
"LAYOUT_68_ansi": {
"layout": [
{ "label": "~", "x": 0, "y": 0 },
{ "label": "!", "x": 1, "y": 0 },
{ "label": "@", "x": 2, "y": 0 },
{ "label": "#", "x": 3, "y": 0 },
{ "label": "$", "x": 4, "y": 0 },
{ "label": "%", "x": 5, "y": 0 },
{ "label": "^", "x": 6, "y": 0 },
{ "label": "&", "x": 7, "y": 0 },
{ "label": "*", "x": 8, "y": 0 },
{ "label": "(", "x": 9, "y": 0 },
{ "label": ")", "x": 10, "y": 0 },
{ "label": "_", "x": 11, "y": 0 },
{ "label": "+", "x": 12, "y": 0 },
{ "label": "Backspace", "x": 13, "y": 0, "w": 2 },
{ "label": "ESC", "x": 15.25, "y": 0 },
{ "label": "PGUP", "x": 16.25, "y": 0 },
{ "label": "Tab", "x": 0, "y": 1, "w": 1.5 },
{ "label": "Q", "x": 1.5, "y": 1 },
{ "label": "W", "x": 2.5, "y": 1 },
{ "label": "E", "x": 3.5, "y": 1 },
{ "label": "R", "x": 4.5, "y": 1 },
{ "label": "T", "x": 5.5, "y": 1 },
{ "label": "Y", "x": 6.5, "y": 1 },
{ "label": "U", "x": 7.5, "y": 1 },
{ "label": "I", "x": 8.5, "y": 1 },
{ "label": "O", "x": 9.5, "y": 1 },
{ "label": "P", "x": 10.5, "y": 1 },
{ "label": "{", "x": 11.5, "y": 1 },
{ "label": "}", "x": 12.5, "y": 1 },
{ "label": "|", "x": 13.5, "y": 1, "w": 1.5 },
{ "label": "DEL", "x": 15.25, "y": 1 },
{ "label": "PGDN", "x": 16.25, "y": 1 },
{ "label": "Caps Lock", "x": 0, "y": 2, "w": 1.75 },
{ "label": "A", "x": 1.75, "y": 2 },
{ "label": "S", "x": 2.75, "y": 2 },
{ "label": "D", "x": 3.75, "y": 2 },
{ "label": "F", "x": 4.75, "y": 2 },
{ "label": "G", "x": 5.75, "y": 2 },
{ "label": "H", "x": 6.75, "y": 2 },
{ "label": "J", "x": 7.75, "y": 2 },
{ "label": "K", "x": 8.75, "y": 2 },
{ "label": "L", "x": 9.75, "y": 2 },
{ "label": ":", "x": 10.75, "y": 2 },
{ "label": "\"", "x": 11.75, "y": 2 },
{ "label": "Enter", "x": 12.75, "y": 2, "w": 2.25 },
{ "label": "Shift", "x": 0, "y": 3, "w": 2.25 },
{ "label": "Z", "x": 2.25, "y": 3 },
{ "label": "X", "x": 3.25, "y": 3 },
{ "label": "C", "x": 4.25, "y": 3 },
{ "label": "V", "x": 5.25, "y": 3 },
{ "label": "B", "x": 6.25, "y": 3 },
{ "label": "N", "x": 7.25, "y": 3 },
{ "label": "M", "x": 8.25, "y": 3 },
{ "label": "<", "x": 9.25, "y": 3 },
{ "label": ">", "x": 10.25, "y": 3 },
{ "label": "?", "x": 11.25, "y": 3 },
{ "label": "Shift", "x": 12.25, "y": 3, "w": 2.75 },
{ "x": 15.25, "y": 3 },
{ "label": "CTRL", "x": 0, "y": 4, "w": 1.25 },
{ "label": "ALT", "x": 1.25, "y": 4, "w": 1.25 },
{ "label": "GUI", "x": 2.5, "y": 4, "w": 1.25 },
{ "x": 3.75, "y": 4, "w": 6.25 },
{ "label": "GUI", "x": 10, "y": 4, "w": 1.25 },
{ "label": "ALT", "x": 11.25, "y": 4, "w": 1.25 },
{ "label": "CTRL", "x": 12.5, "y": 4, "w": 1.25 },
{ "x": 14.25, "y": 4 },
{ "x": 15.25, "y": 4 },
{ "x": 16.25, "y": 4 }
]
}
}
}

View file

@ -0,0 +1,10 @@
#include QMK_KEYBOARD_H
#include "68keys.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_68_ansi(
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_ESC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_PGDN,
KC_CAPSLOCK, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT)};

22
keyboards/68keys/rules.mk Normal file
View file

@ -0,0 +1,22 @@
LAYOUTS = 68_ansi
MCU = atmega32u4
F_CPU = 16000000
ARCH = AVR8
F_USB = $(F_CPU)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
BOOTLOADER = atmel-dfu
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration (+1000)
MOUSEKEY_ENABLE = no # Mouse keys (+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control (+450)
CONSOLE_ENABLE = no # Console for debug (+400)
COMMAND_ENABLE = no # Commands for debug and configuration
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
NKRO_ENABLE = no # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
MIDI_ENABLE = no # MIDI controls
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = no # Audio output on port C6

View file

@ -39,11 +39,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* ws2812 RGB LED */
#define RGB_DI_PIN F7
#define RGBLIGHT_TIMER
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 6 // Number of LEDs
#define ws2812_PORTREG PORTD
#define ws2812_DDRREG DDRD
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW

View file

@ -39,10 +39,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* ws2812 RGB LED */
#define RGB_DI_PIN F7
#define RGBLIGHT_TIMER
#define RGBLED_NUM 1 // Number of LEDs
#define ws2812_PORTREG PORTD
#define ws2812_DDRREG DDRD
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW

View file

@ -1,5 +1,5 @@
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
@ -13,14 +13,11 @@ MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
#define ws2812_PORTREG PORTD
#define ws2812_DDRREG DDRD
ifndef QUANTUM_DIR
include ../../../../Makefile

View file

@ -1,5 +1,5 @@
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
@ -13,15 +13,7 @@ MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
#define ws2812_PORTREG PORTD
#define ws2812_DDRREG DDRD
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

View file

@ -13,15 +13,7 @@ MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
# Do not enable SLEEP_LED_ENABLE. It uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
#define ws2812_PORTREG PORTD
#define ws2812_DDRREG DDRD
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

View file

@ -1,5 +1,5 @@
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
@ -13,15 +13,7 @@ MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
#define ws2812_PORTREG PORTD
#define ws2812_DDRREG DDRD
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

View file

@ -13,7 +13,7 @@ MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

View file

@ -9,7 +9,7 @@ MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = yes # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

View file

@ -63,7 +63,7 @@ MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

View file

@ -0,0 +1,42 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include QMK_KEYBOARD_CONFIG_H
#define PREVENT_STUCK_MODIFIERS
#define SPACE_COUNT 2
#define TEMPLATE( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
K40, K41, K42, K44, K45, K46, K48, K49, K4B, K4C \
) LAYOUT( \
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, \
K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, \
K10, K41, K42, K30, K44, K1D, K20, K45, K3C, K0D, K2B, K3D \
)
#define TEMPLATE_NUM( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K2D, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \
K40, K41, K42, K44, K45, K46, K48, K49, K4B, K4C \
) LAYOUT( \
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, \
K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, \
K10, K41, K42, K30, K44, K1D, K20, K45, K48, K49, K2B, K3D \
)
#define TEMPLATE_RESET LAYOUT( \
RESET , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
RESET , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \
)
#endif

View file

@ -0,0 +1 @@
// This space intentionally left blank

View file

@ -0,0 +1 @@
USER_NAME := talljoe

View file

@ -10,7 +10,7 @@ MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = yes # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
ifndef QUANTUM_DIR

View file

@ -0,0 +1,6 @@
#pragma once
#define ONESHOT_TIMEOUT 3000
#define TAPPING_TERM 200
#define FORCE_NKRO
#define LEADER_TIMEOUT 1000
#define TAPPING_TOGGLE 3

View file

@ -0,0 +1,149 @@
#include QMK_KEYBOARD_H
//The current Nordic and Norwegian layout files are a mess. I'll do it myself:
//Norwegian
#define NO_AE KC_QUOT // Æ
#define NO_AO KC_LBRC // Å
#define NO_BSLS KC_EQL // Backslash
#define NO_LT KC_NUBS // <
#define NO_MINS KC_SLSH // -
#define NO_OE KC_SCLN // Ø
#define NO_PIPE KC_GRV // |
#define NO_PLUS KC_MINS // +
#define NO_QUOT KC_NUHS // '
#define NO_UMLA KC_RBRC // ¨
//Norwegian - Modifier dependant definitions
#define NO_EXLM LSFT(KC_1) // !
#define NO_DQT LSFT(KC_2) // "
#define NO_AT RALT(KC_2) // @
#define NO_HASH LSFT(KC_3) // #
#define NO_EUR LSFT(KC_4) // €
#define NO_DLR RALT(KC_4) // $
#define NO_PERC LSFT(KC_5) // %
#define NO_AND LSFT(KC_6) // &
#define NO_SLSH LSFT(KC_7) // /
#define NO_PO LSFT(KC_8) // (
#define NO_PC LSFT(KC_9) // )
#define NO_EQL LSFT(KC_0) // =
#define NO_LCBR RALT(KC_7) // {
#define NO_LBRC RALT(KC_8) // [
#define NO_RBRC RALT(KC_9) // ]
#define NO_RCBR RALT(KC_0) // }
#define NO_COLN LSFT(KC_DOT) // :
#define NO_SCLN LSFT(KC_COMM) // ;
#define NO_MU RALT(KC_M) // µ
#define NO_EURO RALT(KC_E) // €
#define NO_SECT LSFT(KC_GRV) // §
#define NO_GERC RALT(KC_COMM) // ¸
#define NO_QUAR LSFT(RALT(KC_4)) // ¼
//Norwegian layout - dependant on previous definitions
#define NO_UNDS LSFT(NO_MINS) // _
#define NO_QUES LSFT(NO_PLUS) // ?
#define NO_ACUT RALT(NO_BSLS) // Acute
#define NO_GRAV LSFT(NO_BSLS) // `
#define NO_GT LSFT(NO_LT) // >
#define NO_HALF RALT(NO_LT) // ½
#define NO_HAT LSFT(NO_UMLA) // ^
#define NO_ASTR LSFT(NO_QUOT) // *
#define NO_TILD RALT(NO_UMLA) // ~
//One Shot Modifier
#define OSM_LCTL OSM(MOD_LCTL)
#define OSM_LALT OSM(MOD_LALT)
#define OSM_LSFT OSM(MOD_LSFT)
#define OSM_LGUI OSM(MOD_LGUI)
#define OSM_RCTL OSM(MOD_RCTL)
#define OSM_RALT OSM(MOD_RALT)
#define OSM_RSFT OSM(MOD_RSFT)
#define OSM_RGUI OSM(MOD_RGUI)
//CTRL on hold, ESC on tap
#define CTL_ESC CTL_T(KC_ESC)
//Layers
#define L1 0
#define L2 1
#define L3 2
#define L4 3
#define L5 4
// Momentary switch to layer
#define MO_L2 MO(L2)
#define MO_L4 MO(L4)
#define MO_L5 MO(L5)
// Momentary switch to layer - One Shot Layer
#define OSL_L2 OSL(L2)
#define OSL_L3 OSL(L3)
#define OSL_L4 OSL(L4)
//Tap Dance Declarations
enum {
SCLN_OE = 0,
QUOT_AE,
DQT_AO
};
//Tap Dance Definitions
qk_tap_dance_action_t tap_dance_actions[] = {
//Tap once for semicolon, twice for ø
[SCLN_OE] = ACTION_TAP_DANCE_DOUBLE(NO_SCLN, NO_OE),
//Tap once for single quote, twice for æ
[QUOT_AE] = ACTION_TAP_DANCE_DOUBLE(NO_QUOT, NO_AE),
//Tap once for double quote, twice for å
[DQT_AO] = ACTION_TAP_DANCE_DOUBLE(NO_DQT, NO_AO),
// Other declarations would go here, separated by commas, if you have them
};
//Tap Dance keys
#define TD_SCLN_OE TD(SCLN_OE)
#define TD_QUOT_AE TD(QUOT_AE)
#define TD_DQT_AO TD(DQT_AO)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[L1] = LAYOUT(
KC_LGUI, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_RGUI,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, TD_DQT_AO,
KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, TD_SCLN_OE, TD_QUOT_AE,
OSM_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, NO_MINS, OSM_RSFT,
CTL_ESC, MO_L5, KC_TAB, OSM_LALT, MO_L4, OSL_L3, KC_SPC, KC_ENT, OSL_L3, MO_L4, OSM_LALT, NO_EQL, NO_PLUS, KC_RCTL
),
[L2] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NO_DQT,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, NO_SCLN, NO_QUOT,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[L3] = LAYOUT(
NO_LBRC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, NO_RBRC,
NO_LCBR, XXXXXXX, XXXXXXX, NO_AT, XXXXXXX, NO_TILD, NO_QUES, NO_EXLM, NO_PIPE, XXXXXXX, XXXXXXX, NO_RCBR,
_______, NO_ASTR, NO_BSLS, NO_DLR, NO_HASH, XXXXXXX, NO_HAT, XXXXXXX, NO_COLN, NO_SLSH, NO_SCLN, NO_QUOT,
NO_PO, KC_0, NO_SECT, NO_PERC, XXXXXXX, NO_GRAV, NO_AND, NO_UMLA, NO_LT, NO_GT, NO_UNDS, NO_PC,
XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX
),
[L4] = LAYOUT(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_HOME, KC_PGDN, KC_PGUP, KC_END, XXXXXXX, XXXXXXX,
_______, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, XXXXXXX, KC_DEL,
XXXXXXX, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, XXXXXXX, KC_APP, XXXXXXX, XXXXXXX, KC_VOLD, XXXXXXX,
OSM_LCTL, _______, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, OSM_RALT, KC_MUTE, KC_VOLU, OSM_RCTL
),
[L5] = LAYOUT(
XXXXXXX, TO(L1), TO(L2), TO(L3), TO(L4), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, KC_CAPS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
)
};
//TODO: Is there productivity gain in the use of unicode?
// - Won't work in xterm.
// Create a layer for macros and/or unicode?
// Are macros useful?
// - Found no gain in having sendstring for commands.
// - Find repeated tasks that cannot be done easily on the OS.
// - Most other keymaps have macros for game/fun stuff, hard to find "serious" onces.
// Screw Norwegian layout, switch to US with unicode æøå or US/English International?
// - Will be different from laptop keyboard, requiring a switch on the OS side when only using the laptop.

View file

@ -0,0 +1,7 @@
TAP_DANCE_ENABLE = yes
NKRO_ENABLE = true
MOUSEKEY_ENABLE = no
EXTRAKEY_ENABLE = yes
CONSOLE_ENABLE = no
KEY_LOCK_ENABLE = no
LEADER_ENABLE = no

View file

@ -0,0 +1,71 @@
/* Copyright 2018 Yiancar
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "baguette.h"
void bootmagic_lite(void)
{
// The lite version of TMK's bootmagic made by Wilba.
// 100% less potential for accidentally making the
// keyboard do stupid things.
// We need multiple scans because debouncing can't be turned off.
matrix_scan();
wait_ms(DEBOUNCING_DELAY);
matrix_scan();
// If the Esc and space bar are held down on power up,
// reset the EEPROM valid state and jump to bootloader.
// Assumes Esc is at [0,0] and spacebar is at [4,7].
// This isn't very generalized, but we need something that doesn't
// rely on user's keymaps in firmware or EEPROM.
if ( ( matrix_get_row(0) & (1<<0) ) &&
( matrix_get_row(4) & (1<<7) ) )
{
// Set the TMK/QMK EEPROM state as invalid.
eeconfig_disable();
//eeprom_set_valid(false);
// Jump to bootloader.
bootloader_jump();
}
}
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
bootmagic_lite();
matrix_init_user();
}
void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
}
void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
led_set_user(usb_led);
}

View file

@ -0,0 +1,59 @@
/* Copyright 2018 Yiancar
*
* 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/>.
*/
#ifndef BAGUETTE_H
#define BAGUETTE_H
#include "quantum.h"
/* This a shortcut to help you visually see your layout.
*
* The first section contains all of the arguments representing the physical
* layout of the board and position of the keys.
*
* The second converts the arguments into a two-dimensional array which
* represents the switch matrix.
*/
#define LAYOUT_ansi( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1F, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \
K42, K43, K47, K4B, K4C, K4D, K4E, K4F \
) \
{ \
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, KC_NO, K1F }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, KC_NO, K2D, KC_NO, KC_NO }, \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, KC_NO }, \
{ KC_NO, KC_NO, K42, K43, KC_NO, KC_NO, KC_NO, K47, KC_NO, KC_NO, KC_NO, K4B, K4C, K4D, K4E, K4F } \
}
#define LAYOUT_iso( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1F, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K1D, K2D, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \
K42, K43, K47, K4B, K4C, K4D, K4E, K4F \
) \
{ \
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, KC_NO, KC_NO, K1F }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K1D, K2D, KC_NO, KC_NO }, \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, KC_NO }, \
{ KC_NO, KC_NO, K42, K43, KC_NO, KC_NO, KC_NO, K47, KC_NO, KC_NO, KC_NO, K4B, K4C, K4D, K4E, K4F } \
}
#endif

224
keyboards/baguette/config.h Normal file
View file

@ -0,0 +1,224 @@
/*
Copyright 2018 Yiancar
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x5050
#define DEVICE_VER 0x0001
#define MANUFACTURER Yiancar
#define PRODUCT Baguette
#define DESCRIPTION A French Custom
/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 16
/*
* Keyboard Matrix Assignments
*
* Change this to how you wired your keyboard
* COLS: AVR pins used for columns, left to right
* ROWS: AVR pins used for rows, top to bottom
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
*
*/
#define MATRIX_ROW_PINS { B3, B2, B1, E6, D6 }
#define MATRIX_COL_PINS { B6, C6, C7, F7, F6, F5, F4, F1, F0, B0, D0, D1, D2, D3, D5, D4 }
#define UNUSED_PINS
/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
#define DIODE_DIRECTION COL2ROW
#define BACKLIGHT_PIN B7
#define BACKLIGHT_BREATHING
#define BACKLIGHT_LEVELS 5
// #define RGB_DI_PIN E2
// #ifdef RGB_DI_PIN
// #define RGBLIGHT_ANIMATIONS
// #define RGBLED_NUM 16
// #define RGBLIGHT_HUE_STEP 8
// #define RGBLIGHT_SAT_STEP 8
// #define RGBLIGHT_VAL_STEP 8
// #endif
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCING_DELAY 5
/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST
/* number of backlight levels */
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
* This is userful for the Windows task manager shortcut (ctrl+shift+esc).
*/
// #define GRAVE_ESC_CTRL_OVERRIDE
/*
* Force NKRO
*
* Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
* state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
* makefile for this to work.)
*
* If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
* until the next keyboard reset.
*
* NKRO may prevent your keystrokes from being detected in the BIOS, but it is
* fully operational during normal computer usage.
*
* For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
* or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
* bootmagic, NKRO mode will always be enabled until it is toggled again during a
* power-up.
*
*/
//#define FORCE_NKRO
/*
* Magic Key Options
*
* Magic keys are hotkey commands that allow control over firmware functions of
* the keyboard. They are best used in combination with the HID Listen program,
* found here: https://www.pjrc.com/teensy/hid_listen.html
*
* The options below allow the magic key functionality to be changed. This is
* useful if your keyboard/keypad is missing keys and you want magic key support.
*
*/
/* key combination for magic key command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/* control how magic key switches layers */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
/* override magic key keymap */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
//#define MAGIC_KEY_HELP1 H
//#define MAGIC_KEY_HELP2 SLASH
//#define MAGIC_KEY_DEBUG D
//#define MAGIC_KEY_DEBUG_MATRIX X
//#define MAGIC_KEY_DEBUG_KBD K
//#define MAGIC_KEY_DEBUG_MOUSE M
//#define MAGIC_KEY_VERSION V
//#define MAGIC_KEY_STATUS S
//#define MAGIC_KEY_CONSOLE C
//#define MAGIC_KEY_LAYER0_ALT1 ESC
//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
//#define MAGIC_KEY_LAYER0 0
//#define MAGIC_KEY_LAYER1 1
//#define MAGIC_KEY_LAYER2 2
//#define MAGIC_KEY_LAYER3 3
//#define MAGIC_KEY_LAYER4 4
//#define MAGIC_KEY_LAYER5 5
//#define MAGIC_KEY_LAYER6 6
//#define MAGIC_KEY_LAYER7 7
//#define MAGIC_KEY_LAYER8 8
//#define MAGIC_KEY_LAYER9 9
//#define MAGIC_KEY_BOOTLOADER PAUSE
//#define MAGIC_KEY_LOCK CAPS
//#define MAGIC_KEY_EEPROM E
//#define MAGIC_KEY_NKRO N
//#define MAGIC_KEY_SLEEP_LED Z
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
//#define NO_DEBUG
/* disable print */
//#define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
/*
* MIDI options
*/
/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
//#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 1
/*
* HD44780 LCD Display Configuration
*/
/*
#define LCD_LINES 2 //< number of visible lines of the display
#define LCD_DISP_LENGTH 16 //< visibles characters per line of the display
#define LCD_IO_MODE 1 //< 0: memory mapped mode, 1: IO port mode
#if LCD_IO_MODE
#define LCD_PORT PORTB //< port for the LCD lines
#define LCD_DATA0_PORT LCD_PORT //< port for 4bit data bit 0
#define LCD_DATA1_PORT LCD_PORT //< port for 4bit data bit 1
#define LCD_DATA2_PORT LCD_PORT //< port for 4bit data bit 2
#define LCD_DATA3_PORT LCD_PORT //< port for 4bit data bit 3
#define LCD_DATA0_PIN 4 //< pin for 4bit data bit 0
#define LCD_DATA1_PIN 5 //< pin for 4bit data bit 1
#define LCD_DATA2_PIN 6 //< pin for 4bit data bit 2
#define LCD_DATA3_PIN 7 //< pin for 4bit data bit 3
#define LCD_RS_PORT LCD_PORT //< port for RS line
#define LCD_RS_PIN 3 //< pin for RS line
#define LCD_RW_PORT LCD_PORT //< port for RW line
#define LCD_RW_PIN 2 //< pin for RW line
#define LCD_E_PORT LCD_PORT //< port for Enable line
#define LCD_E_PIN 1 //< pin for Enable line
#endif
*/

View file

@ -0,0 +1,16 @@
{
"keyboard_name": "Baguette",
"url": "",
"maintainer": "qmk",
"bootloader": "atmel-dfu",
"width": 19.75,
"height": 6.5,
"layouts": {
"LAYOUT_ansi": {
"layout": [{"label":"~", "x":3.25, "y":1.5}, {"label":"!", "x":4.25, "y":1.5}, {"label":"@", "x":5.25, "y":1.5}, {"label":"#", "x":6.25, "y":1.5}, {"label":"$", "x":7.25, "y":1.5}, {"label":"%", "x":8.25, "y":1.5}, {"label":"^", "x":9.25, "y":1.5}, {"label":"&", "x":10.25, "y":1.5}, {"label":"*", "x":11.25, "y":1.5}, {"label":"(", "x":12.25, "y":1.5}, {"label":")", "x":13.25, "y":1.5}, {"label":"_", "x":14.25, "y":1.5}, {"label":"+", "x":15.25, "y":1.5}, {"label":"|", "x":16.25, "y":1.5}, {"label":"Del", "x":17.25, "y":1.5}, {"label":"Insert", "x":18.75, "y":1.5}, {"label":"Tab", "x":3.25, "y":2.5, "w":1.5}, {"label":"Q", "x":4.75, "y":2.5}, {"label":"W", "x":5.75, "y":2.5}, {"label":"E", "x":6.75, "y":2.5}, {"label":"R", "x":7.75, "y":2.5}, {"label":"T", "x":8.75, "y":2.5}, {"label":"Y", "x":9.75, "y":2.5}, {"label":"U", "x":10.75, "y":2.5}, {"label":"I", "x":11.75, "y":2.5}, {"label":"O", "x":12.75, "y":2.5}, {"label":"P", "x":13.75, "y":2.5}, {"label":"{", "x":14.75, "y":2.5}, {"label":"}", "x":15.75, "y":2.5}, {"label":"|", "x":16.75, "y":2.5, "w":1.5}, {"label":"Delete", "x":18.75, "y":2.5}, {"label":"Control", "x":3.25, "y":3.5, "w":1.75}, {"label":"A", "x":5, "y":3.5}, {"label":"S", "x":6, "y":3.5}, {"label":"D", "x":7, "y":3.5}, {"label":"F", "x":8, "y":3.5}, {"label":"G", "x":9, "y":3.5}, {"label":"H", "x":10, "y":3.5}, {"label":"J", "x":11, "y":3.5}, {"label":"K", "x":12, "y":3.5}, {"label":"L", "x":13, "y":3.5}, {"label":":", "x":14, "y":3.5}, {"label":"\"", "x":15, "y":3.5}, {"label":"Enter", "x":16, "y":3.5, "w":2.25}, {"x":3.25, "y":4.5, "w":1.25}, {"x":4.5, "y":4.5}, {"label":"Z", "x":5.5, "y":4.5}, {"label":"X", "x":6.5, "y":4.5}, {"label":"C", "x":7.5, "y":4.5}, {"label":"V", "x":8.5, "y":4.5}, {"label":"B", "x":9.5, "y":4.5}, {"label":"N", "x":10.5, "y":4.5}, {"label":"M", "x":11.5, "y":4.5}, {"label":"<", "x":12.5, "y":4.5}, {"label":">", "x":13.5, "y":4.5}, {"label":"?", "x":14.5, "y":4.5}, {"x":15.5, "y":4.5}, {"label":"Shift", "x":16.5, "y":4.5, "w":1.25}, {"label":"\u2191", "x":17.75, "y":4.5}, {"label":"Win", "x":4.5, "y":5.5}, {"label":"Alt", "x":5.5, "y":5.5, "w":1.25}, {"x":6.75, "y":5.5, "w":6.25}, {"label":"Ctrl", "x":13, "y":5.5, "w":1.25}, {"label":"Fn", "x":14.25, "y":5.5}, {"label":"\u2190", "x":16.75, "y":5.5}, {"label":"\u2193", "x":17.75, "y":5.5}, {"label":"\u2192", "x":18.75, "y":5.5}]
},
"LAYOUT_iso": {
"layout": [{"label":"~", "x":3.25, "y":1.5}, {"label":"!", "x":4.25, "y":1.5}, {"label":"@", "x":5.25, "y":1.5}, {"label":"#", "x":6.25, "y":1.5}, {"label":"$", "x":7.25, "y":1.5}, {"label":"%", "x":8.25, "y":1.5}, {"label":"^", "x":9.25, "y":1.5}, {"label":"&", "x":10.25, "y":1.5}, {"label":"*", "x":11.25, "y":1.5}, {"label":"(", "x":12.25, "y":1.5}, {"label":")", "x":13.25, "y":1.5}, {"label":"_", "x":14.25, "y":1.5}, {"label":"+", "x":15.25, "y":1.5}, {"label":"|", "x":16.25, "y":1.5}, {"label":"Del", "x":17.25, "y":1.5}, {"label":"Insert", "x":18.75, "y":1.5}, {"label":"Tab", "x":3.25, "y":2.5, "w":1.5}, {"label":"Q", "x":4.75, "y":2.5}, {"label":"W", "x":5.75, "y":2.5}, {"label":"E", "x":6.75, "y":2.5}, {"label":"R", "x":7.75, "y":2.5}, {"label":"T", "x":8.75, "y":2.5}, {"label":"Y", "x":9.75, "y":2.5}, {"label":"U", "x":10.75, "y":2.5}, {"label":"I", "x":11.75, "y":2.5}, {"label":"O", "x":12.75, "y":2.5}, {"label":"P", "x":13.75, "y":2.5}, {"label":"{", "x":14.75, "y":2.5}, {"label":"}", "x":15.75, "y":2.5}, {"label":"Enter", "x":17, "y":2.5, "w":1.25, "h":2}, {"label":"Delete", "x":18.75, "y":2.5}, {"label":"Control", "x":3.25, "y":3.5, "w":1.75}, {"label":"A", "x":5, "y":3.5}, {"label":"S", "x":6, "y":3.5}, {"label":"D", "x":7, "y":3.5}, {"label":"F", "x":8, "y":3.5}, {"label":"G", "x":9, "y":3.5}, {"label":"H", "x":10, "y":3.5}, {"label":"J", "x":11, "y":3.5}, {"label":"K", "x":12, "y":3.5}, {"label":"L", "x":13, "y":3.5}, {"label":":", "x":14, "y":3.5}, {"label":"\"", "x":15, "y":3.5}, {"x":16, "y":3.5}, {"x":3.25, "y":4.5, "w":1.25}, {"x":4.5, "y":4.5}, {"label":"Z", "x":5.5, "y":4.5}, {"label":"X", "x":6.5, "y":4.5}, {"label":"C", "x":7.5, "y":4.5}, {"label":"V", "x":8.5, "y":4.5}, {"label":"B", "x":9.5, "y":4.5}, {"label":"N", "x":10.5, "y":4.5}, {"label":"M", "x":11.5, "y":4.5}, {"label":"<", "x":12.5, "y":4.5}, {"label":">", "x":13.5, "y":4.5}, {"label":"?", "x":14.5, "y":4.5}, {"x":15.5, "y":4.5}, {"label":"Shift", "x":16.5, "y":4.5, "w":1.25}, {"label":"\u2191", "x":17.75, "y":4.5}, {"label":"Win", "x":4.5, "y":5.5}, {"label":"Alt", "x":5.5, "y":5.5, "w":1.25}, {"x":6.75, "y":5.5, "w":6.25}, {"label":"Ctrl", "x":13, "y":5.5, "w":1.25}, {"label":"Fn", "x":14.25, "y":5.5}, {"label":"\u2190", "x":16.75, "y":5.5}, {"label":"\u2193", "x":17.75, "y":5.5}, {"label":"\u2192", "x":18.75, "y":5.5}]
}
}
}

View file

@ -0,0 +1,50 @@
/* Copyright 2018 Yiancar
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_ansi( /* Base */
KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_TRNS, KC_INS,\
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL,\
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \
KC_LSFT, KC_TRNS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, KC_RSFT, KC_UP, \
KC_LGUI, KC_LALT, KC_SPC, KC_RCTL, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
[1] = LAYOUT_ansi( /* FN */
KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_TRNS, BL_TOGG, BL_STEP, BL_BRTG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_RCTL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
void matrix_init_user(void) {
}
void matrix_scan_user(void) {
}
void led_set_user(uint8_t usb_led) {
}

View file

@ -0,0 +1,9 @@
# The default ANSI keymap for baguette
Typical ANSI keymap. Please note:
- Left key from split backspace is connected to 2u key.
- Left key from split left Shift is connected to 2u key.
- Right key from split right Shift is connected to 2u key.
- Backlight control is on the Z, X and C keys of the FN layer.
- Reset key combination is FN + ].
- Holding ESC and Space while plugging in the USB erases the EEPROM.

View file

@ -0,0 +1,50 @@
/* Copyright 2018 Yiancar
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_iso( /* Base */
KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_TRNS, KC_INS,\
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL,\
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_QUOT, KC_ENT, \
KC_LSFT, KC_TRNS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS, KC_RSFT, KC_UP, \
KC_LGUI, KC_LALT, KC_SPC, KC_RCTL, MO(1), KC_LEFT, KC_DOWN, KC_RGHT),
[0] = LAYOUT_iso( /* FN */
KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_TRNS, BL_TOGG, BL_STEP, BL_BRTG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_RCTL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
void matrix_init_user(void) {
}
void matrix_scan_user(void) {
}
void led_set_user(uint8_t usb_led) {
}

View file

@ -0,0 +1,10 @@
# The default ISO keymap for baguette
Typical ISO keymap. Please note:
- Left key from split backspace is connected to 2u key.
- Left key from split left Shift is connected to 2u key.
- Right key from split right Shift is connected to 2u key.
- Backlight control is on the Z, X and C keys of the FN layer.
- Reset key combination is FN + ].
- Holding ESC and Space while plugging in the USB erases the EEPROM.

View file

@ -0,0 +1,16 @@
Baguette
========
![Baguette](https://cdn.discordapp.com/attachments/426880953143525384/479788409263489035/scecre2.png)
This is a custom keyboard with backlight inspired by France.
Keyboard Maintainer: [Yiancar](http://yiancar-designs.com/) and on [github](https://github.com/yiancar)
Hardware Supported: ATMEGA 32u4 MCU with backlight support.
Hardware Availability: Closed group-buy please contact the runners (Tesletron and Enjoy)
Make example for this keyboard (after setting up your build environment):
make baguette:default
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).

View file

@ -0,0 +1,81 @@
# MCU name
#MCU = at90usb1286
MCU = atmega32u4
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
# This will be an integer division of F_USB below, as it is sourced by
# F_USB after it has run through any CPU prescalers. Note that this value
# does not *change* the processor frequency - it should merely be updated to
# reflect the processor speed set externally so that the code can use accurate
# software delays.
F_CPU = 16000000
#
# LUFA specific
#
# Target architecture (see library "Board Types" documentation).
ARCH = AVR8
# Input clock frequency.
# This will define a symbol, F_USB, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
# at the end, this will be done automatically to create a 32-bit value in your
# source code.
#
# If no clock division is performed on the input clock inside the AVR (via the
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# Bootloader selection
# Teensy halfkay
# Pro Micro caterina
# Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# atmega32a bootloadHID
BOOTLOADER = atmel-dfu
# If you don't know the bootloader type, then you can specify the
# Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line
# Teensy halfKay 512
# Teensy++ halfKay 1024
# Atmel DFU loader 4096
# LUFA bootloader 4096
# USBaspLoader 2048
# OPT_DEFS += -DBOOTLOADER_SIZE=4096
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = no # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = no # USB Nkey Rollover
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = no # Audio output on port C6
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)

View file

@ -53,7 +53,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* ws2812 RGB LED */
#define RGB_DI_PIN B4
#define RGBLIGHT_TIMER
#define RGBLED_NUM 20 // Number of LEDs
/*

View file

@ -63,7 +63,7 @@ MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

View file

@ -26,10 +26,12 @@ void matrix_init_user(void) {
__attribute__ ((weak))
void matrix_scan_user(void) {
#if defined(RGBLIGHT_ENABLE)
if (runonce && timer_elapsed(my_timer) > 1000) {
runonce = false;
rgblight_sethsv_noeeprom(0x0, 0xff, 0x80);
rgblight_mode_noeeprom(9);
rgblight_enable_noeeprom();
}
#endif
}

View file

@ -21,7 +21,6 @@
#define MATRIX_ROW_PINS { B4 }
#undef MATRIX_COL_PINS
#define MATRIX_COL_PINS { B6 }
//#define UNUSED_PINS
/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
#undef DIODE_DIRECTION
@ -32,14 +31,12 @@
#define BACKLIGHT_LEVELS 3
#define BREATHING_PERIOD 5
/* for Tap Dance */
#undef TAPPING_TERM
#define TAPPING_TERM 700
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
//#define DEBOUNCING_DELAY 5
#undef DEBOUNCING_DELAY
#define DEBOUNCING_DELAY 2
#define DEBOUNCING_DELAY 5
// set flashing LED with QMK DFU
#define QMK_LED B0
// set audio pin
#define C6_AUDIO

View file

@ -20,8 +20,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT( /* Base */
TD(CAD_TD) \
),
};
void led_set_user(uint8_t usb_led) {
}
[1] = LAYOUT( /*Secondary*/
TD(BSW_TAP_DANCE) \
),
};

View file

@ -1,7 +1,16 @@
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default
#If using a ProMicro and it has the QMK DFU bootloader instead of Caterina,
#run "make <keyboard>:<keymap> dfu=qmk" when compiling to ensure it is flagged properly after being flashed
ifeq ($(strip $(dfu)), qmk)
BOOTLOADER = qmk-dfu
endif
endif
AUDIO_ENABLE = yes # Audio output on port C6
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = no # Commands for debug and configuration
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)

View file

@ -51,11 +51,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* ws2812 RGB LED */
#define RGB_DI_PIN B1
#define RGBLIGHT_TIMER
#define RGBLED_NUM 4
#define ws2812_PORTREG PORTB
#define ws2812_DDRREG DDRB
#define RGBLED_NUM 4
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17

View file

@ -38,6 +38,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
{ K07, K17, K27, K37, K47, K57, K67, K77, KC_NO, KC_NO, KA7, KB7, KC7, KD7, KE7 } \
}
#define LAYOUT_splitbs( \
K05, K25, K35, K45, K55, K06, KA6, KA7, K07, KB5, KC5, KD5, KE5, KD1, KE1, KE2, \
K04, K14, K24, K34, K44, K54, K16, KB6, KB7, K17, KA4, KB4, KC4, KE4, KD4, KD0, \
K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3, KC3, KD3, K67, \
K02, K12, K22, K32, K42, K52, K36, KD6, KD7, K37, KA2, KB2, KD2, KE0, \
K01, K11, K21, K31, K41, K51, K46, KE6, KE7, K47, KA1, KB1, K86, K77, \
K00, K10, K20, K56, K57, KB0, KC0, K66, K76, K96 \
){ \
{ K00, K10, K20, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KB0, KC0, KD0, KE0 }, \
{ K01, K11, K21, K31, K41, K51, KC_NO, KC_NO, KC_NO, KC_NO, KA1, KB1, KC_NO, KD1, KE1 }, \
{ K02, K12, K22, K32, K42, K52, KC_NO, KC_NO, KC_NO, KC_NO, KA2, KB2, KC_NO, KD2, KE2 }, \
{ K03, K13, K23, K33, K43, K53, KC_NO, KC_NO, KC_NO, KC_NO, KA3, KB3, KC3, KD3, KC_NO }, \
{ K04, K14, K24, K34, K44, K54, KC_NO, KC_NO, KC_NO, KC_NO, KA4, KB4, KC4, KD4, KE4 }, \
{ K05, KC_NO, K25, K35, K45, K55, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KB5, KC5, KD5, KE5 }, \
{ K06, K16, K26, K36, K46, K56, K66, K76, K86, K96, KA6, KB6, KC6, KD6, KE6 }, \
{ K07, K17, K27, K37, K47, K57, K67, K77, KC_NO, KC_NO, KA7, KB7, KC7, KD7, KE7 } \
}
#define LAYOUT_kc( \
K05, K25, K35, K45, K55, K06, KA6, KA7, K07, KB5, KC5, KD5, KE5, KD1, KE1, KE2, \
K04, K14, K24, K34, K44, K54, K16, KB6, KB7, K17, KA4, KB4, KC4, KE4, KD0, \

View file

@ -8,6 +8,10 @@
"LAYOUT": {
"key_count": 84,
"layout": [{"label":"K05", "x":0, "y":0}, {"label":"K25", "x":1, "y":0}, {"label":"K35", "x":2, "y":0}, {"label":"K45", "x":3, "y":0}, {"label":"K55", "x":4, "y":0}, {"label":"K06", "x":5, "y":0}, {"label":"KA6", "x":6, "y":0}, {"label":"KA7", "x":7, "y":0}, {"label":"K07", "x":8, "y":0}, {"label":"KB5", "x":9, "y":0}, {"label":"KC5", "x":10, "y":0}, {"label":"KD5", "x":11, "y":0}, {"label":"KE5", "x":12, "y":0}, {"label":"KD1", "x":13, "y":0}, {"label":"KE1", "x":14, "y":0}, {"label":"KE2", "x":15, "y":0}, {"label":"K04", "x":0, "y":1}, {"label":"K14", "x":1, "y":1}, {"label":"K24", "x":2, "y":1}, {"label":"K34", "x":3, "y":1}, {"label":"K44", "x":4, "y":1}, {"label":"K54", "x":5, "y":1}, {"label":"K16", "x":6, "y":1}, {"label":"KB6", "x":7, "y":1}, {"label":"KB7", "x":8, "y":1}, {"label":"K17", "x":9, "y":1}, {"label":"KA4", "x":10, "y":1}, {"label":"KB4", "x":11, "y":1}, {"label":"KC4", "x":12, "y":1}, {"label":"KE4", "x":13, "y":1, "w":2}, {"label":"KD0", "x":15, "y":1}, {"label":"K03", "x":0, "y":2, "w":1.5}, {"label":"K13", "x":1.5, "y":2}, {"label":"K23", "x":2.5, "y":2}, {"label":"K33", "x":3.5, "y":2}, {"label":"K43", "x":4.5, "y":2}, {"label":"K53", "x":5.5, "y":2}, {"label":"K26", "x":6.5, "y":2}, {"label":"KC6", "x":7.5, "y":2}, {"label":"KC7", "x":8.5, "y":2}, {"label":"K27", "x":9.5, "y":2}, {"label":"KA3", "x":10.5, "y":2}, {"label":"KB3", "x":11.5, "y":2}, {"label":"KC3", "x":12.5, "y":2}, {"label":"KD3", "x":13.5, "y":2, "w":1.5}, {"label":"K67", "x":15, "y":2}, {"label":"K02", "x":0, "y":3, "w":1.75}, {"label":"K12", "x":1.75, "y":3}, {"label":"K22", "x":2.75, "y":3}, {"label":"K32", "x":3.75, "y":3}, {"label":"K42", "x":4.75, "y":3}, {"label":"K52", "x":5.75, "y":3}, {"label":"K36", "x":6.75, "y":3}, {"label":"KD6", "x":7.75, "y":3}, {"label":"KD7", "x":8.75, "y":3}, {"label":"K37", "x":9.75, "y":3}, {"label":"KA2", "x":10.75, "y":3}, {"label":"KB2", "x":11.75, "y":3}, {"label":"KD2", "x":12.75, "y":3, "w":2.25}, {"label":"KE0", "x":15, "y":3}, {"label":"K01", "x":0, "y":4, "w":2.25}, {"label":"K11", "x":2.25, "y":4}, {"label":"K21", "x":3.25, "y":4}, {"label":"K31", "x":4.25, "y":4}, {"label":"K41", "x":5.25, "y":4}, {"label":"K51", "x":6.25, "y":4}, {"label":"K46", "x":7.25, "y":4}, {"label":"KE6", "x":8.25, "y":4}, {"label":"KE7", "x":9.25, "y":4}, {"label":"K47", "x":10.25, "y":4}, {"label":"KA1", "x":11.25, "y":4}, {"label":"KB1", "x":12.25, "y":4, "w":1.75}, {"label":"K86", "x":14, "y":4}, {"label":"K77", "x":15, "y":4}, {"label":"K00", "x":0, "y":5, "w":1.25}, {"label":"K10", "x":1.25, "y":5, "w":1.25}, {"label":"K20", "x":2.5, "y":5, "w":1.25}, {"label":"K56", "x":3.75, "y":5, "w":6.25}, {"label":"K57", "x":10, "y":5}, {"label":"KB0", "x":11, "y":5}, {"label":"KC0", "x":12, "y":5}, {"label":"K66", "x":13, "y":5}, {"label":"K76", "x":14, "y":5}, {"label":"K96", "x":15, "y":5}]
},
"LAYOUT_splitbs": {
"key_count": 85,
"layout": [{"label":"K05", "x":0, "y":0}, {"label":"K25", "x":1, "y":0}, {"label":"K35", "x":2, "y":0}, {"label":"K45", "x":3, "y":0}, {"label":"K55", "x":4, "y":0}, {"label":"K06", "x":5, "y":0}, {"label":"KA6", "x":6, "y":0}, {"label":"KA7", "x":7, "y":0}, {"label":"K07", "x":8, "y":0}, {"label":"KB5", "x":9, "y":0}, {"label":"KC5", "x":10, "y":0}, {"label":"KD5", "x":11, "y":0}, {"label":"KE5", "x":12, "y":0}, {"label":"KD1", "x":13, "y":0}, {"label":"KE1", "x":14, "y":0}, {"label":"KE2", "x":15, "y":0}, {"label":"K04", "x":0, "y":1}, {"label":"K14", "x":1, "y":1}, {"label":"K24", "x":2, "y":1}, {"label":"K34", "x":3, "y":1}, {"label":"K44", "x":4, "y":1}, {"label":"K54", "x":5, "y":1}, {"label":"K16", "x":6, "y":1}, {"label":"KB6", "x":7, "y":1}, {"label":"KB7", "x":8, "y":1}, {"label":"K17", "x":9, "y":1}, {"label":"KA4", "x":10, "y":1}, {"label":"KB4", "x":11, "y":1}, {"label":"KC4", "x":12, "y":1}, {"label":"KE4", "x":13, "y":1}, {"label":"KD4", "x":14, "y":1}, {"label":"KD0", "x":15, "y":1}, {"label":"K03", "x":0, "y":2, "w":1.5}, {"label":"K13", "x":1.5, "y":2}, {"label":"K23", "x":2.5, "y":2}, {"label":"K33", "x":3.5, "y":2}, {"label":"K43", "x":4.5, "y":2}, {"label":"K53", "x":5.5, "y":2}, {"label":"K26", "x":6.5, "y":2}, {"label":"KC6", "x":7.5, "y":2}, {"label":"KC7", "x":8.5, "y":2}, {"label":"K27", "x":9.5, "y":2}, {"label":"KA3", "x":10.5, "y":2}, {"label":"KB3", "x":11.5, "y":2}, {"label":"KC3", "x":12.5, "y":2}, {"label":"KD3", "x":13.5, "y":2, "w":1.5}, {"label":"K67", "x":15, "y":2}, {"label":"K02", "x":0, "y":3, "w":1.75}, {"label":"K12", "x":1.75, "y":3}, {"label":"K22", "x":2.75, "y":3}, {"label":"K32", "x":3.75, "y":3}, {"label":"K42", "x":4.75, "y":3}, {"label":"K52", "x":5.75, "y":3}, {"label":"K36", "x":6.75, "y":3}, {"label":"KD6", "x":7.75, "y":3}, {"label":"KD7", "x":8.75, "y":3}, {"label":"K37", "x":9.75, "y":3}, {"label":"KA2", "x":10.75, "y":3}, {"label":"KB2", "x":11.75, "y":3}, {"label":"KD2", "x":12.75, "y":3, "w":2.25}, {"label":"KE0", "x":15, "y":3}, {"label":"K01", "x":0, "y":4, "w":2.25}, {"label":"K11", "x":2.25, "y":4}, {"label":"K21", "x":3.25, "y":4}, {"label":"K31", "x":4.25, "y":4}, {"label":"K41", "x":5.25, "y":4}, {"label":"K51", "x":6.25, "y":4}, {"label":"K46", "x":7.25, "y":4}, {"label":"KE6", "x":8.25, "y":4}, {"label":"KE7", "x":9.25, "y":4}, {"label":"K47", "x":10.25, "y":4}, {"label":"KA1", "x":11.25, "y":4}, {"label":"KB1", "x":12.25, "y":4, "w":1.75}, {"label":"K86", "x":14, "y":4}, {"label":"K77", "x":15, "y":4}, {"label":"K00", "x":0, "y":5, "w":1.25}, {"label":"K10", "x":1.25, "y":5, "w":1.25}, {"label":"K20", "x":2.5, "y":5, "w":1.25}, {"label":"K56", "x":3.75, "y":5, "w":6.25}, {"label":"K57", "x":10, "y":5}, {"label":"KB0", "x":11, "y":5}, {"label":"KC0", "x":12, "y":5}, {"label":"K66", "x":13, "y":5}, {"label":"K76", "x":14, "y":5}, {"label":"K96", "x":15, "y":5}]
}
}
}

View file

@ -0,0 +1,211 @@
/**
* Backlighting code for PS2AVRGB boards (ATMEGA32A)
* Kenneth A. (github.com/krusli | krusli.me)
*/
#include "backlight.h"
#include "quantum.h"
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include "backlight_custom.h"
#include "breathing_custom.h"
// DEBUG
#include <stdlib.h>
#include <stdio.h>
// Port D: digital pins of the AVR chipset
#define NUMLOCK_PORT (1 << 0) // D0
#define CAPSLOCK_PORT (1 << 1) // D1
#define BACKLIGHT_PORT (1 << 4) // D4
#define SCROLLLOCK_PORT (1 << 6) // D6
#define TIMER_CLK_DIV64 0x03 ///< Timer clocked at F_CPU/64
#define TIMER1PRESCALE TIMER_CLK_DIV64 ///< timer 1 prescaler default
#define TIMER_PRESCALE_MASK 0x07 ///< Timer Prescaler Bit-Mask
#define PWM_MAX 0xFF
#define TIMER_TOP 255 // 8 bit PWM
extern backlight_config_t backlight_config;
/**
* References
* Port Registers: https://www.arduino.cc/en/Reference/PortManipulation
* TCCR1A: https://electronics.stackexchange.com/questions/92350/what-is-the-difference-between-tccr1a-and-tccr1b
* Timers: http://www.avrbeginners.net/architecture/timers/timers.html
* 16-bit timer setup: http://sculland.com/ATmega168/Interrupts-And-Timers/16-Bit-Timer-Setup/
* PS2AVRGB firmware: https://github.com/showjean/ps2avrU/tree/master/firmware
*/
// @Override
// turn LEDs on and off depending on USB caps/num/scroll lock states.
__attribute__ ((weak))
void led_set_user(uint8_t usb_led) {
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
// turn on
DDRD |= NUMLOCK_PORT;
PORTD |= NUMLOCK_PORT;
} else {
// turn off
DDRD &= ~NUMLOCK_PORT;
PORTD &= ~NUMLOCK_PORT;
}
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
DDRD |= CAPSLOCK_PORT;
PORTD |= CAPSLOCK_PORT;
} else {
DDRD &= ~CAPSLOCK_PORT;
PORTD &= ~CAPSLOCK_PORT;
}
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
DDRD |= SCROLLLOCK_PORT;
PORTD |= SCROLLLOCK_PORT;
} else {
DDRD &= ~SCROLLLOCK_PORT;
PORTD &= ~SCROLLLOCK_PORT;
}
}
#ifdef BACKLIGHT_ENABLE
// sets up Timer 1 for 8-bit PWM
void timer1PWMSetup(void) { // NOTE ONLY CALL THIS ONCE
// default 8 bit mode
TCCR1A &= ~(1 << 1); // cbi(TCCR1A,PWM11); <- set PWM11 bit to HIGH
TCCR1A |= (1 << 0); // sbi(TCCR1A,PWM10); <- set PWM10 bit to LOW
// clear output compare value A
// outb(OCR1AH, 0);
// outb(OCR1AL, 0);
// clear output comparator registers for B
OCR1BH = 0; // outb(OCR1BH, 0);
OCR1BL = 0; // outb(OCR1BL, 0);
}
bool is_init = false;
void timer1Init(void) {
// timer1SetPrescaler(TIMER1PRESCALE)
// set to DIV/64
(TCCR1B) = ((TCCR1B) & ~TIMER_PRESCALE_MASK) | TIMER1PRESCALE;
// reset TCNT1
TCNT1H = 0; // outb(TCNT1H, 0);
TCNT1L = 0; // outb(TCNT1L, 0);
// TOIE1: Timer Overflow Interrupt Enable (Timer 1);
TIMSK |= _BV(TOIE1); // sbi(TIMSK, TOIE1);
is_init = true;
}
void timer1UnInit(void) {
// set prescaler back to NONE
(TCCR1B) = ((TCCR1B) & ~TIMER_PRESCALE_MASK) | 0x00; // TIMERRTC_CLK_STOP
// disable timer overflow interrupt
TIMSK &= ~_BV(TOIE1); // overflow bit?
setPWM(0);
is_init = false;
}
// handle TCNT1 overflow
//! Interrupt handler for tcnt1 overflow interrupt
ISR(TIMER1_OVF_vect, ISR_NOBLOCK)
{
// sei();
// handle breathing here
#ifdef BACKLIGHT_BREATHING
if (is_breathing()) {
custom_breathing_handler();
}
#endif
}
// enable timer 1 PWM
// timer1PWMBOn()
void timer1PWMBEnable(void) {
// turn on channel B (OC1B) PWM output
// set OC1B as non-inverted PWM
TCCR1A |= _BV(COM1B1);
TCCR1A &= ~_BV(COM1B0);
}
// disable timer 1 PWM
// timer1PWMBOff()
void timer1PWMBDisable(void) {
TCCR1A &= ~_BV(COM1B1);
TCCR1A &= ~_BV(COM1B0);
}
void enableBacklight(void) {
DDRD |= BACKLIGHT_PORT; // set digital pin 4 as output
PORTD |= BACKLIGHT_PORT; // set digital pin 4 to high
}
void disableBacklight(void) {
// DDRD &= ~BACKLIGHT_PORT; // set digital pin 4 as input
PORTD &= ~BACKLIGHT_PORT; // set digital pin 4 to low
}
void startPWM(void) {
timer1Init();
timer1PWMBEnable();
enableBacklight();
}
void stopPWM(void) {
timer1UnInit();
disableBacklight();
timer1PWMBDisable();
}
void b_led_init_ports(void) {
/* turn backlight on/off depending on user preference */
#if BACKLIGHT_ON_STATE == 0
// DDRx register: sets the direction of Port D
// DDRD &= ~BACKLIGHT_PORT; // set digital pin 4 as input
PORTD &= ~BACKLIGHT_PORT; // set digital pin 4 to low
#else
DDRD |= BACKLIGHT_PORT; // set digital pin 4 as output
PORTD |= BACKLIGHT_PORT; // set digital pin 4 to high
#endif
timer1PWMSetup();
startPWM();
#ifdef BACKLIGHT_BREATHING
breathing_enable();
#endif
}
void b_led_set(uint8_t level) {
if (level > BACKLIGHT_LEVELS) {
level = BACKLIGHT_LEVELS;
}
setPWM((int)(TIMER_TOP * (float) level / BACKLIGHT_LEVELS));
}
// called every matrix scan
void b_led_task(void) {
// do nothing for now
}
void setPWM(uint16_t xValue) {
if (xValue > TIMER_TOP) {
xValue = TIMER_TOP;
}
OCR1B = xValue; // timer1PWMBSet(xValue);
}
#endif // BACKLIGHT_ENABLE

View file

@ -0,0 +1,13 @@
/**
* Backlighting code for PS2AVRGB boards (ATMEGA32A)
* Kenneth A. (github.com/krusli | krusli.me)
*/
#pragma once
#include <avr/pgmspace.h>
void b_led_init_ports(void);
void b_led_set(uint8_t level);
void b_led_task(void);
void setPWM(uint16_t xValue);

View file

@ -0,0 +1,97 @@
/*
Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "bminiex.h"
#include "rgblight.h"
#include <avr/pgmspace.h>
#include "action_layer.h"
#include "i2c.h"
#include "quantum.h"
#include "backlight.h"
#include "backlight_custom.h"
// for keyboard subdirectory level init functions
// @Override
void matrix_init_kb(void) {
// call user level keymaps, if any
matrix_init_user();
}
#ifdef BACKLIGHT_ENABLE
/// Overrides functions in `quantum.c`
void backlight_init_ports(void) {
b_led_init_ports();
}
void backlight_task(void) {
b_led_task();
}
void backlight_set(uint8_t level) {
b_led_set(level);
}
#endif
#ifdef RGBLIGHT_ENABLE
extern rgblight_config_t rgblight_config;
// custom RGB driver
void rgblight_set(void) {
if (!rgblight_config.enable) {
for (uint8_t i=0; i<RGBLED_NUM; i++) {
led[i].r = 0;
led[i].g = 0;
led[i].b = 0;
}
}
i2c_init();
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
}
bool rgb_init = false;
void matrix_scan_kb(void) {
// if LEDs were previously on before poweroff, turn them back on
if (rgb_init == false && rgblight_config.enable) {
i2c_init();
i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
rgb_init = true;
}
rgblight_task();
#else
void matrix_scan_kb(void) {
#endif
matrix_scan_user();
/* Nothing else for now. */
}
__attribute__((weak)) // overridable
void matrix_init_user(void) {
}
__attribute__((weak)) // overridable
void matrix_scan_user(void) {
}

View file

@ -0,0 +1,58 @@
/*
Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
#define LAYOUT( \
K05, K25, K35, K45, K55, K06, KA6, KA7, K07, KB5, KC5, KD5, KE5, KD1, KE1, KE2, K65, K75, K85, K95, \
K04, K14, K24, K34, K44, K54, K16, KB6, KB7, K17, KA4, KB4, KC4, KE4, KD0, K64, K74, K84, K94, \
K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3, KC3, KD3, K67, K63, K73, K83, \
K02, K12, K22, K32, K42, K52, K36, KD6, KD7, K37, KA2, KB2, KC2, KD2, KE0, K62, K72, K82, K92, \
K01, K30, K11, K21, K31, K41, K51, K46, KE6, KE7, K47, KA1, KB1, K86, K77, K61, K71, K81, \
K00, K10, K20, K56, K57, KB0, KC0, K66, K76, K96, K60, K80, K90 \
){ \
{ K00, K10, K20, K30, KC_NO, KC_NO, K60, KC_NO, K80, K90, KC_NO, KB0, KC0, KD0, KE0 }, \
{ K01, K11, K21, K31, K41, K51, K61, K71, K81, KC_NO, KA1, KB1, KC_NO, KD1, KE1 }, \
{ K02, K12, K22, K32, K42, K52, K62, K72, K82, K92, KA2, KB2, KC2, KD2, KE2 }, \
{ K03, K13, K23, K33, K43, K53, K63, K73, K83, KC_NO, KA3, KB3, KC3, KD3, KC_NO }, \
{ K04, K14, K24, K34, K44, K54, K64, K74, K84, K94, KA4, KB4, KC4, KC_NO, KE4 }, \
{ K05, KC_NO, K25, K35, K45, K55, K65, K75, K85, K95, KC_NO, KB5, KC5, KD5, KE5 }, \
{ K06, K16, K26, K36, K46, K56, K66, K76, K86, K96, KA6, KB6, KC6, KD6, KE6 }, \
{ K07, K17, K27, K37, K47, K57, K67, K77, KC_NO, KC_NO, KA7, KB7, KC7, KD7, KE7 } \
}
#define LAYOUT_kc( \
K05, K25, K35, K45, K55, K06, KA6, KA7, K07, KB5, KC5, KD5, KE5, KD1, KE1, KE2, K65, K75, K85, K95, \
K04, K14, K24, K34, K44, K54, K16, KB6, KB7, K17, KA4, KB4, KC4, KE4, KD0, K64, K74, K84, K94, \
K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3, KC3, KD3, K67, K63, K73, K83, \
K02, K12, K22, K32, K42, K52, K36, KD6, KD7, K37, KA2, KB2, KC2, KD2, KE0, K62, K72, K82, K92, \
K01, K30, K11, K21, K31, K41, K51, K46, KE6, KE7, K47, KA1, KB1, K86, K77, K61, K71, K81, \
K00, K10, K20, K56, K57, KB0, KC0, K66, K76, K96, K60, K80, K90 \
) \
{ \
{ KC_##K00, KC_##K10, KC_##K20, KC_##K30, KC_NO, KC_NO, KC_##K60, KC_NO, KC_##K80, KC_##K90, KC_NO, KC_##KB0, KC_##KC0, KC_##KD0, KC_##KE0 }, \
{ KC_##K01, KC_##K11, KC_##K21, KC_##K31, KC_##K41, KC_##K51, KC_##K61, KC_##K71, KC_##K81, KC_NO, KC_##KA1, KC_##KB1, KC_NO, KC_##KD1, KC_##KE1 }, \
{ KC_##K02, KC_##K12, KC_##K22, KC_##K32, KC_##K42, KC_##K52, KC_##K62, KC_##K72, KC_##K82, KC_##K92, KC_##KA2, KC_##KB2, KC_##KC2, KC_##KD2, KC_##KE2 }, \
{ KC_##K03, KC_##K13, KC_##K23, KC_##K33, KC_##K43, KC_##K53, KC_##K63, KC_##K73, KC_##K83, KC_NO, KC_##KA3, KC_##KB3, KC_##KC3, KC_##KD3, KC_NO }, \
{ KC_##K04, KC_##K14, KC_##K24, KC_##K34, KC_##K44, KC_##K54, KC_##K64, KC_##K74, KC_##K84, KC_##K94, KC_##KA4, KC_##KB4, KC_##KC4, KC_NO, KC_##KE4 }, \
{ KC_##K05, KC_NO, KC_##K25, KC_##K35, KC_##K45, KC_##K55, KC_##K65, KC_##K75, KC_##K85, KC_##K95, KC_NO, KC_##KB5, KC_##KC5, KC_##KD5, KC_##KE5 }, \
{ KC_##K06, KC_##K16, KC_##K26, KC_##K36, KC_##K46, KC_##K56, KC_##K66, KC_##K76, KC_##K86, KC_##K96, KC_##KA6, KC_##KB6, KC_##KC6, KC_##KD6, KC_##KE6 }, \
{ KC_##K07, KC_##K17, KC_##K27, KC_##K37, KC_##K47, KC_##K57, KC_##K67, KC_##K77, KC_NO, KC_NO, KC_##KA7, KC_##KB7, KC_##KC7, KC_##KD7, KC_##KE7 } \
}

View file

@ -0,0 +1,140 @@
/**
* Breathing effect code for PS2AVRGB boards (ATMEGA32A)
* Works in conjunction with `backlight.c`.
*
* Code adapted from `quantum.c` to register with the existing TIMER1 overflow
* handler in `backlight.c` instead of setting up its own timer.
* Kenneth A. (github.com/krusli | krusli.me)
*/
#ifdef BACKLIGHT_ENABLE
#ifdef BACKLIGHT_BREATHING
#include "backlight_custom.h"
#ifndef BREATHING_PERIOD
#define BREATHING_PERIOD 6
#endif
#define breathing_min() do {breathing_counter = 0;} while (0)
#define breathing_max() do {breathing_counter = breathing_period * 244 / 2;} while (0)
// TODO make this share code with quantum.c
#define BREATHING_NO_HALT 0
#define BREATHING_HALT_OFF 1
#define BREATHING_HALT_ON 2
#define BREATHING_STEPS 128
static uint8_t breathing_period = BREATHING_PERIOD;
static uint8_t breathing_halt = BREATHING_NO_HALT;
static uint16_t breathing_counter = 0;
static bool breathing = false;
bool is_breathing(void) {
return breathing;
}
// See http://jared.geek.nz/2013/feb/linear-led-pwm
static uint16_t cie_lightness(uint16_t v) {
if (v <= 5243) // if below 8% of max
return v / 9; // same as dividing by 900%
else {
uint32_t y = (((uint32_t) v + 10486) << 8) / (10486 + 0xFFFFUL); // add 16% of max and compare
// to get a useful result with integer division, we shift left in the expression above
// and revert what we've done again after squaring.
y = y * y * y >> 8;
if (y > 0xFFFFUL) // prevent overflow
return 0xFFFFU;
else
return (uint16_t) y;
}
}
void breathing_enable(void) {
breathing = true;
breathing_counter = 0;
breathing_halt = BREATHING_NO_HALT;
// interrupt already registered
}
void breathing_pulse(void) {
if (get_backlight_level() == 0)
breathing_min();
else
breathing_max();
breathing_halt = BREATHING_HALT_ON;
// breathing_interrupt_enable();
breathing = true;
}
void breathing_disable(void) {
breathing = false;
// backlight_set(get_backlight_level());
b_led_set(get_backlight_level()); // custom implementation of backlight_set()
}
void breathing_self_disable(void)
{
if (get_backlight_level() == 0)
breathing_halt = BREATHING_HALT_OFF;
else
breathing_halt = BREATHING_HALT_ON;
}
void breathing_toggle(void) {
if (is_breathing())
breathing_disable();
else
breathing_enable();
}
void breathing_period_set(uint8_t value)
{
if (!value)
value = 1;
breathing_period = value;
}
void breathing_period_default(void) {
breathing_period_set(BREATHING_PERIOD);
}
void breathing_period_inc(void)
{
breathing_period_set(breathing_period+1);
}
void breathing_period_dec(void)
{
breathing_period_set(breathing_period-1);
}
/* To generate breathing curve in python:
* from math import sin, pi; [int(sin(x/128.0*pi)**4*255) for x in range(128)]
*/
static const uint8_t breathing_table[BREATHING_STEPS] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 17, 20, 24, 28, 32, 36, 41, 46, 51, 57, 63, 70, 76, 83, 91, 98, 106, 113, 121, 129, 138, 146, 154, 162, 170, 178, 185, 193, 200, 207, 213, 220, 225, 231, 235, 240, 244, 247, 250, 252, 253, 254, 255, 254, 253, 252, 250, 247, 244, 240, 235, 231, 225, 220, 213, 207, 200, 193, 185, 178, 170, 162, 154, 146, 138, 129, 121, 113, 106, 98, 91, 83, 76, 70, 63, 57, 51, 46, 41, 36, 32, 28, 24, 20, 17, 15, 12, 10, 8, 6, 5, 4, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
// Use this before the cie_lightness function.
static inline uint16_t scale_backlight(uint16_t v) {
return v / BACKLIGHT_LEVELS * get_backlight_level();
}
void custom_breathing_handler(void) {
uint16_t interval = (uint16_t) breathing_period * 244 / BREATHING_STEPS;
// resetting after one period to prevent ugly reset at overflow.
breathing_counter = (breathing_counter + 1) % (breathing_period * 244);
uint8_t index = breathing_counter / interval % BREATHING_STEPS;
if (((breathing_halt == BREATHING_HALT_ON) && (index == BREATHING_STEPS / 2)) ||
((breathing_halt == BREATHING_HALT_OFF) && (index == BREATHING_STEPS - 1)))
{
// breathing_interrupt_disable();
}
setPWM(cie_lightness(scale_backlight((uint16_t) pgm_read_byte(&breathing_table[index]) * 0x0101U)));
}
#endif // BACKLIGHT_BREATHING
#endif // BACKLIGHT_ENABLE

View file

@ -0,0 +1,41 @@
/*
Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "config_common.h"
#define VENDOR_ID 0x20A0
#define PRODUCT_ID 0x422E
#define MANUFACTURER winkeyless.kr
#define PRODUCT B.mini Ex
#define RGBLED_NUM 20
/* matrix size */
#define MATRIX_ROWS 8
#define MATRIX_COLS 15
#define RGBLIGHT_ANIMATIONS
#define BACKLIGHT_LEVELS 5
#define NO_UART 1
/* key combination for command */
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))

Some files were not shown because too many files have changed in this diff Show more