~ruther/qmk_firmware

1c0e8a6bb4718c693e24d87c19ccca435d2f1f58 — rate 4 years ago 10d9e8e
Add keyboard PistachioMacroPad (#10980)

Co-authored-by: Joel Challis <git@zvecr.com>
A keyboards/pistachio_mp/config.h => keyboards/pistachio_mp/config.h +78 -0
@@ 0,0 1,78 @@
/*
Copyright 2020 rate

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.222

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "config_common.h"

/* USB Device descriptor parameter */
#define VENDOR_ID    0xFEED
#define PRODUCT_ID   0xD0C3
#define DEVICE_VER   0x0001
#define MANUFACTURER rate
#define PRODUCT      pistachio_mp

/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 4

#ifdef ENCODER_ENABLE
#define ENCODERS_PAD_A {F4}
#define ENCODERS_PAD_B {F5}
#endif

/*
 * Keyboard Matrix Assignments
 *
 * Change this to how you wired your keyboard
 * COLS: AVR pins used for columns, left to right
 * ROWS: AVR pins used for rows, top to bottom
 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
 *                  ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
 *
 */
#define MATRIX_ROW_PINS { B4, E6, D7, C6, D4 }
#define MATRIX_COL_PINS { B3, B1, F7, F6 }
#define UNUSED_PINS

/* COL2ROW, ROW2COL */
#define DIODE_DIRECTION ROW2COL

#define RGB_DI_PIN D2
#define RGBLED_NUM 3
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#if defined(RGBLIGHT_ENABLE) && !defined(IOS_DEVICE_ENABLE)
  #define USB_MAX_POWER_CONSUMPTION 400
#else
  #define USB_MAX_POWER_CONSUMPTION 100
#endif

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

/* nKey Rollover */
#define FORCE_NKRO

/* disable these deprecated features by default */
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION

A keyboards/pistachio_mp/info.json => keyboards/pistachio_mp/info.json +30 -0
@@ 0,0 1,30 @@
{
    "keyboard_name": "pistachio_mp", 
    "url": "", 
    "maintainer": "rate", 
    "width": 4, 
    "height": 6.5, 
    "layouts": {
        "LAYOUT": {
            "layout": [
            {"label":"Encoder", "x":3, "y":0},
            {"label":"Num Lock", "x":0, "y":1.5},
            {"label":"/", "x":1, "y":1.5},
            {"label":"*", "x":2, "y":1.5},
            {"label":"-", "x":3, "y":1.5},
            {"label":"7", "x":0, "y":2.5},
            {"label":"8", "x":1, "y":2.5},
            {"label":"9", "x":2, "y":2.5},
            {"label":"+", "x":3, "y":2.5, "h":2},
            {"label":"4", "x":0, "y":3.5},
            {"label":"5", "x":1, "y":3.5},
            {"label":"6", "x":2, "y":3.5},
            {"label":"1", "x":0, "y":4.5},
            {"label":"2", "x":1, "y":4.5},
            {"label":"3", "x":2, "y":4.5},
            {"label":"Enter", "x":3, "y":4.5, "h":2},
            {"label":"0", "x":0, "y":5.5, "w":2},
            {"label":".", "x":2, "y":5.5}]
        }
    }
}
\ No newline at end of file

A keyboards/pistachio_mp/keymaps/default/keymap.c => keyboards/pistachio_mp/keymaps/default/keymap.c +55 -0
@@ 0,0 1,55 @@
/* Copyright 2020 rate
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include QMK_KEYBOARD_H

// Defines names for use in layer keycodes and the keymap
enum layer_names {
    _BASE = 0,
    _FN
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* Base */
    [_BASE] = LAYOUT(
                                           KC_MPLY,
    LT(_FN, KC_NLCK),  KC_PSLS,  KC_PAST,  KC_PMNS,
    KC_P7,             KC_P8,    KC_P9,
    KC_P4,             KC_P5,    KC_P6,    KC_PPLS,
    KC_P1,             KC_P2,    KC_P3,
    KC_P0,                       KC_PDOT,  KC_PENT
    ),
    /* Fn */
    [_FN] = LAYOUT(
                                KC_NO,
    KC_NO,   KC_NO,   KC_NO,    KC_NO,
    RGB_HUI, RGB_SAI, RGB_VAI,
    RGB_HUD, RGB_SAD, RGB_VAD,  RGB_TOG,
    KC_NO,   KC_NO,   KC_NO,
    KC_NO,            KC_NO,    KC_NO
    )
};
#ifdef ENCODER_ENABLE
void encoder_update_user(uint8_t index, bool clockwise) {
    if (index == 0) {
        // Volume control
        if (clockwise) {
            tap_code(KC_VOLU);
        } else {
            tap_code(KC_VOLD);
        }
    }
}
#endif

