diff options
Diffstat (limited to 'keyboards/rate')
48 files changed, 2580 insertions, 0 deletions
diff --git a/keyboards/rate/pistachio/config.h b/keyboards/rate/pistachio/config.h new file mode 100644 index 0000000000..5ff7b3d799 --- /dev/null +++ b/keyboards/rate/pistachio/config.h @@ -0,0 +1,31 @@ +/* +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 "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x5255 +#define PRODUCT_ID 0xD0C2 +#define DEVICE_VER 0x0001 +#define MANUFACTURER rate +#define PRODUCT pistachio + +/* key matrix size */ +#define MATRIX_ROWS 12 +#define MATRIX_COLS 9 diff --git a/keyboards/rate/pistachio/info.json b/keyboards/rate/pistachio/info.json new file mode 100644 index 0000000000..8cdeb51ca3 --- /dev/null +++ b/keyboards/rate/pistachio/info.json @@ -0,0 +1,101 @@ +{ + "keyboard_name": "Pistachio", + "url": "", + "maintainer": "rate", + "layouts": { + "LAYOUT": { + "layout": [{"label":"ESC", "x":1.25, "y":0.25}, + {"label":"F1", "x":2.75, "y":0.25}, + {"label":"F2", "x":3.75, "y":0.25}, + {"label":"F3", "x":4.75, "y":0.25}, + {"label":"F4", "x":5.75, "y":0.25}, + {"label":"DEL", "x":7.25, "y":0.25}, + {"label":"F5", "x":9.5, "y":0.25}, + {"label":"F6", "x":10.5, "y":0.25}, + {"label":"F7", "x":11.5, "y":0.25}, + {"label":"F8", "x":12.5, "y":0.25}, + {"label":"F9", "x":14, "y":0.25}, + {"label":"F10", "x":15, "y":0.25}, + {"label":"F11", "x":16, "y":0.25}, + {"label":"F12", "x":17, "y":0.25}, + {"label":"\u25b6\u25b6|", "x":0, "y":1.75}, + {"label":"E/J", "x":1.25, "y":1.75}, + {"label":"!", "x":2.25, "y":1.75}, + {"label":"\"", "x":3.25, "y":1.75}, + {"label":"#", "x":4.25, "y":1.75}, + {"label":"$", "x":5.25, "y":1.75}, + {"label":"%", "x":6.25, "y":1.75}, + {"label":"&", "x":7.25, "y":1.75}, + {"label":"'", "x":10, "y":1.75}, + {"label":"(", "x":11, "y":1.75}, + {"label":")", "x":12, "y":1.75}, + {"label":"", "x":13, "y":1.75}, + {"label":"=", "x":14, "y":1.75}, + {"label":"~", "x":15, "y":1.75}, + {"label":"\\", "x":16, "y":1.75}, + {"label":"\u2190", "x":17, "y":1.75}, + {"label":"Delete", "x":18.25, "y":1.75}, + {"label":"\u25b6||", "x":0, "y":2.75}, + {"label":"Tab", "x":1.25, "y":2.75, "w":1.5}, + {"label":"Q", "x":2.75, "y":2.75}, + {"label":"W", "x":3.75, "y":2.75}, + {"label":"E", "x":4.75, "y":2.75}, + {"label":"R", "x":5.75, "y":2.75}, + {"label":"T", "x":6.75, "y":2.75}, + {"label":"Y", "x":9.5, "y":2.75}, + {"label":"U", "x":10.5, "y":2.75}, + {"label":"I", "x":11.5, "y":2.75}, + {"label":"O", "x":12.5, "y":2.75}, + {"label":"P", "x":13.5, "y":2.75}, + {"label":"`", "x":14.5, "y":2.75}, + {"label":"{", "x":15.5, "y":2.75}, + {"label":"Home", "x":18.25, "y":2.75}, + {"label":"\ud83d\udd07", "x":0, "y":3.75}, + {"label":"CapsLock", "x":1.25, "y":3.75, "w":1.75}, + {"label":"A", "x":3, "y":3.75}, + {"label":"S", "x":4, "y":3.75}, + {"label":"D", "x":5, "y":3.75}, + {"label":"F", "x":6, "y":3.75}, + {"label":"G", "x":7, "y":3.75}, + {"label":"H", "x":9.75, "y":3.75}, + {"label":"J", "x":10.75, "y":3.75}, + {"label":"K", "x":11.75, "y":3.75}, + {"label":"L", "x":12.75, "y":3.75}, + {"label":"+", "x":13.75, "y":3.75}, + {"label":"*", "x":14.75, "y":3.75}, + {"label":"}", "x":15.75, "y":3.75}, + {"label":"Enter", "x":16.75, "y":2.75, "w":1.25, "h":2}, + {"label":"End", "x":18.25, "y":3.75}, + {"label":"VolUP", "x":0, "y":4.75}, + {"label":"Shift", "x":1.25, "y":4.75, "w":2.25}, + {"label":"Z", "x":3.5, "y":4.75}, + {"label":"X", "x":4.5, "y":4.75}, + {"label":"C", "x":5.5, "y":4.75}, + {"label":"V", "x":6.5, "y":4.75}, + {"label":"B", "x":7.5, "y":4.75}, + {"label":"N", "x":10.25, "y":4.75}, + {"label":"M", "x":11.25, "y":4.75}, + {"label":"<", "x":12.25, "y":4.75}, + {"label":">", "x":13.25, "y":4.75}, + {"label":"?", "x":14.25, "y":4.75}, + {"label":"_", "x":15.25, "y":4.75}, + {"label":"Shift", "x":16.25, "y":4.75, "w":1.75}, + {"label":"Page", "x":18.25, "y":4.75}, + {"label":"VolDW", "x":0, "y":5.75}, + {"label":"Ctrl", "x":1.25, "y":5.75, "w":1.25}, + {"label":"Win", "x":2.5, "y":5.75}, + {"label":"Alt", "x":3.5, "y":5.75, "w":1.25}, + {"label":"Enter", "x":4.75, "y":5.75}, + {"label":"\u7121\u5909\u63db", "x":5.75, "y":5.75}, + {"x":6.75, "y":5.75, "w":1.25}, + {"x":10.5, "y":5.75, "w":1.25}, + {"label":"\u5909\u63db", "x":11.75, "y":5.75}, + {"label":"\u5de6\u30af\u30ea\u30c3\u30af", "x":12.75, "y":5.75}, + {"label":"Insert", "x":13.75, "y":5.75}, + {"label":"Alt", "x":14.75, "y":5.75}, + {"label":"Menu", "x":15.75, "y":5.75}, + {"label":"Ctrl", "x":16.75, "y":5.75, "w":1.25}, + {"label":"Page", "x":18.25, "y":5.75}] + } + } +} diff --git a/keyboards/rate/pistachio/keymaps/default/keymap.c b/keyboards/rate/pistachio/keymaps/default/keymap.c new file mode 100644 index 0000000000..585807abdd --- /dev/null +++ b/keyboards/rate/pistachio/keymaps/default/keymap.c @@ -0,0 +1,67 @@ +/* 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 +#include "keymap_jp.h" + +extern rgblight_config_t rgblight_config; + +enum layer_names { + _QWERTY = 0, + _FN +}; + +enum custom_keycodes { + RGB_RST = SAFE_RANGE +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_DEL, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + KC_MNXT, KC_ZKHK, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, JP_MINS, JP_CIRC, JP_YEN, KC_BSPC, KC_DEL, + KC_MPLY, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, JP_AT, JP_LBRC, KC_HOME, + KC_MUTE, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, JP_SCLN, JP_COLN, JP_RBRC, KC_ENT, KC_END, + KC_VOLU, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, JP_COMM, JP_DOT, JP_SLSH, JP_BSLS, KC_RSFT, KC_PGUP, + KC_VOLD, KC_LCTL, KC_LGUI, KC_LALT, KC_ENT, KC_MHEN, LT(_FN,KC_SPC), LT(_FN,KC_SPC), KC_HENK, KC_BTN1, KC_INS, KC_RALT, KC_APP, KC_RCTL, KC_PGDN + ), + [_FN] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_VAD, _______, _______, _______, _______, KC_UP, _______, KC_HOME, KC_PGUP, KC_END, _______, _______, _______, _______, _______, + _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, KC_LEFT, KC_UP, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, + RGB_HUI, _______, _______, _______, _______, _______, _______, KC_PGDN, _______, _______, _______, _______, _______, _______, RGB_SAI, + RGB_HUD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAD + ) +}; + + +int RGB_current_mode; +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + bool result = false; + switch (keycode) { + case RGB_RST: + if (record->event.pressed) { + eeconfig_update_rgblight_default(); + rgblight_enable(); + RGB_current_mode = rgblight_config.mode; + } + break; + default: + result = true; + break; + } + + return result; +} diff --git a/keyboards/rate/pistachio/keymaps/rate/keymap.c b/keyboards/rate/pistachio/keymaps/rate/keymap.c new file mode 100644 index 0000000000..34e1324aed --- /dev/null +++ b/keyboards/rate/pistachio/keymaps/rate/keymap.c @@ -0,0 +1,69 @@ +/* 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 +#include "keymap_jp.h" + + +enum layer_names { + _QWERTY = 0, + _FN, + _NUM +}; + +enum custom_keycodes { + RGB_RST = SAFE_RANGE +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_DEL, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + KC_0, KC_ZKHK, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, JP_MINS, JP_CIRC, JP_YEN, KC_BSPC, KC_DEL, + KC_H, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, JP_AT, JP_LBRC, KC_HOME, + KC_U, KC_ENT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, JP_SCLN, JP_COLN, JP_RBRC, KC_ENT, KC_END, + KC_VOLU, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, JP_COMM, JP_DOT, JP_SLSH, JP_BSLS, KC_RSFT, KC_PGUP, + KC_VOLD, KC_LCTRL, KC_LGUI, KC_LALT, KC_LALT, LT(_NUM, KC_M), KC_SPC, LT(_FN, KC_SPC), KC_MPLY, JP_KANA, KC_UP, KC_DOWN, KC_INS, KC_RCTRL, KC_PGDN + ), + [_FN] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_VAD, _______, _______, _______, _______, KC_UP, _______, _______, KC_HOME, KC_END, _______, KC_PGUP, _______, _______, _______, + _______, _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, KC_LEFT, KC_UP, KC_DOWN, KC_RIGHT, KC_PGDN, _______, _______, _______, _______, + RGB_HUI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAI, + RGB_HUD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAD + ), + [_NUM] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PMNS, _______, _______, _______, _______, + RGB_VAD, KC_7, KC_8, KC_9, _______, _______, _______, KC_7, KC_8, KC_9, _______, _______, _______, _______, _______, + _______, KC_4, KC_5, KC_6, _______, _______, _______, KC_4, KC_5, KC_6, _______, KC_PPLS, KC_PAST, _______, _______, _______, + RGB_HUI, KC_1, KC_2, KC_3, KC_0, JP_DOT, _______, KC_1, KC_2, KC_3, _______, KC_PSLS, _______, _______, RGB_SAI, + RGB_HUD, _______, _______, _______, _______, _______, _______, KC_0, _______, JP_DOT, _______, _______, _______, _______, RGB_SAD + ) +}; + + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case RGB_RST: + if (record->event.pressed) { + eeconfig_update_rgblight_default(); + rgblight_enable(); + } + break; + } + + return true; +} diff --git a/keyboards/rate/pistachio/keymaps/via/keymap.c b/keyboards/rate/pistachio/keymaps/via/keymap.c new file mode 100644 index 0000000000..357253ac2d --- /dev/null +++ b/keyboards/rate/pistachio/keymaps/via/keymap.c @@ -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. + * + * 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 +#include "keymap_jp.h" + + +enum layer_names { + _QWERTY = 0, + _FN, + _NUM, + _RESERVE +}; + +enum custom_keycodes { + RGB_RST = SAFE_RANGE +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_DEL, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + KC_0, KC_ZKHK, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, JP_MINS, JP_CIRC, JP_YEN, KC_BSPC, KC_DEL, + KC_H, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, JP_AT, JP_LBRC, KC_HOME, + KC_U, KC_ENT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, JP_SCLN, JP_COLN, JP_RBRC, KC_ENT, KC_END, + KC_VOLU, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, JP_COMM, JP_DOT, JP_SLSH, JP_BSLS, KC_RSFT, KC_PGUP, + KC_VOLD, KC_LCTRL, KC_LGUI, KC_LALT, KC_LALT, LT(_NUM, KC_M), KC_SPC, LT(_FN, KC_SPC), KC_MPLY, JP_KANA, KC_UP, KC_DOWN, KC_INS, KC_RCTRL, KC_PGDN + ), + [_FN] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_VAD, _______, _______, _______, _______, KC_UP, _______, _______, KC_HOME, KC_END, _______, KC_PGUP, _______, _______, _______, + _______, _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, KC_LEFT, KC_UP, KC_DOWN, KC_RIGHT, KC_PGDN, _______, _______, _______, _______, + RGB_HUI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAI, + RGB_HUD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_SAD + ), + [_NUM] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + RGB_VAI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PMNS, _______, _______, _______, _______, + RGB_VAD, KC_7, KC_8, KC_9, _______, _______, _______, KC_7, KC_8, KC_9, _______, _______, _______, _______, _______, + _______, KC_4, KC_5, KC_6, _______, _______, _______, KC_4, KC_5, KC_6, _______, KC_PPLS, KC_PAST, _______, _______, _______, + RGB_HUI, KC_1, KC_2, KC_3, KC_0, JP_DOT, _______, KC_1, KC_2, KC_3, _______, KC_PSLS, _______, _______, RGB_SAI, + RGB_HUD, _______, _______, _______, _______, _______, _______, KC_0, _______, JP_DOT, _______, _______, _______, _______, RGB_SAD + ), + [_RESERVE] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; + + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case RGB_RST: + if (record->event.pressed) { + eeconfig_update_rgblight_default(); + rgblight_enable(); + } + break; + } + + return true; +} diff --git a/keyboards/rate/pistachio/keymaps/via/rules.mk b/keyboards/rate/pistachio/keymaps/via/rules.mk new file mode 100644 index 0000000000..036bd6d1c3 --- /dev/null +++ b/keyboards/rate/pistachio/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes
\ No newline at end of file diff --git a/keyboards/rate/pistachio/pistachio.c b/keyboards/rate/pistachio/pistachio.c new file mode 100644 index 0000000000..2a850f64a4 --- /dev/null +++ b/keyboards/rate/pistachio/pistachio.c @@ -0,0 +1,18 @@ +/* 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.h" + diff --git a/keyboards/rate/pistachio/pistachio.h b/keyboards/rate/pistachio/pistachio.h new file mode 100644 index 0000000000..7bf2c59ad6 --- /dev/null +++ b/keyboards/rate/pistachio/pistachio.h @@ -0,0 +1,25 @@ +/* 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" + +#if defined(KEYBOARD_rate_pistachio_rev1) +# include "rev1.h" +#elif defined(KEYBOARD_rate_pistachio_rev2) +# include "rev2.h" +#endif diff --git a/keyboards/rate/pistachio/readme.md b/keyboards/rate/pistachio/readme.md new file mode 100644 index 0000000000..dc989bbe6c --- /dev/null +++ b/keyboards/rate/pistachio/readme.md @@ -0,0 +1,18 @@ +# pistachio + +![pistachio](https://ratelog.net/wp-content/uploads/2021/05/s-IMG_1835.jpg) + +This is a 92-key split keyboard with JIS layout and spare keys. + +* Keyboard Maintainer: [rate](https://github.com/7-rate) [@7_rate](https://twitter.com/7_rate) +* Hardware Supported: pistachio PCB Rev1 Rev2, Pro Micro +* Hardware Availability: [PCB & Case Data](https://github.com/7-rate/Pistachio), [Booth Shop](https://rates.booth.pm/items/2237334) + +Make example for this keyboard (after setting up your build environment): + + make rate/pistachio/rev1:default + make rate/pistachio/rev2: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). + +[Build guide](https://ratelog.net/pistachio-build-guide/) diff --git a/keyboards/rate/pistachio/rev1/config.h b/keyboards/rate/pistachio/rev1/config.h new file mode 100644 index 0000000000..24f121ef17 --- /dev/null +++ b/keyboards/rate/pistachio/rev1/config.h @@ -0,0 +1,67 @@ +/* +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 + +/* + * 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 { D4, C6, D7, E6, B4, B5 } +#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2, B6, D3} +#define UNUSED_PINS + +#define USE_I2C + +/* COL2ROW, ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* ws2812 RGB LED */ +#define RGB_DI_PIN D2 +#define RGBLIGHT_SPLIT +#define RGBLED_SPLIT { 1, 1 } +#define RGBLED_NUM 2 +#define RGBLIGHT_LAYERS +#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/rev1/readme.md b/keyboards/rate/pistachio/rev1/readme.md new file mode 100644 index 0000000000..eae3776935 --- /dev/null +++ b/keyboards/rate/pistachio/rev1/readme.md @@ -0,0 +1,17 @@ +# pistachio Rev1 + +![pistachio](https://ratelog.net/wp-content/uploads/2020/08/Pistachio4-scaled.jpg) + +This is a 92-key split keyboard with JIS layout and spare keys. + +* Keyboard Maintainer: [rate](https://github.com/7-rate) [@7_rate](https://twitter.com/7_rate) +* Hardware Supported: pistachio PCB Rev1, Pro Micro +* Hardware Availability: [PCB & Case Data](https://github.com/7-rate/Pistachio), [Booth Shop](https://rates.booth.pm/items/2237334) + +Make example for this keyboard (after setting up your build environment): + + make pistachio/rev1: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). + +[Build guide](https://ratelog.net/pistachio-build-guide/)
\ No newline at end of file diff --git a/keyboards/rate/pistachio/rev1/rev1.c b/keyboards/rate/pistachio/rev1/rev1.c new file mode 100644 index 0000000000..5824157f53 --- /dev/null +++ b/keyboards/rate/pistachio/rev1/rev1.c @@ -0,0 +1,18 @@ +/* +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 "rev1.h" diff --git a/keyboards/rate/pistachio/rev1/rev1.h b/keyboards/rate/pistachio/rev1/rev1.h new file mode 100644 index 0000000000..e42de2d2b0 --- /dev/null +++ b/keyboards/rate/pistachio/rev1/rev1.h @@ -0,0 +1,58 @@ +/* +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" + +/* + * ,------------------------------------------------- ---------------------------------------------------------. + * | | L00 | | L01 | L02 | L03 | L04 | | L05 | | R00 | R01 | R02 | R03 | | R04 | R05 | R06 | R07 | | + * |-------------------------------------- ---------- ---------------------------------------------------------+ + * | L10 || L11 | L12 | L13 | L14 | L15 | L16 | L17 | | R10 | R11 | R12 | R13 | R14 | R15 | R16 | R17 || R18 | + * |------------------------------------------------- ---------------------------------------------------------+ + * | L20 || L21 | L22 | L23 | L24 | L25 | L26 | | R20 | R21 | R22 | R23 | R24 | R25 | R26 | R27 || R28 | + * |--------------------------------------------- ------------------------------------------- ------+ + * | L30 || L31 | L32 | L33 | L34 | L35 | L36 | | R30 | R31 | R32 | R33 | R34 | R35 | R36 | || R37 | + * |---------------------------------------------- -------------------------------------------------------+ + * | L40 || L41 | L42 | L43 | L44 | L45 | L46 | | R40 | R41 | R42 | R43 | R44 | R45 | R46 || R47 | + * |----------------------------------------------- -----------------------------------------------------+ + * | L50 || L51 | L52 | L53 | L54 | L55 | L56 | | R50 | R51 | R52 | R53 | R54 | R55 | R56 || R57 | + * |----------------------------------------------- ---------------------------------------------------- + */ +#define LAYOUT( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, R06, R07, \ + L10, L11, L12, L13, L14, L15, L16, L17, R10, R11, R12, R13, R14, R15, R16, R17, R18, \ + L20, L21, L22, L23, L24, L25, L26, R20, R21, R22, R23, R24, R25, R26, R28, \ + L30, L31, L32, L33, L34, L35, L36, R30, R31, R32, R33, R34, R35, R36, R27, R37, \ + L40, L41, L42, L43, L44, L45, L46, R40, R41, R42, R43, R44, R45, R46, R47, \ + L50, L51, L52, L53, L54, L55, L56, R50, R51, R52, R53, R54, R55, R56, R57 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05, KC_NO, KC_NO, KC_NO }, \ + { L10, L11, L12, L13, L14, L15, L16, L17, KC_NO }, \ + { L20, L21, L22, L23, L24, L25, L26, KC_NO, KC_NO }, \ + { L30, L31, L32, L33, L34, L35, L36, KC_NO, KC_NO }, \ + { L40, L41, L42, L43, L44, L45, L46, KC_NO, KC_NO }, \ + { L50, L51, L52, L53, L54, L55, L56, KC_NO, KC_NO }, \ + { R00, R01, R02, R03, R04, R05, R06, R07, KC_NO }, \ + { R10, R11, R12, R13, R14, R15, R16, R17, R18 }, \ + { R20, R21, R22, R23, R24, R25, R26, R27, R28 }, \ + { R30, R31, R32, R33, R34, R35, R36, R37, KC_NO }, \ + { R40, R41, R42, R43, R44, R45, R46, R47, KC_NO }, \ + { R50, R51, R52, R53, R54, R55, R56, R57, KC_NO } \ + } diff --git a/keyboards/rate/pistachio/rev1/rules.mk b/keyboards/rate/pistachio/rev1/rules.mk new file mode 100644 index 0000000000..909b1e68de --- /dev/null +++ b/keyboards/rate/pistachio/rev1/rules.mk @@ -0,0 +1,19 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +SPLIT_KEYBOARD = yes # Enable split keyboard diff --git a/keyboards/rate/pistachio/rev2/config.h b/keyboards/rate/pistachio/rev2/config.h new file mode 100644 index 0000000000..d0de298542 --- /dev/null +++ b/keyboards/rate/pistachio/rev2/config.h @@ -0,0 +1,71 @@ +/* +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 + +/* + * 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 { B5, B4, E6, D7, C6, D4 } +#define MATRIX_COL_PINS { B6, B2, B3, B1, F7, F6, F5, F4, D3} +#define UNUSED_PINS + +#define USE_I2C + +/* COL2ROW, ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Split hand configration */ +#define SPLIT_HAND_MATRIX_GRID D4,D3 + +/* ws2812 RGB LED */ +#define RGB_DI_PIN D2 +#define RGBLIGHT_SPLIT +#define RGBLED_SPLIT { 38, 46 } +#define RGBLED_NUM 84 +#define RGBLIGHT_LIMIT_VAL 195 +#define RGBLIGHT_LAYERS +#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/rev2/readme.md b/keyboards/rate/pistachio/rev2/readme.md new file mode 100644 index 0000000000..12d9f6598f --- /dev/null +++ b/keyboards/rate/pistachio/rev2/readme.md @@ -0,0 +1,17 @@ +# pistachio Rev2 + +![pistachio](https://ratelog.net/wp-content/uploads/2021/05/s-IMG_1835.jpg) + +This is a 92-key split keyboard with JIS layout and spare keys. + +* Keyboard Maintainer: [rate](https://github.com/7-rate) [@7_rate](https://twitter.com/7_rate) +* Hardware Supported: pistachio PCB Rev2, Pro Micro, Backlight +* Hardware Availability: [PCB & Case Data](https://github.com/7-rate/Pistachio), [Booth Shop](https://rates.booth.pm/items/2237334) + +Make example for this keyboard (after setting up your build environment): + + make pistachio/rev2: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). + +[Build guide](https://ratelog.net/pistachio-build-guide/)
\ No newline at end of file diff --git a/keyboards/rate/pistachio/rev2/rev2.c b/keyboards/rate/pistachio/rev2/rev2.c new file mode 100644 index 0000000000..c6e64a526d --- /dev/null +++ b/keyboards/rate/pistachio/rev2/rev2.c @@ -0,0 +1,19 @@ +/* +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 "rev2.h" diff --git a/keyboards/rate/pistachio/rev2/rev2.h b/keyboards/rate/pistachio/rev2/rev2.h new file mode 100644 index 0000000000..750778a30e --- /dev/null +++ b/keyboards/rate/pistachio/rev2/rev2.h @@ -0,0 +1,58 @@ +/* +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" + +/* + * ,------------------------------------------------- ---------------------------------------------------------. + * | | L00 | | L01 | L02 | L03 | L04 | | L05 | | R00 | R01 | R02 | R03 | | R04 | R05 | R06 | R07 | | + * |-------------------------------------- ---------- ---------------------------------------------------------+ + * | L10 || L11 | L12 | L13 | L14 | L15 | L16 | L17 | | R10 | R11 | R12 | R13 | R14 | R15 | R16 | R17 || R18 | + * |------------------------------------------------- ---------------------------------------------------------+ + * | L20 || L21 | L22 | L23 | L24 | L25 | L26 | | R20 | R21 | R22 | R23 | R24 | R25 | R26 | R27 || R28 | + * |--------------------------------------------- ------------------------------------------- ------+ + * | L30 || L31 | L32 | L33 | L34 | L35 | L36 | | R30 | R31 | R32 | R33 | R34 | R35 | R36 | || R37 | + * |---------------------------------------------- -------------------------------------------------------+ + * | L40 || L41 | L42 | L43 | L44 | L45 | L46 | | R40 | R41 | R42 | R43 | R44 | R45 | R46 || R47 | + * |----------------------------------------------- -----------------------------------------------------+ + * | L50 || L51 | L52 | L53 | L54 | L55 | L56 | | R50 | R51 | R52 | R53 | R54 | R55 | R56 || R57 | + * |----------------------------------------------- ---------------------------------------------------- + */ +#define LAYOUT( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, R06, R07, \ + L10, L11, L12, L13, L14, L15, L16, L17, R10, R11, R12, R13, R14, R15, R16, R17, R18, \ + L20, L21, L22, L23, L24, L25, L26, R20, R21, R22, R23, R24, R25, R26, R28, \ + L30, L31, L32, L33, L34, L35, L36, R30, R31, R32, R33, R34, R35, R36, R27, R37, \ + L40, L41, L42, L43, L44, L45, L46, R40, R41, R42, R43, R44, R45, R46, R47, \ + L50, L51, L52, L53, L54, L55, L56, R50, R51, R52, R53, R54, R55, R56, R57 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05, KC_NO, KC_NO, KC_NO }, \ + { L10, L11, L12, L13, L14, L15, L16, L17, KC_NO }, \ + { L20, L21, L22, L23, L24, L25, L26, KC_NO, KC_NO }, \ + { L30, L31, L32, L33, L34, L35, L36, KC_NO, KC_NO }, \ + { L40, L41, L42, L43, L44, L45, L46, KC_NO, KC_NO }, \ + { L50, L51, L52, L53, L54, L55, L56, KC_NO, KC_NO }, \ + { R00, R01, R02, R03, R04, R05, R06, R07, KC_NO }, \ + { R10, R11, R12, R13, R14, R15, R16, R17, R18 }, \ + { R20, R21, R22, R23, R24, R25, R26, R28, KC_NO }, \ + { R30, R31, R32, R33, R34, R35, R36, R27, R37 }, \ + { R40, R41, R42, R43, R44, R45, R46, R47, KC_NO }, \ + { R50, R51, R52, R53, R54, R55, R56, R57, KC_NO } \ + } diff --git a/keyboards/rate/pistachio/rev2/rules.mk b/keyboards/rate/pistachio/rev2/rules.mk new file mode 100644 index 0000000000..909b1e68de --- /dev/null +++ b/keyboards/rate/pistachio/rev2/rules.mk @@ -0,0 +1,19 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +SPLIT_KEYBOARD = yes # Enable split keyboard diff --git a/keyboards/rate/pistachio/rules.mk b/keyboards/rate/pistachio/rules.mk new file mode 100644 index 0000000000..a5f4485316 --- /dev/null +++ b/keyboards/rate/pistachio/rules.mk @@ -0,0 +1 @@ +DEFAULT_FOLDER = rate/pistachio/rev2 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 diff --git a/keyboards/rate/pistachio_pro/config.h b/keyboards/rate/pistachio_pro/config.h new file mode 100644 index 0000000000..f268967f6e --- /dev/null +++ b/keyboards/rate/pistachio_pro/config.h @@ -0,0 +1,108 @@ +/* +Copyright 2021 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 "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x5255 +#define PRODUCT_ID 0xF40C +#define DEVICE_VER 0x0001 +#define MANUFACTURER rate +#define PRODUCT PistachioPro + +#define ENCODERS_PAD_A {D2} +#define ENCODERS_PAD_B {D3} + +/* key matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 18 + +#define MATRIX_ROW_PINS { D4, C6, D7, B3, B4, B5 } +#define MATRIX_COL_PINS { E6, F0, F1, F4, F5, F6, F7, B6, D6 } +#define UNUSED_PINS +/* 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 + +/* If defined, GRAVE_ESC will always act as ESC when CTRL is held. + * This is useful for the Windows task manager shortcut (ctrl+shift+esc). + */ +//#define GRAVE_ESC_CTRL_OVERRIDE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT + +/* disable these deprecated features by default */ +#define NO_ACTION_MACRO +#define NO_ACTION_FUNCTION + +/* Bootmagic Lite key configuration */ +//#define BOOTMAGIC_LITE_ROW 0 +//#define BOOTMAGIC_LITE_COLUMN 0 + +/* OLED */ +#define OLED_DISPLAY_128X64 +#define OLED_FONT_H "keyboards/rate/pistachio_pro/lib/glcdfont.c" + +#define OLED_FONT_WIDTH 6 +#define OLED_FONT_HEIGHT 6 + +#define OLED_UPDATE_INTERVAL 1000 + +#define OLED_TIMEOUT 0 + +#define OLED_BRIGHTNESS 255 diff --git a/keyboards/rate/pistachio_pro/info.json b/keyboards/rate/pistachio_pro/info.json new file mode 100644 index 0000000000..c519a69e11 --- /dev/null +++ b/keyboards/rate/pistachio_pro/info.json @@ -0,0 +1,106 @@ +{ + "keyboard_name": "PistachioPro", + "url": "https://rates.booth.pm/items/2925303", + "maintainer": "rate", + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"Esc", "x":0, "y":0}, + {"label":"F1", "x":2, "y":0}, + {"label":"F2", "x":3, "y":0}, + {"label":"F3", "x":4, "y":0}, + {"label":"F4", "x":5, "y":0}, + {"label":"F5", "x":6.5, "y":0}, + {"label":"F6", "x":7.5, "y":0}, + {"label":"F7", "x":8.5, "y":0}, + {"label":"F8", "x":9.5, "y":0}, + {"label":"F9", "x":11, "y":0}, + {"label":"F10", "x":12, "y":0}, + {"label":"F11", "x":13, "y":0}, + {"label":"F12", "x":14, "y":0}, + {"label":"Pause", "x":17.25, "y":0}, + + {"label":"E/J", "x":0, "y":1.5}, + {"label":"!", "x":1, "y":1.5}, + {"label":"\"", "x":2, "y":1.5}, + {"label":"#", "x":3, "y":1.5}, + {"label":"$", "x":4, "y":1.5}, + {"label":"%", "x":5, "y":1.5}, + {"label":"&", "x":6, "y":1.5}, + {"label":"'", "x":7, "y":1.5}, + {"label":"(", "x":8, "y":1.5}, + {"label":")", "x":9, "y":1.5}, + {"label":"", "x":10, "y":1.5}, + {"label":"=", "x":11, "y":1.5}, + {"label":"~", "x":12, "y":1.5}, + {"label":"|", "x":13, "y":1.5}, + {"label":"BS", "x":14, "y":1.5}, + {"label":"Insert", "x":15.25, "y":1.5}, + {"label":"Home", "x":16.25, "y":1.5}, + {"label":"PgUp", "x":17.25, "y":1.5}, + + {"label":"Tab", "x":0, "y":2.5, "w":1.5}, + {"label":"Q", "x":1.5, "y":2.5}, + {"label":"W", "x":2.5, "y":2.5}, + {"label":"E", "x":3.5, "y":2.5}, + {"label":"R", "x":4.5, "y":2.5}, + {"label":"T", "x":5.5, "y":2.5}, + {"label":"Y", "x":6.5, "y":2.5}, + {"label":"U", "x":7.5, "y":2.5}, + {"label":"I", "x":8.5, "y":2.5}, + {"label":"O", "x":9.5, "y":2.5}, + {"label":"P", "x":10.5, "y":2.5}, + {"label":"`", "x":11.5, "y":2.5}, + {"label":"{", "x":12.5, "y":2.5}, + {"label":"Delete", "x":15.25, "y":2.5}, + {"label":"End", "x":16.25, "y":2.5}, + {"label":"PgDn", "x":17.25, "y":2.5}, + + {"label":"Caps Lock", "x":0, "y":3.5, "w":1.75}, + {"label":"A", "x":1.75, "y":3.5}, + {"label":"S", "x":2.75, "y":3.5}, + {"label":"D", "x":3.75, "y":3.5}, + {"label":"F", "x":4.75, "y":3.5}, + {"label":"G", "x":5.75, "y":3.5}, + {"label":"H", "x":6.75, "y":3.5}, + {"label":"J", "x":7.75, "y":3.5}, + {"label":"K", "x":8.75, "y":3.5}, + {"label":"L", "x":9.75, "y":3.5}, + {"label":"+", "x":10.75, "y":3.5}, + {"label":"*", "x":11.75, "y":3.5}, + {"label":"}", "x":12.75, "y":3.5}, + {"label":"Enter", "x":13.75, "y":2.5, "w":1.25, "h":2}, + + {"label":"Shift", "x":0, "y":4.5, "w":2.25}, + {"label":"Z", "x":2.25, "y":4.5}, + {"label":"X", "x":3.25, "y":4.5}, + {"label":"C", "x":4.25, "y":4.5}, + {"label":"V", "x":5.25, "y":4.5}, + {"label":"B", "x":6.25, "y":4.5}, + {"label":"N", "x":7.25, "y":4.5}, + {"label":"M", "x":8.25, "y":4.5}, + {"label":"<", "x":9.25, "y":4.5}, + {"label":">", "x":10.25, "y":4.5}, + {"label":"?", "x":11.25, "y":4.5}, + {"label":"_", "x":12.25, "y":4.5}, + {"label":"Shift", "x":13.25, "y":4.5, "w":1.75}, + {"label":"\u2191", "x":16.25, "y":4.5}, + + {"label":"Ctrl", "x":0, "y":5.5, "w":1.25}, + {"label":"Win", "x":1.25, "y":5.5}, + {"label":"Alt", "x":2.25, "y":5.5, "w":1.25}, + {"x":3.5, "y":5.5}, + {"x":4.5, "y":5.5, "w":2.25}, + {"x":6.75, "y":5.5, "w":2.25}, + {"label":"kana", "x":9, "y":5.5, "w":1.25}, + {"x":10.25, "y":5.5, "w":1.25}, + {"label":"Alt", "x":11.5, "y":5.5, "w":1.25}, + {"label":"Menu", "x":12.75, "y":5.5}, + {"label":"Ctrl", "x":13.75, "y":5.5, "w":1.25}, + {"label":"\u2190", "x":15.25, "y":5.5}, + {"label":"\u2193", "x":16.25, "y":5.5}, + {"label":"\u2192", "x":17.25, "y":5.5} + ] + } + } +} diff --git a/keyboards/rate/pistachio_pro/keymaps/default/keymap.c b/keyboards/rate/pistachio_pro/keymaps/default/keymap.c new file mode 100644 index 0000000000..3fe6e8a5f5 --- /dev/null +++ b/keyboards/rate/pistachio_pro/keymaps/default/keymap.c @@ -0,0 +1,123 @@ +/* Copyright 2021 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 +#include <stdio.h> +#include "keymap_jp.h" +#include "lib/bme280.h" + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _BASE, + _FN +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [_BASE] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, + KC_ZKHK, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, JP_MINS, JP_CIRC, JP_YEN, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, JP_AT, JP_LBRC, KC_DEL, KC_END, KC_PGDN, + JP_EISU, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, JP_SCLN, JP_COLN, JP_RBRC, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, JP_COMM, JP_DOT, JP_SLSH, JP_BSLS, KC_RSFT, KC_UP, + KC_LCTRL, KC_LGUI, KC_LALT, JP_MHEN, KC_SPC, KC_SPC, LT(_FN, JP_HENK), JP_KANA, KC_RALT, KC_APP, KC_RCTRL, KC_LEFT, KC_DOWN, KC_RGHT + ), + [_FN] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_7, KC_8, KC_9, 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_4, KC_5, KC_6, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_1, KC_2, KC_3, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_0, JP_DOT, JP_DOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ) +}; + +/* OLED */ +const char code_to_name[60] = { + ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', + 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', + 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' ' +}; + +static void print_airstate(void) { + char airstate_str[32]; + double temp; + double press; + double hum; + + temp = bme280_getTemp(); + press = bme280_getPress(); + hum = bme280_getHum(); + + oled_write_ln_P(PSTR("\nTemp Press Hum"), false); + snprintf(airstate_str, sizeof(airstate_str), "%ddeg %dhPa %d%% \n", (int)temp, (int)press, (int)hum ); + oled_write(airstate_str, false); + + return; +} + +static keyrecord_t keylog_record; +static void print_keylog(void) { + char keylog_str[32]; + + oled_write_ln_P(PSTR("\nKeylog"), false); + snprintf(keylog_str, sizeof(keylog_str), "row:%d col:%d", keylog_record.event.key.row, keylog_record.event.key.col ); + oled_write(keylog_str, false); + + return; +} + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + return OLED_ROTATION_180; +} + +bool oled_task_user(void) { + oled_write_ln_P(PSTR(" - PistachioPro -"), false); + print_airstate(); + print_keylog(); + + return false; +} + +/* Encoder */ +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; +} + +/* Keyboard */ +void keyboard_post_init_user(void) { + bme280_init(); +} + +void housekeeping_task_user(void) { + bme280_exec(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + keylog_record = *record; + } + + return true; +} diff --git a/keyboards/rate/pistachio_pro/keymaps/default/readme.md b/keyboards/rate/pistachio_pro/keymaps/default/readme.md new file mode 100644 index 0000000000..bf313ec19d --- /dev/null +++ b/keyboards/rate/pistachio_pro/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for pistachio_pro diff --git a/keyboards/rate/pistachio_pro/keymaps/rate/keymap.c b/keyboards/rate/pistachio_pro/keymaps/rate/keymap.c new file mode 100644 index 0000000000..7aa70c51d1 --- /dev/null +++ b/keyboards/rate/pistachio_pro/keymaps/rate/keymap.c @@ -0,0 +1,125 @@ +/* Copyright 2021 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 +#include <stdio.h> +#include "keymap_jp.h" +#include "lib/bme280.h" + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _BASE, + _FN +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [_BASE] = LAYOUT( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MPLY, + KC_ZKHK, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, JP_MINS, JP_CIRC, JP_YEN, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, JP_AT, JP_LBRC, KC_DEL, KC_END, KC_PGDN, + KC_ENT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, JP_SCLN, JP_COLN, JP_RBRC, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, JP_COMM, JP_DOT, JP_SLSH, JP_BSLS, KC_RSFT, KC_UP, + KC_LCTRL, KC_LGUI, KC_LALT, KC_DEL, KC_SPC, KC_SPC, LT(_FN, KC_ESC), JP_KANA, KC_RALT, KC_APP, KC_RCTRL, KC_LEFT, KC_DOWN, KC_RGHT + ), + [_FN] = LAYOUT( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_7, KC_8, KC_9, 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_4, KC_5, KC_6, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_1, KC_2, KC_3, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_0, JP_DOT, JP_DOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ) +}; + + + +/* OLED */ +const char code_to_name[60] = { + ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', + 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', + 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' ' +}; + +static void print_airstate(void) { + char airstate_str[32]; + double temp; + double press; + double hum; + + temp = bme280_getTemp(); + press = bme280_getPress(); + hum = bme280_getHum(); + + oled_write_ln_P(PSTR("\nTemp Press Hum"), false); + snprintf(airstate_str, sizeof(airstate_str), "%ddeg %dhPa %d%% \n", (int)temp, (int)press, (int)hum ); + oled_write(airstate_str, false); + + return; +} + +static keyrecord_t keylog_record; +static void print_keylog(void) { + char keylog_str[32]; + + oled_write_ln_P(PSTR("\nKeylog"), false); + snprintf(keylog_str, sizeof(keylog_str), "row:%d col:%d", keylog_record.event.key.row, keylog_record.event.key.col ); + oled_write(keylog_str, false); + + return; +} + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + return OLED_ROTATION_180; +} + +bool oled_task_user(void) { + oled_write_ln_P(PSTR(" - PistachioPro -"), false); + print_airstate(); + print_keylog(); + + return false; +} + +/* Encoder */ +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; +} + +/* Keyboard */ +void keyboard_post_init_user(void) { + bme280_init(); +} + +void housekeeping_task_user(void) { + bme280_exec(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + keylog_record = *record; + } + + return true; +} diff --git a/keyboards/rate/pistachio_pro/keymaps/rate/readme.md b/keyboards/rate/pistachio_pro/keymaps/rate/readme.md new file mode 100644 index 0000000000..c7049b67ce --- /dev/null +++ b/keyboards/rate/pistachio_pro/keymaps/rate/readme.md @@ -0,0 +1 @@ +# The rate's keymap for pistachio_pro diff --git a/keyboards/rate/pistachio_pro/keymaps/via/keymap.c b/keyboards/rate/pistachio_pro/keymaps/via/keymap.c new file mode 100644 index 0000000000..f30254320b --- /dev/null +++ b/keyboards/rate/pistachio_pro/keymaps/via/keymap.c @@ -0,0 +1,179 @@ +/* Copyright 2021 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 +#include <stdio.h> +#include "keymap_jp.h" +#include "lib/bme280.h" + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _BASE, + _FN, + _RESERVE_0, + _RESERVE_1 +}; + +static uint8_t encoder_state = 0; +static const keypos_t ENC_CW = {.row = 0, .col = 14 }; +static const keypos_t ENC_CCW = {.row = 0, .col = 15 }; + +#define LAYOUT_via( \ + k000, k001, k002, k003, k004, k005, k006, k007, k008, k009, k010, k011, k012, ENC_CW, ENC_CCW, k013, \ + k100, k101, k102, k103, k104, k105, k106, k107, k108, k109, k110, k111, k112, k113, k114, k115, k116, k117, \ + k200, k201, k202, k203, k204, k205, k206, k207, k208, k209, k210, k211, k212, k213, k214, k215, \ + k300, k301, k302, k303, k304, k305, k306, k307, k308, k309, k310, k311, k312, k313, \ + k400, k401, k402, k403, k404, k405, k406, k407, k408, k409, k410, k411, k412, k413, \ + k500, k501, k502, k503, k504, k505, k506, k507, k508, k509, k510, k511, k512, k513 ) { \ + { k000, k001, k002, k003, k004, k005, k006, k007, k008, k009, k010, k011, k012, k013, ENC_CW, ENC_CCW, KC_NO, KC_NO }, \ + { k100, k101, k102, k103, k104, k105, k106, k107, k108, k109, k110, k111, k112, k113, k114, k115, k116, k117 }, \ + { k200, k201, k202, k203, k204, k205, k206, k207, k208, k209, k210, k211, k212, k213, k214, k215, KC_NO, KC_NO }, \ + { k300, k301, k302, k303, k304, k305, k306, k307, k308, k309, k310, k311, k312, k313, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { k400, k401, k402, k403, k404, k405, k406, k407, k408, k409, k410, k411, k412, k413, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { k500, k501, k502, k503, k504, k505, k506, k507, k508, k509, k510, k511, k512, k513, KC_NO, KC_NO, KC_NO, KC_NO } \ +} + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Base */ + [_BASE] = LAYOUT_via( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_VOLU,KC_VOLD,KC_MPLY, + KC_ZKHK, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, JP_MINS, JP_CIRC, JP_YEN, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, JP_AT, JP_LBRC, KC_DEL, KC_END, KC_PGDN, + JP_EISU, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, JP_SCLN, JP_COLN, JP_RBRC, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, JP_COMM, JP_DOT, JP_SLSH, JP_BSLS, KC_RSFT, KC_UP, + KC_LCTRL, KC_LGUI, KC_LALT, JP_MHEN, KC_SPC, KC_SPC, LT(_FN, JP_HENK), JP_KANA, KC_RALT, KC_APP, KC_RCTRL, KC_LEFT, KC_DOWN, KC_RGHT + ), + [_FN] = LAYOUT_via( + 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_VOLU,KC_VOLD,KC_MPLY, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_7, KC_8, KC_9, 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_4, KC_5, KC_6, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_1, KC_2, KC_3, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_0, JP_DOT, JP_DOT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + [_RESERVE_0] = LAYOUT_via( + 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_VOLU,KC_VOLD,KC_MPLY, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 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_1] = LAYOUT_via( + 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_VOLU,KC_VOLD,KC_MPLY, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 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 + ) +}; + +/* OLED */ +const char code_to_name[60] = { + ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', + 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', + 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' ' +}; + +static void print_airstate(void) { + char airstate_str[32]; + double temp; + double press; + double hum; + + temp = bme280_getTemp(); + press = bme280_getPress(); + hum = bme280_getHum(); + + oled_write_ln_P(PSTR("\nTemp Press Hum"), false); + snprintf(airstate_str, sizeof(airstate_str), "%ddeg %dhPa %d%% \n", (int)temp, (int)press, (int)hum ); + oled_write(airstate_str, false); + + return; +} + +static keyrecord_t keylog_record; +static void print_keylog(void) { + char keylog_str[32]; + + oled_write_ln_P(PSTR("\nKeylog"), false); + snprintf(keylog_str, sizeof(keylog_str), "row:%d col:%d", keylog_record.event.key.row, keylog_record.event.key.col ); + oled_write(keylog_str, false); + + return; +} + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + return OLED_ROTATION_180; +} + +bool oled_task_user(void) { + oled_write_ln_P(PSTR(" - PistachioPro -"), false); + print_airstate(); + print_keylog(); + + return false; +} + +/* Encoder */ +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); + } +} + +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); +} + +void matrix_scan_user(void) { + encoder_action_unregister(); +} + +bool encoder_update_user(uint8_t index, bool clockwise) { + encoder_action_register(index, clockwise); + return false; +} + +/* Keyboard */ +void keyboard_post_init_user(void) { + bme280_init(); +} + +void housekeeping_task_user(void) { + bme280_exec(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + keylog_record = *record; + } + + return true; +} diff --git a/keyboards/rate/pistachio_pro/keymaps/via/readme.md b/keyboards/rate/pistachio_pro/keymaps/via/readme.md new file mode 100644 index 0000000000..e2f4b9f6b2 --- /dev/null +++ b/keyboards/rate/pistachio_pro/keymaps/via/readme.md @@ -0,0 +1 @@ +# The via keymap for pistachio_pro diff --git a/keyboards/rate/pistachio_pro/keymaps/via/rules.mk b/keyboards/rate/pistachio_pro/keymaps/via/rules.mk new file mode 100644 index 0000000000..36b7ba9cbc --- /dev/null +++ b/keyboards/rate/pistachio_pro/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +LTO_ENABLE = yes diff --git a/keyboards/rate/pistachio_pro/lib/bme280.c b/keyboards/rate/pistachio_pro/lib/bme280.c new file mode 100644 index 0000000000..f3dc231dc5 --- /dev/null +++ b/keyboards/rate/pistachio_pro/lib/bme280.c @@ -0,0 +1,255 @@ +/* Copyright 2021 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 <stdint.h> +#include "bme280.h" +#include "i2c_master.h" + +#define BME280_ADDRESS (0x76<<1) + +#define BME280_REG_CALIB00 (0x88) +#define BME280_REG_CALIB25 (0xA1) +#define BME280_REG_CALIB26 (0xE1) +#define BME280_REG_CTRL_HUM (0xF2) +#define BME280_REG_CTRL_MEAS (0xF4) +#define BME280_REG_CONFIG (0xF5) +#define BME280_REG_PRESS_MSB (0xf7) + +#define I2C_BME280_TIMEOUT (20) + +/* BME280 configurator values */ +/* [2:0] Humidity oversampling + * 000 Skipped + * 001 oversampling x1 + * 010 oversampling x2 + * 011 oversampling x4 + * 100 oversampling x8 + * 101,others oversampling x16 + */ +#define BME280_CTRL_HUM_VAL (0x01) + + +/* [7:5] Pressure oversampling + * 000 Skipped + * 001 oversampling x1 + * 010 oversampling x2 + * 011 oversampling x4 + * 100 oversampling x8 + * 101,others oversampling x16 + * [4:2] Temperature oversampling + * 000 Skipped + * 001 oversampling x1 + * 010 oversampling x2 + * 011 oversampling x4 + * 100 oversampling x8 + * 101,others oversampling x16 + * [1:0] Mode + * 00 Sleep mode + * 11 Normal mode + */ +#define BME280_CTRL_MEAS_VAL (0x27) + +/* [7:5] t_standby[ms] + * 000 0.5 + * 001 62.5 + * 010 125 + * 011 250 + * 100 500 + * 101 1000 + * 110 10 + * 111 20 + * [4:2] Filter corefficient + * 000 Filter off + * 001 2 + * 010 4 + * 011 8 + * 100,others 16 + * [0] SPI interface + * 0 4-wire + * 1 3-wire + */ +#define BME280_CONFIG_VAL (0xA0) + +static void readTrim(void); +static void readData(void); +static int32_t calibration_T(int32_t adc_T); +static uint32_t calibration_P(int32_t adc_P); +static uint32_t calibration_H(int32_t adc_H); + +static uint32_t hum_raw,temp_raw,pres_raw; +static uint16_t dig_T1; +static int16_t dig_T2, dig_T3; +static uint16_t dig_P1; +static int16_t dig_P2, dig_P3, dig_P4, dig_P5, dig_P6, dig_P7, dig_P8, dig_P9; +static uint8_t dig_H1, dig_H3; +static int16_t dig_H2, dig_H4, dig_H5; +static int8_t dig_H6; +static int32_t t_fine; + +/* Private */ +static void readTrim(void) { + uint8_t data[32]; + + i2c_readReg(BME280_ADDRESS, BME280_REG_CALIB00, &data[0], 24, I2C_BME280_TIMEOUT); + i2c_readReg(BME280_ADDRESS, BME280_REG_CALIB25, &data[25], 1, I2C_BME280_TIMEOUT); + i2c_readReg(BME280_ADDRESS, BME280_REG_CALIB26, &data[25], 7, I2C_BME280_TIMEOUT); + + dig_T1 = (data[1] << 8) | data[0]; + dig_T2 = (data[3] << 8) | data[2]; + dig_T3 = (data[5] << 8) | data[4]; + dig_P1 = (data[7] << 8) | data[6]; + dig_P2 = (data[9] << 8) | data[8]; + dig_P3 = (data[11]<< 8) | data[10]; + dig_P4 = (data[13]<< 8) | data[12]; + dig_P5 = (data[15]<< 8) | data[14]; + dig_P6 = (data[17]<< 8) | data[16]; + dig_P7 = (data[19]<< 8) | data[18]; + dig_P8 = (data[21]<< 8) | data[20]; + dig_P9 = (data[23]<< 8) | data[22]; + dig_H1 = data[24]; + dig_H2 = (data[26]<< 8) | data[25]; + dig_H3 = data[27]; + dig_H4 = (data[28]<< 4) | (0x0F & data[29]); + dig_H5 = (data[30] << 4) | ((data[29] >> 4) & 0x0F); + dig_H6 = data[31]; + + return; +} + +static void readData(void) { + uint8_t data[8]; + + i2c_readReg(BME280_ADDRESS, 0xF7, &data[0], 8, I2C_BME280_TIMEOUT); + + pres_raw = data[0]; + pres_raw = (pres_raw<<8) | data[1]; + pres_raw = (pres_raw<<4) | (data[2] >> 4); + + temp_raw = data[3]; + temp_raw = (temp_raw<<8) | data[4]; + temp_raw = (temp_raw<<4) | (data[5] >> 4); + + hum_raw = data[6]; + hum_raw = (hum_raw << 8) | data[7]; + + return; +} + +static int32_t calibration_T(int32_t adc_T) { + int32_t var1, var2, T; + var1 = ((((adc_T >> 3) - ((int32_t)dig_T1<<1))) * ((int32_t)dig_T2)) >> 11; + var2 = (((((adc_T >> 4) - ((int32_t)dig_T1)) * ((adc_T>>4) - ((int32_t)dig_T1))) >> 12) * ((int32_t)dig_T3)) >> 14; + + t_fine = var1 + var2; + T = (t_fine * 5 + 128) >> 8; + + return T; +} + +static uint32_t calibration_P(int32_t adc_P) { + int32_t var1, var2; + uint32_t P; + + var1 = (((int32_t)t_fine)>>1) - (int32_t)64000; + var2 = (((var1>>2) * (var1>>2)) >> 11) * ((int32_t)dig_P6); + var2 = var2 + ((var1*((int32_t)dig_P5))<<1); + var2 = (var2>>2)+(((int32_t)dig_P4)<<16); + var1 = (((dig_P3 * (((var1>>2)*(var1>>2)) >> 13)) >>3) + ((((int32_t)dig_P2) * var1)>>1))>>18; + var1 = ((((32768+var1))*((int32_t)dig_P1))>>15); + if (var1 == 0) { + return 0; + } + P = (((uint32_t)(((int32_t)1048576)-adc_P)-(var2>>12)))*3125; + if( P < 0x80000000 ) { + P = (P << 1) / ((uint32_t) var1); + } else { + P = (P / (uint32_t)var1) * 2; + } + var1 = (((int32_t)dig_P9) * ((int32_t)(((P>>3) * (P>>3))>>13)))>>12; + var2 = (((int32_t)(P>>2)) * ((int32_t)dig_P8))>>13; + P = (uint32_t)((int32_t)P + ((var1 + var2 + dig_P7) >> 4)); + + return P; +} + +static uint32_t calibration_H(int32_t adc_H) { + int32_t v_x1; + + v_x1 = (t_fine - ((int32_t)76800)); + v_x1 = (((((adc_H << 14) -(((int32_t)dig_H4) << 20) - (((int32_t)dig_H5) * v_x1)) + + ((int32_t)16384)) >> 15) * (((((((v_x1 * ((int32_t)dig_H6)) >> 10) * + (((v_x1 * ((int32_t)dig_H3)) >> 11) + ((int32_t) 32768))) >> 10) + (( int32_t)2097152)) * + ((int32_t) dig_H2) + 8192) >> 14)); + v_x1 = (v_x1 - (((((v_x1 >> 15) * (v_x1 >> 15)) >> 7) * ((int32_t)dig_H1)) >> 4)); + v_x1 = (v_x1 < 0 ? 0 : v_x1); + v_x1 = (v_x1 > 419430400 ? 419430400 : v_x1); + + return (uint32_t)(v_x1 >> 12); +} + +/* Public */ +void bme280_init(void) { + uint8_t ctrl_hum_reg; + uint8_t ctrl_meas_reg; + uint8_t config_reg; + + ctrl_hum_reg = BME280_CTRL_HUM_VAL; + ctrl_meas_reg = BME280_CTRL_MEAS_VAL; + config_reg = BME280_CONFIG_VAL; + + i2c_init(); + i2c_writeReg(BME280_ADDRESS, BME280_REG_CTRL_HUM, &ctrl_hum_reg, 1, I2C_BME280_TIMEOUT); + i2c_writeReg(BME280_ADDRESS, BME280_REG_CTRL_MEAS, &ctrl_meas_reg, 1, I2C_BME280_TIMEOUT); + i2c_writeReg(BME280_ADDRESS, BME280_REG_CONFIG, &config_reg, 1, I2C_BME280_TIMEOUT); + readTrim(); + + return; +} + +void bme280_exec(void) { + readData(); + + return; +} + +double bme280_getTemp(void) { + double temp_act; + int32_t temp_cal; + + temp_cal = calibration_T(temp_raw); + temp_act = (double)temp_cal / 100.0; + + return temp_act; +} + +double bme280_getPress(void) { + double press_act; + uint32_t press_cal; + + press_cal = calibration_P(pres_raw); + press_act = (double)press_cal / 100.0; + + return press_act; +} + +double bme280_getHum(void) { + double hum_act; + uint32_t hum_cal; + + hum_cal = calibration_H(hum_raw); + hum_act = (double)hum_cal / 1024.0; + + return hum_act; +} diff --git a/keyboards/rate/pistachio_pro/lib/bme280.h b/keyboards/rate/pistachio_pro/lib/bme280.h new file mode 100644 index 0000000000..eb503038d3 --- /dev/null +++ b/keyboards/rate/pistachio_pro/lib/bme280.h @@ -0,0 +1,22 @@ +/* Copyright 2021 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 + +void bme280_init(void); +void bme280_exec(void); +double bme280_getTemp(void); +double bme280_getPress(void); +double bme280_getHum(void); diff --git a/keyboards/rate/pistachio_pro/lib/glcdfont.c b/keyboards/rate/pistachio_pro/lib/glcdfont.c new file mode 100644 index 0000000000..41041f12bb --- /dev/null +++ b/keyboards/rate/pistachio_pro/lib/glcdfont.c @@ -0,0 +1,232 @@ +// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. +// See gfxfont.h for newer custom bitmap font info. + +#include "progmem.h" + +// Standard ASCII 5x7 font +const unsigned char font[] PROGMEM = { +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, +0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, +0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, +0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, +0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, +0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, +0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, +0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, +0x00, 0x18, 0x24, 0x18, 0x00, 0x00, +0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, +0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, +0x26, 0x29, 0x79, 0x29, 0x26, 0x00, +0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, +0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, +0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00, +0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, +0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, +0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, +0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, +0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, +0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, +0x60, 0x60, 0x60, 0x60, 0x60, 0x00, +0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, +0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, +0x10, 0x20, 0x7E, 0x20, 0x10, 0x00, +0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, +0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, +0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, +0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, +0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, +0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, +0x00, 0x07, 0x00, 0x07, 0x00, 0x00, +0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, +0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, +0x23, 0x13, 0x08, 0x64, 0x62, 0x00, +0x36, 0x49, 0x56, 0x20, 0x50, 0x00, +0x00, 0x08, 0x07, 0x03, 0x00, 0x00, +0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, +0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, +0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, +0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, +0x00, 0x80, 0x70, 0x30, 0x00, 0x00, +0x08, 0x08, 0x08, 0x08, 0x08, 0x00, +0x00, 0x00, 0x60, 0x60, 0x00, 0x00, +0x20, 0x10, 0x08, 0x04, 0x02, 0x00, +0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, +0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, +0x72, 0x49, 0x49, 0x49, 0x46, 0x00, +0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, +0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, +0x27, 0x45, 0x45, 0x45, 0x39, 0x00, +0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, +0x41, 0x21, 0x11, 0x09, 0x07, 0x00, +0x36, 0x49, 0x49, 0x49, 0x36, 0x00, +0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, +0x00, 0x00, 0x14, 0x00, 0x00, 0x00, +0x00, 0x40, 0x34, 0x00, 0x00, 0x00, +0x00, 0x08, 0x14, 0x22, 0x41, 0x00, +0x14, 0x14, 0x14, 0x14, 0x14, 0x00, +0x00, 0x41, 0x22, 0x14, 0x08, 0x00, +0x02, 0x01, 0x59, 0x09, 0x06, 0x00, +0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, +0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, +0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, +0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, +0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, +0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, +0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, +0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, +0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, +0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, +0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, +0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, +0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, +0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, +0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, +0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, +0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, +0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, +0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, +0x26, 0x49, 0x49, 0x49, 0x32, 0x00, +0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, +0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, +0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, +0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, +0x63, 0x14, 0x08, 0x14, 0x63, 0x00, +0x03, 0x04, 0x78, 0x04, 0x03, 0x00, +0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, +0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, +0x02, 0x04, 0x08, 0x10, 0x20, 0x00, +0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, +0x04, 0x02, 0x01, 0x02, 0x04, 0x00, +0x40, 0x40, 0x40, 0x40, 0x40, 0x00, +0x00, 0x03, 0x07, 0x08, 0x00, 0x00, +0x20, 0x54, 0x54, 0x78, 0x40, 0x00, +0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, +0x38, 0x44, 0x44, 0x44, 0x28, 0x00, +0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, +0x38, 0x54, 0x54, 0x54, 0x18, 0x00, +0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, +0x18, 0x24, 0x24, 0x1C, 0x78, 0x00, +0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, +0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, +0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, +0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, +0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, +0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, +0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, +0x38, 0x44, 0x44, 0x44, 0x38, 0x00, +0x7C, 0x18, 0x24, 0x24, 0x18, 0x00, +0x18, 0x24, 0x24, 0x18, 0x7C, 0x00, +0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, +0x48, 0x54, 0x54, 0x54, 0x24, 0x00, +0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, +0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, +0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, +0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, +0x44, 0x28, 0x10, 0x28, 0x44, 0x00, +0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00, +0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, +0x00, 0x08, 0x36, 0x41, 0x00, 0x00, +0x00, 0x00, 0x77, 0x00, 0x00, 0x00, +0x00, 0x41, 0x36, 0x08, 0x00, 0x00, +0x02, 0x01, 0x02, 0x04, 0x02, 0x00, +0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, +0xF0, 0xF8, 0xF8, 0x18, 0x00, 0xC0, +0xF0, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, +0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x80, 0xC0, 0xE0, 0xE0, +0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, +0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, +0x80, 0xC0, 0xE0, 0xE0, 0xE0, 0xE0, +0xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0x80, +0x00, 0x00, 0x00, 0xE0, 0xE0, 0xC0, +0xC0, 0xE0, 0xE0, 0xE0, 0xE0, 0x00, +0x00, 0xE0, 0xE0, 0xC0, 0xC0, 0xE0, +0xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0x80, +0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, +0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, +0xE0, 0xE0, 0xC0, 0x80, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, +0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, +0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, +0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00, +0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B, +0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00, +0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE, +0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0xF8, 0xFC, 0xFE, +0xFF, 0xE0, 0x00, 0xFF, 0xFF, 0xFF, +0xFF, 0xFF, 0xFF, 0x80, 0xFF, 0xFF, +0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, +0xFF, 0x1F, 0x07, 0x01, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0xFF, 0xFF, 0xFF, 0x81, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x81, +0xC3, 0xC3, 0xC3, 0x00, 0x00, 0xFF, +0xFF, 0xFF, 0x81, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x81, 0xFF, 0xFF, +0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, +0x01, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0xFF, 0xFF, 0xFF, 0x01, 0x00, +0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, +0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, +0x9D, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, +0x1C, 0x9D, 0xDF, 0xDF, 0xDF, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, +0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, +0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, +0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00, +0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20, +0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00, +0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F, +0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x03, 0x0F, 0x1F, +0x3F, 0x3F, 0x3F, 0x3F, 0x1F, 0x1F, +0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x3F, +0x3F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, +0x7F, 0x7C, 0x78, 0x78, 0x38, 0x1C, +0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x01, 0x03, 0x07, 0x07, +0x07, 0x07, 0x07, 0x07, 0x07, 0x07, +0x03, 0x01, 0x00, 0x00, 0x00, 0x00, +0x01, 0x03, 0x07, 0x07, 0x07, 0x07, +0x07, 0x07, 0x07, 0x07, 0x03, 0x01, +0x00, 0x00, 0x00, 0x07, 0x07, 0x07, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x07, 0x07, 0x07, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x07, 0x07, +0x07, 0x00, 0x00, 0x00, 0x01, 0x03, +0x07, 0x07, 0x07, 0x07, 0x07, 0x07, +0x07, 0x07, 0x03, 0x01, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; diff --git a/keyboards/rate/pistachio_pro/matrix.c b/keyboards/rate/pistachio_pro/matrix.c new file mode 100644 index 0000000000..6cbfb6dfea --- /dev/null +++ b/keyboards/rate/pistachio_pro/matrix.c @@ -0,0 +1,151 @@ +/* +Copyright 2012-2018 Jun Wako, Jack Humbert, Yiancar + +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 <stdint.h> +#include <stdbool.h> +#include "matrix.h" +#include "quantum.h" + +static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +static inline void setPinOutput_writeLow(pin_t pin) { + ATOMIC_BLOCK_FORCEON { + setPinOutput(pin); + writePinLow(pin); + } +} + +static inline void setPinInputHigh_atomic(pin_t pin) { + ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); } +} + +static void select_row(uint8_t row) { + setPinOutput_writeLow(row_pins[row]); +} + +static void unselect_row(uint8_t row) { + setPinInputHigh_atomic(row_pins[row]); +} + +static void unselect_rows(void) { + for (uint8_t x = 0; x < MATRIX_ROWS; x++) { + setPinInputHigh_atomic(row_pins[x]); + } +} + +static void select_col(uint8_t col) { + setPinOutput_writeLow(col_pins[col]); +} + +static void unselect_col(uint8_t col) { + setPinInputHigh_atomic(col_pins[col]); +} + +static void unselect_cols(void) { + for (uint8_t x = 0; x < MATRIX_COLS; x++) { + setPinInputHigh_atomic(col_pins[x]); + } +} + +static void init_pins(void) { + unselect_rows(); + for (uint8_t x = 0; x < MATRIX_COLS; x++) { + setPinInputHigh_atomic(col_pins[x]); + } + unselect_cols(); + for (uint8_t x = 0; x < MATRIX_ROWS; x++) { + setPinInputHigh_atomic(row_pins[x]); + } +} + +static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[current_row]; + + // Select row + select_row(current_row); + matrix_io_delay(); + + // For each col... + for (uint8_t col_index = 0; col_index < MATRIX_COLS / 2; col_index++) { + // Check row pin state + if (readPin(col_pins[col_index])) { + // Pin HI, clear col bit + current_matrix[current_row] &= ~(MATRIX_ROW_SHIFTER << col_index); + } else { + // Pin LO, set col bit + current_matrix[current_row] |= (MATRIX_ROW_SHIFTER << col_index); + } + } + + // Unselect row + unselect_row(current_row); + + return (last_row_value != current_matrix[current_row]); +} + +static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { + bool matrix_changed = false; + + // Select col + select_col(current_col); + matrix_io_delay(); + + // For each row... + for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) { + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[row_index]; + + // Check row pin state + if (readPin(row_pins[row_index])) { + // Pin HI, clear col bit + current_matrix[row_index] &= ~(MATRIX_ROW_SHIFTER << ( current_col + MATRIX_COLS/2)); + } else { + // Pin LO, set col bit + current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << ( current_col + MATRIX_COLS/2)); + } + + // Determine if the matrix changed state + if ((last_row_value != current_matrix[row_index]) && !(matrix_changed)) { + matrix_changed = true; + } + } + + // Unselect col + unselect_col(current_col); + + return matrix_changed; +} + +void matrix_init_custom(void) { + init_pins(); +} + +bool matrix_scan_custom(matrix_row_t current_matrix[]) { + bool changed = false; + + // Set row, read cols + for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) { + changed |= read_cols_on_row(current_matrix, current_row); + } + // Set col, read rows + for (uint8_t current_col = 0; current_col < (MATRIX_COLS/2); current_col++) { + changed |= read_rows_on_col(current_matrix, current_col); + } + + return (uint8_t)changed; +} diff --git a/keyboards/rate/pistachio_pro/pistachio_pro.c b/keyboards/rate/pistachio_pro/pistachio_pro.c new file mode 100644 index 0000000000..fda14471b7 --- /dev/null +++ b/keyboards/rate/pistachio_pro/pistachio_pro.c @@ -0,0 +1,17 @@ +/* Copyright 2021 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_pro.h" diff --git a/keyboards/rate/pistachio_pro/pistachio_pro.h b/keyboards/rate/pistachio_pro/pistachio_pro.h new file mode 100644 index 0000000000..42de95ea87 --- /dev/null +++ b/keyboards/rate/pistachio_pro/pistachio_pro.h @@ -0,0 +1,42 @@ +/* Copyright 2021 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" + +/* This is a shortcut to help you visually see your layout. + * + * The first section contains all of the arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ +#define LAYOUT( \ + k000, k001, k002, k003, k004, k005, k006, k007, k008, k009, k010, k011, k012, k013, \ + k100, k101, k102, k103, k104, k105, k106, k107, k108, k109, k110, k111, k112, k113, k114, k115, k116, k117, \ + k200, k201, k202, k203, k204, k205, k206, k207, k208, k209, k210, k211, k212, k213, k214, k215, \ + k300, k301, k302, k303, k304, k305, k306, k307, k308, k309, k310, k311, k312, k313, \ + k400, k401, k402, k403, k404, k405, k406, k407, k408, k409, k410, k411, k412, k413, \ + k500, k501, k502, k503, k504, k505, k506, k507, k508, k509, k510, k511, k512, k513 ) { \ + { k000, k001, k002, k003, k004, k005, k006, k007, k008, k009, k010, k011, k012, k013, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { k100, k101, k102, k103, k104, k105, k106, k107, k108, k109, k110, k111, k112, k113, k114, k115, k116, k117 }, \ + { k200, k201, k202, k203, k204, k205, k206, k207, k208, k209, k210, k211, k212, k213, k214, k215, KC_NO, KC_NO }, \ + { k300, k301, k302, k303, k304, k305, k306, k307, k308, k309, k310, k311, k312, k313, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { k400, k401, k402, k403, k404, k405, k406, k407, k408, k409, k410, k411, k412, k413, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { k500, k501, k502, k503, k504, k505, k506, k507, k508, k509, k510, k511, k512, k513, KC_NO, KC_NO, KC_NO, KC_NO } \ +} diff --git a/keyboards/rate/pistachio_pro/readme.md b/keyboards/rate/pistachio_pro/readme.md new file mode 100644 index 0000000000..752f98b73b --- /dev/null +++ b/keyboards/rate/pistachio_pro/readme.md @@ -0,0 +1,21 @@ +# PistachioPro + +![PistachioPro](https://ratelog.net/wp-content/uploads/2021/07/PistachioPro-scaled.jpg) + +This is a JIS layout TKL keyboard with 89 keys, encoder and OLED. + +* Keyboard Maintainer: [rate](https://github.com/7-rate) +* Hardware Supported: PistachioPro PCB, +* Hardware Availability: [Booth Shop](https://rates.booth.pm/items/2925303) + +Make example for this keyboard (after setting up your build environment): + + make rate/pistachio_pro:default + +Flashing example for this keyboard: + + make rate/pistachio_pro:default:flash + +To reset the keyboard into bootloader mode, press the reset switch on the underside. + +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). diff --git a/keyboards/rate/pistachio_pro/rules.mk b/keyboards/rate/pistachio_pro/rules.mk new file mode 100644 index 0000000000..6816d8d32b --- /dev/null +++ b/keyboards/rate/pistachio_pro/rules.mk @@ -0,0 +1,25 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = atmel-dfu + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = no # 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 = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +OLED_ENABLE = yes +OLED_DRIVER = SSD1306 +ENCODER_ENABLE = yes + +CUSTOM_MATRIX = lite +SRC += matrix.c +SRC += ./lib/bme280.c |