~ruther/qmk_firmware

ad36bb37dd775de5132a68fbd6ad9cdf73b0c070 — Salicylic-acid3 5 years ago 1c9e450
[Keyboard] Add keyboard Nafuda (#7367)

* [Keyboard] Add keyboard Nafuda

Add Nafuda keyboard.

A 7 keys keyboard.
Salicylic-acid3

* Update keyboards/nafuda/info.json

* Update keyboards/nafuda/readme.md

* Update keyboards/nafuda/readme.md

* Update keyboards/nafuda/nafuda.h

* Update keyboards/nafuda/readme.md

* Update keyboards/nafuda/rules.mk

* Update keyboards/nafuda/rules.mk

* Update keyboards/nafuda/rules.mk

* Update keyboards/nafuda/rules.mk

* info.json Update

* Update keyboards/nafuda/rules.mk
A keyboards/nafuda/config.h => keyboards/nafuda/config.h +69 -0
@@ 0,0 1,69 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2015 Jack Humbert

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

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

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

#pragma once

#include "config_common.h"

/* USB Device descriptor parameter */
#define VENDOR_ID       0xFEED
#define PRODUCT_ID      0x3060
#define DEVICE_VER      0x0012
#define MANUFACTURER    Salicylic_Acid
#define PRODUCT         nafuda
#define DESCRIPTION     A custom cursorpad

/* key matrix size */
#define MATRIX_ROWS 3
#define MATRIX_COLS 3

// wiring of each half
#define MATRIX_ROW_PINS { D1, D0, D4 }
#define MATRIX_COL_PINS { F4, F5, F6 }

/* Set 0 if debouncing isn't 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

/* ws2812 RGB LED */
#define RGB_DI_PIN D3

#define RGBLED_NUM 7    // Number of LEDs
#define RGBLIGHT_ANIMATIONS

#ifndef IOS_DEVICE_ENABLE
  #define RGBLIGHT_LIMIT_VAL 180
  #define RGBLIGHT_VAL_STEP 17
#else
  #define RGBLIGHT_LIMIT_VAL 50
  #define RGBLIGHT_VAL_STEP 4
#endif
#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
  // fix iPhone and iPad power adapter issue
  // iOS device need lessthan 100
  #define USB_MAX_POWER_CONSUMPTION 100
#endif

A keyboards/nafuda/info.json => keyboards/nafuda/info.json +20 -0
@@ 0,0 1,20 @@
{
    "keyboard_name": "nafuda", 
    "url": "https://salicylic-acid3.hatenablog.com/", 
    "maintainer": "Salicylic_acid3", 
    "width": 3, 
    "height": 3, 
    "layouts": {
        "LAYOUT": {
            "layout": [
                {"label":"Mouse", "x":1, "y":0},
                {"label":"Backspace", "x":0, "y":0.5},
                {"label":"\u2191", "x":1, "y":1},
                {"label":"Browser", "x":2, "y":0.5},
                {"label":"\u2190", "x":0, "y":1.5},
                {"label":"\u2193", "x":1, "y":2},
                {"label":"\u2192", "x":2, "y":1.5}
            ]
        }
    }
}

A keyboards/nafuda/keymaps/default/config.h => keyboards/nafuda/keymaps/default/config.h +23 -0
@@ 0,0 1,23 @@
/* Copyright 2018 Salicylic_acid3
 *
 * 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

/* Select hand configuration */

#define TAPPING_FORCE_HOLD
#define TAPPING_TERM 180


A keyboards/nafuda/keymaps/default/keymap.c => keyboards/nafuda/keymaps/default/keymap.c +61 -0
@@ 0,0 1,61 @@
#include QMK_KEYBOARD_H

#ifdef RGBLIGHT_ENABLE
//Following line allows macro to read current RGB settings
extern rgblight_config_t rgblight_config;
#endif

extern uint8_t is_master;

// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
enum layer_number {
  _BASE,
  _MOUSE,
  _BROWSER,
  _ADJUST,
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  [_BASE] = LAYOUT(
  //|-------------------------------------------|
                          TG(_MOUSE),
  //|---------------+---------------+-----------|
LT(_ADJUST, KC_BSPC),          KC_UP,TG(_BROWSER),
  //|---------------+---------------+-----------|
             KC_LEFT,        KC_DOWN,    KC_RIGHT
  //|-------------------------------------------|
  ),

  [_MOUSE] = LAYOUT(
  //|-------------------------------------------|
                          TG(_MOUSE),
  //|---------------+---------------+-----------|
             KC_BTN1,        KC_MS_U,    KC_BTN2,
  //|---------------+---------------+-----------|
             KC_MS_L,        KC_MS_D,    KC_MS_R
  //|-------------------------------------------|
  ),

  [_BROWSER] = LAYOUT(
  //|-------------------------------------------|
                          LCTL(KC_W),
  //|---------------+---------------+-----------|
    LCTL(LSFT(KC_T)),        KC_WH_U,TG(_BROWSER),
  //|---------------+---------------+-----------|
  LCTL(LSFT(KC_TAB)),        KC_WH_D,LCTL(KC_TAB)
  //|-------------------------------------------|
  ),

  [_ADJUST] = LAYOUT( /* Base */
  //|-------------------------------------------|
                             RGB_VAD,
  //|---------------+---------------+-----------|
         MO(_ADJUST),        RGB_SAD,    RGB_VAI,
  //|---------------+---------------+-----------|
             RGB_MOD,        RGB_TOG,    RGB_SAI
  //|-------------------------------------------|
  )
};

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

## Base
|        1       |     2    |  3    |
|:--------------:|:--------:|:-----:|
|                |   MOUSE  |       |
| ADJUST or BSPC |     UP   |BROWSER|
|    LEFT        |    DOWN  |  RIGHT|


## MOUSE
|  1       |     2    |     3     |
|:--------:|:--------:|:---------:|
|          |    BASE  |           |
|    Btn 1 | MOUSE_UP |    Btn2   |
|MOUSE_LEFT|MOUSE_DOWN|MOUSE_RIGHT|


## BROWSER
|       1     |     2    |    3    |
|:-----------:|:--------:|:-------:|
|             |  LCTL(W) |         |
| LCTL+LSFT(T)| WHEEL_UP | BROWSER |
|LCTL+SFT(TAB)|WHEEL_DOWN|LCTL(TAB)|


## Adjust
|    1    |     2   |    3   |
|:-------:|:-------:|:------:|
|         | RGB_VAD |        |
| Adjust  | RGB_SAD | RGB_VAI|
| RGB_MOD | RGB_TOG | RGB_SAI|



A keyboards/nafuda/nafuda.c => keyboards/nafuda/nafuda.c +5 -0
@@ 0,0 1,5 @@
#include "nafuda.h"

void matrix_init_kb(void) {
	matrix_init_user();
};

A keyboards/nafuda/nafuda.h => keyboards/nafuda/nafuda.h +24 -0
@@ 0,0 1,24 @@
#pragma once

#include "quantum.h"

/*
 * ,-----------------.
 * |     | L01 |     |
 * |-----------------+
 * | L10 | L11 | L12 |
 * |-----------------+
 * | L20 | L21 | L22 |
 * |-----------------'
 */

#define LAYOUT( \
         L01,      \
    L10, L11, L12, \
    L20, L21, L22  \
  ) \
  { \
    {KC_NO,  L01,KC_NO  },  \
    {  L10,  L11,  L12  },  \
    {  L20,  L21,  L22  }   \
  }

A keyboards/nafuda/readme.md => keyboards/nafuda/readme.md +17 -0
@@ 0,0 1,17 @@
# nafuda

![nafuda](https://cdn-ak.f.st-hatena.com/images/fotolife/S/Salicylic_acid3/20190608/20190608024901.jpg)

This is 7 keys cursor macropad. 

* Keyboard Maintainer: [Salicylic_acid3](https://github.com/Salicylic-acid3)
* Hardware Supported: Nafuda PCB, Pro Micro
* Hardware Availability: [PCB & Case Data](https://github.com/Salicylic-acid3/PCB_Data), [Booth Shop](https://salicylic-acid3.booth.pm/items/1271706)

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

    make nafuda:default

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

[Build guide](https://salicylic-acid3.hatenablog.com/entry/nafuda-build-guide) 

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

# Bootloader selection
#   Teensy       halfkay
#   Pro Micro    caterina
#   Atmel DFU    atmel-dfu
#   LUFA DFU     lufa-dfu
#   QMK DFU      qmk-dfu
#   ATmega32A    bootloadHID
#   ATmega328P   USBasp
BOOTLOADER = caterina

# Build Options
#   change yes to no to disable
#
BOOTMAGIC_ENABLE = no       # 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 = yes        # Commands for debug and configuration
NKRO_ENABLE = no            # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
MIDI_ENABLE = no            # MIDI controls
AUDIO_ENABLE = no           # Audio output on port C6
UNICODE_ENABLE = no         # Unicode
BLUETOOTH_ENABLE = no       # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = yes       # Enable WS2812 RGB underlight. 
TAP_DANCE_ENABLE = no
OLED_DRIVER_ENABLE = no
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no    # Breathing sleep LED during USB suspend