~ruther/qmk_firmware

85ba5074825f608501e14594764cdc3c82a08c01 — Daniel Cormier 3 years ago b441efb
[Keyboard] Added DC MC 001 (#14661)

A keyboards/handwired/dc/mc/001/001.c => keyboards/handwired/dc/mc/001/001.c +17 -0
@@ 0,0 1,17 @@
/* Copyright 2021 Daniel Cormier
 *
 * 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 "001.h"

A keyboards/handwired/dc/mc/001/001.h => keyboards/handwired/dc/mc/001/001.h +33 -0
@@ 0,0 1,33 @@
/* Copyright 2021 Daniel Cormier
 *
 * 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"

/* This is a shortcut to help you visually see your layout.
 *
 * The first section contains all of the arguments representing the physical
 * layout of the board and position of the keys.
 *
 * The second converts the arguments into a two-dimensional array which
 * represents the switch matrix.
 */
#define LAYOUT( \
    k00, k01, k02, k03, k04 \
) { \
    { k00, k01, k02, k03, k04 } \
}

A keyboards/handwired/dc/mc/001/config.h => keyboards/handwired/dc/mc/001/config.h +83 -0
@@ 0,0 1,83 @@
/*
Copyright 2021 Daniel Cormier

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 0x4443   // 'D' 'C'
#define PRODUCT_ID 0x4D43  // 'M' 'C'
#define DEVICE_VER 0x0001
#define MANUFACTURER Daniel Cormier
#define PRODUCT DC MC 001

/*
    BUTTON_MUTE           = _BV(4),
    BUTTON_STOP           = _BV(0),
    BUTTON_TRACK_PREVIOUS = _BV(1),
    BUTTON_TRACK_NEXT     = _BV(2),
    BUTTON_PLAY_PAUSE     = _BV(3),
*/
#define DIRECT_PINS            \
    {                          \
        { B4, B0, B1, B2, B3 } \
    }
#define UNUSED_PINS

/*
    RE_CHANNEL_A          = _BV(6),
    RE_CHANNEL_B          = _BV(5),
*/
#define ENCODERS_PAD_A \
    { B6 }
#define ENCODERS_PAD_B \
    { B5 }
#define ENCODER_RESOLUTION 4

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
// All the keys just need 5ms of debounce, but the mute button on the rotary
// encoderneeds much more (50ms).
#define DEBOUNCE 50

/*
 * Feature disable options
 *  These options are also useful to firmware size reduction.
 */

/* disable debug print */
//#define NO_DEBUG

/* disable print */
//#define NO_PRINT

/* disable action features */
#define NO_ACTION_LAYER
#define NO_ACTION_TAPPING
#define NO_ACTION_ONESHOT

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

/* Bootmagic Lite key configuration */
// The (default) Stop key
// Doesn't work, though. Maybe becuase of the bootloader that's in use?
#define BOOTMAGIC_LITE_ROW 0
#define BOOTMAGIC_LITE_COLUMN 1

#define USB_MAX_POWER_CONSUMPTION 100

A keyboards/handwired/dc/mc/001/info.json => keyboards/handwired/dc/mc/001/info.json +16 -0
@@ 0,0 1,16 @@
{
    "keyboard_name": "Daniel Cormier's Media Controller (v1)",
    "url": "https://imgur.com/a/PM9lQ",
    "maintainer": "Daniel Cormier (Twitter: @danielcormier)",
    "layouts": {
        "LAYOUT": {
            "layout": [
                {"label": "Mute", "x": 0, "y": 0},
                {"label": "Stop", "x": 1, "y": 0},
                {"label": "Previous", "x": 2, "y": 0},
                {"label": "Next", "x": 3, "y": 0},
                {"label": "Play/Pause", "x": 4, "y": 0}
            ]
        }
    }
}

A keyboards/handwired/dc/mc/001/keymaps/default/keymap.c => keyboards/handwired/dc/mc/001/keymaps/default/keymap.c +31 -0
@@ 0,0 1,31 @@
/* Copyright 2021 Daniel Cormier
 *
 * 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] = {
    LAYOUT(KC_AUDIO_MUTE, KC_MEDIA_STOP, KC_MEDIA_PREV_TRACK, KC_MEDIA_NEXT_TRACK, KC_MEDIA_PLAY_PAUSE),
};

bool encoder_update_user(uint8_t index, bool clockwise) {
    if (index == 0) {
        if (clockwise) {
            tap_code(KC_VOLU);
        } else {
            tap_code(KC_VOLD);
        }
    }
    return true;
}

A keyboards/handwired/dc/mc/001/keymaps/default/readme.md => keyboards/handwired/dc/mc/001/keymaps/default/readme.md +1 -0
@@ 0,0 1,1 @@
# The default keymap for DC MC 001

A keyboards/handwired/dc/mc/001/readme.md => keyboards/handwired/dc/mc/001/readme.md +24 -0
@@ 0,0 1,24 @@
# handwired/dc/mc/001

[![handwired/dc/mc/001](https://i.imgur.com/bv2g32U.jpg)
*A freestanding media controller*](https://imgur.com/a/PM9lQ)

* Keyboard Maintainer: [Daniel Cormier](https://github.com/dcormier)
* Hardware Supported: Adafruit Atmega32u4 Breakout Board
* Hardware Availability: https://www.adafruit.com/product/296

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

    make handwired/dc/mc/001:default

Flashing example for this keyboard:

    make handwired/dc/mc/001: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).

## Bootloader

Enter the bootloader:

* **Physical reset button**: Briefly press the button on the top of the PCB

A keyboards/handwired/dc/mc/001/rules.mk => keyboards/handwired/dc/mc/001/rules.mk +22 -0
@@ 0,0 1,22 @@
# MCU name
MCU = atmega32u4

# Bootloader selection
BOOTLOADER = caterina

# Build Options
#   change yes to no to disable
#
BOOTMAGIC_ENABLE = yes      # Enable Bootmagic Lite
EXTRAKEY_ENABLE = yes       # Audio control and System control
ENCODER_ENABLE = yes        # Using a rotary encoder for volume control
MOUSEKEY_ENABLE = no        # Mouse keys
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 = no        # Enable keyboard RGB underglow
AUDIO_ENABLE = no           # Audio output