diff options
Diffstat (limited to 'keyboards/ristretto/ristretto.c')
| -rw-r--r-- | keyboards/ristretto/ristretto.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/keyboards/ristretto/ristretto.c b/keyboards/ristretto/ristretto.c new file mode 100644 index 000000000..1ea43bcee --- /dev/null +++ b/keyboards/ristretto/ristretto.c | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | /* Copyright 2021 Brandon Lewis | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "ristretto.h" | ||
| 18 | |||
| 19 | enum layers { | ||
| 20 | _BASE, | ||
| 21 | _RAISE, | ||
| 22 | _LOWER, | ||
| 23 | _ADJUST | ||
| 24 | }; | ||
| 25 | |||
| 26 | bool encoder_update_kb(uint8_t index, bool clockwise) { | ||
| 27 | if (!encoder_update_user(index, clockwise)) { return false; } | ||
| 28 | if(index == 0) { | ||
| 29 | if (clockwise) { | ||
| 30 | tap_code(KC_VOLD); | ||
| 31 | } else { | ||
| 32 | tap_code(KC_VOLU); | ||
| 33 | } | ||
| 34 | } | ||
| 35 | return true; | ||
| 36 | } | ||
| 37 | |||
| 38 | #ifdef OLED_DRIVER_ENABLE | ||
| 39 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
| 40 | return OLED_ROTATION_270; | ||
| 41 | } | ||
| 42 | |||
| 43 | __attribute__((weak)) void oled_task_user(void) { | ||
| 44 | oled_write_P(PSTR("\n\n"), false); | ||
| 45 | oled_write_ln_P(PSTR("LAYER"), false); | ||
| 46 | oled_write_ln_P(PSTR(""), false); | ||
| 47 | switch (get_highest_layer(layer_state)) { | ||
| 48 | case _BASE: | ||
| 49 | oled_write_P(PSTR("BASE\n"), false); | ||
| 50 | break; | ||
| 51 | case _RAISE: | ||
| 52 | oled_write_P(PSTR("RAISE\n"), false); | ||
| 53 | break; | ||
| 54 | case _LOWER: | ||
| 55 | oled_write_P(PSTR("LOWER\n"), false); | ||
| 56 | break; | ||
| 57 | case _ADJUST: | ||
| 58 | oled_write_P(PSTR("ADJ\n"), false); | ||
| 59 | break; | ||
| 60 | } | ||
| 61 | } | ||
| 62 | |||
| 63 | #endif | ||