A keyboards/pistachio_mp/keymaps/default/readme.md => keyboards/pistachio_mp/keymaps/default/readme.md +1 -0
@@ 0,0 1,1 @@
# The default keymap for pistachio_mp

A keyboards/pistachio_mp/pistachio_mp.c => keyboards/pistachio_mp/pistachio_mp.c +17 -0
@@ 0,0 1,17 @@
/* Copyright 2020 rate
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "pistachio_mp.h"

A keyboards/pistachio_mp/pistachio_mp.h => keyboards/pistachio_mp/pistachio_mp.h +48 -0
@@ 0,0 1,48 @@
/* Copyright 2020 rate
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include "quantum.h"

/*
 * ,------------------------
 * |                   K07 |
 * |------------------------
 * | K00 | K01 | K02 | K03 |
 * |------------------------
 * | K04 | K05 | K06 |     |
 * |------------------ K11 -
 * | K08 | K09 | K10 |     |
 * |------------------------
 * | K12 | K13 | K14 |     |
 * |------------------ K17 -
 * |    K15    | K16 |     |
 * |------------------------
 */
#define LAYOUT( \
                   K07, \
    K00, K01, K02, K03, \
    K04, K05, K06,      \
    K08, K09, K10, K11, \
    K12, K13, K14,      \
    K15,      K16, K17 ) { \
    { K00,   K01,   K02,   K03 }, \
    { K04,   K05,   K06,   K07 }, \
    { K08,   K09,   K10,   K11 }, \
    { K12,   K13,   K14,   KC_NO }, \
    { K15,   KC_NO, K16,   K17 }, \
}

A keyboards/pistachio_mp/readme.md => keyboards/pistachio_mp/readme.md +21 -0
@@ 0,0 1,21 @@
# PistachioMacroPad

![PistachioMacroPad](https://ratelog.net/wp-content/uploads/2020/11/s-PXL_20201114_134133741.jpg)

This is a numeric keypad with a rotary encoder that uses a stainless steel plate.

* Keyboard Maintainer: [rate](https://github.com/7-rate)
* Hardware Supported: PistachioMacroPad PCB, Pro Micro, BMP MicroPro
* Hardware Availability: [PCB & CaseData](https://github.com/7-rate/Pistachio_MacroPad.git), [Booth Shop](https://rates.booth.pm/items/2531312)

Make example for this keyboard (after setting up your build environment):

    make pistachio_mp:default

Flashing example for this keyboard:

    make pistachio_mp:default:flash

See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).

[Build guide](https://ratelog.net/pistachiomacropad-build-guide/)
\ No newline at end of file

A keyboards/pistachio_mp/rules.mk => keyboards/pistachio_mp/rules.mk +23 -0
@@ 0,0 1,23 @@
# MCU name
MCU = atmega32u4

# Bootloader selection
BOOTLOADER = caterina

# Build Options
#   change yes to no to disable
#
BOOTMAGIC_ENABLE = lite     # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes       # Mouse keys
EXTRAKEY_ENABLE = yes       # Audio control and System control
CONSOLE_ENABLE = no         # Console for debug
COMMAND_ENABLE = no         # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no       # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = no            # USB Nkey Rollover
BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = yes       # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no       # Enable Bluetooth
AUDIO_ENABLE = no           # Audio output
ENCODER_ENABLE = yes