Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: Jack Humbert <jack.humb@gmail.com>pull/14507/head
@ -1,26 +1,41 @@ | |||||
#ifndef PLANCK_H | |||||
#define PLANCK_H | |||||
/* Copyright 2018 Jack Humbert <jack.humb@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" | #include "quantum.h" | ||||
#if defined(KEYBOARD_planck_ez) | #if defined(KEYBOARD_planck_ez) | ||||
#include "ez.h" | |||||
# include "ez.h" | |||||
#elif defined(KEYBOARD_planck_light) | #elif defined(KEYBOARD_planck_light) | ||||
#include "light.h" | |||||
# include "light.h" | |||||
#elif defined(KEYBOARD_planck_thk) | #elif defined(KEYBOARD_planck_thk) | ||||
#include "thk.h" | |||||
# include "thk.h" | |||||
#elif defined(KEYBOARD_planck_rev1) | #elif defined(KEYBOARD_planck_rev1) | ||||
#include "rev1.h" | |||||
# include "rev1.h" | |||||
#elif defined(KEYBOARD_planck_rev2) | #elif defined(KEYBOARD_planck_rev2) | ||||
#include "rev2.h" | |||||
# include "rev2.h" | |||||
#elif defined(KEYBOARD_planck_rev3) | #elif defined(KEYBOARD_planck_rev3) | ||||
#include "rev3.h" | |||||
# include "rev3.h" | |||||
#elif defined(KEYBOARD_planck_rev4) | #elif defined(KEYBOARD_planck_rev4) | ||||
#include "rev4.h" | |||||
# include "rev4.h" | |||||
#elif defined(KEYBOARD_planck_rev5) | #elif defined(KEYBOARD_planck_rev5) | ||||
#include "rev5.h" | |||||
# include "rev5.h" | |||||
#elif defined(KEYBOARD_planck_rev6) | #elif defined(KEYBOARD_planck_rev6) | ||||
#include "rev6.h" | |||||
#endif // Planck revisions | |||||
#endif | |||||
# include "rev6.h" | |||||
#elif defined(KEYBOARD_planck_rev6_drop) | |||||
# include "rev6_drop.h" | |||||
#endif // Planck revisions |
@ -0,0 +1,29 @@ | |||||
/* Copyright 2020 QMK | |||||
* | |||||
* 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/>. | |||||
*/ | |||||
/* | |||||
* This file was auto-generated by: | |||||
* `qmk chibios-confmigrate -i keyboards/planck/rev6/chconf.h -r platforms/chibios/QMK_PROTON_C/configs/chconf.h` | |||||
*/ | |||||
#pragma once | |||||
#define CH_CFG_ST_RESOLUTION 16 | |||||
#define CH_CFG_ST_FREQUENCY 10000 | |||||
#include_next <chconf.h> | |||||
@ -0,0 +1,128 @@ | |||||
/* | |||||
* Copyright 2018 Jack Humbert <jack.humb@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 | |||||
/* USB Device descriptor parameter */ | |||||
#define PRODUCT_ID 0xA4F9 | |||||
#define DEVICE_VER 0x0006 | |||||
#undef MANUFACTURER | |||||
#define MANUFACTURER Drop | |||||
#undef MATRIX_ROWS | |||||
#undef MATRIX_COLS | |||||
/* key matrix size */ | |||||
#define MATRIX_ROWS 8 | |||||
#define MATRIX_COLS 6 | |||||
/* | |||||
* 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) | |||||
* | |||||
*/ | |||||
/* Note: These are not used for arm boards. They're here purely as documentation. */ | |||||
#undef MATRIX_ROW_PINS | |||||
#undef MATRIX_COL_PINS | |||||
#define MATRIX_ROW_PINS \ | |||||
{ A10, A9, A8, B15, C13, C14, C15, A2 } | |||||
#define MATRIX_COL_PINS \ | |||||
{ B11, B10, B2, B1, A7, B0 } | |||||
#define UNUSED_PINS | |||||
#define ENCODERS_PAD_A \ | |||||
{ B12 } | |||||
#define ENCODERS_PAD_B \ | |||||
{ B13 } | |||||
#define DIP_SWITCH_PINS \ | |||||
{ B14, A15, A0, B9 } | |||||
#define MUSIC_MAP | |||||
#undef AUDIO_VOICES | |||||
#undef AUDIO_PIN | |||||
#define AUDIO_PIN A5 | |||||
#define AUDIO_PIN_ALT A4 | |||||
#define AUDIO_PIN_ALT_AS_NEGATIVE | |||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | |||||
// #define DEBOUNCE 6 | |||||
/* 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 | |||||
/* | |||||
* 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 | |||||
//#define NO_ACTION_MACRO | |||||
//#define NO_ACTION_FUNCTION | |||||
/* | |||||
* WS2812 Underglow Matrix options | |||||
*/ | |||||
#define RGB_DI_PIN A1 | |||||
#define RGBLED_NUM 9 | |||||
#define DRIVER_LED_TOTAL RGBLED_NUM | |||||
#define WS2812_PWM_DRIVER PWMD2 | |||||
#define WS2812_PWM_CHANNEL 2 | |||||
#define WS2812_PWM_PAL_MODE 1 | |||||
#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 | |||||
#define WS2812_DMA_CHANNEL 2 | |||||
#define RGB_DISABLE_WHEN_USB_SUSPENDED |
@ -0,0 +1,22 @@ | |||||
/* Copyright 2020 QMK | |||||
* | |||||
* 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 3 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 <https://www.gnu.org/licenses/>. | |||||
*/ | |||||
#pragma once | |||||
#define HAL_USE_PWM TRUE | |||||
#define HAL_USE_GPT TRUE | |||||
#define HAL_USE_DAC TRUE | |||||
#include_next <halconf.h> |
@ -0,0 +1,262 @@ | |||||
{ | |||||
"keyboard_name": "Planck rev 6", | |||||
"url": "https://olkb.com/planck", | |||||
"maintainer": "jackhumbert", | |||||
"layouts": { | |||||
"LAYOUT_ortho_4x12": { | |||||
"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_1x2uC": { | |||||
"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_planck_1x2uL": { | |||||
"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, "w": 2 }, | |||||
{ "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_1x2uR": { | |||||
"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, "w": 2 }, | |||||
{ "x": 8, "y": 3 }, | |||||
{ "x": 9, "y": 3 }, | |||||
{ "x": 10, "y": 3 }, | |||||
{ "x": 11, "y": 3 } | |||||
] | |||||
}, | |||||
"LAYOUT_planck_2x2u": { | |||||
"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, "w": 2 }, | |||||
{ "x": 6, "y": 3, "w": 2 }, | |||||
{ "x": 8, "y": 3 }, | |||||
{ "x": 9, "y": 3 }, | |||||
{ "x": 10, "y": 3 }, | |||||
{ "x": 11, "y": 3 } | |||||
] | |||||
} | |||||
} | |||||
} |
@ -0,0 +1,166 @@ | |||||
/* | |||||
* Copyright 2018 Jack Humbert <jack.humb@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 <stdint.h> | |||||
#include <stdbool.h> | |||||
#include <string.h> | |||||
#include "hal.h" | |||||
#include "timer.h" | |||||
#include "wait.h" | |||||
#include "debug.h" | |||||
#include "matrix.h" | |||||
/* | |||||
* col: { B11, B10, B2, B1, A7, B0 } | |||||
* row: { A10, A9, A8, B15, C13, C14, C15, A2 } | |||||
*/ | |||||
/* matrix state(1:on, 0:off) */ | |||||
static matrix_row_t matrix[MATRIX_ROWS]; | |||||
static matrix_row_t matrix_debouncing[MATRIX_COLS]; | |||||
static bool debouncing = false; | |||||
static uint16_t debouncing_time = 0; | |||||
__attribute__((weak)) void matrix_init_user(void) {} | |||||
__attribute__((weak)) void matrix_scan_user(void) {} | |||||
__attribute__((weak)) void matrix_init_kb(void) { matrix_init_user(); } | |||||
__attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); } | |||||
void matrix_init(void) { | |||||
printf("matrix init\n"); | |||||
// debug_matrix = true; | |||||
// actual matrix setup | |||||
palSetPadMode(GPIOB, 11, PAL_MODE_OUTPUT_PUSHPULL); | |||||
palSetPadMode(GPIOB, 10, PAL_MODE_OUTPUT_PUSHPULL); | |||||
palSetPadMode(GPIOB, 2, PAL_MODE_OUTPUT_PUSHPULL); | |||||
palSetPadMode(GPIOB, 1, PAL_MODE_OUTPUT_PUSHPULL); | |||||
palSetPadMode(GPIOA, 7, PAL_MODE_OUTPUT_PUSHPULL); | |||||
palSetPadMode(GPIOB, 0, PAL_MODE_OUTPUT_PUSHPULL); | |||||
palSetPadMode(GPIOA, 10, PAL_MODE_INPUT_PULLDOWN); | |||||
palSetPadMode(GPIOA, 9, PAL_MODE_INPUT_PULLDOWN); | |||||
palSetPadMode(GPIOA, 8, PAL_MODE_INPUT_PULLDOWN); | |||||
palSetPadMode(GPIOB, 15, PAL_MODE_INPUT_PULLDOWN); | |||||
palSetPadMode(GPIOC, 13, PAL_MODE_INPUT_PULLDOWN); | |||||
palSetPadMode(GPIOC, 14, PAL_MODE_INPUT_PULLDOWN); | |||||
palSetPadMode(GPIOC, 15, PAL_MODE_INPUT_PULLDOWN); | |||||
palSetPadMode(GPIOA, 2, PAL_MODE_INPUT_PULLDOWN); | |||||
memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t)); | |||||
memset(matrix_debouncing, 0, MATRIX_COLS * sizeof(matrix_row_t)); | |||||
matrix_init_quantum(); | |||||
} | |||||
uint8_t matrix_scan(void) { | |||||
// actual matrix | |||||
for (int col = 0; col < MATRIX_COLS; col++) { | |||||
matrix_row_t data = 0; | |||||
// strobe col { B11, B10, B2, B1, A7, B0 } | |||||
switch (col) { | |||||
case 0: | |||||
palSetPad(GPIOB, 11); | |||||
break; | |||||
case 1: | |||||
palSetPad(GPIOB, 10); | |||||
break; | |||||
case 2: | |||||
palSetPad(GPIOB, 2); | |||||
break; | |||||
case 3: | |||||
palSetPad(GPIOB, 1); | |||||
break; | |||||
case 4: | |||||
palSetPad(GPIOA, 7); | |||||
break; | |||||
case 5: | |||||
palSetPad(GPIOB, 0); | |||||
break; | |||||
} | |||||
// need wait to settle pin state | |||||
wait_us(20); | |||||
// read row data { A10, A9, A8, B15, C13, C14, C15, A2 } | |||||
data = ((palReadPad(GPIOA, 10) << 0) | (palReadPad(GPIOA, 9) << 1) | (palReadPad(GPIOA, 8) << 2) | (palReadPad(GPIOB, 15) << 3) | (palReadPad(GPIOC, 13) << 4) | (palReadPad(GPIOC, 14) << 5) | (palReadPad(GPIOC, 15) << 6) | (palReadPad(GPIOA, 2) << 7)); | |||||
// unstrobe col { B11, B10, B2, B1, A7, B0 } | |||||
switch (col) { | |||||
case 0: | |||||
palClearPad(GPIOB, 11); | |||||
break; | |||||
case 1: | |||||
palClearPad(GPIOB, 10); | |||||
break; | |||||
case 2: | |||||
palClearPad(GPIOB, 2); | |||||
break; | |||||
case 3: | |||||
palClearPad(GPIOB, 1); | |||||
break; | |||||
case 4: | |||||
palClearPad(GPIOA, 7); | |||||
break; | |||||
case 5: | |||||
palClearPad(GPIOB, 0); | |||||
break; | |||||
} | |||||
if (matrix_debouncing[col] != data) { | |||||
matrix_debouncing[col] = data; | |||||
debouncing = true; | |||||
debouncing_time = timer_read(); | |||||
} | |||||
} | |||||
if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) { | |||||
for (int row = 0; row < MATRIX_ROWS; row++) { | |||||
matrix[row] = 0; | |||||
for (int col = 0; col < MATRIX_COLS; col++) { | |||||
matrix[row] |= ((matrix_debouncing[col] & (1 << row) ? 1 : 0) << col); | |||||
} | |||||
} | |||||
debouncing = false; | |||||
} | |||||
matrix_scan_quantum(); | |||||
return 1; | |||||
} | |||||
bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & (1 << col)); } | |||||
matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; } | |||||
void matrix_print(void) { | |||||
printf("\nr/c 01234567\n"); | |||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | |||||
printf("%X0: ", row); | |||||
matrix_row_t data = matrix_get_row(row); | |||||
for (int col = 0; col < MATRIX_COLS; col++) { | |||||
if (data & (1 << col)) | |||||
printf("1"); | |||||
else | |||||
printf("0"); | |||||
} | |||||
printf("\n"); | |||||
} | |||||
} |
@ -0,0 +1,39 @@ | |||||
/* Copyright 2020 QMK Contributors | |||||
* | |||||
* 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 3 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_next "mcuconf.h" | |||||
// The SysTick timer from the normal quantum/stm32 uses TIM2 -- the WS2812 pin used | |||||
// on the Planck requires the use of TIM2 to run PWM -- rework which timers are | |||||
// allocated for PWM usage. | |||||
#undef STM32_PWM_USE_TIM2 | |||||
#define STM32_PWM_USE_TIM2 TRUE | |||||
#undef STM32_DAC_USE_DAC1_CH1 | |||||
#define STM32_DAC_USE_DAC1_CH1 TRUE | |||||
#undef STM32_DAC_USE_DAC1_CH2 | |||||
#define STM32_DAC_USE_DAC1_CH2 TRUE | |||||
#undef STM32_GPT_USE_TIM6 | |||||
#define STM32_GPT_USE_TIM6 TRUE | |||||
#undef STM32_GPT_USE_TIM7 | |||||
#define STM32_GPT_USE_TIM7 TRUE | |||||
#undef STM32_GPT_USE_TIM8 | |||||
#define STM32_GPT_USE_TIM8 TRUE | |||||
// As mentioned above, we need to reallocate the SysTick timer used from | |||||
// TIM2 to TIM3. | |||||
#undef STM32_ST_USE_TIMER | |||||
#define STM32_ST_USE_TIMER 3 |
@ -0,0 +1,13 @@ | |||||
# Planck | |||||
A compact 40% (12x4) ortholinear keyboard kit made and sold by OLKB and Massdrop. A complete hardware rework of the Planck, sporting a faster and more powerful STM32 ARM Cortex-M4 microcontroller, with support for rotary encoders and three additional layouts. [More info on qmk.fm](http://qmk.fm/planck/) | |||||
* Keyboard Maintainer: [Jack Humbert](https://github.com/jackhumbert) | |||||
* Hardware Supported: Planck PCB rev6 | |||||
* Hardware Availability: [OLKB.com](https://olkb.com), [Massdrop](https://www.massdrop.com/buy/planck-mechanical-keyboard?mode=guest_open) | |||||
Make example for this keyboard (after setting up your build environment): | |||||
make planck/rev6_drop: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). |
@ -0,0 +1,44 @@ | |||||
/* Copyright 2018 Jack Humbert <jack.humb@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 "rev6_drop.h" | |||||
#ifdef RGB_MATRIX_ENABLE | |||||
// clang-format off | |||||
led_config_t g_led_config = { { | |||||
// Key Matrix to LED Index | |||||
{ NO_LED, 6, NO_LED, NO_LED, 5, NO_LED }, | |||||
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, | |||||
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, 0 }, | |||||
{ NO_LED, 7, NO_LED, NO_LED, 2, NO_LED }, | |||||
{ NO_LED, 4, NO_LED, NO_LED, 3, NO_LED }, | |||||
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, | |||||
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, | |||||
{ NO_LED, 1, NO_LED, NO_LED, 8, NO_LED }, | |||||
}, { | |||||
// LED Index to Physical Position | |||||
{112, 39}, {148, 60}, {206, 53}, {206, 3}, {150, 3}, {74, 3}, {18, 3}, {18, 54}, {77, 60} | |||||
}, { | |||||
// LED Index to Flag | |||||
LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, | |||||
LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL | |||||
} }; | |||||
// LED physical location index | |||||
// 6 5 4 3 | |||||
// 0 | |||||
// 7 8 1 2 | |||||
#endif |
@ -0,0 +1,108 @@ | |||||
/* Copyright 2018 Jack Humbert <jack.humb@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 "planck.h" | |||||
#define LAYOUT_planck_1x2uC( \ | |||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ | |||||
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ | |||||
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ | |||||
k30, k31, k32, k33, k34, k36, k37, k38, k39, k3a, k3b \ | |||||
) \ | |||||
{ \ | |||||
{ k00, k01, k02, k03, k04, k05 }, \ | |||||
{ k10, k11, k12, k13, k14, k15 }, \ | |||||
{ k20, k21, k22, k23, k24, k25 }, \ | |||||
{ k30, k31, k32, k39, k3a, k3b }, \ | |||||
{ k06, k07, k08, k09, k0a, k0b }, \ | |||||
{ k16, k17, k18, k19, k1a, k1b }, \ | |||||
{ k26, k27, k28, k29, k2a, k2b }, \ | |||||
{ k36, k37, k38, k33, k34, KC_NO } \ | |||||
} | |||||
#define LAYOUT_planck_1x2uR( \ | |||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ | |||||
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ | |||||
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ | |||||
k30, k31, k32, k33, k34, k35, k37, k38, k39, k3a, k3b \ | |||||
) \ | |||||
{ \ | |||||
{ k00, k01, k02, k03, k04, k05 }, \ | |||||
{ k10, k11, k12, k13, k14, k15 }, \ | |||||
{ k20, k21, k22, k23, k24, k25 }, \ | |||||
{ k30, k31, k32, k39, k3a, k3b }, \ | |||||
{ k06, k07, k08, k09, k0a, k0b }, \ | |||||
{ k16, k17, k18, k19, k1a, k1b }, \ | |||||
{ k26, k27, k28, k29, k2a, k2b }, \ | |||||
{ KC_NO, k37, k38, k33, k34, k35 } \ | |||||
} | |||||
#define LAYOUT_planck_1x2uL( \ | |||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ | |||||
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ | |||||
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ | |||||
k30, k31, k32, k33, k35, k36, k37, k38, k39, k3a, k3b \ | |||||
) \ | |||||
{ \ | |||||
{ k00, k01, k02, k03, k04, k05 }, \ | |||||
{ k10, k11, k12, k13, k14, k15 }, \ | |||||
{ k20, k21, k22, k23, k24, k25 }, \ | |||||
{ k30, k31, k32, k39, k3a, k3b }, \ | |||||
{ k06, k07, k08, k09, k0a, k0b }, \ | |||||
{ k16, k17, k18, k19, k1a, k1b }, \ | |||||
{ k26, k27, k28, k29, k2a, k2b }, \ | |||||
{ k36, k37, k38, k33, KC_NO, k35 } \ | |||||
} | |||||
#define LAYOUT_planck_2x2u( \ | |||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ | |||||
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ | |||||
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ | |||||
k30, k31, k32, k33, k35, k37, k38, k39, k3a, k3b \ | |||||
) \ | |||||
{ \ | |||||
{ k00, k01, k02, k03, k04, k05 }, \ | |||||
{ k10, k11, k12, k13, k14, k15 }, \ | |||||
{ k20, k21, k22, k23, k24, k25 }, \ | |||||
{ k30, k31, k32, k39, k3a, k3b }, \ | |||||
{ k06, k07, k08, k09, k0a, k0b }, \ | |||||
{ k16, k17, k18, k19, k1a, k1b }, \ | |||||
{ k26, k27, k28, k29, k2a, k2b }, \ | |||||
{ KC_NO, k37, k38, k33, KC_NO, k35 } \ | |||||
} | |||||
#define LAYOUT_ortho_4x12( \ | |||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ | |||||
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ | |||||
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ | |||||
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b \ | |||||
) \ | |||||
{ \ | |||||
{ k00, k01, k02, k03, k04, k05 }, \ | |||||
{ k10, k11, k12, k13, k14, k15 }, \ | |||||
{ k20, k21, k22, k23, k24, k25 }, \ | |||||
{ k30, k31, k32, k39, k3a, k3b }, \ | |||||
{ k06, k07, k08, k09, k0a, k0b }, \ | |||||
{ k16, k17, k18, k19, k1a, k1b }, \ | |||||
{ k26, k27, k28, k29, k2a, k2b }, \ | |||||
{ k36, k37, k38, k33, k34, k35 } \ | |||||
} | |||||
#define LAYOUT LAYOUT_ortho_4x12 | |||||
#define LAYOUT_planck_mit LAYOUT_planck_1x2uC | |||||
#define LAYOUT_planck_grid LAYOUT_ortho_4x12 |
@ -0,0 +1,33 @@ | |||||
# MCU name | |||||
MCU = STM32F303 | |||||
# Bootloader selection | |||||
BOOTLOADER = stm32-dfu | |||||
# Build Options | |||||
# change yes to no to disable | |||||
# | |||||
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite | |||||
MOUSEKEY_ENABLE = yes # Mouse keys | |||||
EXTRAKEY_ENABLE = yes # Audio control and System control | |||||
CONSOLE_ENABLE = yes # Console for debug | |||||
COMMAND_ENABLE = yes # 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 | |||||
AUDIO_ENABLE = yes # Audio output | |||||
WS2812_DRIVER = pwm | |||||
CUSTOM_MATRIX = yes | |||||
# Do not enable RGB_MATRIX_ENABLE together with RGBLIGHT_ENABLE | |||||
RGB_MATRIX_ENABLE = no | |||||
RGB_MATRIX_DRIVER = WS2812 | |||||
ENCODER_ENABLE = yes | |||||
DIP_SWITCH_ENABLE = yes | |||||
SRC += matrix.c | |||||
LAYOUTS = ortho_4x12 planck_mit | |||||
LAYOUTS_HAS_RGB = no |
@ -0,0 +1,29 @@ | |||||
/* Copyright 2021 QMK Contributors | |||||
* | |||||
* 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/>. | |||||
*/ | |||||
/* | |||||
* This file was auto-generated by: | |||||
* `qmk chibios-confmigrate -i keyboards/preonic/rev3/chconf.h -r platforms/chibios/QMK_PROTON_C/configs/chconf.h` | |||||
*/ | |||||
#pragma once | |||||
#define CH_CFG_ST_RESOLUTION 16 | |||||
#define CH_CFG_ST_FREQUENCY 10000 | |||||
#include_next <chconf.h> | |||||
@ -0,0 +1,110 @@ | |||||
/* | |||||
* Copyright 2018 Jack Humbert <jack.humb@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 | |||||
/* USB Device descriptor parameter */ | |||||
#define DEVICE_VER 0x0003 | |||||
#define PRODUCT_ID 0xA649 | |||||
#undef MANUFACTURER | |||||
#define MANUFACTURER Drop | |||||
#undef MATRIX_ROWS | |||||
#undef MATRIX_COLS | |||||
/* key matrix size */ | |||||
#define MATRIX_ROWS 10 | |||||
#define MATRIX_COLS 6 | |||||
#undef MATRIX_ROW_PINS | |||||
#undef MATRIX_COL_PINS | |||||
#define MATRIX_ROW_PINS { A10, A9, A8, B15, C13, C14, C15, A2, A3, A6 } | |||||
#define MATRIX_COL_PINS { B11, B10, B2, B1, A7, B0 } | |||||
#define UNUSED_PINS | |||||
#define ENCODERS_PAD_A { B12 } | |||||
#define ENCODERS_PAD_B { B13 } | |||||
#define DIP_SWITCH_PINS { B14, A15, A0, B9 } | |||||
#define MUSIC_MAP | |||||
#undef AUDIO_VOICES | |||||
#undef AUDIO_PIN | |||||
#define AUDIO_PIN A5 | |||||
#define AUDIO_PIN_ALT A4 | |||||
#define AUDIO_PIN_ALT_AS_NEGATIVE | |||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | |||||
// #define DEBOUNCE 6 | |||||
/* 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 | |||||
/* | |||||
* 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 | |||||
//#define NO_ACTION_MACRO | |||||
//#define NO_ACTION_FUNCTION | |||||
/* | |||||
* WS2812 Underglow Matrix options | |||||
*/ | |||||
#define RGB_DI_PIN A1 | |||||
#define RGBLED_NUM 9 | |||||
#define RGBLIGHT_ANIMATIONS | |||||
// RGB Matrix support | |||||
#define DRIVER_LED_TOTAL RGBLED_NUM | |||||
#define WS2812_PWM_DRIVER PWMD2 | |||||
#define WS2812_PWM_CHANNEL 2 | |||||
#define WS2812_PWM_PAL_MODE 1 | |||||
#define WS2812_DMA_STREAM STM32_DMA1_STREAM2 | |||||
#define WS2812_DMA_CHANNEL 2 |
@ -0,0 +1,22 @@ | |||||
/* Copyright 2020 QMK | |||||
* | |||||
* 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 3 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 <https://www.gnu.org/licenses/>. | |||||
*/ | |||||
#pragma once | |||||
#define HAL_USE_PWM TRUE | |||||
#define HAL_USE_GPT TRUE | |||||
#define HAL_USE_DAC TRUE | |||||
#include_next <halconf.h> |
@ -0,0 +1,342 @@ | |||||
{ | |||||
"keyboard_name": "Preonic rev. 3", | |||||
"url": "https://olkb.com/preonic", | |||||
"maintainer": "jackhumbert", | |||||
"layouts": { | |||||
"LAYOUT_preonic_1x2uC": { | |||||
"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}, | |||||
{"x": 0, "y": 4}, | |||||
{"x": 1, "y": 4}, | |||||
{"x": 2, "y": 4}, | |||||
{"x": 3, "y": 4}, | |||||
{"x": 4, "y": 4}, | |||||
{"x": 5, "y": 4, "w": 2}, | |||||
{"x": 7, "y": 4}, | |||||
{"x": 8, "y": 4}, | |||||
{"x": 9, "y": 4}, | |||||
{"x": 10, "y": 4}, | |||||
{"x": 11, "y": 4} | |||||
] | |||||
}, | |||||
"LAYOUT_preonic_1x2uR": { | |||||
"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}, | |||||
{"x": 0, "y": 4}, | |||||
{"x": 1, "y": 4}, | |||||
{"x": 2, "y": 4}, | |||||
{"x": 3, "y": 4}, | |||||
{"x": 4, "y": 4}, | |||||
{"x": 5, "y": 4}, | |||||
{"x": 6, "y": 4, "w": 2}, | |||||
{"x": 8, "y": 4}, | |||||
{"x": 9, "y": 4}, | |||||
{"x": 10, "y": 4}, | |||||
{"x": 11, "y": 4} | |||||
] | |||||
}, | |||||
"LAYOUT_preonic_1x2uL": { | |||||
"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}, | |||||
{"x": 0, "y": 4}, | |||||
{"x": 1, "y": 4}, | |||||
{"x": 2, "y": 4}, | |||||
{"x": 3, "y": 4}, | |||||
{"x": 4, "y": 4, "w": 2}, | |||||
{"x": 6, "y": 4}, | |||||
{"x": 7, "y": 4}, | |||||
{"x": 8, "y": 4}, | |||||
{"x": 9, "y": 4}, | |||||
{"x": 10, "y": 4}, | |||||
{"x": 11, "y": 4} | |||||
] | |||||
}, | |||||
"LAYOUT_preonic_2x2u": { | |||||
"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}, | |||||
{"x": 0, "y": 4}, | |||||
{"x": 1, "y": 4}, | |||||
{"x": 2, "y": 4}, | |||||
{"x": 3, "y": 4}, | |||||
{"x": 4, "y": 4, "w": 2}, | |||||
{"x": 6, "y": 4, "w": 2}, | |||||
{"x": 8, "y": 4}, | |||||
{"x": 9, "y": 4}, | |||||
{"x": 10, "y": 4}, | |||||
{"x": 11, "y": 4} | |||||
] | |||||
}, | |||||
"LAYOUT_ortho_5x12": { | |||||
"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}, | |||||
{"x": 0, "y": 4}, | |||||
{"x": 1, "y": 4}, | |||||
{"x": 2, "y": 4}, | |||||
{"x": 3, "y": 4}, | |||||
{"x": 4, "y": 4}, | |||||
{"x": 5, "y": 4}, | |||||
{"x": 6, "y": 4}, | |||||
{"x": 7, "y": 4}, | |||||
{"x": 8, "y": 4}, | |||||
{"x": 9, "y": 4}, | |||||
{"x": 10, "y": 4}, | |||||
{"x": 11, "y": 4} | |||||
] | |||||
} | |||||
} | |||||
} |
@ -0,0 +1,168 @@ | |||||
/* | |||||
* Copyright 2018 Jack Humbert <jack.humb@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 <stdint.h> | |||||
#include <stdbool.h> | |||||
#include <string.h> | |||||
#include "hal.h" | |||||
#include "timer.h" | |||||
#include "wait.h" | |||||
#include "debug.h" | |||||
#include "matrix.h" | |||||
/* | |||||
* col: { B11, B10, B2, B1, A7, B0 } | |||||
* row: { A10, A9, A8, B15, C13, C14, C15, A2 } | |||||
*/ | |||||
/* matrix state(1:on, 0:off) */ | |||||
static matrix_row_t matrix[MATRIX_ROWS]; | |||||
static matrix_row_t matrix_debouncing[MATRIX_COLS]; | |||||
static bool debouncing = false; | |||||
static uint16_t debouncing_time = 0; | |||||
__attribute__((weak)) void matrix_init_user(void) {} | |||||
__attribute__((weak)) void matrix_scan_user(void) {} | |||||
__attribute__((weak)) void matrix_init_kb(void) { matrix_init_user(); } | |||||
__attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); } | |||||
void matrix_init(void) { | |||||
printf("matrix init\n"); | |||||
// debug_matrix = true; | |||||
// actual matrix setup | |||||
palSetPadMode(GPIOB, 11, PAL_MODE_OUTPUT_PUSHPULL); | |||||
palSetPadMode(GPIOB, 10, PAL_MODE_OUTPUT_PUSHPULL); | |||||
palSetPadMode(GPIOB, 2, PAL_MODE_OUTPUT_PUSHPULL); | |||||
palSetPadMode(GPIOB, 1, PAL_MODE_OUTPUT_PUSHPULL); | |||||
palSetPadMode(GPIOA, 7, PAL_MODE_OUTPUT_PUSHPULL); | |||||
palSetPadMode(GPIOB, 0, PAL_MODE_OUTPUT_PUSHPULL); | |||||
palSetPadMode(GPIOA, 10, PAL_MODE_INPUT_PULLDOWN); | |||||
palSetPadMode(GPIOA, 9, PAL_MODE_INPUT_PULLDOWN); | |||||
palSetPadMode(GPIOA, 8, PAL_MODE_INPUT_PULLDOWN); | |||||
palSetPadMode(GPIOB, 15, PAL_MODE_INPUT_PULLDOWN); | |||||
palSetPadMode(GPIOC, 13, PAL_MODE_INPUT_PULLDOWN); | |||||
palSetPadMode(GPIOC, 14, PAL_MODE_INPUT_PULLDOWN); | |||||
palSetPadMode(GPIOC, 15, PAL_MODE_INPUT_PULLDOWN); | |||||
palSetPadMode(GPIOA, 2, PAL_MODE_INPUT_PULLDOWN); | |||||
palSetPadMode(GPIOA, 3, PAL_MODE_INPUT_PULLDOWN); | |||||
palSetPadMode(GPIOA, 6, PAL_MODE_INPUT_PULLDOWN); | |||||
memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t)); | |||||
memset(matrix_debouncing, 0, MATRIX_COLS * sizeof(matrix_row_t)); | |||||
matrix_init_quantum(); | |||||
} | |||||
uint8_t matrix_scan(void) { | |||||
// actual matrix | |||||
for (int col = 0; col < MATRIX_COLS; col++) { | |||||
matrix_row_t data = 0; | |||||
// strobe col { B11, B10, B2, B1, A7, B0 } | |||||
switch (col) { | |||||
case 0: | |||||
palSetPad(GPIOB, 11); | |||||
break; | |||||
case 1: | |||||
palSetPad(GPIOB, 10); | |||||
break; | |||||
case 2: | |||||
palSetPad(GPIOB, 2); | |||||
break; | |||||
case 3: | |||||
palSetPad(GPIOB, 1); | |||||
break; | |||||
case 4: | |||||
palSetPad(GPIOA, 7); | |||||
break; | |||||
case 5: | |||||
palSetPad(GPIOB, 0); | |||||
break; | |||||
} | |||||
// need wait to settle pin state | |||||
wait_us(20); | |||||
// read row data { A10, A9, A8, B15, C13, C14, C15, A2 } | |||||
data = ((palReadPad(GPIOA, 10) << 0) | (palReadPad(GPIOA, 9) << 1) | (palReadPad(GPIOA, 8) << 2) | (palReadPad(GPIOB, 15) << 3) | (palReadPad(GPIOC, 13) << 4) | (palReadPad(GPIOC, 14) << 5) | (palReadPad(GPIOC, 15) << 6) | (palReadPad(GPIOA, 2) << 7) | (palReadPad(GPIOA, 3) << 8) | (palReadPad(GPIOA, 6) << 9)); | |||||
// unstrobe col { B11, B10, B2, B1, A7, B0 } | |||||
switch (col) { | |||||
case 0: | |||||
palClearPad(GPIOB, 11); | |||||
break; | |||||
case 1: | |||||
palClearPad(GPIOB, 10); | |||||
break; | |||||
case 2: | |||||
palClearPad(GPIOB, 2); | |||||
break; | |||||
case 3: | |||||
palClearPad(GPIOB, 1); | |||||
break; | |||||
case 4: | |||||
palClearPad(GPIOA, 7); | |||||
break; | |||||
case 5: | |||||
palClearPad(GPIOB, 0); | |||||
break; | |||||
} | |||||
if (matrix_debouncing[col] != data) { | |||||
matrix_debouncing[col] = data; | |||||
debouncing = true; | |||||
debouncing_time = timer_read(); | |||||
} | |||||
} | |||||
if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) { | |||||
for (int row = 0; row < MATRIX_ROWS; row++) { | |||||
matrix[row] = 0; | |||||
for (int col = 0; col < MATRIX_COLS; col++) { | |||||
matrix[row] |= ((matrix_debouncing[col] & (1 << row) ? 1 : 0) << col); | |||||
} | |||||
} | |||||
debouncing = false; | |||||
} | |||||
matrix_scan_quantum(); | |||||
return 1; | |||||
} | |||||
bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & (1 << col)); } | |||||
matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; } | |||||
void matrix_print(void) { | |||||
printf("\nr/c 01234567\n"); | |||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | |||||
printf("%X0: ", row); | |||||
matrix_row_t data = matrix_get_row(row); | |||||
for (int col = 0; col < MATRIX_COLS; col++) { | |||||
if (data & (1 << col)) | |||||
printf("1"); | |||||
else | |||||
printf("0"); | |||||
} | |||||
printf("\n"); | |||||
} | |||||
} |
@ -0,0 +1,39 @@ | |||||
/* Copyright 2020 QMK Contributors | |||||
* | |||||
* 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 3 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_next "mcuconf.h" | |||||
// The SysTick timer from the normal quantum/stm32 uses TIM2 -- the WS2812 pin used | |||||
// on the Planck requires the use of TIM2 to run PWM -- rework which timers are | |||||
// allocated for PWM usage. | |||||
#undef STM32_PWM_USE_TIM2 | |||||
#define STM32_PWM_USE_TIM2 TRUE | |||||
#undef STM32_DAC_USE_DAC1_CH1 | |||||
#define STM32_DAC_USE_DAC1_CH1 TRUE | |||||
#undef STM32_DAC_USE_DAC1_CH2 | |||||
#define STM32_DAC_USE_DAC1_CH2 TRUE | |||||
#undef STM32_GPT_USE_TIM6 | |||||
#define STM32_GPT_USE_TIM6 TRUE | |||||
#undef STM32_GPT_USE_TIM7 | |||||
#define STM32_GPT_USE_TIM7 TRUE | |||||
#undef STM32_GPT_USE_TIM8 | |||||
#define STM32_GPT_USE_TIM8 TRUE | |||||
// As mentioned above, we need to reallocate the SysTick timer used from | |||||
// TIM2 to TIM3. | |||||
#undef STM32_ST_USE_TIMER | |||||
#define STM32_ST_USE_TIMER 3 |
@ -0,0 +1,61 @@ | |||||
/* Copyright 2018 Jack Humbert <jack.humb@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 "rev3_drop.h" | |||||
#ifdef RGB_MATRIX_ENABLE | |||||
led_config_t g_led_config = { { | |||||
// Key Matrix to LED Index | |||||
{ NO_LED, 6, NO_LED, NO_LED, 5, NO_LED }, | |||||
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, | |||||
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, 0 }, | |||||
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, | |||||
{ NO_LED, 4, NO_LED, NO_LED, 3, NO_LED }, | |||||
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, | |||||
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, | |||||
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, | |||||
{ NO_LED, 7, NO_LED, NO_LED, 2, NO_LED }, | |||||
{ NO_LED, 1, NO_LED, NO_LED, 8, NO_LED }, | |||||
}, { | |||||
// LED Index to Physical Position | |||||
{112, 39}, {148, 60}, {206, 53}, {206, 3}, {150, 3}, {74, 3}, {18, 3}, {18, 54}, {77, 60} | |||||
}, { | |||||
// LED Index to Flag | |||||
LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, | |||||
LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL, LED_FLAG_ALL | |||||
} }; | |||||
// LED physical location index | |||||
// 6 5 4 3 | |||||
// 0 | |||||
// 7 8 1 2 | |||||
#endif | |||||
#ifdef SWAP_HANDS_ENABLE | |||||
__attribute__ ((weak)) | |||||
const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { | |||||
{{5, 4}, {4, 4}, {3, 4}, {2, 4}, {1, 4}, {0, 4}}, | |||||
{{5, 5}, {4, 5}, {3, 5}, {2, 5}, {1, 5}, {0, 5}}, | |||||
{{5, 6}, {4, 6}, {3, 6}, {2, 6}, {1, 6}, {0, 6}}, | |||||
{{5, 7}, {4, 7}, {3, 7}, {2, 7}, {1, 7}, {0, 7}}, | |||||
{{5, 0}, {4, 0}, {3, 0}, {2, 0}, {1, 0}, {0, 0}}, | |||||
{{5, 1}, {4, 1}, {3, 1}, {2, 1}, {1, 1}, {0, 1}}, | |||||
{{5, 2}, {4, 2}, {3, 2}, {2, 2}, {1, 2}, {0, 2}}, | |||||
{{5, 3}, {4, 3}, {3, 3}, {2, 3}, {1, 3}, {0, 3}}, | |||||
{{5, 8}, {4, 8}, {3, 8}, {2, 8}, {1, 8}, {0, 8}}, | |||||
{{5, 9}, {4, 9}, {3, 9}, {2, 9}, {1, 9}, {0, 9}}, | |||||
}; | |||||
#endif |
@ -0,0 +1,115 @@ | |||||
/* Copyright 2018 Jack Humbert <jack.humb@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 "preonic.h" | |||||
// clang-format off | |||||
#define LAYOUT_preonic_1x2uC( \ | |||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ | |||||
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ | |||||
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ | |||||
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \ | |||||
k40, k41, k42, k43, k44, k45, k47, k48, k49, k4a, k4b \ | |||||
) { \ | |||||
{ k00, k01, k02, k03, k04, k05 }, \ | |||||
{ k10, k11, k12, k13, k14, k15 }, \ | |||||
{ k20, k21, k22, k23, k24, k25 }, \ | |||||
{ k30, k31, k32, k33, k34, k35 }, \ | |||||
{ k06, k07, k08, k09, k0a, k0b }, \ | |||||
{ k16, k17, k18, k19, k1a, k1b }, \ | |||||
{ k26, k27, k28, k29, k2a, k2b }, \ | |||||
{ k36, k37, k38, k39, k3a, k3b }, \ | |||||
{ k40, k41, k42, k49, k4a, k4b }, \ | |||||
{ k45, k47, k48, k43, k44, k45 } \ | |||||
} | |||||
#define LAYOUT_preonic_1x2uR( \ | |||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ | |||||
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ | |||||
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ | |||||
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \ | |||||
k40, k41, k42, k43, k44, k45, k47, k48, k49, k4a, k4b \ | |||||
) { \ | |||||
{ k00, k01, k02, k03, k04, k05 }, \ | |||||
{ k10, k11, k12, k13, k14, k15 }, \ | |||||
{ k20, k21, k22, k23, k24, k25 }, \ | |||||
{ k30, k31, k32, k33, k34, k35 }, \ | |||||
{ k06, k07, k08, k09, k0a, k0b }, \ | |||||
{ k16, k17, k18, k19, k1a, k1b }, \ | |||||
{ k26, k27, k28, k29, k2a, k2b }, \ | |||||
{ k36, k37, k38, k39, k3a, k3b }, \ | |||||
{ k40, k41, k42, k49, k4a, k4b }, \ | |||||
{ k47, k47, k48, k43, k44, k45 } \ | |||||
} | |||||
#define LAYOUT_preonic_1x2uL( \ | |||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ | |||||
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ | |||||
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ | |||||
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \ | |||||
k40, k41, k42, k43, k44, k46, k47, k48, k49, k4a, k4b \ | |||||
) { \ | |||||
{ k00, k01, k02, k03, k04, k05 }, \ | |||||
{ k10, k11, k12, k13, k14, k15 }, \ | |||||
{ k20, k21, k22, k23, k24, k25 }, \ | |||||
{ k30, k31, k32, k33, k34, k35 }, \ | |||||
{ k06, k07, k08, k09, k0a, k0b }, \ | |||||
{ k16, k17, k18, k19, k1a, k1b }, \ | |||||
{ k26, k27, k28, k29, k2a, k2b }, \ | |||||
{ k36, k37, k38, k39, k3a, k3b }, \ | |||||
{ k40, k41, k42, k49, k4a, k4b }, \ | |||||
{ k46, k47, k48, k43, k44, k44 } \ | |||||
} | |||||
#define LAYOUT_preonic_2x2u( \ | |||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ | |||||
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ | |||||
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ | |||||
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \ | |||||
k40, k41, k42, k43, k44, k46, k48, k49, k4a, k4b \ | |||||
) { \ | |||||
{ k00, k01, k02, k03, k04, k05 }, \ | |||||
{ k10, k11, k12, k13, k14, k15 }, \ | |||||
{ k20, k21, k22, k23, k24, k25 }, \ | |||||
{ k30, k31, k32, k33, k34, k35 }, \ | |||||
{ k06, k07, k08, k09, k0a, k0b }, \ | |||||
{ k16, k17, k18, k19, k1a, k1b }, \ | |||||
{ k26, k27, k28, k29, k2a, k2b }, \ | |||||
{ k36, k37, k38, k39, k3a, k3b }, \ | |||||
{ k40, k41, k42, k49, k4a, k4b }, \ | |||||
{ k46, k46, k48, k43, k44, k44 } \ | |||||
} | |||||
#define LAYOUT_ortho_5x12( \ | |||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \ | |||||
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \ | |||||
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \ | |||||
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, \ | |||||
k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b \ | |||||
) { \ | |||||
{ k00, k01, k02, k03, k04, k05 }, \ | |||||
{ k10, k11, k12, k13, k14, k15 }, \ | |||||
{ k20, k21, k22, k23, k24, k25 }, \ | |||||
{ k30, k31, k32, k33, k34, k35 }, \ | |||||
{ k06, k07, k08, k09, k0a, k0b }, \ | |||||
{ k16, k17, k18, k19, k1a, k1b }, \ | |||||
{ k26, k27, k28, k29, k2a, k2b }, \ | |||||
{ k36, k37, k38, k39, k3a, k3b }, \ | |||||
{ k40, k41, k42, k49, k4a, k4b }, \ | |||||
{ k46, k47, k48, k43, k44, k45 } \ | |||||
} |
@ -0,0 +1,33 @@ | |||||
# MCU name | |||||
MCU = STM32F303 | |||||
# Bootloader selection | |||||
BOOTLOADER = stm32-dfu | |||||
# Build Options | |||||
# change yes to no to disable | |||||
# | |||||
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite | |||||
MOUSEKEY_ENABLE = yes # Mouse keys | |||||
EXTRAKEY_ENABLE = yes # Audio control and System control | |||||
CONSOLE_ENABLE = yes # Console for debug | |||||
COMMAND_ENABLE = yes # 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 | |||||
AUDIO_ENABLE = yes # Audio output | |||||
WS2812_DRIVER = pwm | |||||
CUSTOM_MATRIX = yes | |||||
ENCODER_ENABLE = yes | |||||
DIP_SWITCH_ENABLE = yes | |||||
# Do not enable RGB_MATRIX_ENABLE together with RGBLIGHT_ENABLE | |||||
RGB_MATRIX_ENABLE = no | |||||
RGB_MATRIX_DRIVER = WS2812 | |||||
SRC += matrix.c | |||||
LAYOUTS = ortho_5x12 |