NIU Mini Settings update and Refactor (#6651)

* update codebase to four-space indent

* update codebase to use #pragma once

* refactor config.h

* change info.json to debug linting

* refactor readme

- file header
- update docs links

* minimize and lint rules.mk

* change features

- enable mousekeys and nkro

* use GPIO commands for Status LED

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* use IS_LED_ON macro

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* update compile/flash examples in readme

* :flash doesn't use QMK Toolbox
This commit is contained in:
noroadsleft 2019-09-01 00:54:13 -07:00 committed by fauxpark
parent f59d076898
commit 4c4ee4a26b
7 changed files with 236 additions and 179 deletions

View File

@ -15,16 +15,15 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CONFIG_H
#define CONFIG_H
#pragma once
#include "config_common.h"
#define DEVICE_VER 0x0001
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER KBDFans
#define PRODUCT NIU Mini
#define DESCRIPTION A compact ortholinear keyboard
@ -47,7 +46,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* number of backlight levels */
#define BACKLIGHT_PIN B6
#ifdef BACKLIGHT_PIN
#define BACKLIGHT_LEVELS 4
#define BACKLIGHT_LEVELS 4
#endif
/* Set 0 if debouncing isn't needed */
@ -61,11 +60,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define RGB_DI_PIN E2
#ifdef RGB_DI_PIN
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 14
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 14
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
#endif
/*
@ -85,5 +84,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
#endif

View File

@ -7,12 +7,109 @@
"layouts": {
"LAYOUT_ortho_4x12": {
"key_count": 48,
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":6, "y":1}, {"x":7, "y":1}, {"x":8, "y":1}, {"x":9, "y":1}, {"x":10, "y":1}, {"x":11, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2}, {"x":5, "y":2}, {"x":6, "y":2}, {"x":7, "y":2}, {"x":8, "y":2}, {"x":9, "y":2}, {"x":10, "y":2}, {"x":11, "y":2}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}, {"x":4, "y":3}, {"x":5, "y":3}, {"x":6, "y":3}, {"x":7, "y":3}, {"x":8, "y":3}, {"x":9, "y":3}, {"x":10, "y":3}, {"x":11, "y":3}]
"layout": [
{"x":0, "y":0},
{"x":1, "y":0},
{"x":2, "y":0},
{"x":3, "y":0},
{"x":4, "y":0},
{"x":5, "y":0},
{"x":6, "y":0},
{"x":7, "y":0},
{"x":8, "y":0},
{"x":9, "y":0},
{"x":10, "y":0},
{"x":11, "y":0},
{"x":0, "y":1},
{"x":1, "y":1},
{"x":2, "y":1},
{"x":3, "y":1},
{"x":4, "y":1},
{"x":5, "y":1},
{"x":6, "y":1},
{"x":7, "y":1},
{"x":8, "y":1},
{"x":9, "y":1},
{"x":10, "y":1},
{"x":11, "y":1},
{"x":0, "y":2},
{"x":1, "y":2},
{"x":2, "y":2},
{"x":3, "y":2},
{"x":4, "y":2},
{"x":5, "y":2},
{"x":6, "y":2},
{"x":7, "y":2},
{"x":8, "y":2},
{"x":9, "y":2},
{"x":10, "y":2},
{"x":11, "y":2},
{"x":0, "y":3},
{"x":1, "y":3},
{"x":2, "y":3},
{"x":3, "y":3},
{"x":4, "y":3},
{"x":5, "y":3},
{"x":6, "y":3},
{"x":7, "y":3},
{"x":8, "y":3},
{"x":9, "y":3},
{"x":10, "y":3},
{"x":11, "y":3}
]
},
"LAYOUT_planck_mit": {
"key_count": 47,
"layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":6, "y":1}, {"x":7, "y":1}, {"x":8, "y":1}, {"x":9, "y":1}, {"x":10, "y":1}, {"x":11, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2}, {"x":5, "y":2}, {"x":6, "y":2}, {"x":7, "y":2}, {"x":8, "y":2}, {"x":9, "y":2}, {"x":10, "y":2}, {"x":11, "y":2}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}, {"x":4, "y":3}, {"x":5, "y":3, "w":2}, {"x":7, "y":3}, {"x":8, "y":3}, {"x":9, "y":3}, {"x":10, "y":3}, {"x":11, "y":3}]
"layout": [
{"x":0, "y":0},
{"x":1, "y":0},
{"x":2, "y":0},
{"x":3, "y":0},
{"x":4, "y":0},
{"x":5, "y":0},
{"x":6, "y":0},
{"x":7, "y":0},
{"x":8, "y":0},
{"x":9, "y":0},
{"x":10, "y":0},
{"x":11, "y":0},
{"x":0, "y":1},
{"x":1, "y":1},
{"x":2, "y":1},
{"x":3, "y":1},
{"x":4, "y":1},
{"x":5, "y":1},
{"x":6, "y":1},
{"x":7, "y":1},
{"x":8, "y":1},
{"x":9, "y":1},
{"x":10, "y":1},
{"x":11, "y":1},
{"x":0, "y":2},
{"x":1, "y":2},
{"x":2, "y":2},
{"x":3, "y":2},
{"x":4, "y":2},
{"x":5, "y":2},
{"x":6, "y":2},
{"x":7, "y":2},
{"x":8, "y":2},
{"x":9, "y":2},
{"x":10, "y":2},
{"x":11, "y":2},
{"x":0, "y":3},
{"x":1, "y":3},
{"x":2, "y":3},
{"x":3, "y":3},
{"x":4, "y":3},
{"x":5, "y":3, "w":2},
{"x":7, "y":3},
{"x":8, "y":3},
{"x":9, "y":3},
{"x":10, "y":3},
{"x":11, "y":3}
]
}
}
}

View File

@ -70,31 +70,31 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
void led_set_user(uint8_t usb_led) {
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
} else {
}
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
} else {
}
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
} else {
}
if (usb_led & (1 << USB_LED_COMPOSE)) {
if (IS_LED_ON(usb_led, USB_LED_COMPOSE)) {
} else {
}
if (usb_led & (1 << USB_LED_KANA)) {
if (IS_LED_ON(usb_led, USB_LED_KANA)) {
} else {

View File

@ -12,8 +12,8 @@ const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
void matrix_init_kb(void) {
// Turn status LED on
DDRE |= (1<<6);
PORTE |= (1<<6);
setPinOutput(E6);
writePinHigh(E6);
matrix_init_user();
}

View File

@ -1,5 +1,4 @@
#ifndef NIU_MINI_H
#define NIU_MINI_H
#pragma once
#include "quantum.h"
@ -45,5 +44,3 @@
#define LAYOUT LAYOUT_ortho_4x12
#define LAYOUT_kc_ortho_4x12 LAYOUT_kc
#endif

View File

@ -1,5 +1,4 @@
NIU Mini
===
# NIU Mini
![NIU Mini](https://cdn.shopify.com/s/files/1/1473/3902/files/40__01.jpg)
@ -11,6 +10,10 @@ Hardware Availability: [KBDFans](https://kbdfans.myshopify.com/products/niu-mini
Make example for this keyboard (after setting up your build environment):
make niu_mini:default:dfu
make niu_mini:default
See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
Flashing example for this keyboard ([using the command line](https://docs.qmk.fm/#/newbs_flashing?id=flash-your-keyboard-from-the-command-line)):
make niu_mini: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

@ -1,42 +1,6 @@
# MCU name
MCU = atmega32u4
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
# This will be an integer division of F_USB below, as it is sourced by
# F_USB after it has run through any CPU prescalers. Note that this value
# does not *change* the processor frequency - it should merely be updated to
# reflect the processor speed set externally so that the code can use accurate
# software delays.
F_CPU = 16000000
#
# LUFA specific
#
# Target architecture (see library "Board Types" documentation).
ARCH = AVR8
# Input clock frequency.
# This will define a symbol, F_USB, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
# at the end, this will be done automatically to create a 32-bit value in your
# source code.
#
# If no clock division is performed on the input clock inside the AVR (via the
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)
# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# Boot Section Size in *bytes*
# Teensy halfKay 512
# Teensy++ halfKay 1024
@ -49,12 +13,12 @@ BOOTLOADER = atmel-dfu
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = yes # Console for debug(+400)
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
@ -68,4 +32,3 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
LAYOUTS = ortho_4x12 planck_mit
LAYOUTS_HAS_RGB = no