summaryrefslogtreecommitdiffstats
path: root/keyboards
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/pistachio_pro/config.h108
-rw-r--r--keyboards/pistachio_pro/info.json101
-rw-r--r--keyboards/pistachio_pro/keymaps/default/keymap.c123
-rw-r--r--keyboards/pistachio_pro/keymaps/default/readme.md1
-rw-r--r--keyboards/pistachio_pro/keymaps/rate/keymap.c125
-rw-r--r--keyboards/pistachio_pro/keymaps/rate/readme.md1
-rw-r--r--keyboards/pistachio_pro/keymaps/via/keymap.c141
-rw-r--r--keyboards/pistachio_pro/keymaps/via/readme.md1
-rw-r--r--keyboards/pistachio_pro/keymaps/via/rules.mk1
-rw-r--r--keyboards/pistachio_pro/lib/bme280.c255
-rw-r--r--keyboards/pistachio_pro/lib/bme280.h22
-rw-r--r--keyboards/pistachio_pro/lib/glcdfont.c232
-rw-r--r--keyboards/pistachio_pro/matrix.c151
-rw-r--r--keyboards/pistachio_pro/pistachio_pro.c17
-rw-r--r--keyboards/pistachio_pro/pistachio_pro.h42
-rw-r--r--keyboards/pistachio_pro/readme.md21
-rw-r--r--keyboards/pistachio_pro/rules.mk28
17 files changed, 1370 insertions, 0 deletions
diff --git a/keyboards/pistachio_pro/config.h b/keyboards/pistachio_pro/config.h
new file mode 100644
index 0000000000..6c95e0f808
--- /dev/null
+++ b/keyboards/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, D5,}
+#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/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/pistachio_pro/info.json b/keyboards/pistachio_pro/info.json
new file mode 100644
index 0000000000..81035fe798
--- /dev/null
+++ b/keyboards/pistachio_pro/info.json
@@ -0,0 +1,101 @@
+{
+ "keyboard_name": "PistachioPro",
+ "url": "https://rates.booth.pm/items/2925303",
+ "maintainer": "rate",
+ "width": 18.25,
+ "height": 6.5,
+ "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":"Enter", "x":13.75, "y":2.5, "w":1.25, "h":2},
+ {"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":"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}]
+ }
+ }
+} \ No newline at end of file
diff --git a/keyboards/pistachio_pro/keymaps/default/keymap.c b/keyboards/pistachio_pro/keymaps/default/keymap.c
new file mode 100644
index 0000000000..a79b9a2b52
--- /dev/null
+++ b/keyboards/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;
+}
+
+void oled_task_user(void) {
+ oled_write_ln_P(PSTR(" - PistachioPro -"), false);
+ print_airstate();
+ print_keylog();
+
+ return;
+}
+
+/* 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;
+} \ No newline at end of file
diff --git a/keyboards/pistachio_pro/keymaps/default/readme.md b/keyboards/pistachio_pro/keymaps/default/readme.md
new file mode 100644
index 0000000000..2bc50be9dd
--- /dev/null
+++ b/keyboards/pistachio_pro/keymaps/default/readme.md
@@ -0,0 +1 @@
+# The default keymap for pistachio_mp
diff --git a/keyboards/pistachio_pro/keymaps/rate/keymap.c b/keyboards/pistachio_pro/keymaps/rate/keymap.c
new file mode 100644
index 0000000000..e08e167700
--- /dev/null
+++ b/keyboards/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;
+}
+
+void oled_task_user(void) {
+ oled_write_ln_P(PSTR(" - PistachioPro -"), false);
+ print_airstate();
+ print_keylog();
+
+ return;
+}
+
+/* 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;
+} \ No newline at end of file
diff --git a/keyboards/pistachio_pro/keymaps/rate/readme.md b/keyboards/pistachio_pro/keymaps/rate/readme.md
new file mode 100644
index 0000000000..b355dced23
--- /dev/null
+++ b/keyboards/pistachio_pro/keymaps/rate/readme.md
@@ -0,0 +1 @@
+# The rate's keymap for pistachio_mp
diff --git a/keyboards/pistachio_pro/keymaps/via/keymap.c b/keyboards/pistachio_pro/keymaps/via/keymap.c
new file mode 100644
index 0000000000..833bbb8ecc
--- /dev/null
+++ b/keyboards/pistachio_pro/keymaps/via/keymap.c
@@ -0,0 +1,141 @@
+/* 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
+};
+
+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
+ ),
+ [_RESERVE_0] = 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_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(
+ 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,
+ 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;
+}
+
+void oled_task_user(void) {
+ oled_write_ln_P(PSTR(" - PistachioPro -"), false);
+ print_airstate();
+ print_keylog();
+
+ return;
+}
+
+/* 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;
+} \ No newline at end of file
diff --git a/keyboards/pistachio_pro/keymaps/via/readme.md b/keyboards/pistachio_pro/keymaps/via/readme.md
new file mode 100644
index 0000000000..b768049ccc
--- /dev/null
+++ b/keyboards/pistachio_pro/keymaps/via/readme.md
@@ -0,0 +1 @@
+# The via keymap for pistachio_mp
diff --git a/keyboards/pistachio_pro/keymaps/via/rules.mk b/keyboards/pistachio_pro/keymaps/via/rules.mk
new file mode 100644
index 0000000000..036bd6d1c3
--- /dev/null
+++ b/keyboards/pistachio_pro/keymaps/via/rules.mk
@@ -0,0 +1 @@
+VIA_ENABLE = yes \ No newline at end of file
diff --git a/keyboards/pistachio_pro/lib/bme280.c b/keyboards/pistachio_pro/lib/bme280.c
new file mode 100644
index 0000000000..f3dc231dc5
--- /dev/null
+++ b/keyboards/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 {