Skip to content

Commit

Permalink
[Keyboard] Add macro3 PCB support (qmk#15131)
Browse files Browse the repository at this point in the history
Co-authored-by: Joel Challis <[email protected]>
Co-authored-by: Drashna Jaelre <[email protected]>
Co-authored-by: Ryan <[email protected]>
Co-authored-by: filterpaper <filterpaper@localhost>
  • Loading branch information
5 people authored and mgor committed Nov 16, 2021
1 parent f212b62 commit ba5d3f3
Show file tree
Hide file tree
Showing 7 changed files with 220 additions and 0 deletions.
55 changes: 55 additions & 0 deletions keyboards/macro3/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* Copyright 2020 David Philip Barr <@davidphilipbarr>
* Copyright 2021 @filterpaper
*
* 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 0xC88B
#define PRODUCT_ID 0x3388
#define DEVICE_VER 0x0003
#define MANUFACTURER DPB
#define PRODUCT Macro3

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

/* key matrix pins */
#define DIRECT_PINS { \
{ D7, C6, D4, D1 }, \
{ B1, B4, B5, B3 } \
}

#define ENCODERS_PAD_A { D2, F7 }
#define ENCODERS_PAD_B { D3, F6 }

#define UNUSED_PINS

/* 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

/* Top right key */
#define BOOTMAGIC_LITE_ROW 0
#define BOOTMAGIC_LITE_COLUMN 3

20 changes: 20 additions & 0 deletions keyboards/macro3/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"keyboard_name": "Macro3",
"url": "https://github.com/davidphilipbarr/Macropads/tree/main/macro3",
"maintainer": "@davidphilipbarr",
"layouts": {
"LAYOUT": {
"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},
]
}
}
}
30 changes: 30 additions & 0 deletions keyboards/macro3/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* Copyright 2020 David Philip Barr <@davidphilipbarr>
* Copyright 2021 @filterpaper
*
* 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(
KC_HOME, KC_MUTE, KC_MPLY, KC_MSEL,
KC_UNDO, KC_CUT, KC_COPY, LT(1,KC_PSTE)
),
[1] = LAYOUT(
_______, _______, _______, _______,
RESET, _______, _______, _______
)
};

39 changes: 39 additions & 0 deletions keyboards/macro3/macro3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* Copyright 2020 David Philip Barr <@davidphilipbarr>
* Copyright 2021 @filterpaper
*
* 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 "macro3.h"

#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 1) {
if (clockwise) {
tap_code(KC_VOLD);
} else {
tap_code(KC_VOLU);
}
} else if (index == 0) {
if (clockwise) {
tap_code(KC_WH_D);
} else {
tap_code(KC_WH_U);
}
}
return true;
}
#endif

28 changes: 28 additions & 0 deletions keyboards/macro3/macro3.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* Copyright 2020 David Philip Barr <@davidphilipbarr>
* Copyright 2021 @filterpaper
*
* 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 "quantum.h"

#define LAYOUT( \
K00, K01, K02, K03, \
K10, K11, K12, K13 \
) \
{ \
{ K00, K01, K02, K03 }, \
{ K10, K11, K12, K13 } \
}

26 changes: 26 additions & 0 deletions keyboards/macro3/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Macro3

![Macro3](https://github.com/davidphilipbarr/Macropads/raw/main/macro3/IMG_20200703_170424.jpg)

Macro3 is a low-profile macro pad with encoder support designed by [@davidphilipbarr](https://github.com/davidphilipbarr) using direct micro-controller pin wiring.

## Keyboard Info

* Keyboard Maintainer: [davidphilipbarr](https://github.com/davidphilipbarr)
* Hardware Supported: [Macro3](https://github.com/davidphilipbarr/Macropads/tree/main/macro3)
* Hardware Availability: order PCBs with gerber file from the repository

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

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

## Bootloader

Enter the bootloader in 3 ways:

* **Bootmagic reset**: Hold down the top right key and plug in the controller.
* **Physical reset button**: Briefly press the reset button soldered on the PCB.
* **Keycode in layout**: Press the key mapped to `RESET` if it is configured.

22 changes: 22 additions & 0 deletions keyboards/macro3/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# MCU name
MCU = atmega32u4

# Bootloader selection
BOOTLOADER = atmel-dfu

# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
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 = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
ENCODER_ENABLE = yes

0 comments on commit ba5d3f3

Please sign in to comment.