From 85ba5074825f608501e14594764cdc3c82a08c01 Mon Sep 17 00:00:00 2001 From: Daniel Cormier Date: Mon, 4 Oct 2021 21:35:48 -0400 Subject: [PATCH] [Keyboard] Added DC MC 001 (#14661) --- keyboards/handwired/dc/mc/001/001.c | 17 ++++ keyboards/handwired/dc/mc/001/001.h | 33 ++++++++ keyboards/handwired/dc/mc/001/config.h | 83 +++++++++++++++++++ keyboards/handwired/dc/mc/001/info.json | 16 ++++ .../dc/mc/001/keymaps/default/keymap.c | 31 +++++++ .../dc/mc/001/keymaps/default/readme.md | 1 + keyboards/handwired/dc/mc/001/readme.md | 24 ++++++ keyboards/handwired/dc/mc/001/rules.mk | 22 +++++ 8 files changed, 227 insertions(+) create mode 100644 keyboards/handwired/dc/mc/001/001.c create mode 100644 keyboards/handwired/dc/mc/001/001.h create mode 100644 keyboards/handwired/dc/mc/001/config.h create mode 100644 keyboards/handwired/dc/mc/001/info.json create mode 100644 keyboards/handwired/dc/mc/001/keymaps/default/keymap.c create mode 100644 keyboards/handwired/dc/mc/001/keymaps/default/readme.md create mode 100644 keyboards/handwired/dc/mc/001/readme.md create mode 100644 keyboards/handwired/dc/mc/001/rules.mk diff --git a/keyboards/handwired/dc/mc/001/001.c b/keyboards/handwired/dc/mc/001/001.c new file mode 100644 index 0000000000..4745469fd6 --- /dev/null +++ b/keyboards/handwired/dc/mc/001/001.c @@ -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 . + */ + +#include "001.h" diff --git a/keyboards/handwired/dc/mc/001/001.h b/keyboards/handwired/dc/mc/001/001.h new file mode 100644 index 0000000000..317655162e --- /dev/null +++ b/keyboards/handwired/dc/mc/001/001.h @@ -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 . + */ + +#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 } \ +} diff --git a/keyboards/handwired/dc/mc/001/config.h b/keyboards/handwired/dc/mc/001/config.h new file mode 100644 index 0000000000..4c687ae7fa --- /dev/null +++ b/keyboards/handwired/dc/mc/001/config.h @@ -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 . +*/ + +#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 diff --git a/keyboards/handwired/dc/mc/001/info.json b/keyboards/handwired/dc/mc/001/info.json new file mode 100644 index 0000000000..d9562f660e --- /dev/null +++ b/keyboards/handwired/dc/mc/001/info.json @@ -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} + ] + } + } +} diff --git a/keyboards/handwired/dc/mc/001/keymaps/default/keymap.c b/keyboards/handwired/dc/mc/001/keymaps/default/keymap.c new file mode 100644 index 0000000000..6f6ca52d74 --- /dev/null +++ b/keyboards/handwired/dc/mc/001/keymaps/default/keymap.c @@ -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 . + */ +#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; +} diff --git a/keyboards/handwired/dc/mc/001/keymaps/default/readme.md b/keyboards/handwired/dc/mc/001/keymaps/default/readme.md new file mode 100644 index 0000000000..e207a7b80d --- /dev/null +++ b/keyboards/handwired/dc/mc/001/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for DC MC 001 diff --git a/keyboards/handwired/dc/mc/001/readme.md b/keyboards/handwired/dc/mc/001/readme.md new file mode 100644 index 0000000000..9a20ac339b --- /dev/null +++ b/keyboards/handwired/dc/mc/001/readme.md @@ -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 diff --git a/keyboards/handwired/dc/mc/001/rules.mk b/keyboards/handwired/dc/mc/001/rules.mk new file mode 100644 index 0000000000..3ec538b93a --- /dev/null +++ b/keyboards/handwired/dc/mc/001/rules.mk @@ -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