mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-08-06 15:23:28 +00:00
Compare commits
211 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
479139f9d4 | ||
![]() |
e0caf94323 | ||
![]() |
83b35bf6f6 | ||
![]() |
07ba06d0b6 | ||
![]() |
b6280f979c | ||
![]() |
7371209ffb | ||
![]() |
d28b2c395b | ||
![]() |
bb30ff5f71 | ||
![]() |
bc5c67b3b2 | ||
![]() |
ea02a3ea23 | ||
![]() |
29fcb64bb4 | ||
![]() |
70cc193d14 | ||
![]() |
aab5f349a2 | ||
![]() |
a7b6292010 | ||
![]() |
8e66f65c77 | ||
![]() |
23549791eb | ||
![]() |
dd3803f334 | ||
![]() |
bd0a888133 | ||
![]() |
d272111d46 | ||
![]() |
0b528d2e36 | ||
![]() |
cc6043ca29 | ||
![]() |
fffc5237a7 | ||
![]() |
992a63c0f2 | ||
![]() |
25659acb1c | ||
![]() |
07cb997b6d | ||
![]() |
ac634aa455 | ||
![]() |
6b2a3492b7 | ||
![]() |
dcd64062d2 | ||
![]() |
4148aeee19 | ||
![]() |
1f78b62cd6 | ||
![]() |
9f82d14eb9 | ||
![]() |
b710e21efb | ||
![]() |
9334986bd9 | ||
![]() |
f2824bca02 | ||
![]() |
5023f55856 | ||
![]() |
6d15f5a5b7 | ||
![]() |
ea1fd96c84 | ||
![]() |
1eea91f5f8 | ||
![]() |
9546b180b9 | ||
![]() |
2265e4ce41 | ||
![]() |
cbc5a08c40 | ||
![]() |
78f79ca6cc | ||
![]() |
f1dbf72e09 | ||
![]() |
c71b60c82a | ||
![]() |
47c6d201aa | ||
![]() |
f6438e42af | ||
![]() |
242c1da2c2 | ||
![]() |
be1876aa76 | ||
![]() |
1ef6777723 | ||
![]() |
d3b6552fb7 | ||
![]() |
ce3ea49743 | ||
![]() |
811c583636 | ||
![]() |
173d1b7571 | ||
![]() |
98f977e95c | ||
![]() |
1832b59266 | ||
![]() |
1bfe5b5723 | ||
![]() |
038c12d59a | ||
![]() |
3d23a80c83 | ||
![]() |
f56884b253 | ||
![]() |
d4e695a136 | ||
![]() |
2013f4fb83 | ||
![]() |
508cc7e56b | ||
![]() |
8958a4f78b | ||
![]() |
429971997c | ||
![]() |
e898a8ecc8 | ||
![]() |
b6e8516d6d | ||
![]() |
2077226fc2 | ||
![]() |
cfafa97227 | ||
![]() |
3d73110795 | ||
![]() |
727707ef0b | ||
![]() |
2a3af90d9f | ||
![]() |
73e5a7fafe | ||
![]() |
eceb2a4810 | ||
![]() |
b34dfeecdf | ||
![]() |
01458037de | ||
![]() |
461f95ce0b | ||
![]() |
f4bc404aa2 | ||
![]() |
b70e68ac5b | ||
![]() |
e4d849ed95 | ||
![]() |
4f193d6dc2 | ||
![]() |
934d35ea3f | ||
![]() |
a76a607a2b | ||
![]() |
9aec284f42 | ||
![]() |
3a0f7865da | ||
![]() |
b11d770bea | ||
![]() |
5a63aa29a9 | ||
![]() |
ab63ff8d2e | ||
![]() |
00e4079d5a | ||
![]() |
4d88634f07 | ||
![]() |
5ea3b1ea4d | ||
![]() |
c497a19e7b | ||
![]() |
7e07bdbde3 | ||
![]() |
60e5277a8f | ||
![]() |
96ec98b1ad | ||
![]() |
7a31ef8284 | ||
![]() |
0c2b0c7cc1 | ||
![]() |
42ea9460fe | ||
![]() |
e9daf0606f | ||
![]() |
be2c7aac31 | ||
![]() |
c5780647d8 | ||
![]() |
26fb063be3 | ||
![]() |
e81e75c147 | ||
![]() |
3e96e8a6a1 | ||
![]() |
c0f63ca9dc | ||
![]() |
f30f12ec81 | ||
![]() |
5987f67989 | ||
![]() |
cefc09ae7d | ||
![]() |
a543ad4c1d | ||
![]() |
6bdf7482b1 | ||
![]() |
415d38ba9e | ||
![]() |
9abbbe7089 | ||
![]() |
f407f3e8de | ||
![]() |
92ccc9a7b8 | ||
![]() |
f40ded7894 | ||
![]() |
fd664fe85b | ||
![]() |
fe113ebad5 | ||
![]() |
6a3c66776c | ||
![]() |
8edb67b082 | ||
![]() |
e26283e9e5 | ||
![]() |
8deb405292 | ||
![]() |
4d665a99ae | ||
![]() |
4627cab49d | ||
![]() |
e5f606558e | ||
![]() |
f379f05c1e | ||
![]() |
1524d29cfb | ||
![]() |
30efce5584 | ||
![]() |
a5b0f4de35 | ||
![]() |
20696a9efe | ||
![]() |
14c5160b1a | ||
![]() |
000e749853 | ||
![]() |
7c0610b411 | ||
![]() |
b6d74b9bb9 | ||
![]() |
5e8594db82 | ||
![]() |
6c9b69a4b6 | ||
![]() |
5412229603 | ||
![]() |
e2e0f5d6d1 | ||
![]() |
21b63d9243 | ||
![]() |
6ed8ce4f59 | ||
![]() |
087af43dee | ||
![]() |
b7d8dec7dc | ||
![]() |
7f67abd7d7 | ||
![]() |
cc468523df | ||
![]() |
387b07404a | ||
![]() |
cc6db9c540 | ||
![]() |
886af32507 | ||
![]() |
78545b9509 | ||
![]() |
5a25d50168 | ||
![]() |
5c3fd67198 | ||
![]() |
0d9e7f635e | ||
![]() |
76bd0d3e18 | ||
![]() |
b8c363099b | ||
![]() |
b85ce4ce22 | ||
![]() |
d47db637ed | ||
![]() |
d73d30aa84 | ||
![]() |
55fcac4639 | ||
![]() |
a4958a532d | ||
![]() |
df50260300 | ||
![]() |
55ed97af1e | ||
![]() |
07bf8522ca | ||
![]() |
1fdf3c84fe | ||
![]() |
65c10790d4 | ||
![]() |
42d5a324eb | ||
![]() |
32fc4da4a7 | ||
![]() |
861087096b | ||
![]() |
7bedf8f4f2 | ||
![]() |
8d190d5e25 | ||
![]() |
a2d3fc98b8 | ||
![]() |
10546665f4 | ||
![]() |
551924f8a0 | ||
![]() |
190b90892b | ||
![]() |
9d8279960d | ||
![]() |
4da3b19603 | ||
![]() |
2251560256 | ||
![]() |
f3c113fb5a | ||
![]() |
8a962f7b27 | ||
![]() |
011ee29441 | ||
![]() |
630f065376 | ||
![]() |
aca0f4dcae | ||
![]() |
1ff5fb000f | ||
![]() |
ba405cfbb4 | ||
![]() |
7ea8753b72 | ||
![]() |
9312b9db6c | ||
![]() |
707f4efd99 | ||
![]() |
e7a5fee1f3 | ||
![]() |
6221498601 | ||
![]() |
8858438a77 | ||
![]() |
fcd08b8c7d | ||
![]() |
9158673166 | ||
![]() |
b3af79eaff | ||
![]() |
41efcd6d73 | ||
![]() |
60b1880a62 | ||
![]() |
67f722c9c8 | ||
![]() |
631c09e976 | ||
![]() |
e5780a6dc6 | ||
![]() |
4087d6da0d | ||
![]() |
fc4bfbe580 | ||
![]() |
4e69a8bda6 | ||
![]() |
a62f449659 | ||
![]() |
cae7a9c3ec | ||
![]() |
1985f43bad | ||
![]() |
72c8df1f19 | ||
![]() |
1e4cc36e14 | ||
![]() |
0256cd8cca | ||
![]() |
7d79962785 | ||
![]() |
448b91689f | ||
![]() |
6e2cae4cda | ||
![]() |
03706de946 | ||
![]() |
5a3397d17e | ||
![]() |
ea3df7466a | ||
![]() |
cedfbfcb1a | ||
![]() |
03eb6a3e86 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -23,6 +23,7 @@ quantum/version.h
|
||||
CMakeLists.txt
|
||||
.DS_STORE
|
||||
/util/wsl_downloaded
|
||||
/util/win_downloaded
|
||||
|
||||
# Eclipse/PyCharm/Other IDE Settings
|
||||
.cproject
|
||||
@@ -32,7 +33,9 @@ CMakeLists.txt
|
||||
.browse.VC.db*
|
||||
*.stackdump
|
||||
util/Win_Check_Output.txt
|
||||
.vscode
|
||||
# Let these ones be user specific, since we have so many different configurations
|
||||
.vscode/launch.json
|
||||
.vscode/tasks.json
|
||||
.stfolder
|
||||
|
||||
# ignore image files
|
||||
|
14
.vscode/settings.json
vendored
Normal file
14
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
// Configure glob patterns for excluding files and folders.
|
||||
"files.exclude": {
|
||||
"**/.build": true,
|
||||
"**/*.hex": true
|
||||
},
|
||||
"files.associations": {
|
||||
"*.h": "c",
|
||||
"*.c": "c",
|
||||
"*.cpp": "cpp",
|
||||
"*.hpp": "cpp"
|
||||
}
|
||||
}
|
4
Makefile
4
Makefile
@@ -419,7 +419,7 @@ define BUILD_TEST
|
||||
MAKE_TARGET := $2
|
||||
COMMAND := $1
|
||||
MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f build_test.mk $$(MAKE_TARGET)
|
||||
MAKE_VARS := TEST=$$(TEST_NAME) FULL_TESTS=$$(FULL_TESTS)
|
||||
MAKE_VARS := TEST=$$(TEST_NAME) FULL_TESTS="$$(FULL_TESTS)"
|
||||
MAKE_MSG := $$(MSG_MAKE_TEST)
|
||||
$$(eval $$(call BUILD))
|
||||
ifneq ($$(MAKE_TARGET),clean)
|
||||
@@ -483,6 +483,8 @@ define RUN_TEST
|
||||
+error_occurred=0;\
|
||||
$($(TEST)_COMMAND)\
|
||||
if [ $$error_occurred -gt 0 ]; then $(HANDLE_ERROR); fi;
|
||||
|
||||
|
||||
endef
|
||||
|
||||
# Allow specifying just the subproject, in the keyboard directory, which will compile all keymaps
|
||||
|
@@ -18,13 +18,16 @@
|
||||
TEST_PATH=tests/$(TEST)
|
||||
|
||||
$(TEST)_SRC= \
|
||||
$(TEST_PATH)/test.cpp \
|
||||
$(TEST_PATH)/keymap.c \
|
||||
$(TMK_COMMON_SRC) \
|
||||
$(QUANTUM_SRC) \
|
||||
$(SRC) \
|
||||
tests/test_common/matrix.c \
|
||||
tests/test_common/test_driver.cpp \
|
||||
tests/test_common/keyboard_report_util.cpp \
|
||||
tests/test_common/test_fixture.cpp
|
||||
$(TEST)_DEFS=$(TMK_COMMON_DEFS)
|
||||
$(TEST)_SRC += $(patsubst $(ROOTDIR)/%,%,$(wildcard $(TEST_PATH)/*.cpp))
|
||||
|
||||
$(TEST)_DEFS=$(TMK_COMMON_DEFS) $(OPT_DEFS)
|
||||
$(TEST)_CONFIG=$(TEST_PATH)/config.h
|
||||
VPATH+=$(TOP_DIR)/tests/test_common
|
||||
VPATH+=$(TOP_DIR)/tests/test_common
|
@@ -9,6 +9,9 @@ LIB_PATH = $(TOP_DIR)/lib
|
||||
QUANTUM_DIR = quantum
|
||||
QUANTUM_PATH = $(TOP_DIR)/$(QUANTUM_DIR)
|
||||
|
||||
DRIVER_DIR = drivers
|
||||
DRIVER_PATH = $(TOP_DIR)/$(DRIVER_DIR)
|
||||
|
||||
BUILD_DIR := $(TOP_DIR)/.build
|
||||
|
||||
COMMON_VPATH := $(TOP_DIR)
|
||||
@@ -17,4 +20,5 @@ COMMON_VPATH += $(QUANTUM_PATH)
|
||||
COMMON_VPATH += $(QUANTUM_PATH)/keymap_extras
|
||||
COMMON_VPATH += $(QUANTUM_PATH)/audio
|
||||
COMMON_VPATH += $(QUANTUM_PATH)/process_keycode
|
||||
COMMON_VPATH += $(QUANTUM_PATH)/api
|
||||
COMMON_VPATH += $(QUANTUM_PATH)/api
|
||||
COMMON_VPATH += $(DRIVER_PATH)
|
@@ -54,6 +54,12 @@ ifeq ($(strip $(COMBO_ENABLE)), yes)
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(STENO_ENABLE)), yes)
|
||||
OPT_DEFS += -DSTENO_ENABLE
|
||||
VIRTSER_ENABLE := yes
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_steno.c
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(VIRTSER_ENABLE)), yes)
|
||||
OPT_DEFS += -DVIRTSER_ENABLE
|
||||
endif
|
||||
@@ -87,7 +93,7 @@ endif
|
||||
|
||||
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
|
||||
OPT_DEFS += -DRGBLIGHT_ENABLE
|
||||
SRC += $(QUANTUM_DIR)/light_ws2812.c
|
||||
SRC += ws2812.c
|
||||
SRC += $(QUANTUM_DIR)/rgblight.c
|
||||
CIE1931_CURVE = yes
|
||||
LED_BREATHING_TABLE = yes
|
||||
|
@@ -1,4 +1,4 @@
|
||||
* [Getting started](README.md)
|
||||
* [Getting started](README.md)
|
||||
* [QMK Overview](qmk_overview.md)
|
||||
* [Build Environment Setup](build_environment_setup.md)
|
||||
* [Vagrant Guide](vagrant_guide.md)
|
||||
@@ -7,7 +7,7 @@
|
||||
* [FAQ: Compiling QMK](faq_build.md)
|
||||
* [How to Github](how_to_github.md)
|
||||
|
||||
* [Features](features/README.md)
|
||||
* [Features](features.md)
|
||||
* [Layer switching](key_functions.md)
|
||||
* [Leader Key](leader_key.md)
|
||||
* [Macros](macros.md)
|
||||
@@ -16,6 +16,7 @@
|
||||
* [Tap Dance](tap_dance.md)
|
||||
* [Mouse keys](mouse_keys.md)
|
||||
* [Unicode](unicode.md)
|
||||
* [Stenography](stenography.md)
|
||||
|
||||
* Reference
|
||||
* [Glossary](glossary.md)
|
||||
@@ -27,7 +28,7 @@
|
||||
* [Customizing Functionality](custom_quantum_functions.md)
|
||||
* [Documentation Best Practices](documentation_best_practices.md)
|
||||
* [Unit Testing](unit_testing.md)
|
||||
|
||||
|
||||
* For Makers and Modders
|
||||
* [Adding a keyboard to QMK](adding_a_keyboard_to_qmk.md)
|
||||
* [Adding features to QMK](adding_features_to_qmk.md)
|
||||
@@ -39,7 +40,7 @@
|
||||
* For a Deeper Understanding
|
||||
* [How Keyboards Work](basic_how_keyboards_work.md)
|
||||
* [Understanding QMK](understanding_qmk.md)
|
||||
|
||||
|
||||
* Other Topics
|
||||
* [General FAQ](faq.md)
|
||||
* [Using Eclipse with QMK](eclipse.md)
|
||||
|
@@ -36,7 +36,7 @@ enum my_keycodes {
|
||||
|
||||
## Programming The Behavior Of Any Keycode
|
||||
|
||||
When you want to override the behavior of an existing key, or define the behavior for a new key, you should use the `process_record_kb()' and `process_record_user()` functions. These are called by QMK during key processing before the actual key event is handled. If these functions return `true` QMK will process the keycodes as usual. That can be handy for extending the functionality of a key rather than replacing it. If these functions return `false` QMK will skip the normal key handling, and it will be up you to send any key up or down events that are required.
|
||||
When you want to override the behavior of an existing key, or define the behavior for a new key, you should use the `process_record_kb()` and `process_record_user()` functions. These are called by QMK during key processing before the actual key event is handled. If these functions return `true` QMK will process the keycodes as usual. That can be handy for extending the functionality of a key rather than replacing it. If these functions return `false` QMK will skip the normal key handling, and it will be up you to send any key up or down events that are required.
|
||||
|
||||
These function are called every time a key is pressed or released.
|
||||
|
||||
|
@@ -102,4 +102,4 @@ case MACRO_RAISED:
|
||||
update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST);
|
||||
}
|
||||
break;
|
||||
```
|
||||
```
|
@@ -1,52 +1,52 @@
|
||||
|
||||
## Audio output from a speaker
|
||||
|
||||
Your keyboard can make sounds! If you've got a Planck, Preonic, or basically any keyboard that allows access to the C6 or B5 port (`#define C6_AUDIO` and `#define B5_AUDIO`), you can hook up a simple speaker and make it beep. You can use those beeps to indicate layer transitions, modifiers, special keys, or just to play some funky 8bit tunes.
|
||||
Your keyboard can make sounds! If you've got a Planck, Preonic, or basically any AVR keyboard that allows access to the C6 or B5 port (`#define C6_AUDIO` and/or `#define B5_AUDIO`), you can hook up a simple speaker and make it beep. You can use those beeps to indicate layer transitions, modifiers, special keys, or just to play some funky 8bit tunes.
|
||||
|
||||
The audio code lives in [quantum/audio/audio.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/audio/audio.h) and in the other files in the audio directory. It's enabled by default on the Planck [stock keymap](https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/default/keymap.c). Here are the important bits:
|
||||
If you add `AUDIO_ENABLE = yes` to your `rules.mk`, there's a couple different sounds that will automatically be enabled without any other configuration:
|
||||
|
||||
```
|
||||
#include "audio.h"
|
||||
STARTUP_SONG // plays when the keyboard starts up (audio.c)
|
||||
GOODBYE_SONG // plays when you press the RESET key (quantum.c)
|
||||
AG_NORM_SONG // plays when you press AG_NORM (quantum.c)
|
||||
AG_SWAP_SONG // plays when you press AG_SWAP (quantum.c)
|
||||
MUSIC_ON_SONG // plays when music mode is activated (process_music.c)
|
||||
MUSIC_OFF_SONG // plays when music mode is deactivated (process_music.c)
|
||||
CHROMATIC_SONG // plays when the chromatic music mode is selected (process_music.c)
|
||||
GUITAR_SONG // plays when the guitar music mode is selected (process_music.c)
|
||||
VIOLIN_SONG // plays when the violin music mode is selected (process_music.c)
|
||||
MAJOR_SONG // plays when the major music mode is selected (process_music.c)
|
||||
```
|
||||
|
||||
Then, lower down the file:
|
||||
You can override the default songs by doing something like this in your `config.h`:
|
||||
|
||||
```
|
||||
float tone_startup[][2] = {
|
||||
ED_NOTE(_E7 ),
|
||||
E__NOTE(_CS7),
|
||||
E__NOTE(_E6 ),
|
||||
E__NOTE(_A6 ),
|
||||
M__NOTE(_CS7, 20)
|
||||
};
|
||||
```c
|
||||
#ifdef AUDIO_ENABLE
|
||||
#define STARTUP_SONG SONG(STARTUP_SOUND)
|
||||
#endif
|
||||
```
|
||||
|
||||
This is how you write a song. Each of these lines is a note, so we have a little ditty composed of five notes here.
|
||||
A full list of sounds can be found in [quantum/audio/song_list.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/audio/song_list.h) - feel free to add your own to this list! All available notes can be seen in [quantum/audio/musical_notes.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/audio/musical_notes.h).
|
||||
|
||||
Then, we have this chunk:
|
||||
To play a custom sound at a particular time, you can define a song like this (near the top of the file):
|
||||
|
||||
```
|
||||
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
|
||||
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
|
||||
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
|
||||
float tone_plover[][2] = SONG(PLOVER_SOUND);
|
||||
float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
|
||||
|
||||
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
|
||||
float goodbye[][2] = SONG(GOODBYE_SOUND);
|
||||
```c
|
||||
float my_song[][2] = SONG(QWERTY_SOUND);
|
||||
```
|
||||
|
||||
Wherein we bind predefined songs (from [quantum/audio/song_list.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/audio/song_list.h)) into named variables. This is one optimization that helps save on memory: These songs only take up memory when you reference them in your keymap, because they're essentially all preprocessor directives.
|
||||
And then play your song like this:
|
||||
|
||||
So now you have something called `tone_plover` for example. How do you make it play the Plover tune, then? If you look further down the keymap, you'll see this:
|
||||
|
||||
```
|
||||
PLAY_NOTE_ARRAY(tone_plover, false, 0); // Signature is: Song name, repeat, rest style
|
||||
```c
|
||||
PLAY_SONG(my_song);
|
||||
```
|
||||
|
||||
This is inside one of the macros. So when that macro executes, your keyboard plays that particular chime.
|
||||
Alternatively, you can play it in a loop like this:
|
||||
|
||||
"Rest style" in the method signature above (the last parameter) specifies if there's a rest (a moment of silence) between the notes.
|
||||
```c
|
||||
PLAY_LOOP(my_song);
|
||||
```
|
||||
|
||||
It's advised that you wrap all audio features in `#ifdef AUDIO_ENABLE` / `#endif` to avoid causing problems when audio isn't built into the keyboard.
|
||||
|
||||
## Music mode
|
||||
|
||||
@@ -59,6 +59,11 @@ Keycodes available:
|
||||
* `MU_ON` - Turn music mode on
|
||||
* `MU_OFF` - Turn music mode off
|
||||
* `MU_TOG` - Toggle music mode
|
||||
* `MU_MOD` - Cycle through the music modes:
|
||||
* `CHROMATIC_MODE` - Chromatic scale, row changes the octave
|
||||
* `GUITAR_MODE` - Chromatic scale, but the row changes the string (+5 st)
|
||||
* `VIOLIN_MODE` - Chromatic scale, but the row changes the string (+7 st)
|
||||
* `MAJOR_MODE` - Major scale
|
||||
|
||||
In music mode, the following keycodes work differently, and don't pass through:
|
||||
|
||||
@@ -68,6 +73,16 @@ In music mode, the following keycodes work differently, and don't pass through:
|
||||
* `KC_UP` - speed-up playback
|
||||
* `KC_DOWN` - slow-down playback
|
||||
|
||||
By default, `MUSIC_MASK` is set to `keycode < 0xFF` which means keycodes less than `0xFF` are turned into notes, and don't output anything. You can change this by defining this in your `config.h` like this:
|
||||
|
||||
#define MUSIC_MASK keycode != KC_NO
|
||||
|
||||
Which will capture all keycodes - be careful, this will get you stuck in music mode until you restart your keyboard!
|
||||
|
||||
The pitch standard (`PITCH_STANDARD_A`) is 440.0f by default - to change this, add something like this to your `config.h`:
|
||||
|
||||
#define PITCH_STANDARD_A 432.0f
|
||||
|
||||
## MIDI functionalty
|
||||
|
||||
This is still a WIP, but check out `quantum/keymap_midi.c` to see what's happening. Enable from the Makefile.
|
||||
|
@@ -20,7 +20,7 @@ For the `DIODE_DIRECTION`, most hand-wiring guides will instruct you to wire the
|
||||
|
||||
`BACKLIGHT_LEVELS` is how many levels exist for your backlight - max is 15, and they are computed automatically from this number.
|
||||
|
||||
## `/keyboards/<keyboard>/Makefile`
|
||||
## `/keyboards/<keyboard>/rules.mk`
|
||||
|
||||
The values at the top likely won't need to be changed, since most boards use the `atmega32u4` chip. The `BOOTLOADER_SIZE` will need to be adjusted based on your MCU type. It's defaulted to the Teensy, since that's the most common controller. Below is quoted from the `Makefile`.
|
||||
|
||||
|
@@ -44,6 +44,8 @@ Shortcuts for bootmagic options (these work even when bootmagic is off.)
|
||||
|`MAGIC_UNSWAP_ALT_GUI`/`AG_NORM`|Disable the Alt/GUI switching|
|
||||
|`MAGIC_TOGGLE_NKRO`|Turn NKRO on or off|
|
||||
|
||||
<!-- FIXME: this formatting needs work
|
||||
|
||||
## Audio
|
||||
|
||||
```c
|
||||
@@ -157,6 +159,8 @@ MI_MODSD, // decrease modulation speed
|
||||
MI_MODSU, // increase modulation speed
|
||||
#endif // MIDI_ADVANCED
|
||||
|
||||
-->
|
||||
|
||||
## Backlight
|
||||
|
||||
These keycodes control the backlight. Most keyboards use this for single color in-switch lighting.
|
||||
|
108
docs/stenography.md
Normal file
108
docs/stenography.md
Normal file
@@ -0,0 +1,108 @@
|
||||
# Stenography in QMK
|
||||
|
||||
[Stenography](https://en.wikipedia.org/wiki/Stenotype) is a method of writing most often used by court reports, closed-captioning, and real-time transcription for the deaf. In stenography words are chorded syllable by syllable with a mixture of spelling, phonetic, and shortcut (briefs) strokes. Professional stenographers can reach 200-300 WPM without any of the strain usually found in standard typing and with far fewer errors (>99.9% accuracy).
|
||||
|
||||
The [Open Steno Project](http://www.openstenoproject.org/) has built an open-source program called Plover that provides real-time translation of steno strokes into words and commands. It has an established dictionary and supports
|
||||
|
||||
## Plover with QWERTY Keyboard
|
||||
|
||||
Plover can work with any standard QWERTY keyboard, although it is more efficient if the keyboard supports NKRO (n-key rollover) to allow Plover to see all the pressed keys at once. An example keymap for Plover can be found in `planck/keymaps/default`. Switching to the `PLOVER` layer adjusts the position of the keyboard to support the number bar.
|
||||
|
||||
To use Plover with QMK just enable NKRO and optionally adjust your layout if you have anything other than a standard layout. You may also want to purchase some steno-friendly keycaps to make it easier to hit multiple keys.
|
||||
|
||||
## Plover with Steno Protocol
|
||||
|
||||
Plover also understands the language of several steno machines. QMK can speak a couple of these languages, TX Bolt and GeminiRP. An example layout can be found in `planck/keymaps/steno`.
|
||||
|
||||
When QMK speaks to Plover over a steno protocol Plover will not use the keyboard as input. This means that you can switch back and forth between a standard keyboard and your steno keyboard, or even switch layers from Plover to standard and back without needing to activate/deactive Plover.
|
||||
|
||||
In this mode Plover expects to speak with a steno machine over a serial port so QMK will present itself to the operating system as a virtual serial port in addition to a keyboard. By default QMK will speak the TX Bolt protocol but can be switched to GeminiRP; the last protocol used is stored in non-volatile memory so QMK will use the same protocol on restart.
|
||||
|
||||
> Note: Due to hardware limitations you may not be able to run both a virtual serial port and mouse emulation at the same time.
|
||||
|
||||
### TX Bolt
|
||||
|
||||
TX Bolt communicates the status of 24 keys over a very simple protocol in variable-sized (1-5 byte) packets.
|
||||
|
||||
### GeminiRP
|
||||
|
||||
GeminiRP encodes 42 keys into a 6-byte packet. While TX Bolt contains everything that is necessary for standard stenography, GeminiRP opens up many more options, including supporting non-English theories.
|
||||
|
||||
## Configuring QMK for Steno
|
||||
|
||||
Firstly, enable steno in your keymap's Makefile. You should also diable mousekeys to prevent conflicts.
|
||||
|
||||
```Makefile
|
||||
STENO_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = no
|
||||
```
|
||||
|
||||
In your keymap create a new layer for Plover. You will need to include `keymap_steno.h`. See `planck/keymaps/steno/keymap.c` for an example. Remember to create a key to switch to the layer as well as a key for exiting the layer. If you would like to switch modes on the fly you can use the keycodes `QK_STENO_BOLT` and `QK_STENO_GEMINI`. If you only want to use one of the protocols you may set it up in your initialization function:
|
||||
|
||||
```C
|
||||
void matrix_init_user() {
|
||||
steno_set_mode(STENO_MODE_GEMINI); // or STENO_MODE_BOLT
|
||||
}
|
||||
```
|
||||
|
||||
Once you have your keyboard flashed launch Plover. Click the 'Configure...' button. In the 'Machine' tab select the Stenotype Machine that corresponds to your desired protocol. Click the 'Configure...' button on this tab and enter the serial port or click 'Scan'. Baud rate is fine at 9600 (although you should be able to set as high as 115200 with no issues). Use the default settings for everything else (Data Bits: 8, Stop Bits: 1, Parity: N, no flow control).
|
||||
|
||||
On the display tab click 'Open stroke display'. With Plover disabled you should be able to hit keys on your keyboard and see them show up in the stroke display window. Use this to make sure you have set up your keymap correctly. You are now ready to steno!
|
||||
|
||||
## Learning Stenography
|
||||
|
||||
* [Learn Plover!](https://sites.google.com/site/ploverdoc/)
|
||||
* [QWERTY Steno](http://qwertysteno.com/Home/)
|
||||
* [Steno Jig](https://joshuagrams.github.io/steno-jig/)
|
||||
* More resources at the Plover [Learning Stenography](https://github.com/openstenoproject/plover/wiki/Learning-Stenography) wiki
|
||||
|
||||
## Keycode Reference
|
||||
|
||||
As defined in `keymap_steno.h`.
|
||||
|
||||
> Note: TX Bolt does not support the full set of keys. The TX Bolt implementation in QMK will map the GeminiRP keys to the nearest TX Bolt key so that one key map will work for both.
|
||||
|
||||
|GeminiRP|TX Bolt|Steno Key|
|
||||
|--------|-------|-----------|
|
||||
|`STN_N1`|`STN_NUM`|Number bar #1|
|
||||
|`STN_N2`|`STN_NUM`|Number bar #2|
|
||||
|`STN_N3`|`STN_NUM`|Number bar #3|
|
||||
|`STN_N4`|`STN_NUM`|Number bar #4|
|
||||
|`STN_N5`|`STN_NUM`|Number bar #5|
|
||||
|`STN_N6`|`STN_NUM`|Number bar #6|
|
||||
|`STN_N7`|`STN_NUM`|Number bar #7|
|
||||
|`STN_N8`|`STN_NUM`|Number bar #8|
|
||||
|`STN_N9`|`STN_NUM`|Number bar #9|
|
||||
|`STN_NA`|`STN_NUM`|Number bar #A|
|
||||
|`STN_NB`|`STN_NUM`|Number bar #B|
|
||||
|`STN_NC`|`STN_NUM`|Number bar #C|
|
||||
|`STN_S1`|`STN_SL`| `S-` upper|
|
||||
|`STN_S2`|`STN_SL`| `S-` lower|
|
||||
|`STN_TL`|`STN_TL`| `T-`|
|
||||
|`STN_KL`|`STN_KL`| `K-`|
|
||||
|`STN_PL`|`STN_PL`| `P-`|
|
||||
|`STN_WL`|`STN_WL`| `W-`|
|
||||
|`STN_HL`|`STN_HL`| `H-`|
|
||||
|`STN_RL`|`STN_RL`| `R-`|
|
||||
|`STN_A`|`STN_A`| `A` vowel|
|
||||
|`STN_O`|`STN_O`| `O` vowel|
|
||||
|`STN_ST1`|`STN_STR`| `*` upper-left |
|
||||
|`STN_ST2`|`STN_STR`| `*` lower-left|
|
||||
|`STN_ST3`|`STN_STR`| `*` upper-right|
|
||||
|`STN_ST4`|`STN_STR`| `*` lower-right|
|
||||
|`STN_E`|`STN_E`| `E` vowel|
|
||||
|`STN_U`|`STN_U`| `U` vowel|
|
||||
|`STN_FR`|`STN_FR`| `-F`|
|
||||
|`STN_PR`|`STN_PR`| `-P`|
|
||||
|`STN_RR`|`STN_RR`| `-R`|
|
||||
|`STN_BR`|`STN_BR`| `-B`|
|
||||
|`STN_LR`|`STN_LR`| `-L`|
|
||||
|`STN_GR`|`STN_GR`| `-G`|
|
||||
|`STN_TR`|`STN_TR`| `-T`|
|
||||
|`STN_SR`|`STN_SR`| `-S`|
|
||||
|`STN_DR`|`STN_DR`| `-D`|
|
||||
|`STN_ZR`|`STN_ZR`| `-Z`|
|
||||
|`STN_FN`|| (GeminiRP only)|
|
||||
|`STN_RES1`||(GeminiRP only)|
|
||||
|`STN_RES2`||(GeminiRP only)|
|
||||
|`STN_PWR`||(GeminiRP only)|
|
@@ -1,12 +1,10 @@
|
||||
#ifdef SSD1306OLED
|
||||
|
||||
#include "ssd1306.h"
|
||||
#include "config.h"
|
||||
#include "i2c.h"
|
||||
#include <string.h>
|
||||
#include "print.h"
|
||||
#include "lets_split.h"
|
||||
#include "common/glcdfont.c"
|
||||
#include "glcdfont.c"
|
||||
#ifdef ADAFRUIT_BLE_ENABLE
|
||||
#include "adafruit_ble.h"
|
||||
#endif
|
||||
@@ -14,18 +12,7 @@
|
||||
#include "lufa.h"
|
||||
#endif
|
||||
#include "sendchar.h"
|
||||
#include "pincontrol.h"
|
||||
|
||||
//assign the right code to your layers
|
||||
#define _BASE 0
|
||||
#define _LOWER 8
|
||||
#define _RAISE 16
|
||||
#define _FNLAYER 64
|
||||
#define _NUMLAY 128
|
||||
#define _NLOWER 136
|
||||
#define _NFNLAYER 192
|
||||
#define _MOUSECURSOR 256
|
||||
#define _ADJUST 65560
|
||||
#include "timer.h"
|
||||
|
||||
// Set this to 1 to help diagnose early startup problems
|
||||
// when testing power-on with ble. Turn it off otherwise,
|
||||
@@ -33,26 +20,6 @@
|
||||
// with the matrix scan, causing keys to drop.
|
||||
#define DEBUG_TO_SCREEN 0
|
||||
|
||||
// Controls the SSD1306 128x32 OLED display via i2c
|
||||
|
||||
#define i2cAddress 0x3C
|
||||
|
||||
#define DisplayHeight 32
|
||||
#define DisplayWidth 128
|
||||
|
||||
#define FontHeight 8
|
||||
#define FontWidth 6
|
||||
|
||||
#define MatrixRows (DisplayHeight / FontHeight)
|
||||
#define MatrixCols (DisplayWidth / FontWidth)
|
||||
|
||||
struct CharacterMatrix {
|
||||
uint8_t display[MatrixRows][MatrixCols];
|
||||
uint8_t *cursor;
|
||||
bool dirty;
|
||||
};
|
||||
|
||||
static struct CharacterMatrix display;
|
||||
//static uint16_t last_battery_update;
|
||||
//static uint32_t vbat;
|
||||
//#define BatteryUpdateInterval 10000 /* milliseconds */
|
||||
@@ -62,54 +29,13 @@ static uint8_t displaying;
|
||||
#endif
|
||||
static uint16_t last_flush;
|
||||
|
||||
enum ssd1306_cmds {
|
||||
DisplayOff = 0xAE,
|
||||
DisplayOn = 0xAF,
|
||||
|
||||
SetContrast = 0x81,
|
||||
DisplayAllOnResume = 0xA4,
|
||||
|
||||
DisplayAllOn = 0xA5,
|
||||
NormalDisplay = 0xA6,
|
||||
InvertDisplay = 0xA7,
|
||||
SetDisplayOffset = 0xD3,
|
||||
SetComPins = 0xda,
|
||||
SetVComDetect = 0xdb,
|
||||
SetDisplayClockDiv = 0xD5,
|
||||
SetPreCharge = 0xd9,
|
||||
SetMultiPlex = 0xa8,
|
||||
SetLowColumn = 0x00,
|
||||
SetHighColumn = 0x10,
|
||||
SetStartLine = 0x40,
|
||||
|
||||
SetMemoryMode = 0x20,
|
||||
ColumnAddr = 0x21,
|
||||
PageAddr = 0x22,
|
||||
|
||||
ComScanInc = 0xc0,
|
||||
ComScanDec = 0xc8,
|
||||
SegRemap = 0xa0,
|
||||
SetChargePump = 0x8d,
|
||||
ExternalVcc = 0x01,
|
||||
SwitchCapVcc = 0x02,
|
||||
|
||||
ActivateScroll = 0x2f,
|
||||
DeActivateScroll = 0x2e,
|
||||
SetVerticalScrollArea = 0xa3,
|
||||
RightHorizontalScroll = 0x26,
|
||||
LeftHorizontalScroll = 0x27,
|
||||
VerticalAndRightHorizontalScroll = 0x29,
|
||||
VerticalAndLeftHorizontalScroll = 0x2a,
|
||||
};
|
||||
|
||||
|
||||
// Write command sequence.
|
||||
// Returns true on success.
|
||||
static inline bool _send_cmd1(uint8_t cmd) {
|
||||
bool res = false;
|
||||
|
||||
if (i2c_start_write(i2cAddress)) {
|
||||
xprintf("failed to start write to %d\n", i2cAddress);
|
||||
if (i2c_start_write(SSD1306_ADDRESS)) {
|
||||
xprintf("failed to start write to %d\n", SSD1306_ADDRESS);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -154,8 +80,6 @@ static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) {
|
||||
#define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;}
|
||||
#define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;}
|
||||
|
||||
static void matrix_clear(struct CharacterMatrix *matrix);
|
||||
|
||||
static void clear_display(void) {
|
||||
matrix_clear(&display);
|
||||
|
||||
@@ -164,7 +88,7 @@ static void clear_display(void) {
|
||||
send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1);
|
||||
send_cmd3(ColumnAddr, 0, DisplayWidth - 1);
|
||||
|
||||
if (i2c_start_write(i2cAddress)) {
|
||||
if (i2c_start_write(SSD1306_ADDRESS)) {
|
||||
goto done;
|
||||
}
|
||||
if (i2c_master_write(0x40)) {
|
||||
@@ -210,14 +134,17 @@ bool iota_gfx_init(void) {
|
||||
send_cmd2(SetChargePump, 0x14 /* Enable */);
|
||||
send_cmd2(SetMemoryMode, 0 /* horizontal addressing */);
|
||||
|
||||
/// Flips the display orientation 0 degrees
|
||||
send_cmd1(SegRemap | 0x1);
|
||||
send_cmd1(ComScanDec);
|
||||
/*
|
||||
#ifdef OLED_ROTATE180
|
||||
// the following Flip the display orientation 180 degrees
|
||||
send_cmd1(SegRemap);
|
||||
send_cmd1(ComScanInc);
|
||||
// end flip */
|
||||
#endif
|
||||
#ifndef OLED_ROTATE180
|
||||
// Flips the display orientation 0 degrees
|
||||
send_cmd1(SegRemap | 0x1);
|
||||
send_cmd1(ComScanDec);
|
||||
#endif
|
||||
|
||||
send_cmd2(SetComPins, 0x2);
|
||||
send_cmd2(SetContrast, 0x8f);
|
||||
send_cmd2(SetPreCharge, 0xf1);
|
||||
@@ -263,7 +190,7 @@ done:
|
||||
return success;
|
||||
}
|
||||
|
||||
static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) {
|
||||
void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) {
|
||||
*matrix->cursor = c;
|
||||
++matrix->cursor;
|
||||
|
||||
@@ -276,7 +203,7 @@ static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) {
|
||||
}
|
||||
}
|
||||
|
||||
static void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) {
|
||||
void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) {
|
||||
matrix->dirty = true;
|
||||
|
||||
if (c == '\n') {
|
||||
@@ -297,7 +224,7 @@ void iota_gfx_write_char(uint8_t c) {
|
||||
matrix_write_char(&display, c);
|
||||
}
|
||||
|
||||
static void matrix_write(struct CharacterMatrix *matrix, const char *data) {
|
||||
void matrix_write(struct CharacterMatrix *matrix, const char *data) {
|
||||
const char *end = data + strlen(data);
|
||||
while (data < end) {
|
||||
matrix_write_char(matrix, *data);
|
||||
@@ -309,7 +236,7 @@ void iota_gfx_write(const char *data) {
|
||||
matrix_write(&display, data);
|
||||
}
|
||||
|
||||
static void matrix_write_P(struct CharacterMatrix *matrix, const char *data) {
|
||||
void matrix_write_P(struct CharacterMatrix *matrix, const char *data) {
|
||||
while (true) {
|
||||
uint8_t c = pgm_read_byte(data);
|
||||
if (c == 0) {
|
||||
@@ -324,7 +251,7 @@ void iota_gfx_write_P(const char *data) {
|
||||
matrix_write_P(&display, data);
|
||||
}
|
||||
|
||||
static void matrix_clear(struct CharacterMatrix *matrix) {
|
||||
void matrix_clear(struct CharacterMatrix *matrix) {
|
||||
memset(matrix->display, ' ', sizeof(matrix->display));
|
||||
matrix->cursor = &matrix->display[0][0];
|
||||
matrix->dirty = true;
|
||||
@@ -334,7 +261,7 @@ void iota_gfx_clear_screen(void) {
|
||||
matrix_clear(&display);
|
||||
}
|
||||
|
||||
static void matrix_render(struct CharacterMatrix *matrix) {
|
||||
void matrix_render(struct CharacterMatrix *matrix) {
|
||||
last_flush = timer_read();
|
||||
iota_gfx_on();
|
||||
#if DEBUG_TO_SCREEN
|
||||
@@ -345,7 +272,7 @@ static void matrix_render(struct CharacterMatrix *matrix) {
|
||||
send_cmd3(PageAddr, 0, MatrixRows - 1);
|
||||
send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1);
|
||||
|
||||
if (i2c_start_write(i2cAddress)) {
|
||||
if (i2c_start_write(SSD1306_ADDRESS)) {
|
||||
goto done;
|
||||
}
|
||||
if (i2c_master_write(0x40)) {
|
||||
@@ -380,84 +307,12 @@ void iota_gfx_flush(void) {
|
||||
matrix_render(&display);
|
||||
}
|
||||
|
||||
static void matrix_update(struct CharacterMatrix *dest,
|
||||
const struct CharacterMatrix *source) {
|
||||
if (memcmp(dest->display, source->display, sizeof(dest->display))) {
|
||||
memcpy(dest->display, source->display, sizeof(dest->display));
|
||||
dest->dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void render_status_info(void) {
|
||||
#if DEBUG_TO_SCREEN
|
||||
if (debug_enable) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct CharacterMatrix matrix;
|
||||
|
||||
matrix_clear(&matrix);
|
||||
matrix_write_P(&matrix, PSTR("USB: "));
|
||||
#ifdef PROTOCOL_LUFA
|
||||
switch (USB_DeviceState) {
|
||||
case DEVICE_STATE_Unattached:
|
||||
matrix_write_P(&matrix, PSTR("Unattached"));
|
||||
break;
|
||||
case DEVICE_STATE_Suspended:
|
||||
matrix_write_P(&matrix, PSTR("Suspended"));
|
||||
break;
|
||||
case DEVICE_STATE_Configured:
|
||||
matrix_write_P(&matrix, PSTR("Connected"));
|
||||
break;
|
||||
case DEVICE_STATE_Powered:
|
||||
matrix_write_P(&matrix, PSTR("Powered"));
|
||||
break;
|
||||
case DEVICE_STATE_Default:
|
||||
matrix_write_P(&matrix, PSTR("Default"));
|
||||
break;
|
||||
case DEVICE_STATE_Addressed:
|
||||
matrix_write_P(&matrix, PSTR("Addressed"));
|
||||
break;
|
||||
default:
|
||||
matrix_write_P(&matrix, PSTR("Invalid"));
|
||||
}
|
||||
#endif
|
||||
|
||||
// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
|
||||
|
||||
char buf[40];
|
||||
snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
|
||||
matrix_write_P(&matrix, PSTR("\n\nLayer: "));
|
||||
switch (layer_state) {
|
||||
case _BASE:
|
||||
matrix_write_P(&matrix, PSTR("Default"));
|
||||
break;
|
||||
case _RAISE:
|
||||
matrix_write_P(&matrix, PSTR("Raise"));
|
||||
break;
|
||||
case _LOWER:
|
||||
matrix_write_P(&matrix, PSTR("Lower"));
|
||||
break;
|
||||
case _ADJUST:
|
||||
matrix_write_P(&matrix, PSTR("ADJUST"));
|
||||
break;
|
||||
default:
|
||||
matrix_write(&matrix, buf);
|
||||
}
|
||||
|
||||
// Host Keyboard LED Status
|
||||
char led[40];
|
||||
snprintf(led, sizeof(led), "\n%s %s %s",
|
||||
(host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
|
||||
(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
|
||||
(host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
|
||||
matrix_write(&matrix, led);
|
||||
matrix_update(&display, &matrix);
|
||||
__attribute__ ((weak))
|
||||
void iota_gfx_task_user(void) {
|
||||
}
|
||||
|
||||
void iota_gfx_task(void) {
|
||||
render_status_info();
|
||||
iota_gfx_task_user();
|
||||
|
||||
if (display.dirty) {
|
||||
iota_gfx_flush();
|
93
drivers/avr/ssd1306.h
Normal file
93
drivers/avr/ssd1306.h
Normal file
@@ -0,0 +1,93 @@
|
||||
#ifndef SSD1306_H
|
||||
#define SSD1306_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include "pincontrol.h"
|
||||
#include "config.h"
|
||||
|
||||
enum ssd1306_cmds {
|
||||
DisplayOff = 0xAE,
|
||||
DisplayOn = 0xAF,
|
||||
|
||||
SetContrast = 0x81,
|
||||
DisplayAllOnResume = 0xA4,
|
||||
|
||||
DisplayAllOn = 0xA5,
|
||||
NormalDisplay = 0xA6,
|
||||
InvertDisplay = 0xA7,
|
||||
SetDisplayOffset = 0xD3,
|
||||
SetComPins = 0xda,
|
||||
SetVComDetect = 0xdb,
|
||||
SetDisplayClockDiv = 0xD5,
|
||||
SetPreCharge = 0xd9,
|
||||
SetMultiPlex = 0xa8,
|
||||
SetLowColumn = 0x00,
|
||||
SetHighColumn = 0x10,
|
||||
SetStartLine = 0x40,
|
||||
|
||||
SetMemoryMode = 0x20,
|
||||
ColumnAddr = 0x21,
|
||||
PageAddr = 0x22,
|
||||
|
||||
ComScanInc = 0xc0,
|
||||
ComScanDec = 0xc8,
|
||||
SegRemap = 0xa0,
|
||||
SetChargePump = 0x8d,
|
||||
ExternalVcc = 0x01,
|
||||
SwitchCapVcc = 0x02,
|
||||
|
||||
ActivateScroll = 0x2f,
|
||||
DeActivateScroll = 0x2e,
|
||||
SetVerticalScrollArea = 0xa3,
|
||||
RightHorizontalScroll = 0x26,
|
||||
LeftHorizontalScroll = 0x27,
|
||||
VerticalAndRightHorizontalScroll = 0x29,
|
||||
VerticalAndLeftHorizontalScroll = 0x2a,
|
||||
};
|
||||
|
||||
// Controls the SSD1306 128x32 OLED display via i2c
|
||||
|
||||
#ifndef SSD1306_ADDRESS
|
||||
#define SSD1306_ADDRESS 0x3C
|
||||
#endif
|
||||
|
||||
#define DisplayHeight 32
|
||||
#define DisplayWidth 128
|
||||
|
||||
#define FontHeight 8
|
||||
#define FontWidth 6
|
||||
|
||||
#define MatrixRows (DisplayHeight / FontHeight)
|
||||
#define MatrixCols (DisplayWidth / FontWidth)
|
||||
|
||||
struct CharacterMatrix {
|
||||
uint8_t display[MatrixRows][MatrixCols];
|
||||
uint8_t *cursor;
|
||||
bool dirty;
|
||||
};
|
||||
|
||||
struct CharacterMatrix display;
|
||||
|
||||
bool iota_gfx_init(void);
|
||||
void iota_gfx_task(void);
|
||||
bool iota_gfx_off(void);
|
||||
bool iota_gfx_on(void);
|
||||
void iota_gfx_flush(void);
|
||||
void iota_gfx_write_char(uint8_t c);
|
||||
void iota_gfx_write(const char *data);
|
||||
void iota_gfx_write_P(const char *data);
|
||||
void iota_gfx_clear_screen(void);
|
||||
|
||||
void iota_gfx_task_user(void);
|
||||
|
||||
void matrix_clear(struct CharacterMatrix *matrix);
|
||||
void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c);
|
||||
void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c);
|
||||
void matrix_write(struct CharacterMatrix *matrix, const char *data);
|
||||
void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
|
||||
void matrix_render(struct CharacterMatrix *matrix);
|
||||
|
||||
|
||||
|
||||
#endif
|
2
quantum/light_ws2812.c → drivers/avr/ws2812.c
Executable file → Normal file
2
quantum/light_ws2812.c → drivers/avr/ws2812.c
Executable file → Normal file
@@ -21,7 +21,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "light_ws2812.h"
|
||||
#include "ws2812.h"
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
0
quantum/light_ws2812.h → drivers/avr/ws2812.h
Executable file → Normal file
0
quantum/light_ws2812.h → drivers/avr/ws2812.h
Executable file → Normal file
@@ -22,9 +22,6 @@ static const I2CConfig i2ccfg = {
|
||||
400000 // clock speed (Hz); 400kHz max for IS31
|
||||
};
|
||||
|
||||
#define GDISP_SCREEN_WIDTH 7
|
||||
#define GDISP_SCREEN_HEIGHT 7
|
||||
|
||||
static const uint8_t led_mask[] = {
|
||||
0xFF, 0x00, /* C1-1 -> C1-16 */
|
||||
0xFF, 0x00, /* C2-1 -> C2-16 */
|
3
drivers/ugfx/gdisp/is31fl3731c/driver.mk
Normal file
3
drivers/ugfx/gdisp/is31fl3731c/driver.mk
Normal file
@@ -0,0 +1,3 @@
|
||||
GFXINC += drivers/ugfx/gdisp/is31fl3731c
|
||||
GFXSRC += drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c
|
||||
GDISP_DRIVER_LIST += GDISPVMT_IS31FL3731C_QMK
|
@@ -19,11 +19,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#if GFX_USE_GDISP
|
||||
|
||||
#define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_WHITEFOX
|
||||
#include "drivers/gdisp/IS31FL3731C/gdisp_lld_config.h"
|
||||
#define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_QMK
|
||||
#define GDISP_SCREEN_HEIGHT LED_HEIGHT
|
||||
#define GDISP_SCREEN_WIDTH LED_WIDTH
|
||||
|
||||
#include "gdisp_lld_config.h"
|
||||
#include "src/gdisp/gdisp_driver.h"
|
||||
|
||||
#include "board_IS31FL3731C.h"
|
||||
#include "board_is31fl3731c.h"
|
||||
|
||||
|
||||
// Can't include led_tables from here
|
||||
@@ -33,27 +36,21 @@ extern const uint8_t CIE1931_CURVE[];
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifndef GDISP_SCREEN_HEIGHT
|
||||
#define GDISP_SCREEN_HEIGHT 9
|
||||
#endif
|
||||
#ifndef GDISP_SCREEN_WIDTH
|
||||
#define GDISP_SCREEN_WIDTH 16
|
||||
#endif
|
||||
#ifndef GDISP_INITIAL_CONTRAST
|
||||
#define GDISP_INITIAL_CONTRAST 0
|
||||
#define GDISP_INITIAL_CONTRAST 0
|
||||
#endif
|
||||
#ifndef GDISP_INITIAL_BACKLIGHT
|
||||
#define GDISP_INITIAL_BACKLIGHT 0
|
||||
#define GDISP_INITIAL_BACKLIGHT 0
|
||||
#endif
|
||||
|
||||
#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
|
||||
#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
|
||||
|
||||
#define IS31_ADDR_DEFAULT 0x74
|
||||
|
||||
#define IS31_REG_CONFIG 0x00
|
||||
#define IS31_REG_CONFIG 0x00
|
||||
// bits in reg
|
||||
#define IS31_REG_CONFIG_PICTUREMODE 0x00
|
||||
#define IS31_REG_CONFIG_AUTOPLAYMODE 0x08
|
||||
#define IS31_REG_CONFIG_PICTUREMODE 0x00
|
||||
#define IS31_REG_CONFIG_AUTOPLAYMODE 0x08
|
||||
#define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18
|
||||
// D2:D0 bits are starting frame for autoplay mode
|
||||
|
||||
@@ -100,7 +97,6 @@ extern const uint8_t CIE1931_CURVE[];
|
||||
#define IS31_PWM_SIZE 0x90
|
||||
|
||||
#define IS31_LED_MASK_SIZE 0x12
|
||||
#define IS31_SCREEN_WIDTH 16
|
||||
|
||||
#define IS31
|
||||
|
||||
@@ -144,14 +140,14 @@ static GFXINLINE void write_ram(GDisplay *g, uint8_t page, uint16_t offset, uint
|
||||
}
|
||||
|
||||
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
||||
// The private area is the display surface.
|
||||
g->priv = gfxAlloc(sizeof(PrivData));
|
||||
// The private area is the display surface.
|
||||
g->priv = gfxAlloc(sizeof(PrivData));
|
||||
__builtin_memset(PRIV(g), 0, sizeof(PrivData));
|
||||
PRIV(g)->page = 0;
|
||||
PRIV(g)->page = 0;
|
||||
|
||||
// Initialise the board interface
|
||||
init_board(g);
|
||||
gfxSleepMilliseconds(10);
|
||||
// Initialise the board interface
|
||||
init_board(g);
|
||||
gfxSleepMilliseconds(10);
|
||||
|
||||
// zero function page, all registers (assuming full_page is all zeroes)
|
||||
write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
|
||||
@@ -179,134 +175,134 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
||||
// Finish Init
|
||||
post_init_board(g);
|
||||
|
||||
/* Initialise the GDISP structure */
|
||||
g->g.Width = GDISP_SCREEN_WIDTH;
|
||||
g->g.Height = GDISP_SCREEN_HEIGHT;
|
||||
g->g.Orientation = GDISP_ROTATE_0;
|
||||
g->g.Powermode = powerOff;
|
||||
g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
|
||||
g->g.Contrast = GDISP_INITIAL_CONTRAST;
|
||||
return TRUE;
|
||||
/* Initialise the GDISP structure */
|
||||
g->g.Width = GDISP_SCREEN_WIDTH;
|
||||
g->g.Height = GDISP_SCREEN_HEIGHT;
|
||||
g->g.Orientation = GDISP_ROTATE_0;
|
||||
g->g.Powermode = powerOff;
|
||||
g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
|
||||
g->g.Contrast = GDISP_INITIAL_CONTRAST;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if GDISP_HARDWARE_FLUSH
|
||||
LLDSPEC void gdisp_lld_flush(GDisplay *g) {
|
||||
// Don't flush if we don't need it.
|
||||
if (!(g->flags & GDISP_FLG_NEEDFLUSH))
|
||||
return;
|
||||
LLDSPEC void gdisp_lld_flush(GDisplay *g) {
|
||||
// Don't flush if we don't need it.
|
||||
if (!(g->flags & GDISP_FLG_NEEDFLUSH))
|
||||
return;
|
||||
|
||||
PRIV(g)->page++;
|
||||
PRIV(g)->page %= 2;
|
||||
// TODO: some smarter algorithm for this
|
||||
// We should run only one physical page at a time
|
||||
// This way we don't need to send so much data, and
|
||||
// we could use slightly less memory
|
||||
uint8_t* src = PRIV(g)->frame_buffer;
|
||||
for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) {
|
||||
for (int x=0;x<GDISP_SCREEN_WIDTH;x++) {
|
||||
uint8_t val = (uint16_t)*src * g->g.Backlight / 100;
|
||||
PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val];
|
||||
++src;
|
||||
}
|
||||
}
|
||||
PRIV(g)->page++;
|
||||
PRIV(g)->page %= 2;
|
||||
// TODO: some smarter algorithm for this
|
||||
// We should run only one physical page at a time
|
||||
// This way we don't need to send so much data, and
|
||||
// we could use slightly less memory
|
||||
uint8_t* src = PRIV(g)->frame_buffer;
|
||||
for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) {
|
||||
for (int x=0;x<GDISP_SCREEN_WIDTH;x++) {
|
||||
uint8_t val = (uint16_t)*src * g->g.Backlight / 100;
|
||||
PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val];
|
||||
++src;
|
||||
}
|
||||
}
|
||||
write_ram(g, PRIV(g)->page, IS31_PWM_REG, IS31_PWM_SIZE);
|
||||
gfxSleepMilliseconds(1);
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_PICTDISP, PRIV(g)->page);
|
||||
|
||||
g->flags &= ~GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
g->flags &= ~GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_DRAWPIXEL
|
||||
LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
|
||||
coord_t x, y;
|
||||
LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
|
||||
coord_t x, y;
|
||||
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
case GDISP_ROTATE_0:
|
||||
x = g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
case GDISP_ROTATE_180:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
}
|
||||
PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color);
|
||||
g->flags |= GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
case GDISP_ROTATE_0:
|
||||
x = g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
case GDISP_ROTATE_180:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
}
|
||||
PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color);
|
||||
g->flags |= GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_PIXELREAD
|
||||
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
|
||||
coord_t x, y;
|
||||
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
|
||||
coord_t x, y;
|
||||
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
case GDISP_ROTATE_0:
|
||||
x = g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
case GDISP_ROTATE_180:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
}
|
||||
return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]);
|
||||
}
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
case GDISP_ROTATE_0:
|
||||
x = g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
case GDISP_ROTATE_180:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
}
|
||||
return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
|
||||
LLDSPEC void gdisp_lld_control(GDisplay *g) {
|
||||
switch(g->p.x) {
|
||||
case GDISP_CONTROL_POWER:
|
||||
if (g->g.Powermode == (powermode_t)g->p.ptr)
|
||||
return;
|
||||
switch((powermode_t)g->p.ptr) {
|
||||
case powerOff:
|
||||
case powerSleep:
|
||||
case powerDeepSleep:
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
|
||||
break;
|
||||
case powerOn:
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
g->g.Powermode = (powermode_t)g->p.ptr;
|
||||
return;
|
||||
|
||||
case GDISP_CONTROL_ORIENTATION:
|
||||
if (g->g.Orientation == (orientation_t)g->p.ptr)
|
||||
return;
|
||||
switch((orientation_t)g->p.ptr) {
|
||||
/* Rotation is handled by the drawing routines */
|
||||
case GDISP_ROTATE_0:
|
||||
case GDISP_ROTATE_180:
|
||||
g->g.Height = GDISP_SCREEN_HEIGHT;
|
||||
g->g.Width = GDISP_SCREEN_WIDTH;
|
||||
break;
|
||||
case GDISP_ROTATE_90:
|
||||
case GDISP_ROTATE_270:
|
||||
g->g.Height = GDISP_SCREEN_WIDTH;
|
||||
g->g.Width = GDISP_SCREEN_HEIGHT;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
g->g.Orientation = (orientation_t)g->p.ptr;
|
||||
return;
|
||||
|
||||
case GDISP_CONTROL_BACKLIGHT:
|
||||
if (g->g.Backlight == (unsigned)g->p.ptr)
|
||||
LLDSPEC void gdisp_lld_control(GDisplay *g) {
|
||||
switch(g->p.x) {
|
||||
case GDISP_CONTROL_POWER:
|
||||
if (g->g.Powermode == (powermode_t)g->p.ptr)
|
||||
return;
|
||||
unsigned val = (unsigned)g->p.ptr;
|
||||
g->g.Backlight = val > 100 ? 100 : val;
|
||||
switch((powermode_t)g->p.ptr) {
|
||||
case powerOff:
|
||||
case powerSleep:
|
||||
case powerDeepSleep:
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
|
||||
break;
|
||||
case powerOn:
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
g->g.Powermode = (powermode_t)g->p.ptr;
|
||||
return;
|
||||
|
||||
case GDISP_CONTROL_ORIENTATION:
|
||||
if (g->g.Orientation == (orientation_t)g->p.ptr)
|
||||
return;
|
||||
switch((orientation_t)g->p.ptr) {
|
||||
/* Rotation is handled by the drawing routines */
|
||||
case GDISP_ROTATE_0:
|
||||
case GDISP_ROTATE_180:
|
||||
g->g.Height = GDISP_SCREEN_HEIGHT;
|
||||
g->g.Width = GDISP_SCREEN_WIDTH;
|
||||
break;
|
||||
case GDISP_ROTATE_90:
|
||||
case GDISP_ROTATE_270:
|
||||
g->g.Height = GDISP_SCREEN_WIDTH;
|
||||
g->g.Width = GDISP_SCREEN_HEIGHT;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
g->g.Orientation = (orientation_t)g->p.ptr;
|
||||
return;
|
||||
|
||||
case GDISP_CONTROL_BACKLIGHT:
|
||||
if (g->g.Backlight == (unsigned)g->p.ptr)
|
||||
return;
|
||||
unsigned val = (unsigned)g->p.ptr;
|
||||
g->g.Backlight = val > 100 ? 100 : val;
|
||||
g->flags |= GDISP_FLG_NEEDFLUSH;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // GDISP_NEED_CONTROL
|
||||
|
||||
#endif // GFX_USE_GDISP
|
@@ -24,13 +24,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/* Driver hardware support. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
|
||||
#define GDISP_HARDWARE_DRAWPIXEL TRUE
|
||||
#define GDISP_HARDWARE_PIXELREAD TRUE
|
||||
#define GDISP_HARDWARE_CONTROL TRUE
|
||||
#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
|
||||
#define GDISP_HARDWARE_DRAWPIXEL TRUE
|
||||
#define GDISP_HARDWARE_PIXELREAD TRUE
|
||||
#define GDISP_HARDWARE_CONTROL TRUE
|
||||
|
||||
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256
|
||||
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256
|
||||
|
||||
#endif /* GFX_USE_GDISP */
|
||||
#endif /* GFX_USE_GDISP */
|
||||
|
||||
#endif /* _GDISP_LLD_CONFIG_H */
|
||||
#endif /* _GDISP_LLD_CONFIG_H */
|
@@ -83,7 +83,7 @@ static GFXINLINE void init_board(GDisplay *g) {
|
||||
}
|
||||
|
||||
static GFXINLINE void post_init_board(GDisplay *g) {
|
||||
(void) g;
|
||||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
@@ -106,8 +106,8 @@ static GFXINLINE void enter_cmd_mode(GDisplay *g) {
|
||||
|
||||
|
||||
static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
|
||||
(void) g;
|
||||
spiSend(&SPID1, length, data);
|
||||
(void) g;
|
||||
spiSend(&SPID1, length, data);
|
||||
}
|
||||
|
||||
#endif /* _GDISP_LLD_BOARD_H */
|
3
drivers/ugfx/gdisp/st7565/driver.mk
Normal file
3
drivers/ugfx/gdisp/st7565/driver.mk
Normal file
@@ -0,0 +1,3 @@
|
||||
GFXINC += drivers/ugfx/gdisp/st7565
|
||||
GFXSRC += drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c
|
||||
GDISP_DRIVER_LIST += GDISPVMT_ST7565_QMK
|
@@ -9,35 +9,35 @@
|
||||
|
||||
#if GFX_USE_GDISP
|
||||
|
||||
#define GDISP_DRIVER_VMT GDISPVMT_ST7565_ERGODOX
|
||||
#include "drivers/gdisp/st7565ergodox/gdisp_lld_config.h"
|
||||
#define GDISP_DRIVER_VMT GDISPVMT_ST7565_QMK
|
||||
#include "gdisp_lld_config.h"
|
||||
#include "src/gdisp/gdisp_driver.h"
|
||||
|
||||
#include "board_ST7565.h"
|
||||
#include "board_st7565.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifndef GDISP_SCREEN_HEIGHT
|
||||
#define GDISP_SCREEN_HEIGHT 32
|
||||
#define GDISP_SCREEN_HEIGHT LCD_HEIGHT
|
||||
#endif
|
||||
#ifndef GDISP_SCREEN_WIDTH
|
||||
#define GDISP_SCREEN_WIDTH 128
|
||||
#define GDISP_SCREEN_WIDTH LCD_WIDTH
|
||||
#endif
|
||||
#ifndef GDISP_INITIAL_CONTRAST
|
||||
#define GDISP_INITIAL_CONTRAST 35
|
||||
#define GDISP_INITIAL_CONTRAST 35
|
||||
#endif
|
||||
#ifndef GDISP_INITIAL_BACKLIGHT
|
||||
#define GDISP_INITIAL_BACKLIGHT 100
|
||||
#define GDISP_INITIAL_BACKLIGHT 100
|
||||
#endif
|
||||
|
||||
#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
|
||||
#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
|
||||
|
||||
#include "drivers/gdisp/st7565ergodox/st7565.h"
|
||||
#include "st7565.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver config defaults for backward compatibility. */
|
||||
/* Driver config defaults for backward compatibility. */
|
||||
/*===========================================================================*/
|
||||
#ifndef ST7565_LCD_BIAS
|
||||
#define ST7565_LCD_BIAS ST7565_LCD_BIAS_7
|
||||
@@ -65,7 +65,7 @@ typedef struct{
|
||||
|
||||
// Some common routines and macros
|
||||
#define PRIV(g) ((PrivData*)g->priv)
|
||||
#define RAM(g) (PRIV(g)->ram)
|
||||
#define RAM(g) (PRIV(g)->ram)
|
||||
|
||||
static GFXINLINE void write_cmd(GDisplay* g, uint8_t cmd) {
|
||||
PRIV(g)->data[PRIV(g)->data_pos++] = cmd;
|
||||
@@ -76,15 +76,15 @@ static GFXINLINE void flush_cmd(GDisplay* g) {
|
||||
PRIV(g)->data_pos = 0;
|
||||
}
|
||||
|
||||
#define write_cmd2(g, cmd1, cmd2) { write_cmd(g, cmd1); write_cmd(g, cmd2); }
|
||||
#define write_cmd3(g, cmd1, cmd2, cmd3) { write_cmd(g, cmd1); write_cmd(g, cmd2); write_cmd(g, cmd3); }
|
||||
#define write_cmd2(g, cmd1, cmd2) { write_cmd(g, cmd1); write_cmd(g, cmd2); }
|
||||
#define write_cmd3(g, cmd1, cmd2, cmd3) { write_cmd(g, cmd1); write_cmd(g, cmd2); write_cmd(g, cmd3); }
|
||||
|
||||
// Some common routines and macros
|
||||
#define delay(us) gfxSleepMicroseconds(us)
|
||||
#define delay_ms(ms) gfxSleepMilliseconds(ms)
|
||||
#define delay(us) gfxSleepMicroseconds(us)
|
||||
#define delay_ms(ms) gfxSleepMilliseconds(ms)
|
||||
|
||||
#define xyaddr(x, y) ((x) + ((y)>>3)*GDISP_SCREEN_WIDTH)
|
||||
#define xybit(y) (1<<((y)&7))
|
||||
#define xyaddr(x, y) ((x) + ((y)>>3)*GDISP_SCREEN_WIDTH)
|
||||
#define xybit(y) (1<<((y)&7))
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
@@ -150,7 +150,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
||||
|
||||
#if GDISP_HARDWARE_FLUSH
|
||||
LLDSPEC void gdisp_lld_flush(GDisplay *g) {
|
||||
unsigned p;
|
||||
unsigned p;
|
||||
|
||||
// Don't flush if we don't need it.
|
||||
if (!(g->flags & GDISP_FLG_NEEDFLUSH))
|
||||
@@ -181,7 +181,7 @@ LLDSPEC void gdisp_lld_flush(GDisplay *g) {
|
||||
|
||||
#if GDISP_HARDWARE_DRAWPIXEL
|
||||
LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
|
||||
coord_t x, y;
|
||||
coord_t x, y;
|
||||
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
@@ -212,7 +212,7 @@ LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
|
||||
|
||||
#if GDISP_HARDWARE_PIXELREAD
|
||||
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
|
||||
coord_t x, y;
|
||||
coord_t x, y;
|
||||
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
@@ -257,7 +257,7 @@ LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
|
||||
else {
|
||||
*dst &= ~xybit(dsty);
|
||||
}
|
||||
dstx++;
|
||||
dstx++;
|
||||
srcbit++;
|
||||
}
|
||||
}
|
@@ -14,7 +14,7 @@
|
||||
/* Driver hardware support. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
|
||||
#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
|
||||
#define GDISP_HARDWARE_DRAWPIXEL TRUE
|
||||
#define GDISP_HARDWARE_PIXELREAD TRUE
|
||||
#define GDISP_HARDWARE_CONTROL TRUE
|
||||
@@ -22,6 +22,6 @@
|
||||
|
||||
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO
|
||||
|
||||
#endif /* GFX_USE_GDISP */
|
||||
#endif /* GFX_USE_GDISP */
|
||||
|
||||
#endif /* _GDISP_LLD_CONFIG_H */
|
||||
#endif /* _GDISP_LLD_CONFIG_H */
|
5
keyboards/deltasplit75/Makefile
Normal file
5
keyboards/deltasplit75/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
SUBPROJECT_DEFAULT = v2
|
||||
|
||||
ifndef MAKEFILE_INCLUDED
|
||||
include ../../Makefile
|
||||
endif
|
29
keyboards/deltasplit75/config.h
Normal file
29
keyboards/deltasplit75/config.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
#ifdef SUBPROJECT_protosplit
|
||||
#include "protosplit/config.h"
|
||||
#endif
|
||||
#ifdef SUBPROJECT_v2
|
||||
#include "v2/config.h"
|
||||
#endif
|
||||
#endif
|
1
keyboards/deltasplit75/deltasplit75.c
Normal file
1
keyboards/deltasplit75/deltasplit75.c
Normal file
@@ -0,0 +1 @@
|
||||
#include "deltasplit75.h"
|
13
keyboards/deltasplit75/deltasplit75.h
Normal file
13
keyboards/deltasplit75/deltasplit75.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef DELTASPLIT75_H
|
||||
#define DELTASPLIT75_H
|
||||
|
||||
#ifdef SUBPROJECT_v2
|
||||
#include "v2.h"
|
||||
#endif
|
||||
#ifdef SUBPROJECT_protosplit
|
||||
#include "protosplit.h"
|
||||
#endif
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#endif
|
2
keyboards/deltasplit75/eeprom-lefthand.eep
Normal file
2
keyboards/deltasplit75/eeprom-lefthand.eep
Normal file
@@ -0,0 +1,2 @@
|
||||
:0B0000000000000000000000000001F4
|
||||
:00000001FF
|
2
keyboards/deltasplit75/eeprom-righthand.eep
Normal file
2
keyboards/deltasplit75/eeprom-righthand.eep
Normal file
@@ -0,0 +1,2 @@
|
||||
:0B0000000000000000000000000000F5
|
||||
:00000001FF
|
162
keyboards/deltasplit75/i2c.c
Normal file
162
keyboards/deltasplit75/i2c.c
Normal file
@@ -0,0 +1,162 @@
|
||||
#include <util/twi.h>
|
||||
#include <avr/io.h>
|
||||
#include <stdlib.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <util/twi.h>
|
||||
#include <stdbool.h>
|
||||
#include "i2c.h"
|
||||
|
||||
#ifdef USE_I2C
|
||||
|
||||
// Limits the amount of we wait for any one i2c transaction.
|
||||
// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
|
||||
// 9 bits, a single transaction will take around 90μs to complete.
|
||||
//
|
||||
// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit
|
||||
// poll loop takes at least 8 clock cycles to execute
|
||||
#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8
|
||||
|
||||
#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE)
|
||||
|
||||
volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
|
||||
|
||||
static volatile uint8_t slave_buffer_pos;
|
||||
static volatile bool slave_has_register_set = false;
|
||||
|
||||
// Wait for an i2c operation to finish
|
||||
inline static
|
||||
void i2c_delay(void) {
|
||||
uint16_t lim = 0;
|
||||
while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT)
|
||||
lim++;
|
||||
|
||||
// easier way, but will wait slightly longer
|
||||
// _delay_us(100);
|
||||
}
|
||||
|
||||
// Setup twi to run at 100kHz
|
||||
void i2c_master_init(void) {
|
||||
// no prescaler
|
||||
TWSR = 0;
|
||||
// Set TWI clock frequency to SCL_CLOCK. Need TWBR>10.
|
||||
// Check datasheets for more info.
|
||||
TWBR = ((F_CPU/SCL_CLOCK)-16)/2;
|
||||
}
|
||||
|
||||
// Start a transaction with the given i2c slave address. The direction of the
|
||||
// transfer is set with I2C_READ and I2C_WRITE.
|
||||
// returns: 0 => success
|
||||
// 1 => error
|
||||
uint8_t i2c_master_start(uint8_t address) {
|
||||
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA);
|
||||
|
||||
i2c_delay();
|
||||
|
||||
// check that we started successfully
|
||||
if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START))
|
||||
return 1;
|
||||
|
||||
TWDR = address;
|
||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||
|
||||
i2c_delay();
|
||||
|
||||
if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) )
|
||||
return 1; // slave did not acknowledge
|
||||
else
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
|
||||
// Finish the i2c transaction.
|
||||
void i2c_master_stop(void) {
|
||||
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
|
||||
|
||||
uint16_t lim = 0;
|
||||
while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT)
|
||||
lim++;
|
||||
}
|
||||
|
||||
// Write one byte to the i2c slave.
|
||||
// returns 0 => slave ACK
|
||||
// 1 => slave NACK
|
||||
uint8_t i2c_master_write(uint8_t data) {
|
||||
TWDR = data;
|
||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||
|
||||
i2c_delay();
|
||||
|
||||
// check if the slave acknowledged us
|
||||
return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1;
|
||||
}
|
||||
|
||||
// Read one byte from the i2c slave. If ack=1 the slave is acknowledged,
|
||||
// if ack=0 the acknowledge bit is not set.
|
||||
// returns: byte read from i2c device
|
||||
uint8_t i2c_master_read(int ack) {
|
||||
TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA);
|
||||
|
||||
i2c_delay();
|
||||
return TWDR;
|
||||
}
|
||||
|
||||
void i2c_reset_state(void) {
|
||||
TWCR = 0;
|
||||
}
|
||||
|
||||
void i2c_slave_init(uint8_t address) {
|
||||
TWAR = address << 0; // slave i2c address
|
||||
// TWEN - twi enable
|
||||
// TWEA - enable address acknowledgement
|
||||
// TWINT - twi interrupt flag
|
||||
// TWIE - enable the twi interrupt
|
||||
TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN);
|
||||
}
|
||||
|
||||
ISR(TWI_vect);
|
||||
|
||||
ISR(TWI_vect) {
|
||||
uint8_t ack = 1;
|
||||
switch(TW_STATUS) {
|
||||
case TW_SR_SLA_ACK:
|
||||
// this device has been addressed as a slave receiver
|
||||
slave_has_register_set = false;
|
||||
break;
|
||||
|
||||
case TW_SR_DATA_ACK:
|
||||
// this device has received data as a slave receiver
|
||||
// The first byte that we receive in this transaction sets the location
|
||||
// of the read/write location of the slaves memory that it exposes over
|
||||
// i2c. After that, bytes will be written at slave_buffer_pos, incrementing
|
||||
// slave_buffer_pos after each write.
|
||||
if(!slave_has_register_set) {
|
||||
slave_buffer_pos = TWDR;
|
||||
// don't acknowledge the master if this memory loctaion is out of bounds
|
||||
if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) {
|
||||
ack = 0;
|
||||
slave_buffer_pos = 0;
|
||||
}
|
||||
slave_has_register_set = true;
|
||||
} else {
|
||||
i2c_slave_buffer[slave_buffer_pos] = TWDR;
|
||||
BUFFER_POS_INC();
|
||||
}
|
||||
break;
|
||||
|
||||
case TW_ST_SLA_ACK:
|
||||
case TW_ST_DATA_ACK:
|
||||
// master has addressed this device as a slave transmitter and is
|
||||
// requesting data.
|
||||
TWDR = i2c_slave_buffer[slave_buffer_pos];
|
||||
BUFFER_POS_INC();
|
||||
break;
|
||||
|
||||
case TW_BUS_ERROR: // something went wrong, reset twi state
|
||||
TWCR = 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// Reset everything, so we are ready for the next TWI interrupt
|
||||
TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
|
||||
}
|
||||
#endif
|
31
keyboards/deltasplit75/i2c.h
Normal file
31
keyboards/deltasplit75/i2c.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef I2C_H
|
||||
#define I2C_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef F_CPU
|
||||
#define F_CPU 16000000UL
|
||||
#endif
|
||||
|
||||
#define I2C_READ 1
|
||||
#define I2C_WRITE 0
|
||||
|
||||
#define I2C_ACK 1
|
||||
#define I2C_NACK 0
|
||||
|
||||
#define SLAVE_BUFFER_SIZE 0x10
|
||||
|
||||
// i2c SCL clock frequency
|
||||
#define SCL_CLOCK 100000L
|
||||
|
||||
extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
|
||||
|
||||
void i2c_master_init(void);
|
||||
uint8_t i2c_master_start(uint8_t address);
|
||||
void i2c_master_stop(void);
|
||||
uint8_t i2c_master_write(uint8_t data);
|
||||
uint8_t i2c_master_read(int);
|
||||
void i2c_reset_state(void);
|
||||
void i2c_slave_init(uint8_t address);
|
||||
|
||||
#endif
|
31
keyboards/deltasplit75/keymaps/default/config.h
Normal file
31
keyboards/deltasplit75/keymaps/default/config.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
|
||||
#define USE_SERIAL
|
||||
|
||||
#define MASTER_LEFT
|
||||
// #define _MASTER_RIGHT
|
||||
// #define EE_HANDS
|
||||
|
||||
|
||||
#ifdef SUBPROJECT_v2
|
||||
#include "../../v2/config.h"
|
||||
#endif
|
||||
#ifdef SUBPROJECT_protosplit
|
||||
#include "../../protosplit/config.h"
|
||||
#endif
|
31
keyboards/deltasplit75/keymaps/default/keymap.c
Normal file
31
keyboards/deltasplit75/keymaps/default/keymap.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "deltasplit75.h"
|
||||
#include "action_layer.h"
|
||||
#include "eeconfig.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.
|
||||
|
||||
// Fillers to make layering more clear
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KEYMAP_V2(
|
||||
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_INS, KC_HOME, KC_PGUP,
|
||||
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_DEL, KC_END, KC_PGDN,
|
||||
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, KC_SLCK,
|
||||
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_TRNS, KC_ENT, KC_PAUS, //modify KC_TRNS to enable ISO Support
|
||||
KC_LSFT, KC_TRNS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_LSFT, KC_UP, KC_PSCR, //modify KC_TRNS to enable ISO Support
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
KEYMAP_V2(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET,
|
||||
KC_BSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_VOLU, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
M(1), KC_LEFT, KC_DOWN, KC_RGHT, KC_PAUS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_VOLD, M(0), KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
|
||||
|
||||
};
|
7
keyboards/deltasplit75/keymaps/itsaferbie/Makefile
Normal file
7
keyboards/deltasplit75/keymaps/itsaferbie/Makefile
Normal file
@@ -0,0 +1,7 @@
|
||||
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
|
||||
AUDIO_ENABLE = no # Audio disabled while using RGB underlight.
|
||||
EXTRAKEY_ENABLE = yes
|
||||
|
||||
ifndef QUANTUM_DIR
|
||||
include ../../../../Makefile
|
||||
endif
|
31
keyboards/deltasplit75/keymaps/itsaferbie/config.h
Normal file
31
keyboards/deltasplit75/keymaps/itsaferbie/config.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
|
||||
#define USE_SERIAL
|
||||
|
||||
#define MASTER_LEFT
|
||||
// #define _MASTER_RIGHT
|
||||
// #define EE_HANDS
|
||||
|
||||
|
||||
#ifdef SUBPROJECT_v2
|
||||
#include "../../v2/config.h"
|
||||
#endif
|
||||
#ifdef SUBPROJECT_protosplit
|
||||
#include "../../protosplit/config.h"
|
||||
#endif
|
46
keyboards/deltasplit75/keymaps/itsaferbie/keymap.c
Normal file
46
keyboards/deltasplit75/keymaps/itsaferbie/keymap.c
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "deltasplit75.h"
|
||||
#include "action_layer.h"
|
||||
#include "eeconfig.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.
|
||||
|
||||
// Fillers to make layering more clear
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Layer 0: Default Layer
|
||||
*,-----------------------------------------------------------------------.
|
||||
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9| F10| F11| F12|Prnt|Ins|Del|
|
||||
* |----------------------------------------------------------------------|
|
||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Backspace| Home|
|
||||
* |----------------------------------------------------------------------|
|
||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| PgUp|
|
||||
* |----------------------------------------------------------------------|
|
||||
* |Ctrl| A| S| D| F| G| H| J| K| L| ;| '|Enter | PgDown|
|
||||
* |----------------------------------------------------------------------|
|
||||
* |Shif| | Z| X| C| V| B| N| M| ,| .| /|Shift | Up| End|
|
||||
* |----------------------------------------------------------------------|
|
||||
* |CapsLo|Gui |Alt |Sp |Mod | Sp| Alt| Gui| Ctrl| | Lef| Dow| Rig|
|
||||
* `----------------------------------------------------------------------'
|
||||
*/
|
||||
KEYMAP_V2(
|
||||
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_INS, KC_DEL,
|
||||
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_TRNS, KC_HOME, // KC_TRNS is the unneeded key in the split backspace.
|
||||
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_PGUP,
|
||||
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_TRNS, KC_ENT, KC_PGDN, // KC_TRNS is unneeded ISO enter key.
|
||||
KC_LSFT, KC_TRNS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, // KC_TRNS is uneeded ISO layout key.
|
||||
KC_CAPS, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
KEYMAP_V2(
|
||||
RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET,
|
||||
RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLU,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, KC_VOLD,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_STOP, KC_MNXT),
|
||||
|
||||
};
|
31
keyboards/deltasplit75/keymaps/protosplit/config.h
Normal file
31
keyboards/deltasplit75/keymaps/protosplit/config.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
|
||||
#define USE_SERIAL
|
||||
|
||||
#define MASTER_LEFT
|
||||
// #define _MASTER_RIGHT
|
||||
// #define EE_HANDS
|
||||
|
||||
|
||||
#ifdef SUBPROJECT_v2
|
||||
#include "../../v2/config.h"
|
||||
#endif
|
||||
#ifdef SUBPROJECT_protosplit
|
||||
#include "../../protosplit/config.h"
|
||||
#endif
|
32
keyboards/deltasplit75/keymaps/protosplit/keymap.c
Normal file
32
keyboards/deltasplit75/keymaps/protosplit/keymap.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "deltasplit75.h"
|
||||
#include "action_layer.h"
|
||||
#include "eeconfig.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.
|
||||
|
||||
// Fillers to make layering more clear
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KEYMAP_PROTOSPLIT(
|
||||
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_INS, KC_HOME, KC_PGUP,
|
||||
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_DEL, KC_END, KC_PGDN,
|
||||
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, KC_SLCK,
|
||||
KC_LCTL, 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_PAUS,
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_LSFT, KC_UP, KC_PSCR,
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
KEYMAP_PROTOSPLIT(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET,
|
||||
KC_BSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_VOLU, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
M(1), KC_LEFT, KC_DOWN, KC_RGHT, KC_PAUS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_VOLD, M(0), KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
|
||||
|
||||
|
||||
};
|
318
keyboards/deltasplit75/matrix.c
Normal file
318
keyboards/deltasplit75/matrix.c
Normal file
@@ -0,0 +1,318 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* scan matrix
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/wdt.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <util/delay.h>
|
||||
#include "print.h"
|
||||
#include "debug.h"
|
||||
#include "util.h"
|
||||
#include "matrix.h"
|
||||
#include "split_util.h"
|
||||
#include "pro_micro.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef USE_I2C
|
||||
# include "i2c.h"
|
||||
#else // USE_SERIAL
|
||||
# include "serial.h"
|
||||
#endif
|
||||
|
||||
#ifndef DEBOUNCE
|
||||
# define DEBOUNCE 5
|
||||
#endif
|
||||
|
||||
#define ERROR_DISCONNECT_COUNT 5
|
||||
|
||||
static uint8_t debouncing = DEBOUNCE;
|
||||
static const int ROWS_PER_HAND = MATRIX_ROWS/2;
|
||||
static uint8_t error_count = 0;
|
||||
|
||||
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||
static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
|
||||
|
||||
/* matrix state(1:on, 0:off) */
|
||||
static matrix_row_t matrix[MATRIX_ROWS];
|
||||
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||
|
||||
static matrix_row_t read_cols(void);
|
||||
static void init_cols(void);
|
||||
static void unselect_rows(void);
|
||||
static void select_row(uint8_t row);
|
||||
|
||||
__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;
|
||||
}
|
||||
|
||||
void matrix_init(void)
|
||||
{
|
||||
debug_enable = true;
|
||||
debug_matrix = true;
|
||||
debug_mouse = true;
|
||||
// initialize row and col
|
||||
unselect_rows();
|
||||
init_cols();
|
||||
|
||||
TX_RX_LED_INIT;
|
||||
|
||||
// initialize matrix state: all keys off
|
||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
||||
matrix[i] = 0;
|
||||
matrix_debouncing[i] = 0;
|
||||
}
|
||||
|
||||
matrix_init_quantum();
|
||||
}
|
||||
|
||||
uint8_t _matrix_scan(void)
|
||||
{
|
||||
// Right hand is stored after the left in the matirx so, we need to offset it
|
||||
int offset = isLeftHand ? 0 : (ROWS_PER_HAND);
|
||||
|
||||
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
|
||||
select_row(i);
|
||||
_delay_us(30); // without this wait read unstable value.
|
||||
matrix_row_t cols = read_cols();
|
||||
if (matrix_debouncing[i+offset] != cols) {
|
||||
matrix_debouncing[i+offset] = cols;
|
||||
debouncing = DEBOUNCE;
|
||||
}
|
||||
unselect_rows();
|
||||
}
|
||||
|
||||
if (debouncing) {
|
||||
if (--debouncing) {
|
||||
_delay_ms(1);
|
||||
} else {
|
||||
for (uint8_t i = 0; i < ROWS_PER_HAND; i++) {
|
||||
matrix[i+offset] = matrix_debouncing[i+offset];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef USE_I2C
|
||||
|
||||
// Get rows from other half over i2c
|
||||
int i2c_transaction(void) {
|
||||
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
|
||||
|
||||
int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE);
|
||||
if (err) goto i2c_error;
|
||||
|
||||
// start of matrix stored at 0x00
|
||||
err = i2c_master_write(0x00);
|
||||
if (err) goto i2c_error;
|
||||
|
||||
// Start read
|
||||
err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ);
|
||||
if (err) goto i2c_error;
|
||||
|
||||
if (!err) {
|
||||
int i;
|
||||
for (i = 0; i < ROWS_PER_HAND-1; ++i) {
|
||||
matrix[slaveOffset+i] = i2c_master_read(I2C_ACK);
|
||||
}
|
||||
matrix[slaveOffset+i] = i2c_master_read(I2C_NACK);
|
||||
i2c_master_stop();
|
||||
} else {
|
||||
i2c_error: // the cable is disconnceted, or something else went wrong
|
||||
i2c_reset_state();
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else // USE_SERIAL
|
||||
|
||||
int serial_transaction(void) {
|
||||
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
|
||||
|
||||
if (serial_update_buffers()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||
matrix[slaveOffset+i] = serial_slave_buffer[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t matrix_scan(void)
|
||||
{
|
||||
int ret = _matrix_scan();
|
||||
|
||||
|
||||
|
||||
#ifdef USE_I2C
|
||||
if( i2c_transaction() ) {
|
||||
#else // USE_SERIAL
|
||||
if( serial_transaction() ) {
|
||||
#endif
|
||||
// turn on the indicator led when halves are disconnected
|
||||
TXLED1;
|
||||
|
||||
error_count++;
|
||||
|
||||
if (error_count > ERROR_DISCONNECT_COUNT) {
|
||||
// reset other half if disconnected
|
||||
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
|
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||
matrix[slaveOffset+i] = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// turn off the indicator led on no error
|
||||
TXLED0;
|
||||
error_count = 0;
|
||||
}
|
||||
|
||||
matrix_scan_quantum();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void matrix_slave_scan(void) {
|
||||
_matrix_scan();
|
||||
|
||||
int offset = (isLeftHand) ? 0 : (MATRIX_ROWS / 2);
|
||||
|
||||
#ifdef USE_I2C
|
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||
/* i2c_slave_buffer[i] = matrix[offset+i]; */
|
||||
i2c_slave_buffer[i] = matrix[offset+i];
|
||||
}
|
||||
#else // USE_SERIAL
|
||||
for (int i = 0; i < ROWS_PER_HAND; ++i) {
|
||||
serial_slave_buffer[i] = matrix[offset+i];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool matrix_is_modified(void)
|
||||
{
|
||||
if (debouncing) 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)
|
||||
{
|
||||
return matrix[row];
|
||||
}
|
||||
|
||||
void matrix_print(void)
|
||||
{
|
||||
print("\nr/c 0123456789ABCDEF\n");
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
phex(row); print(": ");
|
||||
pbin_reverse16(matrix_get_row(row));
|
||||
print("\n");
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t matrix_key_count(void)
|
||||
{
|
||||
uint8_t count = 0;
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
count += bitpop16(matrix[i]);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static void init_cols(void)
|
||||
{
|
||||
for(int x = 0; x < MATRIX_COLS; x++) {
|
||||
_SFR_IO8((col_pins[x] >> 4) + 1) &= ~_BV(col_pins[x] & 0xF);
|
||||
_SFR_IO8((col_pins[x] >> 4) + 2) |= _BV(col_pins[x] & 0xF);
|
||||
}
|
||||
}
|
||||
|
||||
static matrix_row_t read_cols(void)
|
||||
{
|
||||
matrix_row_t result = 0;
|
||||
for(int x = 0; x < MATRIX_COLS; x++) {
|
||||
result |= (_SFR_IO8(col_pins[x] >> 4) & _BV(col_pins[x] & 0xF)) ? 0 : (1 << x);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static void unselect_rows(void)
|
||||
{
|
||||
for(int x = 0; x < ROWS_PER_HAND; x++) {
|
||||
_SFR_IO8((row_pins[x] >> 4) + 1) &= ~_BV(row_pins[x] & 0xF);
|
||||
_SFR_IO8((row_pins[x] >> 4) + 2) |= _BV(row_pins[x] & 0xF);
|
||||
}
|
||||
}
|
||||
|
||||
static void select_row(uint8_t row)
|
||||
{
|
||||
_SFR_IO8((row_pins[row] >> 4) + 1) |= _BV(row_pins[row] & 0xF);
|
||||
_SFR_IO8((row_pins[row] >> 4) + 2) &= ~_BV(row_pins[row] & 0xF);
|
||||
}
|
137
keyboards/deltasplit75/readme.md
Normal file
137
keyboards/deltasplit75/readme.md
Normal file
@@ -0,0 +1,137 @@
|
||||
DeltaSplit75
|
||||
======
|
||||
|
||||
This readme and most of the code are from https://github.com/ahtn/tmk_keyboard/ and https://github.com/qmk/qmk_firmware/tree/master/keyboards/lets_split
|
||||
|
||||
Credit to ahtn and wootpatoot for work on the split keyboard firmware
|
||||
|
||||
Split keyboard firmware for Arduino Pro Micro or other ATmega32u4
|
||||
based boards.
|
||||
|
||||
## Case Files
|
||||
Files are available here: https://github.com/xyxjj/DeltaSplit75-Case-files
|
||||
|
||||
## Build Guide
|
||||
The build guide should be found at https://qmk.fm/deltasplit75
|
||||
|
||||
|
||||
## First Time Setup
|
||||
|
||||
Download or clone the whole firmware and navigate to the keyboards/deltasplit75 directory. Once your dev env is setup, you'll be able to generate the .hex using:
|
||||
|
||||
```
|
||||
make v2
|
||||
|
||||
or
|
||||
|
||||
make v2-YOUR_KEYMAP_NAME (if you make a folder for your keymap)
|
||||
|
||||
or
|
||||
|
||||
make protosplit (if you have one of the prototype PCBs)
|
||||
```
|
||||
|
||||
You will see a lot of output and if everything worked correctly you will see the built hex files:
|
||||
|
||||
```
|
||||
deltasplit75_v2_protosplit.hex
|
||||
|
||||
or
|
||||
|
||||
deltasplit74_v2_YOUR_KEYMAP_NAME.hex
|
||||
|
||||
or
|
||||
|
||||
deltasplit75_v2_default.hex
|
||||
|
||||
```
|
||||
|
||||
|
||||
For more information on customizing keymaps, take a look at the primary documentation for [Customizing Your Keymap](/readme.md##customizing-your-keymap) in the main readme.md.
|
||||
|
||||
### DeltaSplit75 V2
|
||||
The PCBs available in groupbuy are all v2, if you've bought one of my prototype PCBs (it says DeltaSplit65 on the silkscreen instead of 75), use the code make protosplit instead
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
For the full Quantum Mechanical Keyboard feature list, see [the parent readme.md](/readme.md).
|
||||
|
||||
Some features supported by the firmware:
|
||||
|
||||
* Either half can connect to the computer via USB, or both halves can be used
|
||||
independently.
|
||||
* 75% formfactor
|
||||
* Support for multiple Bottom Rows
|
||||
* RGB underglow support
|
||||
* Split Backspace and ISO support
|
||||
|
||||
|
||||
Flashing
|
||||
-------
|
||||
I personally use xLoader to upload my hex files to the keyboard, though any other working software is fine too
|
||||
|
||||
|
||||
Choosing which board to plug the USB cable into (choosing Master)
|
||||
--------
|
||||
Because the two boards are identical, the firmware has logic to differentiate the left and right board.
|
||||
|
||||
It uses two strategies to figure things out: look at the EEPROM (memory on the chip) or looks if the current board has the usb cable.
|
||||
|
||||
The EEPROM approach requires additional setup (flashing the eeeprom) but allows you to swap the usb cable to either side.
|
||||
|
||||
The USB cable approach is easier to setup and if you just want the usb cable on the left board, you do not need to do anything extra.
|
||||
|
||||
### Setting the left hand as master
|
||||
If you always plug the usb cable into the left board, nothing extra is needed as this is the default. Comment out `EE_HANDS` and comment out `I2C_MASTER_RIGHT` or `MASTER_RIGHT` if for some reason it was set.
|
||||
|
||||
### Setting the right hand as master
|
||||
If you always plug the usb cable into the right board, add an extra flag to your `config.h`
|
||||
```
|
||||
#define MASTER_RIGHT
|
||||
```
|
||||
|
||||
### Setting EE_hands to use either hands as master
|
||||
If you define `EE_HANDS` in your `config.h`, you will need to set the
|
||||
EEPROM for the left and right halves.
|
||||
|
||||
The EEPROM is used to store whether the
|
||||
half is left handed or right handed. This makes it so that the same firmware
|
||||
file will run on both hands instead of having to flash left and right handed
|
||||
versions of the firmware to each half. To flash the EEPROM file for the left
|
||||
half run:
|
||||
```
|
||||
avrdude -p atmega32u4 -P $(COM_PORT) -c avr109 -U eeprom:w:eeprom-lefthand.eep
|
||||
// or the equivalent in dfu-programmer
|
||||
|
||||
```
|
||||
and similarly for right half
|
||||
```
|
||||
avrdude -p atmega32u4 -P $(COM_PORT) -c avr109 -U eeprom:w:eeprom-righhand.eep
|
||||
// or the equivalent in dfu-programmer
|
||||
```
|
||||
|
||||
NOTE: replace `$(COM_PORT)` with the port of your device (e.g. `/dev/ttyACM0`)
|
||||
|
||||
After you have flashed the EEPROM, you then need to set `EE_HANDS` in your config.h, rebuild the hex files and reflash.
|
||||
|
||||
Note that you need to program both halves, but you have the option of using
|
||||
different keymaps for each half. You could program the left half with a QWERTY
|
||||
layout and the right half with a Colemak layout using bootmagic's default layout option.
|
||||
Then if you connect the left half to a computer by USB the keyboard will use QWERTY and Colemak when the
|
||||
right half is connected.
|
||||
|
||||
|
||||
Notes on Using Pro Micro 3.3V
|
||||
-----------------------------
|
||||
|
||||
Do update the `F_CPU` parameter in `rules.mk` to `8000000` which reflects
|
||||
the frequency on the 3.3V board.
|
||||
|
||||
Also, if the slave board is producing weird characters in certain columns,
|
||||
update the following line in `matrix.c` to the following:
|
||||
|
||||
```
|
||||
// _delay_us(30); // without this wait read unstable value.
|
||||
_delay_us(300); // without this wait read unstable value.
|
||||
```
|
75
keyboards/deltasplit75/rules.mk
Normal file
75
keyboards/deltasplit75/rules.mk
Normal file
@@ -0,0 +1,75 @@
|
||||
SRC += matrix.c \
|
||||
i2c.c \
|
||||
split_util.c \
|
||||
serial.c
|
||||
|
||||
# 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)
|
||||
|
||||
# Interrupt driven control endpoint task(+60)
|
||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
|
||||
|
||||
# Boot Section Size in *bytes*
|
||||
# Teensy halfKay 512
|
||||
# Teensy++ halfKay 1024
|
||||
# Atmel DFU loader 4096
|
||||
# LUFA bootloader 4096
|
||||
# USBaspLoader 2048
|
||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
||||
|
||||
# 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 ?= yes # 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. Do not enable this with audio at the same time.
|
||||
SUBPROJECT_rev1 ?= yes
|
||||
USE_I2C ?= yes
|
||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
|
||||
|
||||
CUSTOM_MATRIX = yes
|
228
keyboards/deltasplit75/serial.c
Normal file
228
keyboards/deltasplit75/serial.c
Normal file
@@ -0,0 +1,228 @@
|
||||
/*
|
||||
* WARNING: be careful changing this code, it is very timing dependent
|
||||
*/
|
||||
|
||||
#ifndef F_CPU
|
||||
#define F_CPU 16000000
|
||||
#endif
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <util/delay.h>
|
||||
#include <stdbool.h>
|
||||
#include "serial.h"
|
||||
|
||||
#ifdef USE_SERIAL
|
||||
|
||||
// Serial pulse period in microseconds. Its probably a bad idea to lower this
|
||||
// value.
|
||||
#define SERIAL_DELAY 24
|
||||
|
||||
uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
|
||||
uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
|
||||
|
||||
#define SLAVE_DATA_CORRUPT (1<<0)
|
||||
volatile uint8_t status = 0;
|
||||
|
||||
inline static
|
||||
void serial_delay(void) {
|
||||
_delay_us(SERIAL_DELAY);
|
||||
}
|
||||
|
||||
inline static
|
||||
void serial_output(void) {
|
||||
SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
|
||||
}
|
||||
|
||||
// make the serial pin an input with pull-up resistor
|
||||
inline static
|
||||
void serial_input(void) {
|
||||
SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK;
|
||||
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
|
||||
}
|
||||
|
||||
inline static
|
||||
uint8_t serial_read_pin(void) {
|
||||
return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
|
||||
}
|
||||
|
||||
inline static
|
||||
void serial_low(void) {
|
||||
SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
|
||||
}
|
||||
|
||||
inline static
|
||||
void serial_high(void) {
|
||||
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
|
||||
}
|
||||
|
||||
void serial_master_init(void) {
|
||||
serial_output();
|
||||
serial_high();
|
||||
}
|
||||
|
||||
void serial_slave_init(void) {
|
||||
serial_input();
|
||||
|
||||
// Enable INT0
|
||||
EIMSK |= _BV(INT0);
|
||||
// Trigger on falling edge of INT0
|
||||
EICRA &= ~(_BV(ISC00) | _BV(ISC01));
|
||||
}
|
||||
|
||||
// Used by the master to synchronize timing with the slave.
|
||||
static
|
||||
void sync_recv(void) {
|
||||
serial_input();
|
||||
// This shouldn't hang if the slave disconnects because the
|
||||
// serial line will float to high if the slave does disconnect.
|
||||
while (!serial_read_pin());
|
||||
serial_delay();
|
||||
}
|
||||
|
||||
// Used by the slave to send a synchronization signal to the master.
|
||||
static
|
||||
void sync_send(void) {
|
||||
serial_output();
|
||||
|
||||
serial_low();
|
||||
serial_delay();
|
||||
|
||||
serial_high();
|
||||
}
|
||||
|
||||
// Reads a byte from the serial line
|
||||
static
|
||||
uint8_t serial_read_byte(void) {
|
||||
uint8_t byte = 0;
|
||||
serial_input();
|
||||
for ( uint8_t i = 0; i < 8; ++i) {
|
||||
byte = (byte << 1) | serial_read_pin();
|
||||
serial_delay();
|
||||
_delay_us(1);
|
||||
}
|
||||
|
||||
return byte;
|
||||
}
|
||||
|
||||
// Sends a byte with MSB ordering
|
||||
static
|
||||
void serial_write_byte(uint8_t data) {
|
||||
uint8_t b = 8;
|
||||
serial_output();
|
||||
while( b-- ) {
|
||||
if(data & (1 << b)) {
|
||||
serial_high();
|
||||
} else {
|
||||
serial_low();
|
||||
}
|
||||
serial_delay();
|
||||
}
|
||||
}
|
||||
|
||||
// interrupt handle to be used by the slave device
|
||||
ISR(SERIAL_PIN_INTERRUPT) {
|
||||
sync_send();
|
||||
|
||||
uint8_t checksum = 0;
|
||||
for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
|
||||
serial_write_byte(serial_slave_buffer[i]);
|
||||
sync_send();
|
||||
checksum += serial_slave_buffer[i];
|
||||
}
|
||||
serial_write_byte(checksum);
|
||||
sync_send();
|
||||
|
||||
// wait for the sync to finish sending
|
||||
serial_delay();
|
||||
|
||||
// read the middle of pulses
|
||||
_delay_us(SERIAL_DELAY/2);
|
||||
|
||||
uint8_t checksum_computed = 0;
|
||||
for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
|
||||
serial_master_buffer[i] = serial_read_byte();
|
||||
sync_send();
|
||||
checksum_computed += serial_master_buffer[i];
|
||||
}
|
||||
uint8_t checksum_received = serial_read_byte();
|
||||
sync_send();
|
||||
|
||||
serial_input(); // end transaction
|
||||
|
||||
if ( checksum_computed != checksum_received ) {
|
||||
status |= SLAVE_DATA_CORRUPT;
|
||||
} else {
|
||||
status &= ~SLAVE_DATA_CORRUPT;
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
bool serial_slave_DATA_CORRUPT(void) {
|
||||
return status & SLAVE_DATA_CORRUPT;
|
||||
}
|
||||
|
||||
// Copies the serial_slave_buffer to the master and sends the
|
||||
// serial_master_buffer to the slave.
|
||||
//
|
||||
// Returns:
|
||||
// 0 => no error
|
||||
// 1 => slave did not respond
|
||||
int serial_update_buffers(void) {
|
||||
// this code is very time dependent, so we need to disable interrupts
|
||||
cli();
|
||||
|
||||
// signal to the slave that we want to start a transaction
|
||||
serial_output();
|
||||
serial_low();
|
||||
_delay_us(1);
|
||||
|
||||
// wait for the slaves response
|
||||
serial_input();
|
||||
serial_high();
|
||||
_delay_us(SERIAL_DELAY);
|
||||
|
||||
// check if the slave is present
|
||||
if (serial_read_pin()) {
|
||||
// slave failed to pull the line low, assume not present
|
||||
sei();
|
||||
return 1;
|
||||
}
|
||||
|
||||
// if the slave is present syncronize with it
|
||||
sync_recv();
|
||||
|
||||
uint8_t checksum_computed = 0;
|
||||
// receive data from the slave
|
||||
for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
|
||||
serial_slave_buffer[i] = serial_read_byte();
|
||||
sync_recv();
|
||||
checksum_computed += serial_slave_buffer[i];
|
||||
}
|
||||
uint8_t checksum_received = serial_read_byte();
|
||||
sync_recv();
|
||||
|
||||
if (checksum_computed != checksum_received) {
|
||||
sei();
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t checksum = 0;
|
||||
// send data to the slave
|
||||
for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
|
||||
serial_write_byte(serial_master_buffer[i]);
|
||||
sync_recv();
|
||||
checksum += serial_master_buffer[i];
|
||||
}
|
||||
serial_write_byte(checksum);
|
||||
sync_recv();
|
||||
|
||||
// always, release the line when not in use
|
||||
serial_output();
|
||||
serial_high();
|
||||
|
||||
sei();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
26
keyboards/deltasplit75/serial.h
Normal file
26
keyboards/deltasplit75/serial.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef MY_SERIAL_H
|
||||
#define MY_SERIAL_H
|
||||
|
||||
#include "config.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
/* TODO: some defines for interrupt setup */
|
||||
#define SERIAL_PIN_DDR DDRD
|
||||
#define SERIAL_PIN_PORT PORTD
|
||||
#define SERIAL_PIN_INPUT PIND
|
||||
#define SERIAL_PIN_MASK _BV(PD0)
|
||||
#define SERIAL_PIN_INTERRUPT INT0_vect
|
||||
|
||||
#define SERIAL_SLAVE_BUFFER_LENGTH ((MATRIX_COLS+7)/8 *MATRIX_ROWS/2)
|
||||
#define SERIAL_MASTER_BUFFER_LENGTH 1
|
||||
|
||||
// Buffers for master - slave communication
|
||||
extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
|
||||
extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
|
||||
|
||||
void serial_master_init(void);
|
||||
void serial_slave_init(void);
|
||||
int serial_update_buffers(void);
|
||||
bool serial_slave_data_corrupt(void);
|
||||
|
||||
#endif
|
81
keyboards/deltasplit75/split_util.c
Normal file
81
keyboards/deltasplit75/split_util.c
Normal file
@@ -0,0 +1,81 @@
|
||||
#include <avr/io.h>
|
||||
#include <avr/wdt.h>
|
||||
#include <avr/power.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <util/delay.h>
|
||||
#include <avr/eeprom.h>
|
||||
#include "split_util.h"
|
||||
#include "matrix.h"
|
||||
#include "keyboard.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef USE_I2C
|
||||
# include "i2c.h"
|
||||
#else
|
||||
# include "serial.h"
|
||||
#endif
|
||||
|
||||
volatile bool isLeftHand = true;
|
||||
|
||||
static void setup_handedness(void) {
|
||||
#ifdef EE_HANDS
|
||||
isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
|
||||
#else
|
||||
// I2C_MASTER_RIGHT is deprecated use MASTER_RIGHT instead since this works for both serial and i2c
|
||||
#if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
|
||||
isLeftHand = !has_usb();
|
||||
#else
|
||||
isLeftHand = has_usb();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void keyboard_master_setup(void) {
|
||||
#ifdef USE_I2C
|
||||
i2c_master_init();
|
||||
#else
|
||||
serial_master_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void keyboard_slave_setup(void) {
|
||||
#ifdef USE_I2C
|
||||
i2c_slave_init(SLAVE_I2C_ADDRESS);
|
||||
#else
|
||||
serial_slave_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool has_usb(void) {
|
||||
USBCON |= (1 << OTGPADE); //enables VBUS pad
|
||||
_delay_us(5);
|
||||
return (USBSTA & (1<<VBUS)); //checks state of VBUS
|
||||
}
|
||||
|
||||
void split_keyboard_setup(void) {
|
||||
setup_handedness();
|
||||
|
||||
if (has_usb()) {
|
||||
keyboard_master_setup();
|
||||
} else {
|
||||
keyboard_slave_setup();
|
||||
}
|
||||
sei();
|
||||
}
|
||||
|
||||
void keyboard_slave_loop(void) {
|
||||
matrix_init();
|
||||
|
||||
while (1) {
|
||||
matrix_slave_scan();
|
||||
}
|
||||
}
|
||||
|
||||
// this code runs before the usb and keyboard is initialized
|
||||
void matrix_setup(void) {
|
||||
split_keyboard_setup();
|
||||
|
||||
if (!has_usb()) {
|
||||
keyboard_slave_loop();
|
||||
}
|
||||
}
|
22
keyboards/deltasplit75/split_util.h
Normal file
22
keyboards/deltasplit75/split_util.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef SPLIT_KEYBOARD_UTIL_H
|
||||
#define SPLIT_KEYBOARD_UTIL_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef EE_HANDS
|
||||
#define EECONFIG_BOOTMAGIC_END (uint8_t *)10
|
||||
#define EECONFIG_HANDEDNESS EECONFIG_BOOTMAGIC_END
|
||||
#endif
|
||||
|
||||
#define SLAVE_I2C_ADDRESS 0x32
|
||||
|
||||
extern volatile bool isLeftHand;
|
||||
|
||||
// slave version of matix scan, defined in matrix.c
|
||||
void matrix_slave_scan(void);
|
||||
|
||||
void split_keyboard_setup(void);
|
||||
bool has_usb(void);
|
||||
void keyboard_slave_loop(void);
|
||||
|
||||
#endif
|
3
keyboards/deltasplit75/v2/Makefile
Normal file
3
keyboards/deltasplit75/v2/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
ifndef MAKEFILE_INCLUDED
|
||||
include ../../Makefile
|
||||
endif
|
90
keyboards/deltasplit75/v2/config.h
Normal file
90
keyboards/deltasplit75/v2/config.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0xFEED
|
||||
#define PRODUCT_ID 0x3060
|
||||
#define DEVICE_VER 0x0001
|
||||
#define MANUFACTURER xyxjj
|
||||
#define PRODUCT DeltaSplit75
|
||||
#define DESCRIPTION 75% split keyboard
|
||||
|
||||
/* key matrix size */
|
||||
// Rows are doubled-up
|
||||
#define MATRIX_ROWS 14
|
||||
#define MATRIX_COLS 8
|
||||
|
||||
// wiring of each half
|
||||
#define MATRIX_ROW_PINS { F4, F5, F6, F7, B1, B3, B2 }
|
||||
#define MATRIX_COL_PINS { B6, B5, B4, E6, D7, C6, D4, D1}
|
||||
|
||||
#define CATERINA_BOOTLOADER
|
||||
|
||||
/* COL2ROW or ROW2COL */
|
||||
#define DIODE_DIRECTION COL2ROW
|
||||
|
||||
/* define if matrix has ghost */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
||||
/* number of backlight levels */
|
||||
// #define BACKLIGHT_LEVELS 3
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
/* Locking resynchronize hack */
|
||||
#define LOCKING_RESYNC_ENABLE
|
||||
|
||||
/* key combination for command */
|
||||
#define IS_COMMAND() ( \
|
||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||
)
|
||||
|
||||
/* ws2812 RGB LED */
|
||||
#define RGB_DI_PIN D3
|
||||
#define RGBLIGHT_TIMER
|
||||
#define RGBLED_NUM 12 // Number of LEDs
|
||||
#define ws2812_PORTREG PORTD
|
||||
#define ws2812_DDRREG DDRD
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
|
||||
#endif
|
5
keyboards/deltasplit75/v2/rules.mk
Normal file
5
keyboards/deltasplit75/v2/rules.mk
Normal file
@@ -0,0 +1,5 @@
|
||||
BACKLIGHT_ENABLE = no
|
||||
|
||||
ifndef QUANTUM_DIR
|
||||
include ../../../Makefile
|
||||
endif
|
14
keyboards/deltasplit75/v2/v2.c
Normal file
14
keyboards/deltasplit75/v2/v2.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "deltasplit75.h"
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
// // green led on
|
||||
// DDRD |= (1<<5);
|
||||
// PORTD &= ~(1<<5);
|
||||
|
||||
// // orange led on
|
||||
// DDRB |= (1<<0);
|
||||
// PORTB &= ~(1<<0);
|
||||
|
||||
matrix_init_user();
|
||||
};
|
||||
|
62
keyboards/deltasplit75/v2/v2.h
Normal file
62
keyboards/deltasplit75/v2/v2.h
Normal file
@@ -0,0 +1,62 @@
|
||||
#ifndef V2_H
|
||||
#define V2_H
|
||||
|
||||
#include "deltasplit75.h"
|
||||
|
||||
//void promicro_bootloader_jmp(bool program);
|
||||
#include "quantum.h"
|
||||
|
||||
//void promicro_bootloader_jmp(bool program);
|
||||
//matrix is defined in a weird way here; the layout on both sides are asymmetrical, but the "matrix" is symmetrical but with empty gaps
|
||||
//the last column is defined as a separate row because the firmware currently doesnt support more than 8 columns (this layout has 9 columns per side) K45 and K110 are the Bs on both sides; K53 and K106 are extra keys for ISO
|
||||
#define KEYMAP_V2( \
|
||||
K00, K01, K02, K03, K04, K05, K06, K70, K71, K72, K73, K74, K75, K76, K77, K132, \
|
||||
K10, K11, K12, K13, K14, K15, K16, K80, K81, K82, K83, K84, K85, K86, K87, K133, \
|
||||
K20, K21, K22, K23, K24, K25, K90, K91, K92, K93, K94, K95, K96, K97, K134, \
|
||||
K30, K31, K32, K33, K34, K35, K100, K101, K102, K103, K104, K105, K106, K107, K135, \
|
||||
K40, K53, K41, K42, K43, K44, K45, K110, K111, K112, K113, K114, K115, K116, K117, K136, \
|
||||
K50, K51, K52, K54, K55, K120, K121, K122, K123, K126, K127, K137 \
|
||||
) \
|
||||
{ \
|
||||
{ K00, K01, K02, K03, K04, K05, K06, KC_NO}, \
|
||||
{ K10, K11, K12, K13, K14, K15, K16, KC_NO}, \
|
||||
{ K20, K21, K22, K23, K24, K25, KC_NO, KC_NO}, \
|
||||
{ K30, K31, K32, K33, K34, K35, KC_NO, KC_NO}, \
|
||||
{ K40, K41, K42, K43, K44, K45, KC_NO, KC_NO}, \
|
||||
{ K50, K51, K52, K53, K54, K55, KC_NO, KC_NO}, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO}, \
|
||||
{ K70 , K71, K72, K73, K74, K75, K76, K77}, \
|
||||
{ K80, K81, K82, K83, K84, K85, K86, K87}, \
|
||||
{ K90, K91, K92, K93, K94, K95, K96, K97}, \
|
||||
{ K100, K101, K102, K103, K104, K105, K106, K107}, \
|
||||
{ K110, K111, K112, K113, K114, K115, K116, K117}, \
|
||||
{ K120, K121, K122, K123, KC_NO, KC_NO, K126, K127}, \
|
||||
{ KC_NO, KC_NO, K132, K133, K134, K135, K136, K137} \
|
||||
}
|
||||
|
||||
#define KEYMAP_PROTOSPLIT( \
|
||||
K00, K01, K02, K03, K04, K05, K06, K70, K71, K72, K73, K74, K75, K76, K77, K132, \
|
||||
K10, K11, K12, K13, K14, K15, K16, K80, K81, K82, K83, K84, K85, K86, K87, K133, \
|
||||
K20, K21, K22, K23, K24, K25, K90, K91, K92, K93, K94, K95, K96, K97, K134, \
|
||||
K30, K31, K32, K33, K34, K35, K100, K101, K102, K103, K104, K105, K107, K135, \
|
||||
K40, K41, K42, K43, K44, K45, K110, K111, K112, K113, K114, K115, K116, K117, K136, \
|
||||
K50, K51, K52, K54, K55, K120, K121, K122, K123, K126, K127, K137 \
|
||||
) \
|
||||
{ \
|
||||
{ K00, K01, K02, K03, K04, K05, K06, KC_NO}, \
|
||||
{ K10, K11, K12, K13, K14, K15, K16, KC_NO}, \
|
||||
{ K20, K21, K22, K23, K24, K25, KC_NO, KC_NO}, \
|
||||
{ K30, K31, K32, K33, K34, K35, KC_NO, KC_NO}, \
|
||||
{ K40, K41, K42, K43, K44, K45, KC_NO, KC_NO}, \
|
||||
{ K50, K51, K52, KC_NO, K54, K55, KC_NO, KC_NO}, \
|
||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO}, \
|
||||
{ K70 , K71, K72, K73, K74, K75, K76, K77}, \
|
||||
{ K80, K81, K82, K83, K84, K85, K86, K87}, \
|
||||
{ K90, K91, K92, K93, K94, K95, K96, K97}, \
|
||||
{ K100, K101, K102, K103, K104, K105, KC_NO, K107}, \
|
||||
{ K110, K111, K112, K113, K114, K115, K116, K117}, \
|
||||
{ K120, K121, K122, K123, KC_NO, KC_NO, K126, K127}, \
|
||||
{ KC_NO, KC_NO, K132, K133, K134, K135, K136, K137} \
|
||||
}
|
||||
|
||||
#endif
|
110
keyboards/ergodox/infinity/board_is31fl3731c.h
Normal file
110
keyboards/ergodox/infinity/board_is31fl3731c.h
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
Copyright 2016 Fred Sundvik <fsundvik@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/>.
|
||||
*/
|
||||
|
||||
#ifndef _GDISP_LLD_BOARD_H
|
||||
#define _GDISP_LLD_BOARD_H
|
||||
|
||||
static const I2CConfig i2ccfg = {
|
||||
400000 // clock speed (Hz); 400kHz max for IS31
|
||||
};
|
||||
|
||||
static const uint8_t led_mask[] = {
|
||||
0xFF, 0x00, /* C1-1 -> C1-16 */
|
||||
0xFF, 0x00, /* C2-1 -> C2-16 */
|
||||
0xFF, 0x00, /* C3-1 -> C3-16 */
|
||||
0xFF, 0x00, /* C4-1 -> C4-16 */
|
||||
0x3F, 0x00, /* C5-1 -> C5-16 */
|
||||
0x00, 0x00, /* C6-1 -> C6-16 */
|
||||
0x00, 0x00, /* C7-1 -> C7-16 */
|
||||
0x00, 0x00, /* C8-1 -> C8-16 */
|
||||
0x00, 0x00, /* C9-1 -> C9-16 */
|
||||
};
|
||||
|
||||
// The address of the LED
|
||||
#define LA(c, r) (c + r * 16 )
|
||||
// Need to be an address that is not mapped, but inside the range of the controller matrix
|
||||
#define NA LA(8, 8)
|
||||
|
||||
// The numbers in the comments are the led numbers DXX on the PCB
|
||||
// The mapping is taken from the schematic of left hand side
|
||||
static const uint8_t led_mapping[GDISP_SCREEN_HEIGHT][GDISP_SCREEN_WIDTH] = {
|
||||
// 45 44 43 42 41 40 39
|
||||
{ LA(1, 1), LA(1, 0), LA(0, 4), LA(0, 3), LA(0, 2), LA(0, 1), LA(0, 0)},
|
||||
// 52 51 50 49 48 47 46
|
||||
{ LA(2, 3), LA(2, 2), LA(2, 1), LA(2, 0), LA(1, 4), LA(1, 3), LA(1, 2) },
|
||||
// 58 57 56 55 54 53 N/A
|
||||
{ LA(3, 4), LA(3, 3), LA(3, 2), LA(3, 1), LA(3, 0), LA(2, 4), NA },
|
||||
// 67 66 65 64 63 62 61
|
||||
{ LA(5, 3), LA(5, 2), LA(5, 1), LA(5, 0), LA(4, 4), LA(4, 3), LA(4, 2) },
|
||||
// 76 75 74 73 72 60 59
|
||||
{ LA(7, 3), LA(7, 2), LA(7, 1), LA(7, 0), LA(6, 3), LA(4, 1), LA(4, 0) },
|
||||
// N/A N/A N/A N/A N/A N/A 68
|
||||
{ NA, NA, NA, NA, NA, NA, LA(5, 4) },
|
||||
// N/A N/A N/A N/A 71 70 69
|
||||
{ NA, NA, NA, NA, LA(6, 2), LA(6, 1), LA(6, 0) },
|
||||
};
|
||||
|
||||
|
||||
#define IS31_ADDR_DEFAULT 0x74 // AD connected to GND
|
||||
#define IS31_TIMEOUT 5000
|
||||
|
||||
static GFXINLINE void init_board(GDisplay *g) {
|
||||
(void) g;
|
||||
/* I2C pins */
|
||||
palSetPadMode(GPIOB, 0, PAL_MODE_ALTERNATIVE_2); // PTB0/I2C0/SCL
|
||||
palSetPadMode(GPIOB, 1, PAL_MODE_ALTERNATIVE_2); // PTB1/I2C0/SDA
|
||||
palSetPadMode(GPIOB, 16, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palClearPad(GPIOB, 16);
|
||||
/* start I2C */
|
||||
i2cStart(&I2CD1, &i2ccfg);
|
||||
// try high drive (from kiibohd)
|
||||
I2CD1.i2c->C2 |= I2Cx_C2_HDRS;
|
||||
// try glitch fixing (from kiibohd)
|
||||
I2CD1.i2c->FLT = 4;
|
||||
}
|
||||
|
||||
static GFXINLINE void post_init_board(GDisplay *g) {
|
||||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE const uint8_t* get_led_mask(GDisplay* g) {
|
||||
(void) g;
|
||||
return led_mask;
|
||||
}
|
||||
|
||||
static GFXINLINE uint8_t get_led_address(GDisplay* g, uint16_t x, uint16_t y)
|
||||
{
|
||||
(void) g;
|
||||
return led_mapping[y][x];
|
||||
}
|
||||
|
||||
static GFXINLINE void set_hardware_shutdown(GDisplay* g, bool shutdown) {
|
||||
(void) g;
|
||||
if(!shutdown) {
|
||||
palSetPad(GPIOB, 16);
|
||||
}
|
||||
else {
|
||||
palClearPad(GPIOB, 16);
|
||||
}
|
||||
}
|
||||
|
||||
static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
|
||||
(void) g;
|
||||
i2cMasterTransmitTimeout(&I2CD1, IS31_ADDR_DEFAULT, data, length, 0, 0, US2ST(IS31_TIMEOUT));
|
||||
}
|
||||
|
||||
#endif /* _GDISP_LLD_BOARD_H */
|
113
keyboards/ergodox/infinity/board_st7565.h
Normal file
113
keyboards/ergodox/infinity/board_st7565.h
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#ifndef _GDISP_LLD_BOARD_H
|
||||
#define _GDISP_LLD_BOARD_H
|
||||
|
||||
#define ST7565_LCD_BIAS ST7565_LCD_BIAS_9 // actually 6
|
||||
#define ST7565_ADC ST7565_ADC_NORMAL
|
||||
#define ST7565_COM_SCAN ST7565_COM_SCAN_DEC
|
||||
#define ST7565_PAGE_ORDER 0,1,2,3
|
||||
/*
|
||||
* Custom page order for several LCD boards, e.g. HEM12864-99
|
||||
* #define ST7565_PAGE_ORDER 4,5,6,7,0,1,2,3
|
||||
*/
|
||||
|
||||
#define ST7565_GPIOPORT GPIOC
|
||||
#define ST7565_PORT PORTC
|
||||
#define ST7565_A0_PIN 7
|
||||
#define ST7565_RST_PIN 8
|
||||
#define ST7565_MOSI_PIN 6
|
||||
#define ST7565_SLCK_PIN 5
|
||||
#define ST7565_SS_PIN 4
|
||||
|
||||
#define palSetPadModeRaw(portname, bits) \
|
||||
ST7565_PORT->PCR[ST7565_##portname##_PIN] = bits
|
||||
|
||||
#define palSetPadModeNamed(portname, portmode) \
|
||||
palSetPadMode(ST7565_GPIOPORT, ST7565_##portname##_PIN, portmode)
|
||||
|
||||
#define ST7565_SPI_MODE PORTx_PCRn_DSE | PORTx_PCRn_MUX(2)
|
||||
// DSPI Clock and Transfer Attributes
|
||||
// Frame Size: 8 bits
|
||||
// MSB First
|
||||
// CLK Low by default
|
||||
static const SPIConfig spi1config = {
|
||||
// Operation complete callback or @p NULL.
|
||||
.end_cb = NULL,
|
||||
//The chip select line port - when not using pcs.
|
||||
.ssport = ST7565_GPIOPORT,
|
||||
// brief The chip select line pad number - when not using pcs.
|
||||
.sspad=ST7565_SS_PIN,
|
||||
// SPI initialization data.
|
||||
.tar0 =
|
||||
SPIx_CTARn_FMSZ(7) // Frame size = 8 bytes
|
||||
| SPIx_CTARn_ASC(1) // After SCK Delay Scaler (min 50 ns) = 55.56ns
|
||||
| SPIx_CTARn_DT(0) // Delay After Transfer Scaler (no minimum)= 27.78ns
|
||||
| SPIx_CTARn_CSSCK(0) // PCS to SCK Delay Scaler (min 20 ns) = 27.78ns
|
||||
| SPIx_CTARn_PBR(0) // Baud Rate Prescaler = 2
|
||||
| SPIx_CTARn_BR(0) // Baud rate (min 50ns) = 55.56ns
|
||||
};
|
||||
|
||||
static GFXINLINE void acquire_bus(GDisplay *g) {
|
||||
(void) g;
|
||||
// Only the LCD is using the SPI bus, so no need to acquire
|
||||
// spiAcquireBus(&SPID1);
|
||||
spiSelect(&SPID1);
|
||||
}
|
||||
|
||||
static GFXINLINE void release_bus(GDisplay *g) {
|
||||
(void) g;
|
||||
// Only the LCD is using the SPI bus, so no need to release
|
||||
//spiReleaseBus(&SPID1);
|
||||
spiUnselect(&SPID1);
|
||||
}
|
||||
|
||||
static GFXINLINE void init_board(GDisplay *g) {
|
||||
(void) g;
|
||||
palSetPadModeNamed(A0, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN);
|
||||
palSetPadModeNamed(RST, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN);
|
||||
palSetPadModeRaw(MOSI, ST7565_SPI_MODE);
|
||||
palSetPadModeRaw(SLCK, ST7565_SPI_MODE);
|
||||
palSetPadModeNamed(SS, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
|
||||
spiInit();
|
||||
spiStart(&SPID1, &spi1config);
|
||||
release_bus(g);
|
||||
}
|
||||
|
||||
static GFXINLINE void post_init_board(GDisplay *g) {
|
||||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
(void) g;
|
||||
if (state) {
|
||||
palClearPad(ST7565_GPIOPORT, ST7565_RST_PIN);
|
||||
}
|
||||
else {
|
||||
palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN);
|
||||
}
|
||||
}
|
||||
|
||||
static GFXINLINE void enter_data_mode(GDisplay *g) {
|
||||
palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN);
|
||||
}
|
||||
|
||||
static GFXINLINE void enter_cmd_mode(GDisplay *g) {
|
||||
palClearPad(ST7565_GPIOPORT, ST7565_A0_PIN);
|
||||
}
|
||||
|
||||
|
||||
static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
|
||||
(void) g;
|
||||
spiSend(&SPID1, length, data);
|
||||
}
|
||||
|
||||
#endif /* _GDISP_LLD_BOARD_H */
|
@@ -51,16 +51,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#define SERIAL_LINK_BAUD 562500
|
||||
#define SERIAL_LINK_THREAD_PRIORITY (NORMALPRIO - 1)
|
||||
// The visualizer needs gfx thread priorities
|
||||
#define VISUALIZER_THREAD_PRIORITY (NORMAL_PRIORITY - 2)
|
||||
|
||||
#define VISUALIZER_USER_DATA_SIZE 16
|
||||
|
||||
#define LCD_DISPLAY_NUMBER 0
|
||||
#define LED_DISPLAY_NUMBER 1
|
||||
|
||||
#define LED_NUM_ROWS 7
|
||||
#define LED_NUM_COLS 7
|
||||
/*
|
||||
* Feature disable options
|
||||
* These options are also useful to firmware size reduction.
|
||||
|
@@ -1,2 +0,0 @@
|
||||
GFXINC += drivers/gdisp/IS31FL3731C
|
||||
GFXSRC += drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c
|
@@ -1,312 +0,0 @@
|
||||
/*
|
||||
Copyright 2016 Fred Sundvik <fsundvik@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "gfx.h"
|
||||
|
||||
#if GFX_USE_GDISP
|
||||
|
||||
#define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_ERGODOX
|
||||
#include "drivers/gdisp/IS31FL3731C/gdisp_lld_config.h"
|
||||
#include "src/gdisp/gdisp_driver.h"
|
||||
|
||||
#include "board_IS31FL3731C.h"
|
||||
|
||||
|
||||
// Can't include led_tables from here
|
||||
extern const uint8_t CIE1931_CURVE[];
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifndef GDISP_SCREEN_HEIGHT
|
||||
#define GDISP_SCREEN_HEIGHT 9
|
||||
#endif
|
||||
#ifndef GDISP_SCREEN_WIDTH
|
||||
#define GDISP_SCREEN_WIDTH 16
|
||||
#endif
|
||||
#ifndef GDISP_INITIAL_CONTRAST
|
||||
#define GDISP_INITIAL_CONTRAST 0
|
||||
#endif
|
||||
#ifndef GDISP_INITIAL_BACKLIGHT
|
||||
#define GDISP_INITIAL_BACKLIGHT 0
|
||||
#endif
|
||||
|
||||
#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
|
||||
|
||||
#define IS31_ADDR_DEFAULT 0x74
|
||||
|
||||
#define IS31_REG_CONFIG 0x00
|
||||
// bits in reg
|
||||
#define IS31_REG_CONFIG_PICTUREMODE 0x00
|
||||
#define IS31_REG_CONFIG_AUTOPLAYMODE 0x08
|
||||
#define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18
|
||||
// D2:D0 bits are starting frame for autoplay mode
|
||||
|
||||
#define IS31_REG_PICTDISP 0x01 // D2:D0 frame select for picture mode
|
||||
|
||||
#define IS31_REG_AUTOPLAYCTRL1 0x02
|
||||
// D6:D4 number of loops (000=infty)
|
||||
// D2:D0 number of frames to be used
|
||||
|
||||
#define IS31_REG_AUTOPLAYCTRL2 0x03 // D5:D0 delay time (*11ms)
|
||||
|
||||
#define IS31_REG_DISPLAYOPT 0x05
|
||||
#define IS31_REG_DISPLAYOPT_INTENSITY_SAME 0x20 // same intensity for all frames
|
||||
#define IS31_REG_DISPLAYOPT_BLINK_ENABLE 0x8
|
||||
// D2:D0 bits blink period time (*0.27s)
|
||||
|
||||
#define IS31_REG_AUDIOSYNC 0x06
|
||||
#define IS31_REG_AUDIOSYNC_ENABLE 0x1
|
||||
|
||||
#define IS31_REG_FRAMESTATE 0x07
|
||||
|
||||
#define IS31_REG_BREATHCTRL1 0x08
|
||||
// D6:D4 fade out time (26ms*2^i)
|
||||
// D2:D0 fade in time (26ms*2^i)
|
||||
|
||||
#define IS31_REG_BREATHCTRL2 0x09
|
||||
#define IS31_REG_BREATHCTRL2_ENABLE 0x10
|
||||
// D2:D0 extinguish time (3.5ms*2^i)
|
||||
|
||||
#define IS31_REG_SHUTDOWN 0x0A
|
||||
#define IS31_REG_SHUTDOWN_OFF 0x0
|
||||
#define IS31_REG_SHUTDOWN_ON 0x1
|
||||
|
||||
#define IS31_REG_AGCCTRL 0x0B
|
||||
#define IS31_REG_ADCRATE 0x0C
|
||||
|
||||
#define IS31_COMMANDREGISTER 0xFD
|
||||
#define IS31_FUNCTIONREG 0x0B // helpfully called 'page nine'
|
||||
#define IS31_FUNCTIONREG_SIZE 0xD
|
||||
|
||||
#define IS31_FRAME_SIZE 0xB4
|
||||
|
||||
#define IS31_PWM_REG 0x24
|
||||
#define IS31_PWM_SIZE 0x90
|
||||
|
||||
#define IS31_LED_MASK_SIZE 0x12
|
||||
#define IS31_SCREEN_WIDTH 16
|
||||
|
||||
#define IS31
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
typedef struct{
|
||||
uint8_t write_buffer_offset;
|
||||
uint8_t write_buffer[IS31_FRAME_SIZE];
|
||||
uint8_t frame_buffer[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH];
|
||||
uint8_t page;
|
||||
}__attribute__((__packed__)) PrivData;
|
||||
|
||||
// Some common routines and macros
|
||||
#define PRIV(g) ((PrivData*)g->priv)
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
static GFXINLINE void write_page(GDisplay* g, uint8_t page) {
|
||||
uint8_t tx[2] __attribute__((aligned(2)));
|
||||
tx[0] = IS31_COMMANDREGISTER;
|
||||
tx[1] = page;
|
||||
write_data(g, tx, 2);
|
||||
}
|
||||
|
||||
static GFXINLINE void write_register(GDisplay* g, uint8_t page, uint8_t reg, uint8_t data) {
|
||||
uint8_t tx[2] __attribute__((aligned(2)));
|
||||
tx[0] = reg;
|
||||
tx[1] = data;
|
||||
write_page(g, page);
|
||||
write_data(g, tx, 2);
|
||||
}
|
||||
|
||||
static GFXINLINE void write_ram(GDisplay *g, uint8_t page, uint16_t offset, uint16_t length) {
|
||||
PRIV(g)->write_buffer_offset = offset;
|
||||
write_page(g, page);
|
||||
write_data(g, (uint8_t*)PRIV(g), length + 1);
|
||||
}
|
||||
|
||||
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
||||
// The private area is the display surface.
|
||||
g->priv = gfxAlloc(sizeof(PrivData));
|
||||
__builtin_memset(PRIV(g), 0, sizeof(PrivData));
|
||||
PRIV(g)->page = 0;
|
||||
|
||||
// Initialise the board interface
|
||||
init_board(g);
|
||||
gfxSleepMilliseconds(10);
|
||||
|
||||
// zero function page, all registers (assuming full_page is all zeroes)
|
||||
write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
|
||||
set_hardware_shutdown(g, false);
|
||||
gfxSleepMilliseconds(10);
|
||||
// software shutdown
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
|
||||
gfxSleepMilliseconds(10);
|
||||
// zero function page, all registers
|
||||
write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
|
||||
gfxSleepMilliseconds(10);
|
||||
|
||||
|
||||
// zero all LED registers on all 8 pages, and enable the mask
|
||||
__builtin_memcpy(PRIV(g)->write_buffer, get_led_mask(g), IS31_LED_MASK_SIZE);
|
||||
for(uint8_t i=0; i<8; i++) {
|
||||
write_ram(g, i, 0, IS31_FRAME_SIZE);
|
||||
gfxSleepMilliseconds(1);
|
||||
}
|
||||
|
||||
// software shutdown disable (i.e. turn stuff on)
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
|
||||
gfxSleepMilliseconds(10);
|
||||
|
||||
// Finish Init
|
||||
post_init_board(g);
|
||||
|
||||
/* Initialise the GDISP structure */
|
||||
g->g.Width = GDISP_SCREEN_WIDTH;
|
||||
g->g.Height = GDISP_SCREEN_HEIGHT;
|
||||
g->g.Orientation = GDISP_ROTATE_0;
|
||||
g->g.Powermode = powerOff;
|
||||
g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
|
||||
g->g.Contrast = GDISP_INITIAL_CONTRAST;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if GDISP_HARDWARE_FLUSH
|
||||
LLDSPEC void gdisp_lld_flush(GDisplay *g) {
|
||||
// Don't flush if we don't need it.
|
||||
if (!(g->flags & GDISP_FLG_NEEDFLUSH))
|
||||
return;
|
||||
|
||||
PRIV(g)->page++;
|
||||
PRIV(g)->page %= 2;
|
||||
// TODO: some smarter algorithm for this
|
||||
// We should run only one physical page at a time
|
||||
// This way we don't need to send so much data, and
|
||||
// we could use slightly less memory
|
||||
uint8_t* src = PRIV(g)->frame_buffer;
|
||||
for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) {
|
||||
for (int x=0;x<GDISP_SCREEN_WIDTH;x++) {
|
||||
uint8_t val = (uint16_t)*src * g->g.Backlight / 100;
|
||||
PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val];
|
||||
++src;
|
||||
}
|
||||
}
|
||||
write_ram(g, PRIV(g)->page, IS31_PWM_REG, IS31_PWM_SIZE);
|
||||
gfxSleepMilliseconds(1);
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_PICTDISP, PRIV(g)->page);
|
||||
|
||||
g->flags &= ~GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_DRAWPIXEL
|
||||
LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
|
||||
coord_t x, y;
|
||||
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
case GDISP_ROTATE_0:
|
||||
x = g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
case GDISP_ROTATE_180:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
}
|
||||
PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color);
|
||||
g->flags |= GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_PIXELREAD
|
||||
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
|
||||
coord_t x, y;
|
||||
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
case GDISP_ROTATE_0:
|
||||
x = g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
case GDISP_ROTATE_180:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
}
|
||||
return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
|
||||
LLDSPEC void gdisp_lld_control(GDisplay *g) {
|
||||
switch(g->p.x) {
|
||||
case GDISP_CONTROL_POWER:
|
||||
if (g->g.Powermode == (powermode_t)g->p.ptr)
|
||||
return;
|
||||
switch((powermode_t)g->p.ptr) {
|
||||
case powerOff:
|
||||
case powerSleep:
|
||||
case powerDeepSleep:
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
|
||||
break;
|
||||
case powerOn:
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
g->g.Powermode = (powermode_t)g->p.ptr;
|
||||
return;
|
||||
|
||||
case GDISP_CONTROL_ORIENTATION:
|
||||
if (g->g.Orientation == (orientation_t)g->p.ptr)
|
||||
return;
|
||||
switch((orientation_t)g->p.ptr) {
|
||||
/* Rotation is handled by the drawing routines */
|
||||
case GDISP_ROTATE_0:
|
||||
case GDISP_ROTATE_180:
|
||||
g->g.Height = GDISP_SCREEN_HEIGHT;
|
||||
g->g.Width = GDISP_SCREEN_WIDTH;
|
||||
break;
|
||||
case GDISP_ROTATE_90:
|
||||
case GDISP_ROTATE_270:
|
||||
g->g.Height = GDISP_SCREEN_WIDTH;
|
||||
g->g.Width = GDISP_SCREEN_HEIGHT;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
g->g.Orientation = (orientation_t)g->p.ptr;
|
||||
return;
|
||||
|
||||
case GDISP_CONTROL_BACKLIGHT:
|
||||
if (g->g.Backlight == (unsigned)g->p.ptr)
|
||||
return;
|
||||
unsigned val = (unsigned)g->p.ptr;
|
||||
g->g.Backlight = val > 100 ? 100 : val;
|
||||
g->flags |= GDISP_FLG_NEEDFLUSH;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // GDISP_NEED_CONTROL
|
||||
|
||||
#endif // GFX_USE_GDISP
|
@@ -1,2 +0,0 @@
|
||||
GFXINC += drivers/gdisp/st7565ergodox
|
||||
GFXSRC += drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c
|
@@ -22,310 +22,6 @@
|
||||
#ifndef _GFXCONF_H
|
||||
#define _GFXCONF_H
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GOS - One of these must be defined, preferably in your Makefile //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//#define GFX_USE_OS_CHIBIOS TRUE
|
||||
//#define GFX_USE_OS_FREERTOS FALSE
|
||||
// #define GFX_FREERTOS_USE_TRACE FALSE
|
||||
//#define GFX_USE_OS_WIN32 FALSE
|
||||
//#define GFX_USE_OS_LINUX FALSE
|
||||
//#define GFX_USE_OS_OSX FALSE
|
||||
//#define GFX_USE_OS_ECOS FALSE
|
||||
//#define GFX_USE_OS_RAWRTOS FALSE
|
||||
//#define GFX_USE_OS_ARDUINO FALSE
|
||||
//#define GFX_USE_OS_KEIL FALSE
|
||||
//#define GFX_USE_OS_CMSIS FALSE
|
||||
//#define GFX_USE_OS_RAW32 FALSE
|
||||
// #define INTERRUPTS_OFF() optional_code
|
||||
// #define INTERRUPTS_ON() optional_code
|
||||
// These are not defined by default for some reason
|
||||
#define GOS_NEED_X_THREADS FALSE
|
||||
#define GOS_NEED_X_HEAP FALSE
|
||||
|
||||
// Options that (should where relevant) apply to all operating systems
|
||||
#define GFX_NO_INLINE FALSE
|
||||
// #define GFX_COMPILER GFX_COMPILER_UNKNOWN
|
||||
// #define GFX_CPU GFX_CPU_UNKNOWN
|
||||
// #define GFX_OS_HEAP_SIZE 0
|
||||
// #define GFX_OS_NO_INIT FALSE
|
||||
// #define GFX_OS_INIT_NO_WARNING FALSE
|
||||
// #define GFX_OS_PRE_INIT_FUNCTION myHardwareInitRoutine
|
||||
// #define GFX_OS_EXTRA_INIT_FUNCTION myOSInitRoutine
|
||||
// #define GFX_OS_EXTRA_DEINIT_FUNCTION myOSDeInitRoutine
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GDISP //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#define GFX_USE_GDISP TRUE
|
||||
|
||||
//#define GDISP_NEED_AUTOFLUSH FALSE
|
||||
//#define GDISP_NEED_TIMERFLUSH FALSE
|
||||
//#define GDISP_NEED_VALIDATION TRUE
|
||||
//#define GDISP_NEED_CLIP TRUE
|
||||
#define GDISP_NEED_CIRCLE TRUE
|
||||
#define GDISP_NEED_ELLIPSE TRUE
|
||||
#define GDISP_NEED_ARC TRUE
|
||||
#define GDISP_NEED_ARCSECTORS TRUE
|
||||
#define GDISP_NEED_CONVEX_POLYGON TRUE
|
||||
//#define GDISP_NEED_SCROLL FALSE
|
||||
#define GDISP_NEED_PIXELREAD TRUE
|
||||
#define GDISP_NEED_CONTROL TRUE
|
||||
//#define GDISP_NEED_QUERY FALSE
|
||||
//#define GDISP_NEED_MULTITHREAD FALSE
|
||||
//#define GDISP_NEED_STREAMING FALSE
|
||||
#define GDISP_NEED_TEXT TRUE
|
||||
// #define GDISP_NEED_TEXT_WORDWRAP FALSE
|
||||
// #define GDISP_NEED_ANTIALIAS FALSE
|
||||
// #define GDISP_NEED_UTF8 FALSE
|
||||
#define GDISP_NEED_TEXT_KERNING TRUE
|
||||
// #define GDISP_INCLUDE_FONT_UI1 FALSE
|
||||
// #define GDISP_INCLUDE_FONT_UI2 FALSE // The smallest preferred font.
|
||||
// #define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
|
||||
// #define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE
|
||||
// #define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE
|
||||
// #define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE
|
||||
// #define GDISP_INCLUDE_FONT_DEJAVUSANS20 FALSE
|
||||
// #define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE
|
||||
// #define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE
|
||||
#define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 TRUE
|
||||
// #define GDISP_INCLUDE_FONT_FIXED_10X20 FALSE
|
||||
// #define GDISP_INCLUDE_FONT_FIXED_7X14 FALSE
|
||||
#define GDISP_INCLUDE_FONT_FIXED_5X8 TRUE
|
||||
// #define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE
|
||||
// #define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE
|
||||
// #define GDISP_INCLUDE_FONT_DEJAVUSANS20_AA FALSE
|
||||
// #define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE
|
||||
// #define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE
|
||||
// #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE
|
||||
// #define GDISP_INCLUDE_USER_FONTS FALSE
|
||||
|
||||
//#define GDISP_NEED_IMAGE FALSE
|
||||
// #define GDISP_NEED_IMAGE_NATIVE FALSE
|
||||
// #define GDISP_NEED_IMAGE_GIF FALSE
|
||||
// #define GDISP_NEED_IMAGE_BMP FALSE
|
||||
// #define GDISP_NEED_IMAGE_BMP_1 FALSE
|
||||
// #define GDISP_NEED_IMAGE_BMP_4 FALSE
|
||||
// #define GDISP_NEED_IMAGE_BMP_4_RLE FALSE
|
||||
// #define GDISP_NEED_IMAGE_BMP_8 FALSE
|
||||
// #define GDISP_NEED_IMAGE_BMP_8_RLE FALSE
|
||||
// #define GDISP_NEED_IMAGE_BMP_16 FALSE
|
||||
// #define GDISP_NEED_IMAGE_BMP_24 FALSE
|
||||
// #define GDISP_NEED_IMAGE_BMP_32 FALSE
|
||||
// #define GDISP_NEED_IMAGE_JPG FALSE
|
||||
// #define GDISP_NEED_IMAGE_PNG FALSE
|
||||
// #define GDISP_NEED_IMAGE_ACCOUNTING FALSE
|
||||
#ifdef EMULATOR
|
||||
#define GDISP_NEED_PIXMAP TRUE
|
||||
#endif
|
||||
// #define GDISP_NEED_PIXMAP_IMAGE FALSE
|
||||
|
||||
//#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE // If not defined the native hardware orientation is used.
|
||||
//#define GDISP_LINEBUF_SIZE 128
|
||||
//#define GDISP_STARTUP_COLOR Black
|
||||
#define GDISP_NEED_STARTUP_LOGO FALSE
|
||||
|
||||
//#define GDISP_TOTAL_DISPLAYS 2
|
||||
|
||||
#ifndef EMULATOR
|
||||
#define GDISP_DRIVER_LIST GDISPVMT_ST7565_ERGODOX, GDISPVMT_IS31FL3731C_ERGODOX
|
||||
#else
|
||||
#define GDISP_DRIVER_LIST GDISPVMT_EMULATOR_LCD_ERGODOX, GDISPVMT_EMULATOR_LED_ERGODOX
|
||||
#endif
|
||||
|
||||
#ifdef GDISP_DRIVER_LIST
|
||||
// For code and speed optimization define as TRUE or FALSE if all controllers have the same capability
|
||||
#define GDISP_HARDWARE_STREAM_WRITE FALSE
|
||||
#define GDISP_HARDWARE_STREAM_READ FALSE
|
||||
#define GDISP_HARDWARE_STREAM_POS FALSE
|
||||
#define GDISP_HARDWARE_DRAWPIXEL TRUE
|
||||
#define GDISP_HARDWARE_CLEARS FALSE
|
||||
#define GDISP_HARDWARE_FILLS FALSE
|
||||
//#define GDISP_HARDWARE_BITFILLS FALSE
|
||||
#define GDISP_HARDWARE_SCROLL FALSE
|
||||
#define GDISP_HARDWARE_PIXELREAD TRUE
|
||||
#define GDISP_HARDWARE_CONTROL TRUE
|
||||
#define GDISP_HARDWARE_QUERY FALSE
|
||||
#define GDISP_HARDWARE_CLIP FALSE
|
||||
|
||||
#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
|
||||
#endif
|
||||
|
||||
// The custom format is not defined for some reason, so define it as error
|
||||
// so we don't get compiler warnings
|
||||
#define GDISP_PIXELFORMAT_CUSTOM GDISP_PIXELFORMAT_ERROR
|
||||
|
||||
#define GDISP_USE_GFXNET FALSE
|
||||
// #define GDISP_GFXNET_PORT 13001
|
||||
// #define GDISP_GFXNET_CUSTOM_LWIP_STARTUP FALSE
|
||||
// #define GDISP_DONT_WAIT_FOR_NET_DISPLAY FALSE
|
||||
// #define GDISP_GFXNET_UNSAFE_SOCKETS FALSE
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GWIN //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#define GFX_USE_GWIN FALSE
|
||||
|
||||
//#define GWIN_NEED_WINDOWMANAGER FALSE
|
||||
// #define GWIN_REDRAW_IMMEDIATE FALSE
|
||||
// #define GWIN_REDRAW_SINGLEOP FALSE
|
||||
// #define GWIN_NEED_FLASHING FALSE
|
||||
// #define GWIN_FLASHING_PERIOD 250
|
||||
|
||||
//#define GWIN_NEED_CONSOLE FALSE
|
||||
// #define GWIN_CONSOLE_USE_HISTORY FALSE
|
||||
// #define GWIN_CONSOLE_HISTORY_AVERAGING FALSE
|
||||
// #define GWIN_CONSOLE_HISTORY_ATCREATE FALSE
|
||||
// #define GWIN_CONSOLE_ESCSEQ FALSE
|
||||
// #define GWIN_CONSOLE_USE_BASESTREAM FALSE
|
||||
// #define GWIN_CONSOLE_USE_FLOAT FALSE
|
||||
//#define GWIN_NEED_GRAPH FALSE
|
||||
//#define GWIN_NEED_GL3D FALSE
|
||||
|
||||
//#define GWIN_NEED_WIDGET FALSE
|
||||
//#define GWIN_FOCUS_HIGHLIGHT_WIDTH 1
|
||||
// #define GWIN_NEED_LABEL FALSE
|
||||
// #define GWIN_LABEL_ATTRIBUTE FALSE
|
||||
// #define GWIN_NEED_BUTTON FALSE
|
||||
// #define GWIN_BUTTON_LAZY_RELEASE FALSE
|
||||
// #define GWIN_NEED_SLIDER FALSE
|
||||
// #define GWIN_SLIDER_NOSNAP FALSE
|
||||
// #define GWIN_SLIDER_DEAD_BAND 5
|
||||
// #define GWIN_SLIDER_TOGGLE_INC 20
|
||||
// #define GWIN_NEED_CHECKBOX FALSE
|
||||
// #define GWIN_NEED_IMAGE FALSE
|
||||
// #define GWIN_NEED_IMAGE_ANIMATION FALSE
|
||||
// #define GWIN_NEED_RADIO FALSE
|
||||
// #define GWIN_NEED_LIST FALSE
|
||||
// #define GWIN_NEED_LIST_IMAGES FALSE
|
||||
// #define GWIN_NEED_PROGRESSBAR FALSE
|
||||
// #define GWIN_PROGRESSBAR_AUTO FALSE
|
||||
// #define GWIN_NEED_KEYBOARD FALSE
|
||||
// #define GWIN_KEYBOARD_DEFAULT_LAYOUT VirtualKeyboard_English1
|
||||
// #define GWIN_NEED_KEYBOARD_ENGLISH1 TRUE
|
||||
// #define GWIN_NEED_TEXTEDIT FALSE
|
||||
// #define GWIN_FLAT_STYLING FALSE
|
||||
// #define GWIN_WIDGET_TAGS FALSE
|
||||
|
||||
//#define GWIN_NEED_CONTAINERS FALSE
|
||||
// #define GWIN_NEED_CONTAINER FALSE
|
||||
// #define GWIN_NEED_FRAME FALSE
|
||||
// #define GWIN_NEED_TABSET FALSE
|
||||
// #define GWIN_TABSET_TABHEIGHT 18
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GEVENT //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#define GFX_USE_GEVENT TRUE
|
||||
|
||||
//#define GEVENT_ASSERT_NO_RESOURCE FALSE
|
||||
//#define GEVENT_MAXIMUM_SIZE 32
|
||||
//#define GEVENT_MAX_SOURCE_LISTENERS 32
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GTIMER //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#define GFX_USE_GTIMER FALSE
|
||||
|
||||
//#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY
|
||||
//#define GTIMER_THREAD_WORKAREA_SIZE 2048
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GQUEUE //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#define GFX_USE_GQUEUE FALSE
|
||||
|
||||
//#define GQUEUE_NEED_ASYNC FALSE
|
||||
//#define GQUEUE_NEED_GSYNC FALSE
|
||||
//#define GQUEUE_NEED_FSYNC FALSE
|
||||
//#define GQUEUE_NEED_BUFFERS FALSE
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GINPUT //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#define GFX_USE_GINPUT FALSE
|
||||
|
||||
//#define GINPUT_NEED_MOUSE FALSE
|
||||
// #define GINPUT_TOUCH_STARTRAW FALSE
|
||||
// #define GINPUT_TOUCH_NOTOUCH FALSE
|
||||
// #define GINPUT_TOUCH_NOCALIBRATE FALSE
|
||||
// #define GINPUT_TOUCH_NOCALIBRATE_GUI FALSE
|
||||
// #define GINPUT_MOUSE_POLL_PERIOD 25
|
||||
// #define GINPUT_MOUSE_CLICK_TIME 300
|
||||
// #define GINPUT_TOUCH_CXTCLICK_TIME 700
|
||||
// #define GINPUT_TOUCH_USER_CALIBRATION_LOAD FALSE
|
||||
// #define GINPUT_TOUCH_USER_CALIBRATION_SAVE FALSE
|
||||
// #define GMOUSE_DRIVER_LIST GMOUSEVMT_Win32, GMOUSEVMT_Win32
|
||||
//#define GINPUT_NEED_KEYBOARD FALSE
|
||||
// #define GINPUT_KEYBOARD_POLL_PERIOD 200
|
||||
// #define GKEYBOARD_DRIVER_LIST GKEYBOARDVMT_Win32, GKEYBOARDVMT_Win32
|
||||
// #define GKEYBOARD_LAYOUT_OFF FALSE
|
||||
// #define GKEYBOARD_LAYOUT_SCANCODE2_US FALSE
|
||||
//#define GINPUT_NEED_TOGGLE FALSE
|
||||
//#define GINPUT_NEED_DIAL FALSE
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GFILE //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#define GFX_USE_GFILE FALSE
|
||||
|
||||
//#define GFILE_NEED_PRINTG FALSE
|
||||
//#define GFILE_NEED_SCANG FALSE
|
||||
//#define GFILE_NEED_STRINGS FALSE
|
||||
//#define GFILE_NEED_FILELISTS FALSE
|
||||
//#define GFILE_NEED_STDIO FALSE
|
||||
//#define GFILE_NEED_NOAUTOMOUNT FALSE
|
||||
//#define GFILE_NEED_NOAUTOSYNC FALSE
|
||||
|
||||
//#define GFILE_NEED_MEMFS FALSE
|
||||
//#define GFILE_NEED_ROMFS FALSE
|
||||
//#define GFILE_NEED_RAMFS FALSE
|
||||
//#define GFILE_NEED_FATFS FALSE
|
||||
//#define GFILE_NEED_NATIVEFS FALSE
|
||||
//#define GFILE_NEED_CHBIOSFS FALSE
|
||||
|
||||
//#define GFILE_ALLOW_FLOATS FALSE
|
||||
//#define GFILE_ALLOW_DEVICESPECIFIC FALSE
|
||||
//#define GFILE_MAX_GFILES 3
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GADC //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#define GFX_USE_GADC FALSE
|
||||
|
||||
//#define GADC_MAX_LOWSPEED_DEVICES 4
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GAUDIO //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#define GFX_USE_GAUDIO FALSE
|
||||
// There seems to be a bug in the ugfx code, the wrong define is used
|
||||
// So define it in order to avoid warnings
|
||||
#define GFX_USE_GAUDIN GFX_USE_GAUDIO
|
||||
// #define GAUDIO_NEED_PLAY FALSE
|
||||
// #define GAUDIO_NEED_RECORD FALSE
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// GMISC //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#define GFX_USE_GMISC TRUE
|
||||
|
||||
//#define GMISC_NEED_ARRAYOPS FALSE
|
||||
//#define GMISC_NEED_FASTTRIG FALSE
|
||||
//#define GMISC_NEED_FIXEDTRIG FALSE
|
||||
//#define GMISC_NEED_INVSQRT FALSE
|
||||
// #define GMISC_INVSQRT_MIXED_ENDIAN FALSE
|
||||
// #define GMISC_INVSQRT_REAL_SLOW FALSE
|
||||
#define GMISC_NEED_MATRIXFLOAT2D TRUE
|
||||
#define GMISC_NEED_MATRIXFIXED2D FALSE
|
||||
#include "common_gfxconf.h"
|
||||
|
||||
#endif /* _GFXCONF_H */
|
||||
|
@@ -1,7 +1,6 @@
|
||||
# project specific files
|
||||
SRC = matrix.c \
|
||||
led.c \
|
||||
animations.c
|
||||
led.c
|
||||
|
||||
## chip/board settings
|
||||
# - the next two should match the directories in
|
||||
@@ -67,5 +66,10 @@ LCD_BACKLIGHT_ENABLE = yes
|
||||
MIDI_ENABLE = no
|
||||
RGBLIGHT_ENABLE = no
|
||||
|
||||
include $(SUBPROJECT_PATH)/drivers/gdisp/st7565ergodox/driver.mk
|
||||
include $(SUBPROJECT_PATH)/drivers/gdisp/IS31FL3731C/driver.mk
|
||||
LCD_DRIVER = st7565
|
||||
LCD_WIDTH = 128
|
||||
LCD_HEIGHT = 32
|
||||
|
||||
LED_DRIVER = is31fl3731c
|
||||
LED_WIDTH = 7
|
||||
LED_HEIGHT = 7
|
@@ -34,7 +34,7 @@
|
||||
#include "lcd_backlight_keyframes.h"
|
||||
#include "system/serial_link.h"
|
||||
#include "led.h"
|
||||
#include "animations.h"
|
||||
#include "default_animations.h"
|
||||
|
||||
static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF);
|
||||
static const uint32_t initial_color = LCD_COLOR(0, 0, 0);
|
||||
@@ -58,7 +58,7 @@ static keyframe_animation_t color_animation = {
|
||||
// this prevents the color from changing when activating the layer
|
||||
// momentarily
|
||||
.frame_lengths = {gfxMillisecondsToTicks(200), gfxMillisecondsToTicks(500)},
|
||||
.frame_functions = {keyframe_no_operation, backlight_keyframe_animate_color},
|
||||
.frame_functions = {keyframe_no_operation, lcd_backlight_keyframe_animate_color},
|
||||
};
|
||||
|
||||
void initialize_user_visualizer(visualizer_state_t* state) {
|
||||
|
@@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "lcd_keyframes.h"
|
||||
#include "lcd_backlight_keyframes.h"
|
||||
#include "system/serial_link.h"
|
||||
#include "animations.h"
|
||||
#include "default_animations.h"
|
||||
|
||||
static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF);
|
||||
static const uint32_t initial_color = LCD_COLOR(0, 0, 0);
|
||||
@@ -79,7 +79,7 @@ static keyframe_animation_t one_led_color = {
|
||||
.num_frames = 1,
|
||||
.loop = false,
|
||||
.frame_lengths = {gfxMillisecondsToTicks(0)},
|
||||
.frame_functions = {backlight_keyframe_set_color},
|
||||
.frame_functions = {lcd_backlight_keyframe_set_color},
|
||||
};
|
||||
|
||||
bool swap_led_target_color(keyframe_animation_t* animation, visualizer_state_t* state) {
|
||||
@@ -94,7 +94,7 @@ static keyframe_animation_t two_led_colors = {
|
||||
.num_frames = 2,
|
||||
.loop = true,
|
||||
.frame_lengths = {gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(0)},
|
||||
.frame_functions = {backlight_keyframe_set_color, swap_led_target_color},
|
||||
.frame_functions = {lcd_backlight_keyframe_set_color, swap_led_target_color},
|
||||
};
|
||||
|
||||
// The LCD animation alternates between the layer name display and a
|
||||
|
365
keyboards/ergodox/keymaps/french_hacker/keymap.c
Normal file
365
keyboards/ergodox/keymaps/french_hacker/keymap.c
Normal file
@@ -0,0 +1,365 @@
|
||||
#include "ergodox.h"
|
||||
#include "debug.h"
|
||||
#include "action_layer.h"
|
||||
#include "version.h"
|
||||
#include "keymap_french.h"
|
||||
|
||||
#define BASE 0 // default Colemak Mod-DH layer
|
||||
#define SYMB 1 // symbols
|
||||
#define MDIA 2 // media keys
|
||||
#define ACC 3 // accented characters
|
||||
|
||||
#define QCOPY 0 // Qubes OS VM to VM copy
|
||||
#define QPASTE 1 // Qubes OS VM to VM paste
|
||||
#define M_ACIRC 2 // â
|
||||
#define M_ECIRC 3 // ê
|
||||
#define M_ICIRC 4 // î
|
||||
#define M_OCIRC 5 // ô
|
||||
#define M_UCIRC 6 // û
|
||||
#define M_YCIRC 7 // ŷ
|
||||
#define M_AUMLT 8 // ä
|
||||
#define M_EUMLT 9 // ë
|
||||
#define M_IUMLT 10 // ï
|
||||
#define M_OUMLT 11 // ö
|
||||
#define M_UUMLT 12 // ü
|
||||
#define M_YUMLT 13 // ÿ
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Keymap 0: Base Colemak Mod-DH layer
|
||||
*
|
||||
* ,--------------------------------------------------. ,--------------------------------------------------.
|
||||
* | Esc | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | |
|
||||
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
|
||||
* | | Q | W | F | P | B | TO(0)| |TO(2) | J | L | U | Y | ; | |
|
||||
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
|
||||
* | Tab | A | R | S | T | G |------| |------| M | N | E | I | O | Bcksp |
|
||||
* |--------+------+------+------+------+------| TO(1)| |OSL(3)|------+------+------+------+------+--------|
|
||||
* | LShift | Z | X | C | D | V | | | | K | H | , | . | : | Rshift |
|
||||
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
|
||||
* | Ins | Caps | Left | Right| MO(2)| | MO(2)| Down | Up | PgDn | PgUp |
|
||||
* `----------------------------------' `----------------------------------'
|
||||
* ,-------------. ,-------------.
|
||||
* |QCopy | Ralt | | Ralt |QPaste|
|
||||
* ,------|------|------| |------+------+------.
|
||||
* | | | Home | | End | | |
|
||||
* | Space| Ctrl |------| |------| Ctrl |Enter |
|
||||
* | | | LAlt | | LAlt | | |
|
||||
* `--------------------' `--------------------'
|
||||
*/
|
||||
// If it accepts an argument (i.e, is a function), it doesn't need KC_.
|
||||
// Otherwise, it needs KC_*
|
||||
[BASE] = KEYMAP( // layer 0 : default
|
||||
// left hand
|
||||
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_TRNS,
|
||||
KC_TRNS, FR_Q, FR_W, KC_F, KC_P, KC_B, TO(BASE),
|
||||
KC_TAB, FR_A, KC_R, KC_S, KC_T, KC_G,
|
||||
KC_LSFT, FR_Z, KC_X, KC_C, KC_D, KC_V, TO(SYMB),
|
||||
KC_INS, KC_CAPS, KC_LEFT,KC_RIGHT, MO(SYMB),
|
||||
M(QCOPY), KC_RALT,
|
||||
KC_HOME,
|
||||
KC_SPC,KC_LCTRL, KC_LALT,
|
||||
// right hand
|
||||
KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS,
|
||||
TO(MDIA), KC_J, KC_L, KC_U, KC_Y, FR_SCLN, KC_TRNS,
|
||||
FR_M, KC_N, KC_E, KC_I, KC_O, KC_BSPC,
|
||||
OSL(ACC), KC_K, KC_H, FR_COMM, FR_DOT, FR_COLN, KC_RSFT,
|
||||
MO(SYMB), KC_DOWN, KC_UP, KC_PGDN, KC_PGUP,
|
||||
|
||||
KC_RALT, M(QPASTE),
|
||||
KC_END,
|
||||
KC_LALT,KC_RCTL, KC_ENT
|
||||
),
|
||||
|
||||
|
||||
/* Keymap 1: Symbol Layer
|
||||
* // TODO missing: ¤
|
||||
* ,--------------------------------------------------. ,--------------------------------------------------.
|
||||
* |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
|
||||
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
|
||||
* | | § | < | { | \ | ~ | | | | % | @ | } | > | µ | F12 |
|
||||
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
|
||||
* | | ' | = | - | ( | + |------| |------| * | ) | _ | / | " | |
|
||||
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
|
||||
* | | ` | ? | # | [ | | | | | | & | ] | $ | ! | ^ | |
|
||||
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
|
||||
* | € | £ | $ | | | | | | | ß | |
|
||||
* `----------------------------------' `----------------------------------'
|
||||
* ,-------------. ,-------------.
|
||||
* | | | | | |
|
||||
* ,------|------|------| |------+------+------.
|
||||
* | | | | | | | |
|
||||
* | | |------| |------| | |
|
||||
* | | | | | | | |
|
||||
* `--------------------' `--------------------'
|
||||
*/
|
||||
// SYMBOLS
|
||||
[SYMB] = KEYMAP(
|
||||
// left hand
|
||||
M(0), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
|
||||
KC_TRNS,FR_SECT,FR_LESS, FR_LCBR,FR_BSLS,FR_TILD,KC_TRNS,
|
||||
KC_TRNS,FR_APOS,FR_EQL, FR_MINS,FR_LPRN,FR_PLUS,
|
||||
KC_TRNS,FR_GRV,FR_QUES,FR_HASH,FR_LBRC,FR_PIPE,KC_TRNS,
|
||||
FR_EURO,FR_PND,FR_DLR,KC_TRNS,KC_TRNS,
|
||||
KC_TRNS,KC_TRNS,
|
||||
KC_TRNS,
|
||||
KC_TRNS,KC_TRNS,KC_TRNS,
|
||||
// right hand
|
||||
KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
|
||||
KC_TRNS, FR_PERC, FR_AT, FR_RCBR, FR_GRTR, FR_MU, KC_F12,
|
||||
FR_ASTR, FR_RPRN, FR_UNDS, FR_SLSH, FR_QUOT, KC_TRNS,
|
||||
KC_TRNS, FR_AMP, FR_RBRC, FR_DLR, FR_EXLM, FR_CIRC, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, ALGR(KC_S), KC_TRNS,
|
||||
KC_TRNS, KC_TRNS,
|
||||
KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS
|
||||
),
|
||||
/* Keymap 2: Media and mouse keys
|
||||
*
|
||||
* ,--------------------------------------------------. ,--------------------------------------------------.
|
||||
* | | | | | | | | | | | | | | | |
|
||||
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
|
||||
* | | | | MsUp | | | | | | | | | | | |
|
||||
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
|
||||
* | | |MsLeft|MsDown|MsRght| |------| |------| | Lclk | Rclk | | | Play |
|
||||
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
|
||||
* | | | | | | | | | | | | Prev | Next | | |
|
||||
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
|
||||
* | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | |
|
||||
* `----------------------------------' `----------------------------------'
|
||||
* ,-------------. ,-------------.
|
||||
* | | | | | |
|
||||
* ,------|------|------| |------+------+------.
|
||||
* | | | | | | |Brwser|
|
||||
* | | |------| |------| |Back |
|
||||
* | | | | | | | |
|
||||
* `--------------------' `--------------------'
|
||||
*/
|
||||
// MEDIA AND MOUSE
|
||||
[MDIA] = KEYMAP(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
|
||||
KC_TRNS, KC_TRNS,
|
||||
KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
// right hand
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_BTN1, KC_BTN2, KC_TRNS, KC_TRNS, KC_MPLY,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
|
||||
KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS,
|
||||
KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_WBAK
|
||||
),
|
||||
|
||||
/* Keymap 3: accented characters
|
||||
*
|
||||
* ,--------------------------------------------------. ,--------------------------------------------------.
|
||||
* | | | | | | | | | | | | | | | |
|
||||
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
|
||||
* | | | à | â | ä | | | | | | | î | ï | | |
|
||||
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
|
||||
* | | é | è | ê | ë | |------| |------| | | ô | ö | | |
|
||||
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
|
||||
* | | | ù | û | ü | | | | | | | ŷ | ÿ | | |
|
||||
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
|
||||
* | | | | | | | | | | | |
|
||||
* `----------------------------------' `----------------------------------'
|
||||
* ,-------------. ,-------------.
|
||||
* | | | | | |
|
||||
* ,------|------|------| |------+------+------.
|
||||
* | | | | | | | |
|
||||
* | | |------| |------| | |
|
||||
* | | | | | | | |
|
||||
* `--------------------' `--------------------'
|
||||
*/
|
||||
// ACCENTED CHARACTERS
|
||||
[ACC] = KEYMAP(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
|
||||
KC_TRNS, KC_TRNS, FR_AGRV, M(M_ACIRC), M(M_AUMLT), KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, FR_EACU, FR_EGRV, M(M_ECIRC), M(M_EUMLT), KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, FR_UGRV, M(M_UCIRC), M(M_UUMLT), KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS,
|
||||
KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
// right hand
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, M(M_ICIRC), M(M_IUMLT), KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, M(M_OCIRC), M(M_OUMLT), KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, M(M_YCIRC), M(M_YUMLT), KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||
KC_TRNS, KC_TRNS,
|
||||
KC_TRNS,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS
|
||||
),
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM fn_actions[] = {
|
||||
[1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols)
|
||||
};
|
||||
|
||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||
{
|
||||
// MACRODOWN only works in this function
|
||||
switch(id) {
|
||||
case QCOPY:
|
||||
if (record->event.pressed) {
|
||||
return MACRO(I(255),
|
||||
D(LCTRL),
|
||||
T(C),
|
||||
D(LSFT),
|
||||
T(C),
|
||||
U(LCTRL),
|
||||
U(LSFT),
|
||||
END);
|
||||
}
|
||||
break;
|
||||
case QPASTE:
|
||||
if (record->event.pressed) {
|
||||
return MACRO(I(255),
|
||||
D(LCTRL),
|
||||
D(LSFT),
|
||||
T(V),
|
||||
U(LCTRL),
|
||||
T(INS),
|
||||
U(LSFT),
|
||||
END);
|
||||
}
|
||||
break;
|
||||
case M_ACIRC:
|
||||
if (record->event.pressed) {
|
||||
return MACRO(T(LBRC), // FR_CIRC
|
||||
T(Q), // FR_A
|
||||
END);
|
||||
}
|
||||
break;
|
||||
case M_ECIRC:
|
||||
if (record->event.pressed) {
|
||||
return MACRO(T(LBRC), // FR_CIRC
|
||||
T(E),
|
||||
END);
|
||||
}
|
||||
break;
|
||||
case M_UCIRC:
|
||||
if (record->event.pressed) {
|
||||
return MACRO(T(LBRC), // FR_CIRC
|
||||
T(U),
|
||||
END);
|
||||
}
|
||||
break;
|
||||
case M_ICIRC:
|
||||
if (record->event.pressed) {
|
||||
return MACRO(T(LBRC), // FR_CIRC
|
||||
T(I),
|
||||
END);
|
||||
}
|
||||
break;
|
||||
case M_OCIRC:
|
||||
if (record->event.pressed) {
|
||||
return MACRO(T(LBRC), // FR_CIRC
|
||||
T(O),
|
||||
END);
|
||||
}
|
||||
break;
|
||||
case M_YCIRC:
|
||||
if (record->event.pressed) {
|
||||
return MACRO(T(LBRC), // FR_CIRC
|
||||
T(Y),
|
||||
END);
|
||||
}
|
||||
break;
|
||||
case M_AUMLT:
|
||||
if (record->event.pressed) {
|
||||
return MACRO(D(LSFT),
|
||||
T(LBRC),
|
||||
U(LSFT),
|
||||
T(Q),
|
||||
END);
|
||||
}
|
||||
break;
|
||||
case M_EUMLT:
|
||||
if (record->event.pressed) {
|
||||
return MACRO(D(LSFT),
|
||||
T(LBRC),
|
||||
U(LSFT),
|
||||
T(E),
|
||||
END);
|
||||
}
|
||||
break;
|
||||
case M_UUMLT:
|
||||
if (record->event.pressed) {
|
||||
return MACRO(D(LSFT),
|
||||
T(LBRC),
|
||||
U(LSFT),
|
||||
T(U),
|
||||
END);
|
||||
}
|
||||
break;
|
||||
case M_IUMLT:
|
||||
if (record->event.pressed) {
|
||||
return MACRO(D(LSFT),
|
||||
T(LBRC),
|
||||
U(LSFT),
|
||||
T(I),
|
||||
END);
|
||||
}
|
||||
break;
|
||||
case M_OUMLT:
|
||||
if (record->event.pressed) {
|
||||
return MACRO(D(LSFT),
|
||||
T(LBRC),
|
||||
U(LSFT),
|
||||
T(O),
|
||||
END);
|
||||
}
|
||||
break;
|
||||
case M_YUMLT:
|
||||
if (record->event.pressed) {
|
||||
return MACRO(D(LSFT),
|
||||
T(LBRC),
|
||||
U(LSFT),
|
||||
T(Y),
|
||||
END);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
return MACRO_NONE;
|
||||
};
|
||||
|
||||
// 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) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
ergodox_right_led_2_off();
|
||||
ergodox_right_led_3_off();
|
||||
switch (layer) {
|
||||
case SYMB:
|
||||
ergodox_right_led_1_on();
|
||||
break;
|
||||
case MDIA:
|
||||
ergodox_right_led_2_on();
|
||||
break;
|
||||
case ACC:
|
||||
ergodox_right_led_3_on();
|
||||
break;
|
||||
default:
|
||||
// none
|
||||
break;
|
||||
}
|
||||
|
||||
};
|
30
keyboards/ergodox/keymaps/french_hacker/readme.md
Normal file
30
keyboards/ergodox/keymaps/french_hacker/readme.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# French hacker layout
|
||||
|
||||
## Introduction
|
||||
|
||||
[Colemak Mod-DH](https://colemakmods.github.io/mod-dh/) layout for
|
||||
users keeping an `azerty` layout configuration on their OS.
|
||||
|
||||
This keymap is for users keeping their operating systems configured with
|
||||
`azerty` - for typing passwords or in their native languages - but who
|
||||
wants a Colemak Mod-DH layout on their mechanical.
|
||||
|
||||
The symbols layers was done after analysing various programming
|
||||
languages sources codes and should be close to optimal for typing
|
||||
confort.
|
||||
|
||||
Special macros for [Qubes OS](https://www.qubes-os.org/) are included.
|
||||
|
||||
There is an accented characters layer for infrequent typing of french
|
||||
accents.
|
||||
|
||||
Special macros for [Qubes OS](https://www.qubes-os.org/) are included.
|
||||
|
||||
## Build
|
||||
|
||||
cd keyboards/ergodox
|
||||
make french_hacker
|
||||
|
||||
## Design explanations
|
||||
|
||||
See my [blog post](http://dialectical-computing.de/blog/blog/2017/01/29/a-better-coder-layout-for-the-ergodox-ez-keyboard/).
|
5
keyboards/hadron/Makefile
Normal file
5
keyboards/hadron/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
SUBPROJECT_DEFAULT = ver2
|
||||
|
||||
ifndef MAKEFILE_INCLUDED
|
||||
include ../../Makefile
|
||||
endif
|
83
keyboards/hadron/config.h
Normal file
83
keyboards/hadron/config.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0xFEED
|
||||
#define PRODUCT_ID 0x6060
|
||||
#define MANUFACTURER ishtob
|
||||
#define PRODUCT Hadron Keyboard
|
||||
#define DESCRIPTION A cherry ML ortholinear keyboard
|
||||
|
||||
|
||||
|
||||
|
||||
//#define AUDIO_VOICES
|
||||
|
||||
//#define BACKLIGHT_PIN B7
|
||||
|
||||
/* COL2ROW or ROW2COL */
|
||||
#define DIODE_DIRECTION COL2ROW
|
||||
|
||||
/* define if matrix has ghost */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
||||
/* number of backlight levels */
|
||||
//#define BACKLIGHT_LEVELS 3
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCING_DELAY 5
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
/* Locking resynchronize hack */
|
||||
#define LOCKING_RESYNC_ENABLE
|
||||
|
||||
/* key combination for command */
|
||||
#define IS_COMMAND() ( \
|
||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||
)
|
||||
|
||||
/*
|
||||
* 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
|
||||
#ifdef SUBPROJECT_ver0
|
||||
#include "ver0/config.h"
|
||||
#endif
|
||||
#ifdef SUBPROJECT_ver2
|
||||
#include "ver2/config.h"
|
||||
#endif
|
||||
|
||||
#endif
|
26
keyboards/hadron/hadron.c
Normal file
26
keyboards/hadron/hadron.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "hadron.h"
|
||||
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
|
||||
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);
|
||||
}
|
30
keyboards/hadron/hadron.h
Normal file
30
keyboards/hadron/hadron.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef HADRON_H
|
||||
#define HADRON_H
|
||||
|
||||
#ifdef SUBPROJECT_ver0
|
||||
#include "ver0.h"
|
||||
#endif
|
||||
#ifdef SUBPROJECT_ver2
|
||||
#include "ver2.h"
|
||||
#endif
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
|
||||
#define KEYMAP( \
|
||||
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \
|
||||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \
|
||||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \
|
||||
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \
|
||||
K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E \
|
||||
) \
|
||||
{ \
|
||||
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, KC_NO, KC_NO, KC_NO }, \
|
||||
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \
|
||||
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \
|
||||
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \
|
||||
{ K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E } \
|
||||
}
|
||||
|
||||
|
||||
#endif
|
166
keyboards/hadron/i2c.c
Normal file
166
keyboards/hadron/i2c.c
Normal file
@@ -0,0 +1,166 @@
|
||||
#include <util/twi.h>
|
||||
#include <avr/io.h>
|
||||
#include <stdlib.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <util/twi.h>
|
||||
#include <stdbool.h>
|
||||
#include "i2c.h"
|
||||
|
||||
#ifdef USE_I2C
|
||||
|
||||
// Limits the amount of we wait for any one i2c transaction.
|
||||
// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
|
||||
// 9 bits, a single transaction will take around 90μs to complete.
|
||||
//
|
||||
// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit
|
||||
// poll loop takes at least 8 clock cycles to execute
|
||||
#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8
|
||||
|
||||
#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE)
|
||||
|
||||
volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
|
||||
|
||||
static volatile uint8_t slave_buffer_pos;
|
||||
static volatile bool slave_has_register_set = false;
|
||||
|
||||
// Wait for an i2c operation to finish
|
||||
inline static
|
||||
void i2c_delay(void) {
|
||||
uint16_t lim = 0;
|
||||
while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT)
|
||||
lim++;
|
||||
|
||||
// easier way, but will wait slightly longer
|
||||
// _delay_us(100);
|
||||
}
|
||||
|
||||
// Setup twi to run at 100kHz
|
||||
void i2c_master_init(void) {
|
||||
// no prescaler
|
||||
TWSR = 0;
|
||||
// Set TWI clock frequency to SCL_CLOCK. Need TWBR>10.
|
||||
// Check datasheets for more info.
|
||||
TWBR = ((F_CPU/SCL_CLOCK)-16)/2;
|
||||
}
|
||||
|
||||
// Start a transaction with the given i2c slave address. The direction of the
|
||||
// transfer is set with I2C_READ and I2C_WRITE.
|
||||
// returns: 0 => success
|
||||
// 1 => error
|
||||
uint8_t i2c_master_start(uint8_t address) {
|
||||
TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
|
||||
|
||||
i2c_delay();
|
||||
|
||||
// check that we started successfully
|
||||
if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START))
|
||||
return 1;
|
||||
|
||||
// send device address
|
||||
TWDR = address;
|
||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||
|
||||
i2c_delay();
|
||||
|
||||
if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) )
|
||||
return 1; // slave did not acknowledge
|
||||
else
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
|
||||
// Finish the i2c transaction.
|
||||
void i2c_master_stop(void) {
|
||||
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
|
||||
|
||||
uint16_t lim = 0;
|
||||
while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT)
|
||||
lim++;
|
||||
}
|
||||
|
||||
// Write one byte to the i2c slave.
|
||||
// returns 0 => slave ACK
|
||||
// 1 => slave NACK
|
||||
uint8_t i2c_master_write(uint8_t data) {
|
||||
TWDR = data;
|
||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
||||
|
||||
i2c_delay();
|
||||
|
||||
// check if the slave acknowledged us
|
||||
return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1;
|
||||
}
|
||||
|
||||
// Read one byte from the i2c slave. If ack=1 the slave is acknowledged,
|
||||
// if ack=0 the acknowledge bit is not set.
|
||||
// returns: byte read from i2c device
|
||||
uint8_t i2c_master_read(int ack) {
|
||||
TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA);
|
||||
|
||||
i2c_delay();
|
||||
return TWDR;
|
||||
}
|
||||
|
||||
void i2c_reset_state(void) {
|
||||
TWCR = 0;
|
||||
}
|
||||
|
||||
void i2c_slave_init(uint8_t address) {
|
||||
TWAR = address << 0; // slave i2c address
|
||||
// TWEN - twi enable
|
||||
// TWEA - enable address acknowledgement
|
||||
// TWINT - twi interrupt flag
|
||||
// TWIE - enable the twi interrupt
|
||||
TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN);
|
||||
}
|
||||
|
||||
ISR(TWI_vect);
|
||||
|
||||
ISR(TWI_vect) {
|
||||
uint8_t ack = 1;
|
||||
switch(TW_STATUS) {
|
||||
case TW_SR_SLA_ACK:
|
||||
// this device has been addressed as a slave receiver
|
||||
slave_has_register_set = false;
|
||||
break;
|
||||
|
||||
case TW_SR_DATA_ACK:
|
||||
// this device has received data as a slave receiver
|
||||
// The first byte that we receive in this transaction sets the location
|
||||
// of the read/write location of the slaves memory that it exposes over
|
||||
// i2c. After that, bytes will be written at slave_buffer_pos, incrementing
|
||||
// slave_buffer_pos after each write.
|
||||
if(!slave_has_register_set) {
|
||||
slave_buffer_pos = TWDR;
|
||||
// don't acknowledge the master if this memory loctaion is out of bounds
|
||||
if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) {
|
||||
ack = 0;
|
||||
slave_buffer_pos = 0;
|
||||
}
|
||||
slave_has_register_set = true;
|
||||
} else {
|
||||
i2c_slave_buffer[slave_buffer_pos] = TWDR;
|
||||
BUFFER_POS_INC();
|
||||
}
|
||||
break;
|
||||
|
||||
case TW_ST_SLA_ACK:
|
||||
case TW_ST_DATA_ACK:
|
||||
// master has addressed this device as a slave transmitter and is
|
||||
// requesting data.
|
||||
TWDR = i2c_slave_buffer[slave_buffer_pos];
|
||||
BUFFER_POS_INC();
|
||||
break;
|
||||
|
||||
case TW_BUS_ERROR: // something went wrong, reset twi state
|
||||
TWCR = 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// Reset everything, so we are ready for the next TWI interrupt
|
||||
TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
49
keyboards/hadron/i2c.h
Normal file
49
keyboards/hadron/i2c.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef I2C_H
|
||||
#define I2C_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef F_CPU
|
||||
#define F_CPU 16000000UL
|
||||
#endif
|
||||
|
||||
#define I2C_READ 1
|
||||
#define I2C_WRITE 0
|
||||
|
||||
#define I2C_ACK 1
|
||||
#define I2C_NACK 0
|
||||
|
||||
#define SLAVE_BUFFER_SIZE 0x10
|
||||
|
||||
// i2c SCL clock frequency
|
||||
#define SCL_CLOCK 800000L
|
||||
|
||||
extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
|
||||
|
||||
void i2c_master_init(void);
|
||||
uint8_t i2c_master_start(uint8_t address);
|
||||
void i2c_master_stop(void);
|
||||
uint8_t i2c_master_write(uint8_t data);
|
||||
uint8_t i2c_master_read(int);
|
||||
void i2c_reset_state(void);
|
||||
void i2c_slave_init(uint8_t address);
|
||||
|
||||
|
||||
static inline unsigned char i2c_start_read(unsigned char addr) {
|
||||
return i2c_master_start((addr << 1) | I2C_READ);
|
||||
}
|
||||
|
||||
static inline unsigned char i2c_start_write(unsigned char addr) {
|
||||
return i2c_master_start((addr << 1) | I2C_WRITE);
|
||||
}
|
||||
|
||||
// from SSD1306 scrips
|
||||
extern unsigned char i2c_rep_start(unsigned char addr);
|
||||
extern void i2c_start_wait(unsigned char addr);
|
||||
extern unsigned char i2c_readAck(void);
|
||||
extern unsigned char i2c_readNak(void);
|
||||
extern unsigned char i2c_read(unsigned char ack);
|
||||
|
||||
#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak();
|
||||
|
||||
#endif
|
26
keyboards/hadron/keymaps/default/Makefile
Normal file
26
keyboards/hadron/keymaps/default/Makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
# 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 = yes # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = no # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
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 = 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 = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
|
||||
ONEHAND_ENABLE = no # Enable one-hand typing
|
||||
|
||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
|
||||
ifndef QUANTUM_DIR
|
||||
include ../../../../Makefile
|
||||
endif
|
21
keyboards/hadron/keymaps/default/config.h
Normal file
21
keyboards/hadron/keymaps/default/config.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef CONFIG_USER_H
|
||||
#define CONFIG_USER_H
|
||||
|
||||
#include "../../config.h"
|
||||
|
||||
#define LEADER_TIMEOUT 300
|
||||
//#define BACKLIGHT_BREATHING
|
||||
#define PREVENT_STUCK_MODIFIERS
|
||||
|
||||
#define USE_I2C
|
||||
#define SSD1306OLED
|
||||
#define OLED_ROTATE180
|
||||
|
||||
/* ws2812 RGB LED*/
|
||||
#define RGB_DI_PIN D4
|
||||
#define RGBLIGHT_ANIMATIONS
|
||||
#define RGBLED_NUM 14 // Number of LEDs
|
||||
#define RGBLIGHT_HUE_STEP 10
|
||||
#define RGBLIGHT_SAT_STEP 17
|
||||
|
||||
#endif
|
496
keyboards/hadron/keymaps/default/keymap.c
Normal file
496
keyboards/hadron/keymaps/default/keymap.c
Normal file
@@ -0,0 +1,496 @@
|
||||
#include "hadron.h"
|
||||
#include "bootloader.h"
|
||||
#include "action_layer.h"
|
||||
#include "eeconfig.h"
|
||||
#include "LUFA/Drivers/Peripheral/TWI.h"
|
||||
#ifdef AUDIO_ENABLE
|
||||
#include "audio.h"
|
||||
#endif
|
||||
#ifdef USE_I2C
|
||||
#include "i2c.h"
|
||||
#endif
|
||||
#ifdef SSD1306OLED
|
||||
#include "ssd1306.h"
|
||||
#endif
|
||||
extern keymap_config_t keymap_config;
|
||||
|
||||
//Following line allows macro to read current RGB settings
|
||||
extern rgblight_config_t rgblight_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.
|
||||
#define _QWERTY 0
|
||||
#define _COLEMAK 1
|
||||
#define _DVORAK 2
|
||||
#define _LOWER 3
|
||||
#define _RAISE 4
|
||||
#define _MOUSECURSOR 8
|
||||
#define _ADJUST 16
|
||||
|
||||
enum preonic_keycodes {
|
||||
QWERTY = SAFE_RANGE,
|
||||
COLEMAK,
|
||||
DVORAK,
|
||||
LOWER,
|
||||
RAISE,
|
||||
BACKLIT,
|
||||
RGBLED_TOGGLE,
|
||||
RGBLED_STEP_MODE,
|
||||
RGBLED_INCREASE_HUE,
|
||||
RGBLED_DECREASE_HUE,
|
||||
RGBLED_INCREASE_SAT,
|
||||
RGBLED_DECREASE_SAT,
|
||||
RGBLED_INCREASE_VAL,
|
||||
RGBLED_DECREASE_VAL,
|
||||
};
|
||||
|
||||
enum macro_keycodes {
|
||||
KC_DEMOMACRO,
|
||||
};
|
||||
|
||||
// Fillers to make layering more clear
|
||||
#define _______ KC_TRNS
|
||||
#define XXXXXXX KC_NO
|
||||
// Custom macros
|
||||
#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl
|
||||
#define CTL_TTAB CTL_T(KC_TAB) // Tap for Esc, hold for Ctrl
|
||||
#define CTL_ENT CTL_T(KC_ENT) // Tap for Enter, hold for Ctrl
|
||||
#define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift
|
||||
// Requires KC_TRNS/_______ for the trigger key in the destination layer
|
||||
#define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor
|
||||
#define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise
|
||||
#define DEMOMACRO M(KC_DEMOMACRO) // Sample for macros
|
||||
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
/* Qwerty
|
||||
* ,------+------+------+------+------+------------------------------------------------.
|
||||
* | Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | DEL |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||
* | Tab | Q | W | E | R | T | 7 | 8 | 9 | Y | U | I | O | P | Bksp |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | CAPS | A | S | D | F | G | 4 | 5 | 6 | H | J | K | L | ;/Nav| ' |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Shift| Z | X | C | V | B | 1 | 2 | 3 | N | M | , | . | / |Ctl/Et|
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right |
|
||||
* `--------------------------------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_QWERTY] = KEYMAP(
|
||||
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_P7, KC_P8, KC_P9, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
|
||||
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_P4, KC_P5, KC_P6, KC_H, KC_J, KC_K, KC_L,LT_MC(KC_SCLN), KC_QUOT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P1, KC_P2, KC_P3, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, CTL_ENT, \
|
||||
KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT,KC_DOWN, KC_UP, KC_RGHT \
|
||||
),
|
||||
|
||||
/* Colemak
|
||||
* ,------+------+------+------+------+------------------------------------------------.
|
||||
* | Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | 0 | - |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||
* | Tab | Q | W | F | P | G | 7 | 8 | 9 | J | L | U | Y | ; | Bksp |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
|
||||
* | CAPS | A | R | S | T | D | 4 | 5 | 6 | H | N | E | I | O | ' |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Shift| Z | X | C | V | B | 1 | 2 | 3 | K | M | , | . | / |Ctl/Et|
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right |
|
||||
* `--------------------------------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_COLEMAK] = KEYMAP(
|
||||
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\
|
||||
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_P7, KC_P8, KC_P9, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
|
||||
KC_LCTRL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_P4, KC_P5, KC_P6, KC_H, KC_N, KC_E, KC_I, LT_MC(KC_O), KC_QUOT, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P1, KC_P2, KC_P3, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, CTL_ENT, \
|
||||
KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
),
|
||||
|
||||
/* Dvorak
|
||||
* ,------+------+------+------+------+------------------------------------------------.
|
||||
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||
* | Tab | " | , | . | P | Y | 7 | 8 | 9 | F | G | C | R | L | Bksp |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
|
||||
* | Esc | A | O | E | U | I | 4 | 5 | 6 | D | H | T | N | S | / |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Shift| ; | Q | J | K | X | 1 | 2 | 3 | B | M | W | V | Z |Ctl/Et|
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right |
|
||||
* `--------------------------------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_DVORAK] = KEYMAP(
|
||||
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\
|
||||
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_P7, KC_P8, KC_P9, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \
|
||||
KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_P4, KC_P5, KC_P6, KC_D, KC_H, KC_T, KC_N, LT_MC(KC_S), KC_SLSH, \
|
||||
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_P1, KC_P2, KC_P3, KC_B, KC_M, KC_W, KC_V, KC_Z, CTL_ENT, \
|
||||
KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
),
|
||||
|
||||
/* Lower
|
||||
* ,------+------+------+------+------+------------------------------------------------.
|
||||
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||
* | ~ | ! | @ | # | $ | % | | | | ^ | & | * | ( | ) | Del |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
|
||||
* | | F1 | F2 | F3 | F4 | F5 | | | | F6 | _ | + | { | } | | |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------+------+------+------|
|
||||
* | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO ~ |ISO | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | Next | Vol- | Vol+ | Play |
|
||||
* `--------------------------------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_LOWER] = KEYMAP(
|
||||
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \
|
||||
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \
|
||||
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_PIPE, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12,S(KC_NUHS),S(KC_NUBS),_______,_______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||
),
|
||||
|
||||
/* Raise
|
||||
* ,------+------+------+------+------+------------------------------------------------.
|
||||
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||
* | ` | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | Del |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
|
||||
* | Del | F1 | F2 | F3 | F4 | F5 | | | | F6 | - | = | [ | ] | \ |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO # |ISO / | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | Next | Vol- | Vol+ | Play |
|
||||
* `--------------------------------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_RAISE] = KEYMAP(
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
|
||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
|
||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, KC_SPC, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||
),
|
||||
|
||||
/* Mouse Layer (semi-col)
|
||||
* ,------+------+------+------+------+------------------------------------------------.
|
||||
* | ACCL0| ACCL1| ACCL2| | | | | | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||
* | | | | | | | | | Home | Wh_Up| WHL_L| M_Up | WHL_R| Macro| |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | End | Wh_Dn| M_Lft| M_Dn | M_Rt | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | BTN2 | BTN3 | BTN4 | BTN5 | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | BTN1 | | | | BTN1 | | | | | |
|
||||
* `--------------------------------------------------------------------------------------------------------'
|
||||
*/
|
||||
|
||||
[_MOUSECURSOR] = KEYMAP(
|
||||
KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_WH_L, KC_MS_U, KC_WH_R,DEMOMACRO,_______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_END , KC_PGDN, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5, _______, _______, \
|
||||
_______, _______, _______, _______, _______, KC_BTN1, _______, _______, _______, KC_BTN1, _______, _______, _______, _______, _______ \
|
||||
),
|
||||
|
||||
/* Adjust (Lower + Raise)
|
||||
* ,------+------+------+------+------+------------------------------------------------.
|
||||
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||
* | Reset|RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | | | | Del |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | |Aud on|Audoff|AGnorm| | | |AGswap|Qwerty|Colemk| | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | |Voice-|Voice+|Mus on|Musoff| | | | | | | | BL + |BL ST |BL TG |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | | | | |
|
||||
* `--------------------------------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_ADJUST] = KEYMAP(
|
||||
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
|
||||
RESET, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \
|
||||
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, \
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______\
|
||||
)
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
|
||||
float tone_startup[][2] = SONG(STARTUP_SOUND);
|
||||
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
|
||||
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
|
||||
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
|
||||
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
|
||||
float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
|
||||
#endif
|
||||
|
||||
// define variables for reactive RGB
|
||||
bool RGB_INIT = false;
|
||||
bool TOG_STATUS = false;
|
||||
int RGB_current_mode;
|
||||
|
||||
|
||||
|
||||
void persistant_default_layer_set(uint16_t default_layer) {
|
||||
eeconfig_update_default_layer(default_layer);
|
||||
default_layer_set(default_layer);
|
||||
}
|
||||
|
||||
void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
|
||||
if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
|
||||
rgblight_mode(RGB_current_mode);
|
||||
layer_on(layer3);
|
||||
} else {
|
||||
layer_off(layer3);
|
||||
}
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case QWERTY:
|
||||
if (record->event.pressed) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
|
||||
#endif
|
||||
persistant_default_layer_set(1UL<<_QWERTY);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case COLEMAK:
|
||||
if (record->event.pressed) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
|
||||
#endif
|
||||
persistant_default_layer_set(1UL<<_COLEMAK);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case LOWER:
|
||||
if (record->event.pressed) {
|
||||
//not sure how to have keyboard check mode and set it to a variable, so my work around
|
||||
//uses another variable that would be set to true after the first time a reactive key is pressed.
|
||||
if (RGB_INIT) {} else {
|
||||
RGB_current_mode = rgblight_config.mode;
|
||||
RGB_INIT = true;
|
||||
}
|
||||
if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
|
||||
} else {
|
||||
TOG_STATUS = !TOG_STATUS;
|
||||
rgblight_mode(16);
|
||||
}
|
||||
layer_on(_LOWER);
|
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||
} else {
|
||||
rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
|
||||
TOG_STATUS = false;
|
||||
layer_off(_LOWER);
|
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case RAISE:
|
||||
if (record->event.pressed) {
|
||||
//not sure how to have keyboard check mode and set it to a variable, so my work around
|
||||
//uses another variable that would be set to true after the first time a reactive key is pressed.
|
||||
if (RGB_INIT) {} else {
|
||||
RGB_current_mode = rgblight_config.mode;
|
||||
RGB_INIT = true;
|
||||
}
|
||||
if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
|
||||
} else {
|
||||
TOG_STATUS = !TOG_STATUS;
|
||||
rgblight_mode(15);
|
||||
}
|
||||
layer_on(_RAISE);
|
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||
} else {
|
||||
rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
|
||||
layer_off(_RAISE);
|
||||
TOG_STATUS = false;
|
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case BACKLIT:
|
||||
if (record->event.pressed) {
|
||||
register_code(KC_RSFT);
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
backlight_step();
|
||||
#endif
|
||||
} else {
|
||||
unregister_code(KC_RSFT);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case RGB_MOD:
|
||||
//led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
|
||||
if (record->event.pressed) {
|
||||
rgblight_mode(RGB_current_mode);
|
||||
rgblight_step();
|
||||
RGB_current_mode = rgblight_config.mode;
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void matrix_init_user(void) {
|
||||
#ifdef USE_I2C
|
||||
i2c_master_init();
|
||||
#ifdef SSD1306OLED
|
||||
// calls code for the SSD1306 OLED
|
||||
_delay_ms(400);
|
||||
TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
|
||||
iota_gfx_init(); // turns on the display
|
||||
#endif
|
||||
#endif
|
||||
#ifdef AUDIO_ENABLE
|
||||
startup_user();
|
||||
#endif
|
||||
}
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
#ifdef SSD1306OLED
|
||||
iota_gfx_task(); // this is what updates the display continuously
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
|
||||
void startup_user()
|
||||
{
|
||||
_delay_ms(20); // gets rid of tick
|
||||
PLAY_NOTE_ARRAY(tone_startup, false, 0);
|
||||
}
|
||||
|
||||
void shutdown_user()
|
||||
{cc
|
||||
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
|
||||
_delay_ms(150);
|
||||
stop_all_notes();
|
||||
}
|
||||
|
||||
void music_on_user(void)
|
||||
{
|
||||
music_scale_user();
|
||||
}
|
||||
|
||||
void music_scale_user(void)
|
||||
{
|
||||
PLAY_NOTE_ARRAY(music_scale, false, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macro definition
|
||||
*/
|
||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||
{
|
||||
if (!eeconfig_is_enabled()) {
|
||||
eeconfig_init();
|
||||
}
|
||||
|
||||
switch (id) {
|
||||
case KC_DEMOMACRO:
|
||||
if (record->event.pressed){
|
||||
return MACRO (I(1), T(H),T(E),T(L), T(L), T(O), T(SPACE), T(W), T(O), T(R), T(L), T(D), END);
|
||||
}
|
||||
}
|
||||
|
||||
return MACRO_NONE;
|
||||
}
|
||||
|
||||
void matrix_update(struct CharacterMatrix *dest,
|
||||
const struct CharacterMatrix *source) {
|
||||
if (memcmp(dest->display, source->display, sizeof(dest->display))) {
|
||||
memcpy(dest->display, source->display, sizeof(dest->display));
|
||||
dest->dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
//assign the right code to your layers for OLED display
|
||||
#define L_BASE 0
|
||||
#define L_LOWER 8
|
||||
#define L_RAISE 16
|
||||
#define L_FNLAYER 64
|
||||
#define L_NUMLAY 128
|
||||
#define L_NLOWER 136
|
||||
#define L_NFNLAYER 192
|
||||
#define L_MOUSECURSOR 256
|
||||
#define L_ADJUST 65560
|
||||
|
||||
void iota_gfx_task_user(void) {
|
||||
#if DEBUG_TO_SCREEN
|
||||
if (debug_enable) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct CharacterMatrix matrix;
|
||||
|
||||
matrix_clear(&matrix);
|
||||
matrix_write_P(&matrix, PSTR("USB: "));
|
||||
#ifdef PROTOCOL_LUFA
|
||||
switch (USB_DeviceState) {
|
||||
case DEVICE_STATE_Unattached:
|
||||
matrix_write_P(&matrix, PSTR("Unattached"));
|
||||
break;
|
||||
case DEVICE_STATE_Suspended:
|
||||
matrix_write_P(&matrix, PSTR("Suspended"));
|
||||
break;
|
||||
case DEVICE_STATE_Configured:
|
||||
matrix_write_P(&matrix, PSTR("Connected"));
|
||||
break;
|
||||
case DEVICE_STATE_Powered:
|
||||
matrix_write_P(&matrix, PSTR("Powered"));
|
||||
break;
|
||||
case DEVICE_STATE_Default:
|
||||
matrix_write_P(&matrix, PSTR("Default"));
|
||||
break;
|
||||
case DEVICE_STATE_Addressed:
|
||||
matrix_write_P(&matrix, PSTR("Addressed"));
|
||||
break;
|
||||
default:
|
||||
matrix_write_P(&matrix, PSTR("Invalid"));
|
||||
}
|
||||
#endif
|
||||
|
||||
// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
|
||||
|
||||
char buf[40];
|
||||
snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
|
||||
matrix_write_P(&matrix, PSTR("\n\nLayer: "));
|
||||
switch (layer_state) {
|
||||
case L_BASE:
|
||||
matrix_write_P(&matrix, PSTR("Default"));
|
||||
break;
|
||||
case L_RAISE:
|
||||
matrix_write_P(&matrix, PSTR("Raise"));
|
||||
break;
|
||||
case L_LOWER:
|
||||
matrix_write_P(&matrix, PSTR("Lower"));
|
||||
break;
|
||||
case L_ADJUST:
|
||||
matrix_write_P(&matrix, PSTR("ADJUST"));
|
||||
break;
|
||||
default:
|
||||
matrix_write(&matrix, buf);
|
||||
}
|
||||
|
||||
// Host Keyboard LED Status
|
||||
char led[40];
|
||||
snprintf(led, sizeof(led), "\n%s %s %s",
|
||||
(host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
|
||||
(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
|
||||
(host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
|
||||
matrix_write(&matrix, led);
|
||||
matrix_update(&display, &matrix);
|
||||
}
|
||||
|
2
keyboards/hadron/keymaps/default/readme.md
Normal file
2
keyboards/hadron/keymaps/default/readme.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# The Default Planck Layout
|
||||
|
23
keyboards/hadron/keymaps/readme.md
Normal file
23
keyboards/hadron/keymaps/readme.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# How to add your own keymap
|
||||
|
||||
Folders can be named however you'd like (will be approved upon merging), or should follow the format with a preceding `_`:
|
||||
|
||||
_[ISO 3166-1 alpha-2 code*]_[layout variant]_[layout name/author]
|
||||
|
||||
\* See full list: https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements
|
||||
|
||||
and contain the following files:
|
||||
|
||||
* `keymap.c`
|
||||
* `readme.md` *recommended*
|
||||
* `config.h` *optional*, found automatically when compiling
|
||||
* `Makefile` *optional*, found automatically when compling
|
||||
|
||||
When adding your keymap to this list, keep it organised alphabetically (select list, edit->sort lines), and use this format:
|
||||
|
||||
* **folder_name** description
|
||||
|
||||
# List of Planck keymaps
|
||||
|
||||
* **default** default Planck layout
|
||||
* **cbbrowne** cbbrowne's Planck layout
|
26
keyboards/hadron/keymaps/side_numpad/Makefile
Normal file
26
keyboards/hadron/keymaps/side_numpad/Makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
# 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 = yes # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
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 = no # Enable keyboard backlight functionality
|
||||
MIDI_ENABLE = yes # MIDI controls
|
||||
AUDIO_ENABLE = no # Audio output on port C6
|
||||
UNICODE_ENABLE = no # Unicode
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
|
||||
ONEHAND_ENABLE = no # Enable one-hand typing
|
||||
|
||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
|
||||
ifndef QUANTUM_DIR
|
||||
include ../../../../Makefile
|
||||
endif
|
21
keyboards/hadron/keymaps/side_numpad/config.h
Normal file
21
keyboards/hadron/keymaps/side_numpad/config.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef CONFIG_USER_H
|
||||
#define CONFIG_USER_H
|
||||
|
||||
#include "../../config.h"
|
||||
|
||||
#define LEADER_TIMEOUT 300
|
||||
//#define BACKLIGHT_BREATHING
|
||||
#define PREVENT_STUCK_MODIFIERS
|
||||
|
||||
#define USE_I2C
|
||||
#define SSD1306OLED
|
||||
#define OLED_ROTATE180
|
||||
|
||||
/* ws2812 RGB LED*/
|
||||
#define RGB_DI_PIN D4
|
||||
#define RGBLIGHT_ANIMATIONS
|
||||
#define RGBLED_NUM 14 // Number of LEDs
|
||||
#define RGBLIGHT_HUE_STEP 10
|
||||
#define RGBLIGHT_SAT_STEP 17
|
||||
|
||||
#endif
|
505
keyboards/hadron/keymaps/side_numpad/keymap.c
Normal file
505
keyboards/hadron/keymaps/side_numpad/keymap.c
Normal file
@@ -0,0 +1,505 @@
|
||||
#include "hadron.h"
|
||||
#include "bootloader.h"
|
||||
#include "action_layer.h"
|
||||
#include "eeconfig.h"
|
||||
#include "LUFA/Drivers/Peripheral/TWI.h"
|
||||
#ifdef AUDIO_ENABLE
|
||||
#include "audio.h"
|
||||
#endif
|
||||
#ifdef USE_I2C
|
||||
#include "i2c.h"
|
||||
#endif
|
||||
#ifdef SSD1306OLED
|
||||
#include "ssd1306.h"
|
||||
#endif
|
||||
extern keymap_config_t keymap_config;
|
||||
|
||||
//Following line allows macro to read current RGB settings
|
||||
extern rgblight_config_t rgblight_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.
|
||||
#define _QWERTY 0
|
||||
#define _LOWER 3
|
||||
#define _RAISE 4
|
||||
#define _FNLAYER 6
|
||||
#define _NUMLAY 7
|
||||
#define _MOUSECURSOR 8
|
||||
#define _ADJUST 16
|
||||
|
||||
enum preonic_keycodes {
|
||||
QWERTY = SAFE_RANGE,
|
||||
COLEMAK,
|
||||
DVORAK,
|
||||
LOWER,
|
||||
RAISE,
|
||||
BACKLIT,
|
||||
RGBLED_TOGGLE,
|
||||
RGBLED_STEP_MODE,
|
||||
RGBLED_INCREASE_HUE,
|
||||
RGBLED_DECREASE_HUE,
|
||||
RGBLED_INCREASE_SAT,
|
||||
RGBLED_DECREASE_SAT,
|
||||
RGBLED_INCREASE_VAL,
|
||||
RGBLED_DECREASE_VAL,
|
||||
};
|
||||
|
||||
enum macro_keycodes {
|
||||
KC_DEMOMACRO,
|
||||
};
|
||||
|
||||
// Fillers to make layering more clear
|
||||
#define _______ KC_TRNS
|
||||
#define XXXXXXX KC_NO
|
||||
// Custom macros
|
||||
#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl
|
||||
#define CTL_TTAB CTL_T(KC_TAB) // Tap for Esc, hold for Ctrl
|
||||
#define CTL_ENT CTL_T(KC_ENT) // Tap for Enter, hold for Ctrl
|
||||
#define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift
|
||||
// Requires KC_TRNS/_______ for the trigger key in the destination layer
|
||||
#define LT_FN(kc) LT(_FNLAYER, kc) // L-ayer T-ap Function Layer
|
||||
#define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor
|
||||
#define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise
|
||||
#define TG_NUMLAY TG(_NUMLAY) //Toggle for layer _NUMLAY
|
||||
#define DEMOMACRO M(KC_DEMOMACRO) // My login macros
|
||||
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
/* Qwerty
|
||||
* ,------+------+------+------+------+------------------------------------------------.
|
||||
* | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | 7 | 8 | 9 |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | CAPS | A | S | D | F | G | H | J | K | L | ; |Enter | 4 | 5 | 6 |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Shift| Z | X | C | V | B | N | M | , | . | / | = | 1 | 2 | 3 |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | ~ | Ctrl | Alt | GUI |Lower |Space |Space |Raise | RAlt | Ins | Del |NumLay| 0 | . | ENT |
|
||||
* `--------------------------------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_QWERTY] = KEYMAP(
|
||||
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_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, KC_P7, KC_P8, KC_P9, \
|
||||
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, LT_MC(KC_SCLN), CTL_ENT, KC_P4, KC_P5, KC_P6, \
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_EQL, KC_P1, KC_P2, KC_P3, \
|
||||
KC_GRV, KC_RCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_RALT, KC_INS, KC_DEL, TG_NUMLAY, KC_P0, KC_PDOT, KC_PENT \
|
||||
),
|
||||
|
||||
/* Lower
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | | | | | | | | | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||
* | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | ~ | \ | | | |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
|
||||
* | CAPS | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | [ | ] | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | Next | Vol- | Vol+ | Play | | | |
|
||||
* `--------------------------------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_LOWER] = KEYMAP(
|
||||
KC_ESC, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
|
||||
KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_GRV, KC_BSLS, _______, _______, _______, \
|
||||
KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_EQL, KC_LBRC, KC_RBRC, KC_PIPE, _______, _______, _______, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_LCBR, KC_RCBR, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, _______, _______\
|
||||
),
|
||||
|
||||
/* Raise
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||
* | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | ~ | \ | | | |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------|
|
||||
* | | A | Up | D | PrSc | | 4 | 5 | 6 | * | : | ' | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | Lt | Dn | Rt | Mute | | 1 | 2 | 3 | Up | / | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | |Space | 0 | | Left | Down | Right| | | | |
|
||||
* `--------------------------------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_RAISE] = KEYMAP(
|
||||
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_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_PLUS, KC_BSLS, _______, _______, _______, \
|
||||
_______, KC_A, KC_UP, KC_D, KC_PSCR, _______, KC_4, KC_5, KC_6, KC_PAST, KC_COLN, KC_QUOT, _______, _______, _______, \
|
||||
_______, KC_LEFT, KC_DOWN, KC_RIGHT, KC__MUTE, _______, KC_1, KC_2, KC_3, KC_UP, KC_SLSH, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, KC_SPC, KC_0, _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, _______, _______ \
|
||||
),
|
||||
|
||||
/* FN layer on Esc key
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | | | | | | | | | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||
* | | ! | @ | # | $ | % | ^ | & | * | ( | ) | + | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | F1 | F2 | F3 | F4 | F5 | F6 | _ | = | [ | ] | ' | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | { | } | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | Next | Vol- | Vol+ | Play | | | |
|
||||
* `--------------------------------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_FNLAYER] = KEYMAP(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\
|
||||
_______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PLUS, _______, _______, _______, \
|
||||
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_EQL, KC_LBRC, KC_RBRC, KC_QUOT, _______, _______, _______, \
|
||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS), S(KC_NUBS), KC_LCBR, KC_RCBR, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, _______, _______ \
|
||||
),
|
||||
|
||||
/* Num Layer
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | | | | | | | | | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||
* | | | | | | | | | | | | | F7 | F8 | F9 |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | | F4 | F5 | F6 |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | | | Up | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | Exit | Left | Down | Rght |
|
||||
* `--------------------------------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_NUMLAY] = KEYMAP(
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_HOME, KC_PGUP, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PMNS, KC_UP, KC_PPLS, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT \
|
||||
),
|
||||
|
||||
/* Mouse Layer (semi-col)
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | |ACCL0| ACCL1| ACCL2 | | | | | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||
* | | | | | | Home | Wh_Up| WHL_L| M_Up | WHL_R| | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | End | Wh_Dn| M_Lft| M_Dn | M_Rt | | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | BTN2 | BTN3 | BTN4 | BTN5 | | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | BTN1 | | | | BTN1 | | | | | |
|
||||
* `--------------------------------------------------------------------------------------------------------'
|
||||
*/
|
||||
|
||||
[_MOUSECURSOR] = KEYMAP(
|
||||
_______, KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______,\
|
||||
_______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_WH_L, KC_MS_U, KC_WH_R, DEMOMACRO, _______, _______, _______, _______, \
|
||||
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_END , KC_PGDN, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, _______, _______, _______, \
|
||||
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5, _______, _______, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
),
|
||||
|
||||
/* Adjust (Lower + Raise)
|
||||
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Reset| | | | | | | | | VolD | VolU | Mute |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+--------------------.
|
||||
* | |RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | Del | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty| | | | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | BL + |BL ST |BLSTEP| BL TG| | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | | | | |
|
||||
* `--------------------------------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_ADJUST] = KEYMAP(
|
||||
RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_VOLD, KC_VOLU, KC_MUTE, \
|
||||
_______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, KC_DEL, _______, _______, _______, \
|
||||
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______, _______, _______, _______, \
|
||||
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, _______, _______, _______, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
|
||||
)
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
|
||||
float tone_startup[][2] = SONG(STARTUP_SOUND);
|
||||
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
|
||||
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
|
||||
float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
|
||||
#endif
|
||||
|
||||
// define variables for reactive RGB
|
||||
bool RGB_INIT = false;
|
||||
bool TOG_STATUS = false;
|
||||
bool NUMLAY_STATUS = false;
|
||||
int RGB_current_mode;
|
||||
|
||||
|
||||
|
||||
void persistant_default_layer_set(uint16_t default_layer) {
|
||||
eeconfig_update_default_layer(default_layer);
|
||||
default_layer_set(default_layer);
|
||||
}
|
||||
|
||||
void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
|
||||
if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
|
||||
rgblight_mode(RGB_current_mode);
|
||||
layer_on(layer3);
|
||||
} else {
|
||||
layer_off(layer3);
|
||||
}
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case QWERTY:
|
||||
if (record->event.pressed) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
|
||||
#endif
|
||||
persistant_default_layer_set(1UL<<_QWERTY);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case LOWER:
|
||||
if (record->event.pressed) {
|
||||
//not sure how to have keyboard check mode and set it to a variable, so my work around
|
||||
//uses another variable that would be set to true after the first time a reactive key is pressed.
|
||||
if (RGB_INIT) {} else {
|
||||
RGB_current_mode = rgblight_config.mode;
|
||||
RGB_INIT = true;
|
||||
}
|
||||
if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
|
||||
} else {
|
||||
TOG_STATUS = !TOG_STATUS;
|
||||
rgblight_mode(16);
|
||||
}
|
||||
layer_on(_LOWER);
|
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||
} else {
|
||||
rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
|
||||
TOG_STATUS = false;
|
||||
layer_off(_LOWER);
|
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case RAISE:
|
||||
if (record->event.pressed) {
|
||||
//not sure how to have keyboard check mode and set it to a variable, so my work around
|
||||
//uses another variable that would be set to true after the first time a reactive key is pressed.
|
||||
if (RGB_INIT) {} else {
|
||||
RGB_current_mode = rgblight_config.mode;
|
||||
RGB_INIT = true;
|
||||
}
|
||||
if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
|
||||
} else {
|
||||
TOG_STATUS = !TOG_STATUS;
|
||||
rgblight_mode(15);
|
||||
}
|
||||
layer_on(_RAISE);
|
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||
} else {
|
||||
rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
|
||||
layer_off(_RAISE);
|
||||
TOG_STATUS = false;
|
||||
update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case BACKLIT:
|
||||
if (record->event.pressed) {
|
||||
register_code(KC_RSFT);
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
backlight_step();
|
||||
#endif
|
||||
} else {
|
||||
unregister_code(KC_RSFT);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
//my attempt for RGB layer lock indication via changing the mode, still have to figure out how to not have other keypress not override this mode
|
||||
case TG_NUMLAY:
|
||||
if (record->event.pressed) {
|
||||
if (RGB_INIT) {} else {
|
||||
RGB_current_mode = rgblight_config.mode;
|
||||
RGB_INIT = true;
|
||||
}
|
||||
NUMLAY_STATUS = !NUMLAY_STATUS;
|
||||
if (NUMLAY_STATUS) {
|
||||
rgblight_mode(4);
|
||||
layer_on(_NUMLAY);
|
||||
} else {
|
||||
rgblight_mode(RGB_current_mode);
|
||||
layer_off(_NUMLAY); }
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case RGB_MOD:
|
||||
//led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
|
||||
if (record->event.pressed) {
|
||||
rgblight_mode(RGB_current_mode);
|
||||
rgblight_step();
|
||||
RGB_current_mode = rgblight_config.mode;
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void matrix_init_user(void) {
|
||||
#ifdef USE_I2C
|
||||
i2c_master_init();
|
||||
#ifdef SSD1306OLED
|
||||
// calls code for the SSD1306 OLED
|
||||
_delay_ms(400);
|
||||
TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
|
||||
iota_gfx_init(); // turns on the display
|
||||
#endif
|
||||
#endif
|
||||
#ifdef AUDIO_ENABLE
|
||||
startup_user();
|
||||
#endif
|
||||
}
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
#ifdef SSD1306OLED
|
||||
iota_gfx_task(); // this is what updates the display continuously
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
|
||||
void startup_user()
|
||||
{
|
||||
_delay_ms(20); // gets rid of tick
|
||||
PLAY_NOTE_ARRAY(tone_startup, false, 0);
|
||||
}
|
||||
|
||||
void shutdown_user()
|
||||
{cc
|
||||
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
|
||||
_delay_ms(150);
|
||||
stop_all_notes();
|
||||
}
|
||||
|
||||
void music_on_user(void)
|
||||
{
|
||||
music_scale_user();
|
||||
}
|
||||
|
||||
void music_scale_user(void)
|
||||
{
|
||||
PLAY_NOTE_ARRAY(music_scale, false, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macro definition
|
||||
*/
|
||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||
{
|
||||
if (!eeconfig_is_enabled()) {
|
||||
eeconfig_init();
|
||||
}
|
||||
|
||||
switch (id) {
|
||||
case KC_DEMOMACRO:
|
||||
if (record->event.pressed){
|
||||
return MACRO (I(1), T(H),T(E),T(L), T(L), T(O), T(SPACE), T(W), T(O), T(R), T(L), T(D), END);
|
||||
}
|
||||
}
|
||||
|
||||
return MACRO_NONE;
|
||||
}
|
||||
|
||||
void matrix_update(struct CharacterMatrix *dest,
|
||||
const struct CharacterMatrix *source) {
|
||||
if (memcmp(dest->display, source->display, sizeof(dest->display))) {
|
||||
memcpy(dest->display, source->display, sizeof(dest->display));
|
||||
dest->dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
//assign the right code to your layers for OLED display
|
||||
#define L_BASE 0
|
||||
#define L_LOWER 8
|
||||
#define L_RAISE 16
|
||||
#define L_FNLAYER 64
|
||||
#define L_NUMLAY 128
|
||||
#define L_NLOWER 136
|
||||
#define L_NFNLAYER 192
|
||||
#define L_MOUSECURSOR 256
|
||||
#define L_ADJUST 65560
|
||||
|
||||
void iota_gfx_task_user(void) {
|
||||
#if DEBUG_TO_SCREEN
|
||||
if (debug_enable) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct CharacterMatrix matrix;
|
||||
|
||||
matrix_clear(&matrix);
|
||||
matrix_write_P(&matrix, PSTR("USB: "));
|
||||
#ifdef PROTOCOL_LUFA
|
||||
switch (USB_DeviceState) {
|
||||
case DEVICE_STATE_Unattached:
|
||||
matrix_write_P(&matrix, PSTR("Unattached"));
|
||||
break;
|
||||
case DEVICE_STATE_Suspended:
|
||||
matrix_write_P(&matrix, PSTR("Suspended"));
|
||||
break;
|
||||
case DEVICE_STATE_Configured:
|
||||
matrix_write_P(&matrix, PSTR("Connected"));
|
||||
break;
|
||||
case DEVICE_STATE_Powered:
|
||||
matrix_write_P(&matrix, PSTR("Powered"));
|
||||
break;
|
||||
case DEVICE_STATE_Default:
|
||||
matrix_write_P(&matrix, PSTR("Default"));
|
||||
break;
|
||||
case DEVICE_STATE_Addressed:
|
||||
matrix_write_P(&matrix, PSTR("Addressed"));
|
||||
break;
|
||||
default:
|
||||
matrix_write_P(&matrix, PSTR("Invalid"));
|
||||
}
|
||||
#endif
|
||||
|
||||
// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
|
||||
|
||||
char buf[40];
|
||||
snprintf(buf,sizeof(buf), "Undef-%ld", layer_state);
|
||||
matrix_write_P(&matrix, PSTR("\n\nLayer: "));
|
||||
switch (layer_state) {
|
||||
case L_BASE:
|
||||
matrix_write_P(&matrix, PSTR("Default"));
|
||||
break;
|
||||
case L_RAISE:
|
||||
matrix_write_P(&matrix, PSTR("Raise"));
|
||||
break;
|
||||
case L_LOWER:
|
||||
matrix_write_P(&matrix, PSTR("Lower"));
|
||||
break;
|
||||
case L_ADJUST:
|
||||
matrix_write_P(&matrix, PSTR("ADJUST"));
|
||||
break;
|
||||
default:
|
||||
matrix_write(&matrix, buf);
|
||||
}
|
||||
|
||||
// Host Keyboard LED Status
|
||||
char led[40];
|
||||
snprintf(led, sizeof(led), "\n%s %s %s",
|
||||
(host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
|
||||
(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
|
||||
(host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
|
||||
matrix_write(&matrix, led);
|
||||
matrix_update(&display, &matrix);
|
||||
}
|
2
keyboards/hadron/keymaps/side_numpad/readme.md
Normal file
2
keyboards/hadron/keymaps/side_numpad/readme.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# The Default Planck Layout
|
||||
|
66
keyboards/hadron/out.txt
Normal file
66
keyboards/hadron/out.txt
Normal file
@@ -0,0 +1,66 @@
|
||||
-------- begin --------
|
||||
avr-gcc.exe (AVR_8_bit_GNU_Toolchain_3.5.0_1662) 4.9.2
|
||||
Copyright (C) 2014 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Compiling: ../../keyboards/planck/planck.c [32;01m[OK][0m
|
||||
Compiling: ../../keyboards/planck/keymaps/experimental/keymap.c [33;01m[WARNINGS][0m
|
||||
|
|
||||
| ../../keyboards/planck/keymaps/experimental/keymap.c: In function 'action_get_macro':
|
||||
| ../../keyboards/planck/keymaps/experimental/keymap.c:227:17: warning: implicit declaration of function 'breathing_speed_set' [-Wimplicit-function-declaration]
|
||||
| breathing_speed_set(2);
|
||||
| ^
|
||||
| ../../keyboards/planck/keymaps/experimental/keymap.c:228:17: warning: implicit declaration of function 'breathing_pulse' [-Wimplicit-function-declaration]
|
||||
| breathing_pulse();
|
||||
| ^
|
||||
|
|
||||
Compiling: ../../quantum/quantum.c [32;01m[OK][0m
|
||||
Compiling: ../../quantum/keymap.c [32;01m[OK][0m
|
||||
Compiling: ../../quantum/keycode_config.c [32;01m[OK][0m
|
||||
Compiling: ../../quantum/matrix.c [32;01m[OK][0m
|
||||
Compiling: ../../quantum/audio/audio.c [32;01m[OK][0m
|
||||
Compiling: ../../quantum/audio/voices.c [32;01m[OK][0m
|
||||
Compiling: ../../quantum/audio/luts.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/protocol/lufa/lufa.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/protocol/lufa/descriptor.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Class/Common/HIDParser.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/ConfigDescriptors.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/DeviceStandardReq.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/Events.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/HostStandardReq.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/USBTask.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/host.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/keyboard.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/action.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/action_tapping.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/action_macro.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/action_layer.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/action_util.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/print.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/debug.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/util.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/avr/suspend.c [32;01m[OK][0m
|
||||
Assembling: ../../tmk_core/common/avr/xprintf.S [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/avr/timer.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/avr/bootloader.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/magic.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/avr/eeconfig.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/mousekey.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/command.c [32;01m[OK][0m
|
||||
Compiling: ../../tmk_core/common/backlight.c [32;01m[OK][0m
|
||||
Linking: .build/planck_experimental.elf [31;01m[ERRORS][0m
|
||||
|
|
||||
| .build/obj_planck_experimental/keyboards/planck/keymaps/experimental/keymap.o: In function `action_get_macro':
|
||||
| C:\Users\Fred Wales\Documents\Programming\qmk_firmware\keyboards\planck/../../keyboards/planck/keymaps/experimental/keymap.c:240: undefined reference to `breathing_speed_set'
|
||||
| C:\Users\Fred Wales\Documents\Programming\qmk_firmware\keyboards\planck/../../keyboards/planck/keymaps/experimental/keymap.c:241: undefined reference to `breathing_pulse'
|
||||
| collect2.exe: error: ld returned 1 exit status
|
||||
|
|
1
keyboards/hadron/readme.md
Normal file
1
keyboards/hadron/readme.md
Normal file
@@ -0,0 +1 @@
|
||||
|
72
keyboards/hadron/rules.mk
Normal file
72
keyboards/hadron/rules.mk
Normal file
@@ -0,0 +1,72 @@
|
||||
# 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)
|
||||
|
||||
# Interrupt driven control endpoint task(+60)
|
||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
|
||||
|
||||
# Boot Section Size in *bytes*
|
||||
# Teensy halfKay 512
|
||||
# Teensy++ halfKay 1024
|
||||
# Atmel DFU loader 4096
|
||||
# LUFA bootloader 4096
|
||||
# USBaspLoader 2048
|
||||
OPT_DEFS += -DBOOTLOADER_SIZE=512
|
||||
|
||||
# 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 ?= 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 = yes
|
||||
|
||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
|
||||
|
||||
SRC = i2c.c \
|
||||
ssd1306.c
|
||||
|
3
keyboards/hadron/ver0/Makefile
Normal file
3
keyboards/hadron/ver0/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
ifndef MAKEFILE_INCLUDED
|
||||
include ../../../Makefile
|
||||
endif
|
35
keyboards/hadron/ver0/config.h
Normal file
35
keyboards/hadron/ver0/config.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
#ifndef VER0_CONFIG_H
|
||||
#define VER0_CONFIG_H
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define DEVICE_VER 0x0001
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 15
|
||||
|
||||
/* Hadron Ver0 PCB default pin-out */
|
||||
#define MATRIX_ROW_PINS { D7, E6, B4, B5, B6 }
|
||||
#define MATRIX_COL_PINS { F6, F7, C6, C7, F5, F4, F1, F0, D2, D3, D5, B3, B2, B1, B0 }
|
||||
#define UNUSED_PINS
|
||||
|
||||
|
||||
#endif
|
5
keyboards/hadron/ver0/rules.mk
Normal file
5
keyboards/hadron/ver0/rules.mk
Normal file
@@ -0,0 +1,5 @@
|
||||
#AUDIO_ENABLE ?= yes # Audio output on port C6
|
||||
|
||||
ifndef QUANTUM_DIR
|
||||
include ../../../Makefile
|
||||
endif
|
1
keyboards/hadron/ver0/ver0.c
Normal file
1
keyboards/hadron/ver0/ver0.c
Normal file
@@ -0,0 +1 @@
|
||||
#include "ver0.h"
|
6
keyboards/hadron/ver0/ver0.h
Normal file
6
keyboards/hadron/ver0/ver0.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef VER0_H
|
||||
#define VER0_H
|
||||
|
||||
#include "../hadron.h"
|
||||
|
||||
#endif
|
3
keyboards/hadron/ver2/Makefile
Normal file
3
keyboards/hadron/ver2/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
ifndef MAKEFILE_INCLUDED
|
||||
include ../../../Makefile
|
||||
endif
|
35
keyboards/hadron/ver2/config.h
Normal file
35
keyboards/hadron/ver2/config.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
#ifndef VER2_CONFIG_H
|
||||
#define VER2_CONFIG_H
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define DEVICE_VER 0x0002
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 15
|
||||
|
||||
/* Hadron Ver0 PCB default pin-out */
|
||||
#define MATRIX_ROW_PINS { D7, E6, B4, B5, B6 }
|
||||
#define MATRIX_COL_PINS { F6, F7, D6, C7, F5, F4, F1, F0, D2, D3, D5, B3, B2, B1, B0 }
|
||||
#define UNUSED_PINS
|
||||
|
||||
|
||||
#endif
|
5
keyboards/hadron/ver2/rules.mk
Normal file
5
keyboards/hadron/ver2/rules.mk
Normal file
@@ -0,0 +1,5 @@
|
||||
#AUDIO_ENABLE ?= yes # Audio output on port C6
|
||||
|
||||
ifndef QUANTUM_DIR
|
||||
include ../../../Makefile
|
||||
endif
|
1
keyboards/hadron/ver2/ver2.c
Normal file
1
keyboards/hadron/ver2/ver2.c
Normal file
@@ -0,0 +1 @@
|
||||
#include "ver2.h"
|
6
keyboards/hadron/ver2/ver2.h
Normal file
6
keyboards/hadron/ver2/ver2.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef VER2_H
|
||||
#define VER2_H
|
||||
|
||||
#include "../hadron.h"
|
||||
|
||||
#endif
|
@@ -67,15 +67,3 @@ RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this
|
||||
|
||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
|
||||
avrdude: build
|
||||
ls /dev/tty* > /tmp/1; \
|
||||
echo "Reset your Pro Micro now"; \
|
||||
while [[ -z $$USB ]]; do \
|
||||
sleep 1; \
|
||||
ls /dev/tty* > /tmp/2; \
|
||||
USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \
|
||||
done; \
|
||||
avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex
|
||||
|
||||
.PHONY: avrdude
|
||||
|
@@ -69,15 +69,3 @@ AUDIO_ENABLE ?= no # Audio output on port C6
|
||||
ifndef QUANTUM_DIR
|
||||
include ../../../Makefile
|
||||
endif
|
||||
|
||||
avrdude: build
|
||||
ls /dev/tty* > /tmp/1; \
|
||||
echo "Reset your Pro Micro now"; \
|
||||
while [[ -z $$USB ]]; do \
|
||||
sleep 1; \
|
||||
ls /dev/tty* > /tmp/2; \
|
||||
USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \
|
||||
done; \
|
||||
avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex
|
||||
|
||||
.PHONY: avrdude
|
||||
|
@@ -5,7 +5,7 @@ This firmware is for a Magicforce 68 that's had its PCB removed and is handwired
|
||||
|
||||
## Wiring Layout
|
||||
|
||||

|
||||

|
||||
|
||||
## Pinout
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user