From 8c17a822a826924da27f070804dcd420a549b192 Mon Sep 17 00:00:00 2001 From: Brandon Lewis <64657834+blewis308@users.noreply.github.com> Date: Thu, 22 Jul 2021 01:31:03 -0500 Subject: [PATCH] [Keyboard] Add Ristretto Keyboard (#13479) Co-authored-by: Drashna Jaelre Co-authored-by: Ryan Co-authored-by: Brandon Lewis --- keyboards/ristretto/config.h | 50 ++++++++++++++++ keyboards/ristretto/info.json | 17 ++++++ keyboards/ristretto/keymaps/default/keymap.c | 53 ++++++++++++++++ keyboards/ristretto/readme.md | 18 ++++++ keyboards/ristretto/ristretto.c | 63 ++++++++++++++++++++ keyboards/ristretto/ristretto.h | 31 ++++++++++ keyboards/ristretto/rules.mk | 25 ++++++++ 7 files changed, 257 insertions(+) create mode 100644 keyboards/ristretto/config.h create mode 100644 keyboards/ristretto/info.json create mode 100644 keyboards/ristretto/keymaps/default/keymap.c create mode 100644 keyboards/ristretto/readme.md create mode 100644 keyboards/ristretto/ristretto.c create mode 100644 keyboards/ristretto/ristretto.h create mode 100644 keyboards/ristretto/rules.mk diff --git a/keyboards/ristretto/config.h b/keyboards/ristretto/config.h new file mode 100644 index 0000000000..3d5a66fbc3 --- /dev/null +++ b/keyboards/ristretto/config.h @@ -0,0 +1,50 @@ +/* Copyright 2021 Brandon Lewis + * + * 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 . + */ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x666B // fk +#define PRODUCT_ID 0x7273 // rs +#define DEVICE_VER 0x0001 // rev 1 +#define MANUFACTURER fruitykeeb +#define PRODUCT ristretto + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 13 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { B1, B2, B3, D3 } +#define MATRIX_COL_PINS { C7, C6, B6, B5, B4, D7, B7, F0, F1, F4, F5, F6, F7 } + +/* 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 + +#define ENCODERS_PAD_A { D4 } +#define ENCODERS_PAD_B { D6 } +#define ENCODER_RESOLUTION 4 diff --git a/keyboards/ristretto/info.json b/keyboards/ristretto/info.json new file mode 100644 index 0000000000..86a0172c1b --- /dev/null +++ b/keyboards/ristretto/info.json @@ -0,0 +1,17 @@ +{ + "keyboard_name": "ristretto", + "url": "https://www.fruitykeeb.xyz/product/ristretto", + "maintainer": "Fruit", + "width": 13, + "height": 4, + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"ESC", "x":0, "y":0}, {"label":"Q", "x":1, "y":0}, {"label":"W", "x":2, "y":0}, {"label":"E", "x":3, "y":0}, {"label":"R", "x":4, "y":0}, {"label":"T", "x":5, "y":0} , {"label":"Y", "x":7, "y":0}, {"label":"U", "x":8, "y":0}, {"label":"I", "x":9, "y":0}, {"label":"O", "x":10, "y":0}, {"label":"P", "x":11, "y":0}, {"label":"BKSP", "x":12, "y":0}, + {"label":"TAB", "x":0, "y":1}, {"label":"A", "x":1, "y":1}, {"label":"S", "x":2, "y":1}, {"label":"D", "x":3, "y":1}, {"label":"F", "x":4, "y":1}, {"label":"G", "x":5, "y":1} , {"label":"H", "x":7, "y":1}, {"label":"J", "x":8, "y":1}, {"label":"K", "x":9, "y":1}, {"label":"L", "x":10, "y":1}, {"label":";", "x":11, "y":1}, {"label":"'", "x":12, "y":2}, + {"label":"LSFT", "x":0, "y":2},{"label":"Z", "x":1, "y":2}, {"label":"X", "x":2, "y":2}, {"label":"C", "x":3, "y":2}, {"label":"V", "x":4, "y":2}, {"label":"B", "x":5, "y":2} , {"label":"N", "x":7, "y":2}, {"label":"M", "x":8, "y":2}, {"label":"<", "x":9, "y":2}, {"label":">", "x":10, "y":2}, {"label":"?", "x":11, "y":2}, {"label":"ENTR", "x":12, "y":2}, + {"label":"LCTL", "x":0, "y":3},{"label":"LGUI","x":1,"y":3},{"label":"LALT","x":2,"y":3},{"label":"" , "x":3, "y":3}, {"label":"" , "x":4, "y":3}, {"label":"" , "x":5, "y":3}, {"label":"Rotary", "x":6, "y":3}, {"label":"" , "x":7, "y":3}, {"label":"" , "x":8, "y":3}, {"label":"" , "x":9, "y":3}, {"label":"RALT","x":10,"y":3},{"label":"RGUI","x":11,"y":3}, {"label":"RCTL","x":12, "y":3} + ] + } + } +} \ No newline at end of file diff --git a/keyboards/ristretto/keymaps/default/keymap.c b/keyboards/ristretto/keymaps/default/keymap.c new file mode 100644 index 0000000000..e02c6ea246 --- /dev/null +++ b/keyboards/ristretto/keymaps/default/keymap.c @@ -0,0 +1,53 @@ +/* Copyright 2021 Brandon Lewis + * + * 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 . + */ + +#include QMK_KEYBOARD_H + +enum layers { + _BASE, + _RAISE, + _LOWER, + _ADJUST +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT( + KC_ESC , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_BSPC , + KC_TAB , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN , KC_QUOT , + KC_LSFT , KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM , KC_DOT , KC_SLSH , KC_ENT , + KC_LCTL , KC_LGUI , KC_LALT ,MO(_LOWER),KC_ENT , KC_SPC , KC_MUTE , KC_SPC , KC_RSFT ,MO(_RAISE),KC_RALT , KC_RGUI , KC_RCTRL + ), + [_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 , + KC_CAPS , KC_MINS , KC_EQL , KC_LBRC , KC_RBRC , KC_BSLS , KC_NO , KC_LEFT , KC_DOWN , KC_UP , KC_RGHT , KC_BSLS , + KC_TRNS , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + KC_TRNS , KC_TRNS , KC_TRNS ,MO(_ADJUST),KC_ENT , KC_NO , KC_MPLY , KC_NO , KC_RSFT , KC_NO , KC_TRNS , KC_TRNS , KC_TRNS + ), + [_LOWER] = LAYOUT( + 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_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_LBRC , KC_RBRC , KC_NO , + KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , + KC_TRNS , KC_TRNS , KC_TRNS , KC_NO , KC_ENT , KC_NO , KC_MUTE , KC_NO , KC_RSFT ,MO(_ADJUST),KC_TRNS, KC_TRNS , KC_TRNS + ), + [_ADJUST] = LAYOUT( + XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , + XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , KC_CAPS , KC_NLCK , KC_SLCK , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , + XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , XXXXXXX , + KC_TRNS , KC_TRNS , KC_TRNS , XXXXXXX , XXXXXXX , XXXXXXX , KC_MUTE , XXXXXXX , XXXXXXX , XXXXXXX , KC_TRNS , KC_TRNS , KC_TRNS + ), +}; + +// OLED and Encoder function is located in the ristretto.c File diff --git a/keyboards/ristretto/readme.md b/keyboards/ristretto/readme.md new file mode 100644 index 0000000000..d047e70994 --- /dev/null +++ b/keyboards/ristretto/readme.md @@ -0,0 +1,18 @@ +# Ristretto + +![Ristretto](https://i.imgur.com/VHX6ktEh.jpg) +![Ristretto-2](https://i.imgur.com/Hrc8vkph.jpg) + +An Integrated, Column Stagger, 40% Keyboard with OLED and Rotary Encoder + +* Keyboard Maintainer: [Fruit](https://github.com/Blewis308) +* Hardware Supported: Ristretto PCB, Atmega32u4 +* Hardware Availability: Through Group Buy - May 2021 + + To enter the bootloader, press the button marked "SW1" on the bottom of the PCB. + +Make example for this keyboard (after setting up your build envionment): + + make ristretto: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). \ No newline at end of file diff --git a/keyboards/ristretto/ristretto.c b/keyboards/ristretto/ristretto.c new file mode 100644 index 0000000000..1ea43bceed --- /dev/null +++ b/keyboards/ristretto/ristretto.c @@ -0,0 +1,63 @@ +/* Copyright 2021 Brandon Lewis + * + * 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 . + */ + +#include "ristretto.h" + +enum layers { + _BASE, + _RAISE, + _LOWER, + _ADJUST +}; + +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) { return false; } + if(index == 0) { + if (clockwise) { + tap_code(KC_VOLD); + } else { + tap_code(KC_VOLU); + } + } + return true; +} + +#ifdef OLED_DRIVER_ENABLE +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + return OLED_ROTATION_270; +} + +__attribute__((weak)) void oled_task_user(void) { + oled_write_P(PSTR("\n\n"), false); + oled_write_ln_P(PSTR("LAYER"), false); + oled_write_ln_P(PSTR(""), false); + switch (get_highest_layer(layer_state)) { + case _BASE: + oled_write_P(PSTR("BASE\n"), false); + break; + case _RAISE: + oled_write_P(PSTR("RAISE\n"), false); + break; + case _LOWER: + oled_write_P(PSTR("LOWER\n"), false); + break; + case _ADJUST: + oled_write_P(PSTR("ADJ\n"), false); + break; + } +} + +#endif diff --git a/keyboards/ristretto/ristretto.h b/keyboards/ristretto/ristretto.h new file mode 100644 index 0000000000..66be57b18b --- /dev/null +++ b/keyboards/ristretto/ristretto.h @@ -0,0 +1,31 @@ +/* Copyright 2021 Brandon Lewis + * + * 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 . + */ + +#pragma once + +#include "quantum.h" + +#define LAYOUT( \ + K000, K001, K002, K003, K004, K005, K007, K008, K009, K010, K011, K012, \ + K100, K101, K102, K103, K104, K105, K107, K108, K109, K110, K111, K112, \ + K200, K201, K202, K203, K204, K205, K207, K208, K209, K210, K211, K212, \ + K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312 \ +) { \ + {K000, K001, K002, K003, K004, K005, KC_NO, K007, K008, K009, K010, K011, K012}, \ + {K100, K101, K102, K103, K104, K105, KC_NO, K107, K108, K109, K110, K111, K112}, \ + {K200, K201, K202, K203, K204, K205, KC_NO, K207, K208, K209, K210, K211, K212}, \ + {K300, K301, K302, K303, K304, K305, K306 , K307, K308, K309, K310, K311, K312} \ +} diff --git a/keyboards/ristretto/rules.mk b/keyboards/ristretto/rules.mk new file mode 100644 index 0000000000..96bf291a0d --- /dev/null +++ b/keyboards/ristretto/rules.mk @@ -0,0 +1,25 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# 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 = 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 +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = yes +OLED_DRIVER_ENABLE = yes +WAIT_FOR_USB = yes