~ruther/qmk_firmware

1f38221ec5ea95429fe3dbc739065b5598fedfc9 — duoshock 4 years ago 68c3773
[Keyboard] Add ISO Macro keyboard (#11517)

* -

* -

* -

* -

* -

Co-authored-by: online <33636898+online@users.noreply.github.com>
A keyboards/merge/iso_macro/config.h => keyboards/merge/iso_macro/config.h +42 -0
@@ 0,0 1,42 @@
 /* Copyright 2021 duoshock 
  * 
  * 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"

#define VENDOR_ID       0xFEED
#define PRODUCT_ID      0x1200
#define DEVICE_VER      0x0001
#define MANUFACTURER    Merge
#define PRODUCT         ISO Macro

/* key matrix size */
#define MATRIX_ROWS 3
#define MATRIX_COLS 3

#define MATRIX_ROW_PINS { F4, F5, F6}
#define MATRIX_COL_PINS { B4, B5, B6}
#define UNUSED_PINS
#define BACKLIGHT_PIN B7

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW


#define ENCODERS_PAD_A { F0, D0 }
#define ENCODERS_PAD_B { F1, D1 }
#define ENCODER_RESOLUTION 4

A keyboards/merge/iso_macro/iso_macro.c => keyboards/merge/iso_macro/iso_macro.c +17 -0
@@ 0,0 1,17 @@
 /* Copyright 2021 duoshock 
  * 
  * 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 "iso_macro.h"

A keyboards/merge/iso_macro/iso_macro.h => keyboards/merge/iso_macro/iso_macro.h +29 -0
@@ 0,0 1,29 @@
 /* Copyright 2021 duoshock 
  * 
  * 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( \
      k21, k00, k01, k02, k20, \
      k22, k10, k11, k12 \
) \
{ \
    { k00, k01, k02 }, \
    { k10, k11, k12 }, \
    { k20, k21, k22 }  \
} 

A keyboards/merge/iso_macro/keymaps/default/keymap.c => keyboards/merge/iso_macro/keymaps/default/keymap.c +49 -0
@@ 0,0 1,49 @@
/* Copyright 2021 duoshock 
  * 
  * 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] = {

/* LAYER 0
 * ,---------------------------------------------.
 * | Encoder A  |   4   |   5   |   6   | Enter  |
 * |------------|-------+-------+-------|        |
 * | Encoder B  |   1   |   2   |   3   |        |
 * `---------------------------------------------'
 */
[0] = LAYOUT(
  KC_HOME, KC_4, KC_5, KC_6, KC_ENT,
  KC_MUTE, KC_1, KC_2, KC_3
),
};


void encoder_update_user(uint8_t index, bool clockwise) {
    if (index == 0) { // Encdoer A
        if (clockwise) {
            tap_code(KC_UP);
        } else {
            tap_code(KC_DOWN);
        }
    } else if (index == 1) { // Encoder B
        if (clockwise) {
            tap_code(KC_VOLU);
        } else {
            tap_code(KC_VOLD);
        }
    }
}
\ No newline at end of file

A keyboards/merge/iso_macro/keymaps/default/readme.md => keyboards/merge/iso_macro/keymaps/default/readme.md +5 -0
@@ 0,0 1,5 @@
# Default ISO Macro Layout

![ISO Macro Layout Image](https://i.imgur.com/5NEfKVz.jpg)

This is the default layout that comes flashed on every ISO Macro.

A keyboards/merge/iso_macro/keymaps/via/keymap.c => keyboards/merge/iso_macro/keymaps/via/keymap.c +64 -0
@@ 0,0 1,64 @@
 /* Copyright 2021 duoshock 
  * 
  * 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] = {

/* LAYER 0
 * ,---------------------------------------------.
 * | Encoder A  |   4   |   5   |   6   | Enter  |
 * |------------|-------+-------+-------|        |
 * | Encoder B  |   1   |   2   |   3   |        |
 * `---------------------------------------------'
 */
[0] = LAYOUT(
  BL_TOGG, KC_4, KC_5, KC_6, KC_ENT,
  KC_MUTE, KC_1, KC_2, KC_3
),

[1] = LAYOUT(
  KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),

[2] = LAYOUT(
  KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),

[3] = LAYOUT(
  KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
};


void encoder_update_user(uint8_t index, bool clockwise) {
    if (index == 0) { // Encoder A
        if (clockwise) {
            backlight_increase();
        } else {
            backlight_decrease();
        }
    } else if (index == 1) { // Encoder B
        if (clockwise) {
            tap_code(KC_VOLU);
        } else {
            tap_code(KC_VOLD);
        }
    }
}
\ No newline at end of file

A keyboards/merge/iso_macro/keymaps/via/rules.mk => keyboards/merge/iso_macro/keymaps/via/rules.mk +2 -0
@@ 0,0 1,2 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
\ No newline at end of file

A keyboards/merge/iso_macro/readme.md => keyboards/merge/iso_macro/readme.md +14 -0
@@ 0,0 1,14 @@
# ISO Macro

![ISO Macro](https://i.imgur.com/wJoaZ8xl.jpg)

A 7 keys macro pad with 2 encoders made and sold by Merge. [Product page](https://mergedesign.store/products/iso-macro)

* Keyboard Maintainer: [duoshock](https://github.com/duoshock)
* Hardware Availability: [Merge Store](https://mergedesign.store/products/iso-macro)

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

    make merge/isomacro: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).
\ No newline at end of file

A keyboards/merge/iso_macro/rules.mk => keyboards/merge/iso_macro/rules.mk +23 -0
@@ 0,0 1,23 @@
# MCU name
MCU = atmega32u4

# Bootloader selection
BOOTLOADER = atmel-dfu

# Build Options
#   change yes to no to disable
#
BOOTMAGIC_ENABLE = no       # 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 = yes      # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no       # Enable Bluetooth
AUDIO_ENABLE = no           # Audio output
ENCODER_ENABLE = yes
\ No newline at end of file