1
0
Fork 0

[Keyboard] manyboard macro (#11896)

Co-authored-by: Joel Challis <git@zvecr.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
This commit is contained in:
William Ehman 2021-07-02 21:53:13 -06:00 committed by GitHub
parent 04bc74d8f5
commit ad30218701
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 314 additions and 0 deletions

View file

@ -0,0 +1,53 @@
/*
Copyright 2020 William Ehman
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 0x4D42 // MB
#define PRODUCT_ID 0x0015 // 15 keys
#define DEVICE_VER 0x0103
#define MANUFACTURER Manyboard
#define PRODUCT MB_Macro
/* key matrix size */
#define MATRIX_ROWS 4
#define MATRIX_COLS 4
/* key matrix pins */
#define MATRIX_ROW_PINS { D0, D1, D2, D3 }
#define MATRIX_COL_PINS { D4, D5, D6, D7 }
#define UNUSED_PINS
/*Encoder Pins*/
#define ENCODERS_PAD_A { C6 }
#define ENCODERS_PAD_B { C7 }
/* COL2ROW, ROW2COL */
#define DIODE_DIRECTION ROW2COL
/* RGB Pins */
#define RGB_DI_PIN B6
#define RGBLED_NUM 2
#define RGBLIGHT_LIMIT_VAL 10
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
/* disable these deprecated features by default */
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION

View file

@ -0,0 +1,29 @@
{
"keyboard_name": "manyboard_macro",
"url": "https://github.com/WillEhman/qmk_firmware/tree/dev_create_mb_macro",
"maintainer": "William Ehman",
"width": 4,
"height": 4,
"layouts": {
"LAYOUT_ortho_4x4": {
"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}
]
}
}
}

View file

@ -0,0 +1,73 @@
/* Copyright 2020 William Ehman
*
* 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_4x4(
KC_F1, KC_F2, KC_F3, KC_F4,
KC_F5, KC_F6, KC_F7, KC_F8,
KC_F9, KC_F10, KC_F11, KC_F12,
KC_F13, KC_F14, KC_F15, TO(1)
),
[1] = LAYOUT_ortho_4x4(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, TO(2)
),
[2] = LAYOUT_ortho_4x4(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, TO(0)
),
};
layer_state_t layer_state_set_user(layer_state_t state) {
switch (get_highest_layer(state)) {
case 0:
sethsv(HSV_WHITE, (LED_TYPE *)&led[0]);
rgblight_set();
break;
case 1:
sethsv(HSV_GREEN, (LED_TYPE *)&led[0]);
rgblight_set();
break;
case 2:
sethsv(HSV_BLUE, (LED_TYPE *)&led[0]);
rgblight_set();
break;
}
return state;
}
void encoder_update_user(uint8_t index, bool clockwise) {
/* With an if statement we can check which encoder was turned. */
if (index == 0) { /* First encoder */
/* And with another if statement we can check the direction. */
if (clockwise) {
/* This is where the actual magic happens: this bit of code taps on the
Page Down key. You can do anything QMK allows you to do here.
You'll want to replace these lines with the things you want your
encoders to do. */
tap_code(KC_AUDIO_VOL_UP);
} else {
/* And likewise for the other direction, this time Vol Down is pressed. */
tap_code(KC_AUDIO_VOL_DOWN);
}
}
}

View file

@ -0,0 +1,72 @@
/* Copyright 2020 William Ehman
*
* 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_4x4(
KC_F1, KC_F2, KC_F3, KC_F4,
KC_F5, KC_F6, KC_F7, KC_F8,
KC_F9, KC_F10, KC_F11, KC_F12,
KC_F13, KC_F14, KC_F15, TO(1)
),
[1] = LAYOUT_ortho_4x4(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, TO(2)
),
[2] = LAYOUT_ortho_4x4(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, TO(0)
),
};
layer_state_t layer_state_set_user(layer_state_t state) {
switch (get_highest_layer(state)) {
case 0:
sethsv(HSV_WHITE, (LED_TYPE *)&led[0]);
rgblight_set();
break;
case 1:
sethsv(HSV_GREEN, (LED_TYPE *)&led[0]);
rgblight_set();
break;
case 2:
sethsv(HSV_BLUE, (LED_TYPE *)&led[0]);
rgblight_set();
break;
}
return state;
}
void encoder_update_user(uint8_t index, bool clockwise) {
/* With an if statement we can check which encoder was turned. */
if (index == 0) { /* First encoder */
/* And with another if statement we can check the direction. */
if (clockwise) {
/* This is where the actual magic happens: this bit of code taps on the
Page Down key. You can do anything QMK allows you to do here.
You'll want to replace these lines with the things you want your
encoders to do. */
tap_code(KC_AUDIO_VOL_UP);
} else {
/* And likewise for the other direction, this time Vol Down is pressed. */
tap_code(KC_AUDIO_VOL_DOWN);
}
}
}

View file

@ -0,0 +1 @@
VIA_ENABLE = yes

View file

@ -0,0 +1,17 @@
/* Copyright 2020 WillEhman
*
* 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 "macro.h"

View file

@ -0,0 +1,31 @@
/* Copyright 2020 WillEhman
*
* 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_4x4( \
K00, K01, K02, K03, \
K10, K11, K12, K13, \
K20, K21, K22, K23, \
K30, K31, K32, K33 \
) { \
{ K00, K01, K02, K03 }, \
{ K10, K11, K12, K13 }, \
{ K20, K21, K22, K23 }, \
{ K30, K31, K32, K33 } \
}

View file

@ -0,0 +1,15 @@
# manyboard_macro
* Keyboard Maintainer: [WillEhman](https://github.com/WillEhman)
* Hardware Supported: The Manyboard Family of keyboards
* Hardware Availability: TBA
Make example for this keyboard (after setting up your build environment):
make manyboard/macro:default
Flashing example for this keyboard:
make manyboard/macro: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).

View file

@ -0,0 +1,23 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
BOOTLOADER = atmel-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = lite # 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 = 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 = yes # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no # Enable Bluetooth
AUDIO_ENABLE = no # Audio output
ENCODER_ENABLE = yes # Encoder Input