diff options
Diffstat (limited to 'keyboards/pistachio_pro')
| -rw-r--r-- | keyboards/pistachio_pro/config.h | 108 | ||||
| -rw-r--r-- | keyboards/pistachio_pro/info.json | 101 | ||||
| -rw-r--r-- | keyboards/pistachio_pro/keymaps/default/keymap.c | 123 | ||||
| -rw-r--r-- | keyboards/pistachio_pro/keymaps/default/readme.md | 1 | ||||
| -rw-r--r-- | keyboards/pistachio_pro/keymaps/rate/keymap.c | 125 | ||||
| -rw-r--r-- | keyboards/pistachio_pro/keymaps/rate/readme.md | 1 | ||||
| -rw-r--r-- | keyboards/pistachio_pro/keymaps/via/keymap.c | 141 | ||||
| -rw-r--r-- | keyboards/pistachio_pro/keymaps/via/readme.md | 1 | ||||
| -rw-r--r-- | keyboards/pistachio_pro/keymaps/via/rules.mk | 1 | ||||
| -rw-r--r-- | keyboards/pistachio_pro/lib/bme280.c | 255 | ||||
| -rw-r--r-- | keyboards/pistachio_pro/lib/bme280.h | 22 | ||||
| -rw-r--r-- | keyboards/pistachio_pro/lib/glcdfont.c | 232 | ||||
| -rw-r--r-- | keyboards/pistachio_pro/matrix.c | 151 | ||||
| -rw-r--r-- | keyboards/pistachio_pro/pistachio_pro.c | 17 | ||||
| -rw-r--r-- | keyboards/pistachio_pro/pistachio_pro.h | 42 | ||||
| -rw-r--r-- | keyboards/pistachio_pro/readme.md | 21 | ||||
| -rw-r--r-- | keyboards/pistachio_pro/rules.mk | 28 |
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 | /* | ||
| 2 | Copyright 2021 rate | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along 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 | ||
| 22 | enum layer_names { | ||
| 23 | _BASE, | ||
| 24 | _FN | ||
| 25 | }; | ||
| 26 | |||
| 27 | const 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 */ | ||
| 48 | const 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 | |||
| 54 | static 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 | |||
| 71 | static keyrecord_t keylog_record; | ||
| 72 | static 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 | |||
| 82 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
| 83 | return OLED_ROTATION_180; | ||
| 84 | } | ||
| 85 | |||
| 86 | void 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 */ | ||
| 95 | bool 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 */ | ||
| 109 | void keyboard_post_init_user(void) { | ||
| 110 | bme280_init(); | ||
| 111 | } | ||
| 112 | |||
| 113 | void housekeeping_task_user(void) { | ||
| 114 | bme280_exec(); | ||
| 115 | } | ||
| 116 | |||
| 117 | bool 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 | ||
| 22 | enum layer_names { | ||
| 23 | _BASE, | ||
| 24 | _FN | ||
| 25 | }; | ||
| 26 | |||
| 27 | const 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 */ | ||
| 50 | const 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 | |||
| 56 | static 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 | |||
| 73 | static keyrecord_t keylog_record; | ||
| 74 | static 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 | |||
| 84 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
| 85 | return OLED_ROTATION_180; | ||
| 86 | } | ||
| 87 | |||
| 88 | void 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 */ | ||
| 97 | bool 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 */ | ||
| 111 | void keyboard_post_init_user(void) { | ||
| 112 | bme280_init(); | ||
| 113 | } | ||
| 114 | |||
| 115 | void housekeeping_task_user(void) { | ||
| 116 | bme280_exec(); | ||
| 117 | } | ||
| 118 | |||
| 119 | bool 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 | ||
| 22 | enum layer_names { | ||
| 23 | _BASE, | ||
| 24 | _FN, | ||
| 25 | _RESERVE_0, | ||
| 26 | _RESERVE_1 | ||
| 27 | }; | ||
| 28 | |||
| 29 | const 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 */ | ||
| 66 | const 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 | |||
| 72 | static 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 | |||
| 89 | static keyrecord_t keylog_record; | ||
| 90 | static 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 | |||
| 100 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
| 101 | return OLED_ROTATION_180; | ||
| 102 | } | ||
| 103 | |||
| 104 | void 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 */ | ||
| 113 | bool 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 */ | ||
| 127 | void keyboard_post_init_user(void) { | ||
| 128 | bme280_init(); | ||
| 129 | } | ||
| 130 | |||
| 131 | void housekeeping_task_user(void) { | ||
| 132 | bme280_exec(); | ||
| 133 | } | ||
| 134 | |||
| 135 | bool 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 | |||
| 85 | static void readTrim(void); | ||
| 86 | static void readData(void); | ||
| 87 | static int32_t calibration_T(int32_t adc_T); | ||
| 88 | static uint32_t calibration_P(int32_t adc_P); | ||
| 89 | static uint32_t calibration_H(int32_t adc_H); | ||
| 90 | |||
| 91 | static uint32_t hum_raw,temp_raw,pres_raw; | ||
| 92 | static uint16_t dig_T1; | ||
| 93 | static int16_t dig_T2, dig_T3; | ||
| 94 | static uint16_t dig_P1; | ||
| 95 | static int16_t dig_P2, dig_P3, dig_P4, dig_P5, dig_P6, dig_P7, dig_P8, dig_P9; | ||
| 96 | static uint8_t dig_H1, dig_H3; | ||
| 97 | static int16_t dig_H2, dig_H4, dig_H5; | ||
| 98 | static int8_t dig_H6; | ||
| 99 | static int32_t t_fine; | ||
| 100 | |||
| 101 | /* Private */ | ||
| 102 | static 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 | |||
| 131 | static 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 | |||
| 150 | static 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 | |||
| 161 | static 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 | |||
| 187 | static 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 */ | ||
| 203 | void 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 | |||
| 221 | void bme280_exec(void) { | ||
| 222 | readData(); | ||
| 223 | |||
| 224 | return; | ||
| 225 | } | ||
| 226 | |||
| 227 | double 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 | |||
| 237 | double 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 | |||
| 247 | double 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 | |||
| 18 | void bme280_init(void); | ||
| 19 | void bme280_exec(void); | ||
| 20 | double bme280_getTemp(void); | ||
| 21 | double bme280_getPress(void); | ||
| 22 | double 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 | ||
| 7 | const unsigned char font[] PROGMEM = { | ||
| 8 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 9 | 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, | ||
| 10 | 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, | ||
| 11 | 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, | ||
| 12 | 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, | ||
| 13 | 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, | ||
| 14 | 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, | ||
| 15 | 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, | ||
| 16 | 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, | ||
| 17 | 0x00, 0x18, 0x24, 0x18, 0x00, 0x00, | ||
| 18 | 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, | ||
| 19 | 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, | ||
| 20 | 0x26, 0x29, 0x79, 0x29, 0x26, 0x00, | ||
| 21 | 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, | ||
| 22 | 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, | ||
| 23 | 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00, | ||
| 24 | 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, | ||
| 25 | 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, | ||
| 26 | 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, | ||
| 27 | 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, | ||
| 28 | 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, | ||
| 29 | 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, | ||
| 30 | 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, | ||
| 31 | 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, | ||
| 32 | 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, | ||
| 33 | 0x10, 0x20, 0x7E, 0x20, 0x10, 0x00, | ||
| 34 | 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, | ||
| 35 | 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, | ||
| 36 | 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, | ||
| 37 | 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, | ||
| 38 | 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, | ||
| 39 | 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, | ||
| 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 41 | 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, | ||
| 42 | 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, | ||
| 43 | 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, | ||
| 44 | 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, | ||
| 45 | 0x23, 0x13, 0x08, 0x64, 0x62, 0x00, | ||
| 46 | 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, | ||
| 47 | 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, | ||
| 48 | 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, | ||
| 49 | 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, | ||
| 50 | 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, | ||
| 51 | 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, | ||
| 52 | 0x00, 0x80, 0x70, 0x30, 0x00, 0x00, | ||
| 53 | 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, | ||
| 54 | 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, | ||
| 55 | 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, | ||
| 56 | 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, | ||
| 57 | 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, | ||
| 58 | 0x72, 0x49, 0x49, 0x49, 0x46, 0x00, | ||
| 59 | 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, | ||
| 60 | 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, | ||
| 61 | 0x27, 0x45, 0x45, 0x45, 0x39, 0x00, | ||
| 62 | 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, | ||
| 63 | 0x41, 0x21, 0x11, 0x09, 0x07, 0x00, | ||
| 64 | 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, | ||
| 65 | 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, | ||
| 66 | 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, | ||
| 67 | 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, | ||
| 68 | 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, | ||
| 69 | 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, | ||
| 70 | 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, | ||
| 71 | 0x02, 0x01, 0x59, 0x09, 0x06, 0x00, | ||
| 72 | 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, | ||
| 73 | 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, | ||
| 74 | 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, | ||
| 75 | 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, | ||
| 76 | 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, | ||
| 77 | 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, | ||
| 78 | 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, | ||
| 79 | 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, | ||
| 80 | 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, | ||
| 81 | 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, | ||
| 82 | 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, | ||
| 83 | 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, | ||
| 84 | 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, | ||
| 85 | 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, | ||
| 86 | 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, | ||
| 87 | 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, | ||
| 88 | 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, | ||
| 89 | 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, | ||
| 90 | 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, | ||
| 91 | 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, | ||
| 92 | 0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, | ||
| 93 | 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, | ||
| 94 | 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, | ||
| 95 | 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, | ||
| 96 | 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, | ||
| 97 | 0x03, 0x04, 0x78, 0x04, 0x03, 0x00, | ||
| 98 | 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, | ||
| 99 | 0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, | ||
| 100 | 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, | ||
| 101 | 0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, | ||
| 102 | 0x04, 0x02, 0x01, 0x02, 0x04, 0x00, | ||
| 103 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, | ||
| 104 | 0x00, 0x03, 0x07, 0x08, 0x00, 0x00, | ||
| 105 | 0x20, 0x54, 0x54, 0x78, 0x40, 0x00, | ||
| 106 | 0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, | ||
| 107 | 0x38, 0x44, 0x44, 0x44, 0x28, 0x00, | ||
| 108 | 0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, | ||
| 109 | 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, | ||
| 110 | 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, | ||
| 111 | 0x18, 0x24, 0x24, 0x1C, 0x78, 0x00, | ||
| 112 | 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, | ||
| 113 | 0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, | ||
| 114 | 0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, | ||
| 115 | 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, | ||
| 116 | 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, | ||
| 117 | 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, | ||
| 118 | 0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, | ||
| 119 | 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, | ||
| 120 | 0x7C, 0x18, 0x24, 0x24, 0x18, 0x00, | ||
| 121 | 0x18, 0x24, 0x24, 0x18, 0x7C, 0x00, | ||
| 122 | 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, | ||
| 123 | 0x48, 0x54, 0x54, 0x54, 0x24, 0x00, | ||
| 124 | 0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, | ||
| 125 | 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, | ||
| 126 | 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, | ||
| 127 | 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, | ||
| 128 | 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, | ||
| 129 | 0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00, | ||
| 130 | 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, | ||
| 131 | 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, | ||
| 132 | 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, | ||
| 133 | 0x00, 0x41, 0x36, 0x08, 0x00, 0x00, | ||
| 134 | 0x02, 0x01, 0x02, 0x04, 0x02, 0x00, | ||
| 135 | 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, | ||
| 136 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 137 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 138 | 0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, | ||
| 139 | 0xF0, 0xF8, 0xF8, 0x18, 0x00, 0xC0, | ||
| 140 | 0xF0, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, | ||
| 141 | 0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x00, | ||
| 142 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 143 | 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xE0, | ||
| 144 | 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, | ||
| 145 | 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, | ||
| 146 | 0x80, 0xC0, 0xE0, 0xE0, 0xE0, 0xE0, | ||
| 147 | 0xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0x80, | ||
| 148 | 0x00, 0x00, 0x00, 0xE0, 0xE0, 0xC0, | ||
| 149 | 0xC0, 0xE0, 0xE0, 0xE0, 0xE0, 0x00, | ||
| 150 | 0x00, 0xE0, 0xE0, 0xC0, 0xC0, 0xE0, | ||
| 151 | 0xE0, 0xE0, 0xE0, 0xE0, 0xC0, 0x80, | ||
| 152 | 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, | ||
| 153 | 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, | ||
| 154 | 0xE0, 0xE0, 0xC0, 0x80, 0x00, 0x00, | ||
| 155 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 156 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 157 | 0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, | ||
| 158 | 0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, | ||
| 159 | 0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, | ||
| 160 | 0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00, | ||
| 161 | 0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B, | ||
| 162 | 0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00, | ||
| 163 | 0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE, | ||
| 164 | 0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00, | ||
| 165 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 166 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 167 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 168 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 169 | 0x00, 0x00, 0x00, 0xF8, 0xFC, 0xFE, | ||
| 170 | 0xFF, 0xE0, 0x00, 0xFF, 0xFF, 0xFF, | ||
| 171 | 0xFF, 0xFF, 0xFF, 0x80, 0xFF, 0xFF, | ||
| 172 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
| 173 | 0xFF, 0x1F, 0x07, 0x01, 0x00, 0x00, | ||
| 174 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 175 | 0x00, 0xFF, 0xFF, 0xFF, 0x81, 0x00, | ||
| 176 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, | ||
| 177 | 0xC3, 0xC3, 0xC3, 0x00, 0x00, 0xFF, | ||
| 178 | 0xFF, 0xFF, 0x81, 0x00, 0x00, 0x00, | ||
| 179 | 0x00, 0x00, 0x00, 0x81, 0xFF, 0xFF, | ||
| 180 | 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, | ||
| 181 | 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 182 | 0x00, 0xFF, 0xFF, 0xFF, 0x01, 0x00, | ||
| 183 | 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, | ||
| 184 | 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, | ||
| 185 | 0x9D, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, | ||
| 186 | 0x1C, 0x9D, 0xDF, 0xDF, 0xDF, 0x00, | ||
| 187 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 188 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 189 | 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, | ||
| 190 | 0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, | ||
| 191 | 0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, | ||
| 192 | 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00, | ||
| 193 | 0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20, | ||
| 194 | 0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00, | ||
| 195 | 0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F, | ||
| 196 | 0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00, | ||
| 197 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 198 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 199 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 200 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 201 | 0x00, 0x00, 0x00, 0x03, 0x0F, 0x1F, | ||
| 202 | 0x3F, 0x3F, 0x3F, 0x3F, 0x1F, 0x1F, | ||
| 203 | 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x3F, | ||
| 204 | 0x3F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, | ||
| 205 | 0x7F, 0x7C, 0x78, 0x78, 0x38, 0x1C, | ||
| 206 | 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 207 | 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, | ||
| 208 | 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, | ||
| 209 | 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, | ||
| 210 | 0x01, 0x03, 0x07, 0x07, 0x07, 0x07, | ||
| 211 | 0x07, 0x07, 0x07, 0x07, 0x03, 0x01, | ||
| 212 | 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, | ||
| 213 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 214 | 0x00, 0x07, 0x07, 0x07, 0x00, 0x00, | ||
| 215 | 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, | ||
| 216 | 0x07, 0x00, 0x00, 0x00, 0x01, 0x03, | ||
| 217 | 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, | ||
| 218 | 0x07, 0x07, 0x03, 0x01, 0x00, 0x00, | ||
| 219 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 220 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 221 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 222 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 223 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 224 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 225 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 226 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 227 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 228 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 229 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 230 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
| 231 | 0x00, 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 | /* | ||
| 2 | Copyright 2012-2018 Jun Wako, Jack Humbert, Yiancar | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along 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 | |||
| 22 | static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; | ||
| 23 | static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; | ||
| 24 | |||
| 25 | static inline void setPinOutput_writeLow(pin_t pin) { | ||
| 26 | ATOMIC_BLOCK_FORCEON { | ||
| 27 | setPinOutput(pin); | ||
| 28 | writePinLow(pin); | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | static inline void setPinInputHigh_atomic(pin_t pin) { | ||
| 33 | ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); } | ||
| 34 | } | ||
| 35 | |||
| 36 | static void select_row(uint8_t row) { | ||
| 37 | setPinOutput_writeLow(row_pins[row]); | ||
| 38 | } | ||
| 39 | |||
| 40 | static void unselect_row(uint8_t row) { | ||
| 41 | setPinInputHigh_atomic(row_pins[row]); | ||
| 42 | } | ||
| 43 | |||
| 44 | static void unselect_rows(void) { | ||
| 45 | for (uint8_t x = 0; x < MATRIX_ROWS; x++) { | ||
| 46 | setPinInputHigh_atomic(row_pins[x]); | ||
| 47 | } | ||
| 48 | } | ||
| 49 | |||
| 50 | static void select_col(uint8_t col) { | ||
| 51 | setPinOutput_writeLow(col_pins[col]); | ||
| 52 | } | ||
| 53 | |||
| 54 | static void unselect_col(uint8_t col) { | ||
| 55 | setPinInputHigh_atomic(col_pins[col]); | ||
| 56 | } | ||
| 57 | |||
| 58 | static void unselect_cols(void) { | ||
| 59 | for (uint8_t x = 0; x < MATRIX_COLS; x++) { | ||
| 60 | setPinInputHigh_atomic(col_pins[x]); | ||
| 61 | } | ||
| 62 | } | ||
| 63 | |||
| 64 | static 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 | |||
| 75 | static 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 | |||
| 101 | static 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 | |||
| 134 | void matrix_init_custom(void) { | ||
| 135 | init_pins(); | ||
| 136 | } | ||
| 137 | |||
| 138 | bool 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 |  | ||
| 4 | |||
| 5 | This 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 | |||
| 11 | Make example for this keyboard (after setting up your build environment): | ||
| 12 | |||
| 13 | make pistachio_pro:default | ||
| 14 | |||
| 15 | Flashing example for this keyboard: | ||
| 16 | |||
| 17 | make pistachio_pro:default:flash | ||
| 18 | |||
| 19 | To reset the keyboard into bootloader mode, press the reset switch on the underside. | ||
| 20 | |||
| 21 | 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/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 | ||
| 2 | MCU = atmega32u4 | ||
| 3 | |||
| 4 | # Bootloader selection | ||
| 5 | BOOTLOADER = atmel-dfu | ||
| 6 | |||
| 7 | # Build Options | ||
| 8 | # change yes to no to disable | ||
| 9 | # | ||
| 10 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration | ||
| 11 | MOUSEKEY_ENABLE = yes # Mouse keys | ||
| 12 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
| 13 | CONSOLE_ENABLE = no # Console for debug | ||
| 14 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 15 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 16 | SLEEP_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 | ||
| 18 | NKRO_ENABLE = no # USB Nkey Rollover | ||
| 19 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 20 | RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow | ||
| 21 | BLUETOOTH_ENABLE = no # Enable Bluetooth | ||
| 22 | AUDIO_ENABLE = no # Audio output | ||
| 23 | OLED_DRIVER_ENABLE = yes | ||
| 24 | ENCODER_ENABLE = yes | ||
| 25 | |||
| 26 | CUSTOM_MATRIX = lite | ||
| 27 | SRC += matrix.c | ||
| 28 | SRC += ./lib/bme280.c \ No newline at end of file | ||
