diff options
author | Anne Demey <anneyvdemey@gmail.com> | 2020-10-23 17:14:17 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-23 15:14:17 -0700 |
commit | d689f76110ee20e45d6531eac31bf72461ed504b (patch) | |
tree | abcf9cd25057cff9d5532b9ae2c41dad1514c015 /keyboards/terrazzo | |
parent | 5d2deaca069834843bacb5769787c907bdd6bf15 (diff) | |
download | qmk_firmware-d689f76110ee20e45d6531eac31bf72461ed504b.tar.gz qmk_firmware-d689f76110ee20e45d6531eac31bf72461ed504b.zip |
[Keyboard] Add Terrazzo Keyboard (#10408)
* Ciao Terrazzo!
* Keymap updates
* Adding info json
Cleaning up keymap files
Readme updates with template
* Coding style updates
* Removing vscode files
* PR feedback updates
* biton32 -> get_highest_layer update
Adding license headers
Diffstat (limited to 'keyboards/terrazzo')
-rw-r--r-- | keyboards/terrazzo/README.md | 125 | ||||
-rw-r--r-- | keyboards/terrazzo/config.h | 104 | ||||
-rw-r--r-- | keyboards/terrazzo/info.json | 41 | ||||
-rw-r--r-- | keyboards/terrazzo/keymaps/default/keymap.c | 85 | ||||
-rw-r--r-- | keyboards/terrazzo/keymaps/ortho/keymap.c | 84 | ||||
-rw-r--r-- | keyboards/terrazzo/keymaps/ortho_all/keymap.c | 84 | ||||
-rw-r--r-- | keyboards/terrazzo/keymaps/ortho_mit/keymap.c | 82 | ||||
-rw-r--r-- | keyboards/terrazzo/rules.mk | 33 | ||||
-rw-r--r-- | keyboards/terrazzo/terrazzo.c | 165 | ||||
-rw-r--r-- | keyboards/terrazzo/terrazzo.h | 122 | ||||
-rw-r--r-- | keyboards/terrazzo/terrazzo_effects/dino.h | 162 | ||||
-rw-r--r-- | keyboards/terrazzo/terrazzo_effects/dot.h | 27 | ||||
-rw-r--r-- | keyboards/terrazzo/terrazzo_effects/heart.h | 99 | ||||
-rw-r--r-- | keyboards/terrazzo/terrazzo_effects/outrun.h | 127 | ||||
-rw-r--r-- | keyboards/terrazzo/terrazzo_effects/pac_dude.h | 67 | ||||
-rw-r--r-- | keyboards/terrazzo/terrazzo_effects/stripes.h | 35 | ||||
-rw-r--r-- | keyboards/terrazzo/terrazzo_effects/terrazzo_effects.inc | 7 | ||||
-rw-r--r-- | keyboards/terrazzo/terrazzo_effects/wpm_chart.h | 111 |
18 files changed, 1560 insertions, 0 deletions
diff --git a/keyboards/terrazzo/README.md b/keyboards/terrazzo/README.md new file mode 100644 index 0000000000..08cecd6a64 --- /dev/null +++ b/keyboards/terrazzo/README.md @@ -0,0 +1,125 @@ +# Terrazzo + +![Terrazzo](https://i.imgur.com/W91ixck.jpg) + +Terrazzo is a 40% pro micro keyboard kit with a fun, hot-swapable LED module. It is offered in both staggered and ortholinear variations, each with multiple layout options. A left hand macro column has 4 positions for switches or rotary encoders. + +Extended layout options and multiple encoder support will require use of an Elite-C controller. Key switch support is MX soldered only. + +* Keyboard Maintainer: MsMustard, [Anne Demey](https://github.com/ademey) +* Hardware Supported: Terrazzo v1 & v2 PCB in staggered and ortholinear + +Make example for this keyboard (after setting up your build environment): + +- `make terrazzo:default` Split spacebar staggered layout +- `make terrazzo:ortho` 2 x 2u spacebar ortho layout +- `make terrazzo:ortho_mit` 2u spacebar ortho layout +- `make terrazzo:ortho_all` All 1u ortho layout + +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). + +## Parts List +- 1 PCB (staggered or ortho) +- 1 LED module ([red](https://www.digikey.com/product-detail/en/adafruit-industries-llc/3134/1528-1699-ND/6058480), [green](https://www.digikey.com/product-detail/en/adafruit-industries-llc/3136/1528-1701-ND/6058482), [yellow](https://www.digikey.com/short/zbttp5), [blue](https://www.digikey.com/product-detail/en/adafruit-industries-llc/3137/1528-1702-ND/6058483), or [white](https://www.digikey.com/product-detail/en/adafruit-industries-llc/3138/1528-1703-ND/6058484)) +- [1 Rotary encoder](https://www.digikey.com/short/zbttzn) +- 1 Knurled knob ([black](https://www.digikey.com/short/zbttz4) or [silver](https://www.digikey.com/short/zbttz4)) +- [SMD diodes](https://www.digikey.com/short/zbttzr) +- [Reset switch](https://www.digikey.com/short/zbttz1) +- Mill-max female headers ([12](https://www.digikey.com/short/zbtt42) & [5](https://www.digikey.com/short/zbttmt) pins) and [through-hole diodes](https://www.digikey.com/short/zbttmj) to aid in socketing a pro micro +- Mill-max [male](https://www.digikey.com/short/zbttm5) & [female](https://www.digikey.com/short/zbttm4) headers for LED module + +## Custom Keycodes + +Terrazzo has several custom keycodes for LED control. + +| Key | Description | +|-----|-------------| +| `TZ_NXT` | Next Animation | +| `TZ_PRV` | Previous Animation | +| `TZ_OFF` | LED Off | + +## LED Animations + +LED animations for Terrazzo are reactive to keyboard input. Each key press or encoder turn increments an internal counter, looping through the number of individual LEDs. + +This counter (`terrazzo_led_index`) is used as a seed for the animation functions, along with a boolean indicating the direction. Turning the encoder counter-clockwise, or pressing backspace will decrement the counter, allowing for animations to reverse or display alternative frames. + +The current animations are: + +- DINO: It's like your internet went out +- DOT: Just a single led at a time, for debugging +- HEART: Love you too +- OUTRUN: Driving into the sunset +- PAC_DUDE: Vintage arcade fun +- STRIPES: Just a nice gradient +- WPM_CHART: 2 digit readout with lights indicating speed, each pixel = 2 wpm + +Not all animations are enabled by default. You can enable or disable animations in the `config.h` file to limit firmware size. + +``` +// #define DISABLE_TERRAZZO_EFFECT_STRIPES +// #define DISABLE_TERRAZZO_EFFECT_DINO +// #define DISABLE_TERRAZZO_EFFECT_OUTRUN +#define DISABLE_TERRAZZO_EFFECT_PAC_DUDE +#define DISABLE_TERRAZZO_EFFECT_HEART +// #define DISABLE_TERRAZZO_EFFECT_WPM_CHART +#define DISABLE_TERRAZZO_EFFECT_DOT +``` + +## Microcontroller Support + +Terrazzo is designed for use with a Pro Micro (or compatible, like Bit-C), or an Elite-C. The extra pinouts of an Elite-C are required for the ortho MIT and ALL layouts and multiple encoders. By default the firmware is set up for an Elite-C. For a Pro Micro some changes to `config.h` are needed. + +Change number of rows from 9 to 8. +``` +#define MATRIX_ROWS 8 +``` + +Change pinouts, Pro Micro does not have the "F0" pin. +``` +#define MATRIX_ROW_PINS { D2, D7, E6, B4, B5, B6, B2, B3 } +``` + +Set encoder to just top or bottom position. +``` +#define ENCODERS_PAD_A { C6 } +#define ENCODERS_PAD_B { D4 } +``` + +## Encoder Setup + +Terrazzo has 4 positions for encoders in the left-hand column. Up to 3 may be used at a time, but this requires the extra pins of an Elite-C. Please refer to `config.h` for examples of pin configurations. + +The default keymaps are setup for one encoder. Encoders can change behavior based on the current layer. Here, on the "NAV" layer, the encoder changes volume instead of scrolling. + +```c +void encoder_update_user(uint8_t index, bool clockwise) { + terrazzo_scroll_pixel(clockwise); + switch(get_highest_layer(layer_state)) { + case _NAV: + // Change volume when on nav layer + clockwise ? tap_code(KC_AUDIO_VOL_UP) : tap_code(KC_AUDIO_VOL_DOWN); + break; + default: + // Default encoder behavior of Page Up and Down + clockwise ? tap_code(KC_PGDN) : tap_code(KC_PGUP); + break; + } +} +``` + +If using multiple encoders, the `index` param can be used to distingish which is providing input. + +```c +void encoder_update_user(uint8_t index, bool clockwise) { + terrazzo_scroll_pixel(clockwise); + switch(index) { + case 0: + clockwise ? tap_code(KC_PGDN) : tap_code(KC_PGUP); + break; + case 1: + clockwise ? tap_code(KC_AUDIO_VOL_UP) : tap_code(KC_AUDIO_VOL_DOWN); + break; + } +} +```
\ No newline at end of file diff --git a/keyboards/terrazzo/config.h b/keyboards/terrazzo/config.h new file mode 100644 index 0000000000..4b1dac7064 --- /dev/null +++ b/keyboards/terrazzo/config.h @@ -0,0 +1,104 @@ +/* Copyright 2020 ademey "MsMustard" + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#pragma once + +#include "config_common.h" + + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x4d4d // MM +#define PRODUCT_ID 0x545a // TZ +#define DEVICE_VER 0x0002 +#define MANUFACTURER MsMustard +#define PRODUCT Terrazzo + +/* key matrix size */ + +// SWAP FOR PRO MICRO +// #define MATRIX_ROWS 8 +#define MATRIX_ROWS 9 +#define MATRIX_COLS 6 + +/* key matrix pins */ + +// SWAP FOR PRO MICRO +// #define MATRIX_ROW_PINS { D2, D7, E6, B4, B5, B6, B2, B3 } +#define MATRIX_ROW_PINS { D2, D7, E6, B4, B5, B6, B2, B3, F0 } +#define MATRIX_COL_PINS { D3, F4, F5, F6, F7, B1 } + +#define UNUSED_PINS +#define DIODE_DIRECTION COL2ROW + +/* ROTARY ENCODERS */ + +/* 4 encoder positions are supported. With multiple +encoder support when using the extra pins of +Elite-C controller. + +Use the following configuration guides for your +encoder layout. */ + +/* PRO MICRO CONFIGURATIONS */ + +/* If using a Pro Micro, only 1 encoder may be used, +and only in the top or bottom position. +Top and bottom encoders share the same net, +so there is only one configuration. */ + +/* TOP or BOTTOM */ +// #define ENCODERS_PAD_A { C6 } +// #define ENCODERS_PAD_B { D4 } + +/* ELITE-C ONLY CONFIGURATIONS */ + +/* TOP 3 + Default configuration */ +#define ENCODERS_PAD_A { C6 , B7, C7 } +#define ENCODERS_PAD_B { D4 , D5, F1 } + +/* BOTTOM 3 */ +// #define ENCODERS_PAD_A { B7, C7, C6 } +// #define ENCODERS_PAD_B { D5, F1, D4 } + +/* BOTTOM 2 */ +// #define ENCODERS_PAD_A { C7, C6 } +// #define ENCODERS_PAD_B { F1, D4 } + + +#define ENCODER_RESOLUTION 2 +#define BACKLIGHT_LEVELS 5 + +#ifdef LED_MATRIX_ENABLE + +#define LED_DRIVER_ADDR_1 0x74 +#define LED_DRIVER_COUNT 1 +#define LED_DRIVER_LED_COUNT 105 +#define LED_MATRIX_ROWS 15 +#define LED_MATRIX_COLS 7 +#define LED_MATRIX_MAXIMUM_BRIGHTNESS 20 +#define LED_DISABLE_WHEN_USB_SUSPENDED true + +#endif + +/* Terrazzo animations */ + +// #define DISABLE_TERRAZZO_EFFECT_STRIPES +// #define DISABLE_TERRAZZO_EFFECT_DINO +// #define DISABLE_TERRAZZO_EFFECT_OUTRUN +#define DISABLE_TERRAZZO_EFFECT_PAC_DUDE +#define DISABLE_TERRAZZO_EFFECT_HEART +// #define DISABLE_TERRAZZO_EFFECT_WPM_CHART +#define DISABLE_TERRAZZO_EFFECT_DOT diff --git a/keyboards/terrazzo/info.json b/keyboards/terrazzo/info.json new file mode 100644 index 0000000000..d41a81c5d2 --- /dev/null +++ b/keyboards/terrazzo/info.json @@ -0,0 +1,41 @@ +{ + "keyboard_name": "Terrazzo", + "url": "", + "maintainer": "MsMustard", + "width": 14.5, + "height": 4, + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"Mute", "x":0, "y":0}, {"label":"Esc", "x":2.5, "y":0}, {"label":"Q", "x":3.5, "y":0}, {"label":"W", "x":4.5, "y":0}, {"label":"E", "x":5.5, "y":0}, {"label":"R", "x":6.5, "y":0}, {"label":"T", "x":7.5, "y":0}, {"label":"Y", "x":8.5, "y":0}, {"label":"U", "x":9.5, "y":0}, {"label":"I", "x":10.5, "y":0}, {"label":"O", "x":11.5, "y":0}, {"label":"P", "x":12.5, "y":0}, {"label":"Back", "x":13.5, "y":0}, + {"label":"TZ Nxt", "x":0, "y":1}, {"label":"Control", "x":2.5, "y":1, "w":1.25}, {"label":"A", "x":3.75, "y":1}, {"label":"S", "x":4.75, "y":1}, {"label":"D", "x":5.75, "y":1}, {"label":"F", "x":6.75, "y":1}, {"label":"G", "x":7.75, "y":1}, {"label":"H", "x":8.75, "y":1}, {"label":"J", "x":9.75, "y":1}, {"label":"K", "x":10.75, "y":1}, {"label":"L", "x":11.75, "y":1}, {"label":"Enter", "x":12.75, "y":1, "w":1.75}, + {"label":"TZ Prv", "x":0, "y":2}, {"label":"Shift", "x":2.5, "y":2, "w":1.75}, {"label":"Z", "x":4.25, "y":2}, {"label":"X", "x":5.25, "y":2}, {"label":"C", "x":6.25, "y":2}, {"label":"V", "x":7.25, "y":2}, {"label":"B", "x":8.25, "y":2}, {"label":"N", "x":9.25, "y":2}, {"label":"M", "x":10.25, "y":2}, {"label":"<", "x":11.25, "y":2}, {"label":">", "x":12.25, "y":2}, {"label":"Shift", "x":13.25, "y":2, "w":1.25}, + {"label":"TZ Off", "x":0, "y":3}, {"label":"Win", "x":3.5, "y":3}, {"label":"Alt", "x":4.5, "y":3, "w":1.5}, {"label":"Space", "x":6, "y":3, "w":2.25}, {"label":"Space", "x":8.25, "y":3, "w":2.75}, {"label":"Fn", "x":11, "y":3, "w":1.5}, {"label":"Fn1", "x":12.5, "y":3} + ] + }, + "LAYOUT_ortho": { + "layout": [ + {"label":"Mute", "x":0, "y":0}, {"label":"Esc", "x":2.5, "y":0}, {"label":"Q", "x":3.5, "y":0}, {"label":"W", "x":4.5, "y":0}, {"label":"E", "x":5.5, "y":0}, {"label":"R", "x":6.5, "y":0}, {"label":"T", "x":7.5, "y":0}, {"label":"Y", "x":8.5, "y":0}, {"label":"U", "x":9.5, "y":0}, {"label":"I", "x":10.5, "y":0}, {"label":"O", "x":11.5, "y":0}, {"label":"P", "x":12.5, "y":0}, {"label":"Back", "x":13.5, "y":0}, + {"label":"TZ Nxt", "x":0, "y":1}, {"label":"Ctrl", "x":2.5, "y":1}, {"label":"A", "x":3.5, "y":1}, {"label":"S", "x":4.5, "y":1}, {"label":"D", "x":5.5, "y":1}, {"label":"F", "x":6.5, "y":1}, {"label":"G", "x":7.5, "y":1}, {"label":"H", "x":8.5, "y":1}, {"label":"J", "x":9.5, "y":1}, {"label":"K", "x":10.5, "y":1}, {"label":"L", "x":11.5, "y":1}, {"label":";", "x":12.5, "y":1}, {"label":"Enter", "x":13.5, "y":1}, + {"label":"TZ Prv", "x":0, "y":2}, {"label":"Shift", "x":2.5, "y":2}, {"label":"Z", "x":3.5, "y":2}, {"label":"X", "x":4.5, "y":2}, {"label":"C", "x":5.5, "y":2}, {"label":"V", "x":6.5, "y":2}, {"label":"B", "x":7.5, "y":2}, {"label":"N", "x":8.5, "y":2}, {"label":"M", "x":9.5, "y":2}, {"label":"<", "x":10.5, "y":2}, {"label":">", "x":11.5, "y":2}, {"label":"/", "x":12.5, "y":2}, {"label":"Shift", "x":13.5, "y":2}, + {"label":"TZ Off", "x":0, "y":3}, {"label":"Win", "x":3.5, "y":3}, {"label":"Alt", "x":4.5, "y":3}, {"label":"Lower", "x":5.5, "y":3}, {"label":"Space", "x":6.5, "y":3, "w":2}, {"label":"Space", "x":8.5, "y":3, "w":2}, {"label":"Raise", "x":10.5, "y":3}, {"label":"Nav", "x":11.5, "y":3}, {"label":"Fn", "x":12.5, "y":3} + ] + }, + "LAYOUT_ortho_mit": { + "layout": [ + {"label":"Mute", "x":0, "y":0}, {"label":"Esc", "x":2.5, "y":0}, {"label":"Q", "x":3.5, "y":0}, {"label":"W", "x":4.5, "y":0}, {"label":"E", "x":5.5, "y":0}, {"label":"R", "x":6.5, "y":0}, {"label":"T", "x":7.5, "y":0}, {"label":"Y", "x":8.5, "y":0}, {"label":"U", "x":9.5, "y":0}, {"label":"I", "x":10.5, "y":0}, {"label":"O", "x":11.5, "y":0}, {"label":"P", "x":12.5, "y":0}, {"label":"Back", "x":13.5, "y":0}, + {"label":"TZ Nxt", "x":0, "y":1}, {"label":"Ctrl", "x":2.5, "y":1}, {"label":"A", "x":3.5, "y":1}, {"label":"S", "x":4.5, "y":1}, {"label":"D", "x":5.5, "y":1}, {"label":"F", "x":6.5, "y":1}, {"label":"G", "x":7.5, "y":1}, {"label":"H", "x":8.5, "y":1}, {"label":"J", "x":9.5, "y":1}, {"label":"K", "x":10.5, "y":1}, {"label":"L", "x":11.5, "y":1}, {"label":";", "x":12.5, "y":1}, {"label":"Enter", "x":13.5, "y":1}, + {"label":"TZ Prv", "x":0, "y":2}, {"label":"Shift", "x":2.5, "y":2}, {"label":"Z", "x":3.5, "y":2}, {"label":"X", "x":4.5, "y":2}, {"label":"C", "x":5.5, "y":2}, {"label":"V", "x":6.5, "y":2}, {"label":"B", "x":7.5, "y":2}, {"label":"N", "x":8.5, "y":2}, {"label":"M", "x":9.5, "y":2}, {"label":"<", "x":10.5, "y":2}, {"label":">", "x":11.5, "y":2}, {"label":"/", "x":12.5, "y":2}, {"label":"Shift", "x":13.5, "y":2}, + {"label":"TZ Off", "x":0, "y":3}, {"label":"Tab", "x":3.5, "y":3}, {"label":"Win", "x":4.5, "y":3}, {"label":"Alt", "x":5.5, "y":3}, {"label":"Lower", "x":6.5, "y":3}, {"label":"Space", "x":7.5, "y":3, "w":2}, {"label":"Raise", "x":9.5, "y":3}, {"label":"Nav", "x":10.5, "y":3}, {"label":"Fn", "x":11.5, "y":3}, {"label":"Del", "x":12.5, "y":3} + ] + }, + "LAYOUT_ortho_all": { + "layout": [ + {"label":"Mute", "x":0, "y":0}, {"label":"Esc", "x":2.5, "y":0}, {"label":"Q", "x":3.5, "y":0}, {"label":"W", "x":4.5, "y":0}, {"label":"E", "x":5.5, "y":0}, {"label":"R", "x":6.5, "y":0}, {"label":"T", "x":7.5, "y":0}, {"label":"Y", "x":8.5, "y":0}, {"label":"U", "x":9.5, "y":0}, {"label":"I", "x":10.5, "y":0}, {"label":"O", "x":11.5, "y":0}, {"label":"P", "x":12.5, "y":0}, {"label":"Back", "x":13.5, "y":0}, + {"label":"TZ Nxt", "x":0, "y":1}, {"label":"Ctrl", "x":2.5, "y":1}, {"label":"A", "x":3.5, "y":1}, {"label":"S", "x":4.5, "y":1}, {"label":"D", "x":5.5, "y":1}, {"label":"F", "x":6.5, "y":1}, {"label":"G", "x":7.5, "y":1}, {"label":"H", "x":8.5, "y":1}, {"label":"J", "x":9.5, "y":1}, {"label":"K", "x":10.5, "y":1}, {"label":"L", "x":11.5, "y":1}, {"label":";", "x":12.5, "y":1}, {"label":"Enter", "x":13.5, "y":1}, + {"label":"TZ Prv", "x":0, "y":2}, {"label":"Shift", "x":2.5, "y":2}, {"label":"Z", "x":3.5, "y":2}, {"label":"X", "x":4.5, "y":2}, {"label":"C", "x":5.5, "y":2}, {"label":"V", "x":6.5, "y":2}, {"label":"B", "x":7.5, "y":2}, {"label":"N", "x":8.5, "y":2}, {"label":"M", "x":9.5, "y":2}, {"label":"<", "x":10.5, "y":2}, {"label":">", "x":11.5, "y":2}, {"label":"/", "x":12.5, "y":2}, {"label":"Shift", "x":13.5, "y":2}, + {"label":"TZ Off", "x":0, "y":3}, {"label":"Tab", "x":3.5, "y":3}, {"label":"Win", "x":4.5, "y":3}, {"label":"Alt", "x":5.5, "y":3}, {"label":"Lower", "x":6.5, "y":3}, {"label":"Space", "x":7.5, "y":3}, {"label":"Space", "x":8.5, "y":3}, {"label":"Raise", "x":9.5, "y":3}, {"label":"Nav", "x":10.5, "y":3}, {"label":"Fn", "x":11.5, "y":3}, {"label":"Del", "x":12.5, "y":3} + ] + } + } +}
\ No newline at end of file diff --git a/keyboards/terrazzo/keymaps/default/keymap.c b/keyboards/terrazzo/keymaps/default/keymap.c new file mode 100644 index 0000000000..9392a60557 --- /dev/null +++ b/keyboards/terrazzo/keymaps/default/keymap.c @@ -0,0 +1,85 @@ +/* Copyright 2020 ademey "MsMustard" + * + * 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/>. + */ + +/* Staggered layout with split spacebars + * make terrazzo:default + */ +#include QMK_KEYBOARD_H + +enum layers { + _QWERTY, + _RAISE, + _LOWER, + _NAV, + _FN +}; + +#define LOWERSP LT(_LOWER, KC_SPC) +#define RAISESP LT(_RAISE, KC_SPC) +#define SFTSLSH MT(MOD_RSFT, KC_SLSH) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = LAYOUT( + KC_MUTE, KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + TZ_NXT, KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT, + TZ_PRV, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, SFTSLSH, + TZ_OFF, KC_LGUI, KC_RALT, LOWERSP, RAISESP, MO(_NAV), MO(_FN) + ), + + [_RAISE] = LAYOUT( + _______, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MINS, KC_EQL, KC_SCLN, KC_QUOT, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BSLS, KC_LBRC, KC_RBRC, _______, + _______, _______, _______, _______, _______, _______, _______ + ), + + [_LOWER] = LAYOUT( + _______, KC_TAB, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UNDS, KC_PLUS, KC_COLN, KC_DQT, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PIPE, KC_LCBR, KC_RCBR, _______, + _______, _______, _______, _______, _______, _______, _______ + ), + + [_NAV] = LAYOUT( + _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME, KC_UP, KC_END, XXXXXXX, _______, + _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RIGHT, _______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + _______, _______, _______, _______, _______, _______, _______ + ), + + [_FN] = LAYOUT( + _______, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, + _______, KC_CAPS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_F11, KC_F12, _______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, CG_TOGG, + _______, RESET, _______, _______, _______, _______, _______ + ) +}; + + +void encoder_update_user(uint8_t index, bool clockwise) { + terrazzo_scroll_pixel(clockwise); + switch(get_highest_layer(layer_state)) { + case _NAV: + // Change volume when on nav layer + clockwise ? tap_code(KC_AUDIO_VOL_UP) : tap_code(KC_AUDIO_VOL_DOWN); + break; + default: + // Default encoder behavior of Page Up and Down + clockwise ? tap_code(KC_PGDN) : tap_code(KC_PGUP); + break; + } +}
\ No newline at end of file diff --git a/keyboards/terrazzo/keymaps/ortho/keymap.c b/keyboards/terrazzo/keymaps/ortho/keymap.c new file mode 100644 index 0000000000..c2085c4148 --- /dev/null +++ b/keyboards/terrazzo/keymaps/ortho/keymap.c @@ -0,0 +1,84 @@ +/* Copyright 2020 ademey "MsMustard" + * + * 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/>. + */ + +/* Ortho layout with 2x 2u spacebars + * Default ortho layout. + * make terrazzo:othro + */ +#include QMK_KEYBOARD_H + +enum layers { + _QWERTY, + _RAISE, + _LOWER, + _NAV, + _FN +}; + +#define LOWERSP LT(_LOWER, KC_SPC) +#define RAISESP LT(_RAISE, KC_SPC) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = LAYOUT_ortho( + KC_MUTE, KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + TZ_NXT, KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, + TZ_PRV, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + TZ_OFF, KC_TAB, KC_LGUI, KC_RALT, LOWERSP, RAISESP, MO(_NAV), MO(_FN), KC_DEL + ), + + [_RAISE] = LAYOUT_ortho( + _______, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MINS, KC_EQL, KC_SCLN, KC_QUOT, _______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BSLS, KC_LBRC, KC_RBRC, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_LOWER] = LAYOUT_ortho( + _______, KC_TAB, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UNDS, KC_PLUS, KC_COLN, KC_DQT, _______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PIPE, KC_LCBR, KC_RCBR, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_NAV] = LAYOUT_ortho( + _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME, KC_UP, KC_END, KC_PGUP, _______, + _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDN, _______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_FN] = LAYOUT_ortho( + _______, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, + _______, KC_CAPS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_F11, KC_F12, _______, _______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, CG_TOGG, + _______, RESET, _______, _______, _______, _______, _______, _______, _______ + ) +}; + +void encoder_update_user(uint8_t index, bool clockwise) { + terrazzo_scroll_pixel(clockwise); + switch(get_highest_layer(layer_state)) { + case _NAV: + // Change volume when on nav layer + clockwise ? tap_code(KC_AUDIO_VOL_UP) : tap_code(KC_AUDIO_VOL_DOWN); + break; + default: + // Default encoder behavior of Page Up and Down + clockwise ? tap_code(KC_PGDN) : tap_code(KC_PGUP); + break; + } +}
\ No newline at end of file diff --git a/keyboards/terrazzo/keymaps/ortho_all/keymap.c b/keyboards/terrazzo/keymaps/ortho_all/keymap.c new file mode 100644 index 0000000000..ba33c15fbd --- /dev/null +++ b/keyboards/terrazzo/keymaps/ortho_all/keymap.c @@ -0,0 +1,84 @@ +/* Copyright 2020 ademey "MsMustard" + * + * 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/>. + */ + +/* Ortho layout with all 1u + * make terrazzo:othro_all + */ +#include QMK_KEYBOARD_H + +enum layers { + _QWERTY, + _RAISE, + _LOWER, + _NAV, + _FN +}; + +#define LOWERSP LT(_LOWER, KC_SPC) +#define RAISESP LT(_RAISE, KC_SPC) +#define SFTSLSH MT(MOD_RSFT, KC_SLSH) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = LAYOUT_ortho_all( + KC_MUTE, KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + TZ_NXT, KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, + TZ_PRV, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + TZ_OFF, KC_TAB, KC_LGUI, KC_RALT, MO(_LOWER), KC_SPC, KC_SPC, MO(_RAISE), MO(_NAV), MO(_FN), KC_DEL + ), + + [_RAISE] = LAYOUT_ortho_all( + _______, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MINS, KC_EQL, KC_SCLN, KC_QUOT, _______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BSLS, KC_LBRC, KC_RBRC, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_LOWER] = LAYOUT_ortho_all( + _______, KC_TAB, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UNDS, KC_PLUS, KC_COLN, KC_DQT, _______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PIPE, KC_LCBR, KC_RCBR, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_NAV] = LAYOUT_ortho_all( + _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, KC_HOME, KC_UP, KC_END, KC_PGUP, _______, + _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDN,_______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_FN] = LAYOUT_ortho_all( + _______, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, + _______, KC_CAPS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_F11, KC_F12, _______, _______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, CG_TOGG, + _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; + +void encoder_update_user(uint8_t index, bool clockwise) { + terrazzo_scroll_pixel(clockwise); + switch(get_highest_layer(layer_state)) { + case _NAV: + /* Change volume when on nav layer */ + clockwise ? tap_code(KC_AUDIO_VOL_UP) : tap_code(KC_AUDIO_VOL_DOWN); + break; + default: + /* Default encoder behavior of Page Up and Down */ + clockwise ? tap_code(KC_PGDN) : tap_code(KC_PGUP); + break; + } +}
\ No newline at end of file diff --git a/keyboards/terrazzo/keymaps/ortho_mit/keymap.c b/keyboards/terrazzo/keymaps/ortho_mit/keymap.c new file mode 100644 index 0000000000..ab63f53952 --- /dev/null +++ b/keyboards/terrazzo/keymaps/ortho_mit/keymap.c @@ -0,0 +1,82 @@ +/* Copyright 2020 ademey "MsMustard" + * + * 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/>. + */ + +/* Ortho layout with 1 2u spacebar + * make terrazzo:othro_mit + */ +#include QMK_KEYBOARD_H + +enum layers { + _QWERTY, + _RAISE, + _LOWER, + _NAV, + _FN +}; + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = LAYOUT_ortho_mit( + KC_MUTE, KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + TZ_NXT, KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, + TZ_PRV, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + TZ_OFF, KC_TAB, KC_LGUI, KC_RALT, MO(_LOWER), KC_SPC, MO(_RAISE), MO(_NAV), MO(_FN), KC_DEL + ), + + [_RAISE] = LAYOUT_ortho_mit( + _______, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MINS, KC_EQL, KC_SCLN, KC_QUOT, _______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BSLS, KC_LBRC, KC_RBRC, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_LOWER] = LAYOUT_ortho_mit( + _______, KC_TAB, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UNDS, KC_PLUS, KC_COLN, KC_DQT, _______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PIPE, KC_LCBR, KC_RCBR, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_NAV] = LAYOUT_ortho_mit( + _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, KC_HOME, KC_UP, KC_END, KC_PGUP, _______, + _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDN,_______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_FN] = LAYOUT_ortho_mit( + _______, _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, _______, + _______, KC_CAPS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_F11, KC_F12, _______, _______, + _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, CG_TOGG, + _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; + + +void encoder_update_user(uint8_t index, bool clockwise) { + terrazzo_scroll_pixel(clockwise); + switch(get_highest_layer(layer_state)) { + case _NAV: + /* Change volume when on nav layer */ + clockwise ? tap_code(KC_AUDIO_VOL_UP) : tap_code(KC_AUDIO_VOL_DOWN); + break; + default: + /* Default encoder behavior of Page Up and Down */ + clockwise ? tap_code(KC_PGDN) : tap_code(KC_PGUP); + break; + } +}
\ No newline at end of file diff --git a/keyboards/terrazzo/rules.mk b/keyboards/terrazzo/rules.mk new file mode 100644 index 0000000000..f6ea149e3f --- /dev/null +++ b/keyboards/terrazzo/rules.mk @@ -0,0 +1,33 @@ +# 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 +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration +MOUSEKEY_ENABLE = no # 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 +AUDIO_ENABLE = no +RGBLIGHT_ENABLE = no +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +LED_MATRIX_ENABLE = IS31FL3731 +ENCODER_ENABLE = yes +WPM_ENABLE = yes + +LAYOUTS = ortho ortho_mit ortho_all
\ No newline at end of file diff --git a/keyboards/terrazzo/terrazzo.c b/keyboards/terrazzo/terrazzo.c new file mode 100644 index 0000000000..2fe94f8600 --- /dev/null +++ b/keyboards/terrazzo/terrazzo.c @@ -0,0 +1,165 @@ +/* Copyright 2020 ademey "MsMustard" + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "terrazzo.h" + +#ifdef LED_MATRIX_ENABLE + #include "is31fl3731-simple.h" + #include <math.h> + #include <print.h> + #include "quantum.h" + +const is31_led g_is31_leds[LED_DRIVER_LED_COUNT] = { +/* Refer to IS31 manual for these locations + * https://cdn-learn.adafruit.com/downloads/pdf/adafruit-15x7-7x15-charlieplex-led-matrix-charliewing-featherwing.pdf + */ + {0, C1_2}, {0, C1_3}, {0, C1_4}, {0, C1_5}, {0, C1_6}, {0, C1_7}, {0, C1_8}, + {0, C2_2}, {0, C2_3}, {0, C2_4}, {0, C2_5}, {0, C2_6}, {0, C2_7}, {0, C2_8}, + {0, C3_2}, {0, C3_3}, {0, C3_4}, {0, C3_5}, {0, C3_6}, {0, C3_7}, {0, C3_8}, + {0, C4_2}, {0, C4_3}, {0, C4_4}, {0, C4_5}, {0, C4_6}, {0, C4_7}, {0, C4_8}, + {0, C5_2}, {0, C5_3}, {0, C5_4}, {0, C5_5}, {0, C5_6}, {0, C5_7}, {0, C5_8}, + {0, C6_2}, {0, C6_3}, {0, C6_4}, {0, C6_5}, {0, C6_6}, {0, C6_7}, {0, C6_8}, + {0, C7_2}, {0, C7_3}, {0, C7_4}, {0, C7_5}, {0, C7_6}, {0, C7_7}, {0, C7_8}, + {0, C8_2}, {0, C8_3}, {0, C8_4}, {0, C8_5}, {0, C8_6}, {0, C8_7}, {0, C8_8}, + // + {0, C8_15},{0, C8_14},{0, C8_13},{0, C8_12},{0, C8_11},{0, C8_10},{0, C8_9}, + {0, C7_15},{0, C7_14},{0, C7_13},{0, C7_12},{0, C7_11},{0, C7_10},{0, C7_9}, + {0, C6_15},{0, C6_14},{0, C6_13},{0, C6_12},{0, C6_11},{0, C6_10},{0, C6_9}, + {0, C5_15},{0, C5_14},{0, C5_13},{0, C5_12},{0, C5_11},{0, C5_10},{0, C5_9}, + {0, C4_15},{0, C4_14},{0, C4_13},{0, C4_12},{0, C4_11},{0, C4_10},{0, C4_9}, + {0, C3_15},{0, C3_14},{0, C3_13},{0, C3_12},{0, C3_11},{0, C3_10},{0, C3_9}, + {0, C2_15},{0, C2_14},{0, C2_13},{0, C2_12},{0, C2_11},{0, C2_10},{0, C2_9} +}; + +#define TERRAZZO_EFFECT(name) +#define TERRAZZO_EFFECT_IMPLS + +#include "terrazzo_effects/terrazzo_effects.inc" + +#undef TERRAZZO_EFFECT_IMPLS +#undef TERRAZZO_EFFECT + +uint8_t terrazzo_led_index = 0; +uint8_t terrazzo_dir = 1; +uint8_t terrazzo_effect = 1; + +void terrazzo_set_pixel(uint8_t x, uint8_t y, uint8_t value) { + uint8_t target = y * LED_MATRIX_COLS + x; + if (target < LED_DRIVER_LED_COUNT && target >= 0) { + led_matrix_set_index_value(y * LED_MATRIX_COLS + x, value); + } +} + +void terrazzo_draw_at(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t image[]) { + uint8_t index = 0; + for (int v = 0; v < height; v++) { + for (int h = 0; h < width; h++) { + uint8_t pixel_value = image[index]; + if (pixel_value != 0) { + terrazzo_set_pixel(x + h, y + v, image[index]); + } + index++; + } + } +} + +void terrazzo_scroll_pixel(bool clockwise) { + terrazzo_dir = clockwise; + + if (clockwise) { + terrazzo_led_index = terrazzo_led_index + 1; + } else { + terrazzo_led_index = terrazzo_led_index - 1; + } + + if (terrazzo_led_index >= LED_DRIVER_LED_COUNT) { + terrazzo_led_index = 0; + } else if (terrazzo_led_index <= 0 ) { + terrazzo_led_index = LED_DRIVER_LED_COUNT - 1; + } +} + +void terrazzo_step_mode(void) { + terrazzo_effect++; + if (terrazzo_effect >= TERRAZZO_EFFECT_MAX) { + terrazzo_effect = 1; + } +} + +void terrazzo_step_mode_reverse(void) { + terrazzo_effect--; + if (terrazzo_effect < 1) { + terrazzo_effect = TERRAZZO_EFFECT_MAX - 1; + } +} + +void terrazzo_mode_off(void) { + terrazzo_effect = TERRAZZO_NONE; +} + +void terrazzo_render(void) { + switch(terrazzo_effect) { + case TERRAZZO_NONE: + led_matrix_set_index_value_all(0); + break; + #define TERRAZZO_EFFECT(name, ...) \ + case TERRAZZO_EFFECT_##name: \ + name(terrazzo_led_index, terrazzo_dir); \ + break; + #include "terrazzo_effects/terrazzo_effects.inc" + #undef TERRAZZO_EFFECT + } +} + +void led_matrix_indicators_kb(void) { + terrazzo_render(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + switch(keycode) { + case TZ_NXT: + terrazzo_step_mode(); + return true; + case TZ_PRV: + terrazzo_step_mode_reverse(); + return true; + case TZ_OFF: + terrazzo_mode_off(); + return true; + // Reverse animation on backspace + case KC_BSPC: + terrazzo_scroll_pixel(0); + return true; + // Any keycode increments counter + default: + terrazzo_scroll_pixel(1); + break; + } + } + return process_record_user(keycode, record); +} + +void suspend_power_down_kb(void) { + led_matrix_set_suspend_state(true); +} + +void suspend_wakeup_init_kb(void) { + led_matrix_set_suspend_state(false); +} + + +#endif
\ No newline at end of file diff --git a/keyboards/terrazzo/terrazzo.h b/keyboards/terrazzo/terrazzo.h new file mode 100644 index 0000000000..526b3f9251 --- /dev/null +++ b/keyboards/terrazzo/terrazzo.h @@ -0,0 +1,122 @@ +/* Copyright 2020 ademey "MsMustard" + * + * 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" + +/* Default staggered layout + Bottom row: 1u 1.5u 2.25u 2.75u 1.5u 1u */ +#define LAYOUT( \ + K00, K01, K02, K03, K04, K05, K70, K71, K72, K73, K74, K75, K65, \ + K10, K11, K12, K13, K14, K15, K60, K61, K62, K63, K64, K55, \ + K20, K21, K22, K23, K24, K25, K50, K51, K52, K53, K54, K45, \ + K30, K31, K32, K33, K40, K42, K43 \ +){ \ + { K00, K01, K02, K03, K04, K05,}, \ + { K10, K11, K12, K13, K14, K15,}, \ + { K20, K21, K22, K23, K24, K25,}, \ + { K30, K31, K32, K33, KC_NO, KC_NO,},\ + { K40, KC_NO, K42, K43, KC_NO, K45,},\ + { K50, K51, K52, K53, K54, K55,}, \ + { K60, K61, K62, K63, K64, K65,}, \ + { K70, K71, K72, K73, K74, K75, } \ +} + +/* Default ortho layout + Bottom row: 1u 1u 1u 2u 2u 1u 1u 1u */ +#define LAYOUT_ortho( \ + K00, K01, K02, K03, K04, K05, K70, K71, K72, K73, K74, K75, K65, \ + K10, K11, K12, K13, K14, K15, K60, K61, K62, K63, K64, K54, K55, \ + K20, K21, K22, K23, K24, K25, K50, K51, K52, K53, K43, K44, K45, \ + K30, K31, K32, K33, K34, K35, K40, K41, K42 \ +){ \ + { K00, K01, K02, K03, K04, K05,}, \ + { K10, K11, K12, K13, K14, K15,}, \ + { K20, K21, K22, K23, K24, K25,}, \ + { K30, K31, K32, K33, K34, K35,}, \ + { K40, K41, K42, K43, K44, K45,}, \ + { K50, K51, K52, K53, K54, K55,}, \ + { K60, K61, K62, K63, K64, K65,}, \ + { K70, K71, K72, K73, K74, K75, }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, } \ +} + +/* MIT ortho layout + Bottom row: 1u 1u 1u 1u 2u 1u 1u 1u 1u */ +#define LAYOUT_ortho_mit( \ + K00, K01, K02, K03, K04, K05, K70, K71, K72, K73, K74, K75, K65, \ + K10, K11, K12, K13, K14, K15, K60, K61, K62, K63, K64, K54, K55, \ + K20, K21, K22, K23, K24, K25, K50, K51, K52, K53, K43, K44, K45, \ + K30, K31, K32, K33, K84, K35, K85, K40, K41, K42 \ +){ \ + { K00, K01, K02, K03, K04, K05,}, \ + { K10, K11, K12, K13, K14, K15,}, \ + { K20, K21, K22, K23, K24, K25,}, \ + { K30, K31, K32, K33, KC_NO, K35,}, \ + { K40, K41, K42, K43, K44, K45,}, \ + { K50, K51, K52, K53, K54, K55,}, \ + { K60, K61, K62, K63, K64, K65,}, \ + { K70, K71, K72, K73, K74, K75, }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, K84, K85, } \ +} + +/* All 1u ortho layout + Bottom row: 1u 1u 1u 1u 1u 1u 1u 1u 1u 1u */ +#define LAYOUT_ortho_all( \ + K00, K01, K02, K03, K04, K05, K70, K71, K72, K73, K74, K75, K65, \ + K10, K11, K12, K13, K14, K15, K60, K61, K62, K63, K64, K54, K55, \ + K20, K21, K22, K23, K24, K25, K50, K51, K52, K53, K43, K44, K45, \ + K30, K31, K32, K33, K84, K34, K35, K85, K40, K41, K42 \ +){ \ + { K00, K01, K02, K03, K04, K05,}, \ + { K10, K11, K12, K13, K14, K15,}, \ + { K20, K21, K22, K23, K24, K25,}, \ + { K30, K31, K32, K33, K34, K35,}, \ + { K40, K41, K42, K43, K44, K45,}, \ + { K50, K51, K52, K53, K54, K55,}, \ + { K60, K61, K62, K63, K64, K65,}, \ + { K70, K71, K72, K73, K74, K75, }, \ + { KC_NO, KC_NO, KC_NO, KC_NO, K84, K85, } \ +} + + +enum terrazzo_matrix_effects { + TERRAZZO_NONE = 0, +// -------------------------------------- +// -----Begin led effect enum macros----- +#define TERRAZZO_EFFECT(name, ...) TERRAZZO_EFFECT_##name, +#include "terrazzo_effects/terrazzo_effects.inc" +#undef TERRAZZO_EFFECT + // -------------------------------------- + // -----End led effect enum macros------- + // All new effects go above this line + TERRAZZO_EFFECT_MAX +}; + +enum terrazzo_keycodes { + TZ_NXT = SAFE_RANGE, + TZ_PRV, + TZ_OFF +}; + +void terrazzo_render(void); +void terrazzo_set_pixel(uint8_t x, uint8_t y, uint8_t value); +void terrazzo_draw_at(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t image[]); +void terrazzo_scroll_pixel(bool clockwise); +void terrazzo_step_mode(void); +void terrazzo_step_mode_reverse(void); +void terrazzo_mode_off(void); diff --git a/keyboards/terrazzo/terrazzo_effects/dino.h b/keyboards/terrazzo/terrazzo_effects/dino.h new file mode 100644 index 0000000000..747ef6178e --- /dev/null +++ b/keyboards/terrazzo/terrazzo_effects/dino.h @@ -0,0 +1,162 @@ +/* Copyright 2020 ademey "MsMustard" + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef DISABLE_TERRAZZO_EFFECT_DINO +TERRAZZO_EFFECT(DINO) +# ifdef TERRAZZO_EFFECT_IMPLS + +static uint8_t dino_frames[2][56] = { +{ + 0, 0, 0, 9, 9, 9, 9, + 0, 0, 0, 9, 0, 9, 9, + 9, 0, 0, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 0, 0, + 9, 9, 9, 9, 9, 0, 0, + 0, 9, 9, 9, 0, 0, 0, + 0, 9, 0, 9, 9, 0, 0, + 0, 9, 9, 0, 0, 0, 0 +}, +{ + 0, 0, 0, 9, 9, 9, 9, + 0, 0, 0, 9, 0, 9, 9, + 9, 0, 0, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 0, 0, + 9, 9, 9, 9, 9, 0, 0, + 0, 9, 9, 9, 0, 0, 0, + 0, 9, 0, 9, 0, 0, 0, + 0, 0, 0, 9, 9, 0, 0 +} +}; + +static uint8_t dino_reverse[2][56] = { +{ + 9, 9, 9, 9, 0, 0, 0, + 9, 9, 0, 9, 0, 0, 0, + 9, 9, 9, 9, 0, 0, 9, + 0, 0, 9, 9, 9, 9, 9, + 0, 0, 9, 9, 9, 9, 9, + 0, 0, 0, 9, 9, 9, 0, + 0, 0, 9, 9, 0, 9, 0, + 0, 0, 0, 0, 9, 9, 0 +}, +{ + 9, 9, 9, 9, 0, 0, 0, + 9, 9, 0, 9, 0, 0, 0, + 9, 9, 9, 9, 0, 0, 9, + 0, 0, 9, 9, 9, 9, 9, + 0, 0, 9, 9, 9, 9, 9, + 0, 0, 0, 9, 9, 9, 0, + 0, 0, 0, 9, 0, 9, 0, + 0, 0, 9, 9, 0, 0, 0 +} +}; + +static uint8_t dino_bg[10][42] = { +{ + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 4, 0, + 0, 1, 1, 0, 0, 0, 4, + 1, 0, 0, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0 +}, +{ + 0, 0, 0, 0, 0, 0, 4, + 0, 0, 0, 0, 4, 0, 4, + 0, 0, 0, 0, 4, 0, 4, + 1, 1, 0, 0, 0, 4, 4, + 0, 0, 1, 1, 1, 1, 4, + 0, 0, 0, 0, 0, 0, 4 +}, +{ + 0, 0, 0, 0, 0, 4, 0, + 0, 0, 0, 4, 0, 4, 0, + 0, 0, 0, 4, 0, 4, 4, + 1, 0, 0, 0, 4, 4, 0, + 0, 1, 1, 1, 1, 4, 0, + 0, 0, 0, 0, 0, 4, 0 +}, +{ + 0, 0, 0, 0, 4, 0, 0, + 0, 0, 4, 0, 4, 0, 4, + 0, 0, 4, 0, 4, 4, 4, + 0, 0, 0, 4, 4, 0, 0, + 1, 1, 1, 1, 4, 1, 1, + 0, 0, 0, 0, 4, 0, 0 +}, +{ + 0, 0, 0, 4, 0, 0, 0, + 0, 4, 0, 4, 0, 4, 0, + 0, 4, 0, 4, 4, 4, 0, + 0, 0, 4, 4, 0, 0, 0, + 1, 1, 1, 4, 1, 1, 1, + 0, 0, 0, 4, 0, 0, 0 +}, +{ + 0, 0, 4, 0, 0, 0, 0, + 4, 0, 4, 0, 4, 0, 0, + 4, 0, 4, 4, 4, 0, 0, + 0, 4, 4, 0, 0, 0, 1, + 1, 1, 4, 1, 1, 1, 0, + 0, 0, 4, 0, 0, 0, 0 +}, +{ + 0, 4, 0, 0, 0, 0, 0, + 0, 4, 0, 4, 0, 0, 0, + 0, 4, 4, 4, 0, 0, 0, + 4, 4, 0, 0, 0, 1, 1, + 1, 4, 1, 1, 1, 0, 0, + 0, 4, 0, 0, 0, 0, 0 +}, +{ + 4, 0, 0, 0, 0, 0, 0, + 4, 0, 4, 0, 0, 0, 0, + 4, 4, 4, 0, 0, 0, 0, + 4, 0, 0, 0, 1, 1, 0, + 4, 1, 1, 1, 0, 0, 1, + 4, 0, 0, 0, 0, 0, 0 +}, +{ + 0, 0, 0, 0, 0, 0, 0, + 0, 4, 0, 0, 0, 0, 0, + 4, 4, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 0, 0, + 1, 1, 1, 0, 0, 1, 1, + 0, 0, 0, 0, 0, 0, 0 +}, +{ + 0, 0, 0, 0, 0, 0, 0, + 4, 0, 0, 0, 0, 0, 4, + 4, 0, 0, 0, 0, 0, 4, + 0, 0, 1, 1, 0, 0, 0, + 1, 1, 0, 0, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0 +} +}; + +void DINO(uint8_t i, bool dir) { + led_matrix_set_index_value_all(0); + if (dir) { + terrazzo_draw_at(0, 7, 7, 8, dino_frames[i % 2]); + } else { + terrazzo_draw_at(0, 7, 7, 8, dino_reverse[i % 2]); + + } + terrazzo_draw_at(0, 0, 7, 6, dino_bg[i % 10]); +} + +# endif +#endif
\ No newline at end of file diff --git a/keyboards/terrazzo/terrazzo_effects/dot.h b/keyboards/terrazzo/terrazzo_effects/dot.h new file mode 100644 index 0000000000..e8eb8e0fce --- /dev/null +++ b/keyboards/terrazzo/terrazzo_effects/dot.h @@ -0,0 +1,27 @@ +/* Copyright 2020 ademey "MsMustard" + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef DISABLE_TERRAZZO_EFFECT_DOT +TERRAZZO_EFFECT(DOT) +# ifdef TERRAZZO_EFFECT_IMPLS +// Animation for debugging. Lights one pixel according to animation index +void DOT(uint8_t i, bool dir) { + led_matrix_set_index_value_all(0); + led_matrix_set_index_value(i, 10); +} + +# endif +#endif
\ No newline at end of file diff --git a/keyboards/terrazzo/terrazzo_effects/heart.h b/keyboards/terrazzo/terrazzo_effects/heart.h new file mode 100644 index 0000000000..bdcd2d7b97 --- /dev/null +++ b/keyboards/terrazzo/terrazzo_effects/heart.h @@ -0,0 +1,99 @@ +/* Copyright 2020 ademey "MsMustard" + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef DISABLE_TERRAZZO_EFFECT_HEART +TERRAZZO_EFFECT(HEART) +# ifdef TERRAZZO_EFFECT_IMPLS + +static uint8_t heart_frames[4][105] = { +{ + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 5, 5, 0, 5, 5, 0, + 5, 0, 0, 5, 0, 0, 5, + 5, 0, 0, 0, 0, 0, 5, + 0, 5, 0, 0, 0, 5, 0, + 0, 0, 5, 0, 5, 0, 0, + 0, 0, 0, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 +}, +{ + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 5, 5, 0, 5, 5, 0, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 0, 5, 5, 5, 5, 5, 0, + 0, 0, 5, 5, 5, 0, 0, + 0, 0, 0, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 +}, +{ + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 0, 1, 1, 0, + 1, 0, 0, 5, 0, 0, 1, + 0, 5, 5, 0, 5, 5, 0, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 0, 5, 5, 5, 5, 5, 0, + 0, 0, 5, 5, 5, 0, 0, + 1, 0, 0, 5, 0, 0, 1, + 0, 1, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 1, 0, 0, + 0, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 +}, +{ + 0, 1, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 0, 1, + 0, 5, 5, 0, 5, 5, 0, + 5, 0, 0, 5, 0, 0, 5, + 0, 5, 5, 0, 5, 5, 0, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 0, 5, 5, 5, 5, 5, 0, + 0, 0, 5, 5, 5, 0, 0, + 5, 0, 0, 5, 0, 0, 5, + 0, 5, 0, 0, 0, 5, 0, + 1, 0, 5, 0, 5, 0, 1, + 0, 1, 0, 5, 0, 1, 0, + 0, 0, 1, 0, 1, 0, 0, + 0, 0, 0, 1, 0, 0, 0 +} +}; + + +void HEART(uint8_t i, bool dir) { + led_matrix_set_index_value_all(0); + terrazzo_draw_at(0, 0, 7, 15, heart_frames[i % 4]); +} + +# endif +#endif
\ No newline at end of file diff --git a/keyboards/terrazzo/terrazzo_effects/outrun.h b/keyboards/terrazzo/terrazzo_effects/outrun.h new file mode 100644 index 0000000000..b4455ef49f --- /dev/null +++ b/keyboards/terrazzo/terrazzo_effects/outrun.h @@ -0,0 +1,127 @@ +/* Copyright 2020 ademey "MsMustard" + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef DISABLE_TERRAZZO_EFFECT_OUTRUN +TERRAZZO_EFFECT(OUTRUN) +# ifdef TERRAZZO_EFFECT_IMPLS + +static uint8_t outrun_sun[25] = { + 0, 9, 9, 9, 0, + 7, 7, 7, 7, 7, + 4, 4, 4, 4, 4, + 2, 2, 2, 2, 2, + 0, 1, 1, 1, 0 +}; + +static uint8_t outrun_ground[63] = { + 0, 0, 1, 1, 1, 0, 0, + 0, 2, 0, 2, 0, 2, 0, + 0, 2, 0, 2, 0, 2, 0, + 0, 2, 0, 4, 0, 2, 0, + 2, 0, 0, 5, 0, 0, 2, + 2, 0, 0, 5, 0, 0, 2, + 2, 0, 0, 6, 0, 0, 2, + 0, 0, 0, 7, 0, 0, 0, + 0, 0, 0, 8, 0, 0, 0 +}; + +static uint8_t outrun_rows[4][63] = { +{ + 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 4, 4, 4, 4, 4, 4, 4, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 +}, +{ + 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 4, 4, 4, 4, 4, 4, 4, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 +}, +{ + 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, + 0, 0, 0, 0, 0, 0, 0, + 4, 4, 4, 4, 4, 4, 4, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 9, 9, 9, 9, 9, 9, 9, + 0, 0, 0, 0, 0, 0, 0 +}, +{ + 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, + 0, 0, 0, 0, 0, 0, 0, + 4, 4, 4, 4, 4, 4, 4, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 9, 9, 9, 9, 9, 9, 9 +} +}; + +bool last_dir; +uint8_t change_index = 0; + +void OUTRUN(uint8_t i, bool dir) { + led_matrix_set_index_value_all(0); + + if(dir != last_dir) { + change_index = i; + } + + uint8_t change_diff = abs(i - change_index); + uint8_t horz_bright = 9; + + if(change_diff < 4) { + if (dir) { + terrazzo_draw_at(1, 4 - change_diff, 5, 1 + change_diff, outrun_sun); + horz_bright = 3 + change_diff; + } else { + terrazzo_draw_at(1, 0 + change_diff, 5, 5 - change_diff, outrun_sun); + horz_bright = 5 - change_diff; + } + } else { + if (dir) { + terrazzo_draw_at(1, 0, 5, 5, outrun_sun); + } else { + horz_bright = 1; + } + } + + for(int x = 0; x < 7; x++){ + terrazzo_set_pixel(x, 5, horz_bright); + } + // Sun is larger but render the top 3 rows only + terrazzo_draw_at(0, 6, 7, 10, outrun_ground); + terrazzo_draw_at(0, 6, 7, 10, outrun_rows[i % 4]); + last_dir = dir; +} + +# endif +#endif
\ No newline at end of file diff --git a/keyboards/terrazzo/terrazzo_effects/pac_dude.h b/keyboards/terrazzo/terrazzo_effects/pac_dude.h new file mode 100644 index 0000000000..aa4fc9923f --- /dev/null +++ b/keyboards/terrazzo/terrazzo_effects/pac_dude.h @@ -0,0 +1,67 @@ +/* Copyright 2020 ademey "MsMustard" + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef DISABLE_TERRAZZO_EFFECT_PAC_DUDE +TERRAZZO_EFFECT(PAC_DUDE) +# ifdef TERRAZZO_EFFECT_IMPLS + +static uint8_t pac_frames[3][25] = { +{ // up + 0, 0, 0, 0, 0, + 9, 0, 0, 0, 9, + 9, 9, 0, 9, 9, + 9, 9, 9, 9, 9, + 0, 9, 9, 9, 0 +}, +{ // closed + 0, 9, 9, 9, 0, + 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, + 0, 9, 9, 9, 0 +}, +{ // down + 0, 9, 9, 9, 0, + 9, 9, 9, 9, 9, + 9, 9, 0, 9, 9, + 9, 0, 0, 0, 9, + 0, 0, 0, 0, 0 +} +}; + +static uint8_t pac_ghost[20] = { + 0, 4, 4, 4, 0, + 4, 0, 4, 0, 4, + 4, 4, 4, 4, 4, + 4, 0, 4, 0, 4 +}; + + +void PAC_DUDE(uint8_t i, bool dir) { + led_matrix_set_index_value_all(0); + if (dir) { + terrazzo_draw_at(1, 4, 5, 5, pac_frames[i % 2]); + terrazzo_set_pixel(3, 0 + i % 3, 5); + terrazzo_set_pixel(3, 3 + i % 3, 5); + } else { + terrazzo_draw_at(1, 4, 5, 5, pac_frames[1 + i % 2]); + terrazzo_draw_at(1, 8 + i % 8, 5, 4, pac_ghost); + } + +} + +# endif +#endif
\ No newline at end of file diff --git a/keyboards/terrazzo/terrazzo_effects/stripes.h b/keyboards/terrazzo/terrazzo_effects/stripes.h new file mode 100644 index 0000000000..4e1238cdc4 --- /dev/null +++ b/keyboards/terrazzo/terrazzo_effects/stripes.h @@ -0,0 +1,35 @@ +/* Copyright 2020 ademey "MsMustard" + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef DISABLE_TERRAZZO_EFFECT_STRIPES +TERRAZZO_EFFECT(STRIPES) +# ifdef TERRAZZO_EFFECT_IMPLS + +void STRIPES(uint8_t i, bool dir) { + uint8_t sweep[] = {1, 2, 3, 4, 6, 8, 10, 15, 20, 30, 40, 60}; + uint8_t levels = 12; + float soften = 5; + + for (int y = 0; y < LED_MATRIX_ROWS; y++) { + for (int x = 0; x < LED_MATRIX_COLS; x++) { + uint8_t target = (x+y+i)%levels; + terrazzo_set_pixel(x, y, floor(sweep[target] / soften)); + } + } +} + +# endif +#endif
\ No newline at end of file diff --git a/keyboards/terrazzo/terrazzo_effects/terrazzo_effects.inc b/keyboards/terrazzo/terrazzo_effects/terrazzo_effects.inc new file mode 100644 index 0000000000..c5271db1b4 --- /dev/null +++ b/keyboards/terrazzo/terrazzo_effects/terrazzo_effects.inc @@ -0,0 +1,7 @@ +#include "terrazzo_effects/stripes.h" +#include "terrazzo_effects/dino.h" +#include "terrazzo_effects/outrun.h" +#include "terrazzo_effects/pac_dude.h" +#include "terrazzo_effects/heart.h" +#include "terrazzo_effects/wpm_chart.h" +#include "terrazzo_effects/dot.h" diff --git a/keyboards/terrazzo/terrazzo_effects/wpm_chart.h b/keyboards/terrazzo/terrazzo_effects/wpm_chart.h new file mode 100644 index 0000000000..5c66bc39ad --- /dev/null +++ b/keyboards/terrazzo/terrazzo_effects/wpm_chart.h @@ -0,0 +1,111 @@ +/* Copyright 2020 ademey "MsMustard" + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef DISABLE_TERRAZZO_EFFECT_WPM_CHART +TERRAZZO_EFFECT(WPM_CHART) +# ifdef TERRAZZO_EFFECT_IMPLS + +static uint8_t number_3_4[10][12] = { +{ // 0 + 9, 9, 9, + 9, 0, 9, + 9, 0, 9, + 9, 9, 9 +}, +{ // 1 + 0, 9, 0, + 9, 9, 0, + 0, 9, 0, + 9, 9, 9 +}, +{ // 2 + 9, 9, 0, + 0, 0, 9, + 0, 9, 0, + 9, 9, 9 +}, +{ // 3 + 9, 9, 9, + 0, 9, 0, + 0, 0, 9, + 9, 9, 0 +}, +{ // 4 + 9, 0, 9, + 9, 0, 9, + 9, 9, 9, + 0, 0, 9 +}, +{ // 5 + 9, 9, 9, + 9, 9, 0, + 0, 0, 9, + 9, 9, 9 +}, +{ // 6 + 0, 0, 9, + 0, 9, 0, + 9, 0, 9, + 0, 9, 0 +}, +{ // 7 + 9, 9, 9, + 0, 0, 9, + 0, 9, 0, + 9, 0, 0 +}, +{ // 8 + 9, 9, 9, + 9, 0, 9, + 9, 4, 9, + 9, 9, 9 +}, +{ // 9 + 9, 9, 9, + 9, 0, 9, + 9, 9, 9, + 0, 0, 9 +} +}; + +/* Reference to create a gradient effect */ +uint8_t wpm_levels[10] = {20, 9, 8, 7, 6, 5, 4, 3, 2, 1}; + +void WPM_CHART(uint8_t i, bool dir) { + led_matrix_set_index_value_all(0); + uint8_t c_wpm = get_current_wpm(); + uint8_t half_wpm = floor(c_wpm / 2); + uint8_t max_rows = 10; + /* Turn on LED for current WPM. Each pixel is 2 wpm. */ + for (int k = 0; k < half_wpm && k < 70; k++) { + uint8_t current_row = (int)floor(k / 7); + led_matrix_set_index_value(k, wpm_levels[max_rows - current_row]); + }; + uint8_t d1 = (int)floor(c_wpm / 10); + /* There is only room to print 2 digits. If the WPM is greater than + 99 then the last 2 digits will show, ie 120 = 20. */ + if (c_wpm > 99) { + uint8_t tens_place = d1 % 10; + terrazzo_draw_at(0, 11, 3, 4, number_3_4[tens_place]); + } else { + terrazzo_draw_at(0, 11, 3, 4, number_3_4[d1]); + } + + terrazzo_draw_at(4, 11, 3, 4, number_3_4[c_wpm % 10]); +} + +# endif +#endif
\ No newline at end of file |