aboutsummaryrefslogtreecommitdiff
path: root/keyboards/pistachio_pro
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/pistachio_pro')
-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 000000000..6c95e0f80
--- /dev/null
+++ b/keyboards/pistachio_pro/config.h
@@ -0,0 +1,108 @@
1/*
2Copyright 2021 rate
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#pragma once
19
20#include "config_common.h"
21
22/* USB Device descriptor parameter */
23#define VENDOR_ID 0x5255
24#define PRODUCT_ID 0xF40C
25#define DEVICE_VER 0x0001
26#define MANUFACTURER rate
27#define PRODUCT PistachioPro
28
29#define ENCODERS_PAD_A {D2}
30#define ENCODERS_PAD_B {D3}
31
32/* key matrix size */
33#define MATRIX_ROWS 6
34#define MATRIX_COLS 18
35
36#define MATRIX_ROW_PINS { D4, C6, D7, B3, B4, B5 }
37#define MATRIX_COL_PINS { E6, F0, F1, F4, F5, F6, F7, B6, D6, D5,}
38#define UNUSED_PINS
39/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
40#define DEBOUNCE 5
41
42/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
43#define LOCKING_SUPPORT_ENABLE
44/* Locking resynchronize hack */
45#define LOCKING_RESYNC_ENABLE
46
47/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
48 * This is useful for the Windows task manager shortcut (ctrl+shift+esc).
49 */
50//#define GRAVE_ESC_CTRL_OVERRIDE
51
52/*
53 * Force NKRO
54 *
55 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
56 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
57 * makefile for this to work.)
58 *
59 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
60 * until the next keyboard reset.
61 *
62 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
63 * fully operational during normal computer usage.
64 *
65 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
66 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
67 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
68 * power-up.
69 *
70 */
71//#define FORCE_NKRO
72
73/*
74 * Feature disable options
75 * These options are also useful to firmware size reduction.
76 */
77
78/* disable debug print */
79//#define NO_DEBUG
80
81/* disable print */
82//#define NO_PRINT
83
84/* disable action features */
85//#define NO_ACTION_LAYER
86//#define NO_ACTION_TAPPING
87//#define NO_ACTION_ONESHOT
88
89/* disable these deprecated features by default */
90#define NO_ACTION_MACRO
91#define NO_ACTION_FUNCTION
92
93/* Bootmagic Lite key configuration */
94//#define BOOTMAGIC_LITE_ROW 0
95//#define BOOTMAGIC_LITE_COLUMN 0
96
97/* OLED */
98#define OLED_DISPLAY_128X64
99#define OLED_FONT_H "keyboards/pistachio_pro/lib/glcdfont.c"
100
101#define OLED_FONT_WIDTH 6
102#define OLED_FONT_HEIGHT 6
103
104#define OLED_UPDATE_INTERVAL 1000
105
106#define OLED_TIMEOUT 0
107
108#define OLED_BRIGHTNESS 255
diff --git a/keyboards/pistachio_pro/info.json b/keyboards/pistachio_pro/info.json
new file mode 100644
index 000000000..81035fe79
--- /dev/null
+++ b/keyboards/pistachio_pro/info.json
@@ -0,0 +1,101 @@
1{
2 "keyboard_name": "PistachioPro",
3 "url": "https://rates.booth.pm/items/2925303",
4 "maintainer": "rate",
5 "width": 18.25,
6 "height": 6.5,
7 "layouts": {
8 "LAYOUT": {
9 "layout": [{"label":"Esc", "x":0, "y":0},
10 {"label":"F1", "x":2, "y":0},
11 {"label":"F2", "x":3, "y":0},
12 {"label":"F3", "x":4, "y":0},
13 {"label":"F4", "x":5, "y":0},
14 {"label":"F5", "x":6.5, "y":0},
15 {"label":"F6", "x":7.5, "y":0},
16 {"label":"F7", "x":8.5, "y":0},
17 {"label":"F8", "x":9.5, "y":0},
18 {"label":"F9", "x":11, "y":0},
19 {"label":"F10", "x":12, "y":0},
20 {"label":"F11", "x":13, "y":0},
21 {"label":"F12", "x":14, "y":0},
22 {"label":"Pause", "x":17.25, "y":0},
23 {"label":"E/J", "x":0, "y":1.5},
24 {"label":"!", "x":1, "y":1.5},
25 {"label":"\"", "x":2, "y":1.5},
26 {"label":"#", "x":3, "y":1.5},
27 {"label":"$", "x":4, "y":1.5},
28 {"label":"%", "x":5, "y":1.5},
29 {"label":"&", "x":6, "y":1.5},
30 {"label":"'", "x":7, "y":1.5},
31 {"label":"(", "x":8, "y":1.5},
32 {"label":")", "x":9, "y":1.5},
33 {"label":"", "x":10, "y":1.5},
34 {"label":"=", "x":11, "y":1.5},
35 {"label":"~", "x":12, "y":1.5},
36 {"label":"|", "x":13, "y":1.5},
37 {"label":"BS", "x":14, "y":1.5},
38 {"label":"Insert", "x":15.25, "y":1.5},
39 {"label":"Home", "x":16.25, "y":1.5},
40 {"label":"PgUp", "x":17.25, "y":1.5},
41 {"label":"Tab", "x":0, "y":2.5, "w":1.5},
42 {"label":"Q", "x":1.5, "y":2.5},
43 {"label":"W", "x":2.5, "y":2.5},
44 {"label":"E", "x":3.5, "y":2.5},
45 {"label":"R", "x":4.5, "y":2.5},
46 {"label":"T", "x":5.5, "y":2.5},
47 {"label":"Y", "x":6.5, "y":2.5},
48 {"label":"U", "x":7.5, "y":2.5},
49 {"label":"I", "x":8.5, "y":2.5},
50 {"label":"O", "x":9.5, "y":2.5},
51 {"label":"P", "x":10.5, "y":2.5},
52 {"label":"`", "x":11.5, "y":2.5},
53 {"label":"{", "x":12.5, "y":2.5},
54 {"label":"Enter", "x":13.75, "y":2.5, "w":1.25, "h":2},
55 {"label":"Delete", "x":15.25, "y":2.5},
56 {"label":"End", "x":16.25, "y":2.5},
57 {"label":"PgDn", "x":17.25, "y":2.5},
58 {"label":"Caps Lock", "x":0, "y":3.5, "w":1.75},
59 {"label":"A", "x":1.75, "y":3.5},
60 {"label":"S", "x":2.75, "y":3.5},
61 {"label":"D", "x":3.75, "y":3.5},
62 {"label":"F", "x":4.75, "y":3.5},
63 {"label":"G", "x":5.75, "y":3.5},
64 {"label":"H", "x":6.75, "y":3.5},
65 {"label":"J", "x":7.75, "y":3.5},
66 {"label":"K", "x":8.75, "y":3.5},
67 {"label":"L", "x":9.75, "y":3.5},
68 {"label":"+", "x":10.75, "y":3.5},
69 {"label":"*", "x":11.75, "y":3.5},
70 {"label":"}", "x":12.75, "y":3.5},
71 {"label":"Shift", "x":0, "y":4.5, "w":2.25},
72 {"label":"Z", "x":2.25, "y":4.5},
73 {"label":"X", "x":3.25, "y":4.5},
74 {"label":"C", "x":4.25, "y":4.5},
75 {"label":"V", "x":5.25, "y":4.5},
76 {"label":"B", "x":6.25, "y":4.5},
77 {"label":"N", "x":7.25, "y":4.5},
78 {"label":"M", "x":8.25, "y":4.5},
79 {"label":"<", "x":9.25, "y":4.5},
80 {"label":">", "x":10.25, "y":4.5},
81 {"label":"?", "x":11.25, "y":4.5},
82 {"label":"_", "x":12.25, "y":4.5},
83 {"label":"Shift", "x":13.25, "y":4.5, "w":1.75},
84 {"label":"\u2191", "x":16.25, "y":4.5},
85 {"label":"Ctrl", "x":0, "y":5.5, "w":1.25},
86 {"label":"Win", "x":1.25, "y":5.5},
87 {"label":"Alt", "x":2.25, "y":5.5, "w":1.25},
88 {"x":3.5, "y":5.5},
89 {"x":4.5, "y":5.5, "w":2.25},
90 {"x":6.75, "y":5.5, "w":2.25},
91 {"label":"kana", "x":9, "y":5.5, "w":1.25},
92 {"x":10.25, "y":5.5, "w":1.25},
93 {"label":"Alt", "x":11.5, "y":5.5, "w":1.25},
94 {"label":"Menu", "x":12.75, "y":5.5},
95 {"label":"Ctrl", "x":13.75, "y":5.5, "w":1.25},
96 {"label":"\u2190", "x":15.25, "y":5.5},
97 {"label":"\u2193", "x":16.25, "y":5.5},
98 {"label":"\u2192", "x":17.25, "y":5.5}]
99 }
100 }
101} \ 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 000000000..a79b9a2b5
--- /dev/null
+++ b/keyboards/pistachio_pro/keymaps/default/keymap.c
@@ -0,0 +1,123 @@
1/* Copyright 2021 rate
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include QMK_KEYBOARD_H
17#include <stdio.h>
18#include "keymap_jp.h"
19#include "lib/bme280.h"
20
21// Defines names for use in layer keycodes and the keymap
22enum layer_names {
23 _BASE,
24 _FN
25};
26
27const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
28 /* Base */
29 [_BASE] = LAYOUT(
30 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,
31 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,
32 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,
33 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,
34 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,
35 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
36 ),
37 [_FN] = LAYOUT(
38 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
39 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
40 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,
41 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,
42 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,
43 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
44 )
45};
46
47/* OLED */
48const char code_to_name[60] = {
49 ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
50 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
51 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '
52};
53
54static void print_airstate(void) {
55 char airstate_str[32];
56 double temp;
57 double press;
58 double hum;
59
60 temp = bme280_getTemp();
61 press = bme280_getPress();
62 hum = bme280_getHum();
63
64 oled_write_ln_P(PSTR("\nTemp Press Hum"), false);
65 snprintf(airstate_str, sizeof(airstate_str), "%ddeg %dhPa %d%% \n", (int)temp, (int)press, (int)hum );
66 oled_write(airstate_str, false);
67
68 return;
69}
70
71static keyrecord_t keylog_record;
72static void print_keylog(void) {
73 char keylog_str[32];
74
75 oled_write_ln_P(PSTR("\nKeylog"), false);
76 snprintf(keylog_str, sizeof(keylog_str), "row:%d col:%d", keylog_record.event.key.row, keylog_record.event.key.col );
77 oled_write(keylog_str, false);
78
79 return;
80}
81
82oled_rotation_t oled_init_user(oled_rotation_t rotation) {
83 return OLED_ROTATION_180;
84}
85
86void oled_task_user(void) {
87 oled_write_ln_P(PSTR(" - PistachioPro -"), false);
88 print_airstate();
89 print_keylog();
90
91 return;
92}
93
94/* Encoder */
95bool encoder_update_user(uint8_t index, bool clockwise) {
96 if (index == 0) {
97 // Volume control
98 if (clockwise) {
99 tap_code(KC_VOLU);
100 } else {
101 tap_code(KC_VOLD);
102 }
103 }
104
105 return true;
106}
107
108/* Keyboard */
109void keyboard_post_init_user(void) {
110 bme280_init();
111}
112
113void housekeeping_task_user(void) {
114 bme280_exec();
115}
116
117bool process_record_user(uint16_t keycode, keyrecord_t *record) {
118 if (record->event.pressed) {
119 keylog_record = *record;
120 }
121
122 return true;
123} \ 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 000000000..2bc50be9d
--- /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 000000000..e08e16770
--- /dev/null
+++ b/keyboards/pistachio_pro/keymaps/rate/keymap.c
@@ -0,0 +1,125 @@
1/* Copyright 2021 rate
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include QMK_KEYBOARD_H
17#include <stdio.h>
18#include "keymap_jp.h"
19#include "lib/bme280.h"
20
21// Defines names for use in layer keycodes and the keymap
22enum layer_names {
23 _BASE,
24 _FN
25};
26
27const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
28 /* Base */
29 [_BASE] = LAYOUT(
30 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,
31 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,
32 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,
33 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,
34 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,
35 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
36 ),
37 [_FN] = LAYOUT(
38 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
39 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
40 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,
41 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,
42 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,
43 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
44 )
45};
46
47
48
49/* OLED */
50const char code_to_name[60] = {
51 ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
52 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
53 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '
54};
55
56static void print_airstate(void) {
57 char airstate_str[32];
58 double temp;
59 double press;
60 double hum;
61
62 temp = bme280_getTemp();
63 press = bme280_getPress();
64 hum = bme280_getHum();
65
66 oled_write_ln_P(PSTR("\nTemp Press Hum"), false);
67 snprintf(airstate_str, sizeof(airstate_str), "%ddeg %dhPa %d%% \n", (int)temp, (int)press, (int)hum );
68 oled_write(airstate_str, false);
69
70 return;
71}
72
73static keyrecord_t keylog_record;
74static void print_keylog(void) {
75 char keylog_str[32];
76
77 oled_write_ln_P(PSTR("\nKeylog"), false);
78 snprintf(keylog_str, sizeof(keylog_str), "row:%d col:%d", keylog_record.event.key.row, keylog_record.event.key.col );
79 oled_write(keylog_str, false);
80
81 return;
82}
83
84oled_rotation_t oled_init_user(oled_rotation_t rotation) {
85 return OLED_ROTATION_180;
86}
87
88void oled_task_user(void) {
89 oled_write_ln_P(PSTR(" - PistachioPro -"), false);
90 print_airstate();
91 print_keylog();
92
93 return;
94}
95
96/* Encoder */
97bool encoder_update_user(uint8_t index, bool clockwise) {
98 if (index == 0) {
99 // Volume control
100 if (clockwise) {
101 tap_code(KC_VOLU);
102 } else {
103 tap_code(KC_VOLD);
104 }
105 }
106
107 return true;
108}
109
110/* Keyboard */
111void keyboard_post_init_user(void) {
112 bme280_init();
113}
114
115void housekeeping_task_user(void) {
116 bme280_exec();
117}
118
119bool process_record_user(uint16_t keycode, keyrecord_t *record) {
120 if (record->event.pressed) {
121 keylog_record = *record;
122 }
123
124 return true;
125} \ 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 000000000..b355dced2
--- /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 000000000..833bbb8ec
--- /dev/null
+++ b/keyboards/pistachio_pro/keymaps/via/keymap.c
@@ -0,0 +1,141 @@
1/* Copyright 2021 rate
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include QMK_KEYBOARD_H
17#include <stdio.h>
18#include "keymap_jp.h"
19#include "lib/bme280.h"
20
21// Defines names for use in layer keycodes and the keymap
22enum layer_names {
23 _BASE,
24 _FN,
25 _RESERVE_0,
26 _RESERVE_1
27};
28
29const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
30 /* Base */
31 [_BASE] = LAYOUT(
32 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,
33 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,
34 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,
35 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,
36 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,
37 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
38 ),
39 [_FN] = LAYOUT(
40 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
41 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
42 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,
43 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,
44 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,
45 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
46 ),
47 [_RESERVE_0] = LAYOUT(
48 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
49 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
50 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
51 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
52 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
53 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
54 ),
55 [_RESERVE_1] = LAYOUT(
56 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
57 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
58 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
59 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
60 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
61 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
62 )
63};
64
65/* OLED */
66const char code_to_name[60] = {
67 ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
68 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
69 'R', 'E', 'B', 'T', '_', '-', '=', '[', ']', '\\', '#', ';', '\'', '`', ',', '.', '/', ' ', ' ', ' '
70};
71
72static void print_airstate(void) {
73 char airstate_str[32];
74 double temp;
75 double press;
76 double hum;
77
78 temp = bme280_getTemp();
79 press = bme280_getPress();
80 hum = bme280_getHum();
81
82 oled_write_ln_P(PSTR("\nTemp Press Hum"), false);
83 snprintf(airstate_str, sizeof(airstate_str), "%ddeg %dhPa %d%% \n", (int)temp, (int)press, (int)hum );
84 oled_write(airstate_str, false);
85
86 return;
87}
88
89static keyrecord_t keylog_record;
90static void print_keylog(void) {
91 char keylog_str[32];
92
93 oled_write_ln_P(PSTR("\nKeylog"), false);
94 snprintf(keylog_str, sizeof(keylog_str), "row:%d col:%d", keylog_record.event.key.row, keylog_record.event.key.col );
95 oled_write(keylog_str, false);
96
97 return;
98}
99
100oled_rotation_t oled_init_user(oled_rotation_t rotation) {
101 return OLED_ROTATION_180;
102}
103
104void oled_task_user(void) {
105 oled_write_ln_P(PSTR(" - PistachioPro -"), false);
106 print_airstate();
107 print_keylog();
108
109 return;
110}
111
112/* Encoder */
113bool encoder_update_user(uint8_t index, bool clockwise) {
114 if (index == 0) {
115 // Volume control
116 if (clockwise) {
117 tap_code(KC_VOLU);
118 } else {
119 tap_code(KC_VOLD);
120 }
121 }
122
123 return true;
124}
125
126/* Keyboard */
127void keyboard_post_init_user(void) {
128 bme280_init();
129}
130
131void housekeeping_task_user(void) {
132 bme280_exec();
133}
134
135bool process_record_user(uint16_t keycode, keyrecord_t *record) {
136 if (record->event.pressed) {
137 keylog_record = *record;
138 }
139
140 return true;
141} \ 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 000000000..b768049cc
--- /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 000000000..036bd6d1c
--- /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 000000000..f3dc231dc
--- /dev/null
+++ b/keyboards/pistachio_pro/lib/bme280.c
@@ -0,0 +1,255 @@
1/* Copyright 2021 rate
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include <stdint.h>
17#include "bme280.h"
18#include "i2c_master.h"
19
20#define BME280_ADDRESS (0x76<<1)
21
22#define BME280_REG_CALIB00 (0x88)
23#define BME280_REG_CALIB25 (0xA1)
24#define BME280_REG_CALIB26 (0xE1)
25#define BME280_REG_CTRL_HUM (0xF2)
26#define BME280_REG_CTRL_MEAS (0xF4)
27#define BME280_REG_CONFIG (0xF5)
28#define BME280_REG_PRESS_MSB (0xf7)
29
30#define I2C_BME280_TIMEOUT (20)
31
32/* BME280 configurator values */
33/* [2:0] Humidity oversampling
34 * 000 Skipped
35 * 001 oversampling x1
36 * 010 oversampling x2
37 * 011 oversampling x4
38 * 100 oversampling x8
39 * 101,others oversampling x16
40 */
41#define BME280_CTRL_HUM_VAL (0x01)
42
43
44/* [7:5] Pressure oversampling
45 * 000 Skipped
46 * 001 oversampling x1
47 * 010 oversampling x2
48 * 011 oversampling x4
49 * 100 oversampling x8
50 * 101,others oversampling x16
51 * [4:2] Temperature oversampling
52 * 000 Skipped
53 * 001 oversampling x1
54 * 010 oversampling x2
55 * 011 oversampling x4
56 * 100 oversampling x8
57 * 101,others oversampling x16
58 * [1:0] Mode
59 * 00 Sleep mode
60 * 11 Normal mode
61 */
62#define BME280_CTRL_MEAS_VAL (0x27)
63
64/* [7:5] t_standby[ms]
65 * 000 0.5
66 * 001 62.5
67 * 010 125
68 * 011 250
69 * 100 500
70 * 101 1000
71 * 110 10
72 * 111 20
73 * [4:2] Filter corefficient
74 * 000 Filter off
75 * 001 2
76 * 010 4
77 * 011 8
78 * 100,others 16
79 * [0] SPI interface
80 * 0 4-wire
81 * 1 3-wire
82 */
83#define BME280_CONFIG_VAL (0xA0)
84
85static void readTrim(void);
86static void readData(void);
87static int32_t calibration_T(int32_t adc_T);
88static uint32_t calibration_P(int32_t adc_P);
89static uint32_t calibration_H(int32_t adc_H);
90
91static uint32_t hum_raw,temp_raw,pres_raw;
92static uint16_t dig_T1;
93static int16_t dig_T2, dig_T3;
94static uint16_t dig_P1;
95static int16_t dig_P2, dig_P3, dig_P4, dig_P5, dig_P6, dig_P7, dig_P8, dig_P9;
96static uint8_t dig_H1, dig_H3;
97static int16_t dig_H2, dig_H4, dig_H5;
98static int8_t dig_H6;
99static int32_t t_fine;
100
101/* Private */
102static void readTrim(void) {
103 uint8_t data[32];
104
105 i2c_readReg(BME280_ADDRESS, BME280_REG_CALIB00, &data[0], 24, I2C_BME280_TIMEOUT);
106 i2c_readReg(BME280_ADDRESS, BME280_REG_CALIB25, &data[25], 1, I2C_BME280_TIMEOUT);
107 i2c_readReg(BME280_ADDRESS, BME280_REG_CALIB26, &data[25], 7, I2C_BME280_TIMEOUT);
108
109 dig_T1 = (data[1] << 8) | data[0];
110 dig_T2 = (data[3] << 8) | data[2];
111 dig_T3 = (data[5] << 8) | data[4];
112 dig_P1 = (data[7] << 8) | data[6];
113 dig_P2 = (data[9] << 8) | data[8];
114 dig_P3 = (data[11]<< 8) | data[10];
115 dig_P4 = (data[13]<< 8) | data[12];
116 dig_P5 = (data[15]<< 8) | data[14];
117 dig_P6 = (data[17]<< 8) | data[16];
118 dig_P7 = (data[19]<< 8) | data[18];
119 dig_P8 = (data[21]<< 8) | data[20];
120 dig_P9 = (data[23]<< 8) | data[22];
121 dig_H1 = data[24];
122 dig_H2 = (data[26]<< 8) | data[25];
123 dig_H3 = data[27];
124 dig_H4 = (data[28]<< 4) | (0x0F & data[29]);
125 dig_H5 = (data[30] << 4) | ((data[29] >> 4) & 0x0F);
126 dig_H6 = data[31];
127
128 return;
129}
130
131static void readData(void) {
132 uint8_t data[8];
133
134 i2c_readReg(BME280_ADDRESS, 0xF7, &data[0], 8, I2C_BME280_TIMEOUT);
135
136 pres_raw = data[0];
137 pres_raw = (pres_raw<<8) | data[1];
138 pres_raw = (pres_raw<<4) | (data[2] >> 4);
139
140 temp_raw = data[3];
141 temp_raw = (temp_raw<<8) | data[4];
142 temp_raw = (temp_raw<<4) | (data[5] >> 4);
143
144 hum_raw = data[6];
145 hum_raw = (hum_raw << 8) | data[7];
146
147 return;
148}
149
150static int32_t calibration_T(int32_t adc_T) {
151 int32_t var1, var2, T;
152 var1 = ((((adc_T >> 3) - ((int32_t)dig_T1<<1))) * ((int32_t)dig_T2)) >> 11;
153 var2 = (((((adc_T >> 4) - ((int32_t)dig_T1)) * ((adc_T>>4) - ((int32_t)dig_T1))) >> 12) * ((int32_t)dig_T3)) >> 14;
154
155 t_fine = var1 + var2;
156 T = (t_fine * 5 + 128) >> 8;
157
158 return T;
159}
160
161static uint32_t calibration_P(int32_t adc_P) {
162 int32_t var1, var2;
163 uint32_t P;
164
165 var1 = (((int32_t)t_fine)>>1) - (int32_t)64000;
166 var2 = (((var1>>2) * (var1>>2)) >> 11) * ((int32_t)dig_P6);
167 var2 = var2 + ((var1*((int32_t)dig_P5))<<1);
168 var2 = (var2>>2)+(((int32_t)dig_P4)<<16);
169 var1 = (((dig_P3 * (((var1>>2)*(var1>>2)) >> 13)) >>3) + ((((int32_t)dig_P2) * var1)>>1))>>18;
170 var1 = ((((32768+var1))*((int32_t)dig_P1))>>15);
171 if (var1 == 0) {
172 return 0;
173 }
174 P = (((uint32_t)(((int32_t)1048576)-adc_P)-(var2>>12)))*3125;
175 if( P < 0x80000000 ) {
176 P = (P << 1) / ((uint32_t) var1);
177 } else {
178 P = (P / (uint32_t)var1) * 2;
179 }
180 var1 = (((int32_t)dig_P9) * ((int32_t)(((P>>3) * (P>>3))>>13)))>>12;
181 var2 = (((int32_t)(P>>2)) * ((int32_t)dig_P8))>>13;
182 P = (uint32_t)((int32_t)P + ((var1 + var2 + dig_P7) >> 4));
183
184 return P;
185}
186
187static uint32_t calibration_H(int32_t adc_H) {
188 int32_t v_x1;
189
190 v_x1 = (t_fine - ((int32_t)76800));
191 v_x1 = (((((adc_H << 14) -(((int32_t)dig_H4) << 20) - (((int32_t)dig_H5) * v_x1)) +
192 ((int32_t)16384)) >> 15) * (((((((v_x1 * ((int32_t)dig_H6)) >> 10) *
193 (((v_x1 * ((int32_t)dig_H3)) >> 11) + ((int32_t) 32768))) >> 10) + (( int32_t)2097152)) *
194 ((int32_t) dig_H2) + 8192) >> 14));
195 v_x1 = (v_x1 - (((((v_x1 >> 15) * (v_x1 >> 15)) >> 7) * ((int32_t)dig_H1)) >> 4));
196 v_x1 = (v_x1 < 0 ? 0 : v_x1);
197 v_x1 = (v_x1 > 419430400 ? 419430400 : v_x1);
198
199 return (uint32_t)(v_x1 >> 12);
200}
201
202/* Public */
203void bme280_init(void) {
204 uint8_t ctrl_hum_reg;
205 uint8_t ctrl_meas_reg;
206 uint8_t config_reg;
207
208 ctrl_hum_reg = BME280_CTRL_HUM_VAL;
209 ctrl_meas_reg = BME280_CTRL_MEAS_VAL;
210 config_reg = BME280_CONFIG_VAL;
211
212 i2c_init();
213 i2c_writeReg(BME280_ADDRESS, BME280_REG_CTRL_HUM, &ctrl_hum_reg, 1, I2C_BME280_TIMEOUT);
214 i2c_writeReg(BME280_ADDRESS, BME280_REG_CTRL_MEAS, &ctrl_meas_reg, 1, I2C_BME280_TIMEOUT);
215 i2c_writeReg(BME280_ADDRESS, BME280_REG_CONFIG, &config_reg, 1, I2C_BME280_TIMEOUT);
216 readTrim();
217
218 return;
219}
220
221void bme280_exec(void) {
222 readData();
223
224 return;
225}
226
227double bme280_getTemp(void) {
228 double temp_act;
229 int32_t temp_cal;
230
231 temp_cal = calibration_T(temp_raw);
232 temp_act = (double)temp_cal / 100.0;
233
234 return temp_act;
235}
236
237double bme280_getPress(void) {
238 double press_act;
239 uint32_t press_cal;
240
241 press_cal = calibration_P(pres_raw);
242 press_act = (double)press_cal / 100.0;
243
244 return press_act;
245}
246
247double bme280_getHum(void) {
248 double hum_act;
249 uint32_t hum_cal;
250
251 hum_cal = calibration_H(hum_raw);
252 hum_act = (double)hum_cal / 1024.0;
253
254 return hum_act;
255}
diff --git a/keyboards/pistachio_pro/lib/bme280.h b/keyboards/pistachio_pro/lib/bme280.h
new file mode 100644
index 000000000..eb503038d
--- /dev/null
+++ b/keyboards/pistachio_pro/lib/bme280.h
@@ -0,0 +1,22 @@
1/* Copyright 2021 rate
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18void bme280_init(void);
19void bme280_exec(void);
20double bme280_getTemp(void);
21double bme280_getPress(void);
22double bme280_getHum(void);
diff --git a/keyboards/pistachio_pro/lib/glcdfont.c b/keyboards/pistachio_pro/lib/glcdfont.c
new file mode 100644
index 000000000..41041f12b
--- /dev/null
+++ b/keyboards/pistachio_pro/lib/glcdfont.c
@@ -0,0 +1,232 @@
1// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0.
2// See gfxfont.h for newer custom bitmap font info.
3
4#include "progmem.h"
5
6// Standard ASCII 5x7 font
7const unsigned char font[] PROGMEM = {
80x00, 0x00, 0x00, 0x00, 0x00, 0x00,
90x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00,
100x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00,
110x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00,
120x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00,
130x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00,
140x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00,
150x00, 0x18, 0x3C, 0x18, 0x00, 0x00,
160xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00,
170x00, 0x18, 0x24, 0x18, 0x00, 0x00,
180xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00,
190x30, 0x48, 0x3A, 0x06, 0x0E, 0x00,
200x26, 0x29, 0x79, 0x29, 0x26, 0x00,
210x40, 0x7F, 0x05, 0x05, 0x07, 0x00,
220x40, 0x7F, 0x05, 0x25, 0x3F, 0x00,
230x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00,
240x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00,
250x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00,
260x14, 0x22, 0x7F, 0x22, 0x14, 0x00,
270x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00,
280x06, 0x09, 0x7F, 0x01, 0x7F, 0x00,
290x00, 0x66, 0x89, 0x95, 0x6A, 0x00,
300x60, 0x60, 0x60, 0x60, 0x60, 0x00,
310x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00,
320x08, 0x04, 0x7E, 0x04, 0x08, 0x00,
330x10, 0x20, 0x7E, 0x20, 0x10, 0x00,
340x08, 0x08, 0x2A, 0x1C, 0x08, 0x00,
350x08, 0x1C, 0x2A, 0x08, 0x08, 0x00,
360x1E, 0x10, 0x10, 0x10, 0x10, 0x00,
370x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00,
380x30, 0x38, 0x3E, 0x38, 0x30, 0x00,
390x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00,
400x00, 0x00, 0x00, 0x00, 0x00, 0x00,
410x00, 0x00, 0x5F, 0x00, 0x00, 0x00,
420x00, 0x07, 0x00, 0x07, 0x00, 0x00,
430x14, 0x7F, 0x14, 0x7F, 0x14, 0x00,
440x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00,
450x23, 0x13, 0x08, 0x64, 0x62, 0x00,
460x36, 0x49, 0x56, 0x20, 0x50, 0x00,
470x00, 0x08, 0x07, 0x03, 0x00, 0x00,
480x00, 0x1C, 0x22, 0x41, 0x00, 0x00,
490x00, 0x41, 0x22, 0x1C, 0x00, 0x00,
500x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00,
510x08, 0x08, 0x3E, 0x08, 0x08, 0x00,
520x00, 0x80, 0x70, 0x30, 0x00, 0x00,
530x08, 0x08, 0x08, 0x08, 0x08, 0x00,
540x00, 0x00, 0x60, 0x60, 0x00, 0x00,
550x20, 0x10, 0x08, 0x04, 0x02, 0x00,
560x3E, 0x51, 0x49, 0x45, 0x3E, 0x00,
570x00, 0x42, 0x7F, 0x40, 0x00, 0x00,
580x72, 0x49, 0x49, 0x49, 0x46, 0x00,
590x21, 0x41, 0x49, 0x4D, 0x33, 0x00,
600x18, 0x14, 0x12, 0x7F, 0x10, 0x00,
610x27, 0x45, 0x45, 0x45, 0x39, 0x00,
620x3C, 0x4A, 0x49, 0x49, 0x31, 0x00,
630x41, 0x21, 0x11, 0x09, 0x07, 0x00,
640x36, 0x49, 0x49, 0x49, 0x36, 0x00,
650x46, 0x49, 0x49, 0x29, 0x1E, 0x00,
660x00, 0x00, 0x14, 0x00, 0x00, 0x00,
670x00, 0x40, 0x34, 0x00, 0x00, 0x00,
680x00, 0x08, 0x14, 0x22, 0x41, 0x00,
690x14, 0x14, 0x14, 0x14, 0x14, 0x00,
700x00, 0x41, 0x22, 0x14, 0x08, 0x00,
710x02, 0x01, 0x59, 0x09, 0x06, 0x00,
720x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00,
730x7C, 0x12, 0x11, 0x12, 0x7C, 0x00,
740x7F, 0x49, 0x49, 0x49, 0x36, 0x00,
750x3E, 0x41, 0x41, 0x41, 0x22, 0x00,
760x7F, 0x41, 0x41, 0x41, 0x3E, 0x00,
770x7F, 0x49, 0x49, 0x49, 0x41, 0x00,
780x7F, 0x09, 0x09, 0x09, 0x01, 0x00,
790x3E, 0x41, 0x41, 0x51, 0x73, 0x00,
800x7F, 0x08, 0x08, 0x08, 0x7F, 0x00,
810x00, 0x41, 0x7F, 0x41, 0x00, 0x00,
820x20, 0x40, 0x41, 0x3F, 0x01, 0x00,
830x7F, 0x08, 0x14, 0x22, 0x41, 0x00,
840x7F, 0x40, 0x40, 0x40, 0x40, 0x00,
850x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00,
860x7F, 0x04, 0x08, 0x10, 0x7F, 0x00,
870x3E, 0x41, 0x41, 0x41, 0x3E, 0x00,
880x7F, 0x09, 0x09, 0x09, 0x06, 0x00,
890x3E, 0x41, 0x51, 0x21, 0x5E, 0x00,
900x7F, 0x09, 0x19, 0x29, 0x46, 0x00,
910x26, 0x49, 0x49, 0x49, 0x32, 0x00,
920x03, 0x01, 0x7F, 0x01, 0x03, 0x00,
930x3F, 0x40, 0x40, 0x40, 0x3F, 0x00,
940x1F, 0x20, 0x40, 0x20, 0x1F, 0x00,
950x3F, 0x40, 0x38, 0x40, 0x3F, 0x00,
960x63, 0x14, 0x08, 0x14, 0x63, 0x00,
970x03, 0x04, 0x78, 0x04, 0x03, 0x00,
980x61, 0x59, 0x49, 0x4D, 0x43, 0x00,
990x00, 0x7F, 0x41, 0x41, 0x41, 0x00,
1000x02, 0x04, 0x08, 0x10, 0x20, 0x00,
1010x00, 0x41, 0x41, 0x41, 0x7F, 0x00,
1020x04, 0x02, 0x01, 0x02, 0x04, 0x00,
1030x40, 0x40, 0x40, 0x40, 0x40, 0x00,
1040x00, 0x03, 0x07, 0x08, 0x00, 0x00,
1050x20, 0x54, 0x54, 0x78, 0x40, 0x00,
1060x7F, 0x28, 0x44, 0x44, 0x38, 0x00,
1070x38, 0x44, 0x44, 0x44, 0x28, 0x00,
1080x38, 0x44, 0x44, 0x28, 0x7F, 0x00,
1090x38, 0x54, 0x54, 0x54, 0x18, 0x00,
1100x00, 0x08, 0x7E, 0x09, 0x02, 0x00,
1110x18, 0x24, 0x24, 0x1C, 0x78, 0x00,
1120x7F, 0x08, 0x04, 0x04, 0x78, 0x00,
1130x00, 0x44, 0x7D, 0x40, 0x00, 0x00,
1140x20, 0x40, 0x40, 0x3D, 0x00, 0x00,
1150x7F, 0x10, 0x28, 0x44, 0x00, 0x00,
1160x00, 0x41, 0x7F, 0x40, 0x00, 0x00,
1170x7C, 0x04, 0x78, 0x04, 0x78, 0x00,
1180x7C, 0x08, 0x04, 0x04, 0x78, 0x00,
1190x38, 0x44, 0x44, 0x44, 0x38, 0x00,
1200x7C, 0x18, 0x24, 0x24, 0x18, 0x00,
1210x18, 0x24, 0x24, 0x18, 0x7C, 0x00,
1220x7C, 0x08, 0x04, 0x04, 0x08, 0x00,
1230x48, 0x54, 0x54, 0x54, 0x24, 0x00,
1240x04, 0x04, 0x3F, 0x44, 0x24, 0x00,
1250x3C, 0x40, 0x40, 0x20, 0x7C, 0x00,
1260x1C, 0x20, 0x40, 0x20, 0x1C, 0x00,
1270x3C, 0x40, 0x30, 0x40, 0x3C, 0x00,
1280x44, 0x28, 0x10, 0x28, 0x44, 0x00,
1290x4C, 0x90, 0x90, 0x90, 0x7C, 0x00,
1300x44, 0x64, 0x54, 0x4C, 0x44, 0x00,
1310x00, 0x08, 0x36, 0x41, 0x00, 0x00,
1320x00, 0x00, 0x77, 0x00, 0x00, 0x00,
1330x00, 0x41, 0x36, 0x08, 0x00, 0x00,
1340x02, 0x01, 0x02, 0x04, 0x02, 0x00,
1350x3C, 0x26, 0x23, 0x26, 0x3C, 0x00,
1360x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1370x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1380x00, 0x00, 0x00, 0x00, 0xC0, 0xE0,
1390xF0, 0xF8, 0xF8, 0x18, 0x00, 0xC0,
1400xF0, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF,
1410xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x00,
1420x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1430x00, 0x00, 0x80, 0xC0, 0xE0, 0xE0,
1440xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0,
1450xC0, 0x80, 0x00, 0x00, 0x00, 0x00,
1460x80, 0xC0, 0xE0, 0xE0, 0xE0, 0xE0,
1470xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0x80,
1480x00, 0x00, 0x00, 0xE0, 0xE0, 0xC0,
1490xC0, 0xE0, 0xE0, 0xE0, 0xE0, 0x00,
1500x00, 0xE0, 0xE0, 0xC0, 0xC0, 0xE0,
1510xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0x80,
1520x00, 0x00, 0x00, 0x00, 0x80, 0xC0,
1530xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0,
1540xE0, 0xE0, 0xC0, 0x80, 0x00, 0x00,
1550x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1560x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1570xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC,
1580xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00,
1590x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E,
1600x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00,
1610x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B,
1620x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00,
1630xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE,
1640xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00,
1650x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1660x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1670x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1680x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1690x00, 0x00, 0x00, 0xF8, 0xFC, 0xFE,
1700xFF, 0xE0, 0x00, 0xFF, 0xFF, 0xFF,
1710xFF, 0xFF, 0xFF, 0x80, 0xFF, 0xFF,
1720xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
1730xFF, 0x1F, 0x07, 0x01, 0x00, 0x00,
1740x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1750x00, 0xFF, 0xFF, 0xFF, 0x81, 0x00,
1760x00, 0x00, 0x00, 0x00, 0x00, 0x81,
1770xC3, 0xC3, 0xC3, 0x00, 0x00, 0xFF,
1780xFF, 0xFF, 0x81, 0x00, 0x00, 0x00,
1790x00, 0x00, 0x00, 0x81, 0xFF, 0xFF,
1800xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF,
1810x01, 0x00, 0x00, 0x00, 0x00, 0x00,
1820x00, 0xFF, 0xFF, 0xFF, 0x01, 0x00,
1830x00, 0x00, 0x00, 0x01, 0xFF, 0xFF,
1840xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF,
1850x9D, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C,
1860x1C, 0x9D, 0xDF, 0xDF, 0xDF, 0x00,
1870x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1880x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1890x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F,
1900x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00,
1910x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F,
1920x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00,
1930x30, 0x7B, 0x7F, 0x78, 0x30, 0x20,
1940x20, 0x30, 0x78, 0x7F, 0x3B, 0x00,
1950x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F,
1960x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00,
1970x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1980x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1990x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2000x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2010x00, 0x00, 0x00, 0x03, 0x0F, 0x1F,
2020x3F, 0x3F, 0x3F, 0x3F, 0x1F, 0x1F,
2030x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x3F,
2040x3F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F,
2050x7F, 0x7C, 0x78, 0x78, 0x38, 0x1C,
2060x0F, 0x00, 0x00, 0x00, 0x00, 0x00,
2070x00, 0x00, 0x01, 0x03, 0x07, 0x07,
2080x07, 0x07, 0x07, 0x07, 0x07, 0x07,
2090x03, 0x01, 0x00, 0x00, 0x00, 0x00,
2100x01, 0x03, 0x07, 0x07, 0x07, 0x07,
2110x07, 0x07, 0x07, 0x07, 0x03, 0x01,
2120x00, 0x00, 0x00, 0x07, 0x07, 0x07,
2130x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2140x00, 0x07, 0x07, 0x07, 0x00, 0x00,
2150x00, 0x00, 0x00, 0x00, 0x07, 0x07,
2160x07, 0x00, 0x00, 0x00, 0x01, 0x03,
2170x07, 0x07, 0x07, 0x07, 0x07, 0x07,
2180x07, 0x07, 0x03, 0x01, 0x00, 0x00,
2190x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2200x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2210x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2220x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2230x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2240x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2250x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2260x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2270x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2280x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2290x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2300x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2310x00, 0x00, 0x00, 0x00, 0x00, 0x00,
232};
diff --git a/keyboards/pistachio_pro/matrix.c b/keyboards/pistachio_pro/matrix.c
new file mode 100644
index 000000000..6cbfb6dfe
--- /dev/null
+++ b/keyboards/pistachio_pro/matrix.c
@@ -0,0 +1,151 @@
1/*
2Copyright 2012-2018 Jun Wako, Jack Humbert, Yiancar
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#include <stdint.h>
18#include <stdbool.h>
19#include "matrix.h"
20#include "quantum.h"
21
22static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
23static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS;
24
25static inline void setPinOutput_writeLow(pin_t pin) {
26 ATOMIC_BLOCK_FORCEON {
27 setPinOutput(pin);
28 writePinLow(pin);
29 }
30}
31
32static inline void setPinInputHigh_atomic(pin_t pin) {
33 ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); }
34}
35
36static void select_row(uint8_t row) {
37 setPinOutput_writeLow(row_pins[row]);
38}
39
40static void unselect_row(uint8_t row) {
41 setPinInputHigh_atomic(row_pins[row]);
42}
43
44static void unselect_rows(void) {
45 for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
46 setPinInputHigh_atomic(row_pins[x]);
47 }
48}
49
50static void select_col(uint8_t col) {
51 setPinOutput_writeLow(col_pins[col]);
52}
53
54static void unselect_col(uint8_t col) {
55 setPinInputHigh_atomic(col_pins[col]);
56}
57
58static void unselect_cols(void) {
59 for (uint8_t x = 0; x < MATRIX_COLS; x++) {
60 setPinInputHigh_atomic(col_pins[x]);
61 }
62}
63
64static void init_pins(void) {
65 unselect_rows();
66 for (uint8_t x = 0; x < MATRIX_COLS; x++) {
67 setPinInputHigh_atomic(col_pins[x]);
68 }
69 unselect_cols();
70 for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
71 setPinInputHigh_atomic(row_pins[x]);
72 }
73}
74
75static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
76 // Store last value of row prior to reading
77 matrix_row_t last_row_value = current_matrix[current_row];
78
79 // Select row
80 select_row(current_row);
81 matrix_io_delay();
82
83 // For each col...
84 for (uint8_t col_index = 0; col_index < MATRIX_COLS / 2; col_index++) {
85 // Check row pin state
86 if (readPin(col_pins[col_index])) {
87 // Pin HI, clear col bit
88 current_matrix[current_row] &= ~(MATRIX_ROW_SHIFTER << col_index);
89 } else {
90 // Pin LO, set col bit
91 current_matrix[current_row] |= (MATRIX_ROW_SHIFTER << col_index);
92 }
93 }
94
95 // Unselect row
96 unselect_row(current_row);
97
98 return (last_row_value != current_matrix[current_row]);
99}
100
101static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
102 bool matrix_changed = false;
103
104 // Select col
105 select_col(current_col);
106 matrix_io_delay();
107
108 // For each row...
109 for (uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++) {
110 // Store last value of row prior to reading
111 matrix_row_t last_row_value = current_matrix[row_index];
112
113 // Check row pin state
114 if (readPin(row_pins[row_index])) {
115 // Pin HI, clear col bit
116 current_matrix[row_index] &= ~(MATRIX_ROW_SHIFTER << ( current_col + MATRIX_COLS/2));
117 } else {
118 // Pin LO, set col bit
119 current_matrix[row_index] |= (MATRIX_ROW_SHIFTER << ( current_col + MATRIX_COLS/2));
120 }
121
122 // Determine if the matrix changed state
123 if ((last_row_value != current_matrix[row_index]) && !(matrix_changed)) {
124 matrix_changed = true;
125 }
126 }
127
128 // Unselect col
129 unselect_col(current_col);
130
131 return matrix_changed;
132}
133
134void matrix_init_custom(void) {
135 init_pins();
136}
137
138bool matrix_scan_custom(matrix_row_t current_matrix[]) {
139 bool changed = false;
140
141 // Set row, read cols
142 for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
143 changed |= read_cols_on_row(current_matrix, current_row);
144 }
145 // Set col, read rows
146 for (uint8_t current_col = 0; current_col < (MATRIX_COLS/2); current_col++) {
147 changed |= read_rows_on_col(current_matrix, current_col);
148 }
149
150 return (uint8_t)changed;
151}
diff --git a/keyboards/pistachio_pro/pistachio_pro.c b/keyboards/pistachio_pro/pistachio_pro.c
new file mode 100644
index 000000000..fda14471b
--- /dev/null
+++ b/keyboards/pistachio_pro/pistachio_pro.c
@@ -0,0 +1,17 @@
1/* Copyright 2021 rate
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "pistachio_pro.h"
diff --git a/keyboards/pistachio_pro/pistachio_pro.h b/keyboards/pistachio_pro/pistachio_pro.h
new file mode 100644
index 000000000..42de95ea8
--- /dev/null
+++ b/keyboards/pistachio_pro/pistachio_pro.h
@@ -0,0 +1,42 @@
1/* Copyright 2021 rate
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include "quantum.h"
20
21/* This is a shortcut to help you visually see your layout.
22 *
23 * The first section contains all of the arguments representing the physical
24 * layout of the board and position of the keys.
25 *
26 * The second converts the arguments into a two-dimensional array which
27 * represents the switch matrix.
28 */
29#define LAYOUT( \
30 k000, k001, k002, k003, k004, k005, k006, k007, k008, k009, k010, k011, k012, k013, \
31 k100, k101, k102, k103, k104, k105, k106, k107, k108, k109, k110, k111, k112, k113, k114, k115, k116, k117, \
32 k200, k201, k202, k203, k204, k205, k206, k207, k208, k209, k210, k211, k212, k213, k214, k215, \
33 k300, k301, k302, k303, k304, k305, k306, k307, k308, k309, k310, k311, k312, k313, \
34 k400, k401, k402, k403, k404, k405, k406, k407, k408, k409, k410, k411, k412, k413, \
35 k500, k501, k502, k503, k504, k505, k506, k507, k508, k509, k510, k511, k512, k513 ) { \
36 { k000, k001, k002, k003, k004, k005, k006, k007, k008, k009, k010, k011, k012, k013, KC_NO, KC_NO, KC_NO, KC_NO }, \
37 { k100, k101, k102, k103, k104, k105, k106, k107, k108, k109, k110, k111, k112, k113, k114, k115, k116, k117 }, \
38 { k200, k201, k202, k203, k204, k205, k206, k207, k208, k209, k210, k211, k212, k213, k214, k215, KC_NO, KC_NO }, \
39 { k300, k301, k302, k303, k304, k305, k306, k307, k308, k309, k310, k311, k312, k313, KC_NO, KC_NO, KC_NO, KC_NO }, \
40 { k400, k401, k402, k403, k404, k405, k406, k407, k408, k409, k410, k411, k412, k413, KC_NO, KC_NO, KC_NO, KC_NO }, \
41 { k500, k501, k502, k503, k504, k505, k506, k507, k508, k509, k510, k511, k512, k513, KC_NO, KC_NO, KC_NO, KC_NO } \
42}
diff --git a/keyboards/pistachio_pro/readme.md b/keyboards/pistachio_pro/readme.md
new file mode 100644
index 000000000..b224c874e
--- /dev/null
+++ b/keyboards/pistachio_pro/readme.md
@@ -0,0 +1,21 @@
1# PistachioPro
2
3![PistachioPro](https://ratelog.net/wp-content/uploads/2021/07/PistachioPro-scaled.jpg)
4
5This is a JIS layout TKL keyboard with 89 keys, encoder and OLED.
6
7* Keyboard Maintainer: [rate](https://github.com/7-rate)
8* Hardware Supported: PistachioPro PCB,
9* Hardware Availability: [Booth Shop](https://rates.booth.pm/items/2925303)
10
11Make example for this keyboard (after setting up your build environment):
12
13 make pistachio_pro:default
14
15Flashing example for this keyboard:
16
17 make pistachio_pro:default:flash
18
19To reset the keyboard into bootloader mode, press the reset switch on the underside.
20
21See 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/pistachio_pro/rules.mk b/keyboards/pistachio_pro/rules.mk
new file mode 100644
index 000000000..48e745a63
--- /dev/null
+++ b/keyboards/pistachio_pro/rules.mk
@@ -0,0 +1,28 @@
1# MCU name
2MCU = atmega32u4
3
4# Bootloader selection
5BOOTLOADER = atmel-dfu
6
7# Build Options
8# change yes to no to disable
9#
10BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
11MOUSEKEY_ENABLE = yes # Mouse keys
12EXTRAKEY_ENABLE = yes # Audio control and System control
13CONSOLE_ENABLE = no # Console for debug
14COMMAND_ENABLE = no # Commands for debug and configuration
15# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
16SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
17# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
18NKRO_ENABLE = no # USB Nkey Rollover
19BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
20RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
21BLUETOOTH_ENABLE = no # Enable Bluetooth
22AUDIO_ENABLE = no # Audio output
23OLED_DRIVER_ENABLE = yes
24ENCODER_ENABLE = yes
25
26CUSTOM_MATRIX = lite
27SRC += matrix.c
28SRC += ./lib/bme280.c \ No newline at end of file