~ruther/qmk_firmware

a68f514a8a82a19b078315fd068db592cd811f19 — James Young 5 years ago 59c783d
[Keyboard] Add QMK support for Red Scarf I numberpads (#7767)

* Add support for Red Scarf I numberpads

* update info.json for configurator

* Update keyboards/redscarf_i/redscarf_i.c

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/redscarf_i/redscarf_i.h

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/redscarf_i/redscarf_i.h

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/redscarf_i/rules.mk

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/redscarf_i/info.json

Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/redscarf_i/info.json

Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/redscarf_i/info.json

Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/redscarf_i/keymaps/4x5_ortho/keymap.c

Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/redscarf_i/keymaps/4x5_ortho/keymap.c

Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/redscarf_i/keymaps/4x6_ortho/keymap.c

Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/redscarf_i/keymaps/4x6_ortho/keymap.c

Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/redscarf_i/readme.md

Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/redscarf_i/readme.md

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update keyboards/redscarf_i/rules.mk

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* rename keymaps, add default

* final touches! i think we're there

* remove .gitignore from keymaps directory

* remove unused custom keycodes from ortho_custom_4x5 keymap

* remove ortho_custom_5x4 keymap (identical to ortho_5x4 keymap)

* remove firmware size impacts from rules.mk

* change "MCU selection" to "MCU name" in rules.mk

* complete matrix array for LAYOUT_ortho_5x4 macro

Probably not needed, but I like when it's complete.

* add numpad layout macros

* correct info.json data

* update readme

Co-Authored-By: Ben Weakley <2173281+Defying@users.noreply.github.com>

* rename ortho keymaps to rows by columns per QMK convention

* rules.mk templating

* change uint32_t to layer_state_t per drashna

* use led_update_kb() per drashna

Co-authored-by: Ben Weakley <2173281+Defying@users.noreply.github.com>
Co-authored-by: fauxpark <fauxpark@gmail.com>
A keyboards/redscarf_i/config.h => keyboards/redscarf_i/config.h +45 -0
@@ 0,0 1,45 @@
/*
Copyright 2019 Ben Weakley

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      0x5959
#define DEVICE_VER      0x0001
#define MANUFACTURER    Red Scarf
#define PRODUCT         Red Scarf I
#define DESCRIPTION     QMK for Red Scarf I number pads

/* Matrix */
#define MATRIX_ROWS 6
#define MATRIX_COLS 4
#define MATRIX_ROW_PINS { D0, D1, D2, D3, D4, D5 }
#define MATRIX_COL_PINS { F0, F1, E6, C7 }
#define UNUSED_PINS
#define DIODE_DIRECTION COL2ROW

/* Backlight */
#define BACKLIGHT_PIN B5
#define BACKLIGHT_LEVELS 3
//#define BACKLIGHT_BREATHING

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
\ No newline at end of file

A keyboards/redscarf_i/info.json => keyboards/redscarf_i/info.json +114 -0
@@ 0,0 1,114 @@
{
    "keyboard_name": "Red Scarf I",
    "url": "",
    "maintainer": "qmk, defying",
    "width": 4,
    "layouts": {
        "LAYOUT_ortho_5x4": {
            "height": 5,
            "key_count": 20,
            "layout": [
                {"x":0, "y":0},
                {"x":1, "y":0},
                {"x":2, "y":0},
                {"x":3, "y":0},
                {"x":0, "y":1},
                {"x":1, "y":1},
                {"x":2, "y":1},
                {"x":3, "y":1},
                {"x":0, "y":2},
                {"x":1, "y":2},
                {"x":2, "y":2},
                {"x":3, "y":2},
                {"x":0, "y":3},
                {"x":1, "y":3},
                {"x":2, "y":3},
                {"x":3, "y":3},
                {"x":0, "y":4},
                {"x":1, "y":4},
                {"x":2, "y":4},
                {"x":3, "y":4}
            ]
        },
        "LAYOUT_ortho_6x4": {
            "height": 6,
            "key_count": 24,
            "layout": [
                {"x":0, "y":0},
                {"x":1, "y":0},
                {"x":2, "y":0},
                {"x":3, "y":0},
                {"x":0, "y":1},
                {"x":1, "y":1},
                {"x":2, "y":1},
                {"x":3, "y":1},
                {"x":0, "y":2},
                {"x":1, "y":2},
                {"x":2, "y":2},
                {"x":3, "y":2},
                {"x":0, "y":3},
                {"x":1, "y":3},
                {"x":2, "y":3},
                {"x":3, "y":3},
                {"x":0, "y":4},
                {"x":1, "y":4},
                {"x":2, "y":4},
                {"x":3, "y":4},
                {"x":0, "y":5},
                {"x":1, "y":5},
                {"x":2, "y":5},
                {"x":3, "y":5}
            ]
        },
        "LAYOUT_numpad_5x4": {
            "height": 5,
            "key_count": 17,
            "layout": [
                {"x":0, "y":0},
                {"x":1, "y":0},
                {"x":2, "y":0},
                {"x":3, "y":0},
                {"x":0, "y":1},
                {"x":1, "y":1},
                {"x":2, "y":1},
                {"x":0, "y":2},
                {"x":1, "y":2},
                {"x":2, "y":2},
                {"x":3, "y":1, "h":2},
                {"x":0, "y":3},
                {"x":1, "y":3},
                {"x":2, "y":3},
                {"x":0, "y":4, "w":2},
                {"x":2, "y":4},
                {"x":3, "y":3, "h":2}
            ]
        },
        "LAYOUT_numpad_6x4": {
            "height": 6,
            "key_count": 21,
            "layout": [
                {"x":0, "y":0},
                {"x":1, "y":0},
                {"x":2, "y":0},
                {"x":3, "y":0},
                {"x":0, "y":1},
                {"x":1, "y":1},
                {"x":2, "y":1},
                {"x":3, "y":1},
                {"x":0, "y":2},
                {"x":1, "y":2},
                {"x":2, "y":2},
                {"x":0, "y":3},
                {"x":1, "y":3},
                {"x":2, "y":3},
                {"x":3, "y":2, "h":2},
                {"x":0, "y":4},
                {"x":1, "y":4},
                {"x":2, "y":4},
                {"x":0, "y":5, "w":2},
                {"x":2, "y":5},
                {"x":3, "y":4, "h":2}
            ]
        }
    }
}

A keyboards/redscarf_i/keymaps/default/keymap.c => keyboards/redscarf_i/keymaps/default/keymap.c +28 -0
@@ 0,0 1,28 @@
/* Copyright 2019 Ben Weakley
 *
 * 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

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  [0] = LAYOUT_ortho_6x4( // Base
    KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
    KC_P7,   KC_P8,   KC_P9,   KC_PPLS,
    KC_P4,   KC_P5,   KC_P6,   KC_PEQL,
    KC_P1,   KC_P2,   KC_P3,   KC_ENT,
    KC_P0,   KC_UP,   KC_PDOT, KC_BSPC,
    KC_LEFT, KC_DOWN, KC_RGHT, BL_TOGG
  )
};

A keyboards/redscarf_i/keymaps/ortho_5x4/keymap.c => keyboards/redscarf_i/keymaps/ortho_5x4/keymap.c +49 -0
@@ 0,0 1,49 @@
/* Copyright 2019 Ben Weakley
 *
 * 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

enum custom_keycodes {
  KC_P00 = SAFE_RANGE
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  [0] = LAYOUT_ortho_5x4( // Base
    KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
    KC_P7,   KC_P8,   KC_P9,   KC_PPLS,
    KC_P4,   KC_P5,   KC_P6,   KC_PEQL,
    KC_P1,   KC_P2,   KC_P3,   KC_ENT,
    KC_P0,   KC_P00,  KC_PDOT, MO(1)
  ),
  [1] = LAYOUT_ortho_5x4( // Function 1
    _______, _______, _______, _______,
    _______, _______, _______, _______,
    BL_TOGG, BL_STEP, BL_BRTG, _______,
    KC_MUTE, KC_VOLD, KC_VOLU, _______,
    KC_MPRV, KC_MPLY, KC_MNXT, _______
  )
};

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  switch (keycode) {
    case KC_P00:
      if (record->event.pressed) {
        SEND_STRING("00");
      }
      break;
  }
  return true;
}

A keyboards/redscarf_i/keymaps/ortho_6x4/keymap.c => keyboards/redscarf_i/keymaps/ortho_6x4/keymap.c +36 -0
@@ 0,0 1,36 @@
/* Copyright 2019 Ben Weakley
 *
 * 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

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  [0] = LAYOUT_ortho_6x4( // Base
    KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
    KC_P7,   KC_P8,   KC_P9,   KC_PPLS,
    KC_P4,   KC_P5,   KC_P6,   KC_PEQL,
    KC_P1,   KC_P2,   KC_P3,   KC_ENT,
    KC_P0,   KC_UP,   KC_PDOT, KC_BSPC,
    KC_LEFT, KC_DOWN, KC_RGHT, MO(1)
  ),
  [1] = LAYOUT_ortho_6x4( // Function 1
    _______, _______, _______, _______,
    _______, _______, _______, _______,
    _______, _______, _______, _______,
    BL_TOGG, BL_STEP, BL_BRTG, _______,
    KC_MUTE, KC_VOLD, KC_VOLU, _______,
    KC_MPRV, KC_MPLY, KC_MNXT, _______
  )
};

A keyboards/redscarf_i/readme.md => keyboards/redscarf_i/readme.md +15 -0
@@ 0,0 1,15 @@
# Red Scarf I

![redscarf_i](https://i.imgur.com/Q6p81aX.jpg)

Port of QMK for Red Scarf I number pads, a five- or six-row number pad with support for in-switch single-color LEDs.

* Keyboard Maintainer: [The QMK Community](https://github.com/qmk), [Ben Weakley](https://github.com/defying)
* Hardware Supported: Red Scarf I PCBs
* Hardware Availability: no longer available

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

    make redscarf_i: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).

A keyboards/redscarf_i/redscarf_i.c => keyboards/redscarf_i/redscarf_i.c +54 -0
@@ 0,0 1,54 @@
/* Copyright 2019 Ben Weakley
 *
 * 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 "redscarf_i.h"

void keyboard_pre_init_kb(void) {
  // initialize top row leds
  setPinOutput(F7);
  setPinOutput(F6);
  setPinOutput(F5);
  // and then turn them off
  writePinHigh(F7);
  writePinHigh(F6);
  writePinHigh(F5);
}

bool led_update_kb(led_t led_state) {
    bool res = led_update_user(led_state);
    if(res) {
        writePin(F7, !led_state.num_lock);
    }
    return res;
}

layer_state_t layer_state_set_kb(layer_state_t state) {
  switch (biton32(state)) {
    case 1:
      writePinHigh(F6);
      writePinLow(F5);
      break;
    case 2:
      writePinLow(F6);
      writePinHigh(F5);
      break;
    default:
      writePinHigh(F6);
      writePinHigh(F5);
      break;
  }
  return state;
}

A keyboards/redscarf_i/redscarf_i.h => keyboards/redscarf_i/redscarf_i.h +85 -0
@@ 0,0 1,85 @@
/* Copyright 2019 Ben Weakley
 *
 * 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"

#define LAYOUT_ortho_6x4( \
    k00, k01, k02, k03, \
    k10, k11, k12, k13, \
    k20, k21, k22, k23, \
    k30, k31, k32, k33, \
    k40, k41, k42, k43, \
    k50, k51, k52, k53  \
) \
{ \
    { k00, k01, k02, k03 }, \
    { k10, k11, k12, k13 }, \
    { k20, k21, k22, k23 }, \
    { k30, k31, k32, k33 }, \
    { k40, k41, k42, k43 }, \
    { k50, k51, k52, k53 }  \
}

#define LAYOUT_ortho_5x4( \
    k00, k01, k02, k03, \
    k10, k11, k12, k13, \
    k20, k21, k22, k23, \
    k30, k31, k32, k33, \
    k40, k41, k42, k43  \
) \
{ \
    { k00,   k01,   k02,   k03   }, \
    { k10,   k11,   k12,   k13   }, \
    { k20,   k21,   k22,   k23   }, \
    { k30,   k31,   k32,   k33   }, \
    { k40,   k41,   k42,   k43   }, \
    { KC_NO, KC_NO, KC_NO, KC_NO }  \
}

#define LAYOUT_numpad_6x4( \
    k00, k01, k02, k03, \
    k10, k11, k12, k13, \
    k20, k21, k22,      \
    k30, k31, k32, k23, \
    k40, k41, k42,      \
    k50,      k52, k43  \
) \
{ \
    { k00, k01,   k02, k03   }, \
    { k10, k11,   k12, k13   }, \
    { k20, k21,   k22, k23   }, \
    { k30, k31,   k32, KC_NO }, \
    { k40, k41,   k42, k43   }, \
    { k50, KC_NO, k52, KC_NO }  \
}

#define LAYOUT_numpad_5x4( \
    k00, k01, k02, k03, \
    k10, k11, k12,      \
    k20, k21, k22, k13, \
    k30, k31, k32,      \
    k40,      k42, k33  \
) \
{ \
    { k00,   k01,   k02,   k03   }, \
    { k10,   k11,   k12,   k13   }, \
    { k20,   k21,   k22,   KC_NO }, \
    { k30,   k31,   k32,   k33   }, \
    { k40,   KC_NO, k42,   KC_NO }, \
    { KC_NO, KC_NO, KC_NO, KC_NO }  \
}

A keyboards/redscarf_i/rules.mk => keyboards/redscarf_i/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 = atmel-dfu

# Build Options
#   change yes to no to disable
#
BOOTMAGIC_ENABLE  = no      # Virtual DIP switch configuration
MOUSEKEY_ENABLE   = no      # 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
BACKLIGHT_ENABLE  = yes     # Enable keyboard backlight functionality
RGBLIGHT_ENABLE   = no      # Enable keyboard RGB underglow
MIDI_ENABLE       = no      # MIDI support
BLUETOOTH_ENABLE  = no      # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE      = no      # Audio output on port C6
FAUXCLICKY_ENABLE = no      # Use buzzer to emulate clicky switches
HD44780_ENABLE    = no      # Enable support for HD44780 based LCDs
UNICODE_ENABLE    = no      # Unicode

LAYOUTS = ortho_5x4 ortho_6x4 numpad_5x4 numpad_6x4