~ruther/qmk_firmware

b7b82d509bfccd69c6507761f03910f34b4366cb — Craig Gardner 4 years ago bf959d7
[Keyboard] add support for bigknob (#11291)

* add support for bigknob

Add support for bigknob macropad

* corrected files

* Apply suggestions from code review

Co-authored-by: Joel Challis <git@zvecr.com>

* corrected tap dance

* Update config.h

* correct image link

* Apply suggestions from code review

Co-authored-by: Ryan <fauxpark@gmail.com>

* added GPL headers

* Update readme.md

Co-authored-by: Joel Challis <git@zvecr.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
A keyboards/leafcutterlabs/bigknob/bigknob.c => keyboards/leafcutterlabs/bigknob/bigknob.c +17 -0
@@ 0,0 1,17 @@
/* Copyright 2021 Craig Gardner 
  * 
  * 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 "bigknob.h"

A keyboards/leafcutterlabs/bigknob/bigknob.h => keyboards/leafcutterlabs/bigknob/bigknob.h +27 -0
@@ 0,0 1,27 @@
/* Copyright 2021 Craig Gardner 
  * 
  * 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_1x5( \
    k01, k02, k03, k04, k05\
  ) { \
    { k01, k02, k03, k04, k05 } \
}

#define LAYOUT LAYOUT_ortho_1x5 
\ No newline at end of file

A keyboards/leafcutterlabs/bigknob/config.h => keyboards/leafcutterlabs/bigknob/config.h +58 -0
@@ 0,0 1,58 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>

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       0xCEEB
#define PRODUCT_ID      0x0007
#define DEVICE_VER      0x0001
#define MANUFACTURER    leafcutterlabs
#define PRODUCT         bigKNOB
/* key matrix size */
#define MATRIX_ROWS 1
#define MATRIX_COLS 5

/*
 * Keyboard Matrix Assignments
 *
 * Change this to how you wired your keyboard
 * COLS: AVR pins used for columns, left to right
 * ROWS: AVR pins used for rows, top to bottom
 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
 *                  ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
 *                  NO_DIODE = switches are directly connected to AVR pins
 *
*/

// Srating with closest to USB port 
#define DIRECT_PINS {   \
    { B7, D4, D6, F6, F7} \
}
#define UNUSED_PINS

/* rotary encoder 1,2,3 closest to usb port is 0*/
#define ENCODERS_PAD_A { D0}
#define ENCODERS_PAD_B { D2}
#define ENCODER_RESOLUTION 4 //default/suggested

/* ws2812 RGB LED */
#define RGB_DI_PIN C7 //D3 - underglow C7 - backlight
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 5    // Number of LEDs

A keyboards/leafcutterlabs/bigknob/info.json => keyboards/leafcutterlabs/bigknob/info.json +12 -0
@@ 0,0 1,12 @@
{
  "keyboard_name": "bigknob",
  "url": "",
  "maintainer": "qmk",
  "width": 5,
  "height": 1,
  "layouts": {
    "LAYOUT_ortho_1x5": {
      "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}]
    }
  }
}

A keyboards/leafcutterlabs/bigknob/keymaps/default/keymap.c => keyboards/leafcutterlabs/bigknob/keymaps/default/keymap.c +55 -0
@@ 0,0 1,55 @@
/* Copyright 2021 Craig Gardner 
  * 
  * 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

#define _MAIN 0

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

enum {
  TD_RGB = 0
};

void dance_rgb_finished (qk_tap_dance_state_t *state, void *user_data) {
  if (state->count == 1) {
    tap_code(KC_MNXT);
  } else if (state->count == 2) {
    rgblight_toggle();
  } else if (state->count == 3) {
    rgblight_step();
  }
}

//All tap dance functions would go here. Only showing this one.
qk_tap_dance_action_t tap_dance_actions[] = {
 [TD_RGB] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, dance_rgb_finished, NULL)
};

//
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //buttion closest to usb is first
  [_MAIN] = LAYOUT(
     KC_MUTE, KC_MEDIA_PREV_TRACK, KC_MEDIA_PLAY_PAUSE, KC_MEDIA_STOP, TD(TD_RGB)
  )
};

A keyboards/leafcutterlabs/bigknob/readme.md => keyboards/leafcutterlabs/bigknob/readme.md +15 -0
@@ 0,0 1,15 @@
# bigknob

A 4 key Macropad with Rotary Encoder based on Atmega32u4.

![](https://i.imgur.com/Px3EpOUl.jpg)

* Keyboard Maintainer: [LeafCutterLabs](https://github.com/LeafCutterLabs)
* Hardware Supported: Atmega32u4
* Hardware availability: Case files are available [here](https://github.com/LeafCutterLabs/bigKNOB)

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

    make leafcutterlabs/bigknob: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).

A keyboards/leafcutterlabs/bigknob/rules.mk => keyboards/leafcutterlabs/bigknob/rules.mk +24 -0
@@ 0,0 1,24 @@
# MCU name
MCU = atmega32u4

# Bootloader selection
BOOTLOADER = caterina

# 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 = yes           # 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        # Enable rotary encoders
TAP_DANCE_ENABLE = yes
\ No newline at end of file