feat(alpspad): added keyboard/keymap for a handwired alps numpad

vial-develop/alpspad
steven 2021-09-02 17:19:09 -04:00
parent 59a13faad7
commit 7ac65d8579
11 changed files with 462 additions and 0 deletions

View File

@ -0,0 +1,17 @@
/* Copyright 2021 steven-y-e
*
* 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 "alpspad.h"

View File

@ -0,0 +1,36 @@
#pragma once
#include "quantum.h"
/* alps numpad wiring matrix layout
* ,-------------------.
* | 00 | 01 | 02 | 51 |
* |-------------------|
* | 10 | 11 | 12 | |
* |--------------- 52 |
* | 20 | 21 | 22 | |
* |-------------------|
* | 30 | 31 | 32 | |
* |--------------| 42 |
* | 40 | 41 | |
* `-------------------'
*/
#define XXX KC_NO
// allows blanks in the key matrix array to have the same character length
// as valid keys
#define LAYOUT( \
k00, k01, k02, k51, \
k10, k11, k12, k52, \
k20, k21, k22, \
k30, k31, k32, k42, \
k40, k41 \
) { \
{k00, k01, k02}, \
{k10, k11, k12}, \
{k20, k21, k22}, \
{k30, k31, k32}, \
{k40, k41, k42}, \
{XXX, k51, k52} \
}

View File

@ -0,0 +1,31 @@
#pragma once
#define CH_CFG_ST_FREQUENCY 1000
#define CH_CFG_ST_TIMEDELTA 0
#define CH_CFG_TIME_QUANTUM 20
#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
#define CH_CFG_FACTORY_SEMAPHORES TRUE
#define CH_CFG_FACTORY_MAILBOXES TRUE
#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
#define CH_CFG_FACTORY_PIPES TRUE
#define CH_DBG_SYSTEM_STATE_CHECK TRUE
#define CH_DBG_ENABLE_CHECKS TRUE
#define CH_DBG_ENABLE_ASSERTS TRUE
#define CH_DBG_ENABLE_STACK_CHECK TRUE
#define CH_DBG_FILL_THREADS TRUE
#include_next <chconf.h>

View File

@ -0,0 +1,159 @@
/*
Copyright 2021 steven-y-e
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
// TODO: including this causes "error: expected identifier before '(' token" errors
//#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x9021
#define DEVICE_VER 0x0420
#define MANUFACTURER steven-y-e
#define PRODUCT alpspad
/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 3
/*
* 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)
*
*/
#define MATRIX_COL_PINS { B1, B2, D5 }
#define MATRIX_ROW_PINS { D7, A2, A1, D0, B17, D6 }
#define UNUSED_PINS
/* 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 SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
#define LED_NUM_LOCK_PIN D4
//#define LED_CAPS_LOCK_PIN B1
//#define LED_SCROLL_LOCK_PIN B2
//#define LED_COMPOSE_PIN B3
//#define LED_KANA_PIN B4
//#define BACKLIGHT_PIN B7
//#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
// i2c_master defines
#define I2C1_SCL 0 // A2 on pinout = B0
#define I2C1_SDA 1 // A3 on pinout = B1
#define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2
#define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2

View File

@ -0,0 +1,3 @@
#define HAL_USE_I2C TRUE
#include_next <halconf.h>

View File

@ -0,0 +1,34 @@
{
"keyboard_name": "alpspad",
"url": "",
"maintainer": "steven-y-e",
"width": 4,
"height": 5,
"layouts": {
"LAYOUT": {
"layout": [
{"x":0, "y":0},
{"x":1, "y":0},
{"x":2, "y":0},
{"x":3, "y":0},
{"x":0, "y":1},
{"x":1, "y":1},
{"x":2, "y":1},
{"x":3, "y":1, "h":2},
{"x":0, "y":2},
{"x":1, "y":2},
{"x":2, "y":2},
{"x":0, "y":3},
{"x":1, "y":3},
{"x":2, "y":3},
{"x":3, "y":3, "h":2},
{"x":0, "y":0, "w":2},
{"x":1, "y":0}
]
}
}
}

View File

@ -0,0 +1,68 @@
/* Copyright 2021 steven-y-e
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
// Defines names for use in layer keycodes and the keymap
enum layer_names {
_BASE,
_FN,
_FN1,
_FN2
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* ,-------------------.
* | NL | / | * | - |
* |----|----|----|----|
* | 7 | 8 | 9 | |
* |----|----|----| + |
* | 4 | 5 | 6 | |
* |----|----|----|----|
* | 1 | 2 | 3 | |
* |----|----|----| En |
* | 0 | . | |
* `-------------------'
*/
[_BASE] = LAYOUT(
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
KC_P7, KC_P8, KC_P9, KC_PPLS,
KC_P4, KC_P5, KC_P6,
KC_P1, KC_P2, KC_P3, KC_PENT,
KC_P0, KC_PDOT
),
[_FN] = LAYOUT(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______, _______,
_______, _______
),
[_FN1] = LAYOUT(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______, _______,
_______, _______
),
[_FN2] = LAYOUT(
_______, _______, _______, _______,
_______, _______, _______, _______,
_______, _______, _______,
_______, _______, _______, _______,
_______, _______
)
};

View File

@ -0,0 +1 @@
# The default keymap for alpspad

View File

@ -0,0 +1,36 @@
//mcuconf.h
#ifndef _MCUCONF_H_
#define _MCUCONF_H_
#define KL2x_MCUCONF
/*
* HAL driver system settings.
*/
/* PEE mode - 48MHz system clock driven by (16 MHz) external crystal. */
#define KINETIS_MCG_MODE KINETIS_MCG_MODE_PEE
#define KINETIS_PLLCLK_FREQUENCY 96000000UL
#define KINETIS_SYSCLK_FREQUENCY 48000000UL
/*
* SERIAL driver system settings.
*/
#define KINETIS_SERIAL_USE_UART0 TRUE
/*
* USB driver settings
*/
#define KINETIS_USB_USE_USB0 TRUE
/* Need to redefine this, since the default (configured for K20x) might not apply
* 2 for Teensy LC
* 5 for Teensy 3.x */
#define KINETIS_USB_USB0_IRQ_PRIORITY 2
/*
* I2C driver settings
*/
#define KINETIS_I2C_USE_I2C0 TRUE
#define KINETIS_I2C_I2C0_PRIORITY 4
#endif /* _MCUCONF_H_ */

View File

@ -0,0 +1,54 @@
# alpspad (handwired)
*Custom handwired numpad.*
* Keyboard Maintainer: steven-y-e
* Hardware Supported: Teensy-LC
* Hardware Availability: PJRC
Make example for this keyboard (after setting up your build environment):
make alps_pad:default
Flashing example for this keyboard:
make alps_pad:default:flash
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
## Hardware
### Pins
When setting matrix pins, you need to use the MCU definitions instead of what is printed on the PCB. Sourced from <https://www.pjrc.com/teensy/schematic_lc.gif>. The following table can be used to convert between the two.
| PCB | MCU | Notes |
|------- |-----|-------|
| 0 | B16 | |
| 1 | B17 | |
| 2 | D0 | |
| 3 | A1 | |
| 4 | A2 | |
| 5 | D7 | |
| 6 | D4 | |
| 7 | D2 | |
| 8 | D3 | |
| 9 | C3 | |
| 10 | C4 | |
| 11 | C6 | |
| 12 | C7 | |
| 13/LED | C5 | |
| 14/A0 | D1 | |
| 15/A1 | C0 | |
| 16/A2 | B0 | |
| 17/A3 | B1 | |
| 18/A4 | B3 | |
| 19/A5 | B2 | |
| 20/A6 | D5 | |
| 21/A7 | D6 | |
| 22/A8 | C1 | |
| 23/A9 | C2 | |
| 24/A10 | E2 | |
| 25/A11 | E21 | *[1]* |
| 26/A12 | E30 | *[1]* |
*[1]* - Currently not configured and may require extra work to implement.

View File

@ -0,0 +1,23 @@
# MCU name
MCU = MKL26Z64
USE_CHIBIOS_CONTRIB = yes
# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = no # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no # Enable Bluetooth
AUDIO_ENABLE = no # Audio output