Skip to content

Commit

Permalink
Freyr refactor (qmk#10833)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark authored and Owen Winkler committed Nov 5, 2020
1 parent cec0b04 commit 4964a37
Show file tree
Hide file tree
Showing 9 changed files with 496 additions and 408 deletions.
108 changes: 92 additions & 16 deletions keyboards/freyr/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config_common.h"

/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x0000
#define DEVICE_VER 0x0002
#define MANUFACTURER HnahKB
#define PRODUCT Freyr
#define DESCRIPTION Custom PCB TKL keyboard
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x1895
#define DEVICE_VER 0x0002
#define MANUFACTURER HnahKB
#define PRODUCT Freyr

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

/*
Expand All @@ -40,26 +39,103 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
*
*/
*/
#define MATRIX_ROW_PINS { D3, B2, B1, B0, E6, F0, D2, D5, F4, F1 }
#define MATRIX_COL_PINS { B4, D7, D6, D4, B5, C7, C6, F5, F6, F7 }
#define UNUSED_PINS

/* COL2ROW, ROW2COL*/
/* COL2ROW, ROW2COL */
#define DIODE_DIRECTION COL2ROW

/*
* Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
*/

#define BACKLIGHT_PIN B6
#define BACKLIGHT_BREATHING
#define BACKLIGHT_LEVELS 3
#define BACKLIGHT_BREATHING

//#define RGB_DI_PIN E2
//#ifdef RGB_DI_PIN
//# define RGBLED_NUM 16
//# define RGBLIGHT_HUE_STEP 8
//# define RGBLIGHT_SAT_STEP 8
//# define RGBLIGHT_VAL_STEP 8
//# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
//# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
/*== all animations enable ==*/
//# define RGBLIGHT_ANIMATIONS
/*== or choose animations ==*/
//# define RGBLIGHT_EFFECT_BREATHING
//# define RGBLIGHT_EFFECT_RAINBOW_MOOD
//# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
//# define RGBLIGHT_EFFECT_SNAKE
//# define RGBLIGHT_EFFECT_KNIGHT
//# define RGBLIGHT_EFFECT_CHRISTMAS
//# define RGBLIGHT_EFFECT_STATIC_GRADIENT
//# define RGBLIGHT_EFFECT_RGB_TEST
//# define RGBLIGHT_EFFECT_ALTERNATING
/*== customize breathing effect ==*/
/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
//# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
/*==== use exp() and sin() ====*/
//# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
//# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
//#endif

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5

/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
* This is useful for the Windows task manager shortcut (ctrl+shift+esc).
*/
//#define GRAVE_ESC_CTRL_OVERRIDE

/*
* Force NKRO
*
* Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
* state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
* makefile for this to work.)
*
* If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
* until the next keyboard reset.
*
* NKRO may prevent your keystrokes from being detected in the BIOS, but it is
* fully operational during normal computer usage.
*
* For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
* or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
* bootmagic, NKRO mode will always be enabled until it is toggled again during a
* power-up.
*
*/
//#define FORCE_NKRO

/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/

/* disable debug print */
//#define NO_DEBUG

/* disable print */
//#define NO_PRINT

/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT

/* disable these deprecated features by default */
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION

/* Bootmagic Lite key configuration */
#define BOOTMAGIC_LITE_ROW 0
#define BOOTMAGIC_LITE_COLUMN 0
//#define BOOTMAGIC_LITE_ROW 0
//#define BOOTMAGIC_LITE_COLUMN 0
35 changes: 13 additions & 22 deletions keyboards/freyr/freyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,24 @@
* 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 "freyr.h"

#include "freyr.h"

void matrix_init_kb(void) {
matrix_init_user();
led_init_ports();
};
matrix_init_user();
led_init_ports();
}

void led_init_ports(void) {
setPinOutput(B3);
setPinOutput(B7);
setPinOutput(B3);
setPinOutput(B7);
}

void led_set_kb(uint8_t usb_led) {
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
// Turn Caps Lock LED on
writePinLow(B3);
} else {
// Turn Caps Lock LED off
writePinHigh(B3);
}
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
// Turn Scroll Lock LED on
writePinLow(B7);
} else {
// Turn Scroll Lock LED off
writePinHigh(B7);
}
led_set_user(usb_led);
bool led_update_kb(led_t led_state) {
if (led_update_user(led_state)) {
writePin(B3, !led_state.caps_lock);
writePin(B7, !led_state.scroll_lock);
}

return true;
}
87 changes: 48 additions & 39 deletions keyboards/freyr/freyr.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,60 +13,69 @@
* 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 XXX KC_NO

#define LAYOUT_all( \
k00, k01, k02, k03, k04, k06, k07, k08,k09, k60, k61, k62, k63, k64, k65, k66, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k70, k71, k72, k73, k74, k75, k76, k67, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k80, k81, k82, k83, k78, k77, k68, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k90, k91, k92, k84, \
k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k95, k94, k85, k93, k79, \
k50, k51, k52, k53, k54, k55, k56, k57, k58, k59, k69 \
k00, k01, k02, k03, k04, k06, k07, k08, k09, k60, k61, k62, k63, k64, k65, k66, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k70, k71, k72, k73, k74, k75, k76, k67, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k80, k81, k82, k83, k78, k77, k68, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k90, k91, k92, k84, \
k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k95, k94, k85, k93, k79, \
k50, k51, k52, k53, k54, k55, k56, k57, k58, k59, k69 \
) { \
{ k00, k01, k02, k03, k04, KC_NO, k06, k07, k08, k09 }, \
{ k00, k01, k02, k03, k04, XXX, 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}, \
{ k40, k41, k42, k43, k44, k45, k46, k47, k48, k49 }, \
{ k50, k51, k52, k53, k54, k55, k56, k57, k58, k59 }, \
{ k60, k61, k62, k63, k64, k65, k66, k67, k68, k69 }, \
{ k70, k71, k72, k73, k74, k75, k76, k77, k78, k79 }, \
{ k80, k81, k82, k83, k84, k85, KC_NO, KC_NO, KC_NO, KC_NO }, \
{ k90, k91, k92, k93, k94, k95, KC_NO, KC_NO, KC_NO, KC_NO } \
{ k80, k81, k82, k83, k84, k85, XXX, XXX, XXX, XXX }, \
{ k90, k91, k92, k93, k94, k95, XXX, XXX, XXX, XXX } \
}

#define LAYOUT_tkl_ansi( \
k00, k01, k02, k03, k04, k06, k07, k08,k09, k60, k61, k62, k63, k64, k65, k66, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k70, k71, k72, k73, k75, k76, k67, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k80, k81, k82, k83, k78, k77, k68, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k90, k91, k84, \
k40, k42, k43, k44, k45, k46, k47, k48, k49, k95, k94, k93, k79, \
k50, k51, k52, k53, k54, k55, k56, k57, k58, k59, k69 \
) LAYOUT_all( \
k00, k01, k02, k03, k04, k06, k07, k08,k09, k60, k61, k62, k63, k64, k65, k66, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k70, k71, k72, k73, KC_NO, k75, k76, k67, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k80, k81, k82, k83, k78, k77, k68, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k90, k91, KC_NO, k84, \
k40, KC_NO, k42, k43, k44, k45, k46, k47, k48, k49, k95, k94, KC_NO, k93, k79, \
k50, k51, k52, k53, k54, k55, k56, k57, k58, k59, k69 \
)
k00, k01, k02, k03, k04, k06, k07, k08, k09, k60, k61, k62, k63, k64, k65, k66, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k70, k71, k72, k73, k75, k76, k67, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k80, k81, k82, k83, k78, k77, k68, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k90, k91, k84, \
k40, k42, k43, k44, k45, k46, k47, k48, k49, k95, k94, k93, k79, \
k50, k51, k52, k53, k54, k55, k56, k57, k58, k59, k69 \
) { \
{ k00, k01, k02, k03, k04, XXX, 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, XXX, k42, k43, k44, k45, k46, k47, k48, k49 }, \
{ k50, k51, k52, k53, k54, k55, k56, k57, k58, k59 }, \
{ k60, k61, k62, k63, k64, k65, k66, k67, k68, k69 }, \
{ k70, k71, k72, k73, XXX, k75, k76, k77, k78, k79 }, \
{ k80, k81, k82, k83, k84, XXX, XXX, XXX, XXX, XXX }, \
{ k90, k91, XXX, k93, k94, k95, XXX, XXX, XXX, XXX } \
}

#define LAYOUT_tkl_iso( \
k00, k01, k02, k03, k04, k06, k07, k08,k09, k60, k61, k62, k63, k64, k65, k66, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k70, k71, k72, k73, k75, k76, k67, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k80, k81, k82, k78, k77, k68, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k90, k91, k92, k84, \
k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k95, k94, k93, k79, \
k50, k51, k52, k53, k54, k55, k56, k57, k58, k59, k69 \
) LAYOUT_all( \
k00, k01, k02, k03, k04, k06, k07, k08,k09, k60, k61, k62, k63, k64, k65, k66, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k70, k71, k72, k73, KC_NO, k75, k76, k67, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k80, k81, k82, KC_NO, k78, k77, k68, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k90, k91, k92, k84, \
k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k95, k94, KC_NO, k93, k79, \
k50, k51, k52, k53, k54, k55, k56, k57, k58, k59, k69 \
)

k00, k01, k02, k03, k04, k06, k07, k08, k09, k60, k61, k62, k63, k64, k65, k66, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k70, k71, k72, k73, k75, k76, k67, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k80, k81, k82, k78, k77, k68, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k90, k91, k92, k84, \
k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k95, k94, k93, k79, \
k50, k51, k52, k53, k54, k55, k56, k57, k58, k59, k69 \
) { \
{ k00, k01, k02, k03, k04, XXX, 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, k52, k53, k54, k55, k56, k57, k58, k59 }, \
{ k60, k61, k62, k63, k64, k65, k66, k67, k68, k69 }, \
{ k70, k71, k72, k73, XXX, k75, k76, k77, k78, k79 }, \
{ k80, k81, k82, XXX, k84, XXX, XXX, XXX, XXX, XXX }, \
{ k90, k91, k92, k93, k94, k95, XXX, XXX, XXX, XXX } \
}
Loading

0 comments on commit 4964a37

Please sign in to comment.