diff options
Diffstat (limited to 'keyboards/rate/pistachio_mp')
-rw-r--r-- | keyboards/rate/pistachio_mp/config.h | 78 | ||||
-rw-r--r-- | keyboards/rate/pistachio_mp/info.json | 34 | ||||
-rw-r--r-- | keyboards/rate/pistachio_mp/keymaps/default/keymap.c | 56 | ||||
-rw-r--r-- | keyboards/rate/pistachio_mp/keymaps/default/readme.md | 1 | ||||
-rw-r--r-- | keyboards/rate/pistachio_mp/keymaps/via/keymap.c | 121 | ||||
-rw-r--r-- | keyboards/rate/pistachio_mp/keymaps/via/readme.md | 1 | ||||
-rw-r--r-- | keyboards/rate/pistachio_mp/keymaps/via/rules.mk | 1 | ||||
-rw-r--r-- | keyboards/rate/pistachio_mp/pistachio_mp.c | 17 | ||||
-rw-r--r-- | keyboards/rate/pistachio_mp/pistachio_mp.h | 48 | ||||
-rw-r--r-- | keyboards/rate/pistachio_mp/readme.md | 21 | ||||
-rw-r--r-- | keyboards/rate/pistachio_mp/rules.mk | 19 |
11 files changed, 397 insertions, 0 deletions
diff --git a/keyboards/rate/pistachio_mp/config.h b/keyboards/rate/pistachio_mp/config.h new file mode 100644 index 0000000000..4da866bb7d --- /dev/null +++ b/keyboards/rate/pistachio_mp/config.h @@ -0,0 +1,78 @@ +/* +Copyright 2020 rate + +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.222 + +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 0x5255 +#define PRODUCT_ID 0xE212 +#define DEVICE_VER 0x0001 +#define MANUFACTURER rate +#define PRODUCT pistachio_mp + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 4 + +#ifdef ENCODER_ENABLE +#define ENCODERS_PAD_A {F4} +#define ENCODERS_PAD_B {F5} +#endif + +/* + * 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 { B4, E6, D7, C6, D4 } +#define MATRIX_COL_PINS { B3, B1, F7, F6 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL */ +#define DIODE_DIRECTION ROW2COL + +#define RGB_DI_PIN D2 +#define RGBLED_NUM 3 +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#if defined(RGBLIGHT_ENABLE) && !defined(IOS_DEVICE_ENABLE) + #define USB_MAX_POWER_CONSUMPTION 400 +#else + #define USB_MAX_POWER_CONSUMPTION 100 +#endif + +/* 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 + +/* nKey Rollover */ +#define FORCE_NKRO + +/* disable these deprecated features by default */ +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION diff --git a/keyboards/rate/pistachio_mp/info.json b/keyboards/rate/pistachio_mp/info.json new file mode 100644 index 0000000000..d4e130300c --- /dev/null +++ b/keyboards/rate/pistachio_mp/info.json @@ -0,0 +1,34 @@ +{ + "keyboard_name": "pistachio_mp", + "url": "", + "maintainer": "rate", + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"Encoder", "x":3, "y":0}, + + {"label":"Num Lock", "x":0, "y":1.5}, + {"label":"/", "x":1, "y":1.5}, + {"label":"*", "x":2, "y":1.5}, + {"label":"-", "x":3, "y":1.5}, + + {"label":"7", "x":0, "y":2.5}, + {"label":"8", "x":1, "y":2.5}, + {"label":"9", "x":2, "y":2.5}, + + {"label":"4", "x":0, "y":3.5}, + {"label":"5", "x":1, "y":3.5}, + {"label":"6", "x":2, "y":3.5}, + {"label":"+", "x":3, "y":2.5, "h":2}, + + {"label":"1", "x":0, "y":4.5}, + {"label":"2", "x":1, "y":4.5}, + {"label":"3", "x":2, "y":4.5}, + + {"label":"0", "x":0, "y":5.5, "w":2}, + {"label":".", "x":2, "y":5.5}, + {"label":"Enter", "x":3, "y":4.5, "h":2} + ] + } + } +} diff --git a/keyboards/rate/pistachio_mp/keymaps/default/keymap.c b/keyboards/rate/pistachio_mp/keymaps/default/keymap.c new file mode 100644 index 0000000000..c206f30617 --- /dev/null +++ b/keyboards/rate/pistachio_mp/keymaps/default/keymap.c @@ -0,0 +1,56 @@ +/* Copyright 2020 rate + * + * 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 QMK_KEYBOARD_H + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _BASE = 0, + _FN +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [_BASE] = LAYOUT( + KC_MPLY, + LT(_FN, KC_NLCK), KC_PSLS, KC_PAST, KC_PMNS, + KC_P7, KC_P8, KC_P9, + KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_P1, KC_P2, KC_P3, + KC_P0, KC_PDOT, KC_PENT + ), + /* Fn */ + [_FN] = LAYOUT( + KC_NO, + KC_NO, KC_NO, KC_NO, KC_NO, + RGB_HUI, RGB_SAI, RGB_VAI, + RGB_HUD, RGB_SAD, RGB_VAD, RGB_TOG, + KC_NO, KC_NO, KC_NO, + KC_NO, KC_NO, KC_NO + ) +}; +#ifdef ENCODER_ENABLE +bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { + // Volume control + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } + return true; +} +#endif diff --git a/keyboards/rate/pistachio_mp/keymaps/default/readme.md b/keyboards/rate/pistachio_mp/keymaps/default/readme.md new file mode 100644 index 0000000000..2bc50be9dd --- /dev/null +++ b/keyboards/rate/pistachio_mp/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for pistachio_mp diff --git a/keyboards/rate/pistachio_mp/keymaps/via/keymap.c b/keyboards/rate/pistachio_mp/keymaps/via/keymap.c new file mode 100644 index 0000000000..241b501d1d --- /dev/null +++ b/keyboards/rate/pistachio_mp/keymaps/via/keymap.c @@ -0,0 +1,121 @@ +/* Copyright 2020 rate + * + * 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 QMK_KEYBOARD_H + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _BASE = 0, + _FN, + _RESERVE_0, + _RESERVE_1 +}; + +static uint8_t encoder_state = 0; +static const keypos_t ENC_CW = {.row = 3, .col = 3}; +static const keypos_t ENC_CCW = {.row = 4, .col = 1}; + +#define LAYOUT_via( \ + ECW,ECCW, K07, \ + K00, K01, K02, K03, \ + K04, K05, K06, \ + K08, K09, K10, K11, \ + K12, K13, K14, \ + K15, K16, K17 ) { \ + { K00, K01, K02, K03 }, \ + { K04, K05, K06, K07 }, \ + { K08, K09, K10, K11 }, \ + { K12, K13, K14, ECCW }, \ + { K15, ECW, K16, K17 }, \ +} + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [_BASE] = LAYOUT_via( + KC_VOLU,KC_VOLD,KC_MPLY, + LT(_FN, KC_NLCK), KC_PSLS, KC_PAST, KC_PMNS, + KC_P7, KC_P8, KC_P9, + KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_P1, KC_P2, KC_P3, + KC_P0, KC_PDOT, KC_PENT + ), + /* Fn */ + [_FN] = LAYOUT_via( + KC_VOLU,KC_VOLD,KC_NO, + KC_NO, KC_NO, KC_NO, KC_NO, + RGB_HUI, RGB_SAI, RGB_VAI, + RGB_HUD, RGB_SAD, RGB_VAD, RGB_TOG, + KC_NO, KC_NO, KC_NO, + KC_NO, KC_NO, KC_NO + ), + /* Reserve */ + [_RESERVE_0] = LAYOUT_via( + KC_VOLU,KC_VOLD,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 + ), + /* Reserve */ + [_RESERVE_1] = LAYOUT_via( + KC_VOLU,KC_VOLD,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 + ), +}; + +#ifdef ENCODER_ENABLE +void encoder_action_unregister(void) { + if (encoder_state) { + keyevent_t encoder_event = (keyevent_t) { + .key = encoder_state >> 1 ? ENC_CW : ENC_CCW, + .pressed = false, + .time = (timer_read() | 1) + }; + encoder_state = 0; + action_exec(encoder_event); + } + return; +} + +void encoder_action_register(uint8_t index, bool clockwise) { + keyevent_t encoder_event = (keyevent_t) { + .key = clockwise ? ENC_CW : ENC_CCW, + .pressed = true, + .time = (timer_read() | 1) + }; + encoder_state = (clockwise ^ 1) | (clockwise << 1); + action_exec(encoder_event); + return; +} + +void matrix_scan_kb(void) { + encoder_action_unregister(); + matrix_scan_user(); + return; +} + +bool encoder_update_kb(uint8_t index, bool clockwise) { + encoder_action_register(index, clockwise); + // don't return user actions, because they are in the keymap + // encoder_update_user(index, clockwise); + return true; +}; +#endif diff --git a/keyboards/rate/pistachio_mp/keymaps/via/readme.md b/keyboards/rate/pistachio_mp/keymaps/via/readme.md new file mode 100644 index 0000000000..b768049ccc --- /dev/null +++ b/keyboards/rate/pistachio_mp/keymaps/via/readme.md @@ -0,0 +1 @@ +# The via keymap for pistachio_mp diff --git a/keyboards/rate/pistachio_mp/keymaps/via/rules.mk b/keyboards/rate/pistachio_mp/keymaps/via/rules.mk new file mode 100644 index 0000000000..036bd6d1c3 --- /dev/null +++ b/keyboards/rate/pistachio_mp/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes
\ No newline at end of file diff --git a/keyboards/rate/pistachio_mp/pistachio_mp.c b/keyboards/rate/pistachio_mp/pistachio_mp.c new file mode 100644 index 0000000000..40e75fe1b0 --- /dev/null +++ b/keyboards/rate/pistachio_mp/pistachio_mp.c @@ -0,0 +1,17 @@ +/* Copyright 2020 rate + * + * 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 "pistachio_mp.h" diff --git a/keyboards/rate/pistachio_mp/pistachio_mp.h b/keyboards/rate/pistachio_mp/pistachio_mp.h new file mode 100644 index 0000000000..d7c5c9bad9 --- /dev/null +++ b/keyboards/rate/pistachio_mp/pistachio_mp.h @@ -0,0 +1,48 @@ +/* Copyright 2020 rate + * + * 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" + +/* + * ,------------------------ + * | K07 | + * |------------------------ + * | K00 | K01 | K02 | K03 | + * |------------------------ + * | K04 | K05 | K06 | | + * |------------------ K11 - + * | K08 | K09 | K10 | | + * |------------------------ + * | K12 | K13 | K14 | | + * |------------------ K17 - + * | K15 | K16 | | + * |------------------------ + */ +#define LAYOUT( \ + K07, \ + K00, K01, K02, K03, \ + K04, K05, K06, \ + K08, K09, K10, K11, \ + K12, K13, K14, \ + K15, K16, K17 ) { \ + { K00, K01, K02, K03 }, \ + { K04, K05, K06, K07 }, \ + { K08, K09, K10, K11 }, \ + { K12, K13, K14, KC_NO }, \ + { K15, KC_NO, K16, K17 }, \ +} diff --git a/keyboards/rate/pistachio_mp/readme.md b/keyboards/rate/pistachio_mp/readme.md new file mode 100644 index 0000000000..b8ea088a4a --- /dev/null +++ b/keyboards/rate/pistachio_mp/readme.md @@ -0,0 +1,21 @@ +# PistachioMacroPad + +![PistachioMacroPad](https://ratelog.net/wp-content/uploads/2020/11/s-PXL_20201114_134133741.jpg) + +This is a numeric keypad with a rotary encoder that uses a stainless steel plate. + +* Keyboard Maintainer: [rate](https://github.com/7-rate) +* Hardware Supported: PistachioMacroPad PCB, Pro Micro, BMP MicroPro +* Hardware Availability: [PCB & CaseData](https://github.com/7-rate/Pistachio_MacroPad.git), [Booth Shop](https://rates.booth.pm/items/2531312) + +Make example for this keyboard (after setting up your build environment): + + make rate/pistachio_mp:default + +Flashing example for this keyboard: + + make rate/pistachio_mp:default:flash + +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). + +[Build guide](https://ratelog.net/pistachiomacropad-build-guide/) diff --git a/keyboards/rate/pistachio_mp/rules.mk b/keyboards/rate/pistachio_mp/rules.mk new file mode 100644 index 0000000000..424aed9074 --- /dev/null +++ b/keyboards/rate/pistachio_mp/rules.mk @@ -0,0 +1,19 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +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 # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = yes |