mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-08-12 11:07:40 +00:00
Compare commits
25 Commits
drop-1.0.0
...
0.6.420
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0f95c0865c | ||
![]() |
3538955778 | ||
![]() |
7d557a0514 | ||
![]() |
a25dd58bc5 | ||
![]() |
7ba82cb5b7 | ||
![]() |
a200f194d1 | ||
![]() |
b2fb0ceeef | ||
![]() |
ff0cb0cf9d | ||
![]() |
cbcf888dc0 | ||
![]() |
d8253b83e8 | ||
![]() |
0a03f7cff7 | ||
![]() |
21fc6be41b | ||
![]() |
989c2094f8 | ||
![]() |
fd48f687b1 | ||
![]() |
f8e4921491 | ||
![]() |
66b63f66a9 | ||
![]() |
77a7e3c91f | ||
![]() |
b8c5efa555 | ||
![]() |
4211252117 | ||
![]() |
0694decfa1 | ||
![]() |
da1f05fbc1 | ||
![]() |
cf215487ba | ||
![]() |
e717dcaa09 | ||
![]() |
38fdf7a2d2 | ||
![]() |
663ca6ba9d |
@@ -16,6 +16,10 @@ insert_final_newline = true
|
||||
trim_trailing_whitespace = false
|
||||
indent_size = 4
|
||||
|
||||
[{qmk,*.py}]
|
||||
charset = utf-8
|
||||
max_line_length = 200
|
||||
|
||||
# Make these match what we have in .gitattributes
|
||||
[*.mk]
|
||||
end_of_line = lf
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -70,3 +70,6 @@ util/Win_Check_Output.txt
|
||||
secrets.tar
|
||||
id_rsa_*
|
||||
/.vs
|
||||
|
||||
# python things
|
||||
__pycache__
|
||||
|
@@ -13,8 +13,6 @@ env:
|
||||
- MAKEFLAGS="-j3 --output-sync"
|
||||
services:
|
||||
- docker
|
||||
before_install:
|
||||
- docker build -t qmkfm/qmk_firmware .
|
||||
install:
|
||||
- npm install -g moxygen
|
||||
script:
|
||||
|
24
Dockerfile
24
Dockerfile
@@ -1,26 +1,4 @@
|
||||
FROM debian:9
|
||||
|
||||
RUN apt-get update && apt-get install --no-install-recommends -y \
|
||||
avr-libc \
|
||||
avrdude \
|
||||
binutils-arm-none-eabi \
|
||||
binutils-avr \
|
||||
build-essential \
|
||||
dfu-programmer \
|
||||
dfu-util \
|
||||
gcc \
|
||||
gcc-avr \
|
||||
git \
|
||||
libnewlib-arm-none-eabi \
|
||||
software-properties-common \
|
||||
unzip \
|
||||
wget \
|
||||
zip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# upgrade gcc-arm-none-eabi from the default 5.4.1 to 6.3.1 due to ARM runtime issues
|
||||
RUN wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 -O - | \
|
||||
tar xj --strip-components=1 -C /
|
||||
FROM qmkfm/base_container
|
||||
|
||||
VOLUME /qmk_firmware
|
||||
WORKDIR /qmk_firmware
|
||||
|
97
bin/qmk
Executable file
97
bin/qmk
Executable file
@@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env python3
|
||||
"""CLI wrapper for running QMK commands.
|
||||
"""
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from glob import glob
|
||||
from time import strftime
|
||||
from importlib import import_module
|
||||
from importlib.util import find_spec
|
||||
|
||||
# Add the QMK python libs to our path
|
||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
qmk_dir = os.path.abspath(os.path.join(script_dir, '..'))
|
||||
python_lib_dir = os.path.abspath(os.path.join(qmk_dir, 'lib', 'python'))
|
||||
sys.path.append(python_lib_dir)
|
||||
|
||||
# Change to the root of our checkout
|
||||
os.environ['ORIG_CWD'] = os.getcwd()
|
||||
os.chdir(qmk_dir)
|
||||
|
||||
# Make sure our modules have been setup
|
||||
with open('requirements.txt', 'r') as fd:
|
||||
for line in fd.readlines():
|
||||
line = line.strip().replace('<', '=').replace('>', '=')
|
||||
|
||||
if line[0] == '#':
|
||||
continue
|
||||
|
||||
if '#' in line:
|
||||
line = line.split('#')[0]
|
||||
|
||||
module = line.split('=')[0] if '=' in line else line
|
||||
if not find_spec(module):
|
||||
print('Your QMK build environment is not fully setup!\n')
|
||||
print('Please run `./util/qmk_install.sh` to setup QMK.')
|
||||
exit(255)
|
||||
|
||||
# Figure out our version
|
||||
command = ['git', 'describe', '--abbrev=6', '--dirty', '--always', '--tags']
|
||||
result = subprocess.run(command, text=True, capture_output=True)
|
||||
|
||||
if result.returncode == 0:
|
||||
os.environ['QMK_VERSION'] = 'QMK ' + result.stdout.strip()
|
||||
else:
|
||||
os.environ['QMK_VERSION'] = 'QMK ' + strftime('%Y-%m-%d-%H:%M:%S')
|
||||
|
||||
# Setup the CLI
|
||||
import milc
|
||||
milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}ψ{style_reset_all}'
|
||||
|
||||
# If we were invoked as `qmk <cmd>` massage sys.argv into `qmk-<cmd>`.
|
||||
# This means we can't accept arguments to the qmk script itself.
|
||||
script_name = os.path.basename(sys.argv[0])
|
||||
if script_name == 'qmk':
|
||||
if len(sys.argv) == 1:
|
||||
milc.cli.log.error('No subcommand specified!\n')
|
||||
|
||||
if len(sys.argv) == 1 or sys.argv[1] in ['-h', '--help']:
|
||||
milc.cli.echo('usage: qmk <subcommand> [...]')
|
||||
milc.cli.echo('\nsubcommands:')
|
||||
subcommands = glob(os.path.join(qmk_dir, 'bin', 'qmk-*'))
|
||||
for subcommand in sorted(subcommands):
|
||||
subcommand = os.path.basename(subcommand).split('-', 1)[1]
|
||||
milc.cli.echo('\t%s', subcommand)
|
||||
milc.cli.echo('\nqmk <subcommand> --help for more information')
|
||||
exit(1)
|
||||
|
||||
if sys.argv[1] in ['-V', '--version']:
|
||||
milc.cli.echo(os.environ['QMK_VERSION'])
|
||||
exit(0)
|
||||
|
||||
sys.argv[0] = script_name = '-'.join((script_name, sys.argv[1]))
|
||||
del sys.argv[1]
|
||||
|
||||
# Look for which module to import
|
||||
if script_name == 'qmk':
|
||||
milc.cli.print_help()
|
||||
exit(0)
|
||||
elif not script_name.startswith('qmk-'):
|
||||
milc.cli.log.error('Invalid symlink, must start with "qmk-": %s', script_name)
|
||||
else:
|
||||
subcommand = script_name.replace('-', '.').replace('_', '.').split('.')
|
||||
subcommand.insert(1, 'cli')
|
||||
subcommand = '.'.join(subcommand)
|
||||
|
||||
try:
|
||||
import_module(subcommand)
|
||||
except ModuleNotFoundError as e:
|
||||
if e.__class__.__name__ != subcommand:
|
||||
raise
|
||||
|
||||
milc.cli.log.error('Invalid subcommand! Could not import %s.', subcommand)
|
||||
exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
milc.cli()
|
1
bin/qmk-compile-json
Symbolic link
1
bin/qmk-compile-json
Symbolic link
@@ -0,0 +1 @@
|
||||
qmk
|
1
bin/qmk-doctor
Symbolic link
1
bin/qmk-doctor
Symbolic link
@@ -0,0 +1 @@
|
||||
qmk
|
1
bin/qmk-hello
Symbolic link
1
bin/qmk-hello
Symbolic link
@@ -0,0 +1 @@
|
||||
qmk
|
1
bin/qmk-json-keymap
Symbolic link
1
bin/qmk-json-keymap
Symbolic link
@@ -0,0 +1 @@
|
||||
qmk
|
@@ -76,6 +76,10 @@ ifeq ($(strip $(BOOTLOADER)), bootloadHID)
|
||||
OPT_DEFS += -DBOOTLOADER_BOOTLOADHID
|
||||
BOOTLOADER_SIZE = 4096
|
||||
endif
|
||||
ifeq ($(strip $(BOOTLOADER)), USBasp)
|
||||
OPT_DEFS += -DBOOTLOADER_USBASP
|
||||
BOOTLOADER_SIZE = 4096
|
||||
endif
|
||||
|
||||
ifdef BOOTLOADER_SIZE
|
||||
OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE))
|
||||
|
27
build_json.mk
Normal file
27
build_json.mk
Normal file
@@ -0,0 +1,27 @@
|
||||
# Look for a json keymap file
|
||||
ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.json)","")
|
||||
KEYMAP_C := $(KEYBOARD_OUTPUT)/src/keymap.c
|
||||
KEYMAP_JSON := $(MAIN_KEYMAP_PATH_5)/keymap.json
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5)
|
||||
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.json)","")
|
||||
KEYMAP_C := $(KEYBOARD_OUTPUT)/src/keymap.c
|
||||
KEYMAP_JSON := $(MAIN_KEYMAP_PATH_4)/keymap.json
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4)
|
||||
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.json)","")
|
||||
KEYMAP_C := $(KEYBOARD_OUTPUT)/src/keymap.c
|
||||
KEYMAP_JSON := $(MAIN_KEYMAP_PATH_3)/keymap.json
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3)
|
||||
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.json)","")
|
||||
KEYMAP_C := $(KEYBOARD_OUTPUT)/src/keymap.c
|
||||
KEYMAP_JSON := $(MAIN_KEYMAP_PATH_2)/keymap.json
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2)
|
||||
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.json)","")
|
||||
KEYMAP_C := $(KEYBOARD_OUTPUT)/src/keymap.c
|
||||
KEYMAP_JSON := $(MAIN_KEYMAP_PATH_1)/keymap.json
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
|
||||
endif
|
||||
|
||||
# Generate the keymap.c
|
||||
ifneq ("$(KEYMAP_JSON)","")
|
||||
_ = $(shell test -e $(KEYMAP_C) || bin/qmk-json-keymap $(KEYMAP_JSON) -o $(KEYMAP_C))
|
||||
endif
|
@@ -98,31 +98,38 @@ MAIN_KEYMAP_PATH_3 := $(KEYBOARD_PATH_3)/keymaps/$(KEYMAP)
|
||||
MAIN_KEYMAP_PATH_4 := $(KEYBOARD_PATH_4)/keymaps/$(KEYMAP)
|
||||
MAIN_KEYMAP_PATH_5 := $(KEYBOARD_PATH_5)/keymaps/$(KEYMAP)
|
||||
|
||||
ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.c)","")
|
||||
-include $(MAIN_KEYMAP_PATH_5)/rules.mk
|
||||
KEYMAP_C := $(MAIN_KEYMAP_PATH_5)/keymap.c
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5)
|
||||
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.c)","")
|
||||
-include $(MAIN_KEYMAP_PATH_4)/rules.mk
|
||||
KEYMAP_C := $(MAIN_KEYMAP_PATH_4)/keymap.c
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4)
|
||||
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.c)","")
|
||||
-include $(MAIN_KEYMAP_PATH_3)/rules.mk
|
||||
KEYMAP_C := $(MAIN_KEYMAP_PATH_3)/keymap.c
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3)
|
||||
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.c)","")
|
||||
-include $(MAIN_KEYMAP_PATH_2)/rules.mk
|
||||
KEYMAP_C := $(MAIN_KEYMAP_PATH_2)/keymap.c
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2)
|
||||
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.c)","")
|
||||
-include $(MAIN_KEYMAP_PATH_1)/rules.mk
|
||||
KEYMAP_C := $(MAIN_KEYMAP_PATH_1)/keymap.c
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
|
||||
else ifneq ($(LAYOUTS),)
|
||||
include build_layout.mk
|
||||
else
|
||||
$(error Could not find keymap)
|
||||
# this state should never be reached
|
||||
# Check for keymap.json first, so we can regenerate keymap.c
|
||||
include build_json.mk
|
||||
|
||||
ifeq ("$(wildcard $(KEYMAP_PATH))", "")
|
||||
# Look through the possible keymap folders until we find a matching keymap.c
|
||||
ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_5)/keymap.c)","")
|
||||
-include $(MAIN_KEYMAP_PATH_5)/rules.mk
|
||||
KEYMAP_C := $(MAIN_KEYMAP_PATH_5)/keymap.c
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_5)
|
||||
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_4)/keymap.c)","")
|
||||
-include $(MAIN_KEYMAP_PATH_4)/rules.mk
|
||||
KEYMAP_C := $(MAIN_KEYMAP_PATH_4)/keymap.c
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_4)
|
||||
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_3)/keymap.c)","")
|
||||
-include $(MAIN_KEYMAP_PATH_3)/rules.mk
|
||||
KEYMAP_C := $(MAIN_KEYMAP_PATH_3)/keymap.c
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_3)
|
||||
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_2)/keymap.c)","")
|
||||
-include $(MAIN_KEYMAP_PATH_2)/rules.mk
|
||||
KEYMAP_C := $(MAIN_KEYMAP_PATH_2)/keymap.c
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_2)
|
||||
else ifneq ("$(wildcard $(MAIN_KEYMAP_PATH_1)/keymap.c)","")
|
||||
-include $(MAIN_KEYMAP_PATH_1)/rules.mk
|
||||
KEYMAP_C := $(MAIN_KEYMAP_PATH_1)/keymap.c
|
||||
KEYMAP_PATH := $(MAIN_KEYMAP_PATH_1)
|
||||
else ifneq ($(LAYOUTS),)
|
||||
# If we haven't found a keymap yet fall back to community layouts
|
||||
include build_layout.mk
|
||||
else
|
||||
$(error Could not find keymap)
|
||||
# this state should never be reached
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CTPC)), yes)
|
||||
@@ -313,7 +320,6 @@ ifneq ("$(wildcard $(USER_PATH)/config.h)","")
|
||||
CONFIG_H += $(USER_PATH)/config.h
|
||||
endif
|
||||
|
||||
|
||||
# Object files directory
|
||||
# To put object files in current directory, use a dot (.), do NOT make
|
||||
# this an empty or blank macro!
|
||||
@@ -323,7 +329,7 @@ ifneq ("$(wildcard $(KEYMAP_PATH)/config.h)","")
|
||||
CONFIG_H += $(KEYMAP_PATH)/config.h
|
||||
endif
|
||||
|
||||
# # project specific files
|
||||
# project specific files
|
||||
SRC += $(KEYBOARD_SRC) \
|
||||
$(KEYMAP_C) \
|
||||
$(QUANTUM_SRC)
|
||||
@@ -392,6 +398,7 @@ $(KEYBOARD_OUTPUT)_CONFIG := $(PROJECT_CONFIG)
|
||||
all: build check-size
|
||||
build: elf cpfirmware
|
||||
check-size: build
|
||||
objs-size: build
|
||||
|
||||
include show_options.mk
|
||||
include $(TMK_PATH)/rules.mk
|
||||
|
@@ -8,6 +8,7 @@
|
||||
|
||||
* [QMK Basics](README.md)
|
||||
* [QMK Introduction](getting_started_introduction.md)
|
||||
* [QMK CLI](cli.md)
|
||||
* [Contributing to QMK](contributing.md)
|
||||
* [How to Use Github](getting_started_github.md)
|
||||
* [Getting Help](getting_started_getting_help.md)
|
||||
@@ -34,6 +35,8 @@
|
||||
* [Keyboard Guidelines](hardware_keyboard_guidelines.md)
|
||||
* [Config Options](config_options.md)
|
||||
* [Keycodes](keycodes.md)
|
||||
* [Coding Conventions - C](coding_conventions_c.md)
|
||||
* [Coding Conventions - Python](coding_conventions_python.md)
|
||||
* [Documentation Best Practices](documentation_best_practices.md)
|
||||
* [Documentation Templates](documentation_templates.md)
|
||||
* [Glossary](reference_glossary.md)
|
||||
@@ -41,6 +44,7 @@
|
||||
* [Useful Functions](ref_functions.md)
|
||||
* [Configurator Support](reference_configurator_support.md)
|
||||
* [info.json Format](reference_info_json.md)
|
||||
* [Python Development](python_development.md)
|
||||
|
||||
* [Features](features.md)
|
||||
* [Basic Keycodes](keycodes_basic.md)
|
||||
|
31
docs/cli.md
Normal file
31
docs/cli.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# QMK CLI
|
||||
|
||||
This page describes how to setup and use the QMK CLI.
|
||||
|
||||
# Overview
|
||||
|
||||
The QMK CLI makes building and working with QMK keyboards easier. We have provided a number of commands to help you work with QMK:
|
||||
|
||||
* `qmk compile-json`
|
||||
|
||||
# Setup
|
||||
|
||||
Simply add the `qmk_firmware/bin` directory to your `PATH`. You can run the `qmk` commands from any directory.
|
||||
|
||||
```
|
||||
export PATH=$PATH:$HOME/qmk_firmware/bin
|
||||
```
|
||||
|
||||
You may want to add this to your `.profile`, `.bash_profile`, `.zsh_profile`, or other shell startup scripts.
|
||||
|
||||
# Commands
|
||||
|
||||
## `qmk compile-json`
|
||||
|
||||
This command allows you to compile JSON files you have downloaded from <https://config.qmk.fm>.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```
|
||||
qmk compile-json mine.json
|
||||
```
|
58
docs/coding_conventions_c.md
Normal file
58
docs/coding_conventions_c.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# Coding Conventions (C)
|
||||
|
||||
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 four (4) spaces (soft tabs)
|
||||
* 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 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
|
||||
* If you not sure if a comment is obvious, go ahead and include it.
|
||||
* 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`)
|
||||
* We accept both forms of preprocessor if's: `#ifdef DEFINED` and `#if defined(DEFINED)`
|
||||
* If you are not sure which to prefer use the `#if defined(DEFINED)` form.
|
||||
* Do not change existing code from one style to the other, except when moving to a multiple condition `#if`.
|
||||
* Do not put whitespace between `#` and `if`.
|
||||
* When deciding how (or if) to indent directives keep these points in mind:
|
||||
* Readability is more important than consistency.
|
||||
* Follow the file's existing style. If the file is mixed follow the style that makes sense for the section you are modifying.
|
||||
* When choosing to indent you can follow the indention level of the surrounding C code, or preprocessor directives can have their own indent level. Choose the style that best communicates the intent of your code.
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
# Auto-formatting with clang-format
|
||||
|
||||
[Clang-format](https://clang.llvm.org/docs/ClangFormat.html) is part of LLVM and can automatically format your code for you, because ain't nobody got time to do it manually. We supply a configuration file for it that applies most of the coding conventions listed above. It will only change whitespace and newlines, so you will still have to remember to include optional braces yourself.
|
||||
|
||||
Use the [full LLVM installer](http://llvm.org/builds/) to get clang-format on Windows, or use `sudo apt install clang-format` on Ubuntu.
|
||||
|
||||
If you run it from the command-line, pass `-style=file` as an option and it will automatically find the .clang-format configuration file in the QMK root directory.
|
||||
|
||||
If you use VSCode, the standard C/C++ plugin supports clang-format, alternatively there is a [separate extension](https://marketplace.visualstudio.com/items?itemName=LLVMExtensions.ClangFormat) for it.
|
||||
|
||||
Some things (like LAYOUT macros) are destroyed by clang-format, so either don't run it on those files, or wrap the sensitive code in `// clang-format off` and `// clang-format on`.
|
314
docs/coding_conventions_python.md
Normal file
314
docs/coding_conventions_python.md
Normal file
@@ -0,0 +1,314 @@
|
||||
# Coding Conventions (Python)
|
||||
|
||||
Most of our style follows PEP8 with some local modifications to make things less nit-picky.
|
||||
|
||||
* We target Python 3.5 for compatability with all supported platforms.
|
||||
* We indent using four (4) spaces (soft tabs)
|
||||
* We encourage liberal use of 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
|
||||
* If you not sure if a comment is obvious, go ahead and include it.
|
||||
* We require useful docstrings for all functions.
|
||||
* 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.
|
||||
* Some of our practices conflict with the wider python community to make our codebase more approachable to non-pythonistas.
|
||||
|
||||
# YAPF
|
||||
|
||||
You can use [yapf](https://github.com/google/yapf) to style your code. We provide a config in [setup.cfg](setup.cfg).
|
||||
|
||||
# Imports
|
||||
|
||||
We don't have a hard and fast rule for when to use `import ...` vs `from ... import ...`. Understandability and maintainability is our ultimate goal.
|
||||
|
||||
Generally we prefer to import specific function and class names from a module to keep code shorter and easier to understand. Sometimes this results in a name that is ambiguous, and in such cases we prefer to import the module instead. You should avoid using the "as" keyword when importing, unless you are importing a compatability module.
|
||||
|
||||
Imports should be one line per module. We group import statements together using the standard python rules- system, 3rd party, local.
|
||||
|
||||
Do not use `from foo import *`. Supply a list of objects you want to import instead, or import the whole module.
|
||||
|
||||
## Import Examples
|
||||
|
||||
Good:
|
||||
|
||||
```
|
||||
from qmk import effects
|
||||
|
||||
effects.echo()
|
||||
```
|
||||
|
||||
Bad:
|
||||
|
||||
```
|
||||
from qmk.effects import echo
|
||||
|
||||
echo() # It's unclear where echo comes from
|
||||
```
|
||||
|
||||
Good:
|
||||
|
||||
```
|
||||
from qmk.keymap import compile_firmware
|
||||
|
||||
compile_firmware()
|
||||
```
|
||||
|
||||
OK, but the above is better:
|
||||
|
||||
```
|
||||
import qmk.keymap
|
||||
|
||||
qmk.keymap.compile_firmware()
|
||||
```
|
||||
|
||||
# Statements
|
||||
|
||||
One statement per line.
|
||||
|
||||
Even when allowed (EG `if foo: bar`) we do not combine 2 statements onto a single line.
|
||||
|
||||
# Naming
|
||||
|
||||
`module_name`, `package_name`, `ClassName`, `method_name`, `ExceptionName`, `function_name`, `GLOBAL_CONSTANT_NAME`, `global_var_name`, `instance_var_name`, `function_parameter_name`, `local_var_name`.
|
||||
|
||||
Function names, variable names, and filenames should be descriptive; eschew abbreviation. In particular, do not use abbreviations that are ambiguous or unfamiliar to readers outside your project, and do not abbreviate by deleting letters within a word.
|
||||
|
||||
Always use a .py filename extension. Never use dashes.
|
||||
|
||||
## Names to Avoid
|
||||
|
||||
* single character names except for counters or iterators. You may use "e" as an exception identifier in try/except statements.
|
||||
* dashes (-) in any package/module name
|
||||
* __double_leading_and_trailing_underscore__ names (reserved by Python)
|
||||
|
||||
# Docstrings
|
||||
|
||||
To maintain consistency with our docstrings we've set out the following guidelines.
|
||||
|
||||
* Use markdown formatting
|
||||
* Always use triple-dquote docstrings with at least one linebreak: `"""\n"""`
|
||||
* First line is a short (< 70 char) description of what the function does
|
||||
* If you need more in your docstring leave a blank line between the description and the rest.
|
||||
* Start indented lines at the same indent level as the opening triple-dquote
|
||||
* Document all function arguments using the format described below
|
||||
* If present, Args:, Returns:, and Raises: should be the last three things in the docstring, separated by a blank line each.
|
||||
|
||||
## Simple docstring example
|
||||
|
||||
```
|
||||
def my_awesome_function():
|
||||
"""Return the number of seconds since 1970 Jan 1 00:00 UTC.
|
||||
"""
|
||||
return int(time.time())
|
||||
```
|
||||
|
||||
## Complex docstring example
|
||||
|
||||
```
|
||||
def my_awesome_function():
|
||||
"""Return the number of seconds since 1970 Jan 1 00:00 UTC.
|
||||
|
||||
This function always returns an integer number of seconds.
|
||||
"""
|
||||
return int(time.time())
|
||||
```
|
||||
|
||||
## Function arguments docstring example
|
||||
|
||||
```
|
||||
def my_awesome_function(start=None, offset=0):
|
||||
"""Return the number of seconds since 1970 Jan 1 00:00 UTC.
|
||||
|
||||
This function always returns an integer number of seconds.
|
||||
|
||||
|
||||
Args:
|
||||
start
|
||||
The time to start at instead of 1970 Jan 1 00:00 UTC
|
||||
|
||||
offset
|
||||
Return an answer that has this number of seconds subtracted first
|
||||
|
||||
Returns:
|
||||
An integer describing a number of seconds.
|
||||
|
||||
Raises:
|
||||
ValueError
|
||||
When `start` or `offset` are not positive numbers
|
||||
"""
|
||||
if start < 0 or offset < 0:
|
||||
raise ValueError('start and offset must be positive numbers.')
|
||||
|
||||
if not start:
|
||||
start = time.time()
|
||||
|
||||
return int(start - offset)
|
||||
```
|
||||
|
||||
# Exceptions
|
||||
|
||||
Exceptions are used to handle exceptional situations. They should not be used for flow control. This is a break from the python norm of "ask for forgiveness." If you are catching an exception it should be to handle a situation that is unusual.
|
||||
|
||||
If you use a catch-all exception for any reason you must log the exception and stacktrace using cli.log.
|
||||
|
||||
Make your try/except blocks as short as possible. If you need a lot of try statements you may need to restructure your code.
|
||||
|
||||
# Tuples
|
||||
|
||||
When defining one-item tuples always include a trailing comma so that it is obvious you are using a tuple. Do not rely on implicit one-item tuple unpacking. Better still use a list which is unambiguous.
|
||||
|
||||
This is particularly important when using the printf-style format strings that are commonly used.
|
||||
|
||||
# Lists and Dictionaries
|
||||
|
||||
We have configured YAPF to differentiate between sequence styles with a trailing comma. When a trailing comma is omitted YAPF will format the sequence as a single line. When a trailing comma is included YAPF will format the sequence with one item per line.
|
||||
|
||||
You should generally prefer to keep short definition on a single line. Break out to multiple lines sooner rather than later to aid readability and maintainability.
|
||||
|
||||
# Parentheses
|
||||
|
||||
Avoid excessive parentheses, but do use parentheses to make code easier to understand. Do not use them in return statements unless you are explicitly returning a tuple, or it is part of a math expression.
|
||||
|
||||
# Format Strings
|
||||
|
||||
We generally prefer printf-style format strings. Example:
|
||||
|
||||
```
|
||||
name = 'World'
|
||||
print('Hello, %s!' % (name,))
|
||||
```
|
||||
|
||||
This style is used by the logging module, which we make use of extensively, and we have adopted it in other places for consistency. It is also more familiar to C programmers, who are a big part of our casual audience.
|
||||
|
||||
Our included CLI module has support for using these without using the percent (%) operator. Look at `cli.echo()` and the various `cli.log` functions (EG, `cli.log.info()`) for more details.
|
||||
|
||||
# Comprehensions & Generator Expressions
|
||||
|
||||
We encourage the liberal use of comprehensions and generators, but do not let them get too complex. If you need complexity fall back to a for loop that is easier to understand.
|
||||
|
||||
# Lambdas
|
||||
|
||||
OK to use but probably should be avoided. With comprehensions and generators the need for lambdas is not as strong as it once was.
|
||||
|
||||
# Conditional Expressions
|
||||
|
||||
OK in variable assignment, but otherwise should be avoided.
|
||||
|
||||
Conditional expressions are if statements that are in line with code. For example:
|
||||
|
||||
```
|
||||
x = 1 if cond else 2
|
||||
```
|
||||
|
||||
It's generally not a good idea to use these as function arguments, sequence items, etc. It's too easy to overlook.
|
||||
|
||||
# Default Argument Values
|
||||
|
||||
Encouraged, but values must be immutable objects.
|
||||
|
||||
When specifying default values in argument lists always be careful to specify objects that can't be modified in place. If you use a mutable object the changes you make will persist between calls, which is usually not what you want. Even if that is what you intend to do it is confusing for others and will hinder understanding.
|
||||
|
||||
Bad:
|
||||
|
||||
```
|
||||
def my_func(foo={}):
|
||||
pass
|
||||
```
|
||||
|
||||
Good:
|
||||
|
||||
```
|
||||
def my_func(foo=None):
|
||||
if not foo:
|
||||
foo = {}
|
||||
```
|
||||
|
||||
# Properties
|
||||
|
||||
Always use properties instead of getter and setter functions.
|
||||
|
||||
```
|
||||
class Foo(object):
|
||||
def __init__(self):
|
||||
self._bar = None
|
||||
|
||||
@property
|
||||
def bar(self):
|
||||
return self._bar
|
||||
|
||||
@bar.setter
|
||||
def bar(self, bar):
|
||||
self._bar = bar
|
||||
```
|
||||
|
||||
# True/False Evaluations
|
||||
|
||||
You should generally prefer the implicit True/False evaluation in if statements, rather than checking equivalency.
|
||||
|
||||
Bad:
|
||||
|
||||
```
|
||||
if foo == True:
|
||||
pass
|
||||
|
||||
if bar == False:
|
||||
pass
|
||||
```
|
||||
|
||||
Good:
|
||||
|
||||
```
|
||||
if foo:
|
||||
pass
|
||||
|
||||
if not bar:
|
||||
pass
|
||||
```
|
||||
|
||||
# Decorators
|
||||
|
||||
Use when appropriate. Try to avoid too much magic unless it helps with understanding.
|
||||
|
||||
# Threading and Multiprocessing
|
||||
|
||||
Should be avoided. If you need this you will have to make a strong case before we merge your code.
|
||||
|
||||
# Power Features
|
||||
|
||||
Python is an extremely flexible language and gives you many fancy features such as custom metaclasses, access to bytecode, on-the-fly compilation, dynamic inheritance, object reparenting, import hacks, reflection, modification of system internals, etc.
|
||||
|
||||
Don't use these.
|
||||
|
||||
Performance is not a critical concern for us, and code understandability is. We want our codebase to be approachable by someone who only has a day or two to play with it. These features generally come with a cost to easy understanding, and we would prefer to have code that can be readily understood over faster or more compact code.
|
||||
|
||||
Note that some standard library modules use these techniques and it is ok to make use of those modules. But please keep readability and understandability in mind when using them.
|
||||
|
||||
# Type Annotated Code
|
||||
|
||||
For now we are not using any type annotation system, and would prefer that code remain unannotated. We may revisit this in the future.
|
||||
|
||||
# Function length
|
||||
|
||||
Prefer small and focused functions.
|
||||
|
||||
We recognize that long functions are sometimes appropriate, so no hard limit is placed on function length. If a function exceeds about 40 lines, think about whether it can be broken up without harming the structure of the program.
|
||||
|
||||
Even if your long function works perfectly now, someone modifying it in a few months may add new behavior. This could result in bugs that are hard to find. Keeping your functions short and simple makes it easier for other people to read and modify your code.
|
||||
|
||||
You could find long and complicated functions when working with some code. Do not be intimidated by modifying existing code: if working with such a function proves to be difficult, you find that errors are hard to debug, or you want to use a piece of it in several different contexts, consider breaking up the function into smaller and more manageable pieces.
|
||||
|
||||
# FIXMEs
|
||||
|
||||
It is OK to leave FIXMEs in code. Why? Encouraging people to at least document parts of code that need to be thought out more (or that are confusing) is better than leaving this code undocumented.
|
||||
|
||||
All FIXMEs should be formatted like:
|
||||
|
||||
```
|
||||
FIXME(username): Revisit this code when the frob feature is done.
|
||||
```
|
||||
|
||||
...where username is your GitHub username.
|
||||
|
||||
# Unit Tests
|
||||
|
||||
These are good. We should have some one day.
|
@@ -289,6 +289,7 @@ This is a [make](https://www.gnu.org/software/make/manual/make.html) file that i
|
||||
* `halfkay`
|
||||
* `caterina`
|
||||
* `bootloadHID`
|
||||
* `USBasp`
|
||||
|
||||
## Feature Options
|
||||
|
||||
|
@@ -54,62 +54,10 @@ Never made an open source contribution before? Wondering how contributions work
|
||||
|
||||
# Coding Conventions
|
||||
|
||||
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:
|
||||
Most of our style is pretty easy to pick up on. If you are familiar with either C or Python you should not have too much trouble with our local styles.
|
||||
|
||||
* We indent using four (4) spaces (soft tabs)
|
||||
* 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 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
|
||||
* If you not sure if a comment is obvious, go ahead and include it.
|
||||
* 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`)
|
||||
* We accept both forms of preprocessor if's: `#ifdef DEFINED` and `#if defined(DEFINED)`
|
||||
* If you are not sure which to prefer use the `#if defined(DEFINED)` form.
|
||||
* Do not change existing code from one style to the other, except when moving to a multiple condition `#if`.
|
||||
* Do not put whitespace between `#` and `if`.
|
||||
* When deciding how (or if) to indent directives keep these points in mind:
|
||||
* Readability is more important than consistency.
|
||||
* Follow the file's existing style. If the file is mixed follow the style that makes sense for the section you are modifying.
|
||||
* When choosing to indent you can follow the indention level of the surrounding C code, or preprocessor directives can have their own indent level. Choose the style that best communicates the intent of your code.
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
# Auto-formatting with clang-format
|
||||
|
||||
[Clang-format](https://clang.llvm.org/docs/ClangFormat.html) is part of LLVM and can automatically format your code for you, because ain't nobody got time to do it manually. We supply a configuration file for it that applies most of the coding conventions listed above. It will only change whitespace and newlines, so you will still have to remember to include optional braces yourself.
|
||||
|
||||
Use the [full LLVM installer](http://llvm.org/builds/) to get clang-format on Windows, or use `sudo apt install clang-format` on Ubuntu.
|
||||
|
||||
If you run it from the command-line, pass `-style=file` as an option and it will automatically find the .clang-format configuration file in the QMK root directory.
|
||||
|
||||
If you use VSCode, the standard C/C++ plugin supports clang-format, alternatively there is a [separate extension](https://marketplace.visualstudio.com/items?itemName=LLVMExtensions.ClangFormat) for it.
|
||||
|
||||
Some things (like LAYOUT macros) are destroyed by clang-format, so either don't run it on those files, or wrap the sensitive code in `// clang-format off` and `// clang-format on`.
|
||||
* [Coding Conventions - C](coding_conventions_c.md)
|
||||
* [Coding Conventions - Python](coding_conventions_python.md)
|
||||
|
||||
# General Guidelines
|
||||
|
||||
|
@@ -87,6 +87,7 @@ Size after:
|
||||
- EEPROM has around a 100000 write cycle. You shouldn't rewrite the
|
||||
firmware repeatedly and continually; that'll burn the EEPROM
|
||||
eventually.
|
||||
|
||||
## NKRO Doesn't work
|
||||
First you have to compile firmware with this build option `NKRO_ENABLE` in **Makefile**.
|
||||
|
||||
|
@@ -119,6 +119,31 @@ Flashing sequence:
|
||||
3. Flash a .hex file
|
||||
4. Reset the device into application mode (may be done automatically)
|
||||
|
||||
## USBasploader
|
||||
|
||||
USBasploader is a bootloader developed by matrixstorm. It is used in some non-USB AVR chips such as the ATmega328P, which run V-USB.
|
||||
|
||||
To ensure compatibility with the USBasploader bootloader, make sure this block is present in your `rules.mk`:
|
||||
|
||||
# Bootloader
|
||||
# This definition is optional, and if your keyboard supports multiple bootloaders of
|
||||
# different sizes, comment this out, and the correct address will be loaded
|
||||
# automatically (+60). See bootloader.mk for all options.
|
||||
BOOTLOADER = USBasp
|
||||
|
||||
Compatible flashers:
|
||||
|
||||
* [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) (recommended GUI)
|
||||
* [avrdude](http://www.nongnu.org/avrdude/) with the `usbasp` programmer
|
||||
* [AVRDUDESS](https://github.com/zkemble/AVRDUDESS)
|
||||
|
||||
Flashing sequence:
|
||||
|
||||
1. Press the `RESET` keycode, or keep the boot pin shorted to GND while quickly shorting RST to GND
|
||||
2. Wait for the OS to detect the device
|
||||
3. Flash a .hex file
|
||||
4. Reset the device into application mode (may be done automatically)
|
||||
|
||||
## STM32
|
||||
|
||||
All STM32 chips come preloaded with a factory bootloader that cannot be modified nor deleted. Some STM32 chips have bootloaders that do not come with USB programming (e.g. STM32F103) but the process is still the same.
|
||||
|
@@ -127,9 +127,7 @@ Once it does this, you'll want to reset the controller. It should then show out
|
||||
>>> dfu-programmer atmega32u4 reset
|
||||
```
|
||||
|
||||
If you have any issues with this, you may need to this:
|
||||
|
||||
sudo make <my_keyboard>:<my_keymap>:dfu
|
||||
?> If you have any issues with this - such as `dfu-programmer: no device present` - please see the [Frequently Asked Build Questions](faq_build.md).
|
||||
|
||||
#### DFU commands
|
||||
|
||||
|
45
docs/python_development.md
Normal file
45
docs/python_development.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# Python Development in QMK
|
||||
|
||||
This document gives an overview of how QMK has structured its python code. You should read this before working on any of the python code.
|
||||
|
||||
## Script directories
|
||||
|
||||
There are two places scripts live in QMK: `qmk_firmware/bin` and `qmk_firmware/util`. You should use `bin` for any python scripts that utilize the `qmk` wrapper. Scripts that are standalone and not run very often live in `util`.
|
||||
|
||||
We discourage putting anything into `bin` that does not utilize the `qmk` wrapper. If you think you have a good reason for doing so please talk to us about your use case.
|
||||
|
||||
## Python Modules
|
||||
|
||||
Most of the QMK python modules can be found in `qmk_firmware/lib/python`. This is the path that we append to `sys.path`.
|
||||
|
||||
We have a module hierarchy under that path:
|
||||
|
||||
* `qmk_firmware/lib/python`
|
||||
* `milc.py` - The CLI library we use. Will be pulled out into its own module in the future.
|
||||
* `qmk` - Code associated with QMK
|
||||
* `cli` - Modules that will be imported for CLI commands.
|
||||
* `errors.py` - Errors that can be raised within QMK apps
|
||||
* `keymap.py` - Functions for working with keymaps
|
||||
|
||||
## CLI Scripts
|
||||
|
||||
We have a CLI wrapper that you should utilize for any user facing scripts. We think it's pretty easy to use and it gives you a lot of nice things for free.
|
||||
|
||||
To use the wrapper simply place a module into `qmk_firmware/lib/python/qmk/cli`, and create a symlink to `bin/qmk` named after your module. Dashes in command names will be converted into dots so you can use hierarchy to manage commands.
|
||||
|
||||
When `qmk` is run it checks to see how it was invoked. If it was invoked as `qmk` the module name is take from `sys.argv[1]`. If it was invoked as `qmk-<module-name>` then everything after the first dash is taken as the module name. Dashes and underscores are converted to dots, and then `qmk.cli` is prepended before the module is imported.
|
||||
|
||||
The module uses `@cli.entrypoint()` and `@cli.argument()` decorators to define an entrypoint, which is where execution starts.
|
||||
|
||||
## Example CLI Script
|
||||
|
||||
We have provided a QMK Hello World script you can use as an example. To run it simply run `qmk hello` or `qmk-hello`. The source code is listed below.
|
||||
|
||||
```
|
||||
from milc import cli
|
||||
|
||||
@cli.argument('-n', '--name', default='World', help='Name to greet.')
|
||||
@cli.entrypoint('QMK Python Hello World.')
|
||||
def main(cli):
|
||||
cli.echo('Hello, %s!', cli.config.general.name)
|
||||
```
|
@@ -1,3 +1,18 @@
|
||||
/* Copyright (C) 2019 Elia Ritterbusch
|
||||
+
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* Library made by: g4lvanix
|
||||
* Github repository: https://github.com/g4lvanix/I2C-master-lib
|
||||
*/
|
||||
|
@@ -1,3 +1,18 @@
|
||||
/* Copyright (C) 2019 Elia Ritterbusch
|
||||
+
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* Library made by: g4lvanix
|
||||
* Github repository: https://github.com/g4lvanix/I2C-master-lib
|
||||
*/
|
||||
|
@@ -1,3 +1,18 @@
|
||||
/* Copyright (C) 2019 Elia Ritterbusch
|
||||
+
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* Library made by: g4lvanix
|
||||
* Github repository: https://github.com/g4lvanix/I2C-slave-lib
|
||||
*/
|
||||
@@ -68,4 +83,4 @@ ISR(TWI_vect){
|
||||
|
||||
// Reset i2c state machine to be ready for next interrupt
|
||||
TWCR |= (1 << TWIE) | (1 << TWINT) | (ack << TWEA) | (1 << TWEN);
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +1,18 @@
|
||||
/* Copyright (C) 2019 Elia Ritterbusch
|
||||
+
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* Library made by: g4lvanix
|
||||
* Github repository: https://github.com/g4lvanix/I2C-slave-lib
|
||||
|
||||
@@ -15,4 +30,4 @@ extern volatile uint8_t i2c_slave_reg[I2C_SLAVE_REG_COUNT];
|
||||
void i2c_slave_init(uint8_t address);
|
||||
void i2c_slave_stop(void);
|
||||
|
||||
#endif // I2C_SLAVE_H
|
||||
#endif // I2C_SLAVE_H
|
||||
|
51
keyboards/angel64/angel64.c
Normal file
51
keyboards/angel64/angel64.c
Normal file
@@ -0,0 +1,51 @@
|
||||
/* Copyright 2019 kakunpc
|
||||
*
|
||||
* 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 "angel64.h"
|
||||
|
||||
// Optional override functions below.
|
||||
// You can leave any or all of these undefined.
|
||||
// These are only required if you want to perform custom actions.
|
||||
|
||||
/*
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
// put your keyboard start-up code here
|
||||
// runs once when the firmware starts up
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
*/
|
48
keyboards/angel64/angel64.h
Normal file
48
keyboards/angel64/angel64.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* Copyright 2019 kakunpc
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
/* This a shortcut to help you visually see your layout.
|
||||
*
|
||||
* The first section contains all of the arguments representing the physical
|
||||
* layout of the board and position of the keys.
|
||||
*
|
||||
* The second converts the arguments into a two-dimensional array which
|
||||
* represents the switch matrix.
|
||||
*/
|
||||
#define LAYOUT( \
|
||||
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, k36, k37, k38, k39, k40, \
|
||||
k41, k42, k43, k44, k45, k46, k47, k48, k49, k50, k51, k52, k53, \
|
||||
k54, k55, k56, k57, k58, k59, k60, k61, k62, k63, k64\
|
||||
) \
|
||||
{ \
|
||||
{ k01, k13, k25, k37, k49, k61 }, \
|
||||
{ k02, k14, k26, k38, k50, k62 }, \
|
||||
{ k03, k15, k27, k39, k51, k63 }, \
|
||||
{ k04, k16, k28, k40, k52, k64 }, \
|
||||
{ k05, k17, k29, k41, k53, KC_NO }, \
|
||||
{ k06, k18, k30, k42, k54, KC_NO }, \
|
||||
{ k07, k19, k31, k43, k55, KC_NO }, \
|
||||
{ k08, k20, k32, k44, k56, KC_NO }, \
|
||||
{ k09, k21, k33, k45, k57, KC_NO }, \
|
||||
{ k10, k22, k34, k46, k58, KC_NO }, \
|
||||
{ k11, k23, k35, k47, k59, KC_NO }, \
|
||||
{ k12, k24, k36, k48, k60, KC_NO } \
|
||||
}
|
242
keyboards/angel64/config.h
Normal file
242
keyboards/angel64/config.h
Normal file
@@ -0,0 +1,242 @@
|
||||
/*
|
||||
Copyright 2019 kakunpc
|
||||
|
||||
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 0x0000
|
||||
#define DEVICE_VER 0x0001
|
||||
#define MANUFACTURER kakunpc
|
||||
#define PRODUCT angel64
|
||||
#define DESCRIPTION A custom keyboard
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 12
|
||||
#define MATRIX_COLS 6
|
||||
|
||||
/*
|
||||
* Keyboard Matrix Assignments
|
||||
*
|
||||
*/
|
||||
#define MATRIX_ROW_PINS { D4, C6, D7, E6, B4, B5 }
|
||||
#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3 }
|
||||
#define UNUSED_PINS
|
||||
|
||||
/*
|
||||
* Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
|
||||
*/
|
||||
#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
|
||||
|
||||
// #define BACKLIGHT_PIN B7
|
||||
// #define BACKLIGHT_BREATHING
|
||||
// #define BACKLIGHT_LEVELS 3
|
||||
|
||||
// #define RGB_DI_PIN E2
|
||||
// #ifdef RGB_DI_PIN
|
||||
// #define RGBLED_NUM 64
|
||||
// #define RGBLIGHT_HUE_STEP 8
|
||||
// #define RGBLIGHT_SAT_STEP 8
|
||||
// #define RGBLIGHT_VAL_STEP 8
|
||||
// #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
|
||||
// #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
|
||||
// /*== all animations enable ==*/
|
||||
// #define RGBLIGHT_ANIMATIONS
|
||||
// /*== or choose animations ==*/
|
||||
// #define RGBLIGHT_EFFECT_BREATHING
|
||||
// #define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||
// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||
// #define RGBLIGHT_EFFECT_SNAKE
|
||||
// #define RGBLIGHT_EFFECT_KNIGHT
|
||||
// #define RGBLIGHT_EFFECT_CHRISTMAS
|
||||
// #define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||
// #define RGBLIGHT_EFFECT_RGB_TEST
|
||||
// #define RGBLIGHT_EFFECT_ALTERNATING
|
||||
// /*== customize breathing effect ==*/
|
||||
// /*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
|
||||
// #define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
|
||||
// /*==== use exp() and sin() ====*/
|
||||
// #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
|
||||
// #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
|
||||
// #endif
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
||||
/* number of backlight levels */
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
/* Locking resynchronize hack */
|
||||
#define LOCKING_RESYNC_ENABLE
|
||||
|
||||
/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
|
||||
* This is userful for the Windows task manager shortcut (ctrl+shift+esc).
|
||||
*/
|
||||
// #define GRAVE_ESC_CTRL_OVERRIDE
|
||||
|
||||
/*
|
||||
* Force NKRO
|
||||
*
|
||||
* Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
|
||||
* state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
|
||||
* makefile for this to work.)
|
||||
*
|
||||
* If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
|
||||
* until the next keyboard reset.
|
||||
*
|
||||
* NKRO may prevent your keystrokes from being detected in the BIOS, but it is
|
||||
* fully operational during normal computer usage.
|
||||
*
|
||||
* For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
|
||||
* or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
|
||||
* bootmagic, NKRO mode will always be enabled until it is toggled again during a
|
||||
* power-up.
|
||||
*
|
||||
*/
|
||||
//#define FORCE_NKRO
|
||||
|
||||
/*
|
||||
* Magic Key Options
|
||||
*
|
||||
* Magic keys are hotkey commands that allow control over firmware functions of
|
||||
* the keyboard. They are best used in combination with the HID Listen program,
|
||||
* found here: https://www.pjrc.com/teensy/hid_listen.html
|
||||
*
|
||||
* The options below allow the magic key functionality to be changed. This is
|
||||
* useful if your keyboard/keypad is missing keys and you want magic key support.
|
||||
*
|
||||
*/
|
||||
|
||||
/* key combination for magic key command */
|
||||
/* defined by default; to change, uncomment and set to the combination you want */
|
||||
// #define IS_COMMAND() (get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))
|
||||
|
||||
/* control how magic key switches layers */
|
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
|
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
|
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
|
||||
|
||||
/* override magic key keymap */
|
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
|
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
|
||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
|
||||
//#define MAGIC_KEY_HELP H
|
||||
//#define MAGIC_KEY_HELP_ALT SLASH
|
||||
//#define MAGIC_KEY_DEBUG D
|
||||
//#define MAGIC_KEY_DEBUG_MATRIX X
|
||||
//#define MAGIC_KEY_DEBUG_KBD K
|
||||
//#define MAGIC_KEY_DEBUG_MOUSE M
|
||||
//#define MAGIC_KEY_VERSION V
|
||||
//#define MAGIC_KEY_STATUS S
|
||||
//#define MAGIC_KEY_CONSOLE C
|
||||
//#define MAGIC_KEY_LAYER0 0
|
||||
//#define MAGIC_KEY_LAYER0_ALT GRAVE
|
||||
//#define MAGIC_KEY_LAYER1 1
|
||||
//#define MAGIC_KEY_LAYER2 2
|
||||
//#define MAGIC_KEY_LAYER3 3
|
||||
//#define MAGIC_KEY_LAYER4 4
|
||||
//#define MAGIC_KEY_LAYER5 5
|
||||
//#define MAGIC_KEY_LAYER6 6
|
||||
//#define MAGIC_KEY_LAYER7 7
|
||||
//#define MAGIC_KEY_LAYER8 8
|
||||
//#define MAGIC_KEY_LAYER9 9
|
||||
//#define MAGIC_KEY_BOOTLOADER B
|
||||
//#define MAGIC_KEY_BOOTLOADER_ALT ESC
|
||||
//#define MAGIC_KEY_LOCK CAPS
|
||||
//#define MAGIC_KEY_EEPROM E
|
||||
//#define MAGIC_KEY_EEPROM_CLEAR BSPACE
|
||||
//#define MAGIC_KEY_NKRO N
|
||||
//#define MAGIC_KEY_SLEEP_LED Z
|
||||
|
||||
/*
|
||||
* Feature disable options
|
||||
* These options are also useful to firmware size reduction.
|
||||
*/
|
||||
|
||||
/* disable debug print */
|
||||
//#define NO_DEBUG
|
||||
|
||||
/* disable print */
|
||||
//#define NO_PRINT
|
||||
|
||||
/* disable action features */
|
||||
//#define NO_ACTION_LAYER
|
||||
//#define NO_ACTION_TAPPING
|
||||
//#define NO_ACTION_ONESHOT
|
||||
//#define NO_ACTION_MACRO
|
||||
//#define NO_ACTION_FUNCTION
|
||||
|
||||
/*
|
||||
* MIDI options
|
||||
*/
|
||||
|
||||
/* Prevent use of disabled MIDI features in the keymap */
|
||||
//#define MIDI_ENABLE_STRICT 1
|
||||
|
||||
/* enable basic MIDI features:
|
||||
- MIDI notes can be sent when in Music mode is on
|
||||
*/
|
||||
//#define MIDI_BASIC
|
||||
|
||||
/* enable advanced MIDI features:
|
||||
- MIDI notes can be added to the keymap
|
||||
- Octave shift and transpose
|
||||
- Virtual sustain, portamento, and modulation wheel
|
||||
- etc.
|
||||
*/
|
||||
//#define MIDI_ADVANCED
|
||||
|
||||
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
|
||||
//#define MIDI_TONE_KEYCODE_OCTAVES 1
|
||||
|
||||
/*
|
||||
* HD44780 LCD Display Configuration
|
||||
*/
|
||||
/*
|
||||
#define LCD_LINES 2 //< number of visible lines of the display
|
||||
#define LCD_DISP_LENGTH 16 //< visibles characters per line of the display
|
||||
|
||||
#define LCD_IO_MODE 1 //< 0: memory mapped mode, 1: IO port mode
|
||||
|
||||
#if LCD_IO_MODE
|
||||
#define LCD_PORT PORTB //< port for the LCD lines
|
||||
#define LCD_DATA0_PORT LCD_PORT //< port for 4bit data bit 0
|
||||
#define LCD_DATA1_PORT LCD_PORT //< port for 4bit data bit 1
|
||||
#define LCD_DATA2_PORT LCD_PORT //< port for 4bit data bit 2
|
||||
#define LCD_DATA3_PORT LCD_PORT //< port for 4bit data bit 3
|
||||
#define LCD_DATA0_PIN 4 //< pin for 4bit data bit 0
|
||||
#define LCD_DATA1_PIN 5 //< pin for 4bit data bit 1
|
||||
#define LCD_DATA2_PIN 6 //< pin for 4bit data bit 2
|
||||
#define LCD_DATA3_PIN 7 //< pin for 4bit data bit 3
|
||||
#define LCD_RS_PORT LCD_PORT //< port for RS line
|
||||
#define LCD_RS_PIN 3 //< pin for RS line
|
||||
#define LCD_RW_PORT LCD_PORT //< port for RW line
|
||||
#define LCD_RW_PIN 2 //< pin for RW line
|
||||
#define LCD_E_PORT LCD_PORT //< port for Enable line
|
||||
#define LCD_E_PIN 1 //< pin for Enable line
|
||||
#endif
|
||||
*/
|
||||
|
||||
/* Bootmagic Lite key configuration */
|
||||
// #define BOOTMAGIC_LITE_ROW 0
|
||||
// #define BOOTMAGIC_LITE_COLUMN 0
|
12
keyboards/angel64/info.json
Normal file
12
keyboards/angel64/info.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"keyboard_name": "angel64",
|
||||
"url": "https://kakunpc.booth.pm/",
|
||||
"maintainer": "kakunpc",
|
||||
"width": 14,
|
||||
"height": 5,
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"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":"back", "x":13, "y":0}, {"label":"Q", "x":0, "y":1, "w":1.5}, {"label":"W", "x":1.5, "y":1}, {"label":"E", "x":2.5, "y":1}, {"label":"R", "x":3.5, "y":1}, {"label":"T", "x":4.5, "y":1}, {"label":"Y", "x":5.5, "y":1}, {"label":"U", "x":6.5, "y":1}, {"label":"I", "x":7.5, "y":1}, {"label":"O", "x":8.5, "y":1}, {"label":"P", "x":9.5, "y":1}, {"label":"[", "x":10.5, "y":1}, {"label":"]", "x":11.5, "y":1}, {"label":"|", "x":12.5, "y":1, "w":1.5}, {"label":"Ctrl", "x":0, "y":2}, {"label":"A", "x":1, "y":2}, {"label":"S", "x":2, "y":2}, {"label":"D", "x":3, "y":2}, {"label":"F", "x":4, "y":2}, {"label":"G", "x":5, "y":2}, {"label":"H", "x":6, "y":2}, {"label":"J", "x":7, "y":2}, {"label":"K", "x":8, "y":2}, {"label":"L", "x":9, "y":2}, {"label":";:", "x":10, "y":2}, {"label":"`", "x":11, "y":2}, {"label":"Enter", "x":12, "y":2, "w":2}, {"label":"Shift", "x":0, "y":3, "w":1.5}, {"label":"Z", "x":1.5, "y":3}, {"label":"X", "x":2.5, "y":3}, {"label":"C", "x":3.5, "y":3}, {"label":"V", "x":4.5, "y":3}, {"label":"B", "x":5.5, "y":3}, {"label":"N", "x":6.5, "y":3}, {"label":"M", "x":7.5, "y":3}, {"label":"<", "x":8.5, "y":3}, {"label":">", "x":9.5, "y":3}, {"label":"?", "x":10.5, "y":3}, {"label":"\u2191", "x":11.5, "y":3}, {"label":"Fn", "x":12.5, "y":3, "w":1.5}, {"label":"Caps", "x":0, "y":4}, {"label":"Alt", "x":1, "y":4}, {"label":"Start", "x":2, "y":4, "w":1.5}, {"label":"Ctrl", "x":3.5, "y":4, "w":1.5}, {"label":"Space", "x":5, "y":4, "w":2}, {"label":"Ctrl", "x":7, "y":4, "w":1.5}, {"label":"Alt", "x":8.5, "y":4, "w":1.5}, {"label":"\u2190", "x":10, "y":4}, {"label":"\u2193", "x":11, "y":4}, {"label":"\u2192", "x":12, "y":4}, {"label":"Alt", "x":13, "y":4}]
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2017 Sebastian Kaim
|
||||
/* Copyright 2019 kakunpc
|
||||
*
|
||||
* 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
|
||||
@@ -14,22 +14,6 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(__AVR__)
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include "backlight.h"
|
||||
|
||||
#ifndef PS2AVRGB_BACKLIGHT_H
|
||||
#define PS2AVRGB_BACKLIGHT_H
|
||||
|
||||
uint8_t get_pwm_for_brightness(uint8_t level);
|
||||
void set_backlight_pwm(uint8_t level);
|
||||
void backlight_on(void);
|
||||
void backlight_off(void);
|
||||
|
||||
#endif
|
||||
// place overrides here
|
58
keyboards/angel64/keymaps/default/keymap.c
Normal file
58
keyboards/angel64/keymaps/default/keymap.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/* Copyright 2019 kakunpc
|
||||
*
|
||||
* 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
|
||||
|
||||
enum layers{
|
||||
BASE = 0,
|
||||
COMMAND
|
||||
};
|
||||
|
||||
#define KC_COMMAND LT(COMMAND,KC_SPC)
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[BASE] = LAYOUT(
|
||||
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_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_TAB, 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_UP, KC_RSFT,
|
||||
KC_LCTL, KC_LALT, KC_LGUI, KC_COMMAND, KC_SPC, KC_COMMAND, KC_CAPS, KC_LEFT, KC_DOWN, KC_RIGHT, KC_DEL
|
||||
),
|
||||
[COMMAND] = LAYOUT(
|
||||
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_BSPC ,
|
||||
KC_NO, KC_UP, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
|
||||
KC_NO, KC_LEFT, KC_DOWN, KC_RIGHT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
|
||||
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
|
||||
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO
|
||||
)
|
||||
};
|
||||
|
||||
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) {
|
||||
|
||||
}
|
||||
|
||||
void keyboard_post_init_user(void) {
|
||||
}
|
1
keyboards/angel64/keymaps/default/readme.md
Normal file
1
keyboards/angel64/keymaps/default/readme.md
Normal file
@@ -0,0 +1 @@
|
||||
# The default keymap for angel64
|
287
keyboards/angel64/matrix.c
Normal file
287
keyboards/angel64/matrix.c
Normal file
@@ -0,0 +1,287 @@
|
||||
/*
|
||||
Copyright 2012-2018 Jun Wako, Jack Humbert, 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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "wait.h"
|
||||
#include "print.h"
|
||||
#include "debug.h"
|
||||
#include "util.h"
|
||||
#include "matrix.h"
|
||||
#include "debounce.h"
|
||||
#include "quantum.h"
|
||||
|
||||
#if (MATRIX_COLS <= 8)
|
||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||
# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
|
||||
# define matrix_bitpop(i) bitpop(matrix[i])
|
||||
# define ROW_SHIFTER ((uint8_t)1)
|
||||
#elif (MATRIX_COLS <= 16)
|
||||
# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n")
|
||||
# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row))
|
||||
# define matrix_bitpop(i) bitpop16(matrix[i])
|
||||
# define ROW_SHIFTER ((uint16_t)1)
|
||||
#elif (MATRIX_COLS <= 32)
|
||||
# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n")
|
||||
# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row))
|
||||
# define matrix_bitpop(i) bitpop32(matrix[i])
|
||||
# define ROW_SHIFTER ((uint32_t)1)
|
||||
#endif
|
||||
|
||||
#ifdef MATRIX_MASKED
|
||||
extern const matrix_row_t matrix_mask[];
|
||||
#endif
|
||||
|
||||
static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||
static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||
|
||||
/* matrix state(1:on, 0:off) */
|
||||
static matrix_row_t raw_matrix[MATRIX_ROWS]; //raw values
|
||||
static matrix_row_t matrix[MATRIX_ROWS]; //debounced values
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_quantum(void) {
|
||||
matrix_init_kb();
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_scan_quantum(void) {
|
||||
matrix_scan_kb();
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_kb(void) {
|
||||
matrix_init_user();
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_scan_kb(void) {
|
||||
matrix_scan_user();
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_user(void) {
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_scan_user(void) {
|
||||
}
|
||||
|
||||
inline
|
||||
uint8_t matrix_rows(void) {
|
||||
return MATRIX_ROWS;
|
||||
}
|
||||
|
||||
inline
|
||||
uint8_t matrix_cols(void) {
|
||||
return MATRIX_COLS;
|
||||
}
|
||||
|
||||
//Deprecated.
|
||||
bool matrix_is_modified(void)
|
||||
{
|
||||
if (debounce_active()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline
|
||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
||||
{
|
||||
return (matrix[row] & ((matrix_row_t)1<<col));
|
||||
}
|
||||
|
||||
inline
|
||||
matrix_row_t matrix_get_row(uint8_t row)
|
||||
{
|
||||
// Matrix mask lets you disable switches in the returned matrix data. For example, if you have a
|
||||
// switch blocker installed and the switch is always pressed.
|
||||
#ifdef MATRIX_MASKED
|
||||
return matrix[row] & matrix_mask[row];
|
||||
#else
|
||||
return matrix[row];
|
||||
#endif
|
||||
}
|
||||
|
||||
void matrix_print(void)
|
||||
{
|
||||
print_matrix_header();
|
||||
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
phex(row); print(": ");
|
||||
print_matrix_row(row);
|
||||
print("\n");
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t matrix_key_count(void)
|
||||
{
|
||||
uint8_t count = 0;
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
count += matrix_bitpop(i);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static void select_row(uint8_t row)
|
||||
{
|
||||
setPinOutput(row_pins[row]);
|
||||
writePinLow(row_pins[row]);
|
||||
}
|
||||
|
||||
static void unselect_row(uint8_t row)
|
||||
{
|
||||
setPinInputHigh(row_pins[row]);
|
||||
}
|
||||
|
||||
static void unselect_rows(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
static void select_col(uint8_t col)
|
||||
{
|
||||
setPinOutput(col_pins[col]);
|
||||
writePinLow(col_pins[col]);
|
||||
}
|
||||
|
||||
static void unselect_col(uint8_t col)
|
||||
{
|
||||
setPinInputHigh(col_pins[col]);
|
||||
}
|
||||
|
||||
static void unselect_cols(void)
|
||||
{
|
||||
for(uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
setPinInputHigh(col_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
static void init_pins(void) {
|
||||
unselect_rows();
|
||||
unselect_cols();
|
||||
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
|
||||
setPinInputHigh(col_pins[x]);
|
||||
}
|
||||
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
|
||||
setPinInputHigh(row_pins[x]);
|
||||
}
|
||||
}
|
||||
|
||||
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
|
||||
{
|
||||
// Store last value of row prior to reading
|
||||
matrix_row_t last_row_value = current_matrix[current_row];
|
||||
|
||||
// Clear data in matrix row
|
||||
current_matrix[current_row] = 0;
|
||||
|
||||
// Select row and wait for row selecton to stabilize
|
||||
select_row(current_row);
|
||||
wait_us(30);
|
||||
|
||||
// For each col...
|
||||
for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
|
||||
|
||||
// Select the col pin to read (active low)
|
||||
uint8_t pin_state = readPin(col_pins[col_index]);
|
||||
|
||||
// Populate the matrix row with the state of the col pin
|
||||
current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
|
||||
}
|
||||
|
||||
// Unselect row
|
||||
unselect_row(current_row);
|
||||
|
||||
return (last_row_value != current_matrix[current_row]);
|
||||
}
|
||||
|
||||
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
|
||||
{
|
||||
bool matrix_changed = false;
|
||||
|
||||
// Select col and wait for col selecton to stabilize
|
||||
select_col(current_col);
|
||||
wait_us(30);
|
||||
|
||||
// For each row...
|
||||
for(uint8_t row_index = 0; row_index < MATRIX_ROWS/2; row_index++)
|
||||
{
|
||||
uint8_t tmp = row_index + MATRIX_ROWS/2;
|
||||
// Store last value of row prior to reading
|
||||
matrix_row_t last_row_value = current_matrix[tmp];
|
||||
|
||||
// Check row pin state
|
||||
if (readPin(row_pins[row_index]) == 0)
|
||||
{
|
||||
// Pin LO, set col bit
|
||||
current_matrix[tmp] |= (ROW_SHIFTER << current_col);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Pin HI, clear col bit
|
||||
current_matrix[tmp] &= ~(ROW_SHIFTER << current_col);
|
||||
}
|
||||
|
||||
// Determine if the matrix changed state
|
||||
if ((last_row_value != current_matrix[tmp]) && !(matrix_changed))
|
||||
{
|
||||
matrix_changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Unselect col
|
||||
unselect_col(current_col);
|
||||
|
||||
return matrix_changed;
|
||||
}
|
||||
|
||||
void matrix_init(void) {
|
||||
|
||||
// initialize key pins
|
||||
init_pins();
|
||||
|
||||
// initialize matrix state: all keys off
|
||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
||||
raw_matrix[i] = 0;
|
||||
matrix[i] = 0;
|
||||
}
|
||||
|
||||
debounce_init(MATRIX_ROWS);
|
||||
|
||||
matrix_init_quantum();
|
||||
}
|
||||
|
||||
uint8_t matrix_scan(void)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// Set row, read cols
|
||||
for (uint8_t current_row = 0; current_row < MATRIX_ROWS / 2; current_row++) {
|
||||
changed |= read_cols_on_row(raw_matrix, current_row);
|
||||
}
|
||||
//else
|
||||
// Set col, read rows
|
||||
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
|
||||
changed |= read_rows_on_col(raw_matrix, current_col);
|
||||
}
|
||||
|
||||
debounce(raw_matrix, matrix, MATRIX_ROWS, changed);
|
||||
|
||||
matrix_scan_quantum();
|
||||
return (uint8_t)changed;
|
||||
}
|
15
keyboards/angel64/readme.md
Normal file
15
keyboards/angel64/readme.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# angel64
|
||||
|
||||

|
||||
|
||||
Keyboard for tablets.
|
||||
|
||||
Keyboard Maintainer: [kakunpc](https://github.com/kakunpc)
|
||||
Hardware Supported: angel64_alpha, promicro
|
||||
Hardware Availability: booth([@kakunpc](https://kakunpc.booth.pm/))
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make angel64: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).
|
83
keyboards/angel64/rules.mk
Normal file
83
keyboards/angel64/rules.mk
Normal file
@@ -0,0 +1,83 @@
|
||||
# MCU name
|
||||
MCU = atmega32u4
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
#
|
||||
# This will be an integer division of F_USB below, as it is sourced by
|
||||
# F_USB after it has run through any CPU prescalers. Note that this value
|
||||
# does not *change* the processor frequency - it should merely be updated to
|
||||
# reflect the processor speed set externally so that the code can use accurate
|
||||
# software delays.
|
||||
F_CPU = 16000000
|
||||
|
||||
|
||||
#
|
||||
# LUFA specific
|
||||
#
|
||||
# Target architecture (see library "Board Types" documentation).
|
||||
ARCH = AVR8
|
||||
|
||||
# Input clock frequency.
|
||||
# This will define a symbol, F_USB, in all source code files equal to the
|
||||
# input clock frequency (before any prescaling is performed) in Hz. This value may
|
||||
# differ from F_CPU if prescaling is used on the latter, and is required as the
|
||||
# raw input clock is fed directly to the PLL sections of the AVR for high speed
|
||||
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
|
||||
# at the end, this will be done automatically to create a 32-bit value in your
|
||||
# source code.
|
||||
#
|
||||
# If no clock division is performed on the input clock inside the AVR (via the
|
||||
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
|
||||
F_USB = $(F_CPU)
|
||||
|
||||
# Interrupt driven control endpoint task(+60)
|
||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
|
||||
|
||||
# Bootloader selection
|
||||
# Teensy halfkay
|
||||
# Pro Micro caterina
|
||||
# Atmel DFU atmel-dfu
|
||||
# LUFA DFU lufa-dfu
|
||||
# QMK DFU qmk-dfu
|
||||
# atmega32a bootloadHID
|
||||
BOOTLOADER = 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 = yes # Console for debug(+400)
|
||||
COMMAND_ENABLE = yes # 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 = no # Enable keyboard backlight functionality on B7 by default
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
|
||||
UNICODE_ENABLE = no # Unicode
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||
AUDIO_ENABLE = no # Audio output on port C6
|
||||
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
||||
HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)
|
||||
CUSTOM_MATRIX = yes
|
||||
|
||||
SRC += matrix.c
|
1
keyboards/clueboard/66_hotswap/keymaps/json/keymap.json
Normal file
1
keyboards/clueboard/66_hotswap/keymaps/json/keymap.json
Normal file
@@ -0,0 +1 @@
|
||||
{"keyboard":"clueboard/66_hotswap/gen1","keymap":"default_66","layout":"LAYOUT","layers":[["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_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_PGDN","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_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_LGUI","KC_LALT","KC_SPC","KC_SPC","KC_RALT","KC_RGUI","MO(1)","KC_RCTL","KC_LEFT","KC_DOWN","KC_RGHT"],["KC_GRV","KC_F1","KC_F2","KC_F3","KC_F4","KC_F5","KC_F6","KC_F7","KC_F8","KC_F9","KC_F10","KC_F11","KC_F12","KC_DEL","BL_INC","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_MPRV","KC_MPLY","KC_MNXT","KC_NO","KC_MUTE","BL_DEC","KC_NO","KC_NO","MO(2)","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_PGUP","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","MO(1)","KC_NO","KC_HOME","KC_PGDN","KC_END"],["KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","BL_TOGG","BL_INC","KC_NO","KC_NO","KC_NO","KC_NO","RESET","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","BL_DEC","KC_NO","KC_NO","MO(2)","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","KC_NO","BL_STEP","KC_NO","KC_NO","MO(1)","KC_NO","KC_NO","KC_NO","KC_NO"]],"author":"","notes":""}
|
@@ -4,9 +4,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
/* Qwerty
|
||||
* ,-----------------------------------------------------------------------------------------.
|
||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | Bkspc |
|
||||
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ |
|
||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | Bkspc |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
* | Fn | A | S | D | F | G | H | J | K | L | ; | ' | Enter |
|
||||
* |-----------------------------------------------------------------------------------------+
|
||||
@@ -17,8 +17,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
*/
|
||||
|
||||
LAYOUT_directional(
|
||||
KC_GRAVE, 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_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_GRAVE, 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_BSLS,
|
||||
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_BSPC,
|
||||
MO(1), 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, _______, RSFT_T(KC_SLSH) , KC_UP, KC_ESCAPE,
|
||||
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT
|
||||
|
@@ -12,6 +12,7 @@ Settings:
|
||||
* RESET is available as `Fn`+ ` ESC`
|
||||
* Underglow toggle is available as `Fn` + `Q`. Yes your keyboard has lights even if you didn't get the LEDs. Bonus!
|
||||
* vim-style arrow key bindings H J K L in layer 1
|
||||
* The `Bkspc` and `\` keys have been swapped, the reach was too great to have backspace on the top row
|
||||
|
||||
### Initial Installation
|
||||
|
||||
@@ -35,16 +36,16 @@ A hex file `dz60_billiams.hex` will be created in the base qmk_firmware director
|
||||
5. Holding those keys down, plug the keyboard into your computer, which will put the keyboard in bootlegger mode
|
||||
6. If you are using [QMK toolbox](https://github.com/qmk/qmk_toolbox/releases), upload the .hex file you made above, select it and hit the flash button. For the love of all that is good and holy on Earth, don't hit the load button, that will load the default keymap and that's not what you want! Unless it is, in which case click away.
|
||||
|
||||
Note: If you didn't follow my instructions in 4 and accidentally loaded the default keymap, then to `RESET` the keyboard and kick it into bootleg mode again, hold the `down arrow` key and `\`. The default layout is Build 1 and sets the `MENU` key on that build to `Fn`. `MENU` corresponds to `down arrow` in build 4. Note that you don't have to unplug the keyboard.
|
||||
Note: If you didn't follow my instructions in 4 and accidentally loaded the default keymap, then to `RESET` the keyboard and kick it into bootleg mode again, hold the `down arrow` key and `\`. The default layout is Build 1 and sets the `MENU` key on that build to `Fn`. `MENU` corresponds to `down arrow` in build 4. Note that you don't have to unplug the keyboard.
|
||||
|
||||
Hope this helps!
|
||||
|
||||
### 0 Qwerty
|
||||
```
|
||||
,-----------------------------------------------------------------------------------------.
|
||||
| ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | Bkspc |
|
||||
| ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ |
|
||||
|-----------------------------------------------------------------------------------------+
|
||||
| Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ |
|
||||
| Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | Bkspc |
|
||||
|-----------------------------------------------------------------------------------------+
|
||||
| Fn | A | S | D | F | G | H | J | K | L | ; | ' | Enter |
|
||||
|-----------------------------------------------------------------------------------------+
|
||||
@@ -69,4 +70,3 @@ FN Layer
|
||||
| | | | | | | HOME | PG_DN | END |
|
||||
`-----------------------------------------------------------------------------------------'
|
||||
```
|
||||
|
||||
|
@@ -146,7 +146,7 @@ void rgb_matrix_indicators_user(void)
|
||||
break;
|
||||
|
||||
case _RGB: {
|
||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
HSV hsv = { rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v };
|
||||
HSV hui = hsv;
|
||||
HSV hud = hsv;
|
||||
HSV sai = hsv;
|
||||
|
@@ -1,216 +0,0 @@
|
||||
/*
|
||||
* Good on you for modifying your layout, this is the most nonQMK layout you will come across
|
||||
* There are three modes, Steno (the default), QWERTY (Toggleable) and a Momentary symbol layer
|
||||
*
|
||||
* Don't modify the steno layer directly, instead add chords using the keycodes and macros
|
||||
* from sten.h to the layout you want to modify.
|
||||
*
|
||||
* Observe the comment above processQWERTY!
|
||||
*
|
||||
* http://docs.gboards.ca
|
||||
*/
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
#include "sten.h"
|
||||
#include "keymap_steno.h"
|
||||
#define IGNORE_MOD_TAP_INTERRUPT
|
||||
|
||||
int getKeymapCount(void);
|
||||
|
||||
// Proper Layers
|
||||
#define FUNCT (LSD | LK | LP | LH)
|
||||
#define MEDIA (LSD | LK | LW | LR)
|
||||
#define MOVE (ST1 | ST2)
|
||||
|
||||
/* Keyboard Layout
|
||||
* ,---------------------------------. ,------------------------------.
|
||||
* | FN | LSU | LFT | LP | LH | ST1 | | ST3 | RF | RP | RL | RT | RD |
|
||||
* |-----+-----+-----+----+----|-----| |-----|----+----+----+----+----|
|
||||
* | PWR | LSD | LK | LW | LR | ST2 | | ST4 | RR | RG | RB | RS | RZ |
|
||||
* `---------------------------------' `------------------------------'
|
||||
* ,---------------, .---------------.
|
||||
* | NUM | LA | LO | | RE | RU | NUM |
|
||||
* `---------------' `---------------'
|
||||
*/
|
||||
|
||||
// YOU MUST ORDER THIS!
|
||||
// P Will return from processing on the first match it finds. Therefore
|
||||
// PJ Will run the requested action, remove the matched chord and continue
|
||||
//
|
||||
// First any chords that would conflict with PJs need to be checked, then PJs, lastly Ps.
|
||||
// For all chords should be ordered by length in their section!
|
||||
//
|
||||
// http://docs.gboards.ca
|
||||
bool processQwerty(void) {
|
||||
// Place P's that would be trashed by PJ's here
|
||||
P( RT | RS | RD | RZ | NUM, SEND_STRING(VERSION); SEND_STRING(__DATE__));
|
||||
P( NUM | LA | LO | RE | RU, SEND(KC_MPLY));
|
||||
P( ST1 | ST2 | ST3 | ST4, SEND(KC_BSPC));
|
||||
|
||||
// Thumb Chords
|
||||
P( LA | LO | RE | RU, SEND(KC_CAPS));
|
||||
P( LA | RU, SEND(KC_ESC));
|
||||
PJ( LO | RE, SEND(KC_LCTL));
|
||||
PJ( NUM | LA | RU, SEND(KC_LCTL); SEND(KC_LSFT));
|
||||
PJ( NUM | LA | RE, SEND(KC_LCTL); SEND(KC_LSFT); SEND(KC_LALT));
|
||||
|
||||
// Mods
|
||||
PJ( RT | RD | RS | RZ, SEND(KC_LGUI));
|
||||
PJ( RT | RD, SEND(KC_LCTL));
|
||||
PJ( RS | RZ, SEND(KC_LALT));
|
||||
PJ( LA | NUM, SEND(KC_LCTL));
|
||||
PJ( LA | LO, SEND(KC_LALT));
|
||||
PJ( LO, SEND(KC_LSFT));
|
||||
|
||||
// Function Layer
|
||||
P( FUNCT | RF | RR, SEND(KC_F5));
|
||||
P( FUNCT | RP | RB, SEND(KC_F6));
|
||||
P( FUNCT | RL | RG, SEND(KC_F7));
|
||||
P( FUNCT | RT | RS, SEND(KC_F8));
|
||||
P( FUNCT | RF, SEND(KC_F1));
|
||||
P( FUNCT | RP, SEND(KC_F2));
|
||||
P( FUNCT | RL, SEND(KC_F3));
|
||||
P( FUNCT | RT, SEND(KC_F4));
|
||||
P( FUNCT | RR, SEND(KC_F9));
|
||||
P( FUNCT | RG, SEND(KC_F10));
|
||||
P( FUNCT | RB, SEND(KC_F11));
|
||||
P( FUNCT | RS, SEND(KC_F12));
|
||||
|
||||
// Movement Layer
|
||||
P( MOVE | RF, SEND(KC_LEFT));
|
||||
P( MOVE | RP, SEND(KC_DOWN));
|
||||
P( MOVE | RL, SEND(KC_UP));
|
||||
P( MOVE | RT, SEND(KC_RIGHT));
|
||||
P( MOVE | ST3, SEND(KC_PGUP));
|
||||
P( MOVE | ST4, SEND(KC_PGDN));
|
||||
|
||||
// Media Layer
|
||||
P( MEDIA | RF, SEND(KC_MPRV));
|
||||
P( MEDIA | RP, SEND(KC_MPLY));
|
||||
P( MEDIA | RL, SEND(KC_MPLY));
|
||||
P( MEDIA | RT, SEND(KC_MNXT));
|
||||
P( MEDIA | RD, SEND(KC_VOLU));
|
||||
P( MEDIA | RZ, SEND(KC_VOLD));
|
||||
P( MEDIA | RS, SEND(KC_MUTE));
|
||||
|
||||
// Mouse Keys
|
||||
P( LP | LH, clickMouse(KC_MS_BTN1));
|
||||
P( LW | LR, clickMouse(KC_MS_BTN2));
|
||||
|
||||
// Number Row
|
||||
P( NUM | LSU, SEND(KC_1));
|
||||
P( NUM | LFT, SEND(KC_2));
|
||||
P( NUM | LP, SEND(KC_3));
|
||||
P( NUM | LH, SEND(KC_4));
|
||||
P( NUM | ST1, SEND(KC_5));
|
||||
P( NUM | ST3, SEND(KC_6));
|
||||
P( NUM | RF, SEND(KC_7));
|
||||
P( NUM | RP, SEND(KC_8));
|
||||
P( NUM | RL, SEND(KC_9));
|
||||
P( NUM | RT, SEND(KC_0));
|
||||
P( NUM | LA, SEND(KC_5));
|
||||
P( NUM | RT, SEND(KC_0));
|
||||
|
||||
// Specials
|
||||
P( LA | NUM, SEND(KC_ESC));
|
||||
P( RU | NUM, SEND(KC_TAB));
|
||||
P( RE | RU, SEND(KC_BSPC));
|
||||
P( RD | RZ, SEND(KC_ENT));
|
||||
P( RE, SEND(KC_ENT));
|
||||
P( RD, SEND(KC_BSPC));
|
||||
P( NUM, SEND(KC_BSPC));
|
||||
P( LA, SEND(KC_SPC));
|
||||
P( RU, SEND(KC_SPC));
|
||||
P( RZ, SEND(KC_ESC));
|
||||
|
||||
// Letters
|
||||
P( LSU | LSD, SEND(KC_A));
|
||||
P( LFT | LK, SEND(KC_S));
|
||||
P( LP | LW, SEND(KC_D));
|
||||
P( LH | LR, SEND(KC_F));
|
||||
P( ST1 | ST2, SEND(KC_G));
|
||||
P( ST3 | ST4, SEND(KC_H));
|
||||
P( RF | RR, SEND(KC_J));
|
||||
P( RT | RS, SEND(KC_SCLN))
|
||||
P( RG | RL, SEND(KC_L));
|
||||
P( RP | RB, SEND(KC_K));
|
||||
P( LSU, SEND(KC_Q));
|
||||
P( LSD, SEND(KC_Z));
|
||||
P( LFT, SEND(KC_W));
|
||||
P( LK, SEND(KC_X));
|
||||
P( LP, SEND(KC_E));
|
||||
P( LW, SEND(KC_C));
|
||||
P( LH, SEND(KC_R));
|
||||
P( LR, SEND(KC_V));
|
||||
P( ST1, SEND(KC_T));
|
||||
P( ST2, SEND(KC_B));
|
||||
P( ST3, SEND(KC_Y));
|
||||
P( ST4, SEND(KC_N));
|
||||
P( RF, SEND(KC_U));
|
||||
P( RR, SEND(KC_M));
|
||||
P( RP, SEND(KC_I));
|
||||
P( RB, SEND(KC_COMM));
|
||||
P( RL, SEND(KC_O));
|
||||
P( RG, SEND(KC_DOT));
|
||||
P( RT, SEND(KC_P));
|
||||
P( RS, SEND(KC_SLSH));
|
||||
|
||||
// Symbols and Numbers
|
||||
P( PWR | RE | RU, SEND(KC_ENT));
|
||||
P( PWR | LA | LO, SEND(KC_SPC));
|
||||
P( PWR | LP | LW, SEND(KC_LSFT); SEND(KC_9)); // (
|
||||
P( PWR | LH | LR, SEND(KC_LSFT); SEND(KC_0)); // )
|
||||
P( PWR | ST1 | ST2, SEND(KC_GRV)); // `
|
||||
P( PWR | RD | RZ, SEND(KC_ESC));
|
||||
P( PWR | LSU | LSD, SEND(KC_LSFT); SEND(KC_3)); // #
|
||||
P( PWR | LFT | LK, SEND(KC_LSFT); SEND(KC_4)); // $
|
||||
P( PWR | LSU, SEND(KC_LSFT); SEND(KC_1)); // !
|
||||
P( PWR | LSD, SEND(KC_LSFT); SEND(KC_5)); // %
|
||||
P( PWR | LFT, SEND(KC_LSFT); SEND(KC_2)); // @
|
||||
P( PWR | LK, SEND(KC_LSFT); SEND(KC_6)); // ^
|
||||
P( PWR | LP, SEND(KC_LSFT); SEND(KC_LBRC)); // {
|
||||
P( PWR | LW, SEND(KC_LBRC));
|
||||
P( PWR | LH, SEND(KC_LSFT); SEND(KC_RBRC)); // }
|
||||
P( PWR | LR, SEND(KC_RBRC));
|
||||
P( PWR | ST1, SEND(KC_LSFT); SEND(KC_BSLS)); // |
|
||||
P( PWR | ST2, SEND(KC_LSFT); SEND(KC_GRV)); // ~
|
||||
P( PWR | ST3, SEND(KC_QUOT));
|
||||
P( PWR | ST4, SEND(KC_LSFT); SEND(KC_QUOT)); // "
|
||||
P( PWR | RF, SEND(KC_KP_PLUS));
|
||||
P( PWR | RR, SEND(KC_LSFT); SEND(KC_7)); // &
|
||||
P( PWR | RP, SEND(KC_MINS));
|
||||
P( PWR | RB, SEND(KC_EQL));
|
||||
P( PWR | RL, SEND(KC_SLSH));
|
||||
P( PWR | RG, SEND(KC_COMM));
|
||||
P( PWR | RT, SEND(KC_PAST));
|
||||
P( PWR | RS, SEND(KC_DOT));
|
||||
P( PWR | RD, SEND(KC_TAB));
|
||||
P( PWR | LA, SEND(KC_SCLN));
|
||||
P( PWR | LO, SEND(KC_SLSH));
|
||||
P( PWR | RE, SEND(KC_SCLN));
|
||||
P( PWR | RU, SEND(KC_SLSH));
|
||||
|
||||
|
||||
// If we make here, send as a steno chord
|
||||
// If plover is running we can hook that host side
|
||||
return false;
|
||||
}
|
||||
|
||||
#define STENO_LAYER 0
|
||||
|
||||
// "Layers"
|
||||
// Steno layer should be first in your map.
|
||||
// When PWR | FN | RR | RG | RB | RS is pressed, the layer is increased to the next map. You must return to STENO_LAYER at the end.
|
||||
// If you have only a single layer, you must set SINGLELAYER = yes in your rules.mk, otherwise you may experince undefined behaviour
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
// Main layer, everything goes through here
|
||||
[STENO_LAYER] = LAYOUT_georgi(
|
||||
STN_FN, STN_S1, STN_TL, STN_PL, STN_HL, STN_ST1, STN_ST3, STN_FR, STN_PR, STN_LR, STN_TR, STN_DR,
|
||||
STN_PWR, STN_S2, STN_KL, STN_WL, STN_RL, STN_ST2, STN_ST4, STN_RR, STN_BR, STN_GR, STN_SR, STN_ZR,
|
||||
STN_N1, STN_A, STN_O, STN_E, STN_U, STN_N1)
|
||||
};
|
||||
|
||||
int getKeymapCount(void) {
|
||||
return sizeof(keymaps)/sizeof(keymaps[0]);
|
||||
}
|
@@ -1,6 +0,0 @@
|
||||
# Georgi QWERTY/Steno firmware
|
||||
|
||||
This is a blank template configured with 5K of free space for your onboard dictionary!
|
||||
Read the docs over at [gBoards](http://docs.gboards.ca)
|
||||
|
||||
Ideally you should copy this directory and make your changes there. If you come up with a good layout submit a PR!
|
@@ -1,27 +0,0 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# make georgi:extrakey:dfu
|
||||
# Make sure you have dfu-programmer installed!
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
#Debug options
|
||||
VERBOSE = yes
|
||||
CONSOLE_ENABLE = yes
|
||||
DEBUG_MATRIX_SCAN_RATE = no
|
||||
DEBUG_MATRIX = no
|
||||
KEYBOARD_SHARED_EP = yes
|
||||
CUSTOM_MATRIX = yes
|
||||
MOUSEKEY_ENABLE = no
|
||||
SINGLE_LAYER = no
|
||||
|
||||
|
||||
# A bunch of stuff that you shouldn't touch unless you
|
||||
# know what you're doing.
|
||||
#
|
||||
# No touchy, capiche?
|
||||
SRC += matrix.c i2c_master.c
|
||||
ifeq ($(strip $(DEBUG_MATRIX)), yes)
|
||||
OPT_DEFS += -DDEBUG_MATRIX
|
||||
endif
|
||||
ifeq ($(strip $(SINGLE_LAYER)), yes)
|
||||
OPT_DEFS += -DSINGLE_LAYER
|
||||
endif
|
@@ -49,7 +49,7 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
# atmega32a bootloadHID
|
||||
#
|
||||
# This uses usbaspbootloader
|
||||
# BOOTLOADER = atmel-dfu
|
||||
BOOTLOADER = USBasp
|
||||
|
||||
# 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
|
||||
@@ -58,8 +58,6 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
# Atmel DFU loader 4096
|
||||
# LUFA bootloader 4096
|
||||
# USBaspLoader 2048
|
||||
# OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
||||
OPT_DEFS += -DBOOTLOADER_SIZE=2048
|
||||
|
||||
# Flash program via avrdude, but default command is not suitable.
|
||||
# You can use plaid:default:program
|
||||
|
67
keyboards/ivy/config.h
Normal file
67
keyboards/ivy/config.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0x1337
|
||||
#define PRODUCT_ID 0x6012
|
||||
#define MANUFACTURER Maple Computing
|
||||
#define PRODUCT Ivy
|
||||
#define DESCRIPTION A 3 key macro pad
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 3
|
||||
#define MATRIX_COLS 3
|
||||
|
||||
/* COL2ROW or ROW2COL */
|
||||
#define DIODE_DIRECTION COL2ROW
|
||||
|
||||
/* define if matrix has ghost */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCE 5
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
/* Locking resynchronize hack */
|
||||
#define LOCKING_RESYNC_ENABLE
|
||||
|
||||
#define BACKLIGHT_PIN D2
|
||||
|
||||
/* number of backlight levels */
|
||||
#define BACKLIGHT_LEVELS 3
|
||||
|
||||
/*
|
||||
* 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
|
1
keyboards/ivy/ivy.c
Normal file
1
keyboards/ivy/ivy.c
Normal file
@@ -0,0 +1 @@
|
||||
#include "ivy.h"
|
7
keyboards/ivy/ivy.h
Normal file
7
keyboards/ivy/ivy.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef KEYBOARD_ivy_rev1
|
||||
#include "rev1.h"
|
||||
#endif
|
||||
|
||||
#include "quantum.h"
|
46
keyboards/ivy/keymaps/default/keymap.c
Normal file
46
keyboards/ivy/keymaps/default/keymap.c
Normal file
@@ -0,0 +1,46 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
extern keymap_config_t keymap_config;
|
||||
|
||||
// Each layer gets a name for readability, which is then used in the keymap matrix below.
|
||||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
||||
// entirely and just use numbers.
|
||||
|
||||
enum pad_layers {
|
||||
_L1,
|
||||
_FUNC
|
||||
};
|
||||
|
||||
// Defines for task manager and such
|
||||
#define CALTDEL LCTL(LALT(KC_DEL))
|
||||
#define TSKMGR LCTL(LSFT(KC_ESC))
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
/* Layer 1
|
||||
* ,------.
|
||||
* | 1 |
|
||||
* |------|
|
||||
* | 2 |
|
||||
* |------|
|
||||
* | FN |
|
||||
* `------'
|
||||
*/
|
||||
[_L1] = LAYOUT( \
|
||||
KC_1, \
|
||||
KC_2, \
|
||||
MO(_FUNC) \
|
||||
),
|
||||
|
||||
[_FUNC] = LAYOUT( \
|
||||
CALTDEL, \
|
||||
TSKMGR, \
|
||||
_______ \
|
||||
)
|
||||
|
||||
};
|
||||
|
||||
void matrix_init_user(void) {
|
||||
|
||||
}
|
22
keyboards/ivy/keymaps/default/rules.mk
Normal file
22
keyboards/ivy/keymaps/default/rules.mk
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
# Build Options
|
||||
# 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)
|
||||
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
|
||||
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||
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 SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
|
15
keyboards/ivy/readme.md
Normal file
15
keyboards/ivy/readme.md
Normal file
@@ -0,0 +1,15 @@
|
||||
IVY
|
||||
===
|
||||
|
||||

|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make ivy/rev1:default
|
||||
|
||||
Install examples:
|
||||
|
||||
make ivy/rev1:default:dfu
|
||||
|
||||
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).
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -17,8 +17,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#define POWER_5V_SPIKE_TESTS 3 //Number of tests to do when a catastrophic spike is detected, to determine if it is a sustained event
|
||||
#define DEVICE_VER 0x0001
|
||||
|
||||
uint8_t power_5v_check(void);
|
||||
void power_init(void);
|
||||
void power_run(void);
|
||||
/* Let's Macro V2 pin-out */
|
||||
#define MATRIX_ROW_PINS { F1, B2, D3 }
|
||||
#define MATRIX_COL_PINS { F5, B3, D5 }
|
||||
#define UNUSED_PINS
|
||||
|
||||
#define DIODE_DIRECTION COL2ROW
|
5
keyboards/ivy/rev1/rev1.c
Normal file
5
keyboards/ivy/rev1/rev1.c
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "ivy.h"
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
matrix_init_user();
|
||||
};
|
14
keyboards/ivy/rev1/rev1.h
Normal file
14
keyboards/ivy/rev1/rev1.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "ivy.h"
|
||||
|
||||
#define LAYOUT( \
|
||||
K00, \
|
||||
K01, \
|
||||
K02 \
|
||||
) \
|
||||
{ \
|
||||
{ K00, KC_NO, KC_NO }, \
|
||||
{ KC_NO, K01, KC_NO }, \
|
||||
{ KC_NO, KC_NO, K02 }, \
|
||||
}
|
3
keyboards/ivy/rev1/rules.mk
Normal file
3
keyboards/ivy/rev1/rules.mk
Normal file
@@ -0,0 +1,3 @@
|
||||
BACKLIGHT_ENABLE = yes
|
||||
RGBLIGHT_ENABLE = no
|
||||
AUDIO_ENABLE = no
|
67
keyboards/ivy/rules.mk
Normal file
67
keyboards/ivy/rules.mk
Normal file
@@ -0,0 +1,67 @@
|
||||
# MCU name
|
||||
#MCU = at90usb1287
|
||||
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)
|
||||
|
||||
# Bootloader
|
||||
# This definition is optional, and if your keyboard supports multiple bootloaders of
|
||||
# different sizes, comment this out, and the correct address will be loaded
|
||||
# automatically (+60). See bootloader.mk for all options.
|
||||
BOOTLOADER = caterina
|
||||
|
||||
# Interrupt driven control endpoint task(+60)
|
||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
|
||||
# Build Options
|
||||
# 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)
|
||||
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
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.
|
||||
API_SYSEX_ENABLE = no
|
||||
|
||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
|
||||
DEFAULT_FOLDER = ivy/rev1
|
@@ -2,7 +2,7 @@
|
||||
"keyboard_name": "kbd4x",
|
||||
"url": "",
|
||||
"maintainer": "qmk",
|
||||
"width": 14,
|
||||
"width": 12,
|
||||
"height": 4,
|
||||
"layouts": {
|
||||
"LAYOUT_planck_mit": {
|
||||
|
@@ -10,6 +10,7 @@ enum layers_keymap {
|
||||
};
|
||||
|
||||
void eeconfig_init_keymap(void) {
|
||||
rgblight_sethsv(MODERN_DOLCH_RED.h, MODERN_DOLCH_RED.s, MODERN_DOLCH_RED.v);
|
||||
rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL);
|
||||
}
|
||||
|
||||
@@ -81,7 +82,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤
|
||||
* │ │Mv←│Mv↓│Mv→│TNx│ │ │ │ │ │ │ │ │
|
||||
* ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤
|
||||
* │ │RTg│RV-│RV+│ │ │ │ │M4 │M5 │ │ │ │
|
||||
* │ │RTg│RV-│RV+│RMd│ │ │ │M4 │M5 │ │ │ │
|
||||
* └─────┬──┴┬──┴──┬┴───┴───┴───┴───┴───┴───┴──┬┴───┴┬───┬─┴───┘
|
||||
* │DPR│DstNA│ │ │ │
|
||||
* └───┴─────┴───────────────────────────┴─────┴───┘
|
||||
@@ -90,7 +91,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, CLEAR,
|
||||
_______, TOP, MV_UP, BOTTOM, TAB_PRV, _______, _______, _______, _______, _______, _______, _______, _______, DEL_NXT,
|
||||
_______, MV_LEFT, MV_DOWN, MV_RGHT, TAB_NXT, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, RGB_TOG, RGB_VAD, RGB_VAI, _______, _______, _______, _______, KC_BTN4, KC_BTN5, _______, _______, _______,
|
||||
_______, RGB_TOG, RGB_VAD, RGB_VAI, RGB_MOD, _______, _______, _______, KC_BTN4, KC_BTN5, _______, _______, _______,
|
||||
XXXXXXX, DST_P_R, DST_N_A, _______, _______, _______, XXXXXXX
|
||||
),
|
||||
};
|
||||
|
@@ -2,8 +2,8 @@
|
||||
"keyboard_name": "Iris",
|
||||
"url": "https://keeb.io",
|
||||
"maintainer": "Keebio",
|
||||
"width": 14.5,
|
||||
"height": 5,
|
||||
"width": 15,
|
||||
"height": 5.75,
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
|
@@ -4,14 +4,17 @@ extern keymap_config_t keymap_config;
|
||||
|
||||
enum layer_names {
|
||||
_QWERTY,
|
||||
_WORKMAN,
|
||||
_LOWER,
|
||||
_RAISE,
|
||||
_ADJUST
|
||||
};
|
||||
|
||||
enum custom_keycodes {
|
||||
LOWER = SAFE_RANGE,
|
||||
RAISE,
|
||||
QWERTY = SAFE_RANGE,
|
||||
WORKMAN,
|
||||
LOWER,
|
||||
RAISE
|
||||
};
|
||||
|
||||
#define KC_ KC_TRNS
|
||||
@@ -33,9 +36,23 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
TAB , Q , W , E , R , T , Y , U , I , O , P ,BSLS,
|
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
LCTL, A , S , D , F , G , H , J , K , L ,SCLN,QUOT,
|
||||
LSFT, A , S , D , F , G , H , J , K , L ,SCLN,QUOT,
|
||||
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||
LSFT, Z , X , C , V , B ,LBRC, RBRC, N , M ,COMM,DOT ,SLSH,RSFT,
|
||||
LECL, Z , X , C , V , B ,LBRC, RBRC, N , M ,COMM,DOT ,SLSH,RGHT,
|
||||
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
|
||||
LGUI,LOWR,ENT , SPC ,RASE,RALT
|
||||
// `----+----+----' `----+----+----'
|
||||
),
|
||||
|
||||
[_WORKMAN] = LAYOUT_kc(
|
||||
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||
GESC, 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,BSPC,
|
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
TAB , Q , D , R , W , B , J , F , U , P ,SCLN,BSLS,
|
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
LSFT, A , S , H , T , G , Y , N , E , O ,I ,QUOT,
|
||||
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||
LECL, Z , X , M , C , V ,LBRC, RBRC, K , L ,COMM,DOT ,SLSH,RGHT,
|
||||
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
|
||||
LGUI,LOWR,ENT , SPC ,RASE,RALT
|
||||
// `----+----+----' `----+----+----'
|
||||
@@ -45,11 +62,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
//,----+----+----+----+----+----. ,----+----+----+----+----+----.
|
||||
TILD,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN,DEL ,
|
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
, , UP , , , , , ,BTN1, , , ,
|
||||
, , , , , , , ,BTN1, , , ,
|
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
,LEFT,DOWN,RGHT, , , MS_L,MS_D,MS_U,MS_R, , ,
|
||||
, , , , , , MS_L,MS_D,MS_U,MS_R, , ,
|
||||
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||
, , , , , , , , , , , , , ,
|
||||
, , , , , UP , , , , , , , , ,
|
||||
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
|
||||
, , , , ,
|
||||
// `----+----+----' `----+----+----'
|
||||
@@ -63,7 +80,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
//|----+----+----+----+----+----| |----+----+----+----+----+----|
|
||||
,MPLY,VOLD,MNXT, ,LPRN, RPRN,MINS,EQL , , , ,
|
||||
//|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----|
|
||||
, , , , , , , , , , , , , ,
|
||||
, , , , , , , ,DOWN, , , , , ,
|
||||
//`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----'
|
||||
, , , , ,
|
||||
// `----+----+----' `----+----+----'
|
||||
@@ -71,7 +88,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
[_ADJUST] = LAYOUT(
|
||||
//,--------+--------+--------+--------+--------+--------. ,--------+--------+--------+--------+--------+--------.
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, QWERTY, WORKMAN, _______, _______, _______, _______, _______,
|
||||
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||
RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______, _______, _______, _______, _______, _______, _______,
|
||||
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
|
||||
@@ -91,6 +108,16 @@ float tone_qwerty[][2] = SONG(QWERTY_SOUND);
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case QWERTY:
|
||||
if (record->event.pressed) {
|
||||
set_single_persistent_default_layer(_QWERTY);
|
||||
}
|
||||
return false;
|
||||
case WORKMAN:
|
||||
if (record->event.pressed) {
|
||||
set_single_persistent_default_layer(_WORKMAN);
|
||||
}
|
||||
return false;
|
||||
case LOWER:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_LOWER);
|
||||
@@ -100,7 +127,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case RAISE:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_RAISE);
|
||||
@@ -110,7 +136,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -3,7 +3,9 @@
|
||||

|
||||
|
||||
- mouse keys enabled
|
||||
- WASD as arrow keys, and same ones for media
|
||||
- includes a QWERTY and a WORKMAN layout now
|
||||
- keys that I need, while removing keys that I don't
|
||||
- more updates with the layout coming soon
|
||||
- the enter needs to move elsewhere, not yet sure where
|
||||
|
||||
See keymap.c for layouts
|
||||
|
@@ -22,7 +22,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KC_P7, KC_P8, KC_P9,
|
||||
KC_P4, KC_P5, KC_P6, KC_PPLS,
|
||||
KC_P1, KC_P2, KC_P3,
|
||||
KC_P0, KC_PDOT, KC_PENT
|
||||
KC_P0, KC_PDOT, KC_PENT
|
||||
),
|
||||
};
|
||||
|
||||
|
@@ -35,15 +35,15 @@
|
||||
#define LAYOUT_numpad_5x4( \
|
||||
k00, k01, k02, k03, \
|
||||
k10, k11, k12, \
|
||||
k20, k21, k22, k13, \
|
||||
k20, k21, k22, k23, \
|
||||
k30, k31, k32, \
|
||||
k40, k42, k33 \
|
||||
k41, k42, k43 \
|
||||
) { \
|
||||
{ k00, k01, k02, k03 }, \
|
||||
{ k10, k11, k12, k13 }, \
|
||||
{ k20, k21, k22, KC_NO }, \
|
||||
{ k30, k31, k32, k33 }, \
|
||||
{ k40, KC_NO, k42, KC_NO } \
|
||||
{ k00, k01, k02, k03 }, \
|
||||
{ k10, k11, k12, KC_NO }, \
|
||||
{ k20, k21, k22, k23 }, \
|
||||
{ k30, k31, k32, KC_NO }, \
|
||||
{ KC_NO, k41, k42, k43 } \
|
||||
}
|
||||
|
||||
#define LAYOUT_ortho_5x4( \
|
||||
|
@@ -54,7 +54,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define SR_EXP_OE_N_PIN 15
|
||||
/* SERCOM port to use for Shift Register SPI */
|
||||
/* DATAOUT and SCLK must be configured to use hardware pins of this port */
|
||||
#define SR_EXP_SERCOM_NUM 2
|
||||
#define SR_EXP_SERCOM SERCOM2
|
||||
/* Shift Register SPI Data Out configuration (MCU.SERCOMx.PAD[0] to ShiftRegister.SER) */
|
||||
#define SR_EXP_DATAOUT_PORT PA
|
||||
#define SR_EXP_DATAOUT_PIN 12
|
||||
@@ -94,9 +94,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCE 5
|
||||
|
||||
// Required BOOT key hold time (in ms) for restarting to bootloader -PS081419
|
||||
#define BOOTKEY_HOLD_MS 2000
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
//#define LOCKING_SUPPORT_ENABLE
|
||||
/* Locking resynchronize hack */
|
||||
|
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
|
||||
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
|
||||
|
||||
//ADC configuration table column indices
|
||||
#define ADC_PORT 0
|
||||
#define ADC_PIN 1
|
||||
#define ADC_MUX 2
|
||||
#define ADC_INDEX 3
|
||||
#define ADC_MUXPOS 4
|
||||
#define ADC_REFSEL 5
|
||||
#define ADC_SAMPLENUM 6
|
||||
#define ADC_SAMPLEN 7
|
||||
|
||||
//ADC configuration table row indices
|
||||
#define ADC_5V 0 //5V bus voltage
|
||||
#define ADC_C1A5 1 //Connector 1 A5 CC voltage
|
||||
#define ADC_C1B5 2 //Connector 1 B5 CC voltage
|
||||
#define ADC_C2A5 3 //Connector 2 A5 CC voltage
|
||||
#define ADC_C2B5 4 //Connector 2 B5 CC voltage
|
||||
#define ADC_C1I 5 //Connector 1 current
|
||||
#define ADC_C2I 6 //Connector 2 current
|
||||
|
||||
//ADC_PORT: PORT of the PIN on the MCU (Ex: 0 = PA, 1 = PB, ...)
|
||||
// Set ADC_PORT to ADC_NA if it is not available for use
|
||||
//ADC_PIN: PIN on the MCU (Ex: 0 = 00, 1 = 01, 12 = 12, ...)
|
||||
//ADC_MUX: PMUX setting for the MCU PIN (Ex: 0 = A, 1 = B, 2 = C, ...)
|
||||
//ADC_INDEX: ADC to use (Ex: 0 = ADC0, 1 = ADC1, ...)
|
||||
//ADC_MUXPOS: MUXPOS setting to read on the ADC (Use macros from Atmel library adc.h ADC_INPUTCTRL_MUXPOS_AIN*_Val)
|
||||
//ADC_REFSEL: Reference the ADC is to use (Use macros from Atmel library adc.h ADC_REFCTRL_REFSEL_*_Val)
|
||||
//ADC_SAMPLENUM: Number of samples to average for output (Use macros from Atmel library adc.h ADC_AVGCTRL_SAMPLENUM_*_Val)
|
||||
//ADC_SAMPLEN: Sampling time for each sample in units of CLK_ADC cycles depending on the ADC clock frequency
|
||||
// ADC_PORT ADC_MUX
|
||||
// | ADC_PIN | ADC_INDEX
|
||||
// | | | | ADC_MUXPOS ADC_REFSEL ADC_SAMPLENUM ADC_SAMPLEN
|
||||
#define ADC_CONFIG_5V 1, 0, 1, 0, ADC_INPUTCTRL_MUXPOS_AIN12_Val, ADC_REFCTRL_REFSEL_INTREF_Val, ADC_AVGCTRL_SAMPLENUM_4_Val, 45
|
||||
#define ADC_CONFIG_C1A5 1, 2, 1, 0, ADC_INPUTCTRL_MUXPOS_AIN14_Val, ADC_REFCTRL_REFSEL_INTREF_Val, ADC_AVGCTRL_SAMPLENUM_16_Val, 63
|
||||
#define ADC_CONFIG_C1B5 ADC_NA, 0, 0, 0, 0, 0, 0, 0
|
||||
#define ADC_CONFIG_C2A5 1, 1, 1, 0, ADC_INPUTCTRL_MUXPOS_AIN13_Val, ADC_REFCTRL_REFSEL_INTREF_Val, ADC_AVGCTRL_SAMPLENUM_16_Val, 63
|
||||
#define ADC_CONFIG_C2B5 ADC_NA, 0, 0, 0, 0, 0, 0, 0
|
||||
#define ADC_CONFIG_C1I ADC_NA, 0, 0, 0, 0, 0, 0, 0
|
||||
#define ADC_CONFIG_C2I ADC_NA, 0, 0, 0, 0, 0, 0, 0
|
||||
|
||||
//Conversion values dependant upon the circuitry
|
||||
#define ADC_5V_VOLTS_PER_COUNT 0.001904297f
|
||||
#define ADC_5V_VOLTS_OFFSET 0.0f
|
||||
#define ADC_5V_NOMINAL 5.0f
|
||||
#define ADC_5V_NOMINAL_COUNTS (ADC_5V_NOMINAL / ADC_5V_VOLTS_PER_COUNT)
|
||||
|
||||
//Conversion macros
|
||||
#define ADC_5V_C2V(icounts) ((float)icounts * ADC_5V_VOLTS_PER_COUNT + ADC_5V_VOLTS_OFFSET) //Converts 5V Bus counts to volts
|
||||
#define ADC_5V_V2C(v) (((float)v - ADC_5V_VOLTS_OFFSET) / ADC_5V_VOLTS_PER_COUNT) //Converts 5V Bus volts to counts
|
||||
#define ADC_CC_5VCOR(v5counts, cc) ((float)v5counts == 0 ? 0 : ADC_5V_NOMINAL_COUNTS / (float)v5counts * (float)cc) //Corrects CC counts to nominal 5V value
|
||||
|
||||
#define ADC_USBC_EXTRA_NOMINAL 850 //Nominal ADC value for detection of connected device
|
||||
#define ADC_USBC_EXTRA_NOMINAL_P1 1250 //Nominal ADC value for detection of connected device
|
||||
|
||||
//Note: Due to assembly error, USBC-1 J2 CC readings are wrong so we must check for special cases
|
||||
#define USBC_IS_SINK(a5, b5) (USB_HOST_IS_2(g_usb_host_port) ? \
|
||||
(a5 < ADC_USBC_EXTRA_NOMINAL_P1 || b5 < ADC_USBC_EXTRA_NOMINAL_P1) \
|
||||
: \
|
||||
(a5 < ADC_USBC_EXTRA_NOMINAL || b5 < ADC_USBC_EXTRA_NOMINAL) \
|
||||
)
|
||||
|
||||
#define POWER_CHECK_INTERVAL 1 //How often to check power usage for adjustment and safety (ms)
|
||||
#define V_5V_AVGS 50 //Number of 5V readings to average for algorithms wanting stable readings rather than instantaneous
|
@@ -8,14 +8,10 @@
|
||||
// This table can be almost-automatically derived from ISSI3733_LED_MAP that is
|
||||
// defined in config_led.h
|
||||
|
||||
// scan in the following equations refers to the scan variable of ISSI3733_LED_MAP
|
||||
// col = (uint8_t)(scan / 8)
|
||||
// row = (uint8_t)(scan % 8)
|
||||
//
|
||||
// You can calculate the (0-244, 0-64) x/y values from the x/y values defined in
|
||||
// ISSI3733_LED_MAP with the following formula:
|
||||
// uint8_t rgb_x = ((ISSI3733_LED_MAP[i].x - MIN_X) / (MAX_X - MIN_X)) * 224;
|
||||
// uint8_t rgb_y = ((ISSI3733_LED_MAP[i].y - MIN_Y) / (MAX_Y - MIN_Y)) * 64; //TODO: 64 - this?
|
||||
// uint8_t rgb_y = ((ISSI3733_LED_MAP[i].y - MIN_Y) / (MAX_Y - MIN_Y)) * 64;
|
||||
// Where the min/max vars are the minimum and maximum "bounds" of x/y values
|
||||
// present in ISSI3733_LED_MAP
|
||||
//
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
Copyright 2018 Massdrop Inc.
|
||||
|
||||
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
|
||||
@@ -17,11 +17,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
//Define number of IS31FL3733 drivers being used (1...16)
|
||||
//Define number of ISSI3733 drivers being used (1...16)
|
||||
#define ISSI3733_DRIVER_COUNT 2
|
||||
#define DRIVER_LED_TOTAL ISSI3733_LED_COUNT
|
||||
|
||||
//Hardware address of each driver (Refer to IS31FL3733 pdf "Table 1 Slave Address" and keyboard schematic)
|
||||
//Hardware address of each driver (Refer to ISSI3733 pdf "Table 1 Slave Address" and keyboard schematic)
|
||||
#define ISSI3773_DRIVER_ADDRESSES { 0xA0, 0xBE }
|
||||
|
||||
//LED I2C bus speed
|
||||
@@ -45,9 +45,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define ISSI3733_GCR_DEFAULT LED_GCR_MAX
|
||||
|
||||
//Automatic power rollback and recovery
|
||||
#define V5_HIGH 2494 //5V high level (After low power detect, point at which LEDs are allowed to use more power )
|
||||
#define V5_LOW 2434 //5V low level (LED power rolled back to stay above this limit)
|
||||
#define V5_CAT 2206 //5V catastrophic level (Host USB port potential to shut down)
|
||||
#define V5_HIGH 2540 //5V high level (After low power detect, point at which LEDs are allowed to use more power )
|
||||
#define V5_LOW 2480 //5V low level (LED power rolled back to stay above this limit)
|
||||
#define V5_CAT 2200 //5V catastrophic level (Host USB port potential to shut down)
|
||||
|
||||
//LED Mapping - More practically generated from a spreadsheet program
|
||||
//id: ID of the LED (Sync with PCB callouts)
|
||||
@@ -58,7 +58,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//swr: Matrix wiring SW Red row (1-12)
|
||||
//swg: Matrix wiring SW Green row (1-12)
|
||||
//swb: Matrix wiring SW Blue row (1-12)
|
||||
//scan: Associated key matrix scancode (set 255 if none or 254 for LED to turn off in alternating mode)
|
||||
//scan: Associated key scancode if any
|
||||
//Note: Origin 0,0 may be located anywhere as the software will do the final layout
|
||||
#define ISSI3733_LED_MAP { \
|
||||
{ .id = 1, .x = 0, .y = 0, .adr = { .drv = 2, .cs = 2, .swr = 2, .swg = 1, .swb = 3 }, .scan = 0 }, \
|
||||
@@ -129,45 +129,46 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
{ .id = 66, .x = 10.5, .y = -3, .adr = { .drv = 1, .cs = 12, .swr = 8, .swg = 7, .swb = 9 }, .scan = 73 }, \
|
||||
{ .id = 67, .x = 11.25, .y = -3, .adr = { .drv = 1, .cs = 12, .swr = 5, .swg = 4, .swb = 6 }, .scan = 74 }, \
|
||||
{ .id = 68, .x = -0.338, .y = -3.338, .adr = { .drv = 2, .cs = 11, .swr = 11, .swg = 10, .swb = 12 }, .scan = 255 }, \
|
||||
{ .id = 69, .x = 0.39, .y = -3.443, .adr = { .drv = 2, .cs = 11, .swr = 8, .swg = 7, .swb = 9 }, .scan = 254 }, \
|
||||
{ .id = 69, .x = 0.39, .y = -3.443, .adr = { .drv = 2, .cs = 11, .swr = 8, .swg = 7, .swb = 9 }, .scan = 255 }, \
|
||||
{ .id = 70, .x = 1.263, .y = -3.443, .adr = { .drv = 2, .cs = 11, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 71, .x = 2.135, .y = -3.443, .adr = { .drv = 2, .cs = 11, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 71, .x = 2.135, .y = -3.443, .adr = { .drv = 2, .cs = 11, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 72, .x = 3.008, .y = -3.443, .adr = { .drv = 2, .cs = 12, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 73, .x = 3.88, .y = -3.443, .adr = { .drv = 2, .cs = 12, .swr = 5, .swg = 4, .swb = 6 }, .scan = 254 }, \
|
||||
{ .id = 73, .x = 3.88, .y = -3.443, .adr = { .drv = 2, .cs = 12, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 74, .x = 4.753, .y = -3.443, .adr = { .drv = 2, .cs = 13, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 75, .x = 5.625, .y = -3.443, .adr = { .drv = 2, .cs = 13, .swr = 8, .swg = 7, .swb = 9 }, .scan = 254 }, \
|
||||
{ .id = 75, .x = 5.625, .y = -3.443, .adr = { .drv = 2, .cs = 13, .swr = 8, .swg = 7, .swb = 9 }, .scan = 255 }, \
|
||||
{ .id = 76, .x = 6.497, .y = -3.443, .adr = { .drv = 1, .cs = 9, .swr = 8, .swg = 7, .swb = 9 }, .scan = 255 }, \
|
||||
{ .id = 77, .x = 7.37, .y = -3.443, .adr = { .drv = 1, .cs = 9, .swr = 5, .swg = 4, .swb = 6 }, .scan = 254 }, \
|
||||
{ .id = 77, .x = 7.37, .y = -3.443, .adr = { .drv = 1, .cs = 9, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 78, .x = 8.242, .y = -3.443, .adr = { .drv = 1, .cs = 9, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 79, .x = 9.115, .y = -3.443, .adr = { .drv = 1, .cs = 13, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 79, .x = 9.115, .y = -3.443, .adr = { .drv = 1, .cs = 13, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 80, .x = 9.987, .y = -3.443, .adr = { .drv = 1, .cs = 13, .swr = 8, .swg = 7, .swb = 9 }, .scan = 255 }, \
|
||||
{ .id = 81, .x = 10.86, .y = -3.443, .adr = { .drv = 1, .cs = 13, .swr = 5, .swg = 4, .swb = 6 }, .scan = 254 }, \
|
||||
{ .id = 81, .x = 10.86, .y = -3.443, .adr = { .drv = 1, .cs = 13, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 82, .x = 11.588, .y = -3.338, .adr = { .drv = 1, .cs = 13, .swr = 11, .swg = 10, .swb = 12 }, .scan = 255 }, \
|
||||
{ .id = 83, .x = 11.693, .y = -2.623, .adr = { .drv = 1, .cs = 12, .swr = 11, .swg = 10, .swb = 12 }, .scan = 254 }, \
|
||||
{ .id = 83, .x = 11.693, .y = -2.623, .adr = { .drv = 1, .cs = 12, .swr = 11, .swg = 10, .swb = 12 }, .scan = 255 }, \
|
||||
{ .id = 84, .x = 11.693, .y = -1.873, .adr = { .drv = 1, .cs = 8, .swr = 11, .swg = 10, .swb = 12 }, .scan = 255 }, \
|
||||
{ .id = 85, .x = 11.693, .y = -1.123, .adr = { .drv = 1, .cs = 8, .swr = 8, .swg = 7, .swb = 9 }, .scan = 255 }, \
|
||||
{ .id = 86, .x = 11.693, .y = -0.373, .adr = { .drv = 1, .cs = 8, .swr = 5, .swg = 4, .swb = 6 }, .scan = 254 }, \
|
||||
{ .id = 86, .x = 11.693, .y = -0.373, .adr = { .drv = 1, .cs = 8, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 87, .x = 11.588, .y = 0.338, .adr = { .drv = 1, .cs = 8, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 88, .x = 9.908, .y = 0.443, .adr = { .drv = 1, .cs = 6, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 89, .x = 9.288, .y = 0.443, .adr = { .drv = 1, .cs = 5, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 89, .x = 9.288, .y = 0.443, .adr = { .drv = 1, .cs = 5, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 90, .x = 8.625, .y = 0.443, .adr = { .drv = 1, .cs = 4, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 91, .x = 7.875, .y = 0.443, .adr = { .drv = 1, .cs = 3, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 91, .x = 7.875, .y = 0.443, .adr = { .drv = 1, .cs = 3, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 92, .x = 7.125, .y = 0.443, .adr = { .drv = 1, .cs = 2, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 93, .x = 6.375, .y = 0.443, .adr = { .drv = 1, .cs = 1, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 93, .x = 6.375, .y = 0.443, .adr = { .drv = 1, .cs = 1, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 94, .x = 5.625, .y = 0.443, .adr = { .drv = 1, .cs = 14, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 95, .x = 4.875, .y = 0.443, .adr = { .drv = 2, .cs = 8, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 95, .x = 4.875, .y = 0.443, .adr = { .drv = 2, .cs = 8, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 96, .x = 4.125, .y = 0.443, .adr = { .drv = 2, .cs = 7, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 97, .x = 3.375, .y = 0.443, .adr = { .drv = 2, .cs = 6, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 97, .x = 3.375, .y = 0.443, .adr = { .drv = 2, .cs = 6, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 98, .x = 2.625, .y = 0.443, .adr = { .drv = 2, .cs = 5, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 99, .x = 1.875, .y = 0.443, .adr = { .drv = 2, .cs = 4, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 99, .x = 1.875, .y = 0.443, .adr = { .drv = 2, .cs = 4, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 100, .x = 1.125, .y = 0.443, .adr = { .drv = 2, .cs = 3, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 101, .x = -0.338, .y = 0.338, .adr = { .drv = 2, .cs = 1, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 102, .x = -0.443, .y = -0.373, .adr = { .drv = 2, .cs = 1, .swr = 5, .swg = 4, .swb = 6 }, .scan = 254 }, \
|
||||
{ .id = 102, .x = -0.443, .y = -0.373, .adr = { .drv = 2, .cs = 1, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 103, .x = -0.443, .y = -1.123, .adr = { .drv = 2, .cs = 1, .swr = 8, .swg = 7, .swb = 9 }, .scan = 255 }, \
|
||||
{ .id = 104, .x = -0.443, .y = -1.873, .adr = { .drv = 2, .cs = 1, .swr = 11, .swg = 10, .swb = 12 }, .scan = 255 }, \
|
||||
{ .id = 105, .x = -0.443, .y = -2.623, .adr = { .drv = 2, .cs = 10, .swr = 11, .swg = 10, .swb = 12 }, .scan = 254 }, \
|
||||
{ .id = 105, .x = -0.443, .y = -2.623, .adr = { .drv = 2, .cs = 10, .swr = 11, .swg = 10, .swb = 12 }, .scan = 255 }, \
|
||||
};
|
||||
|
||||
|
||||
#define USB_LED_INDICATOR_ENABLE //Comment out to disable indicator functionality
|
||||
#ifdef USB_LED_INDICATOR_ENABLE //Scan codes refer to actual key matrix codes, not KC_* (255 to disable)
|
||||
#define USB_LED_NUM_LOCK_SCANCODE 255
|
||||
|
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
|
||||
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
|
||||
|
||||
/* Data structure to define Shift Register output expander hardware */
|
||||
/* This structure gets shifted into registers LSB first */
|
||||
typedef union {
|
||||
struct {
|
||||
uint16_t RSVD4:1; /*!< bit: 0 */
|
||||
uint16_t RSVD3:1; /*!< bit: 1 */
|
||||
uint16_t RSVD2:1; /*!< bit: 2 */
|
||||
uint16_t RSVD1:1; /*!< bit: 3 */
|
||||
uint16_t SDB_N:1; /*!< bit: 4 SHUTDOWN IS31FL3733 CHIPS WHEN 0, RUN WHEN 1 */
|
||||
uint16_t IRST:1; /*!< bit: 5 RESET IS31FL3733 I2C WHEN 1, RUN WHEN 0 */
|
||||
uint16_t SRC_2:1; /*!< bit: 6 ADVERTISE A SOURCE TO USBC-2 CC */
|
||||
uint16_t SRC_1:1; /*!< bit: 7 ADVERTISE A SOURCE TO USBC-1 CC */
|
||||
uint16_t E_VBUS_2:1; /*!< bit: 8 ENABLE 5V OUT TO USBC-2 WHEN 1 */
|
||||
uint16_t E_VBUS_1:1; /*!< bit: 9 ENABLE 5V OUT TO USBC-1 WHEN 1 */
|
||||
uint16_t E_DN1_N:1; /*!< bit: 10 ENABLE DN1 1:2 MUX WHEN 0 */
|
||||
uint16_t S_DN1:1; /*!< bit: 11 SELECT DN1 PATH 0:USBC-1, 1:USBC-2 */
|
||||
uint16_t E_UP_N:1; /*!< bit: 12 ENABLE SUP 1:2 MUX WHEN 0 */
|
||||
uint16_t S_UP:1; /*!< bit: 13 SELECT UP PATH 0:USBC-1, 1:USBC-2 */
|
||||
uint16_t HUB_RESET_N:1; /*!< bit: 14 RESET USB HUB WHEN 0, RUN WHEN 1 */
|
||||
uint16_t HUB_CONNECT:1; /*!< bit: 15 SIGNAL VBUS CONNECT TO USB HUB WHEN 1 */
|
||||
} bit; /*!< Structure used for bit access */
|
||||
uint16_t reg; /*!< Type used for register access */
|
||||
} sr_exp_t;
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
|
||||
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
|
||||
|
||||
//Macros to Enable, Disable, and Update USB 5V bus connections
|
||||
#define USBC_CFG_5V1_VAR sr_exp_data.bit.E_VBUS_1 //Variable storing USBC-1 5V Bus state
|
||||
#define USBC_CFG_5V1_ENA 1 //Value to enable USBC-1 5V Bus
|
||||
#define USBC_CFG_5V1_DIS 0 //Value to disable USBC-1 5V Bus
|
||||
#define USBC_CFG_5V1_UPDATE SR_EXP_WriteData() //Command to run to update value
|
||||
#define USBC_CFG_5V2_VAR sr_exp_data.bit.E_VBUS_2 //Variable storing USBC-2 5V Bus state
|
||||
#define USBC_CFG_5V2_ENA 1 //Value to enable USBC-1 5V Bus
|
||||
#define USBC_CFG_5V2_DIS 0 //Value to disable USBC-1 5V Bus
|
||||
#define USBC_CFG_5V2_UPDATE SR_EXP_WriteData() //Command to run to update value
|
@@ -1,7 +1,8 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
enum alt_keycodes {
|
||||
U_T_AGCR = SAFE_RANGE, //USB Toggle Automatic GCR control
|
||||
U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active
|
||||
U_T_AGCR, //USB Toggle Automatic GCR control
|
||||
DBG_TOG, //DEBUG Toggle On / Off
|
||||
DBG_MTRX, //DEBUG Toggle Matrix Prints
|
||||
DBG_KBD, //DEBUG Toggle Keyboard Prints
|
||||
@@ -23,7 +24,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
),
|
||||
[1] = LAYOUT(
|
||||
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MUTE, \
|
||||
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, _______, U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \
|
||||
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \
|
||||
_______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, \
|
||||
_______, RGB_TOG, _______, _______, _______, MD_BOOT, TG_NKRO, DBG_TOG, _______, _______, _______, _______, KC_PGUP, KC_VOLD, \
|
||||
_______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END \
|
||||
@@ -55,6 +56,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
static uint32_t key_timer;
|
||||
|
||||
switch (keycode) {
|
||||
case U_T_AUTO:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode");
|
||||
}
|
||||
return false;
|
||||
case U_T_AGCR:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
|
||||
|
@@ -1,7 +1,8 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
enum alt_keycodes {
|
||||
U_T_AGCR = SAFE_RANGE, //USB Toggle Automatic GCR control
|
||||
U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active
|
||||
U_T_AGCR, //USB Toggle Automatic GCR control
|
||||
DBG_TOG, //DEBUG Toggle On / Off
|
||||
DBG_MTRX, //DEBUG Toggle Matrix Prints
|
||||
DBG_KBD, //DEBUG Toggle Keyboard Prints
|
||||
@@ -23,7 +24,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
),
|
||||
[1] = LAYOUT(
|
||||
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MUTE, \
|
||||
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, _______, U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \
|
||||
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \
|
||||
_______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, \
|
||||
_______, RGB_TOG, _______, _______, _______, MD_BOOT, TG_NKRO, DBG_TOG, _______, _______, _______, _______, KC_PGUP, KC_VOLD, \
|
||||
_______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END \
|
||||
@@ -55,6 +56,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
static uint32_t key_timer;
|
||||
|
||||
switch (keycode) {
|
||||
case U_T_AUTO:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode");
|
||||
}
|
||||
return false;
|
||||
case U_T_AGCR:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
|
||||
@@ -84,7 +90,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
key_timer = timer_read32();
|
||||
} else {
|
||||
if (timer_elapsed32(key_timer) >= BOOTKEY_HOLD_MS) {
|
||||
if (timer_elapsed32(key_timer) >= 500) {
|
||||
reset_keyboard();
|
||||
}
|
||||
}
|
||||
@@ -119,7 +125,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return true; //Process all other keycodes normally
|
||||
}
|
||||
}
|
||||
|
||||
led_instruction_t led_instructions[] = {
|
||||
{ .end = 1 }
|
||||
};
|
||||
|
@@ -1,28 +1,24 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
enum alt_keycodes {
|
||||
L_BRI = SAFE_RANGE, //LED Brightness Increase
|
||||
L_BRD, //LED Brightness Decrease
|
||||
L_EDG_I, //LED Edge Brightness Increase
|
||||
L_EDG_D, //LED Edge Brightness Decrease
|
||||
L_EDG_M, //LED Edge lighting mode
|
||||
L_PTN, //LED Pattern Select Next
|
||||
L_PTP, //LED Pattern Select Previous
|
||||
L_PSI, //LED Pattern Speed Increase
|
||||
L_PSD, //LED Pattern Speed Decrease
|
||||
L_T_MD, //LED Toggle Mode
|
||||
L_T_ONF, //LED Toggle On / Off
|
||||
L_ON, //LED On
|
||||
L_OFF, //LED Off
|
||||
L_T_BR, //LED Toggle Breath Effect
|
||||
L_T_PTD, //LED Toggle Scrolling Pattern Direction and effect
|
||||
U_T_AGCR, //USB Toggle Automatic GCR control
|
||||
DBG_TOG, //DEBUG Toggle On / Off
|
||||
DBG_MTRX, //DEBUG Toggle Matrix Prints
|
||||
DBG_KBD, //DEBUG Toggle Keyboard Prints
|
||||
DBG_MOU, //DEBUG Toggle Mouse Prints
|
||||
DBG_FAC, //DEBUG Factory light testing (All on white)
|
||||
MD_BOOT //Restart into bootloader after hold timeout
|
||||
L_BRI = SAFE_RANGE, //LED Brightness Increase //Working
|
||||
L_BRD, //LED Brightness Decrease //Working
|
||||
L_PTN, //LED Pattern Select Next //Working
|
||||
L_PTP, //LED Pattern Select Previous //Working
|
||||
L_PSI, //LED Pattern Speed Increase //Working
|
||||
L_PSD, //LED Pattern Speed Decrease //Working
|
||||
L_T_MD, //LED Toggle Mode //Working
|
||||
L_T_ONF, //LED Toggle On / Off //Broken
|
||||
L_ON, //LED On //Broken
|
||||
L_OFF, //LED Off //Broken
|
||||
L_T_BR, //LED Toggle Breath Effect //Working
|
||||
L_T_PTD, //LED Toggle Scrolling Pattern Direction //Working
|
||||
U_T_AGCR, //USB Toggle Automatic GCR control //Working
|
||||
DBG_TOG, //DEBUG Toggle On / Off //
|
||||
DBG_MTRX, //DEBUG Toggle Matrix Prints //
|
||||
DBG_KBD, //DEBUG Toggle Keyboard Prints //
|
||||
DBG_MOU, //DEBUG Toggle Mouse Prints //
|
||||
MD_BOOT //Restart into bootloader after hold timeout //Working
|
||||
};
|
||||
|
||||
#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode
|
||||
@@ -39,10 +35,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
),
|
||||
[1] = LAYOUT(
|
||||
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MUTE, \
|
||||
L_T_BR, L_PSD, L_BRI, L_PSI, L_EDG_I, _______, _______, _______, U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \
|
||||
L_T_PTD, L_PTP, L_BRD, L_PTN, L_EDG_D, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, \
|
||||
_______, L_T_MD, L_T_ONF, _______, L_EDG_M, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, KC_PGUP, KC_VOLD, \
|
||||
_______, _______, _______, DBG_FAC, _______, _______, KC_HOME, KC_PGDN, KC_END \
|
||||
L_T_BR, L_PSD, L_BRI, L_PSI, _______, _______, _______, _______, U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \
|
||||
L_T_PTD, L_PTP, L_BRD, L_PTN, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, \
|
||||
_______, L_T_MD, L_T_ONF, _______, _______, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, KC_PGUP, KC_VOLD, \
|
||||
_______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END \
|
||||
),
|
||||
/*
|
||||
[X] = LAYOUT(
|
||||
@@ -63,13 +59,12 @@ void matrix_init_user(void) {
|
||||
void matrix_scan_user(void) {
|
||||
};
|
||||
|
||||
#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT))
|
||||
#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL))
|
||||
#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))
|
||||
#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT))
|
||||
#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL))
|
||||
#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
static uint32_t key_timer;
|
||||
static uint8_t scroll_effect = 0;
|
||||
|
||||
switch (keycode) {
|
||||
case L_BRI:
|
||||
@@ -86,26 +81,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (led_animation_breathing) gcr_breathe = gcr_desired;
|
||||
}
|
||||
return false;
|
||||
case L_EDG_M:
|
||||
if (record->event.pressed) {
|
||||
led_edge_mode++;
|
||||
if (led_edge_mode > LED_EDGE_MODE_MAX) {
|
||||
led_edge_mode = LED_EDGE_MODE_ALL;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case L_EDG_I:
|
||||
if (record->event.pressed) {
|
||||
led_edge_brightness += 0.1;
|
||||
if (led_edge_brightness > 1) { led_edge_brightness = 1; }
|
||||
}
|
||||
return false;
|
||||
case L_EDG_D:
|
||||
if (record->event.pressed) {
|
||||
led_edge_brightness -= 0.1;
|
||||
if (led_edge_brightness < 0) { led_edge_brightness = 0; }
|
||||
}
|
||||
return false;
|
||||
case L_PTN:
|
||||
if (record->event.pressed) {
|
||||
if (led_animation_id == led_setups_count - 1) led_animation_id = 0;
|
||||
@@ -137,17 +112,20 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return false;
|
||||
case L_T_ONF:
|
||||
if (record->event.pressed) {
|
||||
I2C3733_Control_Set(!I2C3733_Control_Get());
|
||||
led_enabled = !led_enabled;
|
||||
I2C3733_Control_Set(led_enabled);
|
||||
}
|
||||
return false;
|
||||
case L_ON:
|
||||
if (record->event.pressed) {
|
||||
I2C3733_Control_Set(1);
|
||||
led_enabled = 1;
|
||||
I2C3733_Control_Set(led_enabled);
|
||||
}
|
||||
return false;
|
||||
case L_OFF:
|
||||
if (record->event.pressed) {
|
||||
I2C3733_Control_Set(0);
|
||||
led_enabled = 0;
|
||||
I2C3733_Control_Set(led_enabled);
|
||||
}
|
||||
return false;
|
||||
case L_T_BR:
|
||||
@@ -162,33 +140,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return false;
|
||||
case L_T_PTD:
|
||||
if (record->event.pressed) {
|
||||
scroll_effect++;
|
||||
if (scroll_effect == 1) { //Patterns with scroll move horizontal (Right to left)
|
||||
led_animation_direction = 1;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 0;
|
||||
} else if (scroll_effect == 2) { //Patterns with scroll move vertical (Top to bottom)
|
||||
led_animation_direction = 1;
|
||||
led_animation_orientation = 1;
|
||||
led_animation_circular = 0;
|
||||
} else if (scroll_effect == 3) { //Patterns with scroll move vertical (Bottom to top)
|
||||
led_animation_direction = 0;
|
||||
led_animation_orientation = 1;
|
||||
led_animation_circular = 0;
|
||||
} else if (scroll_effect == 4) { //Patterns with scroll explode from center
|
||||
led_animation_direction = 0;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 1;
|
||||
} else if (scroll_effect == 5) { //Patterns with scroll implode on center
|
||||
led_animation_direction = 1;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 1;
|
||||
} else { //Patterns with scroll move horizontal (Left to right)
|
||||
scroll_effect = 0;
|
||||
led_animation_direction = 0;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 0;
|
||||
}
|
||||
led_animation_direction = !led_animation_direction;
|
||||
}
|
||||
return false;
|
||||
case U_T_AGCR:
|
||||
@@ -196,17 +148,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
|
||||
}
|
||||
return false;
|
||||
case DBG_FAC:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
led_lighting_mode = LED_MODE_NORMAL;
|
||||
led_edge_brightness = 1;
|
||||
led_edge_mode = LED_EDGE_MODE_ALL;
|
||||
led_animation_breathing = 0;
|
||||
led_animation_id = 7; //led_programs.c led_setups leds_white index
|
||||
gcr_desired = LED_GCR_MAX;
|
||||
I2C3733_Control_Set(1);
|
||||
}
|
||||
return false;
|
||||
case DBG_TOG:
|
||||
if (record->event.pressed) {
|
||||
TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode");
|
||||
@@ -231,7 +172,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
key_timer = timer_read32();
|
||||
} else {
|
||||
if (timer_elapsed32(key_timer) >= BOOTKEY_HOLD_MS) {
|
||||
if (timer_elapsed32(key_timer) >= 500) {
|
||||
reset_keyboard();
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
enum alt_keycodes {
|
||||
U_T_AGCR = SAFE_RANGE, //USB Toggle Automatic GCR control
|
||||
U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active
|
||||
U_T_AGCR, //USB Toggle Automatic GCR control
|
||||
DBG_TOG, //DEBUG Toggle On / Off
|
||||
DBG_MTRX, //DEBUG Toggle Matrix Prints
|
||||
DBG_KBD, //DEBUG Toggle Keyboard Prints
|
||||
@@ -23,7 +24,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
),
|
||||
[1] = LAYOUT(
|
||||
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MUTE, \
|
||||
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, _______, U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \
|
||||
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \
|
||||
_______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, \
|
||||
_______, RGB_TOG, _______, _______, _______, MD_BOOT, TG_NKRO, DBG_TOG, _______, _______, _______, _______, KC_PGUP, KC_VOLD, \
|
||||
_______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END \
|
||||
@@ -55,6 +56,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
static uint32_t key_timer;
|
||||
|
||||
switch (keycode) {
|
||||
case U_T_AUTO:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode");
|
||||
}
|
||||
return false;
|
||||
case U_T_AGCR:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
|
||||
@@ -84,7 +90,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
key_timer = timer_read32();
|
||||
} else {
|
||||
if (timer_elapsed32(key_timer) >= BOOTKEY_HOLD_MS) {
|
||||
if (timer_elapsed32(key_timer) >= 500) {
|
||||
reset_keyboard();
|
||||
}
|
||||
}
|
||||
@@ -119,7 +125,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return true; //Process all other keycodes normally
|
||||
}
|
||||
}
|
||||
|
||||
led_instruction_t led_instructions[] = {
|
||||
{ .end = 1 }
|
||||
};
|
||||
|
@@ -1,28 +1,24 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
enum alt_keycodes {
|
||||
L_BRI = SAFE_RANGE, //LED Brightness Increase
|
||||
L_BRD, //LED Brightness Decrease
|
||||
L_EDG_I, //LED Edge Brightness Increase
|
||||
L_EDG_D, //LED Edge Brightness Decrease
|
||||
L_EDG_M, //LED Edge lighting mode
|
||||
L_PTN, //LED Pattern Select Next
|
||||
L_PTP, //LED Pattern Select Previous
|
||||
L_PSI, //LED Pattern Speed Increase
|
||||
L_PSD, //LED Pattern Speed Decrease
|
||||
L_T_MD, //LED Toggle Mode
|
||||
L_T_ONF, //LED Toggle On / Off
|
||||
L_ON, //LED On
|
||||
L_OFF, //LED Off
|
||||
L_T_BR, //LED Toggle Breath Effect
|
||||
L_T_PTD, //LED Toggle Scrolling Pattern Direction and effect
|
||||
U_T_AGCR, //USB Toggle Automatic GCR control
|
||||
DBG_TOG, //DEBUG Toggle On / Off
|
||||
DBG_MTRX, //DEBUG Toggle Matrix Prints
|
||||
DBG_KBD, //DEBUG Toggle Keyboard Prints
|
||||
DBG_MOU, //DEBUG Toggle Mouse Prints
|
||||
DBG_FAC, //DEBUG Factory light testing (All on white)
|
||||
MD_BOOT //Restart into bootloader after hold timeout
|
||||
L_BRI = SAFE_RANGE, //LED Brightness Increase //Working
|
||||
L_BRD, //LED Brightness Decrease //Working
|
||||
L_PTN, //LED Pattern Select Next //Working
|
||||
L_PTP, //LED Pattern Select Previous //Working
|
||||
L_PSI, //LED Pattern Speed Increase //Working
|
||||
L_PSD, //LED Pattern Speed Decrease //Working
|
||||
L_T_MD, //LED Toggle Mode //Working
|
||||
L_T_ONF, //LED Toggle On / Off //Broken
|
||||
L_ON, //LED On //Broken
|
||||
L_OFF, //LED Off //Broken
|
||||
L_T_BR, //LED Toggle Breath Effect //Working
|
||||
L_T_PTD, //LED Toggle Scrolling Pattern Direction //Working
|
||||
U_T_AGCR, //USB Toggle Automatic GCR control //Working
|
||||
DBG_TOG, //DEBUG Toggle On / Off //
|
||||
DBG_MTRX, //DEBUG Toggle Matrix Prints //
|
||||
DBG_KBD, //DEBUG Toggle Keyboard Prints //
|
||||
DBG_MOU, //DEBUG Toggle Mouse Prints //
|
||||
MD_BOOT //Restart into bootloader after hold timeout //Working
|
||||
};
|
||||
|
||||
#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode
|
||||
@@ -39,10 +35,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
),
|
||||
[1] = LAYOUT(
|
||||
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MUTE, \
|
||||
L_T_BR, L_PSD, L_BRI, L_PSI, L_EDG_I, _______, _______, _______, U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \
|
||||
L_T_PTD, L_PTP, L_BRD, L_PTN, L_EDG_D, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, \
|
||||
_______, L_T_MD, L_T_ONF, _______, L_EDG_M, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, KC_PGUP, KC_VOLD, \
|
||||
_______, _______, _______, DBG_FAC, _______, _______, KC_HOME, KC_PGDN, KC_END \
|
||||
L_T_BR, L_PSD, L_BRI, L_PSI, _______, _______, _______, _______, U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \
|
||||
L_T_PTD, L_PTP, L_BRD, L_PTN, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, \
|
||||
_______, L_T_MD, L_T_ONF, _______, _______, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, KC_PGUP, KC_VOLD, \
|
||||
_______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END \
|
||||
),
|
||||
/*
|
||||
[X] = LAYOUT(
|
||||
@@ -63,13 +59,12 @@ void matrix_init_user(void) {
|
||||
void matrix_scan_user(void) {
|
||||
};
|
||||
|
||||
#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT))
|
||||
#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL))
|
||||
#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))
|
||||
#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT))
|
||||
#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL))
|
||||
#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
static uint32_t key_timer;
|
||||
static uint8_t scroll_effect = 0;
|
||||
|
||||
switch (keycode) {
|
||||
case L_BRI:
|
||||
@@ -86,26 +81,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (led_animation_breathing) gcr_breathe = gcr_desired;
|
||||
}
|
||||
return false;
|
||||
case L_EDG_M:
|
||||
if (record->event.pressed) {
|
||||
led_edge_mode++;
|
||||
if (led_edge_mode > LED_EDGE_MODE_MAX) {
|
||||
led_edge_mode = LED_EDGE_MODE_ALL;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case L_EDG_I:
|
||||
if (record->event.pressed) {
|
||||
led_edge_brightness += 0.1;
|
||||
if (led_edge_brightness > 1) { led_edge_brightness = 1; }
|
||||
}
|
||||
return false;
|
||||
case L_EDG_D:
|
||||
if (record->event.pressed) {
|
||||
led_edge_brightness -= 0.1;
|
||||
if (led_edge_brightness < 0) { led_edge_brightness = 0; }
|
||||
}
|
||||
return false;
|
||||
case L_PTN:
|
||||
if (record->event.pressed) {
|
||||
if (led_animation_id == led_setups_count - 1) led_animation_id = 0;
|
||||
@@ -137,17 +112,20 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return false;
|
||||
case L_T_ONF:
|
||||
if (record->event.pressed) {
|
||||
I2C3733_Control_Set(!I2C3733_Control_Get());
|
||||
led_enabled = !led_enabled;
|
||||
I2C3733_Control_Set(led_enabled);
|
||||
}
|
||||
return false;
|
||||
case L_ON:
|
||||
if (record->event.pressed) {
|
||||
I2C3733_Control_Set(1);
|
||||
led_enabled = 1;
|
||||
I2C3733_Control_Set(led_enabled);
|
||||
}
|
||||
return false;
|
||||
case L_OFF:
|
||||
if (record->event.pressed) {
|
||||
I2C3733_Control_Set(0);
|
||||
led_enabled = 0;
|
||||
I2C3733_Control_Set(led_enabled);
|
||||
}
|
||||
return false;
|
||||
case L_T_BR:
|
||||
@@ -162,33 +140,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return false;
|
||||
case L_T_PTD:
|
||||
if (record->event.pressed) {
|
||||
scroll_effect++;
|
||||
if (scroll_effect == 1) { //Patterns with scroll move horizontal (Right to left)
|
||||
led_animation_direction = 1;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 0;
|
||||
} else if (scroll_effect == 2) { //Patterns with scroll move vertical (Top to bottom)
|
||||
led_animation_direction = 1;
|
||||
led_animation_orientation = 1;
|
||||
led_animation_circular = 0;
|
||||
} else if (scroll_effect == 3) { //Patterns with scroll move vertical (Bottom to top)
|
||||
led_animation_direction = 0;
|
||||
led_animation_orientation = 1;
|
||||
led_animation_circular = 0;
|
||||
} else if (scroll_effect == 4) { //Patterns with scroll explode from center
|
||||
led_animation_direction = 0;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 1;
|
||||
} else if (scroll_effect == 5) { //Patterns with scroll implode on center
|
||||
led_animation_direction = 1;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 1;
|
||||
} else { //Patterns with scroll move horizontal (Left to right)
|
||||
scroll_effect = 0;
|
||||
led_animation_direction = 0;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 0;
|
||||
}
|
||||
led_animation_direction = !led_animation_direction;
|
||||
}
|
||||
return false;
|
||||
case U_T_AGCR:
|
||||
@@ -196,17 +148,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
|
||||
}
|
||||
return false;
|
||||
case DBG_FAC:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
led_lighting_mode = LED_MODE_NORMAL;
|
||||
led_edge_brightness = 1;
|
||||
led_edge_mode = LED_EDGE_MODE_ALL;
|
||||
led_animation_breathing = 0;
|
||||
led_animation_id = 7; //led_programs.c led_setups leds_white index
|
||||
gcr_desired = LED_GCR_MAX;
|
||||
I2C3733_Control_Set(1);
|
||||
}
|
||||
return false;
|
||||
case DBG_TOG:
|
||||
if (record->event.pressed) {
|
||||
TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode");
|
||||
@@ -231,7 +172,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
key_timer = timer_read32();
|
||||
} else {
|
||||
if (timer_elapsed32(key_timer) >= BOOTKEY_HOLD_MS) {
|
||||
if (timer_elapsed32(key_timer) >= 500) {
|
||||
reset_keyboard();
|
||||
}
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ enum alt_keycodes {
|
||||
L_OFF, //LED Off
|
||||
L_T_BR, //LED Toggle Breath Effect
|
||||
L_T_PTD, //LED Toggle Scrolling Pattern Direction
|
||||
U_T_AUTO, //USB Extra Port Toggle Auto Detect / Always Active
|
||||
U_T_AGCR, //USB Toggle Automatic GCR control
|
||||
DBG_TOG, //DEBUG Toggle On / Off
|
||||
DBG_MTRX, //DEBUG Toggle Matrix Prints
|
||||
@@ -37,7 +38,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
),
|
||||
[1] = LAYOUT(
|
||||
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, KC_MUTE, \
|
||||
_______, _______, _______, KC_UP, _______, _______, _______, _______, U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \
|
||||
_______, _______, _______, KC_UP, _______, _______, _______, U_T_AUTO,U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_END, \
|
||||
_______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, KC_VOLU, _______, \
|
||||
_______, _______, _______, KC_MPLY, MO(2), _______, KC_MRWD, KC_VOLD, KC_MFFD \
|
||||
@@ -145,6 +146,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
led_animation_direction = !led_animation_direction;
|
||||
}
|
||||
return false;
|
||||
case U_T_AUTO:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode");
|
||||
}
|
||||
return false;
|
||||
case U_T_AGCR:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
Copyright 2018 Massdrop Inc.
|
||||
|
||||
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
|
||||
@@ -22,8 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "clks.h"
|
||||
#include <string.h>
|
||||
|
||||
#define MCU_PORTS_USED 2 //PA, PB
|
||||
|
||||
matrix_row_t mlatest[MATRIX_ROWS];
|
||||
matrix_row_t mlast[MATRIX_ROWS];
|
||||
matrix_row_t mdebounced[MATRIX_ROWS];
|
||||
@@ -32,7 +30,7 @@ uint8_t row_ports[] = { MATRIX_ROW_PORTS };
|
||||
uint8_t row_pins[] = { MATRIX_ROW_PINS };
|
||||
uint8_t col_ports[] = { MATRIX_COL_PORTS };
|
||||
uint8_t col_pins[] = { MATRIX_COL_PINS };
|
||||
uint32_t row_masks[MCU_PORTS_USED]; //Array size must match number of unique MCU ports used for reads (PA, PB, PC, etc)
|
||||
uint32_t row_masks[2]; //NOTE: If more than PA PB used in the future, adjust code to accomodate
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_kb(void) {
|
||||
@@ -58,9 +56,9 @@ void matrix_init(void)
|
||||
memset(mlast, 0, MATRIX_ROWS * sizeof(matrix_row_t));
|
||||
memset(mdebounced, 0, MATRIX_ROWS * sizeof(matrix_row_t));
|
||||
|
||||
memset(row_masks, 0, sizeof(row_masks));
|
||||
row_masks[PA] = 0;
|
||||
row_masks[PB] = 0;
|
||||
|
||||
//Inputs
|
||||
uint8_t row;
|
||||
for (row = 0; row < MATRIX_ROWS; row++)
|
||||
{
|
||||
@@ -71,7 +69,6 @@ void matrix_init(void)
|
||||
row_masks[row_ports[row]] |= 1 << row_pins[row]; //Add pin to proper row mask
|
||||
}
|
||||
|
||||
//Outputs
|
||||
uint8_t col;
|
||||
for (col = 0; col < MATRIX_COLS; col++)
|
||||
{
|
||||
@@ -83,29 +80,27 @@ void matrix_init(void)
|
||||
}
|
||||
|
||||
uint64_t mdebouncing = 0;
|
||||
bool debouncing = false;
|
||||
|
||||
uint8_t matrix_scan(void)
|
||||
{
|
||||
uint64_t timer;
|
||||
uint8_t mchanged;
|
||||
uint8_t row;
|
||||
uint8_t col;
|
||||
uint32_t scans[MCU_PORTS_USED]; //Array size must match number of unique MCU ports used for reads (PA, PB, PC, etc)
|
||||
uint32_t scans[2]; //PA PB
|
||||
|
||||
if (timer_read64() < mdebouncing) return 1; //mdebouncing == 0 when no debouncing active
|
||||
|
||||
memset(mlatest, 0, MATRIX_ROWS * sizeof(matrix_row_t)); //Zero the result buffer
|
||||
|
||||
for (col = 0; col < MATRIX_COLS; col++)
|
||||
{
|
||||
//Set output
|
||||
PORT->Group[col_ports[col]].OUTSET.reg = 1 << col_pins[col]; //Set col output
|
||||
wait_us(1); //Delay for output
|
||||
PORT->Group[col_ports[col]].OUTSET.reg = 1 << col_pins[col]; //Set col output
|
||||
|
||||
//Read input (add unique ports as needed, PA, PB, PC, etc)
|
||||
scans[PA] = PORT->Group[PA].IN.reg & row_masks[PA]; //Read PA row pins data
|
||||
scans[PB] = PORT->Group[PB].IN.reg & row_masks[PB]; //Read PA row pins data
|
||||
wait_us(1); //Delay for output
|
||||
|
||||
//Clear output
|
||||
PORT->Group[col_ports[col]].OUTCLR.reg = 1 << col_pins[col]; //Clear col output
|
||||
scans[PA] = PORT->Group[PA].IN.reg & row_masks[PA]; //Read PA row pins data
|
||||
scans[PB] = PORT->Group[PB].IN.reg & row_masks[PB]; //Read PB row pins data
|
||||
|
||||
PORT->Group[col_ports[col]].OUTCLR.reg = 1 << col_pins[col]; //Clear col output
|
||||
|
||||
for (row = 0; row < MATRIX_ROWS; row++)
|
||||
{
|
||||
@@ -115,26 +110,25 @@ uint8_t matrix_scan(void)
|
||||
}
|
||||
}
|
||||
|
||||
timer = timer_read64();
|
||||
mchanged = 0; //Default to no matrix change since last
|
||||
|
||||
for (row = 0; row < MATRIX_ROWS; row++)
|
||||
{
|
||||
if (mlast[row] != mlatest[row]) {
|
||||
debouncing = true;
|
||||
mdebouncing = timer + DEBOUNCE;
|
||||
}
|
||||
|
||||
if (mlast[row] != mlatest[row])
|
||||
mchanged = 1;
|
||||
mlast[row] = mlatest[row];
|
||||
}
|
||||
|
||||
if (debouncing && timer >= mdebouncing)
|
||||
if (!mchanged)
|
||||
{
|
||||
for (row = 0; row < MATRIX_ROWS; row++) {
|
||||
for (row = 0; row < MATRIX_ROWS; row++)
|
||||
mdebounced[row] = mlatest[row];
|
||||
}
|
||||
|
||||
mdebouncing = 0;
|
||||
debouncing = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Begin or extend debounce on change
|
||||
mdebouncing = timer_read64() + DEBOUNCE;
|
||||
}
|
||||
|
||||
matrix_scan_quantum();
|
||||
|
@@ -1,8 +1,6 @@
|
||||
# project specific files
|
||||
SRC = matrix.c
|
||||
SRC += config_led.c
|
||||
SRC += spi.c
|
||||
SRC += usb.c
|
||||
|
||||
#For platform and packs
|
||||
ARM_ATSAM = SAMD51J18A
|
||||
|
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
|
||||
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 "arm_atsam_protocol.h"
|
||||
|
||||
void SR_EXP_Init_kb(void) {
|
||||
/* Initialize shift register */
|
||||
SR_EXP_OE_N_DIS;
|
||||
SR_EXP_RCLK_HI;
|
||||
|
||||
SR_EXP_SERCOM->SPI.CTRLA.bit.DORD = 1; //Data Order - LSB is transferred first
|
||||
SR_EXP_SERCOM->SPI.CTRLA.bit.CPOL = 1; //Clock Polarity - SCK high when idle. Leading edge of cycle is falling. Trailing rising.
|
||||
SR_EXP_SERCOM->SPI.CTRLA.bit.CPHA = 1; //Clock Phase - Leading Edge Falling, change, Trailing Edge - Rising, sample
|
||||
SR_EXP_SERCOM->SPI.CTRLA.bit.DIPO = 3; //Data In Pinout - SERCOM PAD[3] is used as data input (Configure away from DOPO. Not using input.)
|
||||
SR_EXP_SERCOM->SPI.CTRLA.bit.DOPO = 0; //Data Output PAD[0], Serial Clock PAD[1]
|
||||
SR_EXP_SERCOM->SPI.CTRLA.bit.MODE = 3; //Operating Mode - Master operation
|
||||
|
||||
SR_EXP_SERCOM->SPI.CTRLA.bit.ENABLE = 1; //Enable - Peripheral is enabled or being enabled
|
||||
while (SR_EXP_SERCOM->SPI.SYNCBUSY.bit.ENABLE) { DBGC(DC_SPI_EXP_SYNC_ENABLING); }
|
||||
|
||||
/* Set default shift register values */
|
||||
sr_exp_data.reg = 0; //Clear data register
|
||||
sr_exp_data.bit.HUB_CONNECT = 0; //USB Hub disconnected
|
||||
sr_exp_data.bit.HUB_RESET_N = 0; //USB Hub in reset state
|
||||
|
||||
sr_exp_data.bit.SRC_1 = 1; //Set CON1 CC A5/B5 as Rd 5.1k
|
||||
sr_exp_data.bit.SRC_2 = 1; //Set CON2 CC A5/B5 as Rd 5.1k
|
||||
sr_exp_data.bit.S_UP = 0; //Default USB data to CON1
|
||||
sr_exp_data.bit.E_UP_N = 1; //Disable HOST
|
||||
sr_exp_data.bit.S_DN1 = 1; //Default EXTRA port to CON2
|
||||
sr_exp_data.bit.E_DN1_N = 1; //Disable EXTRA
|
||||
|
||||
sr_exp_data.bit.E_VBUS_1 = 0; //Disable CON1 5V
|
||||
sr_exp_data.bit.E_VBUS_2 = 0; //Disable CON2 5V
|
||||
sr_exp_data.bit.IRST = 1; //LED drivers I2C in reset
|
||||
sr_exp_data.bit.SDB_N = 0; //LED drivers in shutdown
|
||||
|
||||
/* Write shift register data */
|
||||
SR_EXP_WriteData();
|
||||
|
||||
/* Enable shift register output */
|
||||
SR_EXP_OE_N_ENA;
|
||||
}
|
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
|
||||
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 "arm_atsam_protocol.h"
|
||||
|
||||
//Note: rp_best_index not used
|
||||
void usb_set_host_kb(uint8_t con, uint8_t rp_best_index) {
|
||||
if (con == 1) {
|
||||
sr_exp_data.bit.S_UP = 0; //HOST to USBC-1
|
||||
sr_exp_data.bit.S_DN1 = 1; //EXTRA to USBC-2
|
||||
g_usb_host_port = USB_HOST_PORT_1; //Save host port
|
||||
sr_exp_data.bit.E_VBUS_1 = 1; //Enable CON1 5V
|
||||
SR_EXP_WriteData(); //Update port configuration
|
||||
} else if (con == 2) {
|
||||
sr_exp_data.bit.S_DN1 = 0; //HOST to USBC-2
|
||||
sr_exp_data.bit.S_UP = 1; //EXTRA to USBC-1
|
||||
g_usb_host_port = USB_HOST_PORT_2; //Save host port
|
||||
sr_exp_data.bit.E_VBUS_2 = 1; //Enable CON2 5V
|
||||
SR_EXP_WriteData(); //Update port configuration
|
||||
}
|
||||
}
|
||||
|
||||
void usb_set_extra_kb(uint8_t con) {
|
||||
if (con == 1) {
|
||||
sr_exp_data.bit.SRC_1 = 0; //Set CON1 CC A5/B5 as Rp 56k
|
||||
sr_exp_data.bit.E_VBUS_1 = 0; //Disable CON1 5V
|
||||
SR_EXP_WriteData(); //Update port configuration
|
||||
} else if (con == 2) {
|
||||
sr_exp_data.bit.SRC_2 = 0; //Set CON2 CC A5/B5 as Rp 56k
|
||||
sr_exp_data.bit.E_VBUS_2 = 0; //Disable CON2 5V
|
||||
SR_EXP_WriteData(); //Update port configuration
|
||||
}
|
||||
}
|
||||
|
||||
void usb_init_host_detection_kb(void) {
|
||||
//Disable 5V
|
||||
sr_exp_data.bit.E_VBUS_1 = 0; //Disable CON1 5V
|
||||
sr_exp_data.bit.E_VBUS_2 = 0; //Disable CON2 5V
|
||||
|
||||
//Configure default paths
|
||||
sr_exp_data.bit.S_UP = 0; //HOST to USBC-1
|
||||
sr_exp_data.bit.S_DN1 = 1; //EXTRA to USBC-2
|
||||
|
||||
//Configure CC lines
|
||||
sr_exp_data.bit.SRC_1 = 1; //Set CON1 CC A5/B5 as Rd 5.1k
|
||||
sr_exp_data.bit.SRC_2 = 1; //Set CON2 CC A5/B5 as Rd 5.1k
|
||||
|
||||
//Enable ports
|
||||
sr_exp_data.bit.E_UP_N = 0; //Enable HOST for use
|
||||
sr_exp_data.bit.E_DN1_N = 0; //Enable EXTRA for use
|
||||
|
||||
SR_EXP_WriteData(); //Update port configuration
|
||||
}
|
||||
|
||||
//Return 1 if configuration successful
|
||||
//Return 0 otherwise
|
||||
uint8_t usb_attach_port_configure_kb(uint8_t g_usb_host_port, uint16_t usbc_cc_a5_v, uint16_t usbc_cc_b5_v) {
|
||||
if (USB_HOST_IS_1(g_usb_host_port)) { //If host is port 1
|
||||
//Set up port 2
|
||||
usb_set_extra_kb(2);
|
||||
return 1;
|
||||
} else if (USB_HOST_IS_2(g_usb_host_port)) { //If host is on port 2
|
||||
//Set up port 1
|
||||
usb_set_extra_kb(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@@ -54,7 +54,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define SR_EXP_OE_N_PIN 15
|
||||
/* SERCOM port to use for Shift Register SPI */
|
||||
/* DATAOUT and SCLK must be configured to use hardware pins of this port */
|
||||
#define SR_EXP_SERCOM_NUM 2
|
||||
#define SR_EXP_SERCOM SERCOM2
|
||||
/* Shift Register SPI Data Out configuration (MCU.SERCOMx.PAD[0] to ShiftRegister.SER) */
|
||||
#define SR_EXP_DATAOUT_PORT PA
|
||||
#define SR_EXP_DATAOUT_PIN 12
|
||||
@@ -94,9 +94,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCE 5
|
||||
|
||||
// Required BOOT key hold time (in ms) for restarting to bootloader -PS081419
|
||||
#define BOOTKEY_HOLD_MS 2000
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
//#define LOCKING_SUPPORT_ENABLE
|
||||
/* Locking resynchronize hack */
|
||||
|
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
|
||||
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
|
||||
|
||||
//ADC configuration table column indices
|
||||
#define ADC_PORT 0
|
||||
#define ADC_PIN 1
|
||||
#define ADC_MUX 2
|
||||
#define ADC_INDEX 3
|
||||
#define ADC_MUXPOS 4
|
||||
#define ADC_REFSEL 5
|
||||
#define ADC_SAMPLENUM 6
|
||||
#define ADC_SAMPLEN 7
|
||||
|
||||
//ADC configuration table row indices
|
||||
#define ADC_5V 0 //5V bus voltage
|
||||
#define ADC_C1A5 1 //Connector 1 A5 CC voltage
|
||||
#define ADC_C1B5 2 //Connector 1 B5 CC voltage
|
||||
#define ADC_C2A5 3 //Connector 2 A5 CC voltage
|
||||
#define ADC_C2B5 4 //Connector 2 B5 CC voltage
|
||||
#define ADC_C1I 5 //Connector 1 current
|
||||
#define ADC_C2I 6 //Connector 2 current
|
||||
|
||||
//ADC_PORT: PORT of the PIN on the MCU (Ex: 0 = PA, 1 = PB, ...)
|
||||
// Set ADC_PORT to ADC_NA if it is not available for use
|
||||
//ADC_PIN: PIN on the MCU (Ex: 0 = 00, 1 = 01, 12 = 12, ...)
|
||||
//ADC_MUX: PMUX setting for the MCU PIN (Ex: 0 = A, 1 = B, 2 = C, ...)
|
||||
//ADC_INDEX: ADC to use (Ex: 0 = ADC0, 1 = ADC1, ...)
|
||||
//ADC_MUXPOS: MUXPOS setting to read on the ADC (Use macros from Atmel library adc.h ADC_INPUTCTRL_MUXPOS_AIN*_Val)
|
||||
//ADC_REFSEL: Reference the ADC is to use (Use macros from Atmel library adc.h ADC_REFCTRL_REFSEL_*_Val)
|
||||
//ADC_SAMPLENUM: Number of samples to average for output (Use macros from Atmel library adc.h ADC_AVGCTRL_SAMPLENUM_*_Val)
|
||||
//ADC_SAMPLEN: Sampling time for each sample in units of CLK_ADC cycles depending on the ADC clock frequency
|
||||
// ADC_PORT ADC_MUX
|
||||
// | ADC_PIN | ADC_INDEX
|
||||
// | | | | ADC_MUXPOS ADC_REFSEL ADC_SAMPLENUM ADC_SAMPLEN
|
||||
#define ADC_CONFIG_5V 1, 0, 1, 0, ADC_INPUTCTRL_MUXPOS_AIN12_Val, ADC_REFCTRL_REFSEL_INTREF_Val, ADC_AVGCTRL_SAMPLENUM_4_Val, 45
|
||||
#define ADC_CONFIG_C1A5 1, 2, 1, 0, ADC_INPUTCTRL_MUXPOS_AIN14_Val, ADC_REFCTRL_REFSEL_INTREF_Val, ADC_AVGCTRL_SAMPLENUM_16_Val, 63
|
||||
#define ADC_CONFIG_C1B5 ADC_NA, 0, 0, 0, 0, 0, 0, 0
|
||||
#define ADC_CONFIG_C2A5 1, 1, 1, 0, ADC_INPUTCTRL_MUXPOS_AIN13_Val, ADC_REFCTRL_REFSEL_INTREF_Val, ADC_AVGCTRL_SAMPLENUM_16_Val, 63
|
||||
#define ADC_CONFIG_C2B5 ADC_NA, 0, 0, 0, 0, 0, 0, 0
|
||||
#define ADC_CONFIG_C1I ADC_NA, 0, 0, 0, 0, 0, 0, 0
|
||||
#define ADC_CONFIG_C2I ADC_NA, 0, 0, 0, 0, 0, 0, 0
|
||||
|
||||
//Conversion values dependant upon the circuitry
|
||||
#define ADC_5V_VOLTS_PER_COUNT 0.001904297f
|
||||
#define ADC_5V_VOLTS_OFFSET 0.0f
|
||||
#define ADC_5V_NOMINAL 5.0f
|
||||
#define ADC_5V_NOMINAL_COUNTS (ADC_5V_NOMINAL / ADC_5V_VOLTS_PER_COUNT)
|
||||
|
||||
//Conversion macros
|
||||
#define ADC_5V_C2V(icounts) ((float)icounts * ADC_5V_VOLTS_PER_COUNT + ADC_5V_VOLTS_OFFSET) //Converts 5V Bus counts to volts
|
||||
#define ADC_5V_V2C(v) (((float)v - ADC_5V_VOLTS_OFFSET) / ADC_5V_VOLTS_PER_COUNT) //Converts 5V Bus volts to counts
|
||||
#define ADC_CC_5VCOR(v5counts, cc) ((float)v5counts == 0 ? 0 : ADC_5V_NOMINAL_COUNTS / (float)v5counts * (float)cc) //Corrects CC counts to nominal 5V value
|
||||
|
||||
#define ADC_USBC_EXTRA_NOMINAL 850 //Nominal ADC value for detection of connected device
|
||||
|
||||
#define USBC_IS_SINK(a5, b5) (a5 < ADC_USBC_EXTRA_NOMINAL || b5 < ADC_USBC_EXTRA_NOMINAL)
|
||||
|
||||
#define POWER_CHECK_INTERVAL 1 //How often to check power usage for adjustment and safety (ms)
|
||||
#define V_5V_AVGS 50 //Number of 5V readings to average for algorithms wanting stable readings rather than instantaneous
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
Copyright 2018 Massdrop Inc.
|
||||
|
||||
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
|
||||
@@ -17,11 +17,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
//Define number of IS31FL3733 drivers being used (1...16)
|
||||
//Define number of ISSI3733 drivers being used (1...16)
|
||||
#define ISSI3733_DRIVER_COUNT 2
|
||||
#define DRIVER_LED_TOTAL ISSI3733_LED_COUNT
|
||||
|
||||
//Hardware address of each driver (Refer to IS31FL3733 pdf "Table 1 Slave Address" and keyboard schematic)
|
||||
//Hardware address of each driver (Refer to ISSI3733 pdf "Table 1 Slave Address" and keyboard schematic)
|
||||
#define ISSI3773_DRIVER_ADDRESSES { 0xA0, 0xBE }
|
||||
|
||||
//LED I2C bus speed
|
||||
@@ -45,9 +45,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define ISSI3733_GCR_DEFAULT LED_GCR_MAX
|
||||
|
||||
//Automatic power rollback and recovery
|
||||
#define V5_HIGH 2494 //5V high level (After low power detect, point at which LEDs are allowed to use more power )
|
||||
#define V5_LOW 2434 //5V low level (LED power rolled back to stay above this limit)
|
||||
#define V5_CAT 2206 //5V catastrophic level (Host USB port potential to shut down)
|
||||
#define V5_HIGH 2540 //5V high level (After low power detect, point at which LEDs are allowed to use more power )
|
||||
#define V5_LOW 2480 //5V low level (LED power rolled back to stay above this limit)
|
||||
#define V5_CAT 2200 //5V catastrophic level (Host USB port potential to shut down)
|
||||
|
||||
//LED Mapping - More practically generated from a spreadsheet program
|
||||
//id: ID of the LED (Sync with PCB callouts)
|
||||
@@ -58,7 +58,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//swr: Matrix wiring SW Red row (1-12)
|
||||
//swg: Matrix wiring SW Green row (1-12)
|
||||
//swb: Matrix wiring SW Blue row (1-12)
|
||||
//scan: Associated key matrix scancode (set 255 if none or 254 for LED to turn off in alternating mode)
|
||||
//scan: Associated key scancode if any
|
||||
//Note: Origin 0,0 may be located anywhere as the software will do the final layout
|
||||
#define ISSI3733_LED_MAP { \
|
||||
{ .id = 1, .x = 0, .y = 0, .adr = { .drv = 2, .cs = 2, .swr = 2, .swg = 1, .swb = 3 }, .scan = 0 }, \
|
||||
@@ -149,37 +149,37 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
{ .id = 86, .x = 12.375, .y = -4.125, .adr = { .drv = 1, .cs = 12, .swr = 5, .swg = 4, .swb = 6 }, .scan = 85 }, \
|
||||
{ .id = 87, .x = 13.125, .y = -4.125, .adr = { .drv = 1, .cs = 11, .swr = 5, .swg = 4, .swb = 6 }, .scan = 86 }, \
|
||||
{ .id = 88, .x = 13.433, .y = -4.43, .adr = { .drv = 1, .cs = 11, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 89, .x = 12.285, .y = -4.535, .adr = { .drv = 1, .cs = 12, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 89, .x = 12.285, .y = -4.535, .adr = { .drv = 1, .cs = 12, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 90, .x = 11.14, .y = -4.535, .adr = { .drv = 1, .cs = 13, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 91, .x = 9.995, .y = -4.535, .adr = { .drv = 1, .cs = 14, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 91, .x = 9.995, .y = -4.535, .adr = { .drv = 1, .cs = 14, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 92, .x = 8.85, .y = -4.535, .adr = { .drv = 1, .cs = 15, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 93, .x = 7.705, .y = -4.535, .adr = { .drv = 1, .cs = 16, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 93, .x = 7.705, .y = -4.535, .adr = { .drv = 1, .cs = 16, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 94, .x = 6.56, .y = -4.535, .adr = { .drv = 2, .cs = 9, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 95, .x = 5.415, .y = -4.535, .adr = { .drv = 2, .cs = 10, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 95, .x = 5.415, .y = -4.535, .adr = { .drv = 2, .cs = 10, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 96, .x = 4.27, .y = -4.535, .adr = { .drv = 2, .cs = 11, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 97, .x = 3.125, .y = -4.535, .adr = { .drv = 2, .cs = 12, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 97, .x = 3.125, .y = -4.535, .adr = { .drv = 2, .cs = 12, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 98, .x = 1.98, .y = -4.535, .adr = { .drv = 2, .cs = 13, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 99, .x = 0.835, .y = -4.535, .adr = { .drv = 2, .cs = 14, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 99, .x = 0.835, .y = -4.535, .adr = { .drv = 2, .cs = 14, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 100, .x = -0.307, .y = -4.43, .adr = { .drv = 2, .cs = 15, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 101, .x = -0.41, .y = -3.245, .adr = { .drv = 2, .cs = 15, .swr = 11, .swg = 10, .swb = 12 }, .scan = 254 }, \
|
||||
{ .id = 101, .x = -0.41, .y = -3.245, .adr = { .drv = 2, .cs = 15, .swr = 11, .swg = 10, .swb = 12 }, .scan = 255 }, \
|
||||
{ .id = 102, .x = -0.41, .y = -2.06, .adr = { .drv = 2, .cs = 15, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 103, .x = -0.41, .y = -0.875, .adr = { .drv = 2, .cs = 15, .swr = 8, .swg = 7, .swb = 9 }, .scan = 254 }, \
|
||||
{ .id = 103, .x = -0.41, .y = -0.875, .adr = { .drv = 2, .cs = 15, .swr = 8, .swg = 7, .swb = 9 }, .scan = 255 }, \
|
||||
{ .id = 104, .x = -0.308, .y = 0.31, .adr = { .drv = 2, .cs = 1, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 105, .x = 0.835, .y = 0.415, .adr = { .drv = 2, .cs = 3, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 105, .x = 0.835, .y = 0.415, .adr = { .drv = 2, .cs = 3, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 106, .x = 1.98, .y = 0.415, .adr = { .drv = 2, .cs = 4, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 107, .x = 3.125, .y = 0.415, .adr = { .drv = 2, .cs = 5, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 107, .x = 3.125, .y = 0.415, .adr = { .drv = 2, .cs = 5, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 108, .x = 4.27, .y = 0.415, .adr = { .drv = 2, .cs = 7, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 109, .x = 5.415, .y = 0.415, .adr = { .drv = 2, .cs = 8, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 109, .x = 5.415, .y = 0.415, .adr = { .drv = 2, .cs = 8, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 110, .x = 6.56, .y = 0.415, .adr = { .drv = 1, .cs = 1, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 111, .x = 7.705, .y = 0.415, .adr = { .drv = 1, .cs = 2, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 111, .x = 7.705, .y = 0.415, .adr = { .drv = 1, .cs = 2, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 112, .x = 8.85, .y = 0.415, .adr = { .drv = 1, .cs = 3, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 113, .x = 9.995, .y = 0.415, .adr = { .drv = 1, .cs = 5, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 113, .x = 9.995, .y = 0.415, .adr = { .drv = 1, .cs = 5, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 114, .x = 11.14, .y = 0.415, .adr = { .drv = 1, .cs = 6, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 115, .x = 12.285, .y = 0.415, .adr = { .drv = 1, .cs = 8, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 115, .x = 12.285, .y = 0.415, .adr = { .drv = 1, .cs = 8, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 116, .x = 13.432, .y = 0.31, .adr = { .drv = 1, .cs = 10, .swr = 2, .swg = 1, .swb = 3 }, .scan = 255 }, \
|
||||
{ .id = 117, .x = 13.535, .y = -0.875, .adr = { .drv = 1, .cs = 10, .swr = 8, .swg = 7, .swb = 9 }, .scan = 254 }, \
|
||||
{ .id = 117, .x = 13.535, .y = -0.875, .adr = { .drv = 1, .cs = 10, .swr = 8, .swg = 7, .swb = 9 }, .scan = 255 }, \
|
||||
{ .id = 118, .x = 13.535, .y = -2.06, .adr = { .drv = 1, .cs = 10, .swr = 11, .swg = 10, .swb = 12 }, .scan = 255 }, \
|
||||
{ .id = 119, .x = 13.535, .y = -3.245, .adr = { .drv = 1, .cs = 10, .swr = 5, .swg = 4, .swb = 6 }, .scan = 254 }, \
|
||||
{ .id = 119, .x = 13.535, .y = -3.245, .adr = { .drv = 1, .cs = 10, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
};
|
||||
|
||||
#define USB_LED_INDICATOR_ENABLE //Comment out to disable indicator functionality
|
||||
|
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
|
||||
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
|
||||
|
||||
/* Data structure to define Shift Register output expander hardware */
|
||||
/* This structure gets shifted into registers LSB first */
|
||||
typedef union {
|
||||
struct {
|
||||
uint16_t RSVD4:1; /*!< bit: 0 */
|
||||
uint16_t RSVD3:1; /*!< bit: 1 */
|
||||
uint16_t RSVD2:1; /*!< bit: 2 */
|
||||
uint16_t RSVD1:1; /*!< bit: 3 */
|
||||
uint16_t SDB_N:1; /*!< bit: 4 SHUTDOWN IS31FL3733 CHIPS WHEN 0, RUN WHEN 1 */
|
||||
uint16_t IRST:1; /*!< bit: 5 RESET IS31FL3733 I2C WHEN 1, RUN WHEN 0 */
|
||||
uint16_t SRC_2:1; /*!< bit: 6 ADVERTISE A SOURCE TO USBC-2 CC */
|
||||
uint16_t SRC_1:1; /*!< bit: 7 ADVERTISE A SOURCE TO USBC-1 CC */
|
||||
uint16_t E_VBUS_2:1; /*!< bit: 8 ENABLE 5V OUT TO USBC-2 WHEN 1 */
|
||||
uint16_t E_VBUS_1:1; /*!< bit: 9 ENABLE 5V OUT TO USBC-1 WHEN 1 */
|
||||
uint16_t E_DN1_N:1; /*!< bit: 10 ENABLE DN1 1:2 MUX WHEN 0 */
|
||||
uint16_t S_DN1:1; /*!< bit: 11 SELECT DN1 PATH 0:USBC-1, 1:USBC-2 */
|
||||
uint16_t E_UP_N:1; /*!< bit: 12 ENABLE SUP 1:2 MUX WHEN 0 */
|
||||
uint16_t S_UP:1; /*!< bit: 13 SELECT UP PATH 0:USBC-1, 1:USBC-2 */
|
||||
uint16_t HUB_RESET_N:1; /*!< bit: 14 RESET USB HUB WHEN 0, RUN WHEN 1 */
|
||||
uint16_t HUB_CONNECT:1; /*!< bit: 15 SIGNAL VBUS CONNECT TO USB HUB WHEN 1 */
|
||||
} bit; /*!< Structure used for bit access */
|
||||
uint16_t reg; /*!< Type used for register access */
|
||||
} sr_exp_t;
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
|
||||
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
|
||||
|
||||
//Macros to Enable, Disable, and Update USB 5V bus connections
|
||||
#define USBC_CFG_5V1_VAR sr_exp_data.bit.E_VBUS_1 //Variable storing USBC-1 5V Bus state
|
||||
#define USBC_CFG_5V1_ENA 1 //Value to enable USBC-1 5V Bus
|
||||
#define USBC_CFG_5V1_DIS 0 //Value to disable USBC-1 5V Bus
|
||||
#define USBC_CFG_5V1_UPDATE SR_EXP_WriteData() //Command to run to update value
|
||||
#define USBC_CFG_5V2_VAR sr_exp_data.bit.E_VBUS_2 //Variable storing USBC-2 5V Bus state
|
||||
#define USBC_CFG_5V2_ENA 1 //Value to enable USBC-1 5V Bus
|
||||
#define USBC_CFG_5V2_DIS 0 //Value to disable USBC-1 5V Bus
|
||||
#define USBC_CFG_5V2_UPDATE SR_EXP_WriteData() //Command to run to update value
|
@@ -1,7 +1,8 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
enum ctrl_keycodes {
|
||||
U_T_AGCR = SAFE_RANGE, //USB Toggle Automatic GCR control
|
||||
U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active
|
||||
U_T_AGCR, //USB Toggle Automatic GCR control
|
||||
DBG_TOG, //DEBUG Toggle On / Off
|
||||
DBG_MTRX, //DEBUG Toggle Matrix Prints
|
||||
DBG_KBD, //DEBUG Toggle Keyboard Prints
|
||||
@@ -25,7 +26,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[1] = LAYOUT(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU, \
|
||||
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, _______, U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \
|
||||
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \
|
||||
_______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, RGB_TOG, _______, _______, _______, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
@@ -36,7 +37,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
),
|
||||
*/
|
||||
@@ -58,6 +59,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
static uint32_t key_timer;
|
||||
|
||||
switch (keycode) {
|
||||
case U_T_AUTO:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode");
|
||||
}
|
||||
return false;
|
||||
case U_T_AGCR:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
|
||||
@@ -87,7 +93,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
key_timer = timer_read32();
|
||||
} else {
|
||||
if (timer_elapsed32(key_timer) >= BOOTKEY_HOLD_MS) {
|
||||
if (timer_elapsed32(key_timer) >= 500) {
|
||||
reset_keyboard();
|
||||
}
|
||||
}
|
||||
@@ -122,15 +128,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return true; //Process all other keycodes normally
|
||||
}
|
||||
}
|
||||
|
||||
led_instruction_t led_instructions[] = {
|
||||
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 10, .id1 = 9, .r = 255, .g = 0, .b = 0 },
|
||||
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_PATTERN, .id0 = 4, .id1 = 0, .pattern_id = 8 },
|
||||
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 8, .id1 = 0, .r = 0, .g = 255, .b = 0 },
|
||||
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_PATTERN, .id = 16, .id1 = 0, .pattern_id = 9 },
|
||||
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 32, .id1 = 0, .r = 0, .g = 0, .b = 255 },
|
||||
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_ROTATE_PATTERN, .id0 = 64, .id1 = 0},
|
||||
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_MATCH_LAYER | LED_FLAG_USE_ROTATE_PATTERN, .id0 = 262144, .id1 = 0, .layer = 0 },
|
||||
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_MATCH_LAYER | LED_FLAG_USE_ROTATE_PATTERN, .id = 16777216, .id1 = 0, .layer = 1 },
|
||||
{ .end = 1 }
|
||||
};
|
||||
|
@@ -1,28 +1,24 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
enum ctrl_keycodes {
|
||||
L_BRI = SAFE_RANGE, //LED Brightness Increase
|
||||
L_BRD, //LED Brightness Decrease
|
||||
L_EDG_I, //LED Edge Brightness Increase
|
||||
L_EDG_D, //LED Edge Brightness Decrease
|
||||
L_EDG_M, //LED Edge lighting mode
|
||||
L_PTN, //LED Pattern Select Next
|
||||
L_PTP, //LED Pattern Select Previous
|
||||
L_PSI, //LED Pattern Speed Increase
|
||||
L_PSD, //LED Pattern Speed Decrease
|
||||
L_T_MD, //LED Toggle Mode
|
||||
L_T_ONF, //LED Toggle On / Off
|
||||
L_ON, //LED On
|
||||
L_OFF, //LED Off
|
||||
L_T_BR, //LED Toggle Breath Effect
|
||||
L_T_PTD, //LED Toggle Scrolling Pattern Direction and effect
|
||||
U_T_AGCR, //USB Toggle Automatic GCR control
|
||||
DBG_TOG, //DEBUG Toggle On / Off
|
||||
DBG_MTRX, //DEBUG Toggle Matrix Prints
|
||||
DBG_KBD, //DEBUG Toggle Keyboard Prints
|
||||
DBG_MOU, //DEBUG Toggle Mouse Prints
|
||||
DBG_FAC, //DEBUG Factory light testing (All on white)
|
||||
MD_BOOT //Restart into bootloader after hold timeout
|
||||
L_BRI = SAFE_RANGE, //LED Brightness Increase //Working
|
||||
L_BRD, //LED Brightness Decrease //Working
|
||||
L_PTN, //LED Pattern Select Next //Working
|
||||
L_PTP, //LED Pattern Select Previous //Working
|
||||
L_PSI, //LED Pattern Speed Increase //Working
|
||||
L_PSD, //LED Pattern Speed Decrease //Working
|
||||
L_T_MD, //LED Toggle Mode //Working
|
||||
L_T_ONF, //LED Toggle On / Off //Broken
|
||||
L_ON, //LED On //Broken
|
||||
L_OFF, //LED Off //Broken
|
||||
L_T_BR, //LED Toggle Breath Effect //Working
|
||||
L_T_PTD, //LED Toggle Scrolling Pattern Direction //Working
|
||||
U_T_AGCR, //USB Toggle Automatic GCR control //Working
|
||||
DBG_TOG, //DEBUG Toggle On / Off //
|
||||
DBG_MTRX, //DEBUG Toggle Matrix Prints //
|
||||
DBG_KBD, //DEBUG Toggle Keyboard Prints //
|
||||
DBG_MOU, //DEBUG Toggle Mouse Prints //
|
||||
MD_BOOT //Restart into bootloader after hold timeout //Working
|
||||
};
|
||||
|
||||
#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode
|
||||
@@ -34,26 +30,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, \
|
||||
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_INS, KC_HOME, 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_END, KC_PGDN, \
|
||||
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_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_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \
|
||||
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_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_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \
|
||||
),
|
||||
[1] = LAYOUT(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU, \
|
||||
L_T_BR, L_PSD, L_BRI, L_PSI, L_EDG_I, _______, _______, _______, U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \
|
||||
L_T_PTD, L_PTP, L_BRD, L_PTN, L_EDG_D, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, L_T_MD, L_T_ONF, _______, L_EDG_M, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, DBG_FAC, _______, _______, _______, _______, _______, _______, _______ \
|
||||
L_T_BR, L_PSD, L_BRI, L_PSI, _______, _______, _______, _______, U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \
|
||||
L_T_PTD, L_PTP, L_BRD, L_PTN, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, L_T_MD, L_T_ONF, _______, _______, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
),
|
||||
/*
|
||||
[X] = LAYOUT(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
),
|
||||
*/
|
||||
};
|
||||
@@ -66,13 +62,12 @@ void matrix_init_user(void) {
|
||||
void matrix_scan_user(void) {
|
||||
};
|
||||
|
||||
#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT))
|
||||
#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL))
|
||||
#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))
|
||||
#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT))
|
||||
#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL))
|
||||
#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
static uint32_t key_timer;
|
||||
static uint8_t scroll_effect = 0;
|
||||
|
||||
switch (keycode) {
|
||||
case L_BRI:
|
||||
@@ -89,26 +84,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (led_animation_breathing) gcr_breathe = gcr_desired;
|
||||
}
|
||||
return false;
|
||||
case L_EDG_M:
|
||||
if (record->event.pressed) {
|
||||
led_edge_mode++;
|
||||
if (led_edge_mode > LED_EDGE_MODE_MAX) {
|
||||
led_edge_mode = LED_EDGE_MODE_ALL;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case L_EDG_I:
|
||||
if (record->event.pressed) {
|
||||
led_edge_brightness += 0.1;
|
||||
if (led_edge_brightness > 1) { led_edge_brightness = 1; }
|
||||
}
|
||||
return false;
|
||||
case L_EDG_D:
|
||||
if (record->event.pressed) {
|
||||
led_edge_brightness -= 0.1;
|
||||
if (led_edge_brightness < 0) { led_edge_brightness = 0; }
|
||||
}
|
||||
return false;
|
||||
case L_PTN:
|
||||
if (record->event.pressed) {
|
||||
if (led_animation_id == led_setups_count - 1) led_animation_id = 0;
|
||||
@@ -140,17 +115,20 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return false;
|
||||
case L_T_ONF:
|
||||
if (record->event.pressed) {
|
||||
I2C3733_Control_Set(!I2C3733_Control_Get());
|
||||
led_enabled = !led_enabled;
|
||||
I2C3733_Control_Set(led_enabled);
|
||||
}
|
||||
return false;
|
||||
case L_ON:
|
||||
if (record->event.pressed) {
|
||||
I2C3733_Control_Set(1);
|
||||
led_enabled = 1;
|
||||
I2C3733_Control_Set(led_enabled);
|
||||
}
|
||||
return false;
|
||||
case L_OFF:
|
||||
if (record->event.pressed) {
|
||||
I2C3733_Control_Set(0);
|
||||
led_enabled = 0;
|
||||
I2C3733_Control_Set(led_enabled);
|
||||
}
|
||||
return false;
|
||||
case L_T_BR:
|
||||
@@ -165,33 +143,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return false;
|
||||
case L_T_PTD:
|
||||
if (record->event.pressed) {
|
||||
scroll_effect++;
|
||||
if (scroll_effect == 1) { //Patterns with scroll move horizontal (Right to left)
|
||||
led_animation_direction = 1;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 0;
|
||||
} else if (scroll_effect == 2) { //Patterns with scroll move vertical (Top to bottom)
|
||||
led_animation_direction = 1;
|
||||
led_animation_orientation = 1;
|
||||
led_animation_circular = 0;
|
||||
} else if (scroll_effect == 3) { //Patterns with scroll move vertical (Bottom to top)
|
||||
led_animation_direction = 0;
|
||||
led_animation_orientation = 1;
|
||||
led_animation_circular = 0;
|
||||
} else if (scroll_effect == 4) { //Patterns with scroll explode from center
|
||||
led_animation_direction = 0;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 1;
|
||||
} else if (scroll_effect == 5) { //Patterns with scroll implode on center
|
||||
led_animation_direction = 1;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 1;
|
||||
} else { //Patterns with scroll move horizontal (Left to right)
|
||||
scroll_effect = 0;
|
||||
led_animation_direction = 0;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 0;
|
||||
}
|
||||
led_animation_direction = !led_animation_direction;
|
||||
}
|
||||
return false;
|
||||
case U_T_AGCR:
|
||||
@@ -199,17 +151,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
|
||||
}
|
||||
return false;
|
||||
case DBG_FAC:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
led_lighting_mode = LED_MODE_NORMAL;
|
||||
led_edge_brightness = 1;
|
||||
led_edge_mode = LED_EDGE_MODE_ALL;
|
||||
led_animation_breathing = 0;
|
||||
led_animation_id = 7; //led_programs.c led_setups leds_white index
|
||||
gcr_desired = LED_GCR_MAX;
|
||||
I2C3733_Control_Set(1);
|
||||
}
|
||||
return false;
|
||||
case DBG_TOG:
|
||||
if (record->event.pressed) {
|
||||
TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode");
|
||||
@@ -234,7 +175,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
key_timer = timer_read32();
|
||||
} else {
|
||||
if (timer_elapsed32(key_timer) >= BOOTKEY_HOLD_MS) {
|
||||
if (timer_elapsed32(key_timer) >= 500) {
|
||||
reset_keyboard();
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
enum ctrl_keycodes {
|
||||
U_T_AGCR = SAFE_RANGE, //USB Toggle Automatic GCR control
|
||||
U_T_AUTO = SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active
|
||||
U_T_AGCR, //USB Toggle Automatic GCR control
|
||||
DBG_TOG, //DEBUG Toggle On / Off
|
||||
DBG_MTRX, //DEBUG Toggle Matrix Prints
|
||||
DBG_KBD, //DEBUG Toggle Keyboard Prints
|
||||
@@ -25,7 +26,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[1] = LAYOUT(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU, \
|
||||
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, _______, U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \
|
||||
_______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \
|
||||
_______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, RGB_TOG, _______, _______, _______, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
@@ -36,7 +37,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
),
|
||||
*/
|
||||
@@ -58,6 +59,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
static uint32_t key_timer;
|
||||
|
||||
switch (keycode) {
|
||||
case U_T_AUTO:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode");
|
||||
}
|
||||
return false;
|
||||
case U_T_AGCR:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
|
||||
@@ -87,7 +93,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
key_timer = timer_read32();
|
||||
} else {
|
||||
if (timer_elapsed32(key_timer) >= BOOTKEY_HOLD_MS) {
|
||||
if (timer_elapsed32(key_timer) >= 500) {
|
||||
reset_keyboard();
|
||||
}
|
||||
}
|
||||
@@ -122,7 +128,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return true; //Process all other keycodes normally
|
||||
}
|
||||
}
|
||||
|
||||
led_instruction_t led_instructions[] = {
|
||||
{ .end = 1 }
|
||||
};
|
||||
|
@@ -1,28 +1,24 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
enum ctrl_keycodes {
|
||||
L_BRI = SAFE_RANGE, //LED Brightness Increase
|
||||
L_BRD, //LED Brightness Decrease
|
||||
L_EDG_I, //LED Edge Brightness Increase
|
||||
L_EDG_D, //LED Edge Brightness Decrease
|
||||
L_EDG_M, //LED Edge lighting mode
|
||||
L_PTN, //LED Pattern Select Next
|
||||
L_PTP, //LED Pattern Select Previous
|
||||
L_PSI, //LED Pattern Speed Increase
|
||||
L_PSD, //LED Pattern Speed Decrease
|
||||
L_T_MD, //LED Toggle Mode
|
||||
L_T_ONF, //LED Toggle On / Off
|
||||
L_ON, //LED On
|
||||
L_OFF, //LED Off
|
||||
L_T_BR, //LED Toggle Breath Effect
|
||||
L_T_PTD, //LED Toggle Scrolling Pattern Direction and effect
|
||||
U_T_AGCR, //USB Toggle Automatic GCR control
|
||||
DBG_TOG, //DEBUG Toggle On / Off
|
||||
DBG_MTRX, //DEBUG Toggle Matrix Prints
|
||||
DBG_KBD, //DEBUG Toggle Keyboard Prints
|
||||
DBG_MOU, //DEBUG Toggle Mouse Prints
|
||||
DBG_FAC, //DEBUG Factory light testing (All on white)
|
||||
MD_BOOT //Restart into bootloader after hold timeout
|
||||
L_BRI = SAFE_RANGE, //LED Brightness Increase //Working
|
||||
L_BRD, //LED Brightness Decrease //Working
|
||||
L_PTN, //LED Pattern Select Next //Working
|
||||
L_PTP, //LED Pattern Select Previous //Working
|
||||
L_PSI, //LED Pattern Speed Increase //Working
|
||||
L_PSD, //LED Pattern Speed Decrease //Working
|
||||
L_T_MD, //LED Toggle Mode //Working
|
||||
L_T_ONF, //LED Toggle On / Off //Broken
|
||||
L_ON, //LED On //Broken
|
||||
L_OFF, //LED Off //Broken
|
||||
L_T_BR, //LED Toggle Breath Effect //Working
|
||||
L_T_PTD, //LED Toggle Scrolling Pattern Direction //Working
|
||||
U_T_AGCR, //USB Toggle Automatic GCR control //Working
|
||||
DBG_TOG, //DEBUG Toggle On / Off //
|
||||
DBG_MTRX, //DEBUG Toggle Matrix Prints //
|
||||
DBG_KBD, //DEBUG Toggle Keyboard Prints //
|
||||
DBG_MOU, //DEBUG Toggle Mouse Prints //
|
||||
MD_BOOT //Restart into bootloader after hold timeout //Working
|
||||
};
|
||||
|
||||
#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode
|
||||
@@ -34,26 +30,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, \
|
||||
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_INS, KC_HOME, 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_END, KC_PGDN, \
|
||||
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_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, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \
|
||||
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_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, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \
|
||||
),
|
||||
[1] = LAYOUT(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU, \
|
||||
L_T_BR, L_PSD, L_BRI, L_PSI, L_EDG_I, _______, _______, _______, U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \
|
||||
L_T_PTD, L_PTP, L_BRD, L_PTN, L_EDG_D, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, L_T_MD, L_T_ONF, _______, L_EDG_M, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, DBG_FAC, _______, _______, _______, _______, _______, _______, _______ \
|
||||
L_T_BR, L_PSD, L_BRI, L_PSI, _______, _______, _______, _______, U_T_AGCR,_______, _______, _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \
|
||||
L_T_PTD, L_PTP, L_BRD, L_PTN, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, L_T_MD, L_T_ONF, _______, _______, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
),
|
||||
/*
|
||||
[X] = LAYOUT(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, TG_NKRO, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
),
|
||||
*/
|
||||
};
|
||||
@@ -66,13 +62,12 @@ void matrix_init_user(void) {
|
||||
void matrix_scan_user(void) {
|
||||
};
|
||||
|
||||
#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT))
|
||||
#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL))
|
||||
#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))
|
||||
#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT))
|
||||
#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL))
|
||||
#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
static uint32_t key_timer;
|
||||
static uint8_t scroll_effect = 0;
|
||||
|
||||
switch (keycode) {
|
||||
case L_BRI:
|
||||
@@ -89,26 +84,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (led_animation_breathing) gcr_breathe = gcr_desired;
|
||||
}
|
||||
return false;
|
||||
case L_EDG_M:
|
||||
if (record->event.pressed) {
|
||||
led_edge_mode++;
|
||||
if (led_edge_mode > LED_EDGE_MODE_MAX) {
|
||||
led_edge_mode = LED_EDGE_MODE_ALL;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case L_EDG_I:
|
||||
if (record->event.pressed) {
|
||||
led_edge_brightness += 0.1;
|
||||
if (led_edge_brightness > 1) { led_edge_brightness = 1; }
|
||||
}
|
||||
return false;
|
||||
case L_EDG_D:
|
||||
if (record->event.pressed) {
|
||||
led_edge_brightness -= 0.1;
|
||||
if (led_edge_brightness < 0) { led_edge_brightness = 0; }
|
||||
}
|
||||
return false;
|
||||
case L_PTN:
|
||||
if (record->event.pressed) {
|
||||
if (led_animation_id == led_setups_count - 1) led_animation_id = 0;
|
||||
@@ -140,17 +115,20 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return false;
|
||||
case L_T_ONF:
|
||||
if (record->event.pressed) {
|
||||
I2C3733_Control_Set(!I2C3733_Control_Get());
|
||||
led_enabled = !led_enabled;
|
||||
I2C3733_Control_Set(led_enabled);
|
||||
}
|
||||
return false;
|
||||
case L_ON:
|
||||
if (record->event.pressed) {
|
||||
I2C3733_Control_Set(1);
|
||||
led_enabled = 1;
|
||||
I2C3733_Control_Set(led_enabled);
|
||||
}
|
||||
return false;
|
||||
case L_OFF:
|
||||
if (record->event.pressed) {
|
||||
I2C3733_Control_Set(0);
|
||||
led_enabled = 0;
|
||||
I2C3733_Control_Set(led_enabled);
|
||||
}
|
||||
return false;
|
||||
case L_T_BR:
|
||||
@@ -165,33 +143,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return false;
|
||||
case L_T_PTD:
|
||||
if (record->event.pressed) {
|
||||
scroll_effect++;
|
||||
if (scroll_effect == 1) { //Patterns with scroll move horizontal (Right to left)
|
||||
led_animation_direction = 1;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 0;
|
||||
} else if (scroll_effect == 2) { //Patterns with scroll move vertical (Top to bottom)
|
||||
led_animation_direction = 1;
|
||||
led_animation_orientation = 1;
|
||||
led_animation_circular = 0;
|
||||
} else if (scroll_effect == 3) { //Patterns with scroll move vertical (Bottom to top)
|
||||
led_animation_direction = 0;
|
||||
led_animation_orientation = 1;
|
||||
led_animation_circular = 0;
|
||||
} else if (scroll_effect == 4) { //Patterns with scroll explode from center
|
||||
led_animation_direction = 0;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 1;
|
||||
} else if (scroll_effect == 5) { //Patterns with scroll implode on center
|
||||
led_animation_direction = 1;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 1;
|
||||
} else { //Patterns with scroll move horizontal (Left to right)
|
||||
scroll_effect = 0;
|
||||
led_animation_direction = 0;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 0;
|
||||
}
|
||||
led_animation_direction = !led_animation_direction;
|
||||
}
|
||||
return false;
|
||||
case U_T_AGCR:
|
||||
@@ -199,17 +151,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
|
||||
}
|
||||
return false;
|
||||
case DBG_FAC:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
led_lighting_mode = LED_MODE_NORMAL;
|
||||
led_edge_brightness = 1;
|
||||
led_edge_mode = LED_EDGE_MODE_ALL;
|
||||
led_animation_breathing = 0;
|
||||
led_animation_id = 7; //led_programs.c led_setups leds_white index
|
||||
gcr_desired = LED_GCR_MAX;
|
||||
I2C3733_Control_Set(1);
|
||||
}
|
||||
return false;
|
||||
case DBG_TOG:
|
||||
if (record->event.pressed) {
|
||||
TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode");
|
||||
@@ -234,7 +175,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
key_timer = timer_read32();
|
||||
} else {
|
||||
if (timer_elapsed32(key_timer) >= BOOTKEY_HOLD_MS) {
|
||||
if (timer_elapsed32(key_timer) >= 500) {
|
||||
reset_keyboard();
|
||||
}
|
||||
}
|
||||
|
@@ -135,7 +135,7 @@ void rgb_matrix_indicators_user(void)
|
||||
break;
|
||||
|
||||
case _FNC: {
|
||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||
HSV hsv = { rgb_matrix_config.hsv.h, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v };
|
||||
HSV hui = hsv;
|
||||
HSV hud = hsv;
|
||||
HSV sai = hsv;
|
||||
|
@@ -29,6 +29,7 @@ enum ctrl_keycodes {
|
||||
L_OFF, //LED Off
|
||||
L_T_BR, //LED Toggle Breath Effect
|
||||
L_T_PTD, //LED Toggle Scrolling Pattern Direction
|
||||
U_T_AUTO, //USB Extra Port Toggle Auto Detect / Always Active
|
||||
U_T_AGCR, //USB Toggle Automatic GCR control
|
||||
DBG_TOG, //DEBUG Toggle On / Off
|
||||
DBG_MTRX, //DEBUG Toggle Matrix Prints
|
||||
@@ -66,7 +67,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[1] = LAYOUT(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MUTE, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, KC_MSTP, KC_VOLU, \
|
||||
L_T_BR, L_PSD, L_BRI, L_PSI, _______, _______, _______, _______, U_T_AGCR,_______, MO(2), _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \
|
||||
L_T_BR, L_PSD, L_BRI, L_PSI, _______, _______, _______, U_T_AUTO,U_T_AGCR,_______, MO(2), _______, _______, _______, KC_MPRV, KC_MNXT, KC_VOLD, \
|
||||
L_T_PTD, L_PTP, L_BRD, L_PTN, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, L_T_MD, L_T_ONF, _______, _______, MD_BOOT, TG_NKRO, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
@@ -776,6 +777,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
led_animation_direction = !led_animation_direction;
|
||||
}
|
||||
return false;
|
||||
case U_T_AUTO:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode");
|
||||
}
|
||||
return false;
|
||||
case U_T_AGCR:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
Copyright 2018 Massdrop Inc.
|
||||
|
||||
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
|
||||
@@ -22,8 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "clks.h"
|
||||
#include <string.h>
|
||||
|
||||
#define MCU_PORTS_USED 2 //PA, PB
|
||||
|
||||
matrix_row_t mlatest[MATRIX_ROWS];
|
||||
matrix_row_t mlast[MATRIX_ROWS];
|
||||
matrix_row_t mdebounced[MATRIX_ROWS];
|
||||
@@ -32,7 +30,7 @@ uint8_t row_ports[] = { MATRIX_ROW_PORTS };
|
||||
uint8_t row_pins[] = { MATRIX_ROW_PINS };
|
||||
uint8_t col_ports[] = { MATRIX_COL_PORTS };
|
||||
uint8_t col_pins[] = { MATRIX_COL_PINS };
|
||||
uint32_t row_masks[MCU_PORTS_USED]; //Array size must match number of unique MCU ports used for reads (PA, PB, PC, etc)
|
||||
uint32_t row_masks[2]; //NOTE: If more than PA PB used in the future, adjust code to accomodate
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_kb(void) {
|
||||
@@ -58,9 +56,9 @@ void matrix_init(void)
|
||||
memset(mlast, 0, MATRIX_ROWS * sizeof(matrix_row_t));
|
||||
memset(mdebounced, 0, MATRIX_ROWS * sizeof(matrix_row_t));
|
||||
|
||||
memset(row_masks, 0, sizeof(row_masks));
|
||||
row_masks[PA] = 0;
|
||||
row_masks[PB] = 0;
|
||||
|
||||
//Inputs
|
||||
uint8_t row;
|
||||
for (row = 0; row < MATRIX_ROWS; row++)
|
||||
{
|
||||
@@ -71,7 +69,6 @@ void matrix_init(void)
|
||||
row_masks[row_ports[row]] |= 1 << row_pins[row]; //Add pin to proper row mask
|
||||
}
|
||||
|
||||
//Outputs
|
||||
uint8_t col;
|
||||
for (col = 0; col < MATRIX_COLS; col++)
|
||||
{
|
||||
@@ -83,29 +80,27 @@ void matrix_init(void)
|
||||
}
|
||||
|
||||
uint64_t mdebouncing = 0;
|
||||
bool debouncing = false;
|
||||
|
||||
uint8_t matrix_scan(void)
|
||||
{
|
||||
uint64_t timer;
|
||||
uint8_t mchanged;
|
||||
uint8_t row;
|
||||
uint8_t col;
|
||||
uint32_t scans[MCU_PORTS_USED]; //Array size must match number of unique MCU ports used for reads (PA, PB, PC, etc)
|
||||
uint32_t scans[2]; //PA PB
|
||||
|
||||
if (timer_read64() < mdebouncing) return 1; //mdebouncing == 0 when no debouncing active
|
||||
|
||||
memset(mlatest, 0, MATRIX_ROWS * sizeof(matrix_row_t)); //Zero the result buffer
|
||||
|
||||
for (col = 0; col < MATRIX_COLS; col++)
|
||||
{
|
||||
//Set output
|
||||
PORT->Group[col_ports[col]].OUTSET.reg = 1 << col_pins[col]; //Set col output
|
||||
wait_us(1); //Delay for output
|
||||
PORT->Group[col_ports[col]].OUTSET.reg = 1 << col_pins[col]; //Set col output
|
||||
|
||||
//Read input (add unique ports as needed, PA, PB, PC, etc)
|
||||
scans[PA] = PORT->Group[PA].IN.reg & row_masks[PA]; //Read PA row pins data
|
||||
scans[PB] = PORT->Group[PB].IN.reg & row_masks[PB]; //Read PA row pins data
|
||||
wait_us(1); //Delay for output
|
||||
|
||||
//Clear output
|
||||
PORT->Group[col_ports[col]].OUTCLR.reg = 1 << col_pins[col]; //Clear col output
|
||||
scans[PA] = PORT->Group[PA].IN.reg & row_masks[PA]; //Read PA row pins data
|
||||
scans[PB] = PORT->Group[PB].IN.reg & row_masks[PB]; //Read PB row pins data
|
||||
|
||||
PORT->Group[col_ports[col]].OUTCLR.reg = 1 << col_pins[col]; //Clear col output
|
||||
|
||||
for (row = 0; row < MATRIX_ROWS; row++)
|
||||
{
|
||||
@@ -115,26 +110,25 @@ uint8_t matrix_scan(void)
|
||||
}
|
||||
}
|
||||
|
||||
timer = timer_read64();
|
||||
mchanged = 0; //Default to no matrix change since last
|
||||
|
||||
for (row = 0; row < MATRIX_ROWS; row++)
|
||||
{
|
||||
if (mlast[row] != mlatest[row]) {
|
||||
debouncing = true;
|
||||
mdebouncing = timer + DEBOUNCE;
|
||||
}
|
||||
|
||||
if (mlast[row] != mlatest[row])
|
||||
mchanged = 1;
|
||||
mlast[row] = mlatest[row];
|
||||
}
|
||||
|
||||
if (debouncing && timer >= mdebouncing)
|
||||
if (!mchanged)
|
||||
{
|
||||
for (row = 0; row < MATRIX_ROWS; row++) {
|
||||
for (row = 0; row < MATRIX_ROWS; row++)
|
||||
mdebounced[row] = mlatest[row];
|
||||
}
|
||||
|
||||
mdebouncing = 0;
|
||||
debouncing = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Begin or extend debounce on change
|
||||
mdebouncing = timer_read64() + DEBOUNCE;
|
||||
}
|
||||
|
||||
matrix_scan_quantum();
|
||||
|
@@ -1,8 +1,6 @@
|
||||
# project specific files
|
||||
SRC = matrix.c
|
||||
SRC += config_led.c
|
||||
SRC += spi.c
|
||||
SRC += usb.c
|
||||
|
||||
#For platform and packs
|
||||
ARM_ATSAM = SAMD51J18A
|
||||
|
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
|
||||
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 "arm_atsam_protocol.h"
|
||||
|
||||
void SR_EXP_Init_kb(void) {
|
||||
/* Initialize shift register */
|
||||
SR_EXP_OE_N_DIS;
|
||||
SR_EXP_RCLK_HI;
|
||||
|
||||
SR_EXP_SERCOM->SPI.CTRLA.bit.DORD = 1; //Data Order - LSB is transferred first
|
||||
SR_EXP_SERCOM->SPI.CTRLA.bit.CPOL = 1; //Clock Polarity - SCK high when idle. Leading edge of cycle is falling. Trailing rising.
|
||||
SR_EXP_SERCOM->SPI.CTRLA.bit.CPHA = 1; //Clock Phase - Leading Edge Falling, change, Trailing Edge - Rising, sample
|
||||
SR_EXP_SERCOM->SPI.CTRLA.bit.DIPO = 3; //Data In Pinout - SERCOM PAD[3] is used as data input (Configure away from DOPO. Not using input.)
|
||||
SR_EXP_SERCOM->SPI.CTRLA.bit.DOPO = 0; //Data Output PAD[0], Serial Clock PAD[1]
|
||||
SR_EXP_SERCOM->SPI.CTRLA.bit.MODE = 3; //Operating Mode - Master operation
|
||||
|
||||
SR_EXP_SERCOM->SPI.CTRLA.bit.ENABLE = 1; //Enable - Peripheral is enabled or being enabled
|
||||
while (SR_EXP_SERCOM->SPI.SYNCBUSY.bit.ENABLE) { DBGC(DC_SPI_EXP_SYNC_ENABLING); }
|
||||
|
||||
/* Set default shift register values */
|
||||
sr_exp_data.reg = 0; //Clear data register
|
||||
sr_exp_data.bit.HUB_CONNECT = 0; //USB Hub disconnected
|
||||
sr_exp_data.bit.HUB_RESET_N = 0; //USB Hub in reset state
|
||||
|
||||
sr_exp_data.bit.SRC_1 = 1; //Set CON1 CC A5/B5 as Rd 5.1k
|
||||
sr_exp_data.bit.SRC_2 = 1; //Set CON2 CC A5/B5 as Rd 5.1k
|
||||
sr_exp_data.bit.S_UP = 0; //Default USB data to CON1
|
||||
sr_exp_data.bit.E_UP_N = 1; //Disable HOST
|
||||
sr_exp_data.bit.S_DN1 = 1; //Default EXTRA port to CON2
|
||||
sr_exp_data.bit.E_DN1_N = 1; //Disable EXTRA
|
||||
|
||||
sr_exp_data.bit.E_VBUS_1 = 0; //Disable CON1 5V
|
||||
sr_exp_data.bit.E_VBUS_2 = 0; //Disable CON2 5V
|
||||
sr_exp_data.bit.IRST = 1; //LED drivers I2C in reset
|
||||
sr_exp_data.bit.SDB_N = 0; //LED drivers in shutdown
|
||||
|
||||
/* Write shift register data */
|
||||
SR_EXP_WriteData();
|
||||
|
||||
/* Enable shift register output */
|
||||
SR_EXP_OE_N_ENA;
|
||||
}
|
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
|
||||
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 "arm_atsam_protocol.h"
|
||||
|
||||
//Note: rp_best_index not used
|
||||
void usb_set_host_kb(uint8_t con, uint8_t rp_best_index) {
|
||||
if (con == 1) {
|
||||
sr_exp_data.bit.S_UP = 0; //HOST to USBC-1
|
||||
sr_exp_data.bit.S_DN1 = 1; //EXTRA to USBC-2
|
||||
g_usb_host_port = USB_HOST_PORT_1; //Save host port
|
||||
sr_exp_data.bit.E_VBUS_1 = 1; //Enable CON1 5V
|
||||
SR_EXP_WriteData(); //Update port configuration
|
||||
} else if (con == 2) {
|
||||
sr_exp_data.bit.S_DN1 = 0; //HOST to USBC-2
|
||||
sr_exp_data.bit.S_UP = 1; //EXTRA to USBC-1
|
||||
g_usb_host_port = USB_HOST_PORT_2; //Save host port
|
||||
sr_exp_data.bit.E_VBUS_2 = 1; //Enable CON2 5V
|
||||
SR_EXP_WriteData(); //Update port configuration
|
||||
}
|
||||
}
|
||||
|
||||
void usb_set_extra_kb(uint8_t con) {
|
||||
if (con == 1) {
|
||||
sr_exp_data.bit.SRC_1 = 0; //Set CON1 CC A5/B5 as Rp 56k
|
||||
sr_exp_data.bit.E_VBUS_1 = 0; //Disable CON1 5V
|
||||
SR_EXP_WriteData(); //Update port configuration
|
||||
} else if (con == 2) {
|
||||
sr_exp_data.bit.SRC_2 = 0; //Set CON2 CC A5/B5 as Rp 56k
|
||||
sr_exp_data.bit.E_VBUS_2 = 0; //Disable CON2 5V
|
||||
SR_EXP_WriteData(); //Update port configuration
|
||||
}
|
||||
}
|
||||
|
||||
void usb_init_host_detection_kb(void) {
|
||||
//Disable 5V
|
||||
sr_exp_data.bit.E_VBUS_1 = 0; //Disable CON1 5V
|
||||
sr_exp_data.bit.E_VBUS_2 = 0; //Disable CON2 5V
|
||||
|
||||
//Configure default paths
|
||||
sr_exp_data.bit.S_UP = 0; //HOST to USBC-1
|
||||
sr_exp_data.bit.S_DN1 = 1; //EXTRA to USBC-2
|
||||
|
||||
//Configure CC lines
|
||||
sr_exp_data.bit.SRC_1 = 1; //Set CON1 CC A5/B5 as Rd 5.1k
|
||||
sr_exp_data.bit.SRC_2 = 1; //Set CON2 CC A5/B5 as Rd 5.1k
|
||||
|
||||
//Enable ports
|
||||
sr_exp_data.bit.E_UP_N = 0; //Enable HOST for use
|
||||
sr_exp_data.bit.E_DN1_N = 0; //Enable EXTRA for use
|
||||
|
||||
SR_EXP_WriteData(); //Update port configuration
|
||||
}
|
||||
|
||||
//Return 1 if configuration successful
|
||||
//Return 0 otherwise
|
||||
uint8_t usb_attach_port_configure_kb(uint8_t g_usb_host_port, uint16_t usbc_cc_a5_v, uint16_t usbc_cc_b5_v) {
|
||||
if (USB_HOST_IS_1(g_usb_host_port)) { //If host is port 1
|
||||
//Set up port 2
|
||||
usb_set_extra_kb(2);
|
||||
return 1;
|
||||
} else if (USB_HOST_IS_2(g_usb_host_port)) { //If host is on port 2
|
||||
//Set up port 1
|
||||
usb_set_extra_kb(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,132 +0,0 @@
|
||||
/*
|
||||
Copyright 2015 Jun Wako <wakojun@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0x04D8
|
||||
#define PRODUCT_ID 0xEE66
|
||||
#define DEVICE_VER 0x0100
|
||||
|
||||
#define MANUFACTURER "Massdrop Inc."
|
||||
#define PRODUCT "Massdrop x Zslane Mercury Rocketeer Keyboard"
|
||||
#define SERIAL_NUM "Unavailable"
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 14
|
||||
|
||||
/* MCU Port name definitions */
|
||||
#define PA 0
|
||||
#define PB 1
|
||||
|
||||
/* Port and Pin definition of key row hardware configuration */
|
||||
#define MATRIX_ROW_PORTS PB, PB, PB, PB, PA
|
||||
#define MATRIX_ROW_PINS 6, 7, 8, 9, 4
|
||||
|
||||
/* Port and Pin definition of key column hardware configuration */
|
||||
#define MATRIX_COL_PORTS PB, PA, PA, PA, PA, PB, PB, PA, PA, PA, PB, PB, PB, PB
|
||||
#define MATRIX_COL_PINS 3, 0, 1, 2, 3, 30, 31, 5, 6, 7, 10, 11, 12, 13
|
||||
|
||||
/* This Shift Register expands available hardware output lines to control additional peripherals */
|
||||
/* It uses four lines from the MCU to provide 16 output lines */
|
||||
/* Shift Register Clock configuration (MCU to ShiftRegister.RCLK) */
|
||||
#define SR_EXP_RCLK_PORT PB
|
||||
#define SR_EXP_RCLK_PIN 14
|
||||
/* Shift Register Output Enable configuration (MCU to ShiftRegister.OE_N) */
|
||||
#define SR_EXP_OE_N_PORT PB
|
||||
#define SR_EXP_OE_N_PIN 15
|
||||
/* SERCOM port to use for Shift Register SPI */
|
||||
/* DATAOUT and SCLK must be configured to use hardware pins of this port */
|
||||
#define SR_EXP_SERCOM_NUM 2
|
||||
/* Shift Register SPI Data Out configuration (MCU.SERCOMx.PAD[0] to ShiftRegister.SER) */
|
||||
#define SR_EXP_DATAOUT_PORT PA
|
||||
#define SR_EXP_DATAOUT_PIN 12
|
||||
#define SR_EXP_DATAOUT_MUX 2
|
||||
/* Shift Register SPI Serial Clock configuration (MCU.SERCOMx.PAD[1] to ShiftRegister.SRCLK) */
|
||||
#define SR_EXP_SCLK_PORT PA
|
||||
#define SR_EXP_SCLK_PIN 13
|
||||
#define SR_EXP_SCLK_MUX 2
|
||||
|
||||
/* Debug LED (Small LED Located near MCU) */
|
||||
/* PCB D94 */
|
||||
#define DEBUG_LED_ENABLE 1
|
||||
#define DEBUG_LED_PORT PA
|
||||
#define DEBUG_LED_PIN 27
|
||||
|
||||
/* Additional debugging ports */
|
||||
/* PCB M25 */
|
||||
#define DEBUG_PORT1_ENABLE 1
|
||||
#define DEBUG_PORT1_PORT PA
|
||||
#define DEBUG_PORT1_PIN 20
|
||||
/* PCB M26 */
|
||||
#define DEBUG_PORT2_ENABLE 1
|
||||
#define DEBUG_PORT2_PORT PA
|
||||
#define DEBUG_PORT2_PIN 21
|
||||
/* PCB M23 */
|
||||
#define DEBUG_PORT3_ENABLE 1
|
||||
#define DEBUG_PORT3_PORT PB
|
||||
#define DEBUG_PORT3_PIN 17
|
||||
|
||||
/* Debug Boot Tracing - During boot sequence, ground this pin to halt and display debug code using Debug LED */
|
||||
/* This is useful in determining which hardware device may have malfunctioned or is improperly configured */
|
||||
/* Feature is automatically disabled after successful boot */
|
||||
/* PCB M27 */
|
||||
#define DEBUG_BOOT_TRACING_ENABLE 1
|
||||
#define DEBUG_BOOT_TRACING_PORT PB
|
||||
#define DEBUG_BOOT_TRACING_PIN 23
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCE 5
|
||||
|
||||
// Required BOOT key hold time (in ms) for restarting to bootloader -PS081419
|
||||
#define BOOTKEY_HOLD_MS 2000
|
||||
|
||||
/* 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
|
||||
|
||||
/* Force boot in NKRO mode */
|
||||
//#define FORCE_NKRO
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
#define RGB_MATRIX_KEYPRESSES
|
||||
#define RGB_MATRIX_LED_PROCESS_LIMIT 15
|
||||
#define RGB_MATRIX_LED_FLUSH_LIMIT 10
|
||||
#define RGB_MATRIX_EXTRA_TOG
|
||||
|
||||
#include "config_led.h"
|
@@ -1,118 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
|
||||
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
|
||||
|
||||
//ADC configuration table column indices
|
||||
#define ADC_PORT 0
|
||||
#define ADC_PIN 1
|
||||
#define ADC_MUX 2
|
||||
#define ADC_INDEX 3
|
||||
#define ADC_MUXPOS 4
|
||||
#define ADC_REFSEL 5
|
||||
#define ADC_SAMPLENUM 6
|
||||
#define ADC_SAMPLEN 7
|
||||
|
||||
//ADC configuration table row indices
|
||||
#define ADC_5V 0 //5V bus voltage
|
||||
#define ADC_C1A5 1 //Connector 1 A5 CC voltage
|
||||
#define ADC_C1B5 2 //Connector 1 B5 CC voltage
|
||||
#define ADC_C2A5 3 //Connector 2 A5 CC voltage
|
||||
#define ADC_C2B5 4 //Connector 2 B5 CC voltage
|
||||
#define ADC_C1I 5 //Connector 1 current
|
||||
#define ADC_C2I 6 //Connector 2 current
|
||||
|
||||
//ADC_PORT: PORT of the PIN on the MCU (Ex: 0 = PA, 1 = PB, ...)
|
||||
// Set ADC_PORT to ADC_NA if it is not available for use
|
||||
//ADC_PIN: PIN on the MCU (Ex: 0 = 00, 1 = 01, 12 = 12, ...)
|
||||
//ADC_MUX: PMUX setting for the MCU PIN (Ex: 0 = A, 1 = B, 2 = C, ...)
|
||||
//ADC_INDEX: ADC to use (Ex: 0 = ADC0, 1 = ADC1, ...)
|
||||
//ADC_MUXPOS: MUXPOS setting to read on the ADC (Use macros from Atmel library adc.h ADC_INPUTCTRL_MUXPOS_AIN*_Val)
|
||||
//ADC_REFSEL: Reference the ADC is to use (Use macros from Atmel library adc.h ADC_REFCTRL_REFSEL_*_Val)
|
||||
//ADC_SAMPLENUM: Number of samples to average for output (Use macros from Atmel library adc.h ADC_AVGCTRL_SAMPLENUM_*_Val)
|
||||
//ADC_SAMPLEN: Sampling time for each sample in units of CLK_ADC cycles depending on the ADC clock frequency
|
||||
// ADC_PORT ADC_MUX
|
||||
// | ADC_PIN | ADC_INDEX
|
||||
// | | | | ADC_MUXPOS ADC_REFSEL ADC_SAMPLENUM ADC_SAMPLEN
|
||||
#define ADC_CONFIG_5V 1, 0, 1, 0, ADC_INPUTCTRL_MUXPOS_AIN12_Val, ADC_REFCTRL_REFSEL_INTREF_Val, ADC_AVGCTRL_SAMPLENUM_4_Val, 45
|
||||
#define ADC_CONFIG_C1A5 1, 2, 1, 0, ADC_INPUTCTRL_MUXPOS_AIN14_Val, ADC_REFCTRL_REFSEL_INTREF_Val, ADC_AVGCTRL_SAMPLENUM_4_Val, 63
|
||||
#define ADC_CONFIG_C1B5 1, 4, 1, 1, ADC_INPUTCTRL_MUXPOS_AIN6_Val, ADC_REFCTRL_REFSEL_INTREF_Val, ADC_AVGCTRL_SAMPLENUM_4_Val, 63
|
||||
#define ADC_CONFIG_C2A5 1, 1, 1, 0, ADC_INPUTCTRL_MUXPOS_AIN13_Val, ADC_REFCTRL_REFSEL_INTREF_Val, ADC_AVGCTRL_SAMPLENUM_4_Val, 63
|
||||
#define ADC_CONFIG_C2B5 1, 5, 1, 1, ADC_INPUTCTRL_MUXPOS_AIN7_Val, ADC_REFCTRL_REFSEL_INTREF_Val, ADC_AVGCTRL_SAMPLENUM_4_Val, 63
|
||||
#define ADC_CONFIG_C1I 0, 10, 1, 0, ADC_INPUTCTRL_MUXPOS_AIN10_Val, ADC_REFCTRL_REFSEL_INTVCC1_Val, ADC_AVGCTRL_SAMPLENUM_4_Val, 45
|
||||
#define ADC_CONFIG_C2I 0, 11, 1, 0, ADC_INPUTCTRL_MUXPOS_AIN11_Val, ADC_REFCTRL_REFSEL_INTVCC1_Val, ADC_AVGCTRL_SAMPLENUM_4_Val, 45
|
||||
|
||||
//Conversion values dependant upon the circuitry
|
||||
#define ADC_I_MILLIAMPS_PER_COUNT -0.000980472f
|
||||
#define ADC_I_MILLIAMPS_OFFSET 1.979711769f
|
||||
#define ADC_5V_VOLTS_PER_COUNT 0.001904297f
|
||||
#define ADC_5V_VOLTS_OFFSET 0.0f
|
||||
#define ADC_5V_NOMINAL 5.0f
|
||||
#define ADC_5V_NOMINAL_COUNTS (ADC_5V_NOMINAL / ADC_5V_VOLTS_PER_COUNT)
|
||||
|
||||
//Conversion macros
|
||||
#define ADC_CI_C2I(macounts) ((float)macounts * ADC_I_MILLIAMPS_PER_COUNT + ADC_I_MILLIAMPS_OFFSET) //Converts connector current counts to milliamps
|
||||
#define ADC_CI_I2C(ma) (uint16_t)((((float)ma - ADC_I_MILLIAMPS_OFFSET) / ADC_I_MILLIAMPS_PER_COUNT)) //Converts milliamps to connector current counts
|
||||
#define ADC_5V_C2V(icounts) ((float)icounts * ADC_5V_VOLTS_PER_COUNT + ADC_5V_VOLTS_OFFSET) //Converts 5V Bus counts to volts
|
||||
#define ADC_5V_V2C(v) (uint16_t)((((float)v - ADC_5V_VOLTS_OFFSET) / ADC_5V_VOLTS_PER_COUNT)) //Converts 5V Bus volts to counts
|
||||
#define ADC_CC_5VCOR(v5counts, cc) ((float)v5counts == 0 ? 0 : (uint16_t)(ADC_5V_NOMINAL_COUNTS / (float)v5counts * (float)cc)) //Corrects CC counts to nominal 5V value
|
||||
|
||||
//Note: The extra port's onboard/external range is not reliable for onboard/external detection due to varying device implementations,
|
||||
// so instead the extra port will follow the host port connection of onboard or external. We will still use
|
||||
// a nominal value for device detection with a wider range though.
|
||||
#define ADC_USBC_ONBOARD 951 //ADC value indicating the USB-C Connector is on main PCB
|
||||
#define ADC_USBC_EXTERNAL 881 //ADC value indicating the USB-C Connector is on external PCB
|
||||
#define ADC_USBC_RANGE ((ADC_USBC_ONBOARD - ADC_USBC_EXTERNAL) / 2) //Range of detection for extra port Rd
|
||||
#define ADC_USBC_EXTRA_NOMINAL ((ADC_USBC_ONBOARD + ADC_USBC_EXTERNAL) / 2) //Nominal ADC value for detection of connected device
|
||||
#define ADC_USBC_EXTRA_TOLERANCE (0.20f) //Tolerance for Rd
|
||||
#define ADC_USBC_EXTRA_ADC_MAX ((float)ADC_USBC_EXTRA_NOMINAL + ((float)ADC_USBC_EXTRA_NOMINAL * ADC_USBC_EXTRA_TOLERANCE)) //Rd ADC max counts
|
||||
#define ADC_USBC_EXTRA_ADC_MIN ((float)ADC_USBC_EXTRA_NOMINAL - ((float)ADC_USBC_EXTRA_NOMINAL * ADC_USBC_EXTRA_TOLERANCE)) //Rd ADC min counts
|
||||
|
||||
#define USBC_IS_SINK(a5, b5) ((a5 > ADC_USBC_EXTRA_ADC_MIN && a5 < ADC_USBC_EXTRA_ADC_MAX) || \
|
||||
(b5 > ADC_USBC_EXTRA_ADC_MIN && b5 < ADC_USBC_EXTRA_ADC_MAX))
|
||||
|
||||
#define ADC_USBC_RP_DELTA_MAX 400 //Amount of noise to tolerate for Rp detection (this can be very generous as long as ranges do not overlap)
|
||||
|
||||
#define ADC_USBC_RP_TYPES 3 //56k, 22k, 10k
|
||||
#define ADC_USBC_CON_TYPES 2 //Onboard, External
|
||||
#define ADC_USBC_TYPES (ADC_USBC_RP_TYPES * ADC_USBC_CON_TYPES)
|
||||
|
||||
//These are the indices for ADC_USBC_RP_NOM
|
||||
//xxK is a ADC_USBC_RP_TYPES
|
||||
//ONB is for the onboard USB-C Connector and must have an even index number
|
||||
//EXT is for the external USB-C Connector and must have an odd index number
|
||||
#define ADC_USBC_56K_ONB 0
|
||||
#define ADC_USBC_56K_EXT 1
|
||||
#define ADC_USBC_22K_ONB 2
|
||||
#define ADC_USBC_22K_EXT 3
|
||||
#define ADC_USBC_10K_ONB 4
|
||||
#define ADC_USBC_10K_EXT 5
|
||||
|
||||
#define ADC_USBC_IS_ONB(a) (a % 2 == 0) //Given a ADC_USBC_RP_NOM index, return true if the index refers to an onboard connector
|
||||
#define ADC_USBC_IS_EXT(a) (a % 2 == 1) //Given a ADC_USBC_RP_NOM index, return true if the index refers to an external connector
|
||||
|
||||
//These values are for detecting whether or not the host is connected through the onboard USB or external USB
|
||||
//The counts are calculated from a nominal 5V bus, then scaled depending on the measured 5V bus
|
||||
//External connectors are detected through addition of a resistor to slightly drop readings while remaining within USB-C CC tolerances
|
||||
//Set a value to -1 if it is not supported
|
||||
//Source Rp 56k-Onb 56k-Ext 22k-Onb 22k-Ext 10k-Onb 10k-Ext
|
||||
#define ADC_USBC_RP_NOM 999, 852, 2232, 1940, 3955, 3528
|
||||
|
||||
extern uint16_t adc_usbc_rp_nominal[ADC_USBC_TYPES];
|
||||
|
||||
#define POWER_CHECK_INTERVAL 1 //How often to check power usage for adjustment and safety (ms)
|
||||
#define V_5V_AVGS 20 //Number of 5V readings to average for algorithms wanting stable readings rather than instantaneous
|
@@ -1,139 +0,0 @@
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
#include "rocketeer.h"
|
||||
|
||||
#include "led_matrix.h"
|
||||
#include "rgb_matrix.h"
|
||||
#include "config_led.h"
|
||||
|
||||
led_config_t g_led_config = {
|
||||
{
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 },
|
||||
{ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 },
|
||||
{ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, NO_LED, 40 },
|
||||
{ 41, NO_LED, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, NO_LED, 52 },
|
||||
{ 53, 54, 55, NO_LED, NO_LED, NO_LED, 56, NO_LED, NO_LED, NO_LED, 57, 58, 59, 60 }
|
||||
},
|
||||
{
|
||||
{ 8, 56 },
|
||||
{ 22, 56 },
|
||||
{ 35, 56 },
|
||||
{ 49, 56 },
|
||||
{ 63, 56 },
|
||||
{ 77, 56 },
|
||||
{ 91, 56 },
|
||||
{ 105, 56 },
|
||||
{ 118, 56 },
|
||||
{ 132, 56 },
|
||||
{ 146, 56 },
|
||||
{ 160, 56 },
|
||||
{ 174, 56 },
|
||||
{ 195, 56 },
|
||||
|
||||
{ 11, 44 },
|
||||
{ 28, 44 },
|
||||
{ 42, 44 },
|
||||
{ 56, 44 },
|
||||
{ 70, 44 },
|
||||
{ 84, 44 },
|
||||
{ 98, 44 },
|
||||
{ 112, 44 },
|
||||
{ 125, 44 },
|
||||
{ 139, 44 },
|
||||
{ 153, 44 },
|
||||
{ 167, 44 },
|
||||
{ 181, 44 },
|
||||
{ 198, 44 },
|
||||
|
||||
{ 13, 32 },
|
||||
{ 32, 32 },
|
||||
{ 46, 32 },
|
||||
{ 60, 32 },
|
||||
{ 73, 32 },
|
||||
{ 87, 32 },
|
||||
{ 101, 32 },
|
||||
{ 115, 32 },
|
||||
{ 129, 32 },
|
||||
{ 143, 32 },
|
||||
{ 156, 32 },
|
||||
{ 170, 32 },
|
||||
// ___
|
||||
{ 193, 32 },
|
||||
|
||||
{ 16, 19 },
|
||||
{ 39, 19 },
|
||||
{ 53, 19 },
|
||||
{ 67, 19 },
|
||||
{ 80, 19 },
|
||||
{ 94, 19 },
|
||||
{ 108, 19 },
|
||||
{ 122, 19 },
|
||||
{ 136, 19 },
|
||||
{ 150, 19 },
|
||||
{ 163, 19 },
|
||||
// ___
|
||||
{ 182, 19 },
|
||||
|
||||
{ 9, 7 },
|
||||
{ 27, 7 },
|
||||
{ 44, 7 },
|
||||
// ___
|
||||
// ___
|
||||
// ___
|
||||
{ 96, 7 },
|
||||
// ___
|
||||
// ___
|
||||
// ___
|
||||
{ 148, 7 },
|
||||
{ 165, 7 },
|
||||
{ 188, 7 },
|
||||
{ 201, 7 },
|
||||
|
||||
// Underglow
|
||||
{ 15, 49 },
|
||||
{ 35, 49 },
|
||||
{ 53, 49 },
|
||||
{ 70, 49 },
|
||||
{ 88, 49 },
|
||||
{ 106, 49 },
|
||||
{ 124, 49 },
|
||||
{ 142, 49 },
|
||||
{ 161, 49 },
|
||||
{ 179, 49 },
|
||||
{ 197, 49 },
|
||||
{ 15, 12 },
|
||||
{ 35, 12 },
|
||||
{ 53, 12 },
|
||||
{ 70, 12 },
|
||||
{ 88, 12 },
|
||||
{ 106, 12 },
|
||||
{ 124, 12 },
|
||||
{ 142, 12 },
|
||||
{ 161, 12 },
|
||||
{ 176, 12 },
|
||||
{ 194, 12 },
|
||||
{ 15, 37 },
|
||||
{ 15, 25 },
|
||||
{ 197, 37 },
|
||||
{ 197, 25 }
|
||||
},
|
||||
{
|
||||
1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
1, 1, 1, 4, 1, 1, 1, 1,
|
||||
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef USB_LED_INDICATOR_ENABLE
|
||||
void rgb_matrix_indicators_kb(void)
|
||||
{
|
||||
led_matrix_indicators();
|
||||
}
|
||||
#endif // USB_LED_INDICATOR_ENABLE
|
||||
|
||||
#endif
|
@@ -1,160 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
//Define number of IS31FL3733 drivers being used (1...16)
|
||||
#define ISSI3733_DRIVER_COUNT 2
|
||||
#define DRIVER_LED_TOTAL ISSI3733_LED_COUNT
|
||||
|
||||
//Hardware address of each driver (Refer to IS31FL3733 pdf "Table 1 Slave Address" and keyboard schematic)
|
||||
#define ISSI3773_DRIVER_ADDRESSES { 0xA0, 0xBE }
|
||||
|
||||
//LED I2C bus speed
|
||||
#define I2C_HZ 580000
|
||||
|
||||
//Count of LED bodies
|
||||
#define ISSI3733_LED_COUNT 87
|
||||
|
||||
#define LED_GCR_MAX 165 //Max GCR value (0 - 255) WARNING: Raising this value may overload the LED drivers and USB bus
|
||||
#define LED_GCR_STEP 10 //GCR increment/decrement value
|
||||
|
||||
#ifdef USE_MASSDROP_CONFIGURATOR
|
||||
#define ANIMATION_SPEED_STEP 1
|
||||
|
||||
#define BREATHE_STEP 1
|
||||
#define BREATHE_MIN_STEP 0
|
||||
#define BREATHE_MAX_STEP 255
|
||||
#endif
|
||||
|
||||
//Default Global Current Register value (Default brightness 0 - 255)
|
||||
#define ISSI3733_GCR_DEFAULT LED_GCR_MAX
|
||||
|
||||
//Automatic power rollback and recovery
|
||||
#define V5_HIGH 2494 //5V high level (After low power detect, point at which LEDs are allowed to use more power )
|
||||
#define V5_LOW 2434 //5V low level (LED power rolled back to stay above this limit)
|
||||
#define V5_CAT 2206 //5V catastrophic level (Host USB port potential to shut down)
|
||||
|
||||
//LED Mapping - More practically generated from a spreadsheet program
|
||||
//id: ID of the LED (Sync with PCB callouts)
|
||||
//x: Physical X coordinate of LED (units do not matter)
|
||||
//y: Physical Y coordinate of LED (units do not matter)
|
||||
//drv: 1-Based index of ISSI3773_DRIVER_ADDRESSES
|
||||
//cs: Matrix wiring CS col (1-16)
|
||||
//swr: Matrix wiring SW Red row (1-12)
|
||||
//swg: Matrix wiring SW Green row (1-12)
|
||||
//swb: Matrix wiring SW Blue row (1-12)
|
||||
//scan: Associated key matrix scancode (set 255 if none or 254 for LED to turn off in alternating mode)
|
||||
//Note: Origin 0,0 may be located anywhere as the software will do the final layout
|
||||
#define ISSI3733_LED_MAP { \
|
||||
{ .id = 1, .x = 0.36, .y = 3.362, .adr = { .drv = 2, .cs = 9, .swr = 2, .swg = 1, .swb = 3 }, .scan = 0 }, \
|
||||
{ .id = 2, .x = 1.11, .y = 3.362, .adr = { .drv = 2, .cs = 8, .swr = 2, .swg = 1, .swb = 3 }, .scan = 1 }, \
|
||||
{ .id = 3, .x = 1.86, .y = 3.362, .adr = { .drv = 2, .cs = 8, .swr = 5, .swg = 4, .swb = 6 }, .scan = 2 }, \
|
||||
{ .id = 4, .x = 2.61, .y = 3.362, .adr = { .drv = 2, .cs = 7, .swr = 2, .swg = 1, .swb = 3 }, .scan = 3 }, \
|
||||
{ .id = 5, .x = 3.36, .y = 3.362, .adr = { .drv = 2, .cs = 5, .swr = 2, .swg = 1, .swb = 3 }, .scan = 4 }, \
|
||||
{ .id = 6, .x = 4.11, .y = 3.362, .adr = { .drv = 2, .cs = 5, .swr = 5, .swg = 4, .swb = 6 }, .scan = 5 }, \
|
||||
{ .id = 7, .x = 4.86, .y = 3.362, .adr = { .drv = 2, .cs = 3, .swr = 2, .swg = 1, .swb = 3 }, .scan = 6 }, \
|
||||
{ .id = 8, .x = 5.61, .y = 3.362, .adr = { .drv = 1, .cs = 12, .swr = 2, .swg = 1, .swb = 3 }, .scan = 7 }, \
|
||||
{ .id = 9, .x = 6.36, .y = 3.362, .adr = { .drv = 1, .cs = 11, .swr = 2, .swg = 1, .swb = 3 }, .scan = 8 }, \
|
||||
{ .id = 10, .x = 7.11, .y = 3.362, .adr = { .drv = 1, .cs = 9, .swr = 2, .swg = 1, .swb = 3 }, .scan = 9 }, \
|
||||
{ .id = 11, .x = 7.86, .y = 3.362, .adr = { .drv = 1, .cs = 8, .swr = 2, .swg = 1, .swb = 3 }, .scan = 10 }, \
|
||||
{ .id = 12, .x = 8.61, .y = 3.362, .adr = { .drv = 1, .cs = 7, .swr = 2, .swg = 1, .swb = 3 }, .scan = 11 }, \
|
||||
{ .id = 13, .x = 9.36, .y = 3.362, .adr = { .drv = 1, .cs = 7, .swr = 5, .swg = 4, .swb = 6 }, .scan = 12 }, \
|
||||
{ .id = 14, .x = 10.485, .y = 3.362, .adr = { .drv = 1, .cs = 5, .swr = 2, .swg = 1, .swb = 3 }, .scan = 13 }, \
|
||||
{ .id = 15, .x = 0.548, .y = 2.612, .adr = { .drv = 2, .cs = 9, .swr = 8, .swg = 7, .swb = 9 }, .scan = 14 }, \
|
||||
{ .id = 16, .x = 1.485, .y = 2.612, .adr = { .drv = 2, .cs = 8, .swr = 11, .swg = 10, .swb = 12 }, .scan = 15 }, \
|
||||
{ .id = 17, .x = 2.235, .y = 2.612, .adr = { .drv = 2, .cs = 7, .swr = 8, .swg = 7, .swb = 9 }, .scan = 16 }, \
|
||||
{ .id = 18, .x = 2.985, .y = 2.612, .adr = { .drv = 2, .cs = 7, .swr = 11, .swg = 10, .swb = 12 }, .scan = 17 }, \
|
||||
{ .id = 19, .x = 3.735, .y = 2.612, .adr = { .drv = 2, .cs = 5, .swr = 11, .swg = 10, .swb = 12 }, .scan = 18 }, \
|
||||
{ .id = 20, .x = 4.485, .y = 2.612, .adr = { .drv = 2, .cs = 3, .swr = 5, .swg = 4, .swb = 6 }, .scan = 19 }, \
|
||||
{ .id = 21, .x = 5.235, .y = 2.612, .adr = { .drv = 2, .cs = 3, .swr = 11, .swg = 10, .swb = 12 }, .scan = 20 }, \
|
||||
{ .id = 22, .x = 5.985, .y = 2.612, .adr = { .drv = 1, .cs = 12, .swr = 8, .swg = 7, .swb = 9 }, .scan = 21 }, \
|
||||
{ .id = 23, .x = 6.735, .y = 2.612, .adr = { .drv = 1, .cs = 11, .swr = 8, .swg = 7, .swb = 9 }, .scan = 22 }, \
|
||||
{ .id = 24, .x = 7.485, .y = 2.612, .adr = { .drv = 1, .cs = 9, .swr = 8, .swg = 7, .swb = 9 }, .scan = 23 }, \
|
||||
{ .id = 25, .x = 8.235, .y = 2.612, .adr = { .drv = 1, .cs = 8, .swr = 8, .swg = 7, .swb = 9 }, .scan = 24 }, \
|
||||
{ .id = 26, .x = 8.985, .y = 2.612, .adr = { .drv = 1, .cs = 7, .swr = 8, .swg = 7, .swb = 9 }, .scan = 25 }, \
|
||||
{ .id = 27, .x = 9.735, .y = 2.612, .adr = { .drv = 1, .cs = 5, .swr = 11, .swg = 10, .swb = 12 }, .scan = 26 }, \
|
||||
{ .id = 28, .x = 10.673, .y = 2.612, .adr = { .drv = 1, .cs = 3, .swr = 5, .swg = 4, .swb = 6 }, .scan = 27 }, \
|
||||
{ .id = 29, .x = 0.641, .y = 1.862, .adr = { .drv = 2, .cs = 11, .swr = 11, .swg = 10, .swb = 12 }, .scan = 28 }, \
|
||||
{ .id = 30, .x = 1.673, .y = 1.862, .adr = { .drv = 2, .cs = 11, .swr = 8, .swg = 7, .swb = 9 }, .scan = 29 }, \
|
||||
{ .id = 31, .x = 2.423, .y = 1.862, .adr = { .drv = 2, .cs = 11, .swr = 2, .swg = 1, .swb = 3 }, .scan = 30 }, \
|
||||
{ .id = 32, .x = 3.173, .y = 1.862, .adr = { .drv = 2, .cs = 11, .swr = 5, .swg = 4, .swb = 6 }, .scan = 31 }, \
|
||||
{ .id = 33, .x = 3.923, .y = 1.862, .adr = { .drv = 2, .cs = 2, .swr = 5, .swg = 4, .swb = 6 }, .scan = 32 }, \
|
||||
{ .id = 34, .x = 4.673, .y = 1.862, .adr = { .drv = 2, .cs = 2, .swr = 8, .swg = 7, .swb = 9 }, .scan = 33 }, \
|
||||
{ .id = 35, .x = 5.423, .y = 1.862, .adr = { .drv = 2, .cs = 2, .swr = 11, .swg = 10, .swb = 12 }, .scan = 34 }, \
|
||||
{ .id = 36, .x = 6.173, .y = 1.862, .adr = { .drv = 1, .cs = 12, .swr = 11, .swg = 10, .swb = 12 }, .scan = 35 }, \
|
||||
{ .id = 37, .x = 6.923, .y = 1.862, .adr = { .drv = 1, .cs = 11, .swr = 11, .swg = 10, .swb = 12 }, .scan = 36 }, \
|
||||
{ .id = 38, .x = 7.673, .y = 1.862, .adr = { .drv = 1, .cs = 9, .swr = 11, .swg = 10, .swb = 12 }, .scan = 37 }, \
|
||||
{ .id = 39, .x = 8.423, .y = 1.862, .adr = { .drv = 1, .cs = 8, .swr = 11, .swg = 10, .swb = 12 }, .scan = 38 }, \
|
||||
{ .id = 40, .x = 9.173, .y = 1.862, .adr = { .drv = 1, .cs = 7, .swr = 11, .swg = 10, .swb = 12 }, .scan = 39 }, \
|
||||
{ .id = 41, .x = 10.391, .y = 1.862, .adr = { .drv = 1, .cs = 3, .swr = 2, .swg = 1, .swb = 3 }, .scan = 41 }, \
|
||||
{ .id = 42, .x = 0.829, .y = 1.112, .adr = { .drv = 2, .cs = 12, .swr = 8, .swg = 7, .swb = 9 }, .scan = 42 }, \
|
||||
{ .id = 43, .x = 2.048, .y = 1.112, .adr = { .drv = 2, .cs = 13, .swr = 11, .swg = 10, .swb = 12 }, .scan = 44 }, \
|
||||
{ .id = 44, .x = 2.798, .y = 1.112, .adr = { .drv = 2, .cs = 14, .swr = 11, .swg = 10, .swb = 12 }, .scan = 45 }, \
|
||||
{ .id = 45, .x = 3.548, .y = 1.112, .adr = { .drv = 2, .cs = 14, .swr = 8, .swg = 7, .swb = 9 }, .scan = 46 }, \
|
||||
{ .id = 46, .x = 4.298, .y = 1.112, .adr = { .drv = 2, .cs = 16, .swr = 8, .swg = 7, .swb = 9 }, .scan = 47 }, \
|
||||
{ .id = 47, .x = 5.048, .y = 1.112, .adr = { .drv = 2, .cs = 16, .swr = 11, .swg = 10, .swb = 12 }, .scan = 48 }, \
|
||||
{ .id = 48, .x = 5.798, .y = 1.112, .adr = { .drv = 1, .cs = 13, .swr = 11, .swg = 10, .swb = 12 }, .scan = 49 }, \
|
||||
{ .id = 49, .x = 6.548, .y = 1.112, .adr = { .drv = 1, .cs = 13, .swr = 8, .swg = 7, .swb = 9 }, .scan = 50 }, \
|
||||
{ .id = 50, .x = 7.298, .y = 1.112, .adr = { .drv = 1, .cs = 14, .swr = 8, .swg = 7, .swb = 9 }, .scan = 51 }, \
|
||||
{ .id = 51, .x = 8.048, .y = 1.112, .adr = { .drv = 1, .cs = 14, .swr = 11, .swg = 10, .swb = 12 }, .scan = 52 }, \
|
||||
{ .id = 52, .x = 8.798, .y = 1.112, .adr = { .drv = 1, .cs = 16, .swr = 11, .swg = 10, .swb = 12 }, .scan = 53 }, \
|
||||
{ .id = 53, .x = 10.204, .y = 1.112, .adr = { .drv = 1, .cs = 2, .swr = 11, .swg = 10, .swb = 12 }, .scan = 55 }, \
|
||||
{ .id = 54, .x = 0.454, .y = 0.362, .adr = { .drv = 2, .cs = 12, .swr = 2, .swg = 1, .swb = 3 }, .scan = 56 }, \
|
||||
{ .id = 55, .x = 1.391, .y = 0.362, .adr = { .drv = 2, .cs = 13, .swr = 2, .swg = 1, .swb = 3 }, .scan = 57 }, \
|
||||
{ .id = 56, .x = 2.329, .y = 0.362, .adr = { .drv = 2, .cs = 13, .swr = 5, .swg = 4, .swb = 6 }, .scan = 58 }, \
|
||||
{ .id = 57, .x = 5.141, .y = 0.362, .adr = { .drv = 2, .cs = 16, .swr = 2, .swg = 1, .swb = 3 }, .scan = 62 }, \
|
||||
{ .id = 58, .x = 7.954, .y = 0.362, .adr = { .drv = 1, .cs = 14, .swr = 2, .swg = 1, .swb = 3 }, .scan = 66 }, \
|
||||
{ .id = 59, .x = 8.891, .y = 0.362, .adr = { .drv = 1, .cs = 16, .swr = 2, .swg = 1, .swb = 3 }, .scan = 67 }, \
|
||||
{ .id = 60, .x = 9.829, .y = 0.362, .adr = { .drv = 1, .cs = 2, .swr = 8, .swg = 7, .swb = 9 }, .scan = 68 }, \
|
||||
{ .id = 61, .x = 10.766, .y = 0.362, .adr = { .drv = 1, .cs = 2, .swr = 2, .swg = 1, .swb = 3 }, .scan = 69 }, \
|
||||
{ .id = 62, .x = 0.74, .y = 3, .adr = { .drv = 2, .cs = 9, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 63, .x = 1.714, .y = 3, .adr = { .drv = 2, .cs = 8, .swr = 8, .swg = 7, .swb = 9 }, .scan = 254 }, \
|
||||
{ .id = 64, .x = 2.688, .y = 3, .adr = { .drv = 2, .cs = 7, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 65, .x = 3.662, .y = 3, .adr = { .drv = 2, .cs = 5, .swr = 8, .swg = 7, .swb = 9 }, .scan = 254 }, \
|
||||
{ .id = 66, .x = 4.636, .y = 3, .adr = { .drv = 2, .cs = 3, .swr = 8, .swg = 7, .swb = 9 }, .scan = 255 }, \
|
||||
{ .id = 67, .x = 5.61, .y = 3, .adr = { .drv = 1, .cs = 12, .swr = 5, .swg = 4, .swb = 6 }, .scan = 254 }, \
|
||||
{ .id = 68, .x = 6.584, .y = 3, .adr = { .drv = 1, .cs = 11, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 69, .x = 7.558, .y = 3, .adr = { .drv = 1, .cs = 9, .swr = 5, .swg = 4, .swb = 6 }, .scan = 254 }, \
|
||||
{ .id = 70, .x = 8.532, .y = 3, .adr = { .drv = 1, .cs = 8, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 71, .x = 9.506, .y = 3, .adr = { .drv = 1, .cs = 5, .swr = 8, .swg = 7, .swb = 9 }, .scan = 254 }, \
|
||||
{ .id = 72, .x = 10.48, .y = 3, .adr = { .drv = 1, .cs = 5, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 73, .x = 0.74, .y = 0.74, .adr = { .drv = 2, .cs = 12, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 74, .x = 1.714, .y = 0.74, .adr = { .drv = 2, .cs = 13, .swr = 8, .swg = 7, .swb = 9 }, .scan = 254 }, \
|
||||
{ .id = 75, .x = 2.688, .y = 0.74, .adr = { .drv = 2, .cs = 14, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 76, .x = 3.662, .y = 0.74, .adr = { .drv = 2, .cs = 14, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 77, .x = 4.636, .y = 0.74, .adr = { .drv = 2, .cs = 16, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 78, .x = 5.61, .y = 0.74, .adr = { .drv = 1, .cs = 13, .swr = 2, .swg = 1, .swb = 3 }, .scan = 254 }, \
|
||||
{ .id = 79, .x = 6.584, .y = 0.74, .adr = { .drv = 1, .cs = 13, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 80, .x = 7.558, .y = 0.74, .adr = { .drv = 1, .cs = 14, .swr = 5, .swg = 4, .swb = 6 }, .scan = 254 }, \
|
||||
{ .id = 81, .x = 8.532, .y = 0.74, .adr = { .drv = 1, .cs = 16, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 82, .x = 9.506, .y = 0.74, .adr = { .drv = 1, .cs = 16, .swr = 8, .swg = 7, .swb = 9 }, .scan = 254 }, \
|
||||
{ .id = 83, .x = 10.48, .y = 0.74, .adr = { .drv = 1, .cs = 2, .swr = 5, .swg = 4, .swb = 6 }, .scan = 255 }, \
|
||||
{ .id = 84, .x = 0.74, .y = 2.25, .adr = { .drv = 2, .cs = 9, .swr = 11, .swg = 10, .swb = 12 }, .scan = 254 }, \
|
||||
{ .id = 85, .x = 0.74, .y = 1.5, .adr = { .drv = 2, .cs = 12, .swr = 11, .swg = 10, .swb = 12 }, .scan = 254 }, \
|
||||
{ .id = 86, .x = 10.48, .y = 2.25, .adr = { .drv = 1, .cs = 3, .swr = 8, .swg = 7, .swb = 9 }, .scan = 254 }, \
|
||||
{ .id = 87, .x = 10.48, .y = 1.5, .adr = { .drv = 1, .cs = 3, .swr = 11, .swg = 10, .swb = 12 }, .scan = 254 }, \
|
||||
};
|
||||
|
||||
#define USB_LED_INDICATOR_ENABLE //Comment out to disable indicator functionality
|
||||
#ifdef USB_LED_INDICATOR_ENABLE //Scan codes refer to actual key matrix codes, not KC_* (255 to disable)
|
||||
#define USB_LED_NUM_LOCK_SCANCODE 255
|
||||
#define USB_LED_CAPS_LOCK_SCANCODE 28
|
||||
#define USB_LED_SCROLL_LOCK_SCANCODE 21
|
||||
#define USB_LED_COMPOSE_SCANCODE 255
|
||||
#define USB_LED_KANA_SCANCODE 255
|
||||
#endif //USB_LED_INDICATOR_ENABLE
|
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
|
||||
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
|
||||
|
||||
/* Data structure to define Shift Register output expander hardware */
|
||||
/* This structure gets shifted into registers LSB first */
|
||||
typedef union {
|
||||
struct {
|
||||
uint16_t RSVD4:1; /*!< bit: 0 */
|
||||
uint16_t SRC_2_B5:1; /*!< bit: 1 USBC-2 CC B5 UFP Rd 5.1k WHEN 1, DFP Rp 56k WHEN 0 */
|
||||
uint16_t SRC_1_B5:1; /*!< bit: 2 USBC-1 CC B5 UFP Rd 5.1k WHEN 1, DFP Rp 56k WHEN 0 */
|
||||
uint16_t S_B_EXT:1; /*!< bit: 3 B TO EX-1 WHEN 0, B TO USBC-1 WHEN 1 */
|
||||
uint16_t SDB_N:1; /*!< bit: 4 SHUTDOWN IS31FL3733 CHIPS WHEN 0, RUN WHEN 1 */
|
||||
uint16_t IRST:1; /*!< bit: 5 RESET IS31FL3733 I2C WHEN 1, RUN WHEN 0 */
|
||||
uint16_t SRC_2_A5:1; /*!< bit: 6 USBC-2 CC A5 UFP Rd 5.1k WHEN 1, DFP Rp 56k WHEN 0 */
|
||||
uint16_t SRC_1_A5:1; /*!< bit: 7 USBC-1 CC A5 UFP Rd 5.1k WHEN 1, DFP Rp 56k WHEN 0 */
|
||||
uint16_t E_VBUS_2:1; /*!< bit: 8 ENABLE 5V TO USBC-2/EX-2 WHEN 1, DISABLE WHEN 0 */
|
||||
uint16_t E_VBUS_1:1; /*!< bit: 9 ENABLE 5V TO USBC-1/EX-1 WHEN 1, DISABLE WHEN 0 */
|
||||
uint16_t ENB:1; /*!< bit: 10 ENABLE CHANNEL B USBC-1/EX-1 WHEN 1, DISABLE WHEN 0 */
|
||||
uint16_t S_A_EXT:1; /*!< bit: 11 A TO USBC-2 WHEN 0, A TO EX-2 WHEN 1 */
|
||||
uint16_t ENA:1; /*!< bit: 12 ENABLE CHANNEL A USBC-2/EX-2 WHEN 1, DISABLE WHEN 0 */
|
||||
uint16_t S_A_UP:1; /*!< bit: 13 DN1 TO A & UP TO B WHEN 1, DN1 TO B & UP TO A WHEN 0 */
|
||||
uint16_t HUB_RESET_N:1; /*!< bit: 14 RESET USB HUB WHEN 0, RUN WHEN 1 */
|
||||
uint16_t HUB_CONNECT:1; /*!< bit: 15 SIGNAL VBUS CONNECT TO USB HUB WHEN 1 */
|
||||
} bit; /*!< Structure used for bit access */
|
||||
uint16_t reg; /*!< Type used for register access */
|
||||
} sr_exp_t;
|
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Massdrop Inc.
|
||||
|
||||
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
|
||||
|
||||
//Macros to Enable, Disable, and Update USB 5V bus connections
|
||||
#define USBC_CFG_5V1_VAR sr_exp_data.bit.E_VBUS_1 //Variable storing USBC-1 5V Bus state
|
||||
#define USBC_CFG_5V1_ENA 1 //Value to enable USBC-1 5V Bus
|
||||
#define USBC_CFG_5V1_DIS 0 //Value to disable USBC-1 5V Bus
|
||||
#define USBC_CFG_5V1_UPDATE SR_EXP_WriteData() //Command to run to update value
|
||||
#define USBC_CFG_5V2_VAR sr_exp_data.bit.E_VBUS_2 //Variable storing USBC-2 5V Bus state
|
||||
#define USBC_CFG_5V2_ENA 1 //Value to enable USBC-1 5V Bus
|
||||
#define USBC_CFG_5V2_DIS 0 //Value to disable USBC-1 5V Bus
|
||||
#define USBC_CFG_5V2_UPDATE SR_EXP_WriteData() //Command to run to update value
|
@@ -1,286 +0,0 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
enum rocketeer_keycodes {
|
||||
L_BRI = SAFE_RANGE, //LED Brightness Increase
|
||||
L_BRD, //LED Brightness Decrease
|
||||
L_EDG_I, //LED Edge Brightness Increase
|
||||
L_EDG_D, //LED Edge Brightness Decrease
|
||||
L_EDG_M, //LED Edge lighting mode
|
||||
L_PTN, //LED Pattern Select Next
|
||||
L_PTP, //LED Pattern Select Previous
|
||||
L_PSI, //LED Pattern Speed Increase
|
||||
L_PSD, //LED Pattern Speed Decrease
|
||||
L_T_MD, //LED Toggle Mode
|
||||
L_T_ONF, //LED Toggle On / Off
|
||||
L_ON, //LED On
|
||||
L_OFF, //LED Off
|
||||
L_T_BR, //LED Toggle Breath Effect
|
||||
L_T_PTD, //LED Toggle Scrolling Pattern Direction and effect
|
||||
U_T_AGCR, //USB Toggle Automatic GCR control
|
||||
DBG_TOG, //DEBUG Toggle On / Off
|
||||
DBG_MTRX, //DEBUG Toggle Matrix Prints
|
||||
DBG_KBD, //DEBUG Toggle Keyboard Prints
|
||||
DBG_MOU, //DEBUG Toggle Mouse Prints
|
||||
DBG_FAC, //DEBUG Factory light testing (All on white)
|
||||
MD_BOOT //Restart into bootloader after hold timeout
|
||||
};
|
||||
|
||||
#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode
|
||||
|
||||
keymap_config_t keymap_config;
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT(
|
||||
KC_ESC, 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_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_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_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_RGUI, KC_RCTL \
|
||||
),
|
||||
[1] = LAYOUT(
|
||||
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, \
|
||||
L_T_BR, L_PSD, L_BRI, L_PSI, L_EDG_I, _______, KC_PSCR, KC_SLCK, KC_PAUS, _______, KC_UP, _______, _______, U_T_AGCR,\
|
||||
L_T_PTD, L_PTP, L_BRD, L_PTN, L_EDG_D, _______, KC_INS, KC_HOME, KC_PGUP, KC_LEFT, KC_DOWN, KC_RGHT, _______, \
|
||||
_______, L_T_MD, L_T_ONF, _______, L_EDG_M, MD_BOOT, TG_NKRO, KC_END, KC_PGDN, KC_VOLD, KC_VOLU, _______, \
|
||||
_______, _______, _______, DBG_FAC, KC_MUTE, _______, KC_APP, _______ \
|
||||
),
|
||||
/*
|
||||
[X] = LAYOUT(
|
||||
_______ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
),
|
||||
*/
|
||||
};
|
||||
|
||||
// Runs just one time when the keyboard initializes.
|
||||
void matrix_init_user(void) {
|
||||
};
|
||||
|
||||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
};
|
||||
|
||||
#define MODS_SHIFT (get_mods() & MOD_BIT(KC_LSHIFT) || get_mods() & MOD_BIT(KC_RSHIFT))
|
||||
#define MODS_CTRL (get_mods() & MOD_BIT(KC_LCTL) || get_mods() & MOD_BIT(KC_RCTRL))
|
||||
#define MODS_ALT (get_mods() & MOD_BIT(KC_LALT) || get_mods() & MOD_BIT(KC_RALT))
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
static uint32_t key_timer;
|
||||
static uint8_t scroll_effect = 0;
|
||||
|
||||
switch (keycode) {
|
||||
case L_BRI:
|
||||
if (record->event.pressed) {
|
||||
if (LED_GCR_STEP > LED_GCR_MAX - gcr_desired) gcr_desired = LED_GCR_MAX;
|
||||
else gcr_desired += LED_GCR_STEP;
|
||||
if (led_animation_breathing) gcr_breathe = gcr_desired;
|
||||
}
|
||||
return false;
|
||||
case L_BRD:
|
||||
if (record->event.pressed) {
|
||||
if (LED_GCR_STEP > gcr_desired) gcr_desired = 0;
|
||||
else gcr_desired -= LED_GCR_STEP;
|
||||
if (led_animation_breathing) gcr_breathe = gcr_desired;
|
||||
}
|
||||
return false;
|
||||
case L_EDG_M:
|
||||
if (record->event.pressed) {
|
||||
led_edge_mode++;
|
||||
if (led_edge_mode > LED_EDGE_MODE_MAX) {
|
||||
led_edge_mode = LED_EDGE_MODE_ALL;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case L_EDG_I:
|
||||
if (record->event.pressed) {
|
||||
led_edge_brightness += 0.1;
|
||||
if (led_edge_brightness > 1) { led_edge_brightness = 1; }
|
||||
}
|
||||
return false;
|
||||
case L_EDG_D:
|
||||
if (record->event.pressed) {
|
||||
led_edge_brightness -= 0.1;
|
||||
if (led_edge_brightness < 0) { led_edge_brightness = 0; }
|
||||
}
|
||||
return false;
|
||||
case L_PTN:
|
||||
if (record->event.pressed) {
|
||||
if (led_animation_id == led_setups_count - 1) led_animation_id = 0;
|
||||
else led_animation_id++;
|
||||
}
|
||||
return false;
|
||||
case L_PTP:
|
||||
if (record->event.pressed) {
|
||||
if (led_animation_id == 0) led_animation_id = led_setups_count - 1;
|
||||
else led_animation_id--;
|
||||
}
|
||||
return false;
|
||||
case L_PSI:
|
||||
if (record->event.pressed) {
|
||||
led_animation_speed += ANIMATION_SPEED_STEP;
|
||||
}
|
||||
return false;
|
||||
case L_PSD:
|
||||
if (record->event.pressed) {
|
||||
led_animation_speed -= ANIMATION_SPEED_STEP;
|
||||
if (led_animation_speed < 0) led_animation_speed = 0;
|
||||
}
|
||||
return false;
|
||||
case L_T_MD:
|
||||
if (record->event.pressed) {
|
||||
led_lighting_mode++;
|
||||
if (led_lighting_mode > LED_MODE_MAX_INDEX) led_lighting_mode = LED_MODE_NORMAL;
|
||||
}
|
||||
return false;
|
||||
case L_T_ONF:
|
||||
if (record->event.pressed) {
|
||||
I2C3733_Control_Set(!I2C3733_Control_Get());
|
||||
}
|
||||
return false;
|
||||
case L_ON:
|
||||
if (record->event.pressed) {
|
||||
I2C3733_Control_Set(1);
|
||||
}
|
||||
return false;
|
||||
case L_OFF:
|
||||
if (record->event.pressed) {
|
||||
I2C3733_Control_Set(0);
|
||||
}
|
||||
return false;
|
||||
case L_T_BR:
|
||||
if (record->event.pressed) {
|
||||
led_animation_breathing = !led_animation_breathing;
|
||||
if (led_animation_breathing) {
|
||||
gcr_breathe = gcr_desired;
|
||||
led_animation_breathe_cur = BREATHE_MIN_STEP;
|
||||
breathe_dir = 1;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case L_T_PTD:
|
||||
if (record->event.pressed) {
|
||||
scroll_effect++;
|
||||
if (scroll_effect == 1) { //Patterns with scroll move horizontal (Right to left)
|
||||
led_animation_direction = 1;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 0;
|
||||
} else if (scroll_effect == 2) { //Patterns with scroll move vertical (Top to bottom)
|
||||
led_animation_direction = 1;
|
||||
led_animation_orientation = 1;
|
||||
led_animation_circular = 0;
|
||||
} else if (scroll_effect == 3) { //Patterns with scroll move vertical (Bottom to top)
|
||||
led_animation_direction = 0;
|
||||
led_animation_orientation = 1;
|
||||
led_animation_circular = 0;
|
||||
} else if (scroll_effect == 4) { //Patterns with scroll explode from center
|
||||
led_animation_direction = 0;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 1;
|
||||
} else if (scroll_effect == 5) { //Patterns with scroll implode on center
|
||||
led_animation_direction = 1;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 1;
|
||||
} else { //Patterns with scroll move horizontal (Left to right)
|
||||
scroll_effect = 0;
|
||||
led_animation_direction = 0;
|
||||
led_animation_orientation = 0;
|
||||
led_animation_circular = 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case U_T_AGCR:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode");
|
||||
}
|
||||
return false;
|
||||
case DBG_FAC:
|
||||
if (record->event.pressed && MODS_SHIFT && MODS_CTRL) {
|
||||
led_lighting_mode = LED_MODE_NORMAL;
|
||||
led_edge_brightness = 1;
|
||||
led_edge_mode = LED_EDGE_MODE_ALL;
|
||||
led_animation_breathing = 0;
|
||||
led_animation_id = 7; //led_programs.c led_setups leds_white index
|
||||
gcr_desired = LED_GCR_MAX;
|
||||
I2C3733_Control_Set(1);
|
||||
}
|
||||
return false;
|
||||
case DBG_TOG:
|
||||
if (record->event.pressed) {
|
||||
TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode");
|
||||
}
|
||||
return false;
|
||||
case DBG_MTRX:
|
||||
if (record->event.pressed) {
|
||||
TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix");
|
||||
}
|
||||
return false;
|
||||
case DBG_KBD:
|
||||
if (record->event.pressed) {
|
||||
TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard");
|
||||
}
|
||||
return false;
|
||||
case DBG_MOU:
|
||||
if (record->event.pressed) {
|
||||
TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse");
|
||||
}
|
||||
return false;
|
||||
case MD_BOOT:
|
||||
if (record->event.pressed) {
|
||||
key_timer = timer_read32();
|
||||
} else {
|
||||
if (timer_elapsed32(key_timer) >= BOOTKEY_HOLD_MS) {
|
||||
reset_keyboard();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
return true; //Process all other keycodes normally
|
||||
}
|
||||
}
|
||||
|
||||
void rgb_matrix_init_user(void) {
|
||||
led_lighting_mode = LED_MODE_INDICATORS_ONLY; //Start Rocketeer with only indicator lights
|
||||
}
|
||||
|
||||
led_instruction_t led_instructions[] = {
|
||||
//LEDs are normally inactive, no processing is performed on them
|
||||
//Flags are used in matching criteria for an LED to be active and indicate how to color it
|
||||
//Flags can be found in tmk_core/protocol/arm_atsam/led_matrix.h (prefixed with LED_FLAG_)
|
||||
//LED IDs can be found in config_led.h in the keyboard's directory
|
||||
//Examples are below
|
||||
|
||||
//All LEDs use the user's selected pattern (this is the factory default)
|
||||
{ .flags = LED_FLAG_USE_ROTATE_PATTERN },
|
||||
|
||||
//Specific LEDs use the user's selected pattern while all others are off
|
||||
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_ROTATE_PATTERN, .id0 = 0xFFFFFFFF, .id1 = 0xAAAAAAAA, .id2 = 0x55555555, .id3 = 0x11111111 },
|
||||
|
||||
//Specific LEDs use specified RGB values while all others are off
|
||||
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0xFF, .id1 = 0x00FF, .id2 = 0x0000FF00, .id3 = 0xFF000000, .r = 75, .g = 150, .b = 225 },
|
||||
|
||||
//All LEDs use the user's selected pattern
|
||||
//On layer 1, all key LEDs (except the top row which keeps active pattern) are red while all edge LEDs are green
|
||||
//When layer 1 is active, key LEDs use red (id0 32 - 17: 1111 1111 1111 1111 0000 0000 0000 0000 = 0xFFFF0000) (except top row 16 - 1)
|
||||
//When layer 1 is active, key LEDs use red (id1 64 - 33: 1111 1111 1111 1111 1111 1111 1111 1111 = 0xFFFFFFFF)
|
||||
//When layer 1 is active, key LEDs use red (id2 87 - 65: 0000 0000 0111 1111 1111 1111 1111 1111 = 0x007FFFFF)
|
||||
//When layer 1 is active, edge LEDs use green (id2 95 - 88: 1111 1111 1000 0000 0000 0000 0000 0000 = 0xFF800000)
|
||||
//When layer 1 is active, edge LEDs use green (id3 119 - 96: 0000 0000 1111 1111 1111 1111 1111 1111 = 0x00FFFFFF)
|
||||
// { .flags = LED_FLAG_USE_ROTATE_PATTERN },
|
||||
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_MATCH_LAYER | LED_FLAG_USE_RGB, .id0 = 0xFFFF0000, .id1 = 0xFFFFFFFF, .id2 = 0x007FFFFF, .r = 255, .layer = 1 },
|
||||
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_MATCH_LAYER | LED_FLAG_USE_RGB, .id2 = 0xFF800000, .id3 = 0x00FFFFFF, .g = 127, .layer = 1 },
|
||||
|
||||
//All key LEDs use red while edge LEDs use the active pattern
|
||||
//All key LEDs use red (id0 32 - 1: 1111 1111 1111 1111 1111 1111 1111 1111 = 0xFFFFFFFF)
|
||||
//All key LEDs use red (id1 64 - 33: 1111 1111 1111 1111 1111 1111 1111 1111 = 0xFFFFFFFF)
|
||||
//All key LEDs use red (id2 87 - 65: 0000 0000 0111 1111 1111 1111 1111 1111 = 0x007FFFFF)
|
||||
//Edge uses active pattern (id2 95 - 88: 1111 1111 1000 0000 0000 0000 0000 0000 = 0xFF800000)
|
||||
//Edge uses active pattern (id3 119 - 96: 0000 0000 1111 1111 1111 1111 1111 1111 = 0x00FFFFFF)
|
||||
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_RGB, .id0 = 0xFFFFFFFF, .id1 = 0xFFFFFFFF, .id2 = 0x007FFFFF, .r = 255 },
|
||||
// { .flags = LED_FLAG_MATCH_ID | LED_FLAG_USE_ROTATE_PATTERN , .id2 = 0xFF800000, .id3 = 0x00FFFFFF },
|
||||
|
||||
//end must be set to 1 to indicate end of instruction set
|
||||
{ .end = 1 }
|
||||
};
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user