Compare commits

...
7 Commits
Author SHA1 Message Date
Joshua DiamondandJames Young e0f548085c Add ability to blink lighting layer for a specified duration (#8760)
* Implement momentarily blink of lighting layers

* Refactor spidey3 userspace to use rgb layer blink

* Remove un-necessary line from example in documentation

* Revert "Refactor spidey3 userspace to use rgb layer blink"

This reverts commit 831649bb680c41c6d663ae6fa86d13f4f8bebdd8.

* Adds a missing bit of documentation about lighting layer blink

* Update docs/feature_rgblight.md per suggestions

Co-authored-by: James Young <[email protected]>

* Update docs/feature_rgblight.md per suggestions

Co-authored-by: James Young <[email protected]>

* Update docs/feature_rgblight.md per suggestions

Co-authored-by: James Young <[email protected]>

* cformat, as suggested

Co-authored-by: James Young <[email protected]>
2020-05-09 01:38:33 -07:00
Konstantin Đorđević 94fc32f431 Fix bug in UC_RMOD, add shift and audio support for UC_MOD/UC_RMOD(#8674)
* Invert UC_MOD/UC_RMOD direction when Shift is held

Also use MOD_MASK_SHIFT in process_rgb.c

* Allow audio to be played for UC_MOD, UC_RMOD keycodes as well

* Fix signedness bug in reverse input mode cycling

* Misc formatting in process_unicode_common.c

* Address clang-format issues

* Make decode_utf8 helper function file-local (static)
2020-05-09 01:22:02 -07:00
1f7bbf279c [Keyboard] Added D48 keyboard (#8548)
* [Keyboard] Added D48 keyboard.

* Updated README.

* Cleanups.

* Moved d48 to handwired/

* Added link to build process album.

* Coding conventions cleanups.

* Added DS1307 RTC!

* Minor cleanups.

* Apply suggestions from code review

Co-Authored-By: Drashna Jaelre <[email protected]>

* Minor refactoring.

* Readme fix.

* Moved leftover keymap-specific code from keyboard space into keymap.

* Added encoder button pins to extra matrix row.

* Updated README, updated pinout & cleaned up the glcdfont

* Apply suggestions from code review

Co-Authored-By: Drashna Jaelre <[email protected]>

* Update config.h

* Apply suggestions from code review

Co-Authored-By: Ryan <[email protected]>

* Added default keymap. Refactored existing keymap.

* Update keyboards/handwired/d48/README.md

Co-Authored-By: Ryan <[email protected]>

* Apply suggestions from code review

Co-Authored-By: Joel Challis <[email protected]>

* Minor alignment fix.

* Update keyboards/handwired/d48/glcdfont_d48.c

Co-Authored-By: Ryan <[email protected]>

* Changes as per PR.

* Apply suggestions from code review

Co-authored-by: James Young <[email protected]>

Co-authored-by: Drashna Jaelre <[email protected]>
Co-authored-by: Ryan <[email protected]>
Co-authored-by: Joel Challis <[email protected]>
Co-authored-by: James Young <[email protected]>
2020-05-08 23:59:50 -07:00
milestogo 803610a284 [Keymap] initial user directory for milestogo + babblepaste (#7698)
* initial user directory

* fix missing endif in vi mode

* fix includes per drashna and a few typos. I have not tested the userspace keymap, it is just there to help keep the user space and keymap in sync

* move babblepaste docs to md format

* clean up block quotes

* TIL clang-format - miles2go userspace
2020-05-08 23:15:26 -07:00
OsciX cd0edbb1fb [Keyboard] Shambles TKL (#8500)
* Add support for the Shambles TKL

* Fix Shambles files

* Add files via upload

* Fix Shambles again

* Delete shambles.h.h

* Delete shambles.c.c

* Add files via upload

* Delete Makefile

* Apply suggestions from code review

* Fix default layout to work with review

* Apply suggestions from code review

* Add info files

* Update readme.md

* Update keyboards/shambles/readme.md
2020-05-08 17:08:19 -07:00
Eriq M. Adams 6919772fb9 Add TENKI keyboard (#9029)
* Add TENKI keyboard

Add TENKI keyboard, default keymap and via keymap

* Minor Update Readme.md

Change description of hardware supported

* change layout name

change layout name from ortho_20 to ortho_5x4

* Fix invalid format in info.json

Fix invalid format in info.json

* Fix invalid format

* Fix formatting

Fix formatting tenki.h

* Fix formatting in keymap.c

Fix formatting in keymap.c

* Add new line at EOF info.json

Add new line at EOF

* Fix formatting

* Fix formatting

* Update rules.mk

Fix Formatting
2020-05-08 23:57:11 +01:00
tominabox1andJames Young fedd8e81d1 Add Le Chiffre keyboard (#8995)
* Initial

* update json, added basic oled config, updated matrix to correct rotary location

* disable oled by default

* Tuned oled for release

* Completed OLED function implementation
Correct spelling error in readme

* Fixed image in readme

* Should not be in this branch

* Incorporating recommended changes by zvecr

* Update keyboards/le_chiffre/info.json

Co-authored-by: James Young <[email protected]>

* Update keyboards/le_chiffre/readme.md

Co-authored-by: James Young <[email protected]>

Co-authored-by: James Young <[email protected]>
2020-05-08 23:54:55 +01:00
72 changed files with 4542 additions and 54 deletions

No files matched your search

+3 -1
View File
@@ -191,7 +191,9 @@ If you define these options you will enable the associated feature, which may in
* `#define RGBLIGHT_ANIMATIONS` * `#define RGBLIGHT_ANIMATIONS`
* run RGB animations * run RGB animations
* `#define RGBLIGHT_LAYERS` * `#define RGBLIGHT_LAYERS`
* Lets you define [lighting layers](feature_rgblight.md) that can be toggled on or off. Great for showing the current keyboard layer or caps lock state. * Lets you define [lighting layers](feature_rgblight.md?id=lighting-layers) that can be toggled on or off. Great for showing the current keyboard layer or caps lock state.
* `#define RGBLIGHT_LAYER_BLINK`
* Adds ability to [blink](feature_rgblight.md?id=lighting-layer-blink) a lighting layer for a specified number of milliseconds (e.g. to acknowledge an action).
* `#define RGBLED_NUM 12` * `#define RGBLED_NUM 12`
* number of LEDs * number of LEDs
* `#define RGBLIGHT_SPLIT` * `#define RGBLIGHT_SPLIT`
+41 -2
View File
@@ -177,6 +177,8 @@ const uint8_t RGBLED_GRADIENT_RANGES[] PROGMEM = {255, 170, 127, 85, 64};
By including `#define RGBLIGHT_LAYERS` in your `config.h` file you can enable lighting layers. These make By including `#define RGBLIGHT_LAYERS` in your `config.h` file you can enable lighting layers. These make
it easy to use your underglow LEDs as status indicators to show which keyboard layer is currently active, or the state of caps lock, all without disrupting any animations. [Here's a video](https://youtu.be/uLGE1epbmdY) showing an example of what you can do. it easy to use your underglow LEDs as status indicators to show which keyboard layer is currently active, or the state of caps lock, all without disrupting any animations. [Here's a video](https://youtu.be/uLGE1epbmdY) showing an example of what you can do.
### Defining Lighting Layers :id=defining-lighting-layers
To define a layer, we modify `keymap.c` to list out LED ranges and the colors we want to overlay on them using an array of `rgblight_segment_t` using the `RGBLIGHT_LAYER_SEGMENTS` macro. We can define multiple layers and enable/disable them independently: To define a layer, we modify `keymap.c` to list out LED ranges and the colors we want to overlay on them using an array of `rgblight_segment_t` using the `RGBLIGHT_LAYER_SEGMENTS` macro. We can define multiple layers and enable/disable them independently:
```c ```c
@@ -211,8 +213,12 @@ void keyboard_post_init_user(void) {
rgblight_layers = my_rgb_layers; rgblight_layers = my_rgb_layers;
} }
``` ```
Note: For split keyboards with two controllers, both sides need to be flashed when updating the contents of rgblight_layers.
Finally, we enable and disable the lighting layers whenever the state of the keyboard changes: ### Enabling and disabling lighting layers :id=enabling-lighting-layers
Everything above just configured the definition of each lighting layer.
We can now enable and disable the lighting layers whenever the state of the keyboard changes:
```c ```c
layer_state_t layer_state_set_user(layer_state_t state) { layer_state_t layer_state_set_user(layer_state_t state) {
@@ -228,7 +234,40 @@ bool led_update_user(led_t led_state) {
} }
``` ```
Note: For split keyboards with two controllers, both sides need to be flashed when updating the contents of rgblight_layers. ### Lighting layer blink :id=lighting-layer-blink
By including `#define RGBLIGHT_LAYER_BLINK` in your `config.h` file you can turn a lighting
layer on for a specified duration. Once the specified number of milliseconds has elapsed
the layer will be turned off. This is useful, e.g., if you want to acknowledge some
action (e.g. toggling some setting):
```c
const rgblight_segment_t PROGMEM _yes_layer[] = RGBLIGHT_LAYER_SEGMENTS( {9, 6, HSV_GREEN} );
const rgblight_segment_t PROGMEM _no_layer[] = RGBLIGHT_LAYER_SEGMENTS( {9, 6, HSV_RED} );
const rgblight_segment_t* const PROGMEM _rgb_layers[] =
RGBLIGHT_LAYERS_LIST( _yes_layer, _no_layer );
void keyboard_post_init_user(void) {
rgblight_layers = _rgb_layers;
}
// Note we user post_process_record_user because we want the state
// after the flag has been flipped...
void post_process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case DEBUG:
rgblight_blink_layer(debug_enable ? 0 : 1, 500);
break;
case NK_TOGG:
case NK_ON:
case NK_OFF:
rgblight_blink_layer(keymap_config.nkro ? 0 : 1, 500);
break;
}
}
```
## Functions ## Functions
+87
View File
@@ -0,0 +1,87 @@
# D48
![Proton C based handwired 40% keyboard](https://i.imgur.com/2wCYuno.jpg)
A Proton C based handwired 48 key keyboard with 2 rotary encoders, I2C OLED, WS2812 strip, buzzer & clock!
- Keyboard Maintainer: Andrew Dunai
- Hardware Supported: Proton C handwired
Make example for this keyboard (after setting up your build environment):
make handwired/d48:default
## Details
- Proton C based handwired keyboard
- 2x custom 1.25mm stainless steel plates
- Kailh Choc White (clicky)
- 2x rotary encoders
- 0.91" 128x32 I<sup>2</sup>C OLED
- Small buzzer mounted inside (still waiting for the AST1109MLTRQ boys)
- WS2812 strip (14 LEDs)
- DS1307 I<sup>2</sup>C module real-time clock
Build process: [album](https://imgur.com/gallery/zZZGdDw)
## Pinout
![D48 pinout](https://imgur.com/QoStCvD.jpg)
## Challenges
I'm very happy with the result, but at some point Proton C was driving me nuts.
I did a lot of trial and error during assembly & programming.
There were a lot of *yet* undocumented caveats,
so I'll outline them here so that you guys can avoid the same issues I had.
## Matrix & encoders
Although this is a 48-key board with a 12-col & 4-row matrix, I've decided to add an extra row above the first one
to make my matrix 12x5 and wire encoders' push buttons as 2 extra keys, thus making it a total of 50 (12x4 + 2 encoders).
I used 2 columns (9 & 12) for those buttons.
So, a first row actually has 2 buttons on columns 9 & 12 (because encoders are located near those columns).
Encoders' push buttons are also configured via QMK's keymap.
Check out the `d48.h` & `config.h` for pins used & keymap macro definition.
## I<sup>2</sup>C/OLED
Most of the stuff worked out of the box, except me choosing the right pins for my OLED.
On the Proton C pinout, there are 3 labels for I<sup>2</sup>C and for some reason
there are 2 pairs of SDA/SCL for I<sup>2</sup>C<sup>1</sup> channel: `B8`/`B9` (rear left side) and `B6`/`B7` (rear right side).
I'm not sure if this is a mistake or if I was doing something wrong. So initially I picked `B8`/`B9`
which were not working. When I switched to B6/B7, things worked like a charm.
Later I used B9 for matrix row. No issues so far.
Oh, and by the way, while using `B8`/`B9`, keyboard was sometimes *swallowing* quick keypresses.
I believe this was due to I(2)C timeouts (because incorrect pins were used for OLED).
## Buzzer
It turns out once you switch on `AUDIO_ENABLE`, you cannot use A4 & A5 because they interfere with the buzzer.
My guess is that buzzer uses DAC channels (not sure why both).
I couldn't find this in documentation. Honestly, Proton C has almost zero documentation and this was
the biggest challenge. Anyway, apart from almost going crazy from those challenges, I really liked it!
## RGB
I used pin `A15` for my WS28128 RGB strip.
## D1307 real-time clock
Connecting DS1307 RTC was a piece of cake: same I<sup>2</sup> pins as OLED (SDA/SCL), GND to GND and power to Proton C VUSB pin (5v).
## Other issues
- `B5` could not be used for matrix.
- `TAP_CODE_DELAY` had to be increased to 10 to fix `tap_code(KC_VOLU/KC_VOLD)` calls being swallowed in encoder callback.
- Be extremely attentive about the pinout: keep in mind that **the official Proton C pinout displays the rear of the board, not the front.** Being used to front pinouts, I ended up soldering entire matrix to the wrong side, so I had to desolder every wire and connect it to the opposite side.
## Conclusion
I had a lot of fun. The layout was inspired by the Planck THK. Feel free to ask any questions!
+77
View File
@@ -0,0 +1,77 @@
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER Andrew Dunai
#define PRODUCT D48
/* Key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 12
/* Key matrix pins */
#define MATRIX_ROW_PINS { B8, B9, B1, B2, B4 }
#define MATRIX_COL_PINS { A2, B0, A7, A8, A13, A14, B12, B11, B10, B15, B14, B13 }
#define UNUSED_PINS
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* Set 0 if debouncing isn't needed */
// #define DEBOUNCE 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
// #define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
// #define LOCKING_RESYNC_ENABLE
/* prevent stuck modifiers */
// #define PREVENT_STUCK_MODIFIERS
/* RGB Underglow */
#ifdef RGBLIGHT_ENABLE
#define RGB_DI_PIN A15
#define RGBLED_NUM 14
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
#define RGBLIGHT_ANIMATIONS
#endif
/* Audio */
#ifdef AUDIO_ENABLE
#define STARTUP_SONG_DOOM SONG(E1M1_DOOM)
#define STARTUP_SONG SONG( \
Q__NOTE(_E6), \
Q__NOTE(_A6), \
H__NOTE(_E7), \
Q__NOTE(_E6), \
Q__NOTE(_E7) \
)
#endif
/* Encoders */
#define ENCODERS_PAD_A { B3, A0 }
#define ENCODERS_PAD_B { A6, A1 }
/* #define ENCODER_RESOLUTION 4 */
/* OLED */
#define OLED_FONT_H "glcdfont_d48.c"
#define OLED_TIMEOUT 0
// #define OLED_SCROLL_TIMEOUT 1000
/* Taps (encoder tap_code) */
#define TAP_CODE_DELAY 10
/* I2C */
//#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
//#define PAL_MODE_STM32_ALTERNATE_OPENDRAIN (PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN)
/* DS1307 */
#define DS1307_ADDR (0x68 << 1)
+1
View File
@@ -0,0 +1 @@
#include "d48.h"
+19
View File
@@ -0,0 +1,19 @@
#pragma once
#include "quantum.h"
#define ___ KC_NO
#define LAYOUT( \
K08, K0B, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, \
K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B \
) { \
{ ___, ___, ___, ___, ___, ___, ___, ___, K08, ___, ___, K0B }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B }, \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B }, \
{ K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B } \
}
+21
View File
@@ -0,0 +1,21 @@
#include "ds1307.h"
#include "i2c_master.h"
void ds1307_set_time(uint8_t h, uint8_t m, uint8_t s) {
uint8_t data[] = {
((s % 10) | ((s / 10) << 4)) & 0x7F,
((m % 10) | ((m / 10) << 4)) & 0x7F,
((h % 10) | ((h / 10) << 4)) & 0x3F,
0, 0, 0, 0, 0
}; // 24-hour mode
i2c_writeReg(DS1307_ADDR, 0, data, 8, 100);
}
void ds1307_get_time(uint8_t *h, uint8_t *m, uint8_t *s) {
uint8_t data[3];
i2c_readReg(DS1307_ADDR, 0, data, 3, 100);
i2c_stop();
*s = (data[0] & 0b1111) + ((data[0] & 0b1110000) >> 4) * 10;
*m = (data[1] & 0b1111) + ((data[1] & 0b1110000) >> 4) * 10;
*h = (data[2] & 0b1111) + ((data[2] & 0b0110000) >> 4) * 10;
}
+6
View File
@@ -0,0 +1,6 @@
#pragma once
#include <stdint.h>
void ds1307_set_time(uint8_t h, uint8_t m, uint8_t s);
void ds1307_get_time(uint8_t *h, uint8_t *m, uint8_t *s);
+231
View File
@@ -0,0 +1,231 @@
#include "progmem.h"
// Helidox 8x6 font with QMK Firmware Logo
// Online editor: http://teripom.x0.com/
static const unsigned char font[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00,
0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00,
0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00,
0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00,
0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00,
0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00,
0x00, 0x00, 0x08, 0x08, 0x00, 0x00,
0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00,
0x00, 0x18, 0x24, 0x18, 0x00, 0x00,
0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00,
0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00,
0x26, 0x29, 0x79, 0x29, 0x26, 0x00,
0x40, 0x7F, 0x05, 0x05, 0x07, 0x00,
0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00,
0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00,
0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00,
0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00,
0x14, 0x22, 0x7F, 0x22, 0x14, 0x00,
0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00,
0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00,
0x00, 0x66, 0x89, 0x95, 0x6A, 0x00,
0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00,
0x08, 0x04, 0x7E, 0x04, 0x08, 0x00,
0x10, 0x20, 0x7E, 0x20, 0x10, 0x00,
0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00,
0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00,
0x1E, 0x10, 0x10, 0x10, 0x10, 0x00,
0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00,
0x30, 0x38, 0x3E, 0x38, 0x30, 0x00,
0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x5F, 0x00, 0x00, 0x00,
0x00, 0x07, 0x00, 0x07, 0x00, 0x00,
0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00,
0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00,
0x23, 0x13, 0x08, 0x64, 0x62, 0x00,
0x36, 0x49, 0x56, 0x20, 0x50, 0x00,
0x00, 0x08, 0x07, 0x03, 0x00, 0x00,
0x00, 0x1C, 0x22, 0x41, 0x00, 0x00,
0x00, 0x41, 0x22, 0x1C, 0x00, 0x00,
0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00,
0x08, 0x08, 0x3E, 0x08, 0x08, 0x00,
0x00, 0x80, 0x70, 0x30, 0x00, 0x00,
0x08, 0x08, 0x08, 0x08, 0x08, 0x00,
0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
0x20, 0x10, 0x08, 0x04, 0x02, 0x00,
0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00,
0x00, 0x42, 0x7F, 0x40, 0x00, 0x00,
0x72, 0x49, 0x49, 0x49, 0x46, 0x00,
0x21, 0x41, 0x49, 0x4D, 0x33, 0x00,
0x18, 0x14, 0x12, 0x7F, 0x10, 0x00,
0x27, 0x45, 0x45, 0x45, 0x39, 0x00,
0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00,
0x41, 0x21, 0x11, 0x09, 0x07, 0x00,
0x36, 0x49, 0x49, 0x49, 0x36, 0x00,
0x46, 0x49, 0x49, 0x29, 0x1E, 0x00,
0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
0x00, 0x40, 0x34, 0x00, 0x00, 0x00,
0x00, 0x08, 0x14, 0x22, 0x41, 0x00,
0x14, 0x14, 0x14, 0x14, 0x14, 0x00,
0x00, 0x41, 0x22, 0x14, 0x08, 0x00,
0x02, 0x01, 0x59, 0x09, 0x06, 0x00,
0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00,
0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00,
0x7F, 0x49, 0x49, 0x49, 0x36, 0x00,
0x3E, 0x41, 0x41, 0x41, 0x22, 0x00,
0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00,
0x7F, 0x49, 0x49, 0x49, 0x41, 0x00,
0x7F, 0x09, 0x09, 0x09, 0x01, 0x00,
0x3E, 0x41, 0x41, 0x51, 0x73, 0x00,
0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00,
0x00, 0x41, 0x7F, 0x41, 0x00, 0x00,
0x20, 0x40, 0x41, 0x3F, 0x01, 0x00,
0x7F, 0x08, 0x14, 0x22, 0x41, 0x00,
0x7F, 0x40, 0x40, 0x40, 0x40, 0x00,
0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00,
0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00,
0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00,
0x7F, 0x09, 0x09, 0x09, 0x06, 0x00,
0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00,
0x7F, 0x09, 0x19, 0x29, 0x46, 0x00,
0x26, 0x49, 0x49, 0x49, 0x32, 0x00,
0x03, 0x01, 0x7F, 0x01, 0x03, 0x00,
0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00,
0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00,
0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00,
0x63, 0x14, 0x08, 0x14, 0x63, 0x00,
0x03, 0x04, 0x78, 0x04, 0x03, 0x00,
0x61, 0x59, 0x49, 0x4D, 0x43, 0x00,
0x00, 0x7F, 0x41, 0x41, 0x41, 0x00,
0x02, 0x04, 0x08, 0x10, 0x20, 0x00,
0x00, 0x41, 0x41, 0x41, 0x7F, 0x00,
0x04, 0x02, 0x01, 0x02, 0x04, 0x00,
0x40, 0x40, 0x40, 0x40, 0x40, 0x00,
0x00, 0x03, 0x07, 0x08, 0x00, 0x00,
0x20, 0x54, 0x54, 0x78, 0x40, 0x00,
0x7F, 0x28, 0x44, 0x44, 0x38, 0x00,
0x38, 0x44, 0x44, 0x44, 0x28, 0x00,
0x38, 0x44, 0x44, 0x28, 0x7F, 0x00,
0x38, 0x54, 0x54, 0x54, 0x18, 0x00,
0x00, 0x08, 0x7E, 0x09, 0x02, 0x00,
0x18, 0xA4, 0xA4, 0x9C, 0x78, 0x00,
0x7F, 0x08, 0x04, 0x04, 0x78, 0x00,
0x00, 0x44, 0x7D, 0x40, 0x00, 0x00,
0x20, 0x40, 0x40, 0x3D, 0x00, 0x00,
0x7F, 0x10, 0x28, 0x44, 0x00, 0x00,
0x00, 0x41, 0x7F, 0x40, 0x00, 0x00,
0x7C, 0x04, 0x78, 0x04, 0x78, 0x00,
0x7C, 0x08, 0x04, 0x04, 0x78, 0x00,
0x38, 0x44, 0x44, 0x44, 0x38, 0x00,
0xFC, 0x18, 0x24, 0x24, 0x18, 0x00,
0x18, 0x24, 0x24, 0x18, 0xFC, 0x00,
0x7C, 0x08, 0x04, 0x04, 0x08, 0x00,
0x48, 0x54, 0x54, 0x54, 0x24, 0x00,
0x04, 0x04, 0x3F, 0x44, 0x24, 0x00,
0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00,
0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00,
0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00,
0x44, 0x28, 0x10, 0x28, 0x44, 0x00,
0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00,
0x44, 0x64, 0x54, 0x4C, 0x44, 0x00,
0x00, 0x08, 0x36, 0x41, 0x00, 0x00,
0x00, 0x00, 0x77, 0x00, 0x00, 0x00,
0x00, 0x41, 0x36, 0x08, 0x00, 0x00,
0x02, 0x01, 0x02, 0x04, 0x02, 0x00,
0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x60, 0x70, 0x78, 0x3C,
0x1E, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xE0,
0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
0xE0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x0F,
0x1F, 0xFE, 0xFE, 0xF8, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xF0, 0xFC, 0xFE, 0xFE, 0x3F,
0x1F, 0x0F, 0x0F, 0x0F, 0x0F, 0x9F,
0xFF, 0xFE, 0xFE, 0xFC, 0xF0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x3E, 0x22, 0x22, 0x00, 0x02, 0x3E,
0x02, 0x00, 0x3E, 0x20, 0x20, 0x00,
0x00, 0x3C, 0x0A, 0x3C, 0x00, 0x3E,
0x20, 0x20, 0x02, 0x3E, 0x02, 0x00,
0x00, 0x1C, 0x22, 0x32, 0x00, 0x1E,
0x20, 0x20, 0x1E, 0x00, 0x3E, 0x00,
0x00, 0x2C, 0x2A, 0x1A, 0x00, 0x3E,
0x0A, 0x02, 0x00, 0x02, 0x3E, 0x02,
0x00, 0x00, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xC0, 0xF8, 0xFF, 0xFF,
0xFF, 0xE7, 0xE0, 0xE0, 0xE7, 0xFF,
0xFF, 0xFF, 0xF8, 0xC0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x3C,
0x3C, 0x3C, 0x3C, 0x3C, 0x3C, 0x7E,
0xFF, 0xE7, 0xE7, 0x81, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0,
0xF0, 0xF8, 0x7C, 0x3E, 0x1F, 0x0F,
0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x22, 0x22, 0x00, 0x00,
0x0F, 0x0F, 0x2F, 0x2F, 0x0F, 0x0F,
0xF0, 0xF0, 0xF2, 0xF2, 0xF0, 0xF0,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x22, 0x22, 0x00, 0xFF,
0x0F, 0x0F, 0x2F, 0x2F, 0x0F, 0xFF,
0xF0, 0xF0, 0xF2, 0xF2, 0xF0, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF0, 0xFE, 0xFF, 0xFF, 0x0F, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x0F, 0xFF, 0xFF, 0xFE, 0xF0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0,
0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xF0,
0xF8, 0x7F, 0x7F, 0x1F, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0F, 0x3F, 0x7F, 0x7F, 0xFF,
0xF9, 0xF0, 0xF0, 0xF0, 0xF0, 0xF8,
0xFC, 0x7F, 0x7F, 0x3F, 0x0F, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0x11, 0x11, 0x11, 0x11, 0x11,
0xFF, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F,
0xFF, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x11, 0x11, 0x11, 0x11, 0x11,
0xFF, 0x11, 0x11, 0x11, 0x11, 0x11,
0xFF, 0x11, 0x11, 0x11, 0x11, 0x11,
0xFF, 0x11, 0x11, 0x11, 0x11, 0x11,
0xFF, 0x11, 0x11, 0x11, 0x11, 0x11,
0xFF, 0x11, 0x11, 0x11, 0x11, 0x11,
0xFF, 0x11, 0x11, 0x11, 0x11, 0x11,
0xFF, 0x11, 0x11, 0x11, 0x11, 0x11,
};
@@ -0,0 +1,340 @@
#include QMK_KEYBOARD_H
#include "taphold.h"
#include "seq.h"
#include "ds1307.h"
#include "lightmode.h"
#include <stdio.h>
/* Note: don't forget there's some more code in qmk_firmware/users/anderson dir */
#define _MAIN 0
#define _ALPHA 1
#define _BETA 2
enum custom_keycodes {
KC_MAIN = SAFE_RANGE,
KC_ALPHA,
KC_BETA,
#ifdef LIGHTMODE_ENABLE
KC_LIGHT_MODE,
#endif
KC_SEQ,
KC_SET_TIME,
};
#ifdef LIGHTMODE_ENABLE
#endif
/* TapHold is my own implementation of the `LT` macro. It's processed in `process_record_user()`. */
#define TAPHOLD_CONFIG_SIZE 3
taphold_t taphold_config[TAPHOLD_CONFIG_SIZE] = {
{.key=KC_ALPHA, .mode=TAPHOLD_LAYER, .shortAction=KC_ESC, .longAction=_ALPHA},
{.key=KC_BETA, .mode=TAPHOLD_LAYER, .shortAction=KC_EQL, .longAction=_BETA},
{.key=KC_RCTRL, .mode=TAPHOLD_MOD, .shortAction=KC_MINS, .longAction=KC_LCTRL},
};
uint16_t taphold_config_size = TAPHOLD_CONFIG_SIZE;
uint32_t taphold_timeout = 90;
/* Seq is implementation of unicode macros similar to UCIS, but with unicode strings. */
#define SEQ_CONFIG_SIZE 3
seq_t seq_config[SEQ_CONFIG_SIZE] = {
{.sequence="temp", .result="42°C"},
{.sequence="table", .result="┳━━┳"},
{.sequence="shrug", .result="¯\\_(ツ)_/¯"}
};
uint16_t seq_config_size = SEQ_CONFIG_SIZE;
/* Colors */
uint32_t layer_colors[3] = {
[_MAIN] = 0xFF0010,
[_ALPHA] = 0x4020FF,
[_BETA] = 0x20FF00,
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Main layer
│MUTE │ │L_MOD│
┏━━━━━┳━━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━┳━━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━┳━━━━━┓
┃ TAB ┃ Q │ W │ E │ R │ T ┃ Y │ U │ I │ O │ P ┃ BSP ┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃𝛼/ESC┃ A │ S │ D │ F │ G ┃ H │ J │ K │ L │ ; ┃ RET ┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃SHIFT┃ Z │ X │ C │ V │ B ┃ N │ M │ , │ . │ / ┃CTL/-┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃LCTRL┃ │ │ ALT │ GUI │SPACE┃SPACE│ 𝛽/= │ ' │ │ ┃ \ ┃
┗━━━━━┻━━━━━┷━━━━━┷━━━━━┷━━━━━┷━━━━━┻━━━━━┷━━━━━┷━━━━━┷━━━━━┷━━━━━┻━━━━━┛
*/
[_MAIN] = LAYOUT( \
KC_MUTE, LCTL(KC_D),
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_ALPHA,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RCTRL,\
KC_LCTRL,_______, _______, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_BETA, KC_QUOT, _______, _______, KC_BSLS \
),
/* Alpha layer (𝛼)
│ │ │ │
┏━━━━━┳━━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━┳━━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━┳━━━━━┓
┃ ┃PREV │PLAY │NEXT │ │NUMLK┃ - │ ^^^ │ ^ │ vvv │ ~ ┃ DEL ┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃ ┃ │VOL -│VOL +│ │CPSLK┃HOME │ <-- │ v │ --> │ ` ┃ \ ┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃ ┃ │ │ │ │SCRLK┃ END │ = │ [ │ ] │ ( ┃ ) ┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃ ┃ │ │ │ │ ┃ │ │ │ │ ┃ ┃
┗━━━━━┻━━━━━┷━━━━━┷━━━━━┷━━━━━┷━━━━━┻━━━━━┷━━━━━┷━━━━━┷━━━━━┷━━━━━┻━━━━━┛
*/
[_ALPHA] = LAYOUT( \
_______, _______, \
_______, KC_MPRV, KC_MPLY, KC_MNXT, _______, KC_NLCK, KC_MINS, KC_PGUP, KC_UP, KC_PGDN, KC_TILD, KC_DEL, \
_______, _______, KC_VOLD, KC_VOLU, _______, KC_CAPS, KC_HOME, KC_LEFT, KC_DOWN, KC_RIGHT,KC_GRV, KC_BSLS, \
_______, _______, _______, _______, _______, KC_SLCK, KC_END, KC_EQL, KC_LBRC, KC_RBRC, KC_LPRN ,KC_RPRN, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
),
/* Beta layer (𝛽)
│ │ │ │
┏━━━━━┳━━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━┳━━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━┳━━━━━┓
┃ RGB ┃ 1 │ 2 │ 3 │ 4 │ 5 ┃ 6 │ 7 │ 8 │ 9 │ 0 ┃ F12 ┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃L_MOD┃ F1 │ F2 │ F3 │ F4 │ F5 ┃ F6 │ F7 │ F8 │ F9 │ F10 ┃ F11 ┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃ ┃RESET│DEBUG│ │ │TIME ┃SLEEP│ SEQ │ { │ } │PTSCR┃ ┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃ ┃ │ │ │ │ ┃ │ │ │ │ ┃ ┃
┗━━━━━┻━━━━━┷━━━━━┷━━━━━┷━━━━━┷━━━━━┻━━━━━┷━━━━━┷━━━━━┷━━━━━┷━━━━━┻━━━━━┛
*/
[_BETA] = LAYOUT( \
_______, _______, \
RGB_TOG, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_F12,
#ifdef LIGHTMODE_ENABLE
KC_LIGHT_MODE,
#else
_______,
#endif
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, \
_______, RESET, DEBUG, _______, _______, KC_SET_TIME,KC_SLEP,KC_SEQ,KC_LCBR, KC_RCBR, KC_PSCR, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
)
};
static bool alpha_pressed = false;
static bool beta_pressed = false;
static bool ctrl_pressed = false;
static bool alt_pressed = false;
static bool shift_pressed = false;
static bool gui_pressed = false;
static bool is_in_seq = false;
void keyboard_post_init_user(void) {
/* debug_enable = true; */
/* debug_matrix = true; */
}
void eeconfig_init_user(void) {
set_unicode_input_mode(UC_LNX);
}
void matrix_init_user(void) {
#ifdef LIGHTMODE_ENABLE
set_light_mode(SMOOTHLED, layer_colors[_MAIN]);
#endif
}
static uint32_t last_update = 0;
static uint8_t hours, minutes, seconds;
void matrix_scan_user(void) {
uint32_t now = timer_read32();
if (now - last_update > 500) {
ds1307_get_time(&hours, &minutes, &seconds);
last_update = now;
}
}
static bool is_in_set_time = false;
static char new_time[6];
static uint8_t new_time_index = 0;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (keycode == KC_SEQ && record->event.pressed) {
seq_start();
layer_off(_BETA);
is_in_seq = true;
return false;
} else if (is_in_seq) {
if (record->event.pressed) {
if (!seq_feed(keycode)) {
is_in_seq = false;
}
}
return false;
}
if (keycode == KC_SET_TIME && record->event.pressed) {
is_in_set_time = true;
new_time_index = 0;
} else if (is_in_set_time) {
if (!record->event.pressed && keycode >= KC_1 && keycode <= KC_0) {
new_time[new_time_index++] = (keycode == KC_0) ? 0 : keycode - KC_1 + 1;
if (new_time_index == 6) {
is_in_set_time = false;
ds1307_set_time(
(new_time[0]) * 10 + (new_time[1]),
(new_time[2]) * 10 + (new_time[3]),
(new_time[4]) * 10 + (new_time[5])
);
for (int i = 0; i < 6; i++) {
tap_code(KC_BSPACE);
}
}
}
}
if (keycode == KC_LCTRL || keycode == KC_RCTRL) {
ctrl_pressed = record->event.pressed;
} else if (keycode == KC_LALT) {
alt_pressed = record->event.pressed;
} else if (keycode == KC_LSFT) {
shift_pressed = record->event.pressed;
} else if (keycode == KC_LGUI) {
gui_pressed = record->event.pressed;
} else if (keycode == KC_ALPHA) {
alpha_pressed = record->event.pressed;
} else if (keycode == KC_BETA) {
beta_pressed = record->event.pressed;
}
if (keycode == RESET) {
rgblight_setrgb(255, 255, 0);
}
#ifdef LIGHTMODE_ENABLE
if (record->event.pressed && keycode == KC_LIGHT_MODE) {
next_light_mode(layer_colors[_MAIN]);
}
#endif
if (keycode == KC_LCTRL) {
/* Some Overlay1_Enable fuckery! */
(record->event.pressed ? register_code : unregister_code)(KC_LCTRL);
return false;
}
return taphold_process(keycode, record);
}
layer_state_t layer_state_set_user(layer_state_t state) {
#ifdef LIGHTMODE_ENABLE
uint8_t layer = get_highest_layer(state);
update_light_mode(layer_colors[layer]);
#endif
return state;
}
void encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (!alpha_pressed) {
tap_code(clockwise ? KC_VOLD : KC_VOLU);
} else {
tap_code(clockwise ? KC_MPRV : KC_MNXT);
}
} else if (index == 1) {
if (!alpha_pressed) {
tap_code(clockwise ? KC_UP : KC_DOWN);
} else {
tap_code(clockwise ? KC_PGUP : KC_PGDN);
}
}
}
#ifdef OLED_DRIVER_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_0;
}
void oled_task_user(void) {
/* Host Keyboard Layer Status */
uint8_t current_layer = get_highest_layer(layer_state);
/* Layer */
static const char PROGMEM icons[4][3][6] = {
{
{ 0x80, 0x81, 0x82, 0x83, 0x84, 0 },
{ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0 },
{ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0 }
},
{
{ 0x85, 0x86, 0x87, 0x88, 0x89, 0 },
{ 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0 },
{ 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0 }
},
{
{ 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0 },
{ 0xaa, 0xab, 0xac, 0xad, 0xae, 0 },
{ 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0 }
},
{
{ 0x8f, 0x90, 0x91, 0x92, 0x93, 0 },
{ 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0 },
{ 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0 }
}
};
uint8_t icon_index = current_layer == _MAIN ? 3 : current_layer == _ALPHA ? 1 : 2;
for (int i = 0; i < 3; i++) {
oled_set_cursor(0, i + 1);
oled_write_P(icons[icon_index][i], false);
}
/* Time */
oled_set_cursor(6, 0);
// oled_write_P(PSTR("-D48 Custom-\n"), false);
char buf[16];
sprintf(
buf,
"%02d:%02d:%02d", hours, minutes, seconds
);
oled_write(buf, false);
/* Modifiers */
static const char PROGMEM mods[][2] = {
{0x94, 0x95}, // CTL
{0x96, 0x97}, // ALT
{0x98, 0x99}, // GUI
{0x9a, 0x9b}, // SFT
/* {0x9c, 0x9d}, // EMPTY */
};
char mod_data[13] = "\x9c\x9d\x9c\x9d\x9c\x9d\x9c\x9d \x07\x07\x07\0";
if (ctrl_pressed) strncpy(mod_data, mods[0], 2);
if (alt_pressed) strncpy(mod_data + 2, mods[1], 2);
if (gui_pressed) strncpy(mod_data + 4, mods[2], 2);
if (shift_pressed) strncpy(mod_data + 6, mods[3], 2);
led_t led_usb_state = host_keyboard_led_state();
if (led_usb_state.num_lock) mod_data[9] = 'N';
if (led_usb_state.caps_lock) mod_data[10] = 'C';
if (led_usb_state.scroll_lock) mod_data[11] = 'S';
oled_set_cursor(6, 1);
oled_write(mod_data, false);
/* Matrix */
static const char PROGMEM matrix_chars[] = {
0xb4, // None
0xb5, // Upper
0xb6, // Lower
0xb7 // Both
};
for (uint8_t row = 1; row < MATRIX_ROWS; row += 2) {
// Skip first row because it's used by the encoders.
uint16_t bits1 = matrix_get_row(row);
uint16_t bits2 = matrix_get_row(row + 1);
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
uint8_t matrix_char = matrix_chars[((bits1 & (1 << col)) ? 1 : 0) | ((bits2 & (1 << col)) ? 2 : 0)];
oled_set_cursor(6 + col, 2 + (row - 1) / 2);
oled_write_char(matrix_char, false);
}
}
}
#endif
@@ -0,0 +1,44 @@
#include "lightmode.h"
#ifdef LIGHTMODE_ENABLE
/* Light modes switcher */
uint8_t light_mode = SMOOTHLED;
void set_light_mode(light_mode_t value, uint32_t color) {
light_mode = value;
if (light_mode == SMOOTHLED) {
smoothled_set(color);
} else {
dmc12_start(color, true);
}
}
void process_light_mode(void) {
if (light_mode == SMOOTHLED) {
smoothled_process();
} else {
dmc12_process();
}
}
void update_light_mode(uint32_t color) {
if (light_mode == SMOOTHLED) {
smoothled_set(color);
} else {
dmc12_start(color, false);
}
}
void next_light_mode(uint32_t color) {
light_mode = (light_mode + 1) % LIGHT_MODE_SIZE;
set_light_mode(light_mode, color);
}
void matrix_scan_kb(void) {
process_light_mode();
matrix_scan_user();
}
#endif
@@ -0,0 +1,12 @@
#include "smoothled.h"
#include "dmc12.h"
#include "quantum.h"
/* Light modes */
enum light_mode_enum { SMOOTHLED, DMC12, LIGHT_MODE_SIZE };
typedef enum light_mode_enum light_mode_t;
void set_light_mode(light_mode_t value, uint32_t color);
void process_light_mode(void);
void update_light_mode(uint32_t color);
void next_light_mode(uint32_t color);
@@ -0,0 +1,2 @@
OPT_DEFS += -DLIGHTMODE_ENABLE
SRC += smoothled.c dmc12.c seq.c lightmode.c
@@ -0,0 +1,285 @@
#include QMK_KEYBOARD_H
#include <string.h>
#include <stdio.h>
#include "taphold.h"
#include "ds1307.h"
/* Note: don't forget there's some more code in qmk_firmware/users/anderson dir */
#define _MAIN 0
#define _ALPHA 1
#define _BETA 2
enum custom_keycodes {
KC_MAIN = SAFE_RANGE,
KC_ALPHA,
KC_BETA,
KC_SET_TIME,
};
/* TapHold is my own implementation of the `LT` macro. It's processed in `process_record_user()`. */
#define TAPHOLD_CONFIG_SIZE 3
taphold_t taphold_config[TAPHOLD_CONFIG_SIZE] = {
{.key=KC_ALPHA, .mode=TAPHOLD_LAYER, .shortAction=KC_ESC, .longAction=_ALPHA},
{.key=KC_BETA, .mode=TAPHOLD_LAYER, .shortAction=KC_EQL, .longAction=_BETA},
{.key=KC_RCTRL, .mode=TAPHOLD_MOD, .shortAction=KC_MINS, .longAction=KC_LCTRL},
};
uint16_t taphold_config_size = TAPHOLD_CONFIG_SIZE;
uint32_t taphold_timeout = 90;
/* Colors */
uint32_t layer_colors[3] = {
[_MAIN] = 0xFF0010,
[_ALPHA] = 0x4020FF,
[_BETA] = 0x20FF00,
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Main layer
│MUTE │ │L_MOD│
┏━━━━━┳━━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━┳━━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━┳━━━━━┓
┃ TAB ┃ Q │ W │ E │ R │ T ┃ Y │ U │ I │ O │ P ┃ BSP ┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃𝛼/ESC┃ A │ S │ D │ F │ G ┃ H │ J │ K │ L │ ; ┃ RET ┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃SHIFT┃ Z │ X │ C │ V │ B ┃ N │ M │ , │ . │ / ┃CTL/-┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃LCTRL┃ │ │ ALT │ GUI │SPACE┃SPACE│ 𝛽/= │ ' │ │ ┃ \ ┃
┗━━━━━┻━━━━━┷━━━━━┷━━━━━┷━━━━━┷━━━━━┻━━━━━┷━━━━━┷━━━━━┷━━━━━┷━━━━━┻━━━━━┛
*/
[_MAIN] = LAYOUT( \
KC_MUTE, _______, \
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_ALPHA,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RCTRL,\
KC_LCTRL,_______, _______, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_BETA, KC_QUOT, _______, _______, KC_BSLS \
),
/* Alpha layer (𝛼)
│ │ │ │
┏━━━━━┳━━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━┳━━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━┳━━━━━┓
┃ ┃PREV │PLAY │NEXT │ │NUMLK┃ - │ ^^^ │ ^ │ vvv │ ~ ┃ DEL ┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃ ┃ │VOL -│VOL +│ │CPSLK┃HOME │ <-- │ v │ --> │ ` ┃ \ ┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃ ┃ │ │ │ │SCRLK┃ END │ = │ [ │ ] │ ( ┃ ) ┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃ ┃ │ │ │ │ ┃ │ │ │ │ ┃ ┃
┗━━━━━┻━━━━━┷━━━━━┷━━━━━┷━━━━━┷━━━━━┻━━━━━┷━━━━━┷━━━━━┷━━━━━┷━━━━━┻━━━━━┛
*/
[_ALPHA] = LAYOUT( \
_______, _______, \
_______, KC_MPRV, KC_MPLY, KC_MNXT, _______, KC_NLCK, KC_MINS, KC_PGUP, KC_UP, KC_PGDN, KC_TILD, KC_DEL, \
_______, _______, KC_VOLD, KC_VOLU, _______, KC_CAPS, KC_HOME, KC_LEFT, KC_DOWN, KC_RIGHT,KC_GRV, KC_BSLS, \
_______, _______, _______, _______, _______, KC_SLCK, KC_END, KC_EQL, KC_LBRC, KC_RBRC, KC_LPRN ,KC_RPRN, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
),
/* Beta layer (𝛽)
│ │ │ │
┏━━━━━┳━━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━┳━━━━━┯━━━━━┯━━━━━┯━━━━━┯━━━━━┳━━━━━┓
┃ RGB ┃ 1 │ 2 │ 3 │ 4 │ 5 ┃ 6 │ 7 │ 8 │ 9 │ 0 ┃ F12 ┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃L_MOD┃ F1 │ F2 │ F3 │ F4 │ F5 ┃ F6 │ F7 │ F8 │ F9 │ F10 ┃ F11 ┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃ ┃RESET│DEBUG│ │ │TIME ┃SLEEP│ │ { │ } │PTSCR┃ ┃
┣━━━━━╉─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╊━━━━━┫
┃ ┃ │ │ │ │ ┃ │ │ │ │ ┃ ┃
┗━━━━━┻━━━━━┷━━━━━┷━━━━━┷━━━━━┷━━━━━┻━━━━━┷━━━━━┷━━━━━┷━━━━━┷━━━━━┻━━━━━┛
*/
[_BETA] = LAYOUT( \
_______, _______, \
RGB_TOG, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_F12,
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, \
_______, RESET, DEBUG, _______, _______, KC_SET_TIME,KC_SLEP,_______,KC_LCBR,KC_RCBR, KC_PSCR, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
)
};
static bool alpha_pressed = false;
static bool beta_pressed = false;
static bool ctrl_pressed = false;
static bool alt_pressed = false;
static bool shift_pressed = false;
static bool gui_pressed = false;
void keyboard_post_init_user(void) {
/* debug_enable = true; */
/* debug_matrix = true; */
}
void eeconfig_init_user(void) {
set_unicode_input_mode(UC_LNX);
}
static uint32_t last_update = 0;
static uint8_t hours, minutes, seconds;
void matrix_scan_user(void) {
uint32_t now = timer_read32();
if (now - last_update > 500) {
ds1307_get_time(&hours, &minutes, &seconds);
last_update = now;
}
}
static bool is_in_set_time = false;
static char new_time[6];
static uint8_t new_time_index = 0;
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (keycode == KC_SET_TIME && record->event.pressed) {
is_in_set_time = true;
new_time_index = 0;
} else if (is_in_set_time) {
if (!record->event.pressed && keycode >= KC_1 && keycode <= KC_0) {
new_time[new_time_index++] = (keycode == KC_0) ? 0 : keycode - KC_1 + 1;
if (new_time_index == 6) {
is_in_set_time = false;
ds1307_set_time(
(new_time[0]) * 10 + (new_time[1]),
(new_time[2]) * 10 + (new_time[3]),
(new_time[4]) * 10 + (new_time[5])
);
for (int i = 0; i < 6; i++) {
tap_code(KC_BSPACE);
}
}
}
}
if (keycode == KC_LCTRL || keycode == KC_RCTRL) {
ctrl_pressed = record->event.pressed;
} else if (keycode == KC_LALT) {
alt_pressed = record->event.pressed;
} else if (keycode == KC_LSFT) {
shift_pressed = record->event.pressed;
} else if (keycode == KC_LGUI) {
gui_pressed = record->event.pressed;
} else if (keycode == KC_ALPHA) {
alpha_pressed = record->event.pressed;
} else if (keycode == KC_BETA) {
beta_pressed = record->event.pressed;
}
if (keycode == RESET) {
rgblight_setrgb(255, 255, 0);
}
if (keycode == KC_LCTRL) {
/* Some Overlay1_Enable fuckery! */
(record->event.pressed ? register_code : unregister_code)(KC_LCTRL);
return false;
}
return taphold_process(keycode, record);
}
void encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (!alpha_pressed) {
tap_code(clockwise ? KC_VOLD : KC_VOLU);
} else {
tap_code(clockwise ? KC_MPRV : KC_MNXT);
}
} else if (index == 1) {
if (!alpha_pressed) {
tap_code(clockwise ? KC_UP : KC_DOWN);
} else {
tap_code(clockwise ? KC_PGUP : KC_PGDN);
}
}
}
#ifdef OLED_DRIVER_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_0;
}
void oled_task_user(void) {
/* Host Keyboard Layer Status */
uint8_t current_layer = get_highest_layer(layer_state);
/* Layer */
static const char PROGMEM icons[4][3][6] = {
{
{ 0x80, 0x81, 0x82, 0x83, 0x84, 0 },
{ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0 },
{ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0 }
},
{
{ 0x85, 0x86, 0x87, 0x88, 0x89, 0 },
{ 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0 },
{ 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0 }
},
{
{ 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0 },
{ 0xaa, 0xab, 0xac, 0xad, 0xae, 0 },
{ 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0 }
},
{
{ 0x8f, 0x90, 0x91, 0x92, 0x93, 0 },
{ 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0 },
{ 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0 }
}
};
uint8_t icon_index = current_layer == _MAIN ? 3 : current_layer == _ALPHA ? 1 : 2;
for (int i = 0; i < 3; i++) {
oled_set_cursor(0, i + 1);
oled_write_P(icons[icon_index][i], false);
}
/* Time */
oled_set_cursor(6, 0);
// oled_write_P(PSTR("-D48 Custom-\n"), false);
char buf[16];
sprintf(
buf,
"%02d:%02d:%02d", hours, minutes, seconds
);
oled_write(buf, false);
/* Modifiers */
static const char PROGMEM mods[][2] = {
{0x94, 0x95}, // CTL
{0x96, 0x97}, // ALT
{0x98, 0x99}, // GUI
{0x9a, 0x9b}, // SFT
/* {0x9c, 0x9d}, // EMPTY */
};
char mod_data[13] = "\x9c\x9d\x9c\x9d\x9c\x9d\x9c\x9d \x07\x07\x07\0";
if (ctrl_pressed) strncpy(mod_data, mods[0], 2);
if (alt_pressed) strncpy(mod_data + 2, mods[1], 2);
if (gui_pressed) strncpy(mod_data + 4, mods[2], 2);
if (shift_pressed) strncpy(mod_data + 6, mods[3], 2);
led_t led_usb_state = host_keyboard_led_state();
if (led_usb_state.num_lock) mod_data[9] = 'N';
if (led_usb_state.caps_lock) mod_data[10] = 'C';
if (led_usb_state.scroll_lock) mod_data[11] = 'S';
oled_set_cursor(6, 1);
oled_write(mod_data, false);
/* Matrix */
static const char PROGMEM matrix_chars[] = {
0xb4, // None
0xb5, // Upper
0xb6, // Lower
0xb7 // Both
};
for (uint8_t row = 1; row < MATRIX_ROWS; row += 2) {
// Skip first row because it's used by the encoders.
uint16_t bits1 = matrix_get_row(row);
uint16_t bits2 = matrix_get_row(row + 1);
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
uint8_t matrix_char = matrix_chars[((bits1 & (1 << col)) ? 1 : 0) | ((bits2 & (1 << col)) ? 2 : 0)];
oled_set_cursor(6 + col, 2 + (row - 1) / 2);
oled_write_char(matrix_char, false);
}
}
}
#endif
+22
View File
@@ -0,0 +1,22 @@
# MCU name
MCU = STM32F303
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB 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
AUDIO_ENABLE = yes
USE_I2C = no
RGBLIGHT_ENABLE = yes
ENCODER_ENABLE = yes
OLED_DRIVER_ENABLE = yes
UNICODE_ENABLE = yes
SRC += ds1307.c taphold.c
+29
View File
@@ -0,0 +1,29 @@
#include "taphold.h"
bool taphold_process(uint16_t keycode, keyrecord_t *record) {
for (int i = 0; i < taphold_config_size; i++) {
taphold_t *config = &taphold_config[i];
if (config->key == keycode && record->event.pressed) {
if (config->mode == TAPHOLD_LAYER) {
layer_on(config->longAction);
} else {
register_code(config->longAction);
}
config->time = timer_read32();
config->keypos = record->event.key;
return false;
} else if (KEYEQ(record->event.key, config->keypos) && !record->event.pressed) {
if (config->mode == TAPHOLD_LAYER) {
layer_off(config->longAction);
} else {
unregister_code(config->longAction);
}
if (timer_elapsed32(config->time) < taphold_timeout) {
tap_code(config->shortAction);
}
config->keypos.row = 255;
return false;
}
}
return true;
}
+25
View File
@@ -0,0 +1,25 @@
#include "quantum.h"
typedef enum taphold_mode_t {
TAPHOLD_LAYER,
TAPHOLD_MOD
} taphold_mode_t;
typedef struct taphold_t {
uint16_t key;
uint32_t time;
taphold_mode_t mode;
uint16_t shortAction;
uint16_t longAction;
keypos_t keypos;
// We store key pos to properly release the key
// even when a different layer is active and the key has a different action now
} taphold_t;
extern taphold_t taphold_config[];
extern uint16_t taphold_config_size;
// Dual keys tap/hold timeout.
// If key is tapped for less than this value, send key in addition to primary action after completing the action.
extern uint32_t taphold_timeout;
bool taphold_process(uint16_t keycode, keyrecord_t *record);
+46
View File
@@ -0,0 +1,46 @@
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0xD645
#define DEVICE_VER 0x0001
#define MANUFACTURER tominabox1
#define PRODUCT Le Chiffre
/* key matrix size */
#define MATRIX_ROWS 4
#define MATRIX_COLS 10
/*
* Keyboard Matrix Assignments
*
* Change this to how you wired your keyboard
* COLS: AVR pins used for columns, left to right
* ROWS: AVR pins used for rows, top to bottom
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
*
*/
#define MATRIX_ROW_PINS { B3, D4, F1, C6 }
#define MATRIX_COL_PINS { F4, F5, B0, B2, B1, B4, D7, C7, D2, F7 }
#define UNUSED_PINS
/* COL2ROW, ROW2COL*/
#define DIODE_DIRECTION ROW2COL
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* Define encoder pads */
#define ENCODERS_PAD_A { D5 }
#define ENCODERS_PAD_B { D3 }
/* #define RGB_DI_PIN F0
#define RGBLED_NUM 1 */
+15
View File
@@ -0,0 +1,15 @@
{
"keyboard_name": "le_chiffre",
"url": "",
"maintainer": "tominabox1",
"width": 11,
"height": 4,
"layouts": {
"LAYOUT": {
"layout": [{"label":"Q", "x":0, "y":0}, {"label":"W", "x":1, "y":0}, {"label":"E", "x":2, "y":0}, {"label":"R", "x":3, "y":0}, {"label":"T", "x":4, "y":0}, {"label":"Rotary", "x":5, "y":0, "w":1}, {"label":"Y", "x":6, "y":0}, {"label":"U", "x":7, "y":0}, {"label":"I", "x":8, "y":0}, {"label":"O", "x":9, "y":0}, {"label":"P", "x":10, "y":0},
{"label":"A", "x":0, "y":1}, {"label":"S", "x":1, "y":1}, {"label":"D", "x":2, "y":1}, {"label":"F", "x":3, "y":1}, {"label":"G", "x":4, "y":1}, {"label":"H", "x":6, "y":1}, {"label":"J", "x":7, "y":1}, {"label":"K", "x":8, "y":1}, {"label":"L", "x":9, "y":1},
{"label":";", "x":10, "y":1}, {"label":"Z", "x":0, "y":2}, {"label":"X", "x":1, "y":2}, {"label":"C", "x":2, "y":2}, {"label":"V", "x":3, "y":2}, {"label":"B", "x":4, "y":2}, {"label":"N", "x":6, "y":2}, {"label":"M", "x":7, "y":2}, {"label":"<", "x":8, "y":2}, {"label":">", "x":9, "y":2}, {"label":"?", "x":10, "y":2},
{"label":"", "x":1.75, "y":3, "w":1.25}, {"label":"", "x":3, "y":3, "w":2}, {"label":"", "x":6, "y":3, "w":2}, {"label":"", "x":8, "y":3, "w":1.25}]
}
}
}
@@ -0,0 +1,142 @@
#include QMK_KEYBOARD_H
enum layers{
_BASE,
_NUM_SYM,
_NAV
};
#define KC_NUM_SPC LT(_NUM_SYM, KC_SPC)
#define KC_GA LGUI_T(KC_A)
#define KC_AS LALT_T(KC_S)
#define KC_CD LCTL_T(KC_D)
#define KC_SF LSFT_T(KC_F)
#define KC_SJ RSFT_T(KC_J)
#define KC_CK RCTL_T(KC_K)
#define KC_AL RALT_T(KC_L)
#define KC_GSCLN RGUI_T(KC_SCLN)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT(
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_MPLY, KC_Y, KC_U, KC_I, KC_O, KC_P,
KC_GA, KC_AS, KC_CD, KC_SF, KC_G, KC_H, KC_SJ, KC_CK, KC_AL, KC_GSCLN,
KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH,
KC_LCTL, KC_ENT, KC_NUM_SPC, MO(_NAV)
),
[_NUM_SYM] = LAYOUT(
KC_1, KC_2, KC_3, KC_4, KC_5, KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0,
KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_EQUAL, KC_MINS,
KC_BSLS,KC_LCBR, KC_LBRC, KC_LPRN, KC_UNDS, KC_RPRN, KC_RBRC, KC_RCBR, KC_DOT, KC_GRV,
KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS
),
[_NAV] = LAYOUT(
RESET, _______, AG_NORM, AG_SWAP, DEBUG, KC_TRNS, KC_GRV, KC_PGDN, KC_UP, KC_PGUP, KC_SCLN,
RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, KC_NO, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END,
RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, KC_NO, KC_MINS, KC_RO, KC_COMM, KC_DOT, KC_BSLS,
KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS
),
};
void encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (clockwise) {
tap_code(KC_MNXT);
} else {
tap_code(KC_MPRV);
}
}
}
#ifdef OLED_DRIVER_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_90; // flips the display 180 degrees if offhand
}
void oled_task_user(void) {
static const char PROGMEM base_logo[] = {
// 'base', 32x128px
0x00, 0x00, 0x80, 0x7c, 0x02, 0x01, 0x01, 0x80, 0x00, 0xe0, 0x50, 0x28, 0x98, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x40, 0x41, 0x41, 0x41, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3e, 0x41, 0x40, 0x40, 0x40, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x10, 0x08, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x07, 0x02, 0x39, 0x27, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x13, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xfc,
0x22, 0x21, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x60, 0x1f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x90, 0x7e, 0x11, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40,
0x30, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0xe4, 0x1c, 0x08, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x54, 0x4a, 0x26, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static const char PROGMEM base_caps_logo[] = {
// 'caps', 32x128px
0x00, 0x00, 0x80, 0x7c, 0x02, 0x01, 0x01, 0x80, 0x00, 0xe0, 0x50, 0x28, 0x98, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x40, 0x41, 0x41, 0x41, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3e, 0x41, 0x40, 0x40, 0x40, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x10, 0x08, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x07, 0x02, 0x39, 0x27, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x13, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xfc,
0x22, 0x21, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x60, 0x1f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x90, 0x7e, 0x11, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40,
0x30, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0xe4, 0x1c, 0x08, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x54, 0x4a, 0x26, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x10, 0x10, 0x10, 0x30, 0x00, 0x00, 0x80,
0x80, 0x80, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x1e, 0x11, 0x09, 0x08,
0x1e, 0x11, 0x81, 0x7d, 0x13, 0x11, 0x08, 0x17, 0x11, 0x12, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00
};
switch (get_highest_layer(layer_state)) {
case _BASE:
if (host_keyboard_led_state().caps_lock) {
oled_write_raw_P(base_caps_logo, sizeof(base_caps_logo));
} else {
oled_write_raw_P(base_logo, sizeof(base_logo));
}
break;
default:
oled_write_raw_P(base_logo, sizeof(base_logo));
}
}
#endif
@@ -0,0 +1 @@
# Default Le Chiffre Keymap
+1
View File
@@ -0,0 +1 @@
#include "le_chiffre.h"
+18
View File
@@ -0,0 +1,18 @@
#pragma once
#include "quantum.h"
#define XXX KC_NO
#define LAYOUT( \
K00, K01, K02, K03, K04, K38, K05, K06, K07, K08, K09, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, \
K32, K34, K35, K37 \
) \
{ \
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09 }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19 }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29 }, \
{ XXX, XXX, K32, XXX, K34, K35, XXX, K37, K38, XXX } \
}
+15
View File
@@ -0,0 +1,15 @@
# Le Chiffre
![Le Chiffre](https://i.imgur.com/X1WsUmdl.png)
Le Chiffre (ironically, "the number" in French is a 30% keyboard designed by tominabox1. The purpose of the board is to provide a platform for MX and Choc ergo in one package for when ones wrists need a break. The board supports an RGB LED strip with DI on port F0. The board is also fitted with support for run-of-the-mill .91" OLED and EC11 rotary encoder.
* Keyboard Maintainer: [TJ Campie](https://github.com/tominabox1)
* Hardware Supported: Le Chiffre (source not available at this time)
* Hardware Availability: Bring your own case.
Make example for this keyboard (after setting up your build environment):
make le_chiffre:default
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
+22
View File
@@ -0,0 +1,22 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
# Teensy halfkay
# Pro Micro caterina
# Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = atmel-dfu
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
TAP_DANCE_ENABLE = no
ENCODER_ENABLE = yes
OLED_DRIVER_ENABLE = no
+43
View File
@@ -0,0 +1,43 @@
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x4F42
#define DEVICE_VER 0x0001
#define MANUFACTURER OsciX
#define PRODUCT Shambles TKL
#define DESCRIPTION A minimalist keyboard with extra tenkeyless keys.
/* key matrix size */
#define MATRIX_ROWS 4
#define MATRIX_COLS 13
/* key matrix pins */
#define MATRIX_ROW_PINS { F5, B3, B1, F7 }
#define MATRIX_COL_PINS { D3, D1, D0, D4, C6, D7, E6, B4, B5, B6, B2, F4, F6 }
#define UNUSED_PINS
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* key combination for command */
#ifdef RGB_DI_PIN
# define RGBLIGHT_ANIMATIONS
# define RGBLED_NUM 0
# define RGBLIGHT_HUE_STEP 8
# define RGBLIGHT_SAT_STEP 8
# define RGBLIGHT_VAL_STEP 8
#endif
+13
View File
@@ -0,0 +1,13 @@
{
"keyboard_name": "Shambles TKL",
"url": "",
"maintainer": "OsciX",
"width": 13.25,
"height": 4.5,
"layouts": {
"LAYOUT": {
"key_count": 47,
"layout": [{"label":"K00", "x":0, "y":0}, {"label":"K01", "x":1.5, "y":0}, {"label":"K02", "x":2.5, "y":0}, {"label":"K03", "x":3.5, "y":0}, {"label":"K04", "x":4.75, "y":0}, {"label":"K05", "x":5.75, "y":0}, {"label":"K06", "x":6.75, "y":0}, {"label":"K07", "x":8, "y":0}, {"label":"K08", "x":9, "y":0}, {"label":"K09", "x":10.25, "y":0}, {"label":"K10", "x":11.25, "y":0}, {"label":"K11", "x":12.25, "y":0}, {"label":"K12", "x":0, "y":1.5}, {"label":"K13", "x":1, "y":1.5}, {"label":"K14", "x":2, "y":1.5}, {"label":"K15", "x":3, "y":1.5}, {"label":"K16", "x":4, "y":1.5}, {"label":"K17", "x":5, "y":1.5}, {"label":"K18", "x":6, "y":1.5}, {"label":"K19", "x":7, "y":1.5}, {"label":"K20", "x":8, "y":1.5}, {"label":"K21", "x":9, "y":1.5}, {"label":"K22", "x":10.25, "y":1.25}, {"label":"K23", "x":11.25, "y":1.25}, {"label":"K24", "x":12.25, "y":1.25}, {"label":"K25", "x":0, "y":2.5}, {"label":"K26", "x":1, "y":2.5}, {"label":"K27", "x":2, "y":2.5}, {"label":"K28", "x":3, "y":2.5}, {"label":"K29", "x":4, "y":2.5}, {"label":"K30", "x":5, "y":2.5}, {"label":"K31", "x":6, "y":2.5}, {"label":"K32", "x":7, "y":2.5}, {"label":"K33", "x":8, "y":2.5}, {"label":"K34", "x":9, "y":2.5}, {"label":"K35", "x":11.25, "y":2.5}, {"label":"K36", "x":0.5, "y":3.5}, {"label":"K37", "x":1.5, "y":3.5}, {"label":"K38", "x":2.5, "y":3.5}, {"label":"K39", "x":3.5, "y":3.5}, {"label":"K40", "x":4.5, "y":3.5, "w":2}, {"label":"K41", "x":6.5, "y":3.5}, {"label":"K42", "x":7.5, "y":3.5}, {"label":"K43", "x":8.5, "y":3.5}, {"label":"K44", "x":10.25, "y":3.5}, {"label":"K45", "x":11.25, "y":3.5}, {"label":"K43", "x":12.25, "y":3.5}]
}
}
}
@@ -0,0 +1,10 @@
#include "shambles.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LAYOUT(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_ENT, KC_RCTL, KC_RALT,
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_RSFT, KC_UP,
KC_Z, KC_X, KC_C, KC_V, KC_SPC, KC_B, KC_N, KC_M, KC_LEFT, KC_DOWN, KC_RGHT)
};
+15
View File
@@ -0,0 +1,15 @@
# Shambles
![Shambles](https://i.imgur.com/aTEHQpzl.jpg)
An Alpha28, with a numpad and nav cluster
* Keyboard Maintainer: [OsciX](https://github.com/OsciX)
* Hardware Supported: Shambles
* Hardware Availability: [OsciX/shambles_qmk](https://github.com/OsciX/shambles_qmk)
Make example for this keyboard (after setting up your build environment):
make shambles:default
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
+32
View File
@@ -0,0 +1,32 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
# Teensy halfkay
# Pro Micro caterina
# Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = atmel-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = yes # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
MIDI_ENABLE = no # MIDI support
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = no # Audio output on port C6
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
HD44780_ENABLE = no # Enable support for HD44780 based LCDs
+1
View File
@@ -0,0 +1 @@
#include "shambles.h"
+15
View File
@@ -0,0 +1,15 @@
#pragma once
#include "quantum.h"
#define LAYOUT( \
K000, K001, K002, K003, K005, K006, K007, K008, K009, K010, K011, K012, \
K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, \
K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K211, \
K300, K301, K302, K303, K305, K306, K307, K308, K310, K311, K312 \
) { \
{ K000, K001, K002, K003, KC_NO, K005, K006, K007, K008, K009, K010, K011, K012 }, \
{ K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112 }, \
{ K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, KC_NO, K211, KC_NO }, \
{ K300, K301, K302, K303, KC_NO, K305, K306, K307, K308, KC_NO, K310, K311, K312 } \
}
+41
View File
@@ -0,0 +1,41 @@
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0x5058 // "PX"
#define PRODUCT_ID 0x5445 // "TE"
#define DEVICE_VER 0x1001
#define MANUFACTURER Pixlup
#define PRODUCT TENKI
#define DESCRIPTION Customizable Mechanical Numpad
/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 4
/* key matrix pins */
#define MATRIX_ROW_PINS { B1, B4, F6, B6, B2 }
#define MATRIX_COL_PINS { F4, F5, D4, D0 }
#define UNUSED_PINS
#define DIODE_DIRECTION COL2ROW
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* ws2812 RGB LED */
#define RGB_DI_PIN D1
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 3 // Number of LEDs
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 10
#define RGBLIGHT_VAL_STEP 10
#define RGBLIGHT_SLEEP
+12
View File
@@ -0,0 +1,12 @@
{
"keyboard_name": "TENKI",
"url": "https://tokopedia.com/pixlup",
"maintainer": "eriqadams",
"width": 4,
"height": 5,
"layouts": {
"LAYOUT_ortho_5x4": {
"layout": [{"label":"Num Lock", "x":0, "y":0}, {"label":"/", "x":1, "y":0}, {"label":"*", "x":2, "y":0}, {"label":"-", "x":3, "y":0}, {"label":"7", "x":0, "y":1}, {"label":"8", "x":1, "y":1}, {"label":"9", "x":2, "y":1}, {"label":"+", "x":3, "y":1}, {"label":"4", "x":0, "y":2}, {"label":"5", "x":1, "y":2}, {"label":"6", "x":2, "y":2}, {"label":"Bspc", "x":3, "y":2}, {"label":"1", "x":0, "y":3}, {"label":"2", "x":1, "y":3}, {"label":"3", "x":2, "y":3}, {"label":"=", "x":3, "y":3}, {"label":"0", "x":0, "y":4}, {"label":"PrtScr", "x":1, "y":4}, {"label":".", "x":2, "y":4}, {"label":"Enter", "x":3, "y":4}]
}
}
}
+19
View File
@@ -0,0 +1,19 @@
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_ortho_5x4(
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,\
KC_P7, KC_P8, KC_P9, KC_PPLS,\
KC_P4, KC_P5, KC_P6, KC_BSPC,\
KC_P1, KC_P2, KC_P3, KC_PEQL,\
KC_P0, KC_PSCR , LT(1,KC_PDOT), KC_PENT
),
[1] = LAYOUT_ortho_5x4(
KC_TRNS, RGB_HUI, RGB_HUD, RGB_VAD,\
KC_TRNS, KC_VOLU, RGB_TOG, RGB_VAI,\
KC_MPRV, KC_MUTE, KC_MNXT, KC_TRNS,\
KC_TRNS, KC_VOLD, KC_TRNS, KC_TRNS,\
RESET, KC_TRNS, KC_TRNS, RGB_MOD
)
};
+38
View File
@@ -0,0 +1,38 @@
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_ortho_5x4(
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,\
KC_P7, KC_P8, KC_P9, KC_PPLS,\
KC_P4, KC_P5, KC_P6, KC_BSPC,\
KC_P1, KC_P2, KC_P3, KC_PEQL,\
KC_P0, KC_PSCR, LT(1,KC_PDOT), KC_PENT
),
[1] = LAYOUT_ortho_5x4(
KC_TRNS, RGB_HUI, RGB_HUD, RGB_VAD,\
KC_TRNS, KC_VOLU, RGB_TOG, RGB_VAI,\
KC_MPRV, KC_MUTE, KC_MNXT, KC_TRNS,\
KC_TRNS, KC_VOLD, KC_TRNS, KC_TRNS,\
RESET, KC_TRNS, KC_TRNS, RGB_MOD
),
[2] = LAYOUT_ortho_5x4(
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
),
[3] = LAYOUT_ortho_5x4(
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
)
};
+2
View File
@@ -0,0 +1,2 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
+16
View File
@@ -0,0 +1,16 @@
# TENKI
![TENKI](https://i.imgur.com/nOaxFwR.png)
TENKI is a customizable hotswap mechanical numpad.
Supported layout:
![TENKI LAYOUT](https://i.imgur.com/sD9kxID.png)
Keyboard Maintainer: [eriqadams](https://github.com/eriqadams)
Hardware Supported: TENKI PCB, Pro Micro
Hardware Availability: [If you're in Indonesia you can purchase here](https://tokopedia.com/pixlup)
Make example for this keyboard (after setting up your build environment):
make tenki:default
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
+27
View File
@@ -0,0 +1,27 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
# Teensy halfkay
# Pro Micro caterina
# Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
BOOTLOADER = caterina
# Build Options
# comment out to disable the options.
#
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB 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
AUDIO_ENABLE = no
RGBLIGHT_ENABLE = yes
LAYOUTS = ortho_5x4
+1
View File
@@ -0,0 +1 @@
#include "tenki.h"
+18
View File
@@ -0,0 +1,18 @@
#pragma once
#include "quantum.h"
#define LAYOUT_ortho_5x4( \
K00, K01, K02, K03, \
K10, K11, K12, K13, \
K20, K21, K22, K23, \
K30, K31, K32, K33, \
K40, K41, K42, K43 \
) { \
{ K00, K01, K02, K03}, \
{ K10, K11, K12, K13}, \
{ K20, K21, K22, K23}, \
{ K30, K31, K32, K33}, \
{ K40, K41, K42, K43} \
}
+1 -1
View File
@@ -56,7 +56,7 @@ bool process_rgb(const uint16_t keycode, const keyrecord_t *record) {
// Split keyboards need to trigger on key-up for edge-case issue // Split keyboards need to trigger on key-up for edge-case issue
if (!record->event.pressed) { if (!record->event.pressed) {
#endif #endif
uint8_t shifted = get_mods() & (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)); uint8_t shifted = get_mods() & MOD_MASK_SHIFT;
switch (keycode) { switch (keycode) {
case RGB_TOG: case RGB_TOG:
rgblight_toggle(); rgblight_toggle();
@@ -24,8 +24,8 @@ uint8_t unicode_saved_mods;
#if UNICODE_SELECTED_MODES != -1 #if UNICODE_SELECTED_MODES != -1
static uint8_t selected[] = {UNICODE_SELECTED_MODES}; static uint8_t selected[] = {UNICODE_SELECTED_MODES};
static uint8_t selected_count = sizeof selected / sizeof *selected; static int8_t selected_count = sizeof selected / sizeof *selected;
static uint8_t selected_index; static int8_t selected_index;
#endif #endif
void unicode_input_mode_init(void) { void unicode_input_mode_init(void) {
@@ -33,7 +33,7 @@ void unicode_input_mode_init(void) {
#if UNICODE_SELECTED_MODES != -1 #if UNICODE_SELECTED_MODES != -1
# if UNICODE_CYCLE_PERSIST # if UNICODE_CYCLE_PERSIST
// Find input_mode in selected modes // Find input_mode in selected modes
uint8_t i; int8_t i;
for (i = 0; i < selected_count; i++) { for (i = 0; i < selected_count; i++) {
if (selected[i] == unicode_config.input_mode) { if (selected[i] == unicode_config.input_mode) {
selected_index = i; selected_index = i;
@@ -60,9 +60,12 @@ void set_unicode_input_mode(uint8_t mode) {
dprintf("Unicode input mode set to: %u\n", unicode_config.input_mode); dprintf("Unicode input mode set to: %u\n", unicode_config.input_mode);
} }
void cycle_unicode_input_mode(uint8_t offset) { void cycle_unicode_input_mode(int8_t offset) {
#if UNICODE_SELECTED_MODES != -1 #if UNICODE_SELECTED_MODES != -1
selected_index = (selected_index + offset) % selected_count; selected_index = (selected_index + offset) % selected_count;
if (selected_index < 0) {
selected_index += selected_count;
}
unicode_config.input_mode = selected[selected_index]; unicode_config.input_mode = selected[selected_index];
# if UNICODE_CYCLE_PERSIST # if UNICODE_CYCLE_PERSIST
persist_unicode_input_mode(); persist_unicode_input_mode();
@@ -168,6 +171,8 @@ void register_hex32(uint32_t hex) {
} }
} }
// clang-format off
void send_unicode_hex_string(const char *str) { void send_unicode_hex_string(const char *str) {
if (!str) { if (!str) {
return; return;
@@ -175,12 +180,11 @@ void send_unicode_hex_string(const char *str) {
while (*str) { while (*str) {
// Find the next code point (token) in the string // Find the next code point (token) in the string
for (; *str == ' '; str++) for (; *str == ' '; str++); // Skip leading spaces
;
size_t n = strcspn(str, " "); // Length of the current token size_t n = strcspn(str, " "); // Length of the current token
char code_point[n + 1]; char code_point[n+1];
strncpy(code_point, str, n); strncpy(code_point, str, n); // Copy token into buffer
code_point[n] = '\0'; // Make sure it's null-terminated code_point[n] = '\0'; // Make sure it's null-terminated
// Normalize the code point: make all hex digits lowercase // Normalize the code point: make all hex digits lowercase
for (char *p = code_point; *p; p++) { for (char *p = code_point; *p; p++) {
@@ -196,8 +200,10 @@ void send_unicode_hex_string(const char *str) {
} }
} }
// clang-format on
// Borrowed from https://nullprogram.com/blog/2017/10/06/ // Borrowed from https://nullprogram.com/blog/2017/10/06/
const char *decode_utf8(const char *str, int32_t *code_point) { static const char *decode_utf8(const char *str, int32_t *code_point) {
const char *next; const char *next;
if (str[0] < 0x80) { // U+0000-007F if (str[0] < 0x80) { // U+0000-007F
@@ -231,7 +237,6 @@ void send_unicode_string(const char *str) {
} }
int32_t code_point = 0; int32_t code_point = 0;
while (*str) { while (*str) {
str = decode_utf8(str, &code_point); str = decode_utf8(str, &code_point);
@@ -243,53 +248,70 @@ void send_unicode_string(const char *str) {
} }
} }
// clang-format off
static void audio_helper(void) {
#ifdef AUDIO_ENABLE
switch (get_unicode_input_mode()) {
# ifdef UNICODE_SONG_MAC
static float song_mac[][2] = UNICODE_SONG_MAC;
case UC_MAC:
PLAY_SONG(song_mac);
break;
# endif
# ifdef UNICODE_SONG_LNX
static float song_lnx[][2] = UNICODE_SONG_LNX;
case UC_LNX:
PLAY_SONG(song_lnx);
break;
# endif
# ifdef UNICODE_SONG_WIN
static float song_win[][2] = UNICODE_SONG_WIN;
case UC_WIN:
PLAY_SONG(song_win);
break;
# endif
# ifdef UNICODE_SONG_BSD
static float song_bsd[][2] = UNICODE_SONG_BSD;
case UC_BSD:
PLAY_SONG(song_bsd);
break;
# endif
# ifdef UNICODE_SONG_WINC
static float song_winc[][2] = UNICODE_SONG_WINC;
case UC_WINC:
PLAY_SONG(song_winc);
break;
# endif
}
#endif
}
// clang-format on
bool process_unicode_common(uint16_t keycode, keyrecord_t *record) { bool process_unicode_common(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) { if (record->event.pressed) {
bool shifted = get_mods() & MOD_MASK_SHIFT;
switch (keycode) { switch (keycode) {
case UNICODE_MODE_FORWARD: case UNICODE_MODE_FORWARD:
cycle_unicode_input_mode(+1); cycle_unicode_input_mode(shifted ? -1 : +1);
audio_helper();
break; break;
case UNICODE_MODE_REVERSE: case UNICODE_MODE_REVERSE:
cycle_unicode_input_mode(-1); cycle_unicode_input_mode(shifted ? +1 : -1);
audio_helper();
break; break;
case UNICODE_MODE_MAC: case UNICODE_MODE_MAC ... UNICODE_MODE_WINC: {
set_unicode_input_mode(UC_MAC); // Keycodes and input modes follow the same ordering
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_MAC) uint8_t delta = keycode - UNICODE_MODE_MAC;
static float song_mac[][2] = UNICODE_SONG_MAC; set_unicode_input_mode(UC_MAC + delta);
PLAY_SONG(song_mac); audio_helper();
#endif
break;
case UNICODE_MODE_LNX:
set_unicode_input_mode(UC_LNX);
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_LNX)
static float song_lnx[][2] = UNICODE_SONG_LNX;
PLAY_SONG(song_lnx);
#endif
break;
case UNICODE_MODE_WIN:
set_unicode_input_mode(UC_WIN);
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_WIN)
static float song_win[][2] = UNICODE_SONG_WIN;
PLAY_SONG(song_win);
#endif
break;
case UNICODE_MODE_BSD:
set_unicode_input_mode(UC_BSD);
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_BSD)
static float song_bsd[][2] = UNICODE_SONG_BSD;
PLAY_SONG(song_bsd);
#endif
break;
case UNICODE_MODE_WINC:
set_unicode_input_mode(UC_WINC);
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_WINC)
static float song_winc[][2] = UNICODE_SONG_WINC;
PLAY_SONG(song_winc);
#endif
break; break;
}
} }
} }
#if defined(UNICODE_ENABLE) #if defined(UNICODE_ENABLE)
return process_unicode(keycode, record); return process_unicode(keycode, record);
#elif defined(UNICODEMAP_ENABLE) #elif defined(UNICODEMAP_ENABLE)
@@ -80,7 +80,7 @@ extern uint8_t unicode_saved_mods;
void unicode_input_mode_init(void); void unicode_input_mode_init(void);
uint8_t get_unicode_input_mode(void); uint8_t get_unicode_input_mode(void);
void set_unicode_input_mode(uint8_t mode); void set_unicode_input_mode(uint8_t mode);
void cycle_unicode_input_mode(uint8_t offset); void cycle_unicode_input_mode(int8_t offset);
void persist_unicode_input_mode(void); void persist_unicode_input_mode(void);
void unicode_input_start(void); void unicode_input_start(void);
+2 -1
View File
@@ -21,7 +21,8 @@ __attribute__((weak)) uint16_t unicodemap_index(uint16_t keycode) {
// Keycode is a pair: extract index based on Shift / Caps Lock state // Keycode is a pair: extract index based on Shift / Caps Lock state
uint16_t index = keycode - QK_UNICODEMAP_PAIR; uint16_t index = keycode - QK_UNICODEMAP_PAIR;
bool shift = unicode_saved_mods & MOD_MASK_SHIFT, caps = IS_HOST_LED_ON(USB_LED_CAPS_LOCK); bool shift = unicode_saved_mods & MOD_MASK_SHIFT;
bool caps = IS_HOST_LED_ON(USB_LED_CAPS_LOCK);
if (shift ^ caps) { if (shift ^ caps) {
index >>= 7; index >>= 7;
} }
+29
View File
@@ -658,6 +658,31 @@ static void rgblight_layers_write(void) {
} }
} }
} }
# ifdef RGBLIGHT_LAYER_BLINK
uint8_t _blinked_layer_mask = 0;
uint16_t _blink_duration = 0;
static uint16_t _blink_timer;
void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms) {
rgblight_set_layer_state(layer, true);
_blinked_layer_mask |= 1 << layer;
_blink_timer = timer_read();
_blink_duration = duration_ms;
}
void rgblight_unblink_layers(void) {
if (_blinked_layer_mask != 0 && timer_elapsed(_blink_timer) > _blink_duration) {
for (uint8_t layer = 0; layer < RGBLIGHT_MAX_LAYERS; layer++) {
if ((_blinked_layer_mask & 1 << layer) != 0) {
rgblight_set_layer_state(layer, false);
}
}
_blinked_layer_mask = 0;
}
}
# endif
#endif #endif
__attribute__((weak)) void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { ws2812_setleds(start_led, num_leds); } __attribute__((weak)) void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { ws2812_setleds(start_led, num_leds); }
@@ -909,6 +934,10 @@ void rgblight_task(void) {
# endif # endif
} }
} }
# ifdef RGBLIGHT_LAYER_BLINK
rgblight_unblink_layers();
# endif
} }
#endif /* RGBLIGHT_USE_TIMER */ #endif /* RGBLIGHT_USE_TIMER */
+6
View File
@@ -192,6 +192,12 @@ bool rgblight_get_layer_state(uint8_t layer);
// Point this to an array of rgblight_segment_t arrays in keyboard_post_init_user to use rgblight layers // Point this to an array of rgblight_segment_t arrays in keyboard_post_init_user to use rgblight layers
extern const rgblight_segment_t *const *rgblight_layers; extern const rgblight_segment_t *const *rgblight_layers;
# ifdef RGBLIGHT_LAYER_BLINK
# define RGBLIGHT_USE_TIMER
void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms);
# endif
# endif # endif
extern LED_TYPE led[RGBLED_NUM]; extern LED_TYPE led[RGBLED_NUM];
+46
View File
@@ -0,0 +1,46 @@
#include "dmc12.h"
static uint32_t dmc12_color = 0;
static uint16_t dmc12_timer = 0;
static int8_t dmc12_current = 0;
static uint8_t dmc12_direction = 1;
void dmc12_start(uint32_t color, bool reset) {
dmc12_color = color;
if (reset) {
dmc12_timer = 0;
dmc12_current = 0;
dmc12_direction = 1;
}
}
void dmc12_process(void) {
if (!dmc12_timer) {
dmc12_timer = timer_read();
return;
}
float dist_from_center = ((float)abs(dmc12_current - RGBLED_NUM / 2)) / ((float)RGBLED_NUM);
if (timer_elapsed(dmc12_timer) > dist_from_center * LED_INTERVAL) {
dmc12_current += dmc12_direction;
if (dmc12_current == 0 || dmc12_current == RGBLED_NUM - 1) {
dmc12_direction *= -1;
}
dmc12_timer = timer_read();
for (int i = 0; i < RGBLED_NUM; i++) {
if (i > dmc12_current - LED_RADIUS && i < dmc12_current + LED_RADIUS) {
float intensity = (LED_RADIUS - abs(i - dmc12_current)) / ((float)LED_RADIUS);
if (i != dmc12_current) {
intensity /= 4.0;
}
rgblight_setrgb_at(
((dmc12_color >> 16) & 0xFF) * intensity,
((dmc12_color >> 8) & 0xFF) * intensity,
(dmc12_color & 0xFF) * intensity,
i
);
} else {
rgblight_setrgb_at(0, 0, 0, i);
}
}
}
}
+9
View File
@@ -0,0 +1,9 @@
// Sexy LED animation.
#include "quantum.h"
#define LED_INTERVAL 160
#define LED_RADIUS 6
void dmc12_start(uint32_t color, bool reset);
void dmc12_process(void);
+38
View File
@@ -0,0 +1,38 @@
#include "seq.h"
static char buffer[32];
static uint8_t buffer_size = 0;
void seq_start(void) {
buffer_size = 0;
SEND_STRING(":");
}
bool seq_feed(uint16_t keycode) {
if (keycode == KC_ENTER) {
for (int i = 0; i < buffer_size + 1; i++) {
tap_code(KC_BSPACE);
}
for (int i = 0; i < seq_config_size; i++) {
seq_t item = seq_config[i];
if (strncmp(item.sequence, buffer, buffer_size) == 0) {
send_unicode_string(item.result);
}
}
buffer_size = 0;
return false;
} else if (keycode == KC_BSPACE) {
if (buffer_size) {
buffer_size--;
tap_code(keycode);
}
return true;
} else {
if (keycode >= KC_A && keycode <= KC_Z) {
buffer[buffer_size++] = keycode - KC_A + 'a';
tap_code(keycode);
}
return true;
}
}
+14
View File
@@ -0,0 +1,14 @@
#include "quantum.h"
#include <string.h>
typedef struct seq_t {
const char *sequence;
const char *result;
} seq_t;
extern seq_t seq_config[];
extern uint16_t seq_config_size;
void seq_start(void);
bool seq_feed(uint16_t keycode);
+34
View File
@@ -0,0 +1,34 @@
#include <smoothled.h>
static uint32_t sourceColor = 0x000000;
static uint32_t currentColor = 0x000000;
static uint32_t targetColor = 0x000000;
static int32_t smoothledTimer = -1;
void smoothled_set(uint32_t color) {
smoothledTimer = timer_read32();
sourceColor = currentColor;
targetColor = color;
}
void smoothled_process(void) {
if (smoothledTimer < 0) {
return;
}
int32_t kb = timer_elapsed32(smoothledTimer);
int32_t ka = SMOOTH_DURATION - kb;
if (kb > SMOOTH_DURATION) {
kb = SMOOTH_DURATION;
ka = 0;
smoothledTimer = -1;
}
currentColor = 0;
for (int i = 2; i >= 0; i--) {
uint32_t shift = i * 8;
currentColor |= (ka * ((uint32_t)(sourceColor >> shift) & 0xFF) + kb * ((uint32_t)(targetColor >> shift) & 0xFF)) / SMOOTH_DURATION;
/*currentColor |= ((targetColor >> shift) & 0xFF);*/
currentColor <<= 8;
}
currentColor >>= 8;
rgblight_setrgb((currentColor >> 16) & 0xFF, (currentColor >> 8) & 0xFF, currentColor & 0xFF);
}
+6
View File
@@ -0,0 +1,6 @@
#include "quantum.h"
#define SMOOTH_DURATION 160
void smoothled_set(uint32_t color);
void smoothled_process(void);
+125
View File
@@ -0,0 +1,125 @@
/* A library to output the right key shortcut in any common app.
Given a global variable babble_mode to show the environment and a
key that calls the paste macro, do the right type of paste.
Setting the context is done by another macro, or TBD interaction with the host.
Huge thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts
and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jeebak/keymap.c
*/
#include QMK_KEYBOARD_H
#ifdef USE_BABBLEPASTE
# include "babblePaste.h"
// small function that we might also want to call from a keymap.
// GLOBAL variable to determine mode. Sets startup default if no eeppom
uint8_t babble_mode = 0;
// function to tell the user that the mode has changed
__attribute__((weak)) void babble_led_user(void) {}
void set_babble_mode(uint8_t id) { babble_mode = id; }
void babble_mode_increment() {
babble_mode += 1;
if (babble_mode >= BABL_MODEMAX) {
babble_mode = 0;
}
}
void babble_mode_decrement() {
if (babble_mode >= 1) {
babble_mode -= 1;
} else {
babble_mode = BABL_MODEMAX - 1;
}
}
/* this function runs the appropriate babblepaste macro, given
the global babble_mode and a keycode defined in the babble_keycodes enum.
This could be made faster by splitting into two functions sorted by keycode range
But that makes for a *lot* of ifdefs.
*/
bool babblePaste(uint16_t keycode) {
// handle the OS/mode switching first
# ifdef BABL_MAC
if (keycode == BABL_DO_MAC) {
set_babble_mode(BABL_MAC_MODE);
babble_led_user();
return true;
}
if (babble_mode == BABL_MAC_MODE) {
babblePaste_mac(keycode);
}
# endif
# ifdef BABL_VI
if (keycode == BABL_DO_VI) {
set_babble_mode(BABL_VI_MODE);
babble_led_user();
return true;
}
if (babble_mode == BABL_VI_MODE) {
babblePaste_vi(keycode);
}
# endif
# ifdef BABL_WINDOWS
if (keycode == BABL_DO_WINDOWS) {
set_babble_mode(BABL_WINDOWS_MODE);
babble_led_user();
return true;
}
if (babble_mode == BABL_WINDOWS_MODE) {
babblePaste_win(keycode);
}
# endif
# ifdef BABL_LINUX
if (keycode == BABL_DO_LINUX) {
set_babble_mode(BABL_LINUX_MODE);
babble_led_user();
return true;
}
if (babble_mode == BABL_LINUX_MODE) {
babblePaste_linux(keycode);
}
# endif
# ifdef BABL_EMACS
if (keycode == BABL_DO_EMACS) {
set_babble_mode(BABL_EMACS_MODE);
babble_led_user();
return true;
}
if (babble_mode == BABL_EMACS_MODE) {
babblePaste_emacs(keycode);
}
# endif
# ifdef BABL_CHROME
if (keycode == BABL_DO_CHROMEOS) {
set_babble_mode(BABL_CHROMEOS_MODE);
babble_led_user();
return true;
}
if (babble_mode == BABL_CHROMEOS_MODE) {
babblePaste_readmux(keycode);
}
# endif
# ifdef BABL_READMUX
if (keycode == BABL_DO_READMUX) {
set_babble_mode(BABL_READMUX_MODE);
babble_led_user();
return true;
}
if (babble_mode == BABL_READMUX_MODE) {
babblePaste_readmux(keycode);
}
# endif
return false;
}
#endif // USE_BABBLEPASTE
+349
View File
@@ -0,0 +1,349 @@
/* A library to output the right key shortcut in any common app.
Given a global variable babble_mode to show the environment and a
key that calls the paste macro, do the right type of paste.
Setting the bable_mode is done by another macro, or TBD interaction with the host.
Huge thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts
and jeebak & algernon's keymap
*/
#pragma once
#include "quantum.h"
#ifdef USE_BABBLEPASTE
void set_babble_mode(uint8_t id);
void babble_mode_increment(void);
void babble_mode_decrement(void);
void babble_led_user(void);
// manually re-order these if you want to set the order or default.
enum babble_modes {
# ifdef BABL_MAC
BABL_MAC_MODE,
# endif
# ifdef BABL_READMUX
BABL_READMUX_MODE,
# endif
# ifdef BABL_WINDOWS
BABL_WINDOWS_MODE,
# endif
# ifdef BABL_VI
BABL_VI_MODE,
# endif
# ifdef BABL_LINUX
BABL_LINUX_MODE,
# endif
# ifdef BABL_EMACS
BABL_EMACS_MODE,
# endif
# ifdef BABL_CHROMEOS
BABL_CHROMEOS_MODE,
# endif
BABL_MODEMAX
};
// void babble_led_user( uint8_t id)
/// Hacks to make it easier to create sendstring macros
//"outer" versions wrap text
# define OMCTL(arg) SS_DOWN(X_LCTRL) arg SS_UP(X_LCTRL)
# define OMGUI(arg) SS_DOWN(X_LGUI) arg SS_UP(X_LGUI)
# define OMALT(arg) SS_DOWN(X_LALT) arg SS_UP(X_LALT)
# define OMSFT(...) SS_DOWN(X_LSHIFT) __VA_ARGS__ SS_UP(X_LSHIFT)
//"inner" versions wrap a key tap
# define IMCTL(arg) SS_DOWN(X_LCTRL) SS_TAP(arg) SS_UP(X_LCTRL)
# define IMGUI(arg) SS_DOWN(X_LGUI) SS_TAP(arg) SS_UP(X_LGUI)
# define IMALT(arg) SS_DOWN(X_LALT) SS_TAP(arg) SS_UP(X_LALT)
# define IMSFT(arg) SS_DOWN(X_LSHIFT) SS_TAP(arg) SS_UP(X_LSHIFT)
# define BABLM(ent, ...) \
if (ent == keycode) { \
SEND_STRING(__VA_ARGS__); \
return true; \
}
// BabblePaste should be loaded first (header in userspace .h file, before all else)
// if not,we'll do our best.
# if defined(NEW_SAFE_RANGE)
# define BABBLE_START NEW_SAFE_RANGE
# else
# if defined(KEYMAP_SAFE_RANGE)
# define BABBLE_START KEYMAP_SAFE_RANGE
# else
# define BABBLE_START SAFE_RANGE
# endif
# endif
enum babble_keycodes {
FIRST = BABBLE_START,
# ifdef BABL_MOVE
// Movement macros
// left & right
BABL_GO_LEFT_1C,
BABL_GO_RIGHT_1C,
BABL_GO_LEFT_WORD,
BABL_GO_RIGHT_WORD,
BABL_GO_START_LINE,
BABL_GO_END_LINE,
// now up & down
BABL_GO_START_DOC,
BABL_GO_END_DOC,
BABL_GO_NEXT_LINE,
BABL_GO_PREV_LINE,
BABL_GO_PARA_START,
BABL_GO_PARA_END,
BABL_PGDN,
BABL_PGUP,
// And the delete options
BABL_DEL_LEFT_1C, // == backspace, so why bother?
BABL_DEL_RIGHT_1C, // usually = Del
BABL_DEL_LEFT_WORD,
BABL_DEL_RIGHT_WORD,
BABL_DEL_TO_LINE_END, // delete from cursor to end of line
BABL_DEL_TO_LINE_START, // delete from cursor to begining line
BABL_MODE, // print out string saying what mode we're in.
# endif
# ifdef BABL_OSKEYS
BABL_UNDO,
BABL_REDO,
BABL_CUT,
BABL_COPY,
BABL_PASTE,
BABL_SELECT_ALL,
/* not yet implemented
BABL_SWAP_LAST2C, // swap last characters before the cursor
BABL_SWAP_LAST2W, // Swap the last two words before the cursor
*/
// find & replace
BABL_FIND,
BABL_FIND_NEXT,
BABL_FIND_PREV,
BABL_FIND_REPLACE,
// GUI or app
BABL_RUNAPP,
BABL_SWITCH_APP_NEXT,
BABL_SWITCH_APP_LAST, // previous
BABL_WINDOW_NEXT,
BABL_WINDOW_PREV,
BABL_WINDOW_NEW,
BABL_CLOSE_APP,
BABL_HELP,
BABL_LOCK,
BABL_SCREENCAPTURE,
BABL_SWITCH_KEYBOARD_LAYOUT,
# endif
# ifdef BABL_BROWSER
BABL_BROWSER_NEW_TAB,
BABL_BROWSER_CLOSE_TAB,
BABL_BROWSER_REOPEN_LAST_TAB,
BABL_BROWSER_NEXT_TAB,
BABL_BROWSER_PREV_TAB,
BABL_BROWSER_URL_BAR,
BABL_BROWSER_FORWARD,
BABL_BROWSER_BACK,
BABL_BROWSER_FIND,
BABL_BROWSER_BOOKMARK,
BABL_BROWSER_DEV_TOOLS, // hard one to remember
BABL_BROWSER_RELOAD,
BABL_BROWSER_FULLSCREEN,
BABL_BROWSER_ZOOM_IN,
BABL_BROWSER_ZOOM_OUT,
BABL_BROWSER_VIEWSRC,
# endif
# ifdef BABL_APP
BABL_APP_SAVE, // save file blurs app & os. Move?
BABL_APP_PASTE_VALUES, // paste only values, or with some special formatting. ctrl shift v chrome, // Ctrl+Alt+V, excel
// App hotkeys will be flawed, since you may use different spreadsheets across OSes.
# ifdef BABL_APP_CELLS // spreadsheets and tables
BABL_APP_CENTER_ALIGN, // Center align contents of a cell in table or spreadsheet.
BABL_APP_CLEAR_FORMATTING, //
BABL_APP_SCROLL_ACTIVE_CELL, // scroll to active cell.
BABL_NEWLINE_IN_CELL, // newline inside cell of table,
BABL_INSERT_COMMENT, // insert comment
BABL_INSERT_COL_LEFT, // insert columns to the left
BABL_INSERT_ROW, // insert row
BABL_DELETE_ROW, // delete row // excel ctrl minus // chrome ctrl alt minus
BABL_SELECT_COL, // select column - ctrl space //same in both
BABL_SELECT_ROW, // select row shift spaced // same in both.
# endif // BABL_APP_CELLS
# ifdef BABL_APP_EDITOR
BABL_APP_MULTI_SELECT, /* www.sublimetext.com/docs/2/multiple_selection_with_the_keyboard.html */
# endif // BABL_APP_EDITOR
# ifdef BABL_APP_WINDOWSPLITTING
// These aren't useful on most oses.
BABL_SPLIT_FRAME_VERT,
BABL_UNSPLIT_FRAME_VERT,
BABL_SPLIT_FRAME_HORIZONTAL,
BABL_UNSPLIT_FRAME_HORIZONTAL,
BABL_NEXT_FRAME,
BABL_PREV_FRAME,
# endif
# endif
// Macros for mode switching
# ifdef BABL_WINDOWS
BABL_DO_WINDOWS,
# endif
# ifdef BABL_MAC
BABL_DO_MAC,
# endif
# ifdef BABL_LINUX
BABL_DO_LINUX,
# endif
# ifdef BABL_EMACS
BABL_DO_EMACS,
# endif
# ifdef BABL_VI
BABL_DO_VI,
# endif
# ifdef BABL_READMUX
BABL_DO_READMUX,
# endif
# ifdef BABL_CHROMEOS
BABL_DO_CHROMEOS,
# endif
BABBLE_END_RANGE
};
// primary function.
bool babblePaste(uint16_t keycode);
/****************************************************/
/* All per-os includes and short mode switch macros*/
# ifdef BABL_WINDOWS
# define B_WIN BABL_DO_WINDOWS
bool babblePaste_win(uint16_t keycode);
# endif
# ifdef BABL_MAC
# define B_MAC BABL_DO_MAC
bool babblePaste_mac(uint16_t keycode);
# endif
# ifdef BABL_LINUX
# define B_LINUX BABL_DO_LINUX
bool babblePaste_linux(uint16_t keycode);
# endif
# ifdef BABL_EMACS
# define B_EMACS BABL_DO_EMACS
bool babblePaste_emacs(uint16_t keycode);
# endif
# ifdef BABL_VI
# define B_VI BABL_DO_VI
bool babblePaste_vi(uint16_t keycode);
# endif
# ifdef BABL_READMUX
# define B_READ BABL_DO_READMUX
bool babblePaste_readmux(uint16_t keycode);
# endif
# ifdef BABL_CHROMEOS
# define B_CROM BABL_DO_CHROMEOS
bool babblePaste_chromeos(uint16_t keycode);
# endif
# define BABL_INC babble_mode_increment();
# define BABL_DEC babble_mode_decrement();
/****************************************************
** All keyboard macros for Babble Actions
*****************************************************/
# ifdef BABL_MOVE
# define B_L1C BABL_GO_LEFT_1C
# define B_R1C BABL_GO_RIGHT_1C
# define B_L1W BABL_GO_LEFT_WORD
# define B_R1W BABL_GO_RIGHT_WORD
# define B_GSOL BABL_GO_START_LINE
# define B_GEOL BABL_GO_END_LINE
# define B_GTOP BABL_GO_START_DOC
# define B_GEND BABL_GO_END_DOC
# define B_DOWN BABL_GO_NEXT_LINE
# define B_UP BABL_GO_PREV_LINE
# define B_PTOP BABL_GO_PARA_START
# define B_PEND BABL_GO_PARA_END
# define B_PGDN BABL_PGDN
# define B_PGUP BABL_PGUP
//#define B_BKSP BABL_DEL_LEFT_1C == backspace so why bother.
# define B_DEL BABL_DEL_RIGHT_1C // usually = Del
# define B_DLW BABL_DEL_LEFT_WORD
# define B_DRW BABL_DEL_RIGHT_WORD
# define B_DEOL BABL_DEL_TO_LINE_END // delete from cursor to end of line
# define B_DSOL BABL_DEL_TO_LINE_START // delete from cursor to begining line
# define B_MODE BABL_MODE // type out name of current mode.
# endif
# ifdef BABL_OSKEYS
# define B_UNDO BABL_UNDO
# define B_REDO BABL_REDO
# define B_CUT BABL_CUT
# define B_COPY BABL_COPY
# define B_PASTE BABL_PASTE
# define B_SELALL BABL_SELECT_ALL
# define B_SELA BABL_SELECT_ALL
# define B_FIND BABL_FIND
# define B_FINDN BABL_FIND_NEXT
# define B_FINDP BABL_FIND_PREV
# define B_RPLACE BABL_FIND_REPLACE
# define B_RUNAPP BABL_RUNAPP
# define B_NAPP BABL_SWITCH_APP_NEXT
# define B_PAPP BABL_SWITCH_APP_LAST // previous
# define B_NWIN BABL_WINDOW_NEXT
# define B_PWIN BABL_WINDOW_PREV
# define B_WINN BABL_WINDOW_NEW
# define B_CAPP BABL_CLOSE_APP
# define B_HELP BABL_HELP
# define B_LOCK BABL_LOCK
# define B_SCAP BABL_SCREENCAPTURE
# define B_KEYB BABL_SWITCH_KEYBOARD_LAYOUT
# endif
# ifdef BABL_BROWSER
# define B_NTAB BABL_BROWSER_NEW_TAB
# define B_CTAB BABL_BROWSER_CLOSE_TAB
# define B_ROTB BABL_BROWSER_REOPEN_LAST_TAB
# define B_NXTB BABL_BROWSER_NEXT_TAB
# define B_PTAB BABL_BROWSER_PREV_TAB
# define B_NURL BABL_BROWSER_URL_BAR
# define B_BFWD BABL_BROWSER_FORWARD
# define B_BBAK BABL_BROWSER_BACK
# define B_BFND BABL_BROWSER_FIND
# define B_BOOK BABL_BROWSER_BOOKMARK
# define B_BDEV BABL_BROWSER_DEV_TOOLS // hard one to remember
# define B_BRLD BABL_BROWSER_RELOAD
# define B_BFULL BABL_BROWSER_FULLSCREEN
# define B_ZIN BABL_BROWSER_ZOOM_IN
# define B_ZOUT BABL_BROWSER_ZOOM_OUT
# endif
# ifdef BABL_APP
# define B_SAVE BABL_APP_SAVE
# ifdef BABL_APP_CELLS // spreadsheets and tables
# define B_PASTV BABL_APP_PASTE_VALUES
# define B_CALN BABL_APP_CENTER_ALIGN
# define B_CFMT BABL_APP_CLEAR_FORMATTING
# define B_SCLA BABL_APP_SCROLL_ACTIVE_CELL
# define B_NCEL BABL_NEWLINE_IN_CELL
# define B_IPRW BABL_INSERT_ROW_ABOVE
# define B_ICOL BABL_INSERT_COL_LEFT
# define B_IROW BABL_INSERT_ROW
# define B_DROW BABL_DELETE_ROW
# define B_SELC BABL_SELECT_COL
# define B_SELR BABL_SELECT_ROW
# endif // BABL_APP_CELLS
# ifdef BABL_APP_EDITOR
# define B_MSEL BABL_APP_MULTI_SELECT
/* www.sublimetext.com/docs/2/multiple_selection_with_the_keyboard.html */
# endif // BABL_APP_EDITOR
# ifdef BABL_APP_WINDOWSPLITTING
# define B_VSPLIT BABL_SPLIT_FRAME_VERT
# define B_VUNSPT BABL_UNSPLIT_FRAME_VERT
# define B_HSPLIT BABL_SPLIT_FRAME_HORIZONTAL
# define B_HUNSPT BABL_UNSPLIT_FRAME_HORIZONTAL
# define B_NXTFM BABL_NEXT_FRAME
# define B_PRVFM BABL_PREV_FRAME
# endif // BABL_APP_WINDOWSPLITTING
# endif // BABL_APP
#endif
+207
View File
@@ -0,0 +1,207 @@
## Babblepaste, a universal translator for keyboard shortcuts
The idea is to have one "paste" key do the right thing for any operating system.
Put the keyboard in Windows mode, and "paste" means Ctrl-v.
Switch to Emacs and "Paste" means Ctrl-y. Mac is GUI-v and so on.
Currently supported modes are Windows, OS X, Gnome/KDE, Emacs, VI , ChromeOS, and Readline, with 70+ common macro actions.
The babblepaste library looks for the current OS in the babble_mode global variable.
To switch modes, run the switch_babble_mode() function, or a pre defined BABL_DO_x macro.
**BE CAREFUL**
* Not all actions are defined for all OSes. The default is to do nothing.
* Not all actions are _TESTED_ on all OSes.
* Keys can have very different meanings between windows in the same OS. If you switch apps without switching modes, bad things can happen.
###To use the library
#### Add #defines to your config.h.
```
#define USE_BABBLEPASTE
//// Uncomment the modes you want to enable
#define BABL_WINDOWS
#define BABL_READMUX
#define BABL_VI
#define BABL_MAC
#define BABL_LINUX
#define BABL_EMACS
#define BABL_CHROMEOS
//// These enable subsets of babble macros. Disable options to save space
#define BABL_MOVE // Uncomment to add basic cursor movement
#define BABL_OSKEYS // This adds Cut, paste, window movement and common OS shortcuts
#define BABL_BROWSER // Browser shortcuts
//// What Browser shortcuts?
#define BABL_BROWSER_CHROME // Chrome browser, Google apps
//#define BABL_BROWSER_MS
//#define BABL_BROWSER_SAFARI // Safari, Apple defaults.
//// applications vary even more between OSes. We'll do our best.
#define BABL_APP
// To enable specific App options.
#define BABL_APP_CELLS // spreadsheets and tables
#define BABL_APP_EDITOR // Fancy editor commands
#define BABL_APP_WINDOWSPLITTING // splitting frames & windows
//// What App keybinding is assumed?
//#define BABL_APP_GOOGLE // Google office
#define BABL_APP_MSOFFICE // MS office
//#define BABL_APP_APPLE // Apple office
#define BABL_APP_SUBLIME
```
#### Enable Babblepaste in your Keymap
Add the following to your keymap in process_record_user, before the main switch statement.
```
#ifdef USE_BABBLEPASTE
if( keycode > BABBLE_START && keycode < BABBLE_END_RANGE ) {
if (record->event.pressed) { // is there a case where this isn't desired?
babblePaste ( keycode );
} else{
return true;
}
}
#endif
```
#### Add makefile rules
Update your rules.mk to include the modes you want.
`SRC += babblePaste.c babl_windows.c babl_mac.c babl_vi.c babl_readmux.c babl_chromeos.c babl_emacs.c babl_linux.c`
#### Custom Keycodes
If you are using custom keycodes, update the safe range in your user.h
```
#if defined(BABBLE_END_RANGE)
#define USER_START BABBLE_END_RANGE
#else
#if defined(KEYMAP_SAFE_RANGE)
#define USER_START KEYMAP_SAFE_RANGE
#else
#define USER_START SAFE_RANGE
#endif
#endif
```
#### Add Babblepaste actions to your keymap.
See the full list in babblePaste.h, or the list below
```
B_WIN // switch babblepaste to windows mode.
B_MAC // Mac Mode
B_LNX // switch to linux
B_VI // switch to Vi mode
B_EMAX // switch mode to emacs
B_READ // switch to readline /tmux mode
B_CROM // switch to chromeos mode.
#define B_L1C BABL_GO_LEFT_1C
#define B_R1C BABL_GO_RIGHT_1C
#define B_L1W BABL_GO_LEFT_WORD
#define B_R1W BABL_GO_RIGHT_WORD
#define B_GSOL BABL_GO_START_LINE
#define B_GEOL BABL_GO_END_LINE
#define B_GTOP BABL_GO_START_DOC
#define B_GEND BABL_GO_END_DOC
#define B_DOWN BABL_GO_NEXT_LINE
#define B_UP BABL_GO_PREV_LINE
#define B_PTOP BABL_GO_PARA_START
#define B_PEND BABL_GO_PARA_END
#define B_PGDN BABL_PGDN
#define B_PGUP BABL_PGUP
#define B_DEL BABL_DEL_RIGHT_1C
#define B_DLW BABL_DEL_LEFT_WORD
#define B_DRW BABL_DEL_RIGHT_WORD
#define B_DEOL BABL_DEL_TO_LINE_END // delete from cursor to end of line
#define B_DSOL BABL_DEL_TO_LINE_START // delete from cursor to begining line
#define B_MODE BABL_MODE //type out name of current mode.
#define B_UNDO BABL_UNDO
#define B_REDO BABL_REDO
#define B_CUT BABL_CUT
#define B_COPY BABL_COPY
#define B_PASTE BABL_PASTE
#define B_SELALL BABL_SELECT_ALL
#define B_SELA BABL_SELECT_ALL
#define B_FIND BABL_FIND
#define B_FINDN BABL_FIND_NEXT
#define B_FINDP BABL_FIND_PREV
#define B_RPLACE BABL_FIND_REPLACE
#define B_RUNAPP BABL_RUNAPP
#define B_NAPP BABL_SWITCH_APP_NEXT
#define B_PAPP BABL_SWITCH_APP_LAST // previous
#define B_CAPP BABL_CLOSE_APP
#define B_HELP BABL_HELP
#define B_NTAB BABL_BROWSER_NEW_TAB
#define B_CTAB BABL_BROWSER_CLOSE_TAB
#define B_ROTB BABL_BROWSER_REOPEN_LAST_TAB
#define B_NXTB BABL_BROWSER_NEXT_TAB
#define B_PTAB BABL_BROWSER_PREV_TAB
#define B_NURL BABL_BROWSER_URL_BAR
#define B_BFWD BABL_BROWSER_FORWARD
#define B_BBAK BABL_BROWSER_BACK
#define B_BFND BABL_BROWSER_FIND
#define B_BOOK BABL_BROWSER_BOOKMARK
#define B_BDEV BABL_BROWSER_DEV_TOOLS // hard one to remember
#define B_BRLD BABL_BROWSER_RELOAD
#define B_BFULL BABL_BROWSER_FULLSCREEN
#define B_ZIN BABL_BROWSER_ZOOM_IN
#define B_ZOUT BABL_BROWSER_ZOOM_OUT
#define B_PASTV BABL_APP_PASTE_VALUES
#define B_CALN BABL_APP_CENTER_ALIGN
#define B_CFMT BABL_APP_CLEAR_FORMATTING
#define B_SCLA BABL_APP_SCROLL_ACTIVE_CELL
#define B_NCEL BABL_NEWLINE_IN_CELL
#define B_IPRW BABL_INSERT_ROW_ABOVE
#define B_ICOL BABL_INSERT_COL_LEFT
#define B_IROW BABL_INSERT_ROW
#define B_DROW BABL_DELETE_ROW
#define B_SELC BABL_SELECT_COL
#define B_SELR BABL_SELECT_ROW
#define B_MSEL BABL_APP_MULTI_SELECT
#define B_VSPLIT BABL_SPLIT_FRAME_VERT
#define B_VUNSPT BABL_UNSPLIT_FRAME_VERT
#define B_HSPLIT BABL_SPLIT_FRAME_HORIZONTAL
#define B_HUNSPT BABL_UNSPLIT_FRAME_HORIZONTAL
#define B_NXTFM BABL_NEXT_FRAME
#define B_PRVFM BABL_PREV_FRAME
```
## Development FAQs
**Todos**
eeprom store state of babble_mode? or update docs so that people can change the order of the enum in
babblespace.h?
**You have huge ifdef stanzas instead of functions**
This fails gracefully if you don't have all options defined. Patch if you can think how to use fewer defines.
** Why not an array of arrays as a lookup instead of a function?**
This would allow you to store the lookup table in PROGMEM.
True, but that takes more pre-processor skill than I have, and may be less portable to ARM or other flash mappings.
** Have you tested every key on every platform?**
No. Be careful, submit a patch.
** Why not update Apps at the same global level as the OS? **
This is only a good thing if it doesn't confuse the user. If you can show state of OS vs App, it's probably a good thing.
** Can the OS tell the keyboard what mode to use? **
The keyboard side is easy to do with virtser_recv & a function that updates babble_mode. It still needs a PC side app to track where the keyboard focus is.
One could use a keyboard macro to launch an app & switch modes for that app.
## Thanks
Thanks to [wikipedia shortcuts page](https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts)
and [Jeebak's keymap](https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jeebak/keymap.c)
this [howtogeek shortcuts page](https://www.howtogeek.com/115664/42-text-editing-keyboard-shortcuts-that-work-almost-everywhere/)
And of course QMK...
+103
View File
@@ -0,0 +1,103 @@
/* A library to output the right key shortcut in any common app.
Given a global variable babble_mode to show the environment and a
key that calls the paste macro, do the right type of paste.
Setting the context is done by another macro, or TBD interaction with the host.
https://support.google.com/docs/answer/181110?co=GENIE.Platform%3DDesktop&hl=en
*/
#include QMK_KEYBOARD_H
#ifdef USE_BABBLEPASTE
# include "babblePaste.h"
# ifdef BABL_CHROMEOS
bool babblepaste_chromeos(uint16_t keycode) {
# ifdef BABL_MOVE
BABLM(BABL_GO_LEFT_1C, SS_TAP(X_LEFT));
BABLM(BABL_GO_RIGHT_1C, SS_TAP(X_RIGHT));
BABLM(BABL_GO_LEFT_WORD, IMCTL(X_LEFT));
BABLM(BABL_GO_RIGHT_WORD, IMCTL(X_RIGHT));
BABLM(BABL_GO_START_LINE, SS_TAP(X_HOME));
BABLM(BABL_GO_END_LINE, SS_TAP(X_END));
BABLM(BABL_GO_START_DOC, IMCTL(X_HOME));
BABLM(BABL_GO_END_DOC, IMCTL(X_END));
BABLM(BABL_GO_NEXT_LINE, SS_TAP(X_DOWN));
BABLM(BABL_GO_PREV_LINE, SS_TAP(X_UP));
BABLM(BABL_GO_PARA_START, IMCTL(X_UP)); // untested
BABLM(BABL_GO_PARA_END, IMCTL(X_DOWN)); // untested
BABLM(BABL_PGDN, IMGUI(X_DOWN));
BABLM(BABL_PGUP, IMGUI(X_UP));
BABLM(BABL_DEL_RIGHT_1C, IMALT(X_BSPACE));
BABLM(BABL_DEL_LEFT_WORD, IMCTL(X_BSPACE));
BABLM(BABL_DEL_RIGHT_WORD, OMSFT(IMCTL(X_RIGHT)) SS_TAP(X_BSPACE));
BABLM(BABL_DEL_TO_LINE_END, OMSFT(IMGUI(X_LEFT)) SS_TAP(X_BSPACE));
BABLM(BABL_DEL_TO_LINE_START, OMSFT(IMGUI(X_RIGHT)) SS_TAP(X_BSPACE));
BABLM(BABL_MODE, ("ChromeOS "));
# endif
# ifdef BABL_OSKEYS
BABLM(BABL_UNDO, SS_LCTRL("z"));
BABLM(BABL_REDO, OMSFT(IMCTL(X_Z)));
BABLM(BABL_CUT, SS_LCTRL("x"));
BABLM(BABL_COPY, SS_LCTRL("c"));
BABLM(BABL_PASTE, SS_LCTRL("v"));
BABLM(BABL_SELECT_ALL, SS_LCTRL("a"));
BABLM(BABL_FIND, SS_LCTRL("f"));
BABLM(BABL_FIND_NEXT, SS_LCTRL("g"));
BABLM(BABL_FIND_PREV, OMSFT(IMCTL(X_G)));
BABLM(BABL_WINDOW_NEW, IMCTL(X_N));
// BABLM( BABL_FIND_REPLACE, () ); // not part of Chrome
// BABLM( BABL_RUNAPP, SS_TAP(X_LGUI) ); // not sure of this
BABLM(BABL_SWITCH_APP_NEXT, IMALT(X_TAB));
BABLM(BABL_SWITCH_APP_LAST, OMSFT(IMALT(X_TAB)));
BABLM(BABL_CLOSE_APP, OMSFT(IMCTL(X_W)));
// BABLM( BABL_HELP, OMCTL(IMALT(X_SLASH)) ); // general help
BABLM(BABL_HELP, IMCTL(X_SLASH)); // this is keyboard accelerator lookup
BABLM(BABL_LOCK, SS_LGUI("l")); // should be caps?
BABLM(BABL_SCREENCAPTURE, OMSFT(IMCTL(X_F5)));
BABLM(BABL_SWITCH_KEYBOARD_LAYOUT, IMCTL(X_SPACE));
# endif
# ifdef BABL_BROWSER
BABLM(BABL_BROWSER_NEW_TAB, SS_LCTRL("t"));
BABLM(BABL_BROWSER_CLOSE_TAB, SS_LCTRL("w"));
BABLM(BABL_BROWSER_REOPEN_LAST_TAB, OMSFT(IMCTL(X_T)));
BABLM(BABL_BROWSER_NEXT_TAB, IMCTL(X_TAB));
BABLM(BABL_BROWSER_PREV_TAB, OMSFT(IMCTL(X_TAB)));
BABLM(BABL_BROWSER_URL_BAR, SS_LCTRL("l"));
BABLM(BABL_BROWSER_FORWARD, IMALT(X_RIGHT));
BABLM(BABL_BROWSER_BACK, IMALT(X_LEFT));
;
BABLM(BABL_BROWSER_FIND, SS_LCTRL("f"));
BABLM(BABL_BROWSER_BOOKMARK, SS_LCTRL("d"));
BABLM(BABL_BROWSER_DEV_TOOLS, OMSFT(IMCTL(X_I)));
BABLM(BABL_BROWSER_RELOAD, OMSFT(IMCTL(X_R))); // hard reload w/o cache
BABLM(BABL_BROWSER_FULLSCREEN, SS_TAP(X_F4)); // untested
BABLM(BABL_BROWSER_ZOOM_IN, OMSFT(IMCTL(X_EQUAL))); // ctr+ +
BABLM(BABL_BROWSER_ZOOM_OUT, IMCTL(X_MINUS));
BABLM(BABL_BROWSER_VIEWSRC, SS_LCTRL("u")); // Chrome or firefox
# endif
# ifdef BABL_APP
BABLM(BABL_APP_SAVE, SS_LCTL("s"));
//#ifdef BABL_APP_GOOGLE -- we're going to make an assumption.
BABLM(BABL_APP_CENTER_ALIGN, OMSFT(IMCTL(X_E)));
BABLM(BABL_APP_SCROLL_ACTIVE_CELL, IMCTL(X_BSPACE));
BABLM(BABL_NEWLINE_IN_CELL, IMALT(X_ENTER));
BABLM(BABL_INSERT_COMMENT, OMALT(IMCTL(X_M)));
BABLM(BABL_APP_CLEAR_FORMATTING, IMCTL(X_BSLASH));
BABLM(BABL_DELETE_ROW, IMALT(X_E) "d");
BABLM(BABL_INSERT_COL_LEFT, IMALT(X_I) "c"); // o for to the right.
BABLM(BABL_INSERT_ROW, IMALT(X_I) "w"); // r for above.
BABLM(BABL_SELECT_COL, IMCTL(X_SPACE));
BABLM(BABL_SELECT_ROW, IMSFT(X_SPACE));
BABLM(BABL_DELETE_ROW, OMALT(IMCTL(X_KP_MINUS))); // once selected
//#endif // BABL_APP_CELLS
# endif // BABL_APP
// Todo, ring bell, flash light, show user this isn't supported
return false;
}
# endif
#endif /* chromeos*/
+85
View File
@@ -0,0 +1,85 @@
/* A library to output the right key shortcut in any common app.
Given a global variable babble_mode to show the environment and a
key that calls the paste macro, do the right type of paste.
Setting the context is done by another macro, or TBD interaction with the host.
Emacs mode is probably most useful for people who don't usually use emacs
https://www.ast.cam.ac.uk/~vasily/idl/emacs_commands_list.html
*/
#include QMK_KEYBOARD_H
#ifdef USE_BABBLEPASTE
# include "babblePaste.h"
# ifdef BABL_EMACS
// probably should allow meta to not be ALT
# define DMETA IMALT
bool babblePaste_emacs(uint16_t keycode) {
# ifdef BABL_MOVE
BABLM(BABL_GO_LEFT_1C, SS_TAP(X_LEFT));
BABLM(BABL_GO_RIGHT_1C, SS_TAP(X_RIGHT));
BABLM(BABL_GO_LEFT_WORD, IMALT(X_B));
BABLM(BABL_GO_RIGHT_WORD, IMALT(X_F));
BABLM(BABL_GO_START_LINE, SS_LCTRL("a"));
BABLM(BABL_GO_END_LINE, SS_LCTRL("e"));
BABLM(BABL_GO_START_DOC, OMALT(IMSFT(X_COMMA)));
BABLM(BABL_GO_END_DOC, OMALT(IMSFT(X_DOT)));
BABLM(BABL_GO_NEXT_LINE, SS_LCTRL("n"));
BABLM(BABL_GO_PREV_LINE, SS_LCTRL("p"));
BABLM(BABL_GO_PARA_START, OMALT(IMSFT(X_LBRACKET)));
BABLM(BABL_GO_PARA_END, OMALT(IMSFT(X_RBRACKET)));
BABLM(BABL_PGDN, SS_LCTRL("v"));
BABLM(BABL_PGUP, IMALT(X_V));
BABLM(BABL_DEL_RIGHT_1C, SS_LCTRL("d"));
BABLM(BABL_DEL_LEFT_WORD, IMCTL(X_BSPACE));
BABLM(BABL_DEL_RIGHT_WORD, IMALT(X_D));
BABLM(BABL_DEL_TO_LINE_END, SS_LCTRL("k"));
BABLM(BABL_DEL_TO_LINE_START, SS_TAP(X_ESCAPE) "0" SS_LCTRL("k"));
BABLM(BABL_MODE, "Emacs ");
# endif
# ifdef BABL_OSKEYS
BABLM(BABL_UNDO, SS_LCTRL("x") "c");
BABLM(BABL_REDO, SS_LCTRL("x") "c"); // arguably
BABLM(BABL_CUT, SS_LCTRL("w"));
BABLM(BABL_COPY, SS_LALT("w")); // really?
BABLM(BABL_PASTE, SS_LCTRL("y"));
BABLM(BABL_SELECT_ALL, SS_LCTRL("x") "h");
BABLM(BABL_FIND, SS_LCTRL("s"));
BABLM(BABL_FIND_NEXT, SS_LCTRL("s"));
BABLM(BABL_FIND_PREV, SS_LCTRL("r"));
BABLM(BABL_FIND_REPLACE, OMALT(IMSFT(X_5)));
// BABLM( BABL_RUNAPP , //(SS_LALT("x") "shell") );// arguably
BABLM(BABL_RUNAPP, IMALT(X_X) "split-window" SS_TAP(X_ENTER)); // arguably
BABLM(BABL_WINDOW_NEXT, SS_LCTRL("x") "o");
BABLM(BABL_WINDOW_PREV, SS_LCTRL("x") "o"); // arguably
// BABLM( BABL_WINDOW_NEW, IMCTL(X_X)"n" ); //
BABLM(BABL_CLOSE_APP, SS_LCTRL("x") "c");
BABLM(BABL_HELP, SS_LCTRL("h") "a"); // start search in help
// BABLM( BABL_LOCK, () ); // lock buffer? Too many options.
// BABLM( BABL_SCREENCAPTURE, () ); // requires plugin?
# endif
# ifdef BABL_BROWSER
/* you get to figure w3 out */
# endif
# ifdef BABL_APP
BABLM(BABL_APP_SAVE, SS_LCTL("x") SS_LCTL("s"));
/// BABLM( BABL_APP_MULTI_SELECT, SS_LCTRL("x") "rt" ); // arguably
BABLM(BABL_SPLIT_FRAME_VERT, SS_LCTRL("x") "3");
BABLM(BABL_UNSPLIT_FRAME_VERT, SS_LCTRL("u") SS_LCTRL("x") "0");
BABLM(BABL_SPLIT_FRAME_HORIZONTAL, SS_LCTRL("x") "2");
BABLM(BABL_UNSPLIT_FRAME_HORIZONTAL, SS_LCTRL("u") SS_LCTRL("x") "0");
BABLM(BABL_NEXT_FRAME, SS_LCTRL("x") "o");
BABLM(BABL_PREV_FRAME, SS_LCTRL("u") "-1" SS_LCTRL("x") "o");
# endif
// Todo, ring bell, flash light, show user this isn't supported
return false;
}
# endif /* emacs mode*/
#endif
+102
View File
@@ -0,0 +1,102 @@
/* A library to output the right key shortcut in any common app.
Given a global variable babble_mode to show the environment and a
key that calls the paste macro, do the right type of paste.
Setting the context is done by another macro, or TBD interaction with the host.
Huge thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts
and
https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jeebak/keymap.c
*/
#include QMK_KEYBOARD_H
#ifdef USE_BABBLEPASTE
# include "babblePaste.h"
# ifdef BABL_LINUX
bool babblePaste_linux(uint16_t keycode) {
# ifdef BABL_MOVE
BABLM(BABL_GO_LEFT_1C, SS_TAP(X_LEFT));
BABLM(BABL_GO_RIGHT_1C, SS_TAP(X_RIGHT));
BABLM(BABL_GO_LEFT_WORD, IMCTL(X_LEFT));
BABLM(BABL_GO_RIGHT_WORD, IMCTL(X_RIGHT));
BABLM(BABL_GO_START_LINE, SS_TAP(X_HOME));
BABLM(BABL_GO_END_LINE, SS_TAP(X_END));
BABLM(BABL_GO_START_DOC, IMCTL(X_HOME));
BABLM(BABL_GO_END_DOC, IMCTL(X_END));
BABLM(BABL_GO_NEXT_LINE, SS_TAP(X_DOWN));
BABLM(BABL_GO_PREV_LINE, SS_TAP(X_UP));
BABLM(BABL_GO_PARA_START, IMCTL(X_UP));
BABLM(BABL_GO_PARA_END, IMCTL(X_DOWN));
BABLM(BABL_PGDN, SS_TAP(X_PGDOWN));
BABLM(BABL_PGUP, SS_TAP(X_PGUP));
BABLM(BABL_DEL_RIGHT_1C, SS_TAP(X_DELETE));
BABLM(BABL_DEL_LEFT_WORD, IMCTL(X_BSPACE));
BABLM(BABL_DEL_RIGHT_WORD, IMCTL(X_DELETE));
BABLM(BABL_DEL_TO_LINE_END, IMSFT(X_HOME) SS_TAP(X_DELETE));
BABLM(BABL_DEL_TO_LINE_START, IMSFT(X_END) SS_TAP(X_DELETE));
BABLM(BABL_MODE, "Linux ");
# endif
# ifdef BABL_OSKEYS
BABLM(BABL_UNDO, SS_LCTL("z"));
BABLM(BABL_REDO, SS_LCTL("y"));
BABLM(BABL_CUT, SS_LCTL("x"));
BABLM(BABL_COPY, SS_LCTL("c"));
BABLM(BABL_PASTE, SS_LCTL("v"));
BABLM(BABL_SELECT_ALL, SS_LCTL("a"));
BABLM(BABL_FIND, SS_LCTL("f"));
BABLM(BABL_CLOSE_APP, IMALT(X_F4));
BABLM(BABL_HELP, SS_TAP(X_F1));
// BABLM(BABL_FIND_NEXT (SS_LALT(X_F3)) ); //KDE */
BABLM(BABL_FIND_NEXT, SS_LCTL("g")); // Gnome*/
BABLM(BABL_FIND_PREV, OMSFT(IMCTL(X_G))); // Gnome*/
/* BABLM( BABL_FIND_REPLACE , (SS_LCTL("r")) ); // KDE */
BABLM(BABL_FIND_REPLACE, SS_LCTL("h")); // Gnome*/
BABLM(BABL_RUNAPP, IMALT(X_F2)); // Gnome
BABLM(BABL_SWITCH_APP_NEXT, IMALT(X_TAB));
BABLM(BABL_SWITCH_APP_LAST, OMSFT(IMALT(X_TAB)));
BABLM(BABL_WINDOW_NEXT, OMCTL(IMALT(X_PGUP))); // Gnome, sometimes
BABLM(BABL_WINDOW_PREV, OMCTL(IMALT(X_PGDOWN)));
BABLM(BABL_WINDOW_NEW, IMCTL(X_N));
// BABLM( BABL_HELP, (SS_TAP(X_F1)) ); // NA?
BABLM(BABL_LOCK, OMCTL(IMALT(X_L)));
BABLM(BABL_SCREENCAPTURE, IMSFT(X_PSCREEN));
# endif
# ifdef BABL_BROWSER
BABLM(BABL_BROWSER_NEW_TAB, SS_LCTL("t"));
BABLM(BABL_BROWSER_CLOSE_TAB, SS_LCTL("w"));
BABLM(BABL_BROWSER_REOPEN_LAST_TAB, OMSFT(IMCTL(X_T)));
BABLM(BABL_BROWSER_NEXT_TAB, SS_LCTL(SS_TAP(X_TAB)));
BABLM(BABL_BROWSER_PREV_TAB, OMSFT(IMCTL(X_TAB)));
BABLM(BABL_BROWSER_URL_BAR, SS_LCTL("l"));
BABLM(BABL_BROWSER_FORWARD, IMALT(X_RIGHT));
BABLM(BABL_BROWSER_BACK, IMALT(X_LEFT));
BABLM(BABL_BROWSER_FIND, SS_LCTL("f"));
BABLM(BABL_BROWSER_BOOKMARK, SS_LCTL("d"));
BABLM(BABL_BROWSER_DEV_TOOLS, SS_LCTL("t")); // Chrome
// chrome
BABLM(BABL_BROWSER_RELOAD, IMCTL(X_F5)); // hard reload w/o cache
BABLM(BABL_BROWSER_FULLSCREEN, SS_TAP(X_F11)); // command shift F
BABLM(BABL_BROWSER_ZOOM_IN, OMSFT(IMCTL(X_EQUAL))); // ctr+ +
BABLM(BABL_BROWSER_ZOOM_OUT, IMCTL(X_MINUS));
BABLM(BABL_BROWSER_VIEWSRC, SS_LCTL("u")); // Chrome or firefox
# endif
# ifdef BABL_APP
BABLM(BABL_APP_SAVE, SS_LCTL("s"));
// on linux we'd probably use tmux or screen. Some terminal software also
// allows this.
// BABLM( BABL_SPLIT_FRAME_VERT, () );
// BABLM( BABL_UNSPLIT_FRAME_VERT, () );
// BABLM( BABL_SPLIT_FRAME_HORIZONTAL, () );
// BABLM( BABL_UNSPLIT_FRAME_HORIZONTAL, () );
// BABLM( BABL_NEXT_FRAME, () );
// BABLM( BABL_PREV_FRAME, () );
# endif
// Todo, ring bell, flash light, show user this isn't supported
return false;
}
# endif /* linux mode */
#endif
+152
View File
@@ -0,0 +1,152 @@
/* A library to output the right key shortcut in any common app.
Given a global variable babble_mode to show the environment and a
key that calls the paste macro, do the right type of paste.
Setting the context is done by another macro, or TBD interaction with the host.
Huge thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts
and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jeebak/keymap.c
*/
#include QMK_KEYBOARD_H
#ifdef USE_BABBLEPASTE
# include "babblePaste.h"
# ifdef BABL_MAC
bool babblePaste_mac(uint16_t keycode) {
# ifdef BABL_MOVE
BABLM(BABL_GO_LEFT_1C, SS_TAP(X_LEFT));
BABLM(BABL_GO_RIGHT_1C, SS_TAP(X_RIGHT));
BABLM(BABL_GO_LEFT_WORD, IMALT(X_LEFT));
BABLM(BABL_GO_RIGHT_WORD, IMALT(X_RIGHT));
BABLM(BABL_GO_START_LINE, IMGUI(X_LEFT));
BABLM(BABL_GO_END_LINE, IMGUI(X_RIGHT));
BABLM(BABL_GO_START_DOC, IMGUI(X_UP));
BABLM(BABL_GO_END_DOC, IMGUI(X_DOWN));
BABLM(BABL_GO_NEXT_LINE, SS_TAP(X_DOWN));
BABLM(BABL_GO_PREV_LINE, SS_TAP(X_UP));
BABLM(BABL_GO_PARA_START, IMALT(X_UP));
BABLM(BABL_DEL_RIGHT_1C, SS_TAP(X_DELETE));
BABLM(BABL_GO_PARA_END, IMALT(X_DOWN));
BABLM(BABL_PGDN, SS_TAP(X_PGDOWN));
BABLM(BABL_PGUP, SS_TAP(X_PGUP));
BABLM(BABL_DEL_LEFT_WORD, IMALT(X_BSPACE));
BABLM(BABL_DEL_RIGHT_WORD, IMALT(X_DELETE));
BABLM(BABL_DEL_TO_LINE_END, OMSFT(IMGUI(X_RIGHT)) SS_TAP(X_BSPACE)); // this is more app agnostic than ctrl-k
BABLM(BABL_DEL_TO_LINE_START, OMSFT(IMGUI(X_LEFT)) SS_TAP(X_BSPACE));
BABLM(BABL_MODE, "Mac ");
# endif
# ifdef BABL_OSKEYS
BABLM(BABL_UNDO, SS_LGUI("z"));
BABLM(BABL_REDO, SS_LGUI("y"));
BABLM(BABL_CUT, SS_LGUI("x"));
BABLM(BABL_COPY, SS_LGUI("c"));
BABLM(BABL_PASTE, SS_LGUI("v"));
BABLM(BABL_SELECT_ALL, SS_LGUI("a"));
BABLM(BABL_FIND, SS_LGUI("f"));
BABLM(BABL_FIND_NEXT, SS_LGUI("g"));
// BABLM( BABL_FIND_NEXT, OMSFT(X_F4)) ); // Mac office
BABLM(BABL_FIND_PREV, OMSFT(IMGUI(X_G))); // Sublime, browser
BABLM(BABL_FIND_PREV, SS_LGUI("g"));
BABLM(BABL_FIND_REPLACE, SS_LGUI("f"));
BABLM(BABL_RUNAPP, SS_LGUI(" "));
BABLM(BABL_SWITCH_APP_NEXT, IMGUI(X_TAB));
BABLM(BABL_SWITCH_APP_LAST, OMSFT(IMGUI(X_TAB)));
// Apps vary, but this is usually tab movement, same as B_NXTB
/*
BABLM( BABL_WINDOW_NEXT, OMSFT(IMGUI(X_RBRACKET)) ); // GUI Grav isn't everywhere
BABLM( BABL_WINDOW_PREV, OMSFT(IMGUI(X_LBRACKET)) );
*/
BABLM(BABL_WINDOW_NEXT, IMGUI(X_GRAVE));
BABLM(BABL_WINDOW_PREV, OMSFT(IMGUI(X_GRAVE)));
BABLM(BABL_WINDOW_NEW, IMGUI(X_N));
BABLM(BABL_CLOSE_APP, SS_LGUI("q"));
BABLM(BABL_HELP, OMSFT(IMGUI(X_SLASH)));
// Locking screen from external keyboard requires automator https://apple.stackexchange.com/questions/73995
BABLM(BABL_LOCK, OMCTL(IMALT(X_L)));
BABLM(BABL_SCREENCAPTURE, OMSFT(OMGUI(IMALT(X_4))) IMGUI(X_SPACE) "preview" SS_LGUI("d"));
BABLM(BABL_SWITCH_KEYBOARD_LAYOUT, IMCTL(X_SPACE));
# endif
# ifdef BABL_BROWSER
BABLM(BABL_BROWSER_NEW_TAB, IMGUI(X_T));
BABLM(BABL_BROWSER_CLOSE_TAB, SS_LGUI("w"));
BABLM(BABL_BROWSER_REOPEN_LAST_TAB, OMSFT(SS_LGUI("t")));
BABLM(BABL_BROWSER_NEXT_TAB, OMGUI(IMALT(X_RIGHT)));
BABLM(BABL_BROWSER_PREV_TAB, OMGUI(IMALT(X_LEFT)));
BABLM(BABL_BROWSER_URL_BAR, SS_LGUI("l"));
BABLM(BABL_BROWSER_FORWARD, IMGUI(X_RIGHT));
BABLM(BABL_BROWSER_BACK, IMGUI(X_LEFT));
BABLM(BABL_BROWSER_FIND, SS_LGUI("f"));
BABLM(BABL_BROWSER_BOOKMARK, SS_LGUI("d"));
BABLM(BABL_BROWSER_RELOAD, OMGUI(SS_LSFT("r"))); // hard reload w/o cache
BABLM(BABL_BROWSER_FULLSCREEN, OMGUI(SS_LCTRL("p")));
BABLM(BABL_BROWSER_ZOOM_IN, IMGUI(X_KP_PLUS)); // ctr+ +
BABLM(BABL_BROWSER_ZOOM_OUT, IMGUI(X_KP_MINUS));
# ifdef BABL_BROWSER_CHROME
BABLM(BABL_BROWSER_VIEWSRC, SS_LGUI("u")); // Chrome or firefox
BABLM(BABL_BROWSER_DEV_TOOLS, OMGUI(SS_LALT("i"))); // Chrome or Firefox
# endif
# ifdef BABL_BROWSER_SAFARI
BABLM(BABL_BROWSER_VIEWSRC, OMGUI(IMALT(X_U))); // Safari
// BABLM( BABL_BROWSER_DEV_TOOLS, // No real equivalent for Safari
# endif
# endif // BABL_BROWSER
# ifdef BABL_APP
BABLM(BABL_APP_SAVE, SS_LGUI("s"));
# ifdef BABL_APP_EDITOR
# ifdef BABL_APP_SUBLIME
BABLM(BABL_APP_MULTI_SELECT, OMCTL(IMGUI(X_G))); // add all occurences of current word to select.
BABLM(BABL_APP_PASTE_VALUES, OMSFT(IMGUI(X_V))); // paste with proper indenting.
# endif // sublime
# endif // editor
# ifdef BABL_APP_CELLS
# ifdef BABL_APP_MSOFFICE
BABLM(BABL_APP_CENTER_ALIGN, IMGUI(X_E));
// BABLM( BABL_APP_CLEAR_FORMATTING, OMCTL(IMGUI(X_G)) ); // this isn't native. https://support.office.com/en-us/article/Clear-all-text-formatting-C094C4DA-7F09-4CEA-9A8D-C166949C9C80#OfficeVersion=macOS
BABLM(BABL_APP_SCROLL_ACTIVE_CELL, IMCTL(X_BSPACE));
BABLM(BABL_NEWLINE_IN_CELL, IMALT(X_ENTER));
BABLM(BABL_INSERT_COMMENT, IMSFT(X_F2));
BABLM(BABL_INSERT_COL_LEFT, IMCTL(X_I));
BABLM(BABL_INSERT_ROW, OMCTL(IMSFT(X_KP_PLUS)));
BABLM(BABL_DELETE_ROW, IMCTL(X_KP_MINUS));
BABLM(BABL_SELECT_COL, IMCTL(X_SPACE));
BABLM(BABL_SELECT_ROW, IMSFT(X_SPACE));
# endif // BABL_APP_MSOFFICE
# ifdef BABL_APP_GOOGLE
BABLM(BABL_APP_CENTER_ALIGN, OMSFT(IMGUI(X_E)));
BABLM(BABL_APP_SCROLL_ACTIVE_CELL, IMCTL(X_BSPACE));
BABLM(BABL_NEWLINE_IN_CELL, IMALT(X_ENTER));
BABLM(BABL_INSERT_COMMENT, IMSFT(X_F2));
BABLM(BABL_APP_CLEAR_FORMATTING, IMGUI(X_BSLASH));
BABLM(BABL_DELETE_ROW, OMCTL(IMGUI(X_G)));
BABLM(BABL_INSERT_COL_LEFT, OMALT(IMCTL(X_I)) "c"); // o for to the right.
BABLM(BABL_INSERT_ROW, OMALT(IMCTL(X_I)) "b"); // r for above.
BABLM(BABL_SELECT_COL, IMCTL(X_SPACE));
BABLM(BABL_SELECT_ROW, IMSFT(X_SPACE));
BABLM(BABL_DELETE_ROW, OMALT(IMCTL(X_KP_MINUS))); // once selected
# endif // BABL_APP_GOOGLE
/*
#ifdef BABL_APP_APPLE
// you're on your own.
#endif
*/
# endif // BABL_APP_CELLS
# ifdef BABL_APP_WINDOWSPLITTING
// These are for os X terminal, and are pretty useless.
BABLM(BABL_SPLIT_FRAME_HORIZONTAL, SS_LGUI("d"));
BABLM(BABL_UNSPLIT_FRAME_HORIZONTAL, OMSFT(IMGUI(X_D)));
# endif // BABL_APP_WINDOWSPLITTING
# endif // BABL_APP
// Todo, ring bell, flash light, show user this isn't supported
return false;
}
# endif /* mac mode*/
#endif // Babblepaste
+86
View File
@@ -0,0 +1,86 @@
// Readline command line editing + tmux windowing
// I haven't decided how much to do readline and how much tmux
// see https://tiswww.case.edu/php/chet/readline/rluserman.html for other possible
// keybindings.
#include QMK_KEYBOARD_H
#ifdef USE_BABBLEPASTE
# include "babblePaste.h"
# ifdef BABL_READMUX
// Redefine if you use something other than CTRL-B to activate tmux.
# define TMUX SS_LCTL("b")
bool babblePaste_readmux(uint16_t keycode) {
# ifdef BABL_MOVE
BABLM(BABL_GO_LEFT_1C, SS_TAP(X_LEFT));
BABLM(BABL_GO_RIGHT_1C, SS_TAP(X_RIGHT));
BABLM(BABL_GO_LEFT_WORD, SS_LALT("b"));
BABLM(BABL_GO_RIGHT_WORD, SS_LALT("f"));
BABLM(BABL_GO_START_LINE, SS_LCTL("a"));
BABLM(BABL_GO_END_LINE, SS_LCTL("e"));
// BABLM( BABL_GO_START_DOC ,END );// tmux?
// BABLM( BABL_GO_END_DOC ,END ); // tmux?
BABLM(BABL_GO_NEXT_LINE, SS_LCTL("n"));
BABLM(BABL_GO_PREV_LINE, SS_LCTL("p"));
// BABLM( BABL_GO_PARA_START, // undefined
// BABLM( BABL_GO_PARA_END, // undefinedBABLM( BABL_PGDN ,
BABLM(BABL_PGUP, SS_TAP(X_PGUP));
BABLM(BABL_PGDN, SS_TAP(X_PGDOWN));
BABLM(BABL_DEL_RIGHT_1C, SS_LCTL("d"));
BABLM(BABL_DEL_LEFT_WORD, SS_LCTL("w")); // meta-DEL instead?
BABLM(BABL_DEL_RIGHT_WORD, SS_LALT("d"));
BABLM(BABL_DEL_TO_LINE_END, SS_LCTL("k"));
BABLM(BABL_DEL_TO_LINE_START, SS_LCTL("u"));
BABLM(BABL_MODE, "Readline ");
# endif
# ifdef BABL_OSKEYS
BABLM(BABL_UNDO, SS_LALT("r"));
BABLM(BABL_REDO, SS_LCTL("x") "c"); // arguably
BABLM(BABL_CUT, SS_LCTL("k")); // wrong half the time
// BABLM( BABL_COPY ,END );
BABLM(BABL_PASTE, SS_LCTL("y"));
BABLM(BABL_SELECT_ALL, SS_LCTL("aky"));
BABLM(BABL_FIND, SS_LCTL("r")); // search history
BABLM(BABL_FIND_NEXT, SS_LCTL("r"));
BABLM(BABL_FIND_PREV, SS_LCTL("s"));
// BABLM( BABL_FIND_REPLACE ,END ); // not offered in readline
BABLM(BABL_RUNAPP, TMUX "c"); // tmux
BABLM(BABL_SWITCH_APP_NEXT, TMUX "n"); // tmux
BABLM(BABL_SWITCH_APP_LAST, TMUX "p"); // tmux
BABLM(BABL_CLOSE_APP, TMUX "d"); // usually what I want
BABLM(BABL_HELP, TMUX IMSFT(X_SLASH));
BABLM(BABL_LOCK, TMUX "L"); // assuming you set up VLOCK yourself
BABLM(BABL_SCREENCAPTURE, TMUX ":capture-pane");
# endif
# ifdef BABL_BROWSER
/* Add lynx shortcuts, brow.sh?
*/
# ifdef BABL_MAC
// this is stock OS X Terminal, alter for windows &etc.
BABLM(BABL_BROWSER_NEW_TAB, IMGUI(X_T));
BABLM(BABL_BROWSER_CLOSE_TAB, SS_LGUI("w"));
BABLM(BABL_BROWSER_NEXT_TAB, IMCTL(X_TAB));
BABLM(BABL_BROWSER_PREV_TAB, OMSFT(IMCTL(X_TAB)));
# endif
# endif
# ifdef BABL_APP
// Save makes no sense here
BABLM(BABL_SPLIT_FRAME_VERT, TMUX IMSFT(X_5));
// BUG - misleading. This is currently set to convert frame to a window.
BABLM(BABL_UNSPLIT_FRAME_VERT, TMUX IMSFT(X_1));
BABLM(BABL_SPLIT_FRAME_HORIZONTAL, TMUX IMSFT(X_QUOTE));
// This one closes the current pane.
BABLM(BABL_UNSPLIT_FRAME_HORIZONTAL, SS_LCTL("b") "x");
BABLM(BABL_NEXT_FRAME, SS_LCTL("b") "o");
BABLM(BABL_PREV_FRAME, SS_LCTL("w") SS_TAP(X_SCOLON));
# endif
// Todo, ring bell, flash light, show user this isn't supported
return false;
}
# endif /* readmux*/
#endif
+76
View File
@@ -0,0 +1,76 @@
/*
Vi is stateful, so you have to track the modes yourself. Otherwise motion is awful (bell, bell, bell)
*/
#include QMK_KEYBOARD_H
#ifdef USE_BABBLEPASTE
# include "babblePaste.h"
# ifdef BABL_VI
bool babblePaste_vi(uint16_t keycode) {
# ifdef BABL_MOVE
BABLM(BABL_GO_LEFT_1C, "h");
BABLM(BABL_GO_RIGHT_1C, "l");
BABLM(BABL_GO_LEFT_WORD, "b");
BABLM(BABL_GO_RIGHT_WORD, "w");
BABLM(BABL_GO_START_LINE, IMSFT(X_6));
BABLM(BABL_GO_END_LINE, IMSFT(X_4));
BABLM(BABL_GO_START_DOC, "gg");
BABLM(BABL_GO_END_DOC, IMSFT(X_G));
BABLM(BABL_GO_NEXT_LINE, "j");
BABLM(BABL_GO_PREV_LINE, "k");
BABLM(BABL_GO_PARA_START, IMSFT(X_LBRACKET));
BABLM(BABL_GO_PARA_END, IMSFT(X_RBRACKET));
BABLM(BABL_PGDN, SS_LCTRL("f"));
BABLM(BABL_PGUP, SS_LCTRL("b"));
BABLM(BABL_DEL_RIGHT_1C, "x");
BABLM(BABL_DEL_LEFT_WORD, "dge");
BABLM(BABL_DEL_RIGHT_WORD, "dw");
BABLM(BABL_DEL_TO_LINE_END, "d" IMSFT(X_4));
BABLM(BABL_DEL_TO_LINE_START, "d" IMSFT(X_6));
BABLM(BABL_MODE, "Vi ");
# endif
# ifdef BABL_OSKEYS
BABLM(BABL_UNDO, "h");
BABLM(BABL_REDO, SS_LCTRL("r"));
BABLM(BABL_CUT, "x");
BABLM(BABL_COPY, "y");
BABLM(BABL_PASTE, "p");
BABLM(BABL_SELECT_ALL, IMSFT(X_SCOLON) SS_TAP(X_5) "y"); // wrong but helpful?
BABLM(BABL_FIND, SS_TAP(X_SLASH));
BABLM(BABL_FIND_NEXT, "n");
BABLM(BABL_FIND_PREV, IMSFT(X_N));
BABLM(BABL_FIND_REPLACE, OMALT(IMSFT(X_5)));
BABLM(BABL_RUNAPP, ":split"); // requires VIM, is vsplit better?
BABLM(BABL_SWITCH_APP_NEXT, IMCTL(X_DOWN)); // Or Right?
BABLM(BABL_SWITCH_APP_NEXT, IMCTL(X_UP)); // or Left?
BABLM(BABL_CLOSE_APP, IMCTL(X_SCOLON) "q");
BABLM(BABL_HELP, SS_LSFT(SS_TAP(X_SCOLON)) "h"); // start search in help
// BABLM( BABL_LOCK, () ); Perhaps VI is not an OS?
// BABLM( BABL_SCREENCAPTURE, () ); // capture a buffer?
# endif
# ifdef BABL_BROWSER
/* what _is_ the VI browser now that vimpirator is dead?*/
# endif
# ifdef BABL_APP
BABLM(BABL_APP_SAVE, SS_TAP(X_ESCAPE) ":w");
# ifdef BABL_APP_WINDOWSPLITTING
BABLM(BABL_SPLIT_FRAME_VERT, SS_TAP(X_ESCAPE) ":vsplit");
BABLM(BABL_UNSPLIT_FRAME_VERT, SS_TAP(X_ESCAPE) ":hide"); // debatable.
BABLM(BABL_SPLIT_FRAME_HORIZONTAL, SS_TAP(X_ESCAPE) ":vsplit");
BABLM(BABL_UNSPLIT_FRAME_HORIZONTAL, SS_TAP(X_ESCAPE) ":hide");
BABLM(BABL_NEXT_FRAME, SS_LCTRL("w") "w");
BABLM(BABL_PREV_FRAME, SS_LCTRL("w") SS_LSFT("w"));
# endif
# endif // app
// Todo, ring bell, flash light, show user this isn't supported
return false;
}
# endif // VI
#endif // Babblepaste
+151
View File
@@ -0,0 +1,151 @@
/* A library to output the right key shortcut in any common app.
Given a global variable babble_mode to show the environment and a
key that calls the paste macro, do the right type of paste.
Setting the context is done by another macro, or TBD interaction with the host.
Huge thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts
https://support.microsoft.com/en-gb/help/12445/windows-keyboard-shortcuts
Remember to check https://github.com/qmk/qmk_firmware/blob/master/quantum/send_string_keycodes.h
*/
#include QMK_KEYBOARD_H
#ifdef USE_BABBLEPASTE
# include "babblePaste.h"
# ifdef BABL_WINDOWS
bool babblePaste_win(uint16_t keycode) {
# ifdef BABL_MOVE
BABLM(BABL_GO_LEFT_1C, SS_TAP(X_LEFT));
BABLM(BABL_GO_RIGHT_1C, SS_TAP(X_RIGHT));
BABLM(BABL_GO_LEFT_WORD, IMCTL(X_LEFT));
BABLM(BABL_GO_RIGHT_WORD, IMCTL(X_RIGHT));
BABLM(BABL_GO_START_LINE, IMGUI(X_LEFT));
BABLM(BABL_GO_END_LINE, IMGUI(X_RIGHT));
BABLM(BABL_GO_START_DOC, OMGUI(IMCTL(X_LEFT)));
BABLM(BABL_GO_END_DOC, OMGUI(IMCTL(X_RIGHT)));
BABLM(BABL_GO_NEXT_LINE, SS_TAP(X_DOWN));
BABLM(BABL_GO_PREV_LINE, SS_TAP(X_UP));
BABLM(BABL_GO_PARA_START, IMCTL(X_UP));
BABLM(BABL_GO_PARA_END, IMCTL(X_DOWN));
BABLM(BABL_PGDN, SS_TAP(X_PGDOWN));
BABLM(BABL_PGUP, SS_TAP(X_PGUP));
BABLM(BABL_DEL_RIGHT_1C, SS_TAP(X_DELETE));
BABLM(BABL_DEL_LEFT_WORD, IMCTL(X_BSPACE));
BABLM(BABL_DEL_RIGHT_WORD, IMCTL(X_DELETE));
BABLM(BABL_DEL_TO_LINE_END, IMSFT(X_HOME) SS_TAP(X_DELETE));
BABLM(BABL_DEL_TO_LINE_START, IMSFT(X_END) SS_TAP(X_DELETE));
BABLM(BABL_MODE, "Windows ");
# endif
# ifdef BABL_OSKEYS
BABLM(BABL_UNDO, SS_LCTRL("z"));
BABLM(BABL_REDO, SS_LCTRL("y"));
BABLM(BABL_CUT, SS_LCTRL("x"));
BABLM(BABL_COPY, SS_LCTRL("c"));
BABLM(BABL_PASTE, SS_LCTRL("v"));
BABLM(BABL_SELECT_ALL, SS_LCTRL("a"));
BABLM(BABL_FIND, SS_LCTRL("f"));
BABLM(BABL_FIND_NEXT, SS_TAP(X_F3));
// BABLM( BABL_FIND_PREV, SS_TAP(X_F3) ); // doesn't have a standard one?
BABLM(BABL_FIND_REPLACE, SS_LCTRL("h"));
BABLM(BABL_RUNAPP, SS_LGUI("r"));
BABLM(BABL_SWITCH_APP_NEXT, IMALT(X_TAB));
BABLM(BABL_SWITCH_APP_LAST, OMSFT(IMALT(X_TAB)));
BABLM(BABL_WINDOW_NEXT, IMCTL(X_TAB));
BABLM(BABL_WINDOW_PREV, OMSFT(IMCTL(X_TAB)));
BABLM(BABL_WINDOW_NEW, IMCTL(X_N));
BABLM(BABL_CLOSE_APP, IMALT(X_F4));
BABLM(BABL_HELP, SS_TAP(X_F1));
BABLM(BABL_LOCK, SS_LGUI("l"));
BABLM(BABL_SCREENCAPTURE, OMSFT(SS_LGUI("s")));
BABLM(BABL_SWITCH_KEYBOARD_LAYOUT, IMGUI(X_SPACE));
# endif
# ifdef BABL_BROWSER
BABLM(BABL_BROWSER_NEW_TAB, SS_LCTRL("t"));
BABLM(BABL_BROWSER_CLOSE_TAB, SS_LCTRL("w"));
BABLM(BABL_BROWSER_REOPEN_LAST_TAB, OMSFT(IMCTL(X_T)));
BABLM(BABL_BROWSER_NEXT_TAB, IMCTL(X_TAB));
BABLM(BABL_BROWSER_PREV_TAB, OMSFT(IMCTL(X_TAB)));
BABLM(BABL_BROWSER_URL_BAR, SS_LCTRL("l"));
BABLM(BABL_BROWSER_FORWARD, IMALT(X_RIGHT));
BABLM(BABL_BROWSER_BACK, OMSFT(IMALT(X_LEFT)));
;
BABLM(BABL_BROWSER_FIND, SS_LCTRL("f"));
BABLM(BABL_BROWSER_BOOKMARK, SS_LCTRL("d"));
# ifdef BABL_BROWSER_MS
BABLM(BABL_BROWSER_DEV_TOOLS, IMCTL(X_F12)); // EDGE
# else
BABLM(BABL_BROWSER_DEV_TOOLS, SS_LCTRL("t")); // Chrome
BABLM(BABL_BROWSER_VIEWSRC, SS_LCTRL("u")); // Chrome or firefox
# endif
// chrome
BABLM(BABL_BROWSER_RELOAD, IMCTL(X_F5)); // hard reload w/o cache
BABLM(BABL_BROWSER_FULLSCREEN, SS_TAP(X_F11)); // command shift F
BABLM(BABL_BROWSER_ZOOM_IN, OMSFT(IMCTL(X_EQUAL))); // ctr+ +
BABLM(BABL_BROWSER_ZOOM_OUT, IMCTL(X_MINUS));
# endif
# ifdef BABL_APP
BABLM(BABL_APP_SAVE, SS_LCTL("s"));
# ifdef BABL_APP_EDITOR
# ifdef BABL_APP_SUBLIME
// http://sweetme.at/2013/08/08/sublime-text-keyboard-shortcuts/
BABLM(BABL_APP_MULTI_SELECT, IMALT(X_F3)); // add all occurences of current word to select.
BABLM(BABL_APP_PASTE_VALUES, OMSFT(IMCTL(X_V))); // paste with proper indenting.
# endif // sublime
# endif // editor
# ifdef BABL_APP_CELLS
# ifdef BABL_APP_MSOFFICE
# ifndef BABL_APP_SUBLIME
BABLM(BABL_APP_PASTE_VALUES, OMCTL(IMALT(X_V)) "v");
# endif
BABLM(BABL_APP_CENTER_ALIGN, IMALT(X_H) "ac");
// BABLM( BABL_APP_CLEAR_FORMATTING, OMCTL(IMGUI(X_G)) ); // this isn't native. https://support.office.com/en-us/article/Clear-all-text-formatting-C094C4DA-7F09-4CEA-9A8D-C166949C9C80#OfficeVersion=macOS
BABLM(BABL_APP_SCROLL_ACTIVE_CELL, IMCTL(X_BSPACE));
BABLM(BABL_NEWLINE_IN_CELL, IMALT(X_ENTER));
BABLM(BABL_INSERT_COMMENT, IMSFT(X_F2));
BABLM(BABL_INSERT_COL_LEFT, OMCTL(IMSFT(X_KP_PLUS)));
BABLM(BABL_INSERT_ROW, OMCTL(IMSFT(X_KP_PLUS)));
BABLM(BABL_DELETE_ROW, IMCTL(X_KP_MINUS));
BABLM(BABL_SELECT_COL, IMCTL(X_SPACE));
BABLM(BABL_SELECT_ROW, IMSFT(X_SPACE));
# endif
# ifdef BABL_APP_GOOGLE
BABLM(BABL_APP_CENTER_ALIGN, OMSFT(IMCTL(X_E)));
BABLM(BABL_APP_SCROLL_ACTIVE_CELL, IMCTL(X_BSPACE));
BABLM(BABL_NEWLINE_IN_CELL, IMALT(X_ENTER));
BABLM(BABL_INSERT_COMMENT, IMSFT(X_F2));
BABLM(BABL_APP_CLEAR_FORMATTING, IMCTL(X_BSLASH));
BABLM(BABL_DELETE_ROW, IMALT(X_E) "d");
BABLM(BABL_INSERT_COL_LEFT, OMALT(IMCTL(X_I)) "c"); // o for to the right.
BABLM(BABL_INSERT_ROW, IMALT(IMCTL(X_I)) "w"); // r for above.
BABLM(BABL_SELECT_COL, IMCTL(X_SPACE));
BABLM(BABL_SELECT_ROW, IMSFT(X_SPACE));
BABLM(BABL_DELETE_ROW, OMALT(IMCTL(X_KP_MINUS))); // once selected
# endif
# endif // BABL_APP_CELLS
// BABLM( BABL_SPLIT_FRAME_VERT, () );// no windows way?
// BABLM( BABL_UNSPLIT_FRAME_VERT, () );
BABLM(BABL_SPLIT_FRAME_HORIZONTAL, OMALT(IMCTL(X_S))); // word only
BABLM(BABL_UNSPLIT_FRAME_HORIZONTAL, OMSFT(IMALT(X_C))); // word
// BABLM( BABL_NEXT_FRAME, () );//no windows way?
// BABLM( BABL_PREV_FRAME, () );// no windows way?
# endif
// Todo, ring bell, flash light, show user this isn't supported
return false;
}
# endif /* BABL_WINDOWS*/
#endif /* babblepaste */
+53
View File
@@ -0,0 +1,53 @@
#pragma once
#ifdef RGBLIGHT_ENABLE
#define RGBLIGHT_SLEEP
#undef RGBLIGHT_ANIMATIONS
#define RGBLIGHT_EFFECT_BREATHING
#endif // RGBLIGHT_ENABLE
#ifndef QMK_KEYS_PER_SCAN
#define QMK_KEYS_PER_SCAN 4
#endif // !QMK_KEYS_PER_SCAN
#undef FORCE_NKRO
#ifndef TAPPING_TOGGLE
#define TAPPING_TOGGLE 3
#endif
#ifdef TAPPING_TERM
#undef TAPPING_TERM
#endif // TAPPING_TERM
#define TAPPING_TERM 200
//if no chord during tapping term, do the keystroke
#define RETRO_TAPPING
// Disable action_get_macro and fn_actions, since we don't use these
// and it saves on space in the firmware.
// LTO_ENABLE automatically enables these
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
#define MACRO_TIMER 5
#define USE_BABBLEPASTE
// All options
#define BABL_MOVE // Uncomment to add basic cursor movement
#define BABL_OSKEYS // This adds Cut, paste, window movement and common OS shortcuts
#define BABL_BROWSER // Browser shortcuts, with Chrome/Firefox as the default.
// edit the appropriate OS config file to enable Safari, Edge, vimpirator &etc.
#define BABL_APP // Application specific settings this has sub-options.
#define BABL_APP_CELLS // spreadsheets and tables
#define BABL_APP_EDITOR // Fancy editor commands
#define BABL_APP_WINDOWSPLITTING // splitting frames & windows
//All OSes
#define BABL_WINDOWS
#define BABL_READMUX
#define BABL_VI
#define BABL_MAC
#define BABL_LINUX
#define BABL_EMACS
#define BABL_CHROMEOS
@@ -0,0 +1,41 @@
#pragma once
// Expect to get errors if you comment a feature out and leave it in your keymap.
#define USE_BABLPASTE
#ifdef USE_BABLPASTE
#ifdef RGBLIGHT_ENABLE
#define BABL_LED_INDEX 0 // set to 0 to set all LEDs , or set to # of LED to be used as BABL updaters
#define RGBLIGHT_COLOR_MS 0x00,0x27,0x88 // blue screen?
#define RGBLIGHT_COLOR_MAC 0xF0,0xF0,0xF0 // grey
#define RGBLIGHT_COLOR_LINUX 0xF4,0xAA,0x90 // ubuntu orange?
#define RGBLIGHT_COLOR_EMACS 0x00,0x00,0x00
#define RGBLIGHT_COLOR_VI 0x00,0x90,0x00
#define RGBLIGHT_COLOR_READMUX 0x33,0xFF,0x33 // green screen
#define RGBLIGHT_COLOR_CHROMEOS 0xf4,0xc2,0xd // google yellows
#endif
#endif // bablpaste
// place overrides here
#define RGBLED_NUM 2
#define RGBLIGHT_LIMIT_VAL 200
#ifdef RGBLIGHT_ENABLE
#define RGBLIGHT_COLOR_LAYER_0 0x00, 0xFF, 0x00 // qwerty
#define RGBLIGHT_COLOR_LAYER_1 0x00, 0x99, 0x99 // cdh
#define RGBLIGHT_COLOR_LAYER_2 0xFF, 0x00, 0x00 // symbol
#define RGBLIGHT_COLOR_LAYER_3 0x00, 0xFF, 0xFF // move
#define RGBLIGHT_COLOR_LAYER_4 0xFF, 0x00, 0xFF // delmove
#define RGBLIGHT_COLOR_LAYER_5 0x00, 0xFF, 0xFF
#define RGBLIGHT_ANIMATIONS
#define RGB_LIGHT_EFFECT_BREATHE_MAX 200
#define RGBLIGHT_RAINBOW_SWIRL_RANGE 127
#endif // rgblight
#define TAPPING_TERM 200
#define TAPPING_TERM_PER_KEY
#define RETRO_TAPPING
//#define PERMISSIVE_HOLD
@@ -0,0 +1,463 @@
//placeholder until the new keymaps tree is built
//#include QMK_KEYBOARD_H
#include "virtser.h"
#include <print.h>
#include "milestogo.h"
#define LAYOUT_local LAYOUT_mobile_XUW
#define LAYOUT LAYOUT_mobile_XUW
#ifndef USERSPACE_ACTIVE
enum layer_keycodes {
QWR = SAFE_RANGE,
CDH,
SYM,
MOV,
NUM,
TRAN
};
enum layer_names {
_QWR,
_CDH,
_SYM,
_MOV,
_TRAN
};
#endif
// Shorter spacing
#define XXXX KC_NO
#define ____ KC_TRNS
// Custom macros
/* Fn Keys */
#define TT_SYM MO(_SYM)
#define TT_NUM MO(_NUM)
#define SSFT ACTION_MODS_ONESHOT(MOD_LSFT)
#define SSYM LT(_SYM, KC_SPC)
#define MVTAB LT(_MOV,KC_TAB)
#define BKMV TT(_MOV)
#define MV2 LT(_MOV, KC_2)
#define MV3 LT(_MOV, KC_3)
#define MV4 LT(_MOV, KC_4)
#define MV8 LT(_MOV, KC_8)
#define MV9 LT(_MOV, KC_9)
#define MV0 LT(_MOV, KC_0)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* QWERTY
*
* |ESC | F1 | F2 | F3 | F4 | F5 | F6 | f7 | F8 | F9 | F10| F11| F12|Vol-|Vol+|_CDH|
* -------------------------------------------------------------------------------'
* | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Bakspace| Del|
* ---------------------------------------------------------------------------
* | tab | q | w | e | r | t | y | u | i | o | p | [ | ] | \ | |
* -------------------------------------------------------------------------------'
* |Bak/Mov| a | s | d | f | g | h | j | k | l | ; | ' | enter |PgUp|
* --------------------------------------------------------------------------------
* |Lsft | z | x | c | v | b | n | m | , | . | / | Rsft| Up| PgDn|
* ---------------------------------------------------------------------------------
* |Lctl |Lgui |Lalt | Space/Sym | GUI | Sym | Rctl |Left|Down|Rght|
* ---------------------------------------------------------------------------------
*/
[_QWERTY] = LAYOUT_local( \
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_VOLD, KC_VOLU, TG(_CDH),\
KC_GRAVE, KC_1, KC_2, KC_3 ,KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL,\
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,\
BKMV, 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_PGUP,\
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT,KC_SLSH,KC_RSFT, KC_UP, KC_PGDN,\
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RGUI, TT_SYM,KC_CDH, KC_LEFT, KC_DOWN, KC_RIGHT
),
[_CDH] = LAYOUT_local(\
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \
KC_GRAVE, KC_1, KC_2, KC_3 ,KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINUS, KC_EQL, KC_BSPC, KC_DEL,\
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, ____, ____, ____,\
KC_LCTL, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT, KC_2,\
KC_LSFT, KC_Z, KC_X, KC_C, DHPASTE,KC_V, KC_K, KC_H, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, ____, KC_1,\
TG(_MOV), ____, ____ , ____, ____, ____, KC_QWERTY, ____, ____, ____
),
/* SYMBOL layer, several to chose from
*/
[_SYM] = LAYOUT_wrapper(\
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \
____, _________________EXCEL_L1__________________, _________________EXCEL_R1__________________, ____, ____, ____,\
____, _________________EXCEL_L2__________________, _________________EXCEL_R2__________________, KC_GRV, ____, ____,\
____, _________________EXCEL_L3__________________, _________________EXCEL_R3__________________, B_SAVE, ____, ____,\
____, ____, ____, ____, ____, ____, ____, ____, ____, ____
),
#ifndef USE_BABLPASTE
[_MOV] = LAYOUT_local(\
____, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, ____ , \
____, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, \
____, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, KC_UP, XXXX, XXXX, XXXX, XXXX, XXXX, \
____, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, KC_LEFT, KC_DOWN, KC_RIGHT,XXXX, XXXX, XXXX, XXXX, \
____, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, \
____, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX
)
#else
/* MOVE babble version version
* |ESC | MAC|Read|Linx| VI | | | | | | | | | | | |
* -------------------------------------------------------------------------------'
* | | | - | = |Bakspace| Del|
* ---------------------------------------------------------------------------
* | tab | | [ | ] | \ | |
* -------------------------------------------------------------------------------'
* |Bak/Mov| | ' |Launch App |PgUp|
* ---------------------------------------------------------------------------------
* |Lsft | | Rsft| Up| PgDn|
* ---------------------------------------------------------------------------------
* | |Lgui |Lalt | Exit Move Mode | GUI | Sym | Rctl |Left|Down|Rght|
* ---------------------------------------------------------------------------------
*/
/* ,--------------------------------------------. ,--------------------------------------------.
* 01 | ESC |FindPrev| Find |FindNext| \n cell| |ParStart|LineStrt| Up | EOL | ParEnd |
* |--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------|
* 02 | SelA | Do_DEL | Shift | Undo |Hsplit+ | | WrdLft | Left | Down | Right | WrdRght|
* |--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------|
* 03 |Vspli+ | Cut | Copy | Paste | Paste | | WinPrv | Tab-- | NewTab | Tab++ | WinNxt |
* `--------------------------------------------' `--------------------------------------------'
*/
[_MOV] = LAYOUT_wrapper(\
____, ____________BABBLE_SWITCH_L________________, ____________BABBLE_SWITCH_R________________, XXXX, XXXX, XXXX, XXXX, ____, \
____, ____________BABBLE_MOV_LNUM________________, ____________BABBLE_MOV_RNUM________________, XXXX, XXXX, XXXX, XXXX,\
____, ____________BABBLE_MOV_L1__________________, ____________BABBLE_MOV_R1__________________, XXXX, XXXX, XXXX, \
____, ____________BABBLE_MOV_L2__________________, ____________BABBLE_MOV_R2__________________, XXXX, B_RUNAPP, XXXX,\
____, ____________BABBLE_MOV_L3__________________, ____________BABBLE_MOV_R2__________________, XXXX, XXXX, XXXX, \
____, ____, ____, TG(_MOV), XXXX, XXXX, XXXX, XXXX, XXXX, XXXX
),
// Move in a direction, deleting as we go, or do opposite of Mov layer action */
/* ,--------------------------------------------. ,--------------------------------------------.
* 01 | Esc | |Replace |MultiSel|PasteVal| | . |LineStrt| . | EOL | . |
* |--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------|
* 02 | | Do_Mov | Shift | Redo |Hsplit- | | WrdLft | Left | . | Right | WrdRght|
* |--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------|
* 03 |Vsplit- | Cut | Copy | Paste |Paste | | App-- | ZoomOut| NewWin | ZoomIn | App+ |
* `--------------------------------------------' `--------------------------------------------'
*/
[_DMOV] = LAYOUT_wrapper(\
____, ____________BABBLE_SWITCH_L________________, ____________BABBLE_SWITCH_R________________, XXXX, XXXX, XXXX, ____, \
____, ____________BABBLE_MOV_LNUM________________, ____________BABBLE_MOV_RNUM________________, XXXX, XXXX, XXXX, XXXX, \
____, _________BABBLE_DELMOV_L1__________________ , _________BABBLE_DELMOV_R1__________________ , XXXX, XXXX, XXXX, \
____, _________BABBLE_DELMOV_L2__________________ , _________BABBLE_DELMOV_R2__________________ , XXXX, XXXX, XXXX,\
____, _________BABBLE_DELMOV_L3__________________ , _________BABBLE_DELMOV_R3__________________ , XXXX, XXXX, XXXX, \
____, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX, XXXX
),
#endif // Bablepaste
/*
[_TRAN] = LAYOUT_local(\
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \
____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, ____, \
____, ____, ____, ____, ____, ____, ____, ____, ____, ____
)
*/
};
#ifndef USERSPACE_ACTIVE
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWR:
if (record->event.pressed) {
layer_off(_CDH);
}
return false;
break;
case CDH:
if (record->event.pressed) {
layer_on(_CDH);
}
return false;
break;
case SYM:
if (record->event.pressed) {
layer_on(_SYM);
} else {
layer_off(_SYM);
}
return false;
break;
case SAVE:
if (record->event.pressed) {
SEND_STRING(SS_LCTL("s"));
}
return false;
break;
/* Colemak mod-dh moves the D key to the qwerty V position
This hack makes apple-V_position do what I mean */
case DHPASTE:
if(get_mods() & MOD_BIT(KC_LGUI) ) {
if (record->event.pressed) {
clear_keyboard_but_mods();
register_code(KC_V);
} else {
unregister_code(KC_V);
}
} else {
if (record->event.pressed) {
register_code(KC_D);
} else {
unregister_code(KC_D);
}
}
return false;
break;
return false;
break;
}
return true;
}
#endif
void keyboard_post_init_user(void) {
// Customise these values to desired behaviour
// debug_enable=true;
//debug_matrix=true;
//debug_keyboard=true;
//debug_mouse=true;
}
void matrix_init_user(void) {
#ifdef RGBLIGHT_ENABLE
#ifdef RGB_DI_PIN
rgblight_setrgb(RGB_GREEN);
#endif
#endif //RGB_matrix
}
// Runs whenever there is a layer state change.
layer_state_t layer_state_set_user(layer_state_t state) {
uint8_t layer = get_highest_layer(state);
switch (layer) {
case 0:
#ifdef RGBLIGHT_COLOR_LAYER_0
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0);
#else
#ifdef RGBLIGHT_ENABLE
rgblight_init();
#endif
#endif
break;
case 1:
#ifdef RGBLIGHT_COLOR_LAYER_1
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_1);
#endif
break;
case 2: // symbol
#ifdef RGBLIGHT_COLOR_LAYER_2
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_2);
#endif
break;
case 3: // move
#ifdef RGBLIGHT_COLOR_LAYER_3
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_3);
#endif
#ifdef USE_BABLPASTE
babble_led_user(); // poke led to update
#endif // bablepaste
break;
case 4: //delmove ideally we'd turn on a red pixel in addition to the layer indicator.
#ifdef RGBLIGHT_COLOR_LAYER_4
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_4);
#endif
break;
case 5:
#ifdef RGBLIGHT_COLOR_LAYER_5
rgblight_setrgb(RGBLIGHT_COLOR_LAYER_5);
#endif
break;
default:
break;
}
#ifdef VIRTSER_ENABLE
//virtser_send(layer + 48); // ascii 0 is 48
#endif
return state;
};
// custom tapping term lengths.
uint16_t get_tapping_term(uint16_t keycode) {
switch (keycode) {
case LT(_MOV, KC_TAB):
return TAPPING_TERM ;
break;
default:
return TAPPING_TERM;
}
}
#ifdef VIRTSER_ENABLE
/* listen on serial for commands. Either a set of lower case letters mapped to colors,
/ or upper case letters that change RGB mode.
/ special command C takes 3 numbers as arguments, terminated with a newline or comma or excess digits.
Command C takes 3-5octets of RGB settings. Numbers can be terminated with a comma or period.
3 octets = set all LED, 4th argument specfies specfic LED, 4+5 specify start and stop LEDs.
*/
uint8_t ser_rgbByte[18] ; //ascii string
uint8_t ser_cmd_started =0 ; // are we in process
uint8_t ser_got_RGBbytes =0 ; // how many bytes we've recived.
uint8_t rgb_r[6]; // R, g, b, P1, p2
uint8_t bs=0; // how many bytes into our rgbBytestring.
void virtser_recv(uint8_t serIn) {
#ifdef RGBLIGHT_ENABLE
if ((serIn == 10 ) || (serIn == 13) || ser_got_RGBbytes >=5) { //reached newline or max digits
if (ser_cmd_started) {
ser_cmd_started =0 ; // end loop at newline
virtser_send('|');
if (ser_got_RGBbytes==3) {
rgblight_setrgb( rgb_r[0], rgb_r[1], rgb_r[2]);
}
if (ser_got_RGBbytes ==4) {
if (( rgb_r[3] >=0) && (rgb_r[3] <= RGBLED_NUM) ) { // is pos1 plausible
rgblight_setrgb_at ( rgb_r[0], rgb_r[1], rgb_r[2], rgb_r[3]);
} else {
rgblight_setrgb( rgb_r[0], rgb_r[1], rgb_r[2]);
}
}
if (ser_got_RGBbytes == 5) { // are start and end positions plausible?
if ( (rgb_r[4] >0) && (rgb_r[4] <= RGBLED_NUM) && (rgb_r[4] > rgb_r[3]) &&
(rgb_r[3] >=0) && (rgb_r[3] <= (RGBLED_NUM -1)) ) {
rgblight_setrgb_range(rgb_r[0], rgb_r[1], rgb_r[2], rgb_r[3], rgb_r[4]);
} else {
rgblight_setrgb( rgb_r[0], rgb_r[1], rgb_r[2]);
}
}
} else { // newline outside of command loop, or something that can be ignored.
//virtser_send('.');
}
}
if (1 == ser_cmd_started) { // collecting bytes.
if ( // it is time to compute a byte
( ( (serIn == ',') || (serIn == '.') ) && (bs > 0) ) || // signal done with the byte.
(bs ==2 )){ //or we know this is last.
if ( (serIn <= '9') && (serIn >='0') ) { //3rd asci digit
ser_rgbByte[bs] = serIn;
bs++;
// virtser_send(serIn);
}
if (bs>3) {
rgb_r[ser_got_RGBbytes]=255;
ser_got_RGBbytes ++;
}
if (bs==3) {
rgb_r[ser_got_RGBbytes] = (ser_rgbByte[0] -'0')*100 + (ser_rgbByte[1] -'0')*10 + (ser_rgbByte[2] -'0' );
ser_got_RGBbytes ++;
}
if (bs ==2 ) {
rgb_r[ser_got_RGBbytes] = (ser_rgbByte[0] -'0')*10 + (ser_rgbByte[1] -'0' );
ser_got_RGBbytes ++;
}
if (bs ==1) {
rgb_r[ser_got_RGBbytes] = (ser_rgbByte[0] -'0');
ser_got_RGBbytes ++;
} // {else wipe & start over}
bs=0;
// virtser_send(ser_got_RGBbytes+'0');
} else { // haven't got enough for our byte / no terminal marker
if ( (serIn <= '9') && (serIn >='0') ) { //ascii only
ser_rgbByte[bs] = serIn;
bs++;
// virtser_send(serIn);
}
}
} else { //not in command loop - next is command w/o arguments, or start of one.
switch (serIn) {
case 'C': // color switch
ser_cmd_started=1;
ser_got_RGBbytes = bs =0;
virtser_send('/');
break;
case 'r': //red
rgblight_setrgb(RGB_RED);
break;
case 'g':
rgblight_setrgb(RGB_GREEN);
break;
case 'b': // color switch
rgblight_setrgb(RGB_BLUE);
break;
case 'w': // color switch
rgblight_setrgb(RGB_WHITE);
break;
case 'o': // color black/off
rgblight_setrgb(0,0,0);
break;
case 'T': // toggle
rgblight_toggle();
break;
case 'P': // pulse led
rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING);
break;
case 'S': // Static
rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT);
break;
case 'U': // Rainbow
rgblight_mode_noeeprom(RGBLIGHT_MODE_RAINBOW_MOOD);
break;
default:
// virtser_send(serIn);
break;
}
}
#endif // RGBLIGHT_ENABLE
}
#endif // VirtSerial
@@ -0,0 +1,10 @@
# keymap taking advantage of the STM32 storage & CPU.
RGB LED is used to show layers
default bluepill LED is capslock.
there's a simple serial protocol for the keyboard to listen for color change commands from the PC.
Useful for "do stuff && cat "green">/dev/ttyACM0"
lower case letters set pre-programmed colors
Upper case letters change RGB mode
Command C takes 3-5 octets of RGB settings. Numbers can be terminated with a comma or period.
3 octets = set all LED, 4th argument specfies specfic LED, 4+5 specify start and stop LEDs.
@@ -0,0 +1,24 @@
# 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
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = no # Nkey Rollover
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
ifeq ($(strip $(KEYBOARD)), handwired/ms_sculpt_mobile/8x18_arm)
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight.
endif
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
#enable RAW in keymap config, since it can hang machines
RAW_ENABLE = no
# virtual serial port
VIRTSER_ENABLE = yes
+142
View File
@@ -0,0 +1,142 @@
// based on drashna's but I think at this point it's a new axe
#include QMK_KEYBOARD_H
#include "milestogo.h"
#include <print.h>
__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
bool move_is_on = false; // track if we are in _MOV layer
bool sym_is_on = false; // track if we are in _SYM layer
// Defines actions for global custom keycodes
// Then runs the _keymap's record handier if not processed here
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// static uint16_t spcmov_timer; // timer for spcmov key
#ifdef USE_BABBLEPASTE
if (keycode > BABBLE_START && keycode < BABBLE_END_RANGE) {
if (record->event.pressed) { // is there a case where this isn't desired?
babblePaste(keycode);
} else {
return true;
}
}
#endif
switch (keycode) {
case _QWERTY:
if (record->event.pressed) {
set_single_persistent_default_layer(_QWERTY);
}
break;
case _CDH:
if (record->event.pressed) {
set_single_persistent_default_layer(_CDH);
}
break;
case TMUX: // ctl-B
if (record->event.pressed) {
tap_code16(C(KC_B));
}
break;
/* Colemak mod-dh moves the D key to the qwerty V position
This hack makes apple-V_position do what I mean */
case DHPASTE:
if (get_mods() & MOD_BIT(KC_LGUI)) {
if (record->event.pressed) {
clear_keyboard_but_mods();
register_code(KC_V);
} else {
unregister_code(KC_V);
}
} else {
if (record->event.pressed) {
register_code(KC_D);
} else {
unregister_code(KC_D);
}
}
return false;
break;
default:
return true;
}
// normal keycode
return process_record_keymap(keycode, record);
}
void babble_led_user(void) {
#ifdef USE_BABLPASTE
extern uint8_t babble_mode;
# ifdef BABL_WINDOWS
if (babble_mode == BABL_WINDOWS_MODE) {
if (BABL_LED_INDEX > 0) {
rgblight_setrgb_at(RGBLIGHT_COLOR_MS, BABL_LED_INDEX);
} else {
rgblight_setrgb(RGBLIGHT_COLOR_MS);
}
}
# endif
# ifdef BABL_READMUX
if (babble_mode == BABL_READMUX_MODE) {
if (BABL_LED_INDEX > 0) {
rgblight_setrgb_at(RGBLIGHT_COLOR_READMUX, BABL_LED_INDEX);
} else {
rgblight_setrgb(RGBLIGHT_COLOR_READMUX);
}
}
# endif
# ifdef BABL_MAC
if (babble_mode == BABL_MAC_MODE) {
if (BABL_LED_INDEX > 0) {
rgblight_setrgb_at(RGBLIGHT_COLOR_MAC, BABL_LED_INDEX);
} else {
rgblight_setrgb(RGBLIGHT_COLOR_MAC);
}
}
# endif
# ifdef BABL_VI
if (babble_mode == BABL_VI_MODE) {
if (BABL_LED_INDEX > 0) {
rgblight_setrgb_at(RGBLIGHT_COLOR_VI, BABL_LED_INDEX);
} else {
rgblight_setrgb(RGBLIGHT_COLOR_VI);
}
}
# endif
# ifdef BABL_EMACS
if (babble_mode == BABL_EMACS_MODE) {
if (BABL_LED_INDEX > 0) {
rgblight_setrgb_at(RGBLIGHT_COLOR_EMACS, BABL_LED_INDEX);
} else {
rgblight_setrgb(RGBLIGHT_COLOR_EMACS);
}
}
# endif
# ifdef BABL_CHROMEOS
if (babble_mode == BABL_CHROMEOS_MODE) {
if (BABL_LED_INDEX > 0) {
rgblight_setrgb_at(RGBLIGHT_COLOR_CHROMEOS, BABL_LED_INDEX);
} else {
rgblight_setrgb(RGBLIGHT_COLOR_CHROMEOS);
}
}
# endif
# ifdef BABL_LINUX
if (babble_mode == BABL_LINUX_MODE) {
if (BABL_LED_INDEX > 0) {
rgblight_setrgb_at(RGBLIGHT_COLOR_LINUX, BABL_LED_INDEX);
} else {
rgblight_setrgb(RGBLIGHT_COLOR_LINUX);
}
}
# endif
#endif // bablepaste
}
+289
View File
@@ -0,0 +1,289 @@
/* Modified from
Copyright 2017 Christopher Courtney <[email protected]> @drashna
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
#include "version.h"
#include "eeprom.h"
#ifdef USE_BABBLEPASTE
#include "babblePaste.h"
#endif
#ifdef RGB_MATRIX_ENABLE
#include "rgb_matrix.h"
#endif
#define USERSPACE_ACTIVE
/* Define layer names */
enum userspace_layers {
_QWERTY=0,
_CDH,
_SYM,
_MOV,
_DMOV,
_NUM
};
/*
define modifiers here, since MOD_* doesn't seem to work for these
*/
#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
#define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL))
#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
#define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))
#if defined(BABBLE_END_RANGE)
#define USER_START BABBLE_END_RANGE
#else
#if defined(KEYMAP_SAFE_RANGE)
#define USER_START KEYMAP_SAFE_RANGE
#else
#define USER_START SAFE_RANGE
#endif
#endif
enum userspace_custom_keycodes {
EPRM = BABBLE_END_RANGE, // Resets EEPROM do defaults (as in eeconfig_init)
VRSN, // Prints QMK Firmware and board info
KC_QWERTY, // Sets default layer to QWERTY
KC_CDH, // Sets default layer to COLEMAK DH
KC_MAKE,
VIBRK, // escape :
DHPASTE, // allow pasting via qwerty V,not colemak V
TMUX, // TMUX Ctrl-b
ALTSYM, // Alt when held, toggle MOV when tapped
GUISYM,
SPCMOV,
SAVE, // placeholder for CTRL-S while I get babble working again.
NEW_SAFE_RANGE //Keymap specific codes come AFTER this
};
#define QWERTY KC_QWERTY
#define COLEMAK KC_CDH
#define KC_RESET RESET
#if (!defined(LAYOUT) && defined(KEYMAP))
#define LAYOUT KEYMAP
#endif
#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__)
#define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T
#define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G
#define _________________QWERTY_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_B
#define _________________QWERTY_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P
#define _________________QWERTY_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN
#define _________________QWERTY_R3_________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLASH
#define ______________COLEMAK_MOD_DH_L1____________ KC_Q, KC_W, KC_F, KC_P, KC_B
#define ______________COLEMAK_MOD_DH_L2____________ KC_A, KC_R, KC_S, KC_T, KC_G
#define ______________COLEMAK_MOD_DH_L3____________ KC_Z, KC_X, KC_C, KC_D, KC_V
#define ______________COLEMAK_MOD_DH_R1____________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN
#define ______________COLEMAK_MOD_DH_R2____________ KC_M, KC_N, KC_E, KC_I, KC_O
#define ______________COLEMAK_MOD_DH_R3____________ KC_K, KC_H, KC_COMM, KC_DOT, KC_SLASH
#define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5
#define ________________NUMBER_RIGHT_______________ KC_6, KC_7, KC_8, KC_9, KC_0
#define ________________FKEYS__LEFT________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5
#define ________________FKEYS__RIGHT_______________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10
#define ________________FKEYS__FAR_RIGHT___________ KC_F11, KC_F12, KC_PSCR, KC_HOME, KC_END
#define ________________NAV_NUMBER_LEFT____________ KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, XXXXXXX
#define ___________________BLANK___________________ _______, _______, _______, _______, _______
#define ___________________BLOCK___________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
// BabblePaste
#define ____________BABBLE_SWITCH_L________________ B_MAC , B_READ , B_LINUX, B_VI, _______
#define ____________BABBLE_SWITCH_R________________ B_CROM, B_LINUX, B_WIN , QWERTY, COLEMAK
/////////MOVE - Full size keyboard version
/* ,--------------------------------------------. ,--------------------------------------------.
* N |Lock |PrevApp |NextApp |PasteVal| | | | |SwitchKB|Devtools| Lock |
* |--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------|
* 01 | ESC |FindPrev| Find |FindNext| \n cell| |ParStart|LineStrt| Up | EOL | ParEnd |
* |--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------|
* 02 | SelA | Do_DEL | Shift | Undo |Hsplit+ | | WrdLft | Left | Down | Right | WrdRght|
* |--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------|
* 03 |Vspli+ | Cut | Copy | Paste | Paste | | WinPrv | Tab-- | NewTab | Tab++ | WinNxt |
* `--------------------------------------------' `--------------------------------------------'
*/
/* Movement layer similar to Extend, but fully enriched with babblepaste */
#define ____________BABBLE_MOV_LNUM________________ B_LOCK, B_PAPP, B_NAPP, B_PASTV, XXXX
#define ____________BABBLE_MOV_L1__________________ KC_ESC, B_FINDP, B_FIND, B_FINDN, B_NCEL
#define ____________BABBLE_MOV_L2__________________ B_SELA , MO(_DMOV),KC_LSFT,B_UNDO, B_HSPLIT
#define ____________BABBLE_MOV_L3__________________ B_VSPLIT, B_CUT, B_COPY, B_PASTE, B_PASTE
#define ____________BABBLE_MOV_RNUM________________ XXXX, XXXX, B_KEYB, B_BDEV, B_LOCK
#define ____________BABBLE_MOV_R1__________________ B_PTOP, B_GSOL, B_UP, B_GEOL, B_PEND
#define ____________BABBLE_MOV_R2__________________ B_L1W, B_L1C, B_DOWN, B_R1C, B_R1W
#define ____________BABBLE_MOV_R3__________________ B_PWIN, B_PTAB, B_NTAB, B_NXTB, B_NWIN
// Move in a direction, deleting as we go, or do opposite of Mov layer action */
/* ,--------------------------------------------. ,--------------------------------------------.
* 01 | Esc | |Replace |MultiSel|PasteVal| | . |LineStrt| . | EOL | . |
* |--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------|
* 02 | | Do_Mov | Shift | Redo |Hsplit- | | WrdLft | Left | . | Right | WrdRght|
* |--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------|
* 03 |Vsplit- | Cut | Copy | Paste |Paste | | App-- | ZoomOut| NewWin | ZoomIn | App+ |
* `--------------------------------------------' `--------------------------------------------'
*/
#define _________BABBLE_DELMOV_L1__________________ KC_ESC, _______, B_RPLACE, B_MSEL, B_PASTV
#define _________BABBLE_DELMOV_L2__________________ XXXXXXX, _______, _______, B_REDO, B_HUNSPT
#define _________BABBLE_DELMOV_L3__________________ B_VUNSPT,B_CUT, B_COPY, B_PASTE, B_PRVFM
#define _________BABBLE_DELMOV_R1__________________ XXXXXXX, B_DSOL, _______, B_DEOL, XXXXXXX
#define _________BABBLE_DELMOV_R2__________________ B_DLW, KC_BSPC, _______, B_DEL, B_DRW
#define _________BABBLE_DELMOV_R3__________________ B_NAPP, B_ZOUT, B_WINN, B_ZIN, B_PAPP
/* SYM / excel / programming logic +=1 optimization*/
/* ,----------------------------------. ,----------------------------------.
* 01 | | [ | ] | { | | | | } | ( | ) | |
* |------+------+------+------+------| |------+------+------+------+------|
* 02 | ^ | ! | = | 0 | $ | | # | 1 | - | + | ` |
* |------+------+------+------+------| |------+------+------+------+------|
* 03 | \ | % | @ | | | _ | | * | & | ~ | . | / |
* `----------------------------------' `----------------------------------'
Memnonics
^begining end$ . &&/|| on strong finger. #at start of line.
* (multiply) opposite /
Minus is left of plus as normal.
` is a shifted ''
~/ is an outwards roll. / .* is a roll. !=0 is a roll , ++1 --1 roll.
_ is hard to get to.
*/
#define ___________________SYM_L1__________________ XXXXXXX, KC_LBRC, KC_RBRC, KC_LCBR, XXXXXXX
#define ___________________SYM_L2__________________ KC_CIRC, KC_EXLM, KC_EQL, KC_0, KC_DLR
#define ___________________SYM_L3__________________ KC_BSLS, KC_PERC, KC_AT, KC_PIPE, KC_UNDS
#define ___________________SYM_R1__________________ XXXXXXX, KC_RCBR, KC_LPRN, KC_RPRN, XXXXXXX
#define ___________________SYM_R2__________________ KC_HASH, KC_KP_1, KC_MINS, KC_PLUS, KC_GRAVE
#define ___________________SYM_R3__________________ KC_PERC, KC_TILDE,KC_AMPR, KC_DOT, KC_SLASH
/* excel centric symbol layer*/
/* ,--------------------------------------------. ,--------------------------------------------.
* 01 | DelRow|InsCol | SelCol |PasteVal| | | . | 1 | 2 | 3 | |
* |--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------|
* 02 | - |InsRow | SelRow | Undo | + | | * | 4 | 5 | 6 | - |
* |--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------|
* 03 | Undo | Cut | Copy | Paste |Paste | | / | 7 | 8 | 9 | Paste |
* `--------------------------------------------' `--------------------------------------------'
*/
#define _________________EXCEL_L1__________________ B_DROW, B_ICOL, B_SELC, B_PASTV, XXXX
#define _________________EXCEL_L2__________________ KC_MINS, B_ICOL, B_SELC, B_UNDO, KC_PLUS
#define _________________EXCEL_L3__________________ B_UNDO, B_CUT, B_COPY, B_PASTE, B_PASTE
#define _________________EXCEL_R1__________________ XXXXXXX, KC_1, KC_2, KC_3, XXXXXXX
#define _________________EXCEL_R2__________________ KC_ASTR, KC_4, KC_5, KC_6, KC_MINS
#define _________________EXCEL_R3__________________ KC_SLASH, KC_7, KC_8, KC_8, B_PASTE
/* Based on BEKL 15 punctuation
* ,----------------------------------. ,----------------------------------.
* 01 | | < | $ | > | | | | [ | _ | ] | |
* |------+------+------+------+------| |------+------+------+------+------|
* 02 | \ | ( | "" | ) | # | | % | { | = | } | "|" |
* |------+------+------+------+------| |------+------+------+------+------|
* 03 | | : | * | + | | | | & | ^ | ~ | |
* `----------------------------------' `----------------------------------'
Memnonics
*/
#define ______________BEKL_SYM_L1__________________ XXXXXXX, KC_LBRC, KC_RBRC, KC_LCBR, XXXXXXX
#define ______________BEKL_SYM_L2__________________ KC_CIRC, KC_EXLM, KC_EQL, KC_0, KC_DLR
#define ______________BEKL_SYM_L3__________________ KC_BSLS, KC_PERC, KC_AT, KC_PIPE, KC_UNDS
#define ______________BEKL_SYM_R1__________________ XXXXXXX, KC_RCBR, KC_LPRN, KC_RPRN, XXXXXXX
#define ______________BEKL_SYM_R2__________________ KC_HASH, KC_KP_1, KC_MINS, KC_PLUS, KC_GRAVE
#define ______________BEKL_SYM_R3__________________ KC_PERC, KC_TILDE,KC_AMPR, KC_DOT, KC_SLASH
// NUM
/* ,----------------------------------. ,----------------------------------.
* 01 | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 |
* |------+------+------+------+------| |------+------+------+------+------|
* 02 | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 |
* |------+------+------+------+------| |------+------+------+------+------|
* 03 | F11 | F12 | | | QWERT| | CDH | | | | |
* `----------------------------------' `----------------------------------'
*/
#define ___________________NUM_L1__________________ ________________NUMBER_LEFT________________
#define ___________________NUM_L2__________________ ________________FKEYS__LEFT________________
#define ___________________NUM_L3__________________ KC_F11, KC_F11, XXXXXXX, XXXXXXX, QWERTY
#define ___________________NUM_R1__________________ ________________NUMBER_RIGHT_______________
#define ___________________NUM_R2__________________ ________________FKEYS__RIGHT_______________
#define ___________________NUM_R3__________________ COLEMAK, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
/* NUM / excel / programming logic +=1 optimization*/
/* ,----------------------------------. ,----------------------------------.
* 01 | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 |
* |------+------+------+------+------| |------+------+------+------+------|
* 02 | ^ | ! | = | 0 | $ | | # | 1 | - | + | ` |
* |------+------+------+------+------| |------+------+------+------+------|
* 03 | \ | % | @ | | | _ | | * | & | ~ | . | / |
* `----------------------------------' `----------------------------------'
Memnonics
^begining end$ . &&/|| on strong finger. #at start of line. * missing?
Minus is left of plus as normal. ` is a shifted ''
~/ is an outwards roll. / * is a roll.
_ is hard to get to.
*/
#define __________40_______NUM_L1__________________ ________________NUMBER_LEFT________________
#define __________40_______NUM_L2__________________ KC_CIRC, KC_EXLM, KC_EQL, KC_0, KC_DLR
#define __________40_______NUM_L3__________________ KC_BSLS, KC_PERC, KC_AT, KC_PIPE, KC_UNDS
#define __________40_______NUM_R1__________________ ________________NUMBER_RIGHT_______________
#define __________40_______NUM_R2__________________ KC_HASH, KC_KP_1, KC_MINS, KC_PLUS, KC_GRAVE
#define __________40_______NUM_R3__________________ KC_PERC, KC_TILDE, KC_AMPR,KC_DOT, KC_SLASH
#define _________________ADJUST_L1_________________ RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG
#define _________________ADJUST_L2_________________ MU_TOG , CK_TOGG, AU_ON, AU_OFF, AG_NORM
#define _________________ADJUST_L3_________________ RGB_RMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T
#define _________________ADJUST_R1_________________ KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5
#define _________________ADJUST_R2_________________ AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN
#define _________________ADJUST_R3_________________ MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT
+10
View File
@@ -0,0 +1,10 @@
# Overview
This is my personal userspace file. Most of my code exists here, as it's heavily shared.
## Custom Keycodes
See the babblepaste.txt readme
## Layer Indication
This uses the `layer_state_set_*` command to change the layer color, to indicate which layer it is on. This includes the default keymap, as well.
+10
View File
@@ -0,0 +1,10 @@
SRC += milestogo.c babblePaste.c babl_windows.c babl_mac.c babl_vi.c babl_readmux.c babl_chromeos.c babl_emacs.c babl_linux.c
LTO_ENABLE = yes
ifeq ($(strip $(MACROS_ENABLED)), yes)
OPT_DEFS += -DMACROS_ENABLED
endif
ifeq ($(strip $(USE_BABBLEPASTE)), yes)
SRC += babblePaste.c
endif