From b3e36c734ae82940ad24989248cefa520088ff2b Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 17 Oct 2017 16:57:49 -0400 Subject: [PATCH] adds planck light implementation --- keyboards/planck/keymaps/brandon/config.h | 105 ++++------------ keyboards/planck/keymaps/circuit/config.h | 102 +++------------ keyboards/planck/keymaps/default/keymap.c | 6 +- keyboards/planck/keymaps/khord/config.h | 2 +- keyboards/planck/keymaps/pvc/config.h | 41 +++--- keyboards/planck/keymaps/vifon/config.h | 99 +++------------ keyboards/planck/keymaps/zach/config.h | 74 ++++------- keyboards/planck/light/config.h | 56 +++++++++ keyboards/planck/light/light.c | 145 ++++++++++++++++++++++ keyboards/planck/light/light.h | 24 ++++ keyboards/planck/light/rules.mk | 5 + keyboards/planck/planck.c | 1 + keyboards/planck/planck.h | 3 + keyboards/planck/rev3/rules.mk | 11 +- keyboards/planck/rev4/rules.mk | 10 +- keyboards/planck/rules.mk | 11 +- quantum/audio/audio.c | 5 +- 17 files changed, 363 insertions(+), 337 deletions(-) create mode 100644 keyboards/planck/light/config.h create mode 100644 keyboards/planck/light/light.c create mode 100644 keyboards/planck/light/light.h create mode 100644 keyboards/planck/light/rules.mk diff --git a/keyboards/planck/keymaps/brandon/config.h b/keyboards/planck/keymaps/brandon/config.h index 5442ebf7..29a07dc6 100644 --- a/keyboards/planck/keymaps/brandon/config.h +++ b/keyboards/planck/keymaps/brandon/config.h @@ -1,68 +1,30 @@ -/* -Copyright 2012 Jun Wako - -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 . -*/ - -#ifndef CONFIG_H -#define CONFIG_H - -#define TAPPING_TERM 200 - -#include "config_common.h" - -/* USB Device descriptor parameter */ -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x6060 -#define MANUFACTURER Ortholinear Keyboards -#define PRODUCT The Planck Keyboard -#define DESCRIPTION A compact ortholinear keyboard - -/* key matrix size */ -#define MATRIX_ROWS 4 -#define MATRIX_COLS 12 - -/* Planck PCB default pin-out */ -#define MATRIX_ROW_PINS { D0, D5, B5, B6 } -#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } -#define UNUSED_PINS - -#define AUDIO_VOICES - -#define BACKLIGHT_PIN B7 +#ifndef CONFIG_USER_H +#define CONFIG_USER_H -/* COL2ROW or ROW2COL */ -#define DIODE_DIRECTION COL2ROW +#include "../../config.h" -/* define if matrix has ghost */ -//#define MATRIX_HAS_GHOST +/* + * MIDI options + */ -/* number of backlight levels */ -#define BACKLIGHT_LEVELS 3 +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 -/* Set 0 if debouncing isn't needed */ -#define DEBOUNCING_DELAY 5 +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ +#define MIDI_BASIC -/* 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 +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED -/* key combination for command */ -#define IS_COMMAND() ( \ - keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ -) +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 #define MOUSEKEY_INTERVAL 20 #define MOUSEKEY_DELAY 0 @@ -70,29 +32,4 @@ along with this program. If not, see . #define MOUSEKEY_MAX_SPEED 7 #define MOUSEKEY_WHEEL_DELAY 0 -/* - * 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 -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION - -#ifdef SUBPROJECT_rev3 - #include "rev3/config.h" -#endif -#ifdef SUBPROJECT_rev4 - #include "rev4/config.h" -#endif - #endif diff --git a/keyboards/planck/keymaps/circuit/config.h b/keyboards/planck/keymaps/circuit/config.h index 22244f4a..4c615819 100644 --- a/keyboards/planck/keymaps/circuit/config.h +++ b/keyboards/planck/keymaps/circuit/config.h @@ -1,91 +1,29 @@ -/* -Copyright 2012 Jun Wako - -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 . -*/ - -#ifndef CONFIG_H -#define CONFIG_H - -#include "config_common.h" - -/* Tap-dance interval definition */ -#define TAPPING_TERM 200 - -/* USB Device descriptor parameter */ -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x6060 -#define MANUFACTURER Ortholinear Keyboards -#define PRODUCT The Planck Keyboard -#define DESCRIPTION A compact ortholinear keyboard - -/* key matrix size */ -#define MATRIX_ROWS 4 -#define MATRIX_COLS 12 +#ifndef CONFIG_USER_H +#define CONFIG_USER_H -/* Planck PCB default pin-out */ -#define MATRIX_ROW_PINS { D0, D5, B5, B6 } -#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } -#define UNUSED_PINS - -#define BACKLIGHT_PIN B7 - -/* COL2ROW or ROW2COL */ -#define DIODE_DIRECTION COL2ROW - -/* define if matrix has ghost */ -//#define MATRIX_HAS_GHOST - -/* number of backlight levels */ -#define BACKLIGHT_LEVELS 3 - -/* Set 0 if debouncing isn't needed */ -#define DEBOUNCING_DELAY 5 - -/* 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 - -/* key combination for command */ -#define IS_COMMAND() ( \ - keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ -) +#include "../../config.h" /* - * Feature disable options - * These options are also useful to firmware size reduction. + * MIDI options */ -/* disable debug print */ -//#define NO_DEBUG +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 -/* disable print */ -//#define NO_PRINT +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ +#define MIDI_BASIC -/* disable action features */ -//#define NO_ACTION_LAYER -//#define NO_ACTION_TAPPING -//#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED -#ifdef SUBPROJECT_rev3 - #include "rev3/config.h" -#endif -#ifdef SUBPROJECT_rev4 - #include "rev4/config.h" -#endif +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 -#endif +#endif \ No newline at end of file diff --git a/keyboards/planck/keymaps/default/keymap.c b/keyboards/planck/keymaps/default/keymap.c index 48b02de3..13f0f62d 100644 --- a/keyboards/planck/keymaps/default/keymap.c +++ b/keyboards/planck/keymaps/default/keymap.c @@ -163,9 +163,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_ADJUST] = { - {_______, RESET, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL }, + {_______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL }, {_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______}, - {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______}, + {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} } @@ -259,4 +259,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; } return true; -} \ No newline at end of file +} diff --git a/keyboards/planck/keymaps/khord/config.h b/keyboards/planck/keymaps/khord/config.h index 5482aba5..43c8001c 100644 --- a/keyboards/planck/keymaps/khord/config.h +++ b/keyboards/planck/keymaps/khord/config.h @@ -1,7 +1,7 @@ #ifndef CONFIG_USER_H #define CONFIG_USER_H -#include "../../config.h" +#include "config_common.h" #ifdef AUDIO_ENABLE #define STARTUP_SONG SONG(SONIC_RING) diff --git a/keyboards/planck/keymaps/pvc/config.h b/keyboards/planck/keymaps/pvc/config.h index 17f35175..53942373 100644 --- a/keyboards/planck/keymaps/pvc/config.h +++ b/keyboards/planck/keymaps/pvc/config.h @@ -29,31 +29,28 @@ along with this program. If not, see . #define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } #define UNUSED_PINS -/* COL2ROW or ROW2COL */ -#define DIODE_DIRECTION COL2ROW - -/* define if matrix has ghost */ -//#define MATRIX_HAS_GHOST - -/* number of backlight levels */ -#define BACKLIGHT_LEVELS 3 - -/* Set 0 if debouncing isn't needed */ -#define DEBOUNCING_DELAY 5 +/* + * MIDI options + */ -/* 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 +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 -/* key combination for command */ -#define IS_COMMAND() ( \ - keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ -) +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ +#define MIDI_BASIC -#define BACKLIGHT_PIN B7 -#define BACKLIGHT_BREATHING +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 /* * Feature disable options * These options are also useful to firmware size reduction. @@ -72,6 +69,7 @@ along with this program. If not, see . /* Only print user print statements */ #define USER_PRINT +#define BACKLIGHT_BREATHING /* disable action features */ //#define NO_ACTION_LAYER @@ -79,5 +77,4 @@ along with this program. If not, see . //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION - #endif diff --git a/keyboards/planck/keymaps/vifon/config.h b/keyboards/planck/keymaps/vifon/config.h index a08b37cb..4cb4a123 100644 --- a/keyboards/planck/keymaps/vifon/config.h +++ b/keyboards/planck/keymaps/vifon/config.h @@ -1,82 +1,30 @@ -/* -Copyright 2012 Jun Wako - -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 . -*/ - -#ifndef CONFIG_H -#define CONFIG_H - -#include "config_common.h" - -/* USB Device descriptor parameter */ -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x6060 -#define MANUFACTURER Ortholinear Keyboards -#define PRODUCT The Planck Keyboard -#define DESCRIPTION A compact ortholinear keyboard - -/* key matrix size */ -#define MATRIX_ROWS 4 -#define MATRIX_COLS 12 - -/* Planck PCB default pin-out */ -#define MATRIX_ROW_PINS { D0, D5, B5, B6 } -#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } -#define UNUSED_PINS - -#define BACKLIGHT_PIN B7 +#ifndef CONFIG_USER_H +#define CONFIG_USER_H -/* COL2ROW or ROW2COL */ -#define DIODE_DIRECTION COL2ROW - -/* define if matrix has ghost */ -//#define MATRIX_HAS_GHOST - -/* number of backlight levels */ -#define BACKLIGHT_LEVELS 3 - -/* Set 0 if debouncing isn't needed */ -#define DEBOUNCING_DELAY 5 - -/* 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 - -/* key combination for command */ -#define IS_COMMAND() ( \ - keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ -) +#include "../../config.h" /* - * Feature disable options - * These options are also useful to firmware size reduction. + * MIDI options */ -/* disable debug print */ -//#define NO_DEBUG +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 -/* disable print */ -//#define NO_PRINT +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ +#define MIDI_BASIC -/* disable action features */ -//#define NO_ACTION_LAYER -//#define NO_ACTION_TAPPING -//#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 /* prevent the modifiers from being stuck, sacrificing some memory */ #define PREVENT_STUCK_MODIFIERS @@ -86,11 +34,4 @@ along with this program. If not, see . */ #define DYNAMIC_MACRO_SIZE 256 -#ifdef SUBPROJECT_rev3 - #include "rev3/config.h" -#endif -#ifdef SUBPROJECT_rev4 - #include "rev4/config.h" -#endif - #endif diff --git a/keyboards/planck/keymaps/zach/config.h b/keyboards/planck/keymaps/zach/config.h index d309c949..19a3856a 100644 --- a/keyboards/planck/keymaps/zach/config.h +++ b/keyboards/planck/keymaps/zach/config.h @@ -1,55 +1,30 @@ -/* -Copyright 2012 Jun Wako - -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 . -*/ - -#ifndef CONFIG_H -#define CONFIG_H - -#include "config_common.h" - -/* USB Device descriptor parameter */ -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x6060 -#define MANUFACTURER Ortholinear Keyboards -#define PRODUCT The Planck Keyboard -#define DESCRIPTION A compact ortholinear keyboard +#ifndef CONFIG_USER_H +#define CONFIG_USER_H -/* key matrix size */ -#define MATRIX_ROWS 4 -#define MATRIX_COLS 12 +#include "../../config.h" -/* Planck PCB default pin-out */ -#define MATRIX_ROW_PINS { D0, D5, B5, B6 } -#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } -#define UNUSED_PINS - -#define BACKLIGHT_PIN B7 +/* + * MIDI options + */ -/* COL2ROW or ROW2COL */ -#define DIODE_DIRECTION COL2ROW +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 -/* define if matrix has ghost */ -//#define MATRIX_HAS_GHOST +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ +#define MIDI_BASIC -//#define BACKLIGHT_BREATHING // LED breathing -/* number of backlight levels */ -#define BACKLIGHT_LEVELS 5 +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED -/* Set 0 if debouncing isn't needed */ -#define DEBOUNCING_DELAY 5 +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ //#define LOCKING_SUPPORT_ENABLE @@ -84,11 +59,4 @@ along with this program. If not, see . //#define DYNAMIC_MACRO_ENABLE // Enable if you need to use the macro functionality //#define SPACE_CADET // Parenthesis on L/R shift -#ifdef SUBPROJECT_rev3 - #include "rev3/config.h" -#endif -#ifdef SUBPROJECT_rev4 - #include "rev4/config.h" -#endif - #endif diff --git a/keyboards/planck/light/config.h b/keyboards/planck/light/config.h new file mode 100644 index 00000000..b415851a --- /dev/null +++ b/keyboards/planck/light/config.h @@ -0,0 +1,56 @@ +#ifndef LIGHT_CONFIG_H +#define LIGHT_CONFIG_H + +#include "config_common.h" + +#undef PRODUCT +#define PRODUCT Planck Light +#undef PRODUCT_ID +#define PRODUCT_ID 0x6065 +#define DEVICE_VER 0x0001 + +#undef MATRIX_ROW_PINS +#undef MATRIX_COL_PINS + +#define MATRIX_ROW_PINS { B0, E7, F0, F1 } +#define MATRIX_COL_PINS { E6, E3, E4, D3, D4, D5, C0, A7, A6, E1, E0, D7 } + +#define C6_AUDIO +#define B5_AUDIO + +#undef BACKLIGHT_PIN + +#define BACKLIGHT_PIN A5 + +/* Size of Bootloaders in bytes: + * Atmel DFU loader(ATmega32U4) 4096 + * Atmel DFU loader(AT90USB128) 8192 + * LUFA bootloader(ATmega32U4) 4096 + * Arduino Caterina(ATmega32U4) 4096 + * USBaspLoader(ATmega***) 2048 + * Teensy halfKay(ATmega32U4) 512 + * Teensy++ halfKay(AT90USB128) 1024 + */ +#define BOOTLOADER_SIZE 8192 + +#define NO_USB_STARTUP_CHECK + +#define PLANCK_MIT_LAYOUT + +// This is a 7-bit address, that gets left-shifted and bit 0 +// set to 0 for write, 1 for read (as per I2C protocol) +// The address will vary depending on your wiring: +// 0b1110100 AD <-> GND +// 0b1110111 AD <-> VCC +// 0b1110101 AD <-> SCL +// 0b1110110 AD <-> SDA +#define DRIVER_ADDR_1 0b1110100 +#define DRIVER_ADDR_2 0b1110110 + +#define DRIVER_COUNT 2 +#define DRIVER_1_LED_TOTAL 25 +#define DRIVER_2_LED_TOTAL 24 +#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL + + +#endif \ No newline at end of file diff --git a/keyboards/planck/light/light.c b/keyboards/planck/light/light.c new file mode 100644 index 00000000..a18b42c4 --- /dev/null +++ b/keyboards/planck/light/light.c @@ -0,0 +1,145 @@ +/* Copyright 2017 Jason Williams + * Copyright 2017 Jack Humbert + * + * 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 . + */ + +#include "light.h" + +const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { +/* driver + * | matrix + * | | modifier + * | | | control_index + * | | | | {row | col << 4} + * | | | | | {x=0..224, y=0..64} */ + {0, 0, 1, 3, {0|(0<<4)}, {20.36*0, 21.33*0}}, + {0, 0, 0, 4, {0|(1<<4)}, {20.36*1, 21.33*0}}, + {0, 0, 0, 5, {0|(2<<4)}, {20.36*2, 21.33*0}}, + {0, 1, 0, 3, {0|(3<<4)}, {20.36*3, 21.33*0}}, + {0, 1, 0, 4, {0|(4<<4)}, {20.36*4, 21.33*0}}, + {0, 1, 0, 5, {0|(5<<4)}, {20.36*5, 21.33*0}}, + {1, 0, 0, 3, {0|(6<<4)}, {20.36*6, 21.33*0}}, + {1, 0, 0, 4, {0|(7<<4)}, {20.36*7, 21.33*0}}, + {1, 0, 0, 5, {0|(8<<4)}, {20.36*8, 21.33*0}}, + {1, 1, 0, 3, {0|(9<<4)}, {20.36*9, 21.33*0}}, + {1, 1, 0, 4, {0|(10<<4)}, {20.36*10,21.33*0}}, + {1, 1, 1, 5, {0|(11<<4)}, {20.36*11,21.33*0}}, + + {0, 0, 1, 6, {1|(0<<4)}, {20.36*0, 21.33*1}}, + {0, 0, 0, 7, {1|(1<<4)}, {20.36*1, 21.33*1}}, + {0, 0, 0, 8, {1|(2<<4)}, {20.36*2, 21.33*1}}, + {0, 1, 0, 6, {1|(3<<4)}, {20.36*3, 21.33*1}}, + {0, 1, 0, 7, {1|(4<<4)}, {20.36*4, 21.33*1}}, + {0, 1, 0, 8, {1|(5<<4)}, {20.36*5, 21.33*1}}, + {1, 0, 0, 6, {1|(6<<4)}, {20.36*6, 21.33*1}}, + {1, 0, 0, 7, {1|(7<<4)}, {20.36*7, 21.33*1}}, + {1, 0, 0, 8, {1|(8<<4)}, {20.36*8, 21.33*1}}, + {1, 1, 0, 6, {1|(9<<4)}, {20.36*9, 21.33*1}}, + {1, 1, 0, 7, {1|(10<<4)}, {20.36*10,21.33*1}}, + {1, 1, 1, 8, {1|(11<<4)}, {20.36*11,21.33*1}}, + + {0, 0, 1, 9, {2|(0<<4)}, {20.36*0, 21.33*2}}, + {0, 0, 0, 10, {2|(1<<4)}, {20.36*1, 21.33*2}}, + {0, 0, 0, 11, {2|(2<<4)}, {20.36*2, 21.33*2}}, + {0, 1, 0, 9, {2|(3<<4)}, {20.36*3, 21.33*2}}, + {0, 1, 0, 10, {2|(4<<4)}, {20.36*4, 21.33*2}}, + {0, 1, 0, 11, {2|(5<<4)}, {20.36*5, 21.33*2}}, + {1, 0, 0, 9, {2|(6<<4)}, {20.36*6, 21.33*2}}, + {1, 0, 0, 10, {2|(7<<4)}, {20.36*7, 21.33*2}}, + {1, 0, 0, 11, {2|(8<<4)}, {20.36*8, 21.33*2}}, + {1, 1, 0, 9, {2|(9<<4)}, {20.36*9, 21.33*2}}, + {1, 1, 0, 10, {2|(10<<4)}, {20.36*10,21.33*2}}, + {1, 1, 1, 11, {2|(11<<4)}, {20.36*11,21.33*2}}, + + {0, 0, 1, 12, {3|(0<<4)}, {20.36*0, 21.33*3}}, + {0, 0, 1, 13, {3|(1<<4)}, {20.36*1, 21.33*3}}, + {0, 0, 1, 14, {3|(2<<4)}, {20.36*2, 21.33*3}}, + {0, 1, 1, 12, {3|(3<<4)}, {20.36*3, 21.33*3}}, + {0, 1, 1, 13, {3|(4<<4)}, {20.36*4, 21.33*3}}, +#ifdef PLANCK_MIT_LAYOUT + {0, 1, 0, 14, {3|(5<<4)}, {20.36*5, 21.33*3}}, + {0, 1, 0, 15, {3|(5<<4)}, {20.36*5.5, 21.33*3}}, + {1, 0, 0, 12, {3|(5<<4)}, {20.36*6, 21.33*3}}, +#else + {0, 1, 0, 14, {3|(5<<4)}, {20.36*5, 21.33*3}}, + {0, 1, 0, 15, {0xFF}, {20.36*5.5, 21.33*3}}, + {1, 0, 0, 12, {3|(6<<4)}, {20.36*6, 21.33*3}}, +#endif + {1, 0, 1, 13, {3|(7<<4)}, {20.36*7, 21.33*3}}, + {1, 0, 1, 14, {3|(8<<4)}, {20.36*8, 21.33*3}}, + {1, 1, 1, 12, {3|(9<<4)}, {20.36*9, 21.33*3}}, + {1, 1, 1, 13, {3|(10<<4)}, {20.36*10,21.33*3}}, + {1, 1, 1, 14, {3|(11<<4)}, {20.36*11,21.33*3}} +}; + + +void matrix_init_kb(void) { + + // Initialize LED drivers for backlight. + backlight_init_drivers(); + + backlight_timer_init(); + backlight_timer_enable(); + + // Turn status LED on + DDRD |= (1<<6); + PORTD |= (1<<6); + + matrix_init_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) +{ + // Record keypresses for backlight effects + if ( record->event.pressed ) { + backlight_set_key_hit( record->event.key.row, record->event.key.col ); + } else { + // backlight_unset_key_hit( record->event.key.row, record->event.key.col ); + } + + return process_record_user(keycode, record); +} + +uint16_t backlight_task_counter = 0; + +void matrix_scan_kb(void) +{ + + // if (backlight_task_counter == 0) + backlight_rgb_task(); + // backlight_effect_single_LED_test(); + // backlight_task_counter = ((backlight_task_counter + 1) % 5); + + // This only updates the LED driver buffers if something has changed. + backlight_update_pwm_buffers(); + + matrix_scan_user(); +} + +void led_set_kb(uint8_t usb_led) +{ + backlight_set_indicator_state(usb_led); + //backlight_debug_led(usb_led & (1<. + */ + +#ifndef LIGHT_H +#define LIGHT_H + +#include "planck.h" +#include "rgb_matrix.h" + +#endif \ No newline at end of file diff --git a/keyboards/planck/light/rules.mk b/keyboards/planck/light/rules.mk new file mode 100644 index 00000000..c10b8fd1 --- /dev/null +++ b/keyboards/planck/light/rules.mk @@ -0,0 +1,5 @@ +MIDI_ENABLE = yes +AUDIO_ENABLE = yes # Audio output on port C6 +RGB_MATRIX_ENABLE = yes + +MCU = at90usb1286 \ No newline at end of file diff --git a/keyboards/planck/planck.c b/keyboards/planck/planck.c index 3980b02f..1d2f91bc 100644 --- a/keyboards/planck/planck.c +++ b/keyboards/planck/planck.c @@ -10,6 +10,7 @@ const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { }; #endif +__attribute__ ((weak)) void matrix_init_kb(void) { // Turn status LED on DDRE |= (1<<6); diff --git a/keyboards/planck/planck.h b/keyboards/planck/planck.h index 0ac4375d..3f00b026 100644 --- a/keyboards/planck/planck.h +++ b/keyboards/planck/planck.h @@ -38,5 +38,8 @@ #ifdef KEYBOARD_planck_rev4 #include "rev4.h" #endif +#ifdef KEYBOARD_planck_light + #include "light.h" +#endif #endif diff --git a/keyboards/planck/rev3/rules.mk b/keyboards/planck/rev3/rules.mk index 11485710..9ecde595 100644 --- a/keyboards/planck/rev3/rules.mk +++ b/keyboards/planck/rev3/rules.mk @@ -1 +1,10 @@ -AUDIO_ENABLE = no # Audio output on port C6 \ No newline at end of file + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + +AUDIO_ENABLE = no # Audio output on port C6 diff --git a/keyboards/planck/rev4/rules.mk b/keyboards/planck/rev4/rules.mk index 3b22e0a0..0001fb50 100644 --- a/keyboards/planck/rev4/rules.mk +++ b/keyboards/planck/rev4/rules.mk @@ -1 +1,9 @@ -AUDIO_ENABLE = yes # Audio output on port C6 \ No newline at end of file +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + +AUDIO_ENABLE = yes # Audio output on port C6 diff --git a/keyboards/planck/rules.mk b/keyboards/planck/rules.mk index bee5f878..85d284d4 100644 --- a/keyboards/planck/rules.mk +++ b/keyboards/planck/rules.mk @@ -37,15 +37,6 @@ 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 -# Atmel DFU loader 4096 -# LUFA bootloader 4096 -# USBaspLoader 2048 -OPT_DEFS += -DBOOTLOADER_SIZE=4096 - # Build Options # change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically @@ -69,4 +60,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend LAYOUTS = ortho_4x12 -DEFAULT_FOLDER = planck/rev4 \ No newline at end of file +DEFAULT_FOLDER = planck/rev4 diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c index e0823348..29bad806 100644 --- a/quantum/audio/audio.c +++ b/quantum/audio/audio.c @@ -184,6 +184,9 @@ void audio_init() #ifdef B5_AUDIO TCCR1A = (0 << COM1A1) | (0 << COM1A0) | (1 << WGM11) | (0 << WGM10); TCCR1B = (1 << WGM13) | (1 << WGM12) | (0 << CS12) | (1 << CS11) | (0 << CS10); + + TIMER_1_PERIOD = (uint16_t)(((float)F_CPU) / (440 * CPU_PRESCALER)); + TIMER_1_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (440 * CPU_PRESCALER)) * note_timbre); #endif audio_initialized = true; @@ -192,7 +195,7 @@ void audio_init() if (audio_config.enable) { PLAY_SONG(startup_song); } - + } void stop_all_notes()