Added new keyboard - nack (#10940)

Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
pastapojken 2020-11-18 17:56:59 +01:00 committed by GitHub
parent 58f2e0439e
commit ad5cbe5982
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 847 additions and 0 deletions

59
keyboards/nack/config.h Normal file
View File

@ -0,0 +1,59 @@
/*
Copyright 2020 pastapojken <pastapojken@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"
#define VENDOR_ID 0xDA12
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER pastapojken
#define PRODUCT nack keyboard
#define MATRIX_ROWS 4
#define MATRIX_COLS 13
#define MATRIX_ROW_PINS { A0, A1, A2, A3 }
#define MATRIX_COL_PINS { A6, A7, A8, A9, A10, B0, B1, B2, B6, B7, C13, C14, C15 }
#define DIODE_DIRECTION ROW2COL
#define DEBOUNCE 5
#define TAPPING_TOGGLE 2
#ifdef RGB_MATRIX_ENABLE
#define WS2812_SPI SPID1
#define WS2812_SPI_MOSI_PAL_MODE 5
#define RGB_DI_PIN B5
#define RGBLED_NUM 52
#define DRIVER_LED_TOTAL RGBLED_NUM
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 128 // Max brightness of LEDs
#define RGB_MATRIX_STARTUP_VAL 64
#define RGB_MATRIX_HUE_STEP 10
#define RGB_MATRIX_SAT_STEP 10
#define RGB_MATRIX_VAL_STEP 10
#endif
#ifdef AUDIO_ENABLE
#define STARTUP_SONG SONG(NO_SOUND)
#define AUDIO_PIN A4 // Pin of the left speaker
#define AUDIO_PIN_ALT A5 // Pin of the right speaker
/*
* Basically, change this section once pull request 6165 has been merged
* https://github.com/qmk/qmk_firmware/pull/6165
*/
#endif

12
keyboards/nack/info.json Normal file
View File

@ -0,0 +1,12 @@
{
"keyboard_name": "nack",
"url": "https://github.com/pastapojken/nack",
"maintainer": "pastapojken",
"width": 13,
"height": 4,
"layouts": {
"LAYOUT": {
"layout": [{"label":"Tab", "x":0, "y":0}, {"label":"Q", "x":1, "y":0}, {"label":"W", "x":2, "y":0}, {"label":"E", "x":3, "y":0}, {"label":"R", "x":4, "y":0}, {"label":"T", "x":5, "y":0}, {"label":"Y", "x":6, "y":0}, {"label":"U", "x":7, "y":0}, {"label":"I", "x":8, "y":0}, {"label":"O", "x":9, "y":0}, {"label":"P", "x":10, "y":0}, {"label":"\u00c5", "x":11, "y":0}, {"label":"\u00a8", "x":12, "y":0}, {"label":"Esc", "x":0, "y":1}, {"label":"A", "x":1, "y":1}, {"label":"S", "x":2, "y":1}, {"label":"D", "x":3, "y":1}, {"label":"F", "x":4, "y":1}, {"label":"G", "x":5, "y":1}, {"label":"H", "x":6, "y":1}, {"label":"J", "x":7, "y":1}, {"label":"K", "x":8, "y":1}, {"label":"L", "x":9, "y":1}, {"label":"\u00d6", "x":10, "y":1}, {"label":"\u00c4", "x":11, "y":1}, {"label":"'", "x":12, "y":1}, {"label":"Shift", "x":0, "y":2}, {"label":"Z", "x":1, "y":2}, {"label":"X", "x":2, "y":2}, {"label":"C", "x":3, "y":2}, {"label":"V", "x":4, "y":2}, {"label":"B", "x":5, "y":2}, {"label":"N", "x":6, "y":2}, {"label":"M", "x":7, "y":2}, {"label":",", "x":8, "y":2}, {"label":".", "x":9, "y":2}, {"label":"", "x":10, "y":2}, {"label":"&uarr;", "x":11, "y":2}, {"label":"backsp", "x":12, "y":2}, {"label":"Ctrl", "x":0, "y":3}, {"label":"Super", "x":1, "y":3}, {"label":"Alt", "x":2, "y":3}, {"label":"Fn", "x":3, "y":3}, {"x":4, "y":3}, {"x":5, "y":3}, {"label":"Fn", "x":6, "y":3}, {"label":"", "x":7, "y":3}, {"label":"Alt Gr", "x":8, "y":3}, {"label":"Enter", "x":9, "y":3}, {"label":"&larr;", "x":10, "y":3}, {"label":"&darr;", "x":11, "y":3}, {"label":"&rarr;", "x":12, "y":3}]
}
}
}

View File

@ -0,0 +1,65 @@
/* Copyright 2020 pastapojken <pastapojken@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/>.
*/
#include QMK_KEYBOARD_H
// Defines names for use in layer keycodes and the keymap
enum layer_names {
BASE,
NUM,
FN
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = LAYOUT(
/* __________________________________________________________________________________________________________________________________________________________________________
| \ \ \ \ \ \ \ \ \ \ \ \ \ \ */
// | |----TAB-----|---Q--------|-----W------|-----E------|-----R------|----T-------|-----Y------|-----U------|----I-------|------O-----|----P-------|----Å-------|--( ¨^~ )---|
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,
// | |----ESC-----|---A--------|---S--------|----D-------|-----F------|-----G------|-----H------|-----J------|-----K------|-----L------|-----Ö------|-----Ä------|--( '* )----|
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS,
// | |---SHIFT----|---Z--------|---X--------|----C-------|-----V------|-----B------|-----N------|------M-----|---( ,; )---|---( .: )---|---( -_ )---|----UP------|-BACKSPACE--|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, KC_BSPC,
// | |---CTRL-----|---ALT------|---META-----|----FN_1----|----------SPACE----------|----FN_2----|----AltGr---|--( <>| )---|---ENETER---|-LEFT-------|---DOWN-----|--RIGHT-----|
KC_LCTL, KC_LALT, KC_LGUI, TT(NUM), KC_SPC, KC_NO, TT(FN), KC_RALT, KC_NUBS, KC_ENT, KC_LEFT, KC_DOWN, KC_RIGHT
// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|
),
[NUM] = LAYOUT(
/* __________________________________________________________________________________________________________________________________________________________________________
| \ \ \ \ \ \ \ \ \ \ \ \ \ \ */
// | |---TAB------|---( 1! )---|--( 2"@ )---|--( 3#£ )---|---( 4¤$ )--|--( 5%€ )---|---( 6& )---|--( 7/{ )---|--( 8([ )---|--( 9)] )---|--( 0=} )---|---( +?\ )--|---( ´` )---|
_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL,
// | |----ESC-----|-----F1-----|-----F2-----|----F3------|----F4------|----F5------|-----F6-----|-----F7------|----F8-----|-----F9-----|-----F10----|----F11-----|----F12-----|
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
// | |---SHIFT----|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|
_______, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
// | |---CTRL-----|---ALT------|---META-----|---FN_1-----|------------|------------|----FN_2----|--AltGr-----|---( §½ )---|------------|------------|------------|------------|
_______, _______, _______, TT(FN), KC_NO, KC_NO, TO(BASE), _______, KC_GRV, KC_NO, KC_NO, KC_NO, KC_NO
// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|
),
[FN] = LAYOUT(
/* __________________________________________________________________________________________________________________________________________________________________________
| \ \ \ \ \ \ \ \ \ \ \ \ \ \ */
// | |-RGB TOGGLE-|-CHANGE RGB-|-RGB HUE UP-|-RGB SAT UP-|------------|------------|------------|------------|------------|------------|------------|------------|-RESET KBD--|
RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
// | |------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|
MU_TOG, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
// | |------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|-RGB LIGHT +|------------|
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RGB_VAI, KC_NO,
// | |------------|------------|------------|---FN_1-----|------------|------------|----FN_2----|------------|------------|------------|------------|-RGB LIGHT -|------------|
KC_NO, KC_NO, KC_NO, TT(NUM), KC_NO, KC_NO, TO(BASE), KC_NO, KC_NO, KC_NO, KC_NO, RGB_VAD, KC_NO
// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|
)
};

View File

@ -0,0 +1 @@
# The default keymap for nack, simple and minimal.

View File

@ -0,0 +1,199 @@
/* Copyright 2020 pastapojken <pastapojken@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/>.
*/
#include QMK_KEYBOARD_H
#include "keymap.h"
#define ____ _______
// Defines names for use in layer keycodes and the keymap
enum layer_names {
BASE,
NUM,
FN
};
// Defines the keycodes used by our macros in process_record_user
enum custom_keycodes {
CK_LSFT = SAFE_RANGE, // Shift
CK_RALT, // AltGr
CK_BSPC_DEL, // Backspace or Del (if pressed with CK_LSFT or CK_RALT)
CK_UP_PGUP, // Up or PgUp (if pressed with CK_LSFT or CK_RALT)
CK_DOWN_PGDOWN, // Down or PgDown (if pressed with CK_LSFT or CK_RALT)
CK_LEFT_HOME, // Left or Home (if pressed with CK_LSFT or CK_RALT)
CK_RIGHT_END, // Right or End (if pressed with CK_LSFT or CK_RALT)
KK_RESET
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = LAYOUT(
/* __________________________________________________________________________________________________________________________________________________________________________
| \ \ \ \ \ \ \ \ \ \ \ \ \ \ */
// | |----TAB-----|---Q--------|-----W------|-----E------|-----R------|----T-------|-----Y------|-----U------|----I-------|------O-----|----P-------|----Å-------|--( ¨^~ )---|
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,
// | |----ESC-----|---A--------|---S--------|----D-------|-----F------|-----G------|-----H------|-----J------|-----K------|-----L------|-----Ö------|-----Ä------|--( '* )----|
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS,
// | |---SHIFT----|---Z--------|---X--------|----C-------|-----V------|-----B------|-----N------|------M-----|---( ,; )---|---( .: )---|---( -_ )---|----UP------|-BACKSPACE--|
CK_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, CK_UP_PGUP, CK_BSPC_DEL,
// | |---CTRL-----|---ALT------|---META-----|----FN_1----|----------SPACE----------|----FN_2----|----AltGr---|--( <>| )---|---ENETER---|-LEFT-------|---DOWN-----|--RIGHT-----|
KC_LCTL, KC_LALT, KC_LGUI, TT(NUM), KC_SPC, KC_NO, TT(FN), CK_RALT, KC_NUBS, KC_ENT, CK_LEFT_HOME,CK_DOWN_PGDOWN,CK_RIGHT_END
// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|
),
[NUM] = LAYOUT(
/* __________________________________________________________________________________________________________________________________________________________________________
| \ \ \ \ \ \ \ \ \ \ \ \ \ \ */
// | |---TAB------|---( 1! )---|--( 2"@ )---|--( 3#£ )---|---( 4¤$ )--|--( 5%€ )---|---( 6& )---|--( 7/{ )---|--( 8([ )---|--( 9)] )---|--( 0=} )---|---( +?\ )--|---( ´` )---|
____, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL,
// | |----ESC-----|-----F1-----|-----F2-----|----F3------|----F4------|----F5------|-----F6-----|-----F7------|----F8-----|-----F9-----|-----F10----|----F11-----|----F12-----|
____, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
// | |---SHIFT----|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|
____, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
// | |---CTRL-----|---ALT------|---META-----|---FN_1-----|------------|------------|----FN_2----|--AltGr-----|---( §½ )---|------------|------------|------------|------------|
____, ____, ____, TT(FN), KC_NO, KC_NO, TO(BASE), ____, KC_GRV, KC_NO, KC_NO, KC_NO, KC_NO
// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|
),
[FN] = LAYOUT(
/* __________________________________________________________________________________________________________________________________________________________________________
| \ \ \ \ \ \ \ \ \ \ \ \ \ \ */
// | |-RGB TOGGLE-|-CHANGE RGB-|-RGB HUE UP-|-RGB SAT UP-|------------|------------|------------|------------|------------|------------|------------|------------|-RESET KBD--|
RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KK_RESET,
// | |------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|
MU_TOG, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
// | |------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|------------|-RGB LIGHT +|------------|
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RGB_VAI, KC_NO,
// | |------------|------------|------------|---FN_1-----|------------|------------|----FN_2----|------------|------------|------------|------------|-RGB LIGHT -|------------|
KC_NO, KC_NO, KC_NO, TT(NUM), KC_NO, KC_NO, TO(BASE), KC_NO, KC_NO, KC_NO, KC_NO, RGB_VAD, KC_NO
// \|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|____________|
)
};
// Interrupt bools
bool lshift = false, ralt = false;
// Number of items that are saved in prev_kcs
uint8_t prev_indx = 0;
// Used to save the last 6 actual keycodes
uint16_t prev_kcs[6] = {0, 0, 0, 0, 0, 0};
/*
Used to add a keycode to a prev_kcs to remember it.
When full the last code gets discarded and replaced by
the new one.
*/
void add_to_prev(uint16_t kc){
for (int i=0; i<prev_indx; i++){
if (kc == prev_kcs[i])
return;
}
if (prev_indx == 6){
for (int i=5; i>0; i--){
prev_kcs[i] = prev_kcs[i-1];
}
prev_kcs[0] = kc;
} else {
prev_kcs[prev_indx] = kc;
prev_indx++;
}
}
/*
Unregisters all codes saved in prev_kcs and resets prev_indx.
gets called on multiple occasions mainly when shift is released
and when frankenkeycodes are pressed. Prevents output of
wrong characters when really specific key combinations
that would never occur during normal usage are pressed.
*/
void unreg_prev(void){
if (prev_indx == 0)
return;
for (int i=0; i<prev_indx; i++){
unregister_code(prev_kcs[i]);
}
prev_indx = 0;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static uint32_t key_timer;
switch (keycode) {
case CK_LSFT:
if(record->event.pressed) {
unregister_code(KC_LSFT);
register_code(KC_LSFT);
lshift = true;
} else {
unreg_prev();
unregister_code(KC_LSFT);
lshift = false;
}
return false;
case CK_RALT:
if(record->event.pressed) {
unregister_code(KC_RALT);
register_code(KC_RALT);
ralt = true;
} else {
unreg_prev();
unregister_code(KC_RALT);
ralt = false;
}
return false;
case CK_BSPC_DEL:
RALT_NO(KC_BSPC,KC_DEL);
break;
case CK_UP_PGUP:
RALT_NO(KC_UP,KC_PGUP);
break;
case CK_DOWN_PGDOWN:
RALT_NO(KC_DOWN,KC_PGDOWN);
break;
case CK_LEFT_HOME:
RALT_NO(KC_LEFT,KC_HOME);
break;
case CK_RIGHT_END:
RALT_NO(KC_RIGHT,KC_END);
break;
case KK_RESET: // Basically, turn off RGB before resetting
if (record->event.pressed) {
key_timer = timer_read32();
#ifdef RGB_MATRIX_ENABLE
rgb_matrix_disable_noeeprom();
#endif
} else {
if (timer_elapsed32(key_timer) >= 20) {
reset_keyboard();
}
}
break;
default:
if(record->event.pressed) {
timer_timeout_keymap();
if (lshift)
register_code(KC_LSFT);
else
unregister_code(KC_LSFT);
if (ralt)
register_code(KC_ALGR);
else
unregister_code(KC_ALGR);
}
break;
}
return true;
}
__attribute__((weak))
void timer_timeout_keymap(void){
}

View File

@ -0,0 +1,122 @@
/* Copyright 2020 pastapojken <pastapojken@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 "quantum.h"
#define TAPPING_TOGGLE 2
#ifdef AUDIO_ENABLE
#define STARTUP_SONG SONG(NO_SOUND)
#endif
void add_to_prev(uint16_t kc);
void unreg_prev(void);
void timer_timeout_keymap(void);
bool process_record_user(uint16_t keycode, keyrecord_t *record);
// Normal shift status
#define SHIFT_NORM(kc1, kc2) \
if (record->event.pressed) { \
timer_timeout_keymap(); \
if (lshift) { \
register_code(KC_LSFT); \
unregister_code(kc2); \
register_code(kc2); \
add_to_prev(kc2); \
} else { \
unregister_code(KC_LSFT); \
unregister_code(kc1); \
register_code(kc1); \
} \
} else { \
unregister_code(kc1); \
unregister_code(kc2); \
} \
return false;
// Always shifted
#define SHIFT_ALL(kc1, kc2) \
if (record->event.pressed) { \
timer_timeout_keymap(); \
register_code(KC_LSFT); \
if (lshift) { \
unregister_code(kc2); \
register_code(kc2); \
add_to_prev(kc2); \
} else { \
unregister_code(kc1); \
register_code(kc1); \
add_to_prev(kc1); \
} \
} else { \
unregister_code(kc1); \
unregister_code(kc2); \
unreg_prev(); \
if (lshift) \
register_code(KC_LSFT); \
else \
unregister_code(KC_LSFT); \
} \
return false;
// Never shifted
#define SHIFT_NO(kc1, kc2) \
if (record->event.pressed) { \
timer_timeout_keymap(); \
unregister_code(KC_LSFT); \
if (lshift) { \
unregister_code(kc2); \
register_code(kc2); \
add_to_prev(kc2); \
} else { \
unregister_code(kc1); \
register_code(kc1); \
} \
} else { \
unregister_code(kc1); \
unregister_code(kc2); \
unreg_prev(); \
if (lshift) \
register_code(KC_LSFT); \
else \
unregister_code(KC_LSFT); \
} \
return false;
//Never RALT
#define RALT_NO(kc1, kc2) \
if (record->event.pressed) { \
timer_timeout_keymap(); \
unregister_code(KC_RALT); \
if (ralt) { \
unregister_code(kc2); \
register_code(kc2); \
add_to_prev(kc2); \
} else { \
unregister_code(kc1); \
register_code(kc1); \
} \
} else { \
unregister_code(kc1); \
unregister_code(kc2); \
unreg_prev(); \
if (ralt) \
register_code(KC_RALT); \
else \
unregister_code(KC_RALT); \
} \
return false;

View File

@ -0,0 +1 @@
# pastapojken's keymap for nack

273
keyboards/nack/mcuconf.h Normal file
View File

@ -0,0 +1,273 @@
/*
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef MCUCONF_H
#define MCUCONF_H
/*
* STM32F3xx drivers configuration.
* The following settings override the default settings present in
* the various device driver implementation headers.
* Note that the settings for each driver only have effect if the whole
* driver is enabled in halconf.h.
*
* IRQ priorities:
* 15...0 Lowest...Highest.
*
* DMA priorities:
* 0...3 Lowest...Highest.
*/
#define STM32F3xx_MCUCONF
#define STM32F303_MCUCONF
/*
* HAL driver system settings.
*/
#define STM32_NO_INIT FALSE
#define STM32_PVD_ENABLE FALSE
#define STM32_PLS STM32_PLS_LEV0
#define STM32_HSI_ENABLED TRUE
#define STM32_LSI_ENABLED TRUE
#define STM32_HSE_ENABLED TRUE
#define STM32_LSE_ENABLED FALSE
#define STM32_SW STM32_SW_PLL
#define STM32_PLLSRC STM32_PLLSRC_HSE
#define STM32_PREDIV_VALUE 1
#define STM32_PLLMUL_VALUE 9
#define STM32_HPRE STM32_HPRE_DIV1
#define STM32_PPRE1 STM32_PPRE1_DIV2
#define STM32_PPRE2 STM32_PPRE2_DIV2
#define STM32_MCOSEL STM32_MCOSEL_NOCLOCK
#define STM32_ADC12PRES STM32_ADC12PRES_DIV1
#define STM32_ADC34PRES STM32_ADC34PRES_DIV1
#define STM32_USART1SW STM32_USART1SW_PCLK
#define STM32_USART2SW STM32_USART2SW_PCLK
#define STM32_USART3SW STM32_USART3SW_PCLK
#define STM32_UART4SW STM32_UART4SW_PCLK
#define STM32_UART5SW STM32_UART5SW_PCLK
#define STM32_I2C1SW STM32_I2C1SW_SYSCLK
#define STM32_I2C2SW STM32_I2C2SW_SYSCLK
#define STM32_TIM1SW STM32_TIM1SW_PCLK2
#define STM32_TIM8SW STM32_TIM8SW_PCLK2
#define STM32_RTCSEL STM32_RTCSEL_LSI
#define STM32_USB_CLOCK_REQUIRED TRUE
#define STM32_USBPRE STM32_USBPRE_DIV1P5
/*
* IRQ system settings.
*/
#define STM32_IRQ_EXTI0_PRIORITY 6
#define STM32_IRQ_EXTI1_PRIORITY 6
#define STM32_IRQ_EXTI2_PRIORITY 6
#define STM32_IRQ_EXTI3_PRIORITY 6
#define STM32_IRQ_EXTI4_PRIORITY 6
#define STM32_IRQ_EXTI5_9_PRIORITY 6
#define STM32_IRQ_EXTI10_15_PRIORITY 6
#define STM32_IRQ_EXTI16_PRIORITY 6
#define STM32_IRQ_EXTI17_PRIORITY 15
#define STM32_IRQ_EXTI18_PRIORITY 6
#define STM32_IRQ_EXTI19_PRIORITY 15
#define STM32_IRQ_EXTI20_PRIORITY 15
#define STM32_IRQ_EXTI21_22_29_PRIORITY 6
#define STM32_IRQ_EXTI30_32_PRIORITY 6
#define STM32_IRQ_EXTI33_PRIORITY 6
#define STM32_IRQ_TIM1_BRK_TIM15_PRIORITY 7
#define STM32_IRQ_TIM1_UP_TIM16_PRIORITY 7
#define STM32_IRQ_TIM1_TRGCO_TIM17_PRIORITY 7
#define STM32_IRQ_TIM1_CC_PRIORITY 7
/*
* ADC driver system settings.
*/
#define STM32_ADC_DUAL_MODE FALSE
#define STM32_ADC_COMPACT_SAMPLES FALSE
#define STM32_ADC_USE_ADC1 FALSE
#define STM32_ADC_USE_ADC2 FALSE
#define STM32_ADC_USE_ADC3 FALSE
#define STM32_ADC_USE_ADC4 FALSE
#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(1, 1)
#define STM32_ADC_ADC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
#define STM32_ADC_ADC3_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
#define STM32_ADC_ADC4_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
#define STM32_ADC_ADC1_DMA_PRIORITY 2
#define STM32_ADC_ADC2_DMA_PRIORITY 2
#define STM32_ADC_ADC3_DMA_PRIORITY 2
#define STM32_ADC_ADC4_DMA_PRIORITY 2
#define STM32_ADC_ADC12_IRQ_PRIORITY 5
#define STM32_ADC_ADC3_IRQ_PRIORITY 5
#define STM32_ADC_ADC4_IRQ_PRIORITY 5
#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 5
#define STM32_ADC_ADC2_DMA_IRQ_PRIORITY 5
#define STM32_ADC_ADC3_DMA_IRQ_PRIORITY 5
#define STM32_ADC_ADC4_DMA_IRQ_PRIORITY 5
#define STM32_ADC_ADC12_CLOCK_MODE ADC_CCR_CKMODE_AHB_DIV1
#define STM32_ADC_ADC34_CLOCK_MODE ADC_CCR_CKMODE_AHB_DIV1
/*
* CAN driver system settings.
*/
#define STM32_CAN_USE_CAN1 FALSE
#define STM32_CAN_CAN1_IRQ_PRIORITY 11
/*
* DAC driver system settings.
*/
#define STM32_DAC_DUAL_MODE FALSE
#define STM32_DAC_USE_DAC1_CH1 TRUE
#define STM32_DAC_USE_DAC1_CH2 TRUE
#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10
#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10
#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2
#define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2
/*
* GPT driver system settings.
*/
#define STM32_GPT_USE_TIM1 FALSE
#define STM32_GPT_USE_TIM2 FALSE
#define STM32_GPT_USE_TIM3 FALSE
#define STM32_GPT_USE_TIM4 FALSE
#define STM32_GPT_USE_TIM6 TRUE
#define STM32_GPT_USE_TIM7 TRUE
#define STM32_GPT_USE_TIM8 TRUE
#define STM32_GPT_USE_TIM15 TRUE
#define STM32_GPT_USE_TIM16 FALSE
#define STM32_GPT_USE_TIM17 FALSE
#define STM32_GPT_TIM1_IRQ_PRIORITY 7
#define STM32_GPT_TIM2_IRQ_PRIORITY 7
#define STM32_GPT_TIM3_IRQ_PRIORITY 7
#define STM32_GPT_TIM4_IRQ_PRIORITY 7
#define STM32_GPT_TIM6_IRQ_PRIORITY 7
#define STM32_GPT_TIM7_IRQ_PRIORITY 7
#define STM32_GPT_TIM8_IRQ_PRIORITY 7
/*
* I2C driver system settings.
*/
#define STM32_I2C_USE_I2C1 TRUE
#define STM32_I2C_USE_I2C2 FALSE
#define STM32_I2C_BUSY_TIMEOUT 50
#define STM32_I2C_I2C1_IRQ_PRIORITY 10
#define STM32_I2C_I2C2_IRQ_PRIORITY 10
#define STM32_I2C_USE_DMA TRUE
#define STM32_I2C_I2C1_DMA_PRIORITY 1
#define STM32_I2C_I2C2_DMA_PRIORITY 1
#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
/*
* ICU driver system settings.
*/
#define STM32_ICU_USE_TIM1 FALSE
#define STM32_ICU_USE_TIM2 FALSE
#define STM32_ICU_USE_TIM3 FALSE
#define STM32_ICU_USE_TIM4 FALSE
#define STM32_ICU_USE_TIM8 FALSE
#define STM32_ICU_USE_TIM15 FALSE
#define STM32_ICU_TIM1_IRQ_PRIORITY 7
#define STM32_ICU_TIM2_IRQ_PRIORITY 7
#define STM32_ICU_TIM3_IRQ_PRIORITY 7
#define STM32_ICU_TIM4_IRQ_PRIORITY 7
#define STM32_ICU_TIM8_IRQ_PRIORITY 7
/*
* PWM driver system settings.
*/
#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 TRUE
#define STM32_PWM_USE_TIM4 TRUE
#define STM32_PWM_USE_TIM8 FALSE
#define STM32_PWM_USE_TIM15 FALSE
#define STM32_PWM_USE_TIM16 FALSE
#define STM32_PWM_USE_TIM17 FALSE
#define STM32_PWM_TIM1_IRQ_PRIORITY 7
#define STM32_PWM_TIM2_IRQ_PRIORITY 7
#define STM32_PWM_TIM3_IRQ_PRIORITY 7
#define STM32_PWM_TIM4_IRQ_PRIORITY 7
#define STM32_PWM_TIM8_IRQ_PRIORITY 7
/*
* RTC driver system settings.
*/
#define STM32_RTC_PRESA_VALUE 32
#define STM32_RTC_PRESS_VALUE 1024
#define STM32_RTC_CR_INIT 0
#define STM32_RTC_TAMPCR_INIT 0
/*
* SERIAL driver system settings.
*/
#define STM32_SERIAL_USE_USART1 FALSE
#define STM32_SERIAL_USE_USART2 TRUE
#define STM32_SERIAL_USE_USART3 FALSE
#define STM32_SERIAL_USE_UART4 FALSE
#define STM32_SERIAL_USE_UART5 FALSE
#define STM32_SERIAL_USART1_PRIORITY 12
#define STM32_SERIAL_USART2_PRIORITY 12
#define STM32_SERIAL_USART3_PRIORITY 12
#define STM32_SERIAL_UART4_PRIORITY 12
#define STM32_SERIAL_UART5_PRIORITY 12
/*
* SPI driver system settings.
*/
#define STM32_SPI_USE_SPI1 TRUE
#define STM32_SPI_USE_SPI2 FALSE
#define STM32_SPI_USE_SPI3 FALSE
#define STM32_SPI_SPI1_DMA_PRIORITY 1
#define STM32_SPI_SPI2_DMA_PRIORITY 1
#define STM32_SPI_SPI3_DMA_PRIORITY 1
#define STM32_SPI_SPI1_IRQ_PRIORITY 10
#define STM32_SPI_SPI2_IRQ_PRIORITY 10
#define STM32_SPI_SPI3_IRQ_PRIORITY 10
#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
/*
* ST driver system settings.
*/
#define STM32_ST_IRQ_PRIORITY 8
#define STM32_ST_USE_TIMER 2
/*
* UART driver system settings.
*/
#define STM32_UART_USE_USART1 FALSE
#define STM32_UART_USE_USART2 FALSE
#define STM32_UART_USE_USART3 FALSE
#define STM32_UART_USART1_IRQ_PRIORITY 12
#define STM32_UART_USART2_IRQ_PRIORITY 12
#define STM32_UART_USART3_IRQ_PRIORITY 12
#define STM32_UART_USART1_DMA_PRIORITY 0
#define STM32_UART_USART2_DMA_PRIORITY 0
#define STM32_UART_USART3_DMA_PRIORITY 0
#define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
/*
* USB driver system settings.
*/
#define STM32_USB_USE_USB1 TRUE
#define STM32_USB_LOW_POWER_ON_SUSPEND FALSE
#define STM32_USB_USB1_HP_IRQ_PRIORITY 13
#define STM32_USB_USB1_LP_IRQ_PRIORITY 14
/*
* WDG driver system settings.
*/
#define STM32_WDG_USE_IWDG FALSE
#endif /* MCUCONF_H */

40
keyboards/nack/nack.c Normal file
View File

@ -0,0 +1,40 @@
/* Copyright 2020 pastapojken <pastapojken@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/>.
*/
#include QMK_KEYBOARD_H
#ifdef RGB_MATRIX_ENABLE
led_config_t g_led_config = { {
// Key Matrix to LED Index
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 },
{ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },
{ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38 },
{ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 }
}, {
// LED Index to Physical Position
{ 0, 0 }, { 19, 0 }, { 38, 0 }, { 57, 0 }, { 76, 0 }, { 95, 0 }, { 114, 0 }, { 133, 0 }, { 152, 0 }, { 171, 0 }, { 190, 0 }, { 209, 0 }, { 223, 0 },
{ 0, 21 }, { 19, 21 }, { 38, 21 }, { 57, 21 }, { 76, 21 }, { 95, 21 }, { 114, 21 }, { 133, 21 }, { 152, 21 }, { 171, 21 }, { 190, 21 }, { 209, 21 }, { 223, 21 },
{ 0, 42 }, { 19, 42 }, { 38, 42 }, { 57, 42 }, { 76, 42 }, { 95, 42 }, { 114, 42 }, { 133, 42 }, { 152, 42 }, { 171, 42 }, { 190, 42 }, { 209, 42 }, { 223, 42 },
{ 0, 63 }, { 19, 63 }, { 38, 63 }, { 57, 63 }, { 76, 63 }, { 95, 63 }, { 114, 63 }, { 133, 63 }, { 152, 63 }, { 171, 63 }, { 190, 63 }, { 209, 63 }, { 223, 63 }
}, {
// LED Index to Flag
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
} };
#endif

31
keyboards/nack/nack.h Normal file
View File

@ -0,0 +1,31 @@
/* Copyright 2020 pastapojken <pastapojken@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 "quantum.h"
#define LAYOUT( \
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k10, k11, k12,\
k13, k14, k15, k16, k17, k18, k19, k20, k21, k22, k23, k24, k25,\
k26, k27, k28, k29, k30, k31, k32, k33, k34, k35, k36, k37, k38,\
k39, k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k50, k51\
) \
{ \
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k10, k11, k12 },\
{ k13, k14, k15, k16, k17, k18, k19, k20, k21, k22, k23, k24, k25 },\
{ k26, k27, k28, k29, k30, k31, k32, k33, k34, k35, k36, k37, k38 },\
{ k39, k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k50, k51 },\
}

21
keyboards/nack/readme.md Normal file
View File

@ -0,0 +1,21 @@
# nack
A ISO-friendly ortholinear keyboard, 13x4 keys.
See [screenshots](https://imgur.com/a/PPO18Lc).
* Keyboard Maintainer: [pastapojken](https://github.com/pastapojken)
* Hardware Supported: nack PCB
* Hardware Availability: [github repo](https://github.com/pastapojken/nack)
Make example for this keyboard (after setting up your build environment):
make nack:default
Flashing example for this keyboard:
make nack:default:flash
To reset the board into bootloader mode, press the reset button on top of the keyboard. It's the tiny button to the upper left of the board. If you are using the official case/plate you might need to use something thin to reach & press it.
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).

23
keyboards/nack/rules.mk Normal file
View File

@ -0,0 +1,23 @@
# MCU name
MCU = STM32F303
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = no # 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 = no # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no # Enable Bluetooth
AUDIO_ENABLE = yes # Audio output
RGB_MATRIX_ENABLE = WS2812
WS2812_DRIVER = spi
AUDIO_DRIVER = dac_additive # How to drive the 2 speakers
UNICODE_ENABLE = yes # Unicode support