Merge branch 'master' into feature/combos

This commit is contained in:
Ofer Plesser 2016-12-16 21:52:51 +02:00
commit 6a462c818c
71 changed files with 8131 additions and 2038 deletions

View File

@ -0,0 +1,3 @@
ifndef MAKEFILE_INCLUDED
include ../../Makefile
endif

View File

@ -0,0 +1 @@
#include "converter.h"

View File

@ -0,0 +1 @@
#include "quantum.h"

View File

@ -0,0 +1,3 @@
ifndef MAKEFILE_INCLUDED
include ../../../Makefile
endif

View File

@ -0,0 +1,40 @@
Keyboard converter for IBM terminal keyboard
============================================
This is a port of TMK's converter/terminal_usb to QMK.
It supports PS/2 Scan Code Set 3 and runs on USB AVR chips such like PJRC Teensy.
I tested the converter on ATMega32U4 with 1392595(102keys) and 6110345(122keys).
Source code: https://github.com/tmk/tmk_keyboard
Article: http://geekhack.org/index.php?topic=27272.0
CONNECTION
----------
Keyboard ATMega32U4
----------------------
Data: PD2
Clock: PD5
And VCC and GND, of course. See RESOURCE for keyboard connector pin assign.
BUILD
-----
$ git clone https://github.com/tmk/tmk_keyboard.git
$ cd converter/terminal_usb
$ make
RESOURCE
--------
Soarer's Converter: http://geekhack.org/index.php?topic=17458.0
102keys(1392595): http://geekhack.org/index.php?topic=10737.0
122keys(1390876): http://www.seasip.info/VintagePC/ibm_1390876.html
KbdBabel: http://www.kbdbabel.org/
RJ45 Connector: http://www.kbdbabel.org/conn/kbd_connector_ibmterm.png
DIN Connector: http://www.kbdbabel.org/conn/kbd_connector_ibm3179_318x_319x.png
WinAVR: http://winavr.sourceforge.net/
EOF

View File

@ -0,0 +1,138 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2016 Priyadi Iman Nurcahyo <priyadi@priyadi.net>
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/>.
*/
#ifndef CONFIG_H
#define CONFIG_H
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6535
#define DEVICE_VER 0x0100
#define MANUFACTURER QMK
#define PRODUCT IBM Terminal Keyboard
#define DESCRIPTION USB converter for IBM Terminal Keyboard
/* matrix size */
#define MATRIX_ROWS 17 // keycode bit: 3-0
#define MATRIX_COLS 8 // keycode bit: 6-4
/* legacy keymap support */
#define USE_LEGACY_KEYMAP
/* key combination for command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT) | MOD_BIT(KC_RALT) | MOD_BIT(KC_RCTL)) \
)
/*
* PS/2 USART configuration for ATMega32U4
*/
#ifdef PS2_USE_USART
/* XCK for clock line */
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 5
/* RXD for data line */
#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 2
/* synchronous, odd parity, 1-bit stop, 8-bit data, sample at falling edge */
/* set DDR of CLOCK as input to be slave */
#define PS2_USART_INIT() do { \
PS2_CLOCK_DDR &= ~(1<<PS2_CLOCK_BIT); \
PS2_DATA_DDR &= ~(1<<PS2_DATA_BIT); \
UCSR1C = ((1 << UMSEL10) | \
(3 << UPM10) | \
(0 << USBS1) | \
(3 << UCSZ10) | \
(0 << UCPOL1)); \
UCSR1A = 0; \
UBRR1H = 0; \
UBRR1L = 0; \
} while (0)
#define PS2_USART_RX_INT_ON() do { \
UCSR1B = ((1 << RXCIE1) | \
(1 << RXEN1)); \
} while (0)
#define PS2_USART_RX_POLL_ON() do { \
UCSR1B = (1 << RXEN1); \
} while (0)
#define PS2_USART_OFF() do { \
UCSR1C = 0; \
UCSR1B &= ~((1 << RXEN1) | \
(1 << TXEN1)); \
} while (0)
#define PS2_USART_RX_READY (UCSR1A & (1<<RXC1))
#define PS2_USART_RX_DATA UDR1
#define PS2_USART_ERROR (UCSR1A & ((1<<FE1) | (1<<DOR1) | (1<<UPE1)))
#define PS2_USART_RX_VECT USART1_RX_vect
#endif
/*
* PS/2 Interrupt configuration
*/
#ifdef PS2_USE_INT
/* uses INT1 for clock line(ATMega32U4) */
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 1
#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 0
#define PS2_INT_INIT() do { \
EICRA |= ((1<<ISC11) | \
(0<<ISC10)); \
} while (0)
#define PS2_INT_ON() do { \
EIMSK |= (1<<INT1); \
} while (0)
#define PS2_INT_OFF() do { \
EIMSK &= ~(1<<INT1); \
} while (0)
#define PS2_INT_VECT INT1_vect
#endif
/*
* PS/2 Busywait configuration
*/
#ifdef PS2_USE_BUSYWAIT
#define PS2_CLOCK_PORT PORTD
#define PS2_CLOCK_PIN PIND
#define PS2_CLOCK_DDR DDRD
#define PS2_CLOCK_BIT 1
#define PS2_DATA_PORT PORTD
#define PS2_DATA_PIN PIND
#define PS2_DATA_DDR DDRD
#define PS2_DATA_BIT 0
#endif
#endif

View File

@ -0,0 +1,6 @@
#include "ibm_terminal.h"
// void matrix_init_kb(void) {
// matrix_init_user();
// }

View File

@ -0,0 +1,82 @@
#ifndef IBM_TERMINAL_H
#define IBM_TERMINAL_H
#include "quantum.h"
void matrix_init_user(void);
/*
* IBM Terminal keyboard 6110345(122keys)/1392595(102keys)
* http://geekhack.org/showthread.php?10737-What-Can-I-Do-With-a-Terminal-Model-M
* http://www.seasip.info/VintagePC/ibm_1391406.html
*
* Keymap array:
* 8 bytes
* +---------+
* 0| |
* :| | 0x00-0x87
* ;| |
* 17| |
* +---------+
*/
#define KEYMAP( \
K08,K10,K18,K20,K28,K30,K38,K40,K48,K50,K57,K5F, \
K07,K0F,K17,K1F,K27,K2F,K37,K3F,K47,K4F,K56,K5E, \
\
K05,K06, K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K5D,K66, K67,K6E,K6F, K76,K77,K7E,K84, \
K04,K0C, K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B, K5C, K64,K65,K6D, K6C,K75,K7D,K7C, \
K03,K0B, K14,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K53,K5A, K63, K6B,K73,K74,K7B, \
K83,K0A, K12,K13,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K51,K59, K61,K62,K6A, K69,K72,K7A,K79, \
K01,K09, K11, K19, K29, K39, K58, K60, K68,K70,K71,K78 \
) { \
{ KC_NO, K01, KC_NO, K03, K04, K05, K06, K07 }, \
{ K08, K09, K0A, K0B, K0C, K0D, K0E, K0F }, \
{ K10, K11, K12, K13, K14, K15, K16, K17 }, \
{ K18, K19, K1A, K1B, K1C, K1D, K1E, K1F }, \
{ K20, K21, K22, K23, K24, K25, K26, K27 }, \
{ K28, K29, K2A, K2B, K2C, K2D, K2E, K2F }, \
{ K30, K31, K32, K33, K34, K35, K36, K37 }, \
{ K38, K39, K3A, K3B, K3C, K3D, K3E, K3F }, \
{ K40, K41, K42, K43, K44, K45, K46, K47 }, \
{ K48, K49, K4A, K4B, K4C, K4D, K4E, K4F }, \
{ K50, K51, K52, K53, K54, K55, K56, K57 }, \
{ K58, K59, K5A, K5B, K5C, K5D, K5E, K5F }, \
{ K60, K61, K62, K63, K64, K65, K66, K67 }, \
{ K68, K69, K6A, K6B, K6C, K6D, K6E, K6F }, \
{ K70, K71, K72, K73, K74, K75, K76, K77 }, \
{ K78, K79, K7A, K7B, K7C, K7D, K7E, KC_NO }, \
{ KC_NO, KC_NO, KC_NO, K83, K84, KC_NO, KC_NO, KC_NO,}, \
}
/*
* IBM Terminal keyboard 1399625, 101-key
*/
#define KEYMAP_101( \
K08, K07,K0F,K17,K1F,K27,K2F,K37,K3F,K47,K4F,K56,K5E, K57,K5F,K62, \
\
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, K67,K6E,K6F, K76,K77,K7E,K84, \
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5C, K64,K65,K6D, K6C,K75,K7D, \
K14,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K7C, \
K12, K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, K63, K69,K72,K7A, \
K11, K19, K29, K39, K58, K61,K60,K6A, K70, K71,K79 \
) { \
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, K07 }, \
{ K08, KC_NO, KC_NO, KC_NO, KC_NO, K0D, K0E, K0F }, \
{ KC_NO, K11, K12, KC_NO, K14, K15, K16, K17 }, \
{ KC_NO, K19, K1A, K1B, K1C, K1D, K1E, K1F }, \
{ KC_NO, K21, K22, K23, K24, K25, K26, K27 }, \
{ KC_NO, K29, K2A, K2B, K2C, K2D, K2E, K2F }, \
{ KC_NO, K31, K32, K33, K34, K35, K36, K37 }, \
{ KC_NO, K39, K3A, K3B, K3C, K3D, K3E, K3F }, \
{ KC_NO, K41, K42, K43, K44, K45, K46, K47 }, \
{ KC_NO, K49, K4A, K4B, K4C, K4D, K4E, K4F }, \
{ KC_NO, KC_NO, K52, KC_NO, K54, K55, K56, K57 }, \
{ K58, K59, K5A, K5B, K5C, KC_NO, K5E, K5F }, \
{ K60, K61, K62, K63, K64, K65, K66, K67 }, \
{ KC_NO, K69, K6A, K6B, K6C, K6D, K6E, K6F }, \
{ K70, K71, K72, K73, K74, K75, K76, K77 }, \
{ KC_NO, K79, K7A, KC_NO, K7C, K7D, K7E, KC_NO }, \
{ KC_NO, KC_NO, KC_NO, KC_NO, K84, KC_NO, KC_NO, KC_NO,}, \
}
#endif

View File

@ -0,0 +1,27 @@
# 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
#
BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
CONSOLE_ENABLE ?= no # Console for debug(+400)
COMMAND_ENABLE ?= no # Commands for debug and configuration
NKRO_ENABLE ?= yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality
MIDI_ENABLE ?= no # MIDI controls
AUDIO_ENABLE ?= no # Audio output on port C6
UNICODE_ENABLE ?= no # Unicode
UNICODEMAP_ENABLE ?= yes
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
PS2_USE_USART ?= yes
API_SYSEX_ENABLE ?= no
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
ifndef QUANTUM_DIR
include ../../../../../Makefile
endif

View File

@ -0,0 +1,6 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
#endif

View File

@ -0,0 +1,69 @@
/*
Copyright 2012 Jun Wako <wakojun@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 "keycode.h"
#include "print.h"
#include "debug.h"
#include "util.h"
#include "ibm_terminal.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// Layer 0
KEYMAP(
KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24,
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
KC_PSCR,KC_ESC, KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_NO, KC_BSPC, KC_INS, KC_HOME,KC_PGUP, KC_NLCK,KC_PSLS,KC_PAST,KC_PMNS,
KC_SLCK,KC_INT4, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC, KC_NO, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS,
KC_PAUS,KC_INT5, KC_LCTL,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_BSLS,KC_ENT, KC_UP, KC_P4, KC_P5, KC_P6, KC_PCMM,
KC_APP, KC_INT6, KC_LSFT,KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_NO, KC_RSFT, KC_LEFT,KC_INT2,KC_RGHT, KC_P1, KC_P2, KC_P3, KC_PENT,
KC_RGUI,KC_LGUI, KC_LCTL, KC_LALT, KC_SPC, KC_LGUI, KC_GRV, KC_DOWN, KC_NO, KC_P0, KC_PDOT,KC_NO
),
/* 101-key keymaps
*/
/* 0: default
* ,---. ,---------------. ,---------------. ,---------------. ,-----------.
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|
* `---' `---------------' `---------------' `---------------' `-----------'
* ,-----------------------------------------------------------. ,-----------. ,---------------.
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| /| *| -|
* |-----------------------------------------------------------| |-----------| |---------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| |
* |-----------------------------------------------------------| `-----------' |-----------| +|
* |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| |
* |-----------------------------------------------------------| ,---. |---------------|
* |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| |
* |-----------------------------------------------------------| ,-----------. |-----------|Ent|
* |Ctrl| |Alt | Space |Alt | |Ctrl| |Lef|Dow|Rig| | 0| .| |
* `----' `---------------------------------------' `----' `-----------' `---------------'
*/
/*
KEYMAP_101(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_SLCK, KC_BRK,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,KC_MINS, KC_EQL,KC_BSPC, KC_INS,KC_HOME,KC_PGUP, KC_NLCK,KC_PSLS,KC_PAST,KC_PMNS,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,KC_LBRC,KC_RBRC,KC_BSLS, KC_DEL, KC_END,KC_PGDN, KC_P7, KC_P8, KC_P9,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L,KC_SCLN,KC_QUOT, KC_ENT, KC_P4, KC_P5, KC_P6,KC_PPLS,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT,KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3,
KC_LCTL, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_LEFT,KC_DOWN,KC_RGHT, KC_P0, KC_PDOT,KC_PENT
),
*/
};

View File

@ -0,0 +1,27 @@
# 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
#
BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
CONSOLE_ENABLE ?= no # Console for debug(+400)
COMMAND_ENABLE ?= no # Commands for debug and configuration
NKRO_ENABLE ?= yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality
MIDI_ENABLE ?= no # MIDI controls
AUDIO_ENABLE ?= no # Audio output on port C6
UNICODE_ENABLE ?= no # Unicode
UNICODEMAP_ENABLE ?= yes
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
PS2_USE_USART ?= yes
API_SYSEX_ENABLE ?= no
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
ifndef QUANTUM_DIR
include ../../../../../Makefile
endif

View File

@ -0,0 +1,6 @@
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
#endif

View File

@ -0,0 +1,312 @@
/*
Copyright 2016 Priyadi Iman Nurcahyo <priyadi@priyadi.net>
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 "keycode.h"
#include "print.h"
#include "debug.h"
#include "util.h"
#include "ibm_terminal.h"
#include "action_layer.h"
// Fillers to make layering clearer
#define _______ KC_TRNS
#define XXXXXXX KC_NO
enum layers {
QWE, // qwerty
COL, // colemak
WOR, // workman
DVO, // dvorak
MOU, // mouse keys
EMO, // emoji
SYS, // system
};
enum keycodes {
// default layout switcher
LAY_QWE = SAFE_RANGE,
LAY_COL,
LAY_WOR,
LAY_DVO,
// layer switchers
LYR_SYS,
LYR_EMO,
// os switchers
OS_LIN,
OS_WIN,
OS_MAC,
};
// unicode map
enum unicode_name {
GRIN, // grinning face 😊
TJOY, // tears of joy 😂
SMILE, // grining face with smiling eyes 😁
HEART, // heart ❤
EYERT, // smiling face with heart shaped eyes 😍
CRY, // crying face 😭
SMEYE, // smiling face with smiling eyes 😊
UNAMU, // unamused 😒
KISS, // kiss 😘
HART2, // two hearts 💕
WEARY, // weary 😩
OKHND, // ok hand sign 👌
PENSV, // pensive 😔
SMIRK, // smirk 😏
RECYC, // recycle ♻
WINK, // wink 😉
THMUP, // thumb up 👍
THMDN, // thumb down 👎
PRAY, // pray 🙏
PHEW, // relieved 😌
MUSIC, // musical notes
FLUSH, // flushed 😳
CELEB, // celebration 🙌
CRY2, // crying face 😢
COOL, // smile with sunglasses 😎
NOEVS, // see no evil
NOEVH, // hear no evil
NOEVK, // speak no evil
POO, // pile of poo
EYES, // eyes
VIC, // victory hand
BHART, // broken heart
SLEEP, // sleeping face
SMIL2, // smiling face with open mouth & sweat
HUNRD, // 100
CONFU, // confused
TONGU, // face with tongue & winking eye
DISAP, // disappointed
YUMMY, // face savoring delicious food
CLAP, // hand clapping
FEAR, // face screaming in fear
HORNS, // smiling face with horns
HALO, // smiling face with halo
BYE, // waving hand
SUN, // sun
MOON, // moon
SKULL, // skull
};
const uint32_t PROGMEM unicode_map[] = {
[GRIN] = 0x1F600,
[TJOY] = 0x1F602,
[SMILE] = 0x1F601,
[HEART] = 0x2764,
[EYERT] = 0x1f60d,
[CRY] = 0x1f62d,
[SMEYE] = 0x1F60A,
[UNAMU] = 0x1F612,
[KISS] = 0x1F618,
[HART2] = 0x1F495,
[WEARY] = 0x1F629,
[OKHND] = 0x1F44C,
[PENSV] = 0x1F614,
[SMIRK] = 0x1F60F,
[RECYC] = 0x267B,
[WINK] = 0x1F609,
[THMUP] = 0x1F44D,
[THMDN] = 0x1F44E,
[PRAY] = 0x1F64F,
[PHEW] = 0x1F60C,
[MUSIC] = 0x1F3B6,
[FLUSH] = 0x1F633,
[CELEB] = 0x1F64C,
[CRY2] = 0x1F622,
[COOL] = 0x1F60E,
[NOEVS] = 0x1F648,
[NOEVH] = 0x1F649,
[NOEVK] = 0x1F64A,
[POO] = 0x1F4A9,
[EYES] = 0x1F440,
[VIC] = 0x270C,
[BHART] = 0x1F494,
[SLEEP] = 0x1F634,
[SMIL2] = 0x1F605,
[HUNRD] = 0x1F4AF,
[CONFU] = 0x1F615,
[TONGU] = 0x1F61C,
[DISAP] = 0x1F61E,
[YUMMY] = 0x1F60B,
[CLAP] = 0x1F44F,
[FEAR] = 0x1F631,
[HORNS] = 0x1F608,
[HALO] = 0x1F607,
[BYE] = 0x1F44B,
[SUN] = 0x2600,
[MOON] = 0x1F314,
[SKULL] = 0x1F480,
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* qwerty */
[QWE] = KEYMAP(
KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_PSCR, KC_SLCK, KC_PAUS,
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
MO(EMO), MO(SYS), KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, XXXXXXX, KC_BSPC, KC_INS, KC_HOME, KC_PGUP, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
KC_MNXT, KC_VOLU, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, XXXXXXX, KC_DEL, KC_END, KC_PGDN, KC_P7, KC_P8, KC_P9, KC_PPLS,
KC_MPLY, KC_MUTE, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS, KC_ENT, KC_UP, KC_P4, KC_P5, KC_P6, KC_PCMM,
KC_MPRV, KC_VOLD, KC_LSFT, KC_GRV, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, XXXXXXX, KC_RSFT, KC_LEFT, TG(MOU), KC_RGHT, KC_P1, KC_P2, KC_P3, KC_PENT,
KC_LGUI, KC_APP, KC_LCTL, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, KC_DOWN, XXXXXXX, KC_P0, KC_PDOT, XXXXXXX
),
/* colemak */
[COL] = KEYMAP(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, KC_RBRC, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/* workman */
[WOR] = KEYMAP(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_LBRC, KC_RBRC, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, KC_QUOT, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/* dvorak */
[DVO] = KEYMAP(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LBRC, KC_RBRC, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/* system */
[SYS] = KEYMAP(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, LAY_QWE, OS_WIN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, LAY_DVO, _______, _______, _______, _______, LAY_WOR, OS_LIN, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, LAY_COL, _______, _______, _______, OS_MAC, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/* mouse keys */
[MOU] = KEYMAP(
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, KC_BTN4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MS_U, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, KC_BTN5, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MS_L, _______, KC_MS_R, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_BTN1, KC_BTN3, KC_BTN2, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MS_D, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
),
/* emoji */
[EMO] = KEYMAP(
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, X(CRY2),X(WEARY),X(EYERT),X(SMIRK), X(TJOY), X(RECYC),X(UNAMU),X(MUSIC),X(OKHND),X(PENSV),XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, X(PRAY),X(SMILE),X(SMIL2),X(FLUSH), X(GRIN), X(HEART),X(BYE), X(KISS), X(CELEB),X(COOL), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,X(SLEEP),X(CLAP), X(CRY), X(VIC), X(BHART),X(SUN), X(SMEYE),X(WINK), X(MOON), X(CONFU), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
),
/*
[XXX] = KEYMAP(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
*/
};
void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
/* layout switcher */
case LAY_QWE:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<QWE);
}
return false;
break;
case LAY_COL:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<COL);
}
return false;
break;
case LAY_WOR:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<WOR);
}
return false;
break;
case LAY_DVO:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<DVO);
}
return false;
break;
/* os switcher */
case OS_LIN:
set_unicode_input_mode(UC_LNX);
return false;
break;
case OS_WIN:
set_unicode_input_mode(UC_WINC);
return false;
break;
case OS_MAC:
set_unicode_input_mode(UC_OSX);
return false;
break;
}
return true;
}
void matrix_init_user() {
set_unicode_input_mode(UC_LNX);
}

View File

@ -0,0 +1,33 @@
/*
Copyright 2011 Jun Wako <wakojun@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 "ps2.h"
#include "led.h"
void led_set(uint8_t usb_led)
{
uint8_t ps2_led = 0;
if (usb_led & (1<<USB_LED_SCROLL_LOCK))
ps2_led |= (1<<PS2_LED_SCROLL_LOCK);
if (usb_led & (1<<USB_LED_NUM_LOCK))
ps2_led |= (1<<PS2_LED_NUM_LOCK);
if (usb_led & (1<<USB_LED_CAPS_LOCK))
ps2_led |= (1<<PS2_LED_CAPS_LOCK);
ps2_host_set_led(ps2_led);
}

View File

@ -0,0 +1,237 @@
/*
Copyright 2011 Jun Wako <wakojun@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 <avr/io.h>
#include <util/delay.h>
#include "print.h"
#include "util.h"
#include "debug.h"
#include "ps2.h"
#include "matrix.h"
#define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
#define print_matrix_header() print("\nr/c 01234567\n")
#define matrix_bitpop(i) bitpop(matrix[i])
#define ROW_SHIFTER ((uint8_t)1)
static void matrix_make(uint8_t code);
static void matrix_break(uint8_t code);
/*
* Matrix Array usage:
* 'Scan Code Set 3' is assigned into 17x8 cell matrix.
*
* 8bit wide
* +---------+
* 0| |
* :| | 0x00-0x87
* ;| |
* 17| |
* +---------+
*/
static uint8_t matrix[MATRIX_ROWS];
#define ROW(code) (code>>3)
#define COL(code) (code&0x07)
__attribute__ ((weak))
void matrix_init_user(void) {
}
void matrix_init(void)
{
debug_enable = true;
//debug_matrix = true;
//debug_keyboard = true;
//debug_mouse = false;
ps2_host_init();
// initialize matrix state: all keys off
for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
matrix_init_user();
return;
}
uint8_t matrix_scan(void)
{
// scan code reading states
static enum {
RESET,
RESET_RESPONSE,
KBD_ID0,
KBD_ID1,
CONFIG,
READY,
F0,
} state = RESET;
uint8_t code;
if ((code = ps2_host_recv())) {
debug("r"); debug_hex(code); debug(" ");
}
switch (state) {
case RESET:
debug("wFF ");
if (ps2_host_send(0xFF) == 0xFA) {
debug("[ack]\nRESET_RESPONSE: ");
state = RESET_RESPONSE;
}
break;
case RESET_RESPONSE:
if (code == 0xAA) {
debug("[ok]\nKBD_ID: ");
state = KBD_ID0;
} else if (code) {
debug("err\nRESET: ");
state = RESET;
}
break;
// after reset receive keyboad ID(2 bytes)
case KBD_ID0:
if (code) {
state = KBD_ID1;
}
break;
case KBD_ID1:
if (code) {
debug("\nCONFIG: ");
state = CONFIG;
}
break;
case CONFIG:
debug("wF8 ");
if (ps2_host_send(0xF8) == 0xFA) {
debug("[ack]\nREADY\n");
state = READY;
}
break;
case READY:
switch (code) {
case 0x00:
break;
case 0xF0:
state = F0;
debug(" ");
break;
default: // normal key make
if (code < 0x88) {
matrix_make(code);
} else {
debug("unexpected scan code at READY: "); debug_hex(code); debug("\n");
}
state = READY;
debug("\n");
}
break;
case F0: // Break code
switch (code) {
case 0x00:
break;
default:
if (code < 0x88) {
matrix_break(code);
} else {
debug("unexpected scan code at F0: "); debug_hex(code); debug("\n");
}
state = READY;
debug("\n");
}
break;
}
return 1;
}
inline
uint8_t matrix_get_row(uint8_t row)
{
return matrix[row];
}
inline
static void matrix_make(uint8_t code)
{
if (!matrix_is_on(ROW(code), COL(code))) {
matrix[ROW(code)] |= 1<<COL(code);
}
}
inline
static void matrix_break(uint8_t code)
{
if (matrix_is_on(ROW(code), COL(code))) {
matrix[ROW(code)] &= ~(1<<COL(code));
}
}
bool matrix_is_on(uint8_t row, uint8_t col)
{
return (matrix_get_row(row) & (1<<col));
}
void matrix_print(void)
{
#if (MATRIX_COLS <= 8)
print("r/c 01234567\n");
#elif (MATRIX_COLS <= 16)
print("r/c 0123456789ABCDEF\n");
#elif (MATRIX_COLS <= 32)
print("r/c 0123456789ABCDEF0123456789ABCDEF\n");
#endif
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
#if (MATRIX_COLS <= 8)
xprintf("%02X: %08b%s\n", row, bitrev(matrix_get_row(row)),
#elif (MATRIX_COLS <= 16)
xprintf("%02X: %016b%s\n", row, bitrev16(matrix_get_row(row)),
#elif (MATRIX_COLS <= 32)
xprintf("%02X: %032b%s\n", row, bitrev32(matrix_get_row(row)),
#endif
#ifdef MATRIX_HAS_GHOST
matrix_has_ghost_in_row(row) ? " <ghost" : ""
#else
""
#endif
);
}
}
#ifdef MATRIX_HAS_GHOST
__attribute__ ((weak))
bool matrix_has_ghost_in_row(uint8_t row)
{
matrix_row_t matrix_row = matrix_get_row(row);
// No ghost exists when less than 2 keys are down on the row
if (((matrix_row - 1) & matrix_row) == 0)
return false;
// Ghost occurs when the row shares column line with other row
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
if (i != row && (matrix_get_row(i) & matrix_row))
return true;
}
return false;
}
#endif

View File

@ -0,0 +1,72 @@
# MCU name
MCU = atmega32u4
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
# This will be an integer division of F_USB below, as it is sourced by
# F_USB after it has run through any CPU prescalers. Note that this value
# does not *change* the processor frequency - it should merely be updated to
# reflect the processor speed set externally so that the code can use accurate
# software delays.
F_CPU = 16000000
#
# LUFA specific
#
# Target architecture (see library "Board Types" documentation).
ARCH = AVR8
# Input clock frequency.
# This will define a symbol, F_USB, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
# at the end, this will be done automatically to create a 32-bit value in your
# source code.
#
# If no clock division is performed on the input clock inside the AVR (via the
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
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
#
BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
CONSOLE_ENABLE ?= no # Console for debug(+400)
COMMAND_ENABLE ?= no # Commands for debug and configuration
NKRO_ENABLE ?= yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality
MIDI_ENABLE ?= no # MIDI controls
AUDIO_ENABLE ?= no # Audio output on port C6
UNICODE_ENABLE ?= no # Unicode
UNICODEMAP_ENABLE ?= yes
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
PS2_USE_USART ?= yes
API_SYSEX_ENABLE ?= n
CUSTOM_MATRIX = yes
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
SRC = matrix.c led.c

View File

View File

@ -1,10 +1,11 @@
#ifndef KEYBOARDS_ERGODOX_CONFIG_H_
#define KEYBOARDS_ERGODOX_CONFIG_H_
#define MOUSEKEY_DELAY 100
#define MOUSEKEY_INTERVAL 20
#define MOUSEKEY_MAX_SPEED 3
#define MOUSEKEY_TIME_TO_MAX 10
#define MOUSEKEY_DELAY 0
#define MOUSEKEY_TIME_TO_MAX 5
#define MOUSEKEY_MAX_SPEED 2
#define MOUSEKEY_WHEEL_DELAY 0
#define TAPPING_TOGGLE 1

View File

@ -56,6 +56,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
#define USB_MAX_POWER_CONSUMPTION 50
/*
* Feature disable options
* These options are also useful to firmware size reduction.

View File

@ -7,7 +7,12 @@
#define SYMB 1 // symbols
#define MDIA 2 // media keys
#define EPRM M(1) // Macro 1: Reset EEPROM
enum custom_keycodes {
PLACEHOLDER = SAFE_RANGE, // can always be here
EPRM,
VRSN,
RGB_SLD
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
@ -17,7 +22,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | Del | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2|' / Cmd |
* | BkSp | A | S | D | F | G |------| |------| H |J/Alt | K | L |; / L2|' / Cmd |
* |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
* | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
@ -44,56 +49,56 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_HOME,
KC_SPC,KC_BSPC,KC_END,
// right hand
KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT),
MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1,
KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_H, ALT_T(KC_J), KC_K, KC_L, LT(MDIA, KC_SCLN),GUI_T(KC_QUOT),
MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1,
KC_LALT, CTL_T(KC_ESC),
KC_PGUP,
KC_PGDN,KC_TAB, KC_ENT
),
/* Keymap 1: Symbol Layer
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | EPRM | | | | | | | . | 0 | = | |
* `----------------------------------' `----------------------------------'
* ,---------------------------------------------------. ,--------------------------------------------------.
* |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
* |---------+------+------+------+------+------+------| |------+------+------+------+------+------+--------|
* | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 |
* |---------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | |
* |---------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
* `---------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | EPRM | | | | | | | . | 0 | = | |
* `-----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* |Animat| | |Toggle|Solid |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* |Bright|Bright| | | |Hue- |Hue+ |
* |ness- |ness+ |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
// SYMBOLS
[SYMB] = KEYMAP(
// left hand
M(0), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS,
KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV,
KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS,
EPRM,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,
RGB_MOD,KC_TRNS,
KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,
RGB_VAD,RGB_VAI,KC_TRNS,
// right hand
KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS,
KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS,
KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS,
KC_TRNS, KC_TRNS,
RGB_TOG, RGB_SLD,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
KC_TRNS, RGB_HUD, RGB_HUI
),
/* Keymap 2: Media and mouse keys
*
@ -160,6 +165,33 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
return MACRO_NONE;
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
// dynamically generate these.
case EPRM:
if (record->event.pressed) {
eeconfig_init();
}
return false;
break;
case VRSN:
if (record->event.pressed) {
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
}
return false;
break;
case RGB_SLD:
if (record->event.pressed) {
#ifdef RGBLIGHT_ENABLE
rgblight_mode(1);
#endif
}
return false;
break;
}
return true;
}
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {

View File

@ -5,4 +5,4 @@ FORCE_NKRO ?= yes
DEBUG_ENABLE = no
CONSOLE_ENABLE = no
TAP_DANCE_ENABLE = yes
MOUSEKEY_ENABLE = no
MOUSEKEY_ENABLE = yes

View File

@ -11,5 +11,19 @@ Layers
* KEY_NAV: arrow key movement with backward/forward word support, and copy/paste.
* KEY_SEL: same as above, but every movement shift-selects.
* NUMBER: keypad layer.
* SYMBOL: all the symbols as well as brackets at the bottom.
* SYMBOL: all the symbols.
* BRACKET: special brackets-only layer for programming
* SHORTCUTS: sends Hyper keys for Autohotkey to interpret. I use this to switch between specific apps.
* MOUSE: use mouse keys
Updates
-------
2016/12/10:
* toggle for brackets layer is now on left thumb cluster.
2016/11/05:
* removed brackets anywhere but in brackets layer
* added mouse layer back in
* put semicolon-newline and end-newline on symbol layer
* replaced all HYPR with MEH, added more shortcut keys

View File

@ -13,6 +13,7 @@
#define SYMBOL 6
#define BRACKETS 7
#define SHORTCUTS 8
#define MOUSE 9
// macros
#define MC_COPY_LINE 0
@ -57,13 +58,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = KEYMAP( // layer 0 : default
// left hand
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6,
LT(BRACKETS,KC_TAB), KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, MO(KEY_SEL),
LT(MOUSE,KC_TAB), KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, MO(KEY_SEL),
MO(SHELL_NAV), KC_A, KC_O, KC_E, KC_U, KC_I,
KC_FN3, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, MO(KEY_NAV),
OSL(SHORTCUTS),KC_FN4, KC_FN5,OSL(SYMBOL),MO(NUMBER),
// thumb cluster
RCTL(KC_F), RCTL(KC_S),
RCTL(KC_DEL),
MO(BRACKETS), RCTL(KC_S),
RCTL(KC_DEL),
KC_BSPC,RCTL(KC_BSPC),KC_DEL,
// right hand
KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_BSLS,
@ -71,9 +72,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS,
KC_PGDN, KC_B, KC_M, KC_W, KC_V, KC_Z, TD(TD_SHIFT_CAPSLOCK),
// lower keys - browser tab control
RSFT(RCTL(KC_TAB)), RCTL(KC_TAB), RCTL(KC_T), RCTL(KC_K), RCTL(KC_W),
RSFT(RCTL(KC_TAB)), RCTL(KC_TAB), RCTL(KC_T), LALT(KC_LEFT), RCTL(KC_W),
// thumb cluster
M(SEMICOLON_NEWLINE), M(END_NEWLINE),
KC_HOME,KC_END,
KC_UP,
KC_DOWN,KC_ENT, KC_SPC
),
@ -96,7 +97,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
RCTL(KC_L), RCTL(KC_W), KC_HOME, KC_UP, KC_END, LALT(KC_D), RCTL(KC_R),
LALT(KC_B), KC_LEFT, KC_DOWN, KC_RIGHT, LALT(KC_F), LALT(KC_DOT),
RCTL(KC_C), RCTL(KC_U), M(SCREEN_COPY_MODE), M(SCREEN_PASTE), HYPR(KC_V), RCTL(KC_K), M(SHELL_RECALL_LAST_ARG_REMOVE_FIRST_COMMAND),
RCTL(KC_C), RCTL(KC_U), M(SCREEN_COPY_MODE), M(SCREEN_PASTE), MEH(KC_V), RCTL(KC_K), M(SHELL_RECALL_LAST_ARG_REMOVE_FIRST_COMMAND),
// bottom row
M(SCREEN_TAB_LEFT), M(SCREEN_TAB_RIGHT), M(SCREEN_NEW_TAB), KC_TRNS, KC_TRNS,
// thumb cluster
@ -187,21 +188,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[SYMBOL] = KEYMAP(
// left hand
KC_NO,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6,
KC_TRNS,KC_TRNS, M(OPEN_CLOSE_PAREN), KC_LPRN, KC_RPRN, KC_TRNS, KC_TRNS,
KC_TRNS,KC_TRNS, M(OPEN_CLOSE_BRACKET), KC_LBRC, KC_RBRC, M(OPEN_CLOSE_DOUBLE_QUOTE),
KC_TRNS,M(SEMICOLON_NEWLINE),M(OPEN_CLOSE_CURLY), KC_LCBR, KC_RCBR, M(OPEN_CLOSE_SINGLE_QUOTE),KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,
KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,
// right hand
KC_LPRN, KC_RPRN, KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_PLUS, KC_AMPR, KC_ASTR, KC_GRAVE,KC_TILD, KC_TRNS,
KC_MINS, KC_DLR, KC_PERC, KC_CIRC, KC_PIPE, KC_TRNS,
KC_TRNS, KC_EQUAL,KC_EXLM, KC_AT, KC_HASH, KC_TRNS, KC_TRNS,
KC_LBRC, KC_RBRC, TD(TD_BRK_LEFT), TD(TD_BRK_RIGHT), KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
M(SEMICOLON_NEWLINE), M(END_NEWLINE),
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
),
@ -229,26 +230,46 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[SHORTCUTS] = KEYMAP(
// left hand
KC_NO, HYPR(KC_F1), HYPR(KC_F2), HYPR(KC_F3), HYPR(KC_F4), HYPR(KC_F5), HYPR(KC_F6),
KC_NO, MEH(KC_F1), MEH(KC_F2), MEH(KC_F3), MEH(KC_F4), MEH(KC_F5), MEH(KC_F6),
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,
KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,
MEH(KC_0),MEH(KC_1),
MEH(KC_2),
MEH(KC_3),MEH(KC_4),MEH(KC_5),
// right hand
HYPR(KC_F7), HYPR(KC_F8), HYPR(KC_F9), HYPR(KC_F10), HYPR(KC_F11), HYPR(KC_F12), M(SWITCH_NDS),
KC_TRNS, HYPR(KC_A), HYPR(KC_B), HYPR(KC_C), HYPR(KC_D), HYPR(KC_E), HYPR(KC_F),
HYPR(KC_G), HYPR(KC_H), HYPR(KC_I), HYPR(KC_J), HYPR(KC_K), HYPR(KC_L),
KC_TRNS, HYPR(KC_M), HYPR(KC_N), HYPR(KC_O), HYPR(KC_P), HYPR(KC_Q), HYPR(KC_R),
LALT(KC_LEFT),LALT(KC_RIGHT),KC_F5, LCTL(LGUI(KC_LEFT)), LCTL(LGUI(KC_RIGHT)),
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
MEH(KC_F7), MEH(KC_F8), MEH(KC_F9), MEH(KC_F10), MEH(KC_F11), MEH(KC_F12), M(SWITCH_NDS),
KC_TRNS, MEH(KC_A), MEH(KC_B), MEH(KC_C), MEH(KC_D), MEH(KC_E), MEH(KC_F),
MEH(KC_G), MEH(KC_H), MEH(KC_I), MEH(KC_J), MEH(KC_K), MEH(KC_L),
KC_TRNS, MEH(KC_M), MEH(KC_N), MEH(KC_O), MEH(KC_P), MEH(KC_Q), MEH(KC_R),
MEH(KC_S), MEH(KC_T), MEH(KC_U), MEH(KC_V), MEH(KC_X),
MEH(KC_6), MEH(KC_7),
MEH(KC_8),
MEH(KC_9), MEH(KC_Y), MEH(KC_Z)
),
[MOUSE] = KEYMAP(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS,
// right hand
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_BTN1, KC_BTN2
),
};

View File

@ -73,7 +73,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* ,-------------. ,-------------.
* | | | |TOG |
* ,------|------|------| |------+------+------.
* |VAI |VAD |HUI | |SAI |TOG |MOD |
* |VAI |VAD |HUI | |SAI | |MOD |
* | | |------| |------| | |
* | | |HUD | |SAD | | |
* `--------------------' `--------------------'

View File

@ -13,20 +13,16 @@ enum {
QWERTY,
CARPALX,
SYSCTL,
MOUSE,
};
// extra keys
enum {
NONE = 0,
// mouse
MS_UL, // up left
MS_UR, // up right
MS_DL, // down left
MS_DR, // down right
// tap dance
TD_FLSH, // flash keyboard
TD_LAYR, // SYSCTL and MOUSE layer switch
};
// application selection
@ -52,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | | | | | | | | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* |BEGIN |QWERTY| |SYSCTL| |
* |BEGIN |QWERTY| | | |
* ,------|------|------| |------+--------+------.
* | | |CARPAL| |Slack | | |
* |Backsp|LShift|------| |------| Enter |Space |
@ -66,9 +62,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,TG(BEGIN) ,TG(QWERTY)
,TG(CARPALX)
,KC_BSPC ,KC_LSFT ,TG(SYSCTL)
,TG(BEGIN) ,TD(TD_LAYR)
,TG(MOUSE)
,KC_BSPC ,KC_LSFT ,TD(TD_LAYR)
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
@ -85,7 +81,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* a beginner's keymap i currently use.
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | 1 | 2 | 3 | 4 | 5 | 6 | | 6 | 7 | 8 | 9 | 0 | - | = |
* | | 1 | 2 | 3 | 4 | 5 | opt | | 6 | 7 | 8 | 9 | 0 | - | = |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | \ |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
@ -104,7 +100,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `--------------------' `----------------------'
*/
[BEGIN] = KEYMAP(
KC_TRNS ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_6
KC_TRNS ,KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_LALT
,KC_TAB ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC
,CTL_T(KC_ESC) ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G
,KC_LSFT ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,KC_LPRN
@ -213,27 +209,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
,KC_TRNS ,KC_TRNS ,KC_TRNS
),
/* SYSCTL
* a keymap to control my system.
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | | | | | | | | | | | Mute |VolDn |VolUp | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | | | | | | | | |MsUpL | MsUp |MsUpR | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | |------| |------| |MsLeft| MsDn |MsRght| | Lock |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | |MsDnL | MsDn | | | Sleep |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | | | | | Power|
* `----------------------------------' `----------------------------------'
* ,--------------------------------------------------. ,------------------------------------------------------.
* | ^ | | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+----------+------+------+--------|
* | | | | | | | | | | Mute | Home | Up | End | | |
* |--------+------+------+------+------+------| | | |------+------+----------+------+------+--------|
* | | | | | | |------| |------|VolUp | Left | Down |Right | | Lock |
* |--------+------+------+------+------+------| | | |------+------+----------+------+------+--------|
* | | | | | | | | | |VolDn | Prev |Play/Pause| Next | | Sleep |
* `--------+------+------+------+------+-------------' `-------------+------+----------+------+------+--------'
* | | | | | | | | | | | Power|
* `----------------------------------' `--------------------------------------'
* ,-------------. ,-------------.
* | | | | |MidClk|
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | |Left |Right |
* | | |------| |------| Click| Click|
* | | | | | | | |
* | | |------| |------| | |
* | | | ^ | | | | |
* `--------------------' `--------------------'
*/
[SYSCTL] = KEYMAP(
@ -245,13 +240,57 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
,KC_NO ,KC_NO
,KC_NO
,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_TRNS
/*,KC_POP*/,KC_NO ,KC_NO ,KC_NO ,KC_MUTE ,KC_VOLD ,KC_VOLU ,KC_NO
/*,KC_PTRN*/,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,LCTL(LSFT(KC_PWR))
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_SLEP
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_PWR
/*,KC_POP /// */,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
/* /// ,KC_PTRN*/,KC_NO ,KC_MUTE ,KC_HOME ,KC_UP ,KC_END ,KC_NO ,KC_NO
,KC_VOLU ,KC_LEFT ,KC_DOWN ,KC_RGHT ,KC_NO ,LCTL(LSFT(KC_PWR))
,KC_NO ,KC_VOLD ,KC_MPRV ,KC_MPLY ,KC_MNXT ,KC_NO ,KC_SLEP
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_PWR
,KC_NO ,KC_NO
,KC_NO
,KC_NO ,KC_NO ,KC_NO
),
/* MOUSE
* a keymap to control my system.
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | ^ | | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | | | | | | | | | | MsUp | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | |------| |------| |MsLeft| MsDn |MsRght| | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | | | | | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | |MidClk|
* ,------|------|------| |------+------+------.
* | | | | | |Left |Right |
* | | |------| |------| Click| Click|
* | | | ^ | | | | |
* `--------------------' `--------------------'
*/
[MOUSE] = KEYMAP(
KC_TRNS ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO
,KC_NO
,KC_NO ,KC_NO ,KC_TRNS
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_MS_U ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO ,KC_NO ,KC_NO ,KC_NO
,KC_NO ,KC_NO
,KC_NO
@ -341,47 +380,28 @@ void matrix_init_user() {
ergodox_led_all_off();
}
// light up leds based on the layer
void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state);
switch(layer) {
case SYSCTL:
ergodox_right_led_3_on();
break;
case MOUSE:
ergodox_right_led_2_on();
break;
default:
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
break;
}
}
// extra keys
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
switch (id) {
// mouse
case MS_UL:
if (record->event.pressed) {
mousekey_on(KC_MS_UP);
mousekey_on(KC_MS_LEFT);
} else {
mousekey_off(KC_MS_UP);
mousekey_off(KC_MS_LEFT);
}
break;
case MS_UR:
if (record->event.pressed) {
mousekey_on(KC_MS_UP);
mousekey_on(KC_MS_RIGHT);
} else {
mousekey_off(KC_MS_UP);
mousekey_off(KC_MS_RIGHT);
}
break;
case MS_DL:
if (record->event.pressed) {
mousekey_on(KC_MS_DOWN);
mousekey_on(KC_MS_LEFT);
} else {
mousekey_off(KC_MS_DOWN);
mousekey_off(KC_MS_LEFT);
}
break;
case MS_DR:
if (record->event.pressed) {
mousekey_on(KC_MS_DOWN);
mousekey_on(KC_MS_RIGHT);
} else {
mousekey_off(KC_MS_DOWN);
mousekey_off(KC_MS_RIGHT);
}
break;
}
return MACRO_NONE;
}
@ -425,6 +445,31 @@ void flash_dance_reset(qk_tap_dance_state_t *state, void *user_data) {
ergodox_right_led_3_off();
}
// SYSCTL on first tap, MOUSE ON second tap
void layers_dance_finished(qk_tap_dance_state_t *state, void *user_data) {
uint8_t layer = biton32(layer_state);
switch(state->count) {
case 1:
switch(layer) {
case SYSCTL:
layer_off(SYSCTL);
break;
case MOUSE:
layer_off(MOUSE);
break;
default:
layer_on(SYSCTL);
break;
}
break;
case 2:
layer_on(MOUSE);
break;
}
}
qk_tap_dance_action_t tap_dance_actions[] = {
[TD_FLSH] = ACTION_TAP_DANCE_FN_ADVANCED( flash_each_tap, flash_dance_finished, flash_dance_reset ),
[TD_LAYR] = ACTION_TAP_DANCE_FN_ADVANCED( NULL, layers_dance_finished, NULL ),
};

View File

@ -0,0 +1,3 @@
ifndef MAKEFILE_INCLUDED
include ../../../Makefile
endif

View File

@ -0,0 +1,162 @@
/*
Copyright 2012 Jun Wako <wakojun@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/>.
*/
#ifndef CONFIG_H
#define CONFIG_H
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER You
#define PRODUCT pilcrow
#define DESCRIPTION A custom keyboard
/* key matrix size */
#define MATRIX_ROWS 4
#define MATRIX_COLS 10
/*
* 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_ROW_PINS { B4, F7, B1, B3 }
#define MATRIX_COL_PINS { D4, C6, D7, E6, F5, F6, B6, B2, F4, B5}
#define UNUSED_PINS
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
// #define BACKLIGHT_PIN B7
// #define BACKLIGHT_BREATHING
// #define BACKLIGHT_LEVELS 3
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCING_DELAY 5
/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST
/* number of backlight levels */
/* 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
/*
* Magic Key Options
*
* Magic keys are hotkey commands that allow control over firmware functions of
* the keyboard. They are best used in combination with the HID Listen program,
* found here: https://www.pjrc.com/teensy/hid_listen.html
*
* The options below allow the magic key functionality to be changed. This is
* useful if your keyboard/keypad is missing keys and you want magic key support.
*
*/
/* key combination for magic key command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/* control how magic key switches layers */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
/* override magic key keymap */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
//#define MAGIC_KEY_HELP1 H
//#define MAGIC_KEY_HELP2 SLASH
//#define MAGIC_KEY_DEBUG D
//#define MAGIC_KEY_DEBUG_MATRIX X
//#define MAGIC_KEY_DEBUG_KBD K
//#define MAGIC_KEY_DEBUG_MOUSE M
//#define MAGIC_KEY_VERSION V
//#define MAGIC_KEY_STATUS S
//#define MAGIC_KEY_CONSOLE C
//#define MAGIC_KEY_LAYER0_ALT1 ESC
//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
//#define MAGIC_KEY_LAYER0 0
//#define MAGIC_KEY_LAYER1 1
//#define MAGIC_KEY_LAYER2 2
//#define MAGIC_KEY_LAYER3 3
//#define MAGIC_KEY_LAYER4 4
//#define MAGIC_KEY_LAYER5 5
//#define MAGIC_KEY_LAYER6 6
//#define MAGIC_KEY_LAYER7 7
//#define MAGIC_KEY_LAYER8 8
//#define MAGIC_KEY_LAYER9 9
//#define MAGIC_KEY_BOOTLOADER PAUSE
//#define MAGIC_KEY_LOCK CAPS
//#define MAGIC_KEY_EEPROM E
//#define MAGIC_KEY_NKRO N
//#define MAGIC_KEY_SLEEP_LED Z
/*
* 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
#endif

View File

@ -0,0 +1,88 @@
#include "pilcrow.h"
#define _______ KC_TRNS
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = KEYMAP( \
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, \
KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, \
KC_LCTL, KC_LALT, KC_LGUI, MO(1), KC_SPC, MT(MOD_LSFT, KC_SPC), MO(2), MO(3), KC_DEL, KC_ESC \
),
/* Colemak
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | R | S | T | D | H | N | E | I | O | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[1] = KEYMAP( \
KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, \
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, \
KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),KC_PIPE, S(KC_QUOT), \
_______, _______, _______, _______, KC_BSPC, KC_BSPC, _______, KC_MNXT, KC_VOLD, KC_GRV \
),
[2] = KEYMAP( \
KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, \
KC_TAB, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT,KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, \
OSM(MOD_LSFT), KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_BSLS, KC_QUOT, \
_______, _______, _______, _______, KC_ENT, KC_ENT, _______, KC_MNXT, KC_VOLD, KC_VOLU \
),
/* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------.
* | | Reset| | | | | | | | | | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[3] = KEYMAP( \
RESET, KC_UP, _______, _______, _______, _______, _______, KC_MS_WH_DOWN, KC_MS_U, KC_MS_WH_UP, \
KC_LEFT, KC_DOWN, KC_RIGHT, AU_ON, AU_OFF, AG_NORM, AG_SWAP, KC_MS_L,KC_MS_D, KC_MS_R, \
RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, \
_______, _______, _______, _______, KC_MS_BTN1, KC_MS_BTN2, _______, _______, _______, _______ \
)
};
const uint16_t PROGMEM fn_actions[] = {
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
switch(id) {
case 0:
if (record->event.pressed) {
register_code(KC_RSFT);
} else {
unregister_code(KC_RSFT);
}
break;
}
return MACRO_NONE;
};
void matrix_init_user(void) {
}
void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
void led_set_user(uint8_t usb_led) {
}

View File

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

View File

@ -0,0 +1,28 @@
#include "pilcrow.h"
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
matrix_init_user();
}
void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
}
void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
led_set_user(usb_led);
}

View File

@ -0,0 +1,23 @@
#ifndef PILCROW_H
#define PILCROW_H
#include "quantum.h"
// This a shortcut to help you visually see your layout.
// The following is an example using the Planck MIT layout
// The first section contains all of the arguements
// The second converts the arguments into a two-dimensional array
#define KEYMAP( \
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39 \
) \
{ \
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09 }, \
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19 }, \
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29 }, \
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39 } \
}
#endif

View File

@ -0,0 +1,28 @@
pilcrow keyboard firmware
======================
## Quantum MK Firmware
For the full Quantum feature list, see [the parent readme](/).
## Building
Download or clone the whole firmware and navigate to the keyboards/pilcrow folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Teensy Loader to program your .hex file.
Depending on which keymap you would like to use, you will have to compile slightly differently.
### Default
To build with the default keymap, simply run `make default`.
### Other Keymaps
Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create a folder with the name of your keymap in the keymaps folder, and see keymap documentation (you can find in top readme.md) and existant keymap files.
To build the firmware binary hex file with a keymap just do `make` with a keymap like this:
```
$ make [default|jack|<name>]
```
Keymaps follow the format **__\<name\>.c__** and are stored in the `keymaps` folder.

View File

@ -0,0 +1,67 @@
# MCU name
#MCU = at90usb1287
MCU = atmega32u4
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
# This will be an integer division of F_USB below, as it is sourced by
# F_USB after it has run through any CPU prescalers. Note that this value
# does not *change* the processor frequency - it should merely be updated to
# reflect the processor speed set externally so that the code can use accurate
# software delays.
F_CPU = 16000000
#
# LUFA specific
#
# Target architecture (see library "Board Types" documentation).
ARCH = AVR8
# Input clock frequency.
# This will define a symbol, F_USB, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
# at the end, this will be done automatically to create a 32-bit value in your
# source code.
#
# If no clock division is performed on the input clock inside the AVR (via the
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
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=512
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
CONSOLE_ENABLE ?= yes # Console for debug(+400)
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 ?= no # USB Nkey Rollover
BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default
MIDI_ENABLE ?= no # MIDI controls
UNICODE_ENABLE ?= no # Unicode
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE ?= no # Audio output on port C6

View File

@ -20,13 +20,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config_common.h"
#define USB_VENDOR_ID_LENOVO 0x17ef
#define USB_DEVICE_ID_LENOVO_TPKBD 0x6009
#define USB_DEVICE_ID_LENOVO_CUSBKBD 0x6047
#define USB_DEVICE_ID_LENOVO_CBTKBD 0x6048
#define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6660
#define VENDOR_ID USB_VENDOR_ID_LENOVO
#define PRODUCT_ID USB_DEVICE_ID_LENOVO_CBTKBD
#define DEVICE_VER 0x0001
#define MANUFACTURER Priyadi
#define PRODUCT Promethium Keyboard
#define DESCRIPTION Promethium Keyboard
#define DESCRIPTION
/* key matrix size */
#define MATRIX_ROWS 8

View File

@ -4,16 +4,17 @@
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
UNICODEMAP_ENABLE = yes
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
PS2_MOUSE_ENABLE = yes

View File

@ -1,3 +1,4 @@
#!/bin/sh
sleep 10
avrdude -p m32u4 -P /dev/ttyACM0 -c avr109 -U flash:w:../../../../../.build/handwired_promethium_priyadi.hex

View File

@ -11,6 +11,8 @@
#include "process_unicode.h"
#include "quantum.h"
#include "rgbsps.h"
#include "ps2_mouse.h"
#include "ps2.h"
#define COUNT(x) (sizeof (x) / sizeof (*(x)))
// #define RGBLED_NUM 5
@ -282,25 +284,25 @@ void led_layer_func(void) {
rgbsps_set(LED_K, 15, 0, 15);
rgbsps_set(LED_L, 15, 0, 15);
rgbsps_set(LED_U, 15, 0, 10);
rgbsps_set(LED_O, 15, 0, 10);
rgbsps_set(LED_COMM, 15, 0, 10);
rgbsps_set(LED_DOT, 15, 0, 10);
rgbsps_set(LED_SCLN, 15, 0, 10);
rgbsps_set(LED_P, 15, 0, 10);
rgbsps_set(LED_U, 15, 0, 0);
rgbsps_set(LED_O, 15, 0, 0);
rgbsps_set(LED_COMM, 15, 0, 0);
rgbsps_set(LED_DOT, 15, 0, 0);
rgbsps_set(LED_SCLN, 15, 0, 0);
rgbsps_set(LED_P, 15, 0, 0);
rgbsps_set(LED_Q, 10, 0, 15);
rgbsps_set(LED_W, 10, 0, 15);
rgbsps_set(LED_E, 10, 0, 15);
rgbsps_set(LED_R, 10, 0, 15);
rgbsps_set(LED_A, 10, 0, 15);
rgbsps_set(LED_S, 10, 0, 15);
rgbsps_set(LED_D, 10, 0, 15);
rgbsps_set(LED_F, 10, 0, 15);
rgbsps_set(LED_Z, 10, 0, 15);
rgbsps_set(LED_X, 10, 0, 15);
rgbsps_set(LED_C, 10, 0, 15);
rgbsps_set(LED_V, 10, 0, 15);
rgbsps_set(LED_Q, 0, 15, 0);
rgbsps_set(LED_W, 0, 15, 0);
rgbsps_set(LED_E, 0, 15, 0);
rgbsps_set(LED_R, 0, 15, 0);
rgbsps_set(LED_A, 0, 15, 0);
rgbsps_set(LED_S, 0, 15, 0);
rgbsps_set(LED_D, 0, 15, 0);
rgbsps_set(LED_F, 0, 15, 0);
rgbsps_set(LED_Z, 0, 15, 0);
rgbsps_set(LED_X, 0, 15, 0);
rgbsps_set(LED_C, 0, 15, 0);
rgbsps_set(LED_V, 0, 15, 0);
rgbsps_send();
}
@ -361,7 +363,15 @@ void led_layer_num(void) {
}
void led_layer_emoji(void) {
rgbsps_setall(15, 15, 0);
for(uint8_t i = 0; i < COUNT(LED_ALNUM); i++) {
rgbsps_set(pgm_read_byte(&LED_ALNUM[i]), 15, 15, 0);
}
for(uint8_t i = 0; i < COUNT(LED_MODS); i++) {
rgbsps_set(pgm_read_byte(&LED_MODS[i]), 15, 15, 0);
}
for(uint8_t i = 0; i < COUNT(LED_FN); i++) {
rgbsps_set(pgm_read_byte(&LED_FN[i]), 15, 15, 0);
}
rgbsps_set(LED_IND_FUNC, 0, 0, 0);
rgbsps_set(LED_IND_NUM, 0, 0, 0);
@ -415,7 +425,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[_QWERTY] = KEYMAP(
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT ,
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, KC_ENT ,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_LCTL, KC_LGUI, KC_LALT, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, KC_RALT, KC_RGUI, KC_RCTL
),
@ -432,10 +442,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------------------------------'
*/
[_COLEMAK] = KEYMAP(
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC,
KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT ,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_LCTL, KC_LGUI, KC_LALT, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, KC_RALT, KC_RGUI, KC_RCTL
_______, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, _______,
_______, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, _______,
_______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/* Workman
@ -450,10 +460,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------------------------------'
*/
[_WORKMAN] = KEYMAP(
KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSPC,
KC_ESC, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, KC_ENT ,
KC_LSFT, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_LCTL, KC_LGUI, KC_LALT, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, KC_RALT, KC_RGUI, KC_RCTL
_______, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_QUOT, _______,
_______, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, _______,
_______, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/* Punc
@ -541,7 +551,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[_GUI] = KEYMAP(
_______, LGUI(KC_1),LGUI(KC_2),LGUI(KC_3),LGUI(KC_4),LGUI(KC_5),LGUI(KC_6),LGUI(KC_7),LGUI(KC_8),LGUI(KC_9),LGUI(KC_0), _______,
LINUX, _______, KC_VOLD, KC_MUTE, KC_VOLU,_______,_______,KC_WWW_BACK,_______,KC_WWW_FORWARD,_______, QWERTY,
LINUX, _______, KC_VOLD, KC_MUTE, KC_VOLU,_______,_______,KC_WWW_BACK,_______,KC_WWW_FORWARD,KC_PAUS, QWERTY,
WIN, _______, KC_MPRV, KC_MPLY, KC_MNXT, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, COLEMAK,
OSX, _______, _______, _______, _______, BL_DEC, BL_INC, _______, _______, RGB_VAI, RGB_VAD, WORKMAN
),
@ -572,6 +582,39 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
switch (keycode) {
// QWERTZ style comma and dot: semicolon and colon when shifted
case KC_COMM:
if (record->event.pressed) {
bool lshifted = keyboard_report->mods & MOD_BIT(KC_LSFT);
bool rshifted = keyboard_report->mods & MOD_BIT(KC_RSFT);
if (lshifted || rshifted) {
if (lshifted) unregister_code(KC_LSFT);
if (rshifted) unregister_code(KC_RSFT);
register_code(KC_SCLN);
unregister_code(KC_SCLN);
if (lshifted) register_code(KC_LSFT);
if (rshifted) register_code(KC_RSFT);
} else {
register_code(KC_COMM);
unregister_code(KC_COMM);
}
}
return false;
break;
case KC_DOT:
if (record->event.pressed) {
if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT))) {
register_code(KC_SCLN);
unregister_code(KC_SCLN);
} else {
register_code(KC_DOT);
unregister_code(KC_DOT);
}
}
return false;
break;
// layout switchers
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
@ -600,8 +643,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return false;
break;
// layer switcher
case PUNC:
if (record->event.pressed) {
layer_on(_PUNC);
@ -663,7 +705,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return false;
break;
// OS switchers
case LINUX:
set_unicode_input_mode(UC_LNX);
#ifdef AUDIO_ENABLE
@ -722,4 +764,40 @@ void shutdown_user()
stop_all_notes();
}
#endif
#endif
void ps2_mouse_init_user() {
uint8_t rcv;
// set TrackPoint sensitivity
PS2_MOUSE_SEND(0xE2, "set trackpoint sensitivity: 0xE2");
PS2_MOUSE_SEND(0x81, "set trackpoint sensitivity: 0x81");
PS2_MOUSE_SEND(0x4A, "set trackpoint sensitivity: 0x4A");
PS2_MOUSE_SEND(0x49, "set trackpoint sensitivity: 0x59");
// set TrackPoint Negative Inertia factor
PS2_MOUSE_SEND(0xE2, "set negative inertia factor: 0xE2");
PS2_MOUSE_SEND(0x81, "set negative inertia factor: 0x81");
PS2_MOUSE_SEND(0x4D, "set negative inertia factor: 0x4D");
PS2_MOUSE_SEND(0x06, "set negative inertia factor: 0x06");
// set TrackPoint speed
// (transfer function upper plateau speed)
PS2_MOUSE_SEND(0xE2, "set trackpoint speed: 0xE2");
PS2_MOUSE_SEND(0x81, "set trackpoint speed: 0x81");
PS2_MOUSE_SEND(0x60, "set trackpoint speed: 0x60");
PS2_MOUSE_SEND(0x61, "set trackpoint speed: 0x61");
// inquire pts status
rcv = ps2_host_send(0xE2);
rcv = ps2_host_send(0x2C);
rcv = ps2_host_recv_response();
if ((rcv & 1) == 1) {
// if on, disable pts
rcv = ps2_host_send(0xE2);
rcv = ps2_host_send(0x47);
rcv = ps2_host_send(0x2C);
rcv = ps2_host_send(0x01);
}
}

View File

@ -23,77 +23,77 @@
}
enum led_sequence {
LED_IND_EMOJI,
LED_IND_NUM,
LED_IND_FUNC,
LED_IND_BATTERY,
LED_IND_USB,
LED_IND_BLUETOOTH,
LED_IND_USB,
LED_IND_BATTERY,
LED_TAB,
LED_ESC,
LED_LSFT,
LED_LCTL,
LED_IND_FUNC,
LED_IND_NUM,
LED_IND_EMOJI,
LED_LGUI,
LED_Z,
LED_A,
LED_Q,
LED_W,
LED_S,
LED_X,
LED_LALT,
LED_PUNC,
LED_C,
LED_D,
LED_E,
LED_R,
LED_F,
LED_V,
LED_NUM,
LED_LSPC,
LED_B,
LED_G,
LED_T,
LED_TRACKPOINT1,
LED_TRACKPOINT2,
LED_TRACKPOINT3,
LED_RSPC,
LED_N,
LED_HH,
LED_Y,
LED_U,
LED_J,
LED_M,
LED_FUNC,
LED_EMOJI,
LED_COMM,
LED_K,
LED_I,
LED_O,
LED_L,
LED_DOT,
LED_RALT,
LED_BKSP,
LED_ENT,
LED_RSFT,
LED_RCTL,
LED_RGUI,
LED_SLSH,
LED_SCLN,
LED_P,
LED_BKSP,
LED_ENT,
LED_RSFT,
LED_RCTL
LED_O,
LED_L,
LED_DOT,
LED_RALT,
LED_EMOJI,
LED_COMM,
LED_K,
LED_I,
LED_U,
LED_J,
LED_M,
LED_FUNC,
LED_RSPC,
LED_N,
LED_HH,
LED_Y,
LED_TRACKPOINT3,
LED_TRACKPOINT2,
LED_TRACKPOINT1,
LED_LSPC,
LED_B,
LED_G,
LED_T,
LED_R,
LED_F,
LED_V,
LED_NUM,
LED_PUNC,
LED_C,
LED_D,
LED_E,
LED_W,
LED_S,
LED_X,
LED_LALT,
LED_LGUI,
LED_Z,
LED_A,
LED_Q,
LED_TAB,
LED_ESC,
LED_LSFT,
LED_LCTL,
};
#endif

View File

@ -1,4 +1,3 @@
# MCU name
#MCU = at90usb1287
MCU = atmega32u4
@ -61,11 +60,13 @@ BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality
MIDI_ENABLE ?= no # MIDI controls
AUDIO_ENABLE ?= no # Audio output on port C6
UNICODE_ENABLE ?= no # Unicode
UNICODEMAP_ENABLE = yes
UNICODEMAP_ENABLE ?= yes
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
PS2_MOUSE_ENABLE ?= yes
PS2_USE_INT ?= yes
ADAFRUIT_BLE_ENABLE ?= yes
API_SYSEX_ENABLE ?= no
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 860 KiB

View File

@ -1,3 +1,3 @@
ifndef MAKEFILE_INCLUDED
include ../../Makefile
endif
endif

View File

@ -24,11 +24,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER Wootpatoot
#define MANUFACTURER wootpatoot
#define PRODUCT maxipad
#define DESCRIPTION A custom keyboard
/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 6
@ -55,99 +54,26 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
// #define BACKLIGHT_PIN B7
// #define BACKLIGHT_BREATHING
// #define BACKLIGHT_LEVELS 3
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCING_DELAY 5
/* define if matrix has ghost (lacks anti-ghosting diodes) */
/* 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
/*
* 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
/*
* Magic Key Options
*
* Magic keys are hotkey commands that allow control over firmware functions of
* the keyboard. They are best used in combination with the HID Listen program,
* found here: https://www.pjrc.com/teensy/hid_listen.html
*
* The options below allow the magic key functionality to be changed. This is
* useful if your keyboard/keypad is missing keys and you want magic key support.
*
*/
/* key combination for magic key command */
/* key combination for command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/* control how magic key switches layers */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
/* override magic key keymap */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
//#define MAGIC_KEY_HELP1 H
//#define MAGIC_KEY_HELP2 SLASH
//#define MAGIC_KEY_DEBUG D
//#define MAGIC_KEY_DEBUG_MATRIX X
//#define MAGIC_KEY_DEBUG_KBD K
//#define MAGIC_KEY_DEBUG_MOUSE M
//#define MAGIC_KEY_VERSION V
//#define MAGIC_KEY_STATUS S
//#define MAGIC_KEY_CONSOLE C
//#define MAGIC_KEY_LAYER0_ALT1 ESC
//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
//#define MAGIC_KEY_LAYER0 0
//#define MAGIC_KEY_LAYER1 1
//#define MAGIC_KEY_LAYER2 2
//#define MAGIC_KEY_LAYER3 3
//#define MAGIC_KEY_LAYER4 4
//#define MAGIC_KEY_LAYER5 5
//#define MAGIC_KEY_LAYER6 6
//#define MAGIC_KEY_LAYER7 7
//#define MAGIC_KEY_LAYER8 8
//#define MAGIC_KEY_LAYER9 9
//#define MAGIC_KEY_BOOTLOADER PAUSE
//#define MAGIC_KEY_LOCK CAPS
//#define MAGIC_KEY_EEPROM E
//#define MAGIC_KEY_NKRO N
//#define MAGIC_KEY_SLEEP_LED Z
/*
* Feature disable options
* These options are also useful to firmware size reduction.

View File

@ -1,5 +1,5 @@
#include "maxipad.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = KEYMAP( /* Base */
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, \
@ -13,42 +13,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_SPC \
),
};
const uint16_t PROGMEM fn_actions[] = {
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) // MACRODOWN only works in this function
{
// MACRODOWN only works in this function
switch(id) {
case 0:
if (record->event.pressed) {
register_code(KC_RSFT);
} else {
unregister_code(KC_RSFT);
}
break;
}
return MACRO_NONE;
};
void matrix_init_user(void) {
}
void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
void led_set_user(uint8_t usb_led) {
}
};

View File

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

View File

@ -1,28 +1 @@
#include "maxipad.h"
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
matrix_init_user();
}
void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
}
void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
led_set_user(usb_led);
}
#include "maxipad.h"

View File

@ -8,18 +8,18 @@
// The first section contains all of the arguements
// The second converts the arguments into a two-dimensional array
#define KEYMAP( \
k00, k01, k02, k03, k04, k05, \
k10, k11, k12, k13, k14, k15, \
k20, k21, k22, k23, k24, k25, \
k30, k31, k32, k33, k34, k35, \
k40, k41, k42, k43, k44, k45 \
k00, k01, k02, k03, k04, k05, \
k10, k11, k12, k13, k14, k15, \
k20, k21, k22, k23, k24, k25, \
k30, k31, k32, k33, k34, k35, \
k40, k41, k42, k43, k44, k45 \
) \
{ \
{ k00, k01, k02, k03, k04, k05 }, \
{ k10, k11, k12, k13, k14, k15 }, \
{ k20, k21, k22, k23, k24, k25 }, \
{ k30, k31, k32, k33, k34, k35 }, \
{ k40, k41, k42, k43, k44, k45} \
{ k40, k41, k42, k43, k44, k45 } \
}
#endif

View File

@ -1,10 +1,10 @@
Maxipad keyboard firmware
## Quantum MK Firmware
For the full Quantum feature list, see [the parent readme](/).
## Building
For the full Quantum feature list, see [the parent readme.md](/readme.md).
If you are using a pro micro then make sure to enable USE_PRO_MICRO in the makefile
Change the config.h pinout to match your mcu!!
Download or clone the whole firmware and navigate to the keyboards/maxipad folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Teensy Loader to program your .hex file.
@ -17,8 +17,8 @@ To build with the default keymap, simply run `make`.
### Other Keymaps
Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `<name>.c` and see keymap document (you can find in top readme.md) and existent keymap files.
Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create a folder with the name of your keymap in the keymaps folder, and see keymap documentation (you can find in top readme.md) and existant keymap files.
To build the firmware binary hex file with a keymap just do `make` with a keymap like this:
@ -27,4 +27,3 @@ $ make [default|jack|<name>]
```
Keymaps follow the format **__\<name\>.c__** and are stored in the `keymaps` folder.

View File

@ -1,3 +1,5 @@
# MCU name
#MCU = at90usb1287
MCU = atmega32u4
@ -49,14 +51,21 @@ OPT_DEFS += -DBOOTLOADER_SIZE=512
# Build Options
# change yes to no to disable
# comment out to disable the options.
#
BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
CONSOLE_ENABLE ?= yes # Console for debug(+400)
COMMAND_ENABLE ?= yes # Commands for debug and configuration
BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
CONSOLE_ENABLE ?= yes # Console for debug(+400)
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 ?= yes # Breathing sleep LED during USB suspend
# NKRO_ENABLE ?= yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
# BACKLIGHT_ENABLE ?= yes # Enable keyboard backlight functionality
# MIDI_ENABLE ?= YES # MIDI controls
# UNICODE_ENABLE ?= YES # Unicode
# BLUETOOTH_ENABLE ?= yes # Enable Bluetooth with the Adafruit EZ-Key HID
USE_PRO_MICRO ?= yes
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
@ -64,4 +73,4 @@ BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by
MIDI_ENABLE ?= no # MIDI controls
UNICODE_ENABLE ?= no # Unicode
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE ?= no # Audio output on port C6
AUDIO_ENABLE ?= no # Audio output on port C6

View File

@ -10,7 +10,7 @@ EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
MIDI_ENABLE = yes # MIDI controls
AUDIO_ENABLE = yes # Audio output on port C6
UNICODE_ENABLE = no # Unicode

View File

@ -1,8 +1,3 @@
# Please remove if no longer applicable
$(warning THIS FILE MAY BE TOO LARGE FOR YOUR KEYBOARD)
$(warning Please disable some options in the Makefile to resolve)
# 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
@ -11,7 +6,7 @@ BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
@ -20,6 +15,7 @@ UNICODE_ENABLE = no # Unicode
UNICODEMAP_ENABLE = yes # Unicode map
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
API_SYSEX_ENABLE = no
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

View File

@ -179,7 +179,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[_QWERTY] = {
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT },
{KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, KC_ENT },
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
{KC_LCTL, KC_LGUI, KC_LALT, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, KC_RALT, KC_RGUI, KC_RCTL}
},
@ -196,10 +196,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------------------------------'
*/
[_COLEMAK] = {
{KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
{KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT },
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
{KC_LCTL, KC_LGUI, KC_LALT, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, KC_RALT, KC_RGUI, KC_RCTL}
{_______, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, _______},
{_______, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, _______},
{_______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
},
/* Workman
@ -214,10 +214,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------------------------------'
*/
[_WORKMAN] = {
{KC_TAB, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSPC},
{KC_ESC, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, KC_ENT },
{KC_LSFT, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
{KC_LCTL, KC_LGUI, KC_LALT, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, KC_RALT, KC_RGUI, KC_RCTL}
{_______, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_QUOT, _______},
{_______, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, _______},
{_______, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
},
/* Punc
@ -322,6 +322,7 @@ float tone_linux[][2] = SONG(CAPS_LOCK_ON_SOUND);
float tone_windows[][2] = SONG(SCROLL_LOCK_ON_SOUND);
float tone_osx[][2] = SONG(NUM_LOCK_ON_SOUND);
float tone_click[][2] = SONG(MUSICAL_NOTE(_F3, 2));
float tone_release[][2] = SONG(MUSICAL_NOTE(_A3, 2));
#endif
void persistant_default_layer_set(uint16_t default_layer) {
@ -331,9 +332,49 @@ void persistant_default_layer_set(uint16_t default_layer) {
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// faux clicky
if (record->event.pressed) PLAY_NOTE_ARRAY(tone_click, false, 0);
// if (record->event.pressed) PLAY_NOTE_ARRAY(tone_click, false, 0);
#ifdef AUDIO_ENABLE
if (record->event.pressed) {
PLAY_NOTE_ARRAY(tone_click, false, 0);
} else {
PLAY_NOTE_ARRAY(tone_release, false, 0);
}
#endif
switch (keycode) {
// QWERTZ style comma and dot: semicolon and colon when shifted
case KC_COMM:
if (record->event.pressed) {
bool lshifted = keyboard_report->mods & MOD_BIT(KC_LSFT);
bool rshifted = keyboard_report->mods & MOD_BIT(KC_RSFT);
if (lshifted || rshifted) {
if (lshifted) unregister_code(KC_LSFT);
if (rshifted) unregister_code(KC_RSFT);
register_code(KC_SCLN);
unregister_code(KC_SCLN);
if (lshifted) register_code(KC_LSFT);
if (rshifted) register_code(KC_RSFT);
} else {
register_code(KC_COMM);
unregister_code(KC_COMM);
}
}
return false;
break;
case KC_DOT:
if (record->event.pressed) {
if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT))) {
register_code(KC_SCLN);
unregister_code(KC_SCLN);
} else {
register_code(KC_DOT);
unregister_code(KC_DOT);
}
}
return false;
break;
// layout switcher
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
@ -361,6 +402,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
break;
// layer switchers
case PUNC:
if (record->event.pressed) {
layer_on(_PUNC);
@ -397,6 +440,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
break;
// OS switchers
case LINUX:
set_unicode_input_mode(UC_LNX);
#ifdef AUDIO_ENABLE

View File

@ -19,6 +19,7 @@ AUDIO_ENABLE = yes # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
API_SYSEX_ENABLE = no # Disable extra stuff for ergodoxen
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend

View File

@ -16,4 +16,4 @@ void matrix_init_kb(void) {
PORTE |= (1<<6);
matrix_init_user();
}
}

View File

@ -65,4 +65,4 @@ RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this
API_SYSEX_ENABLE = yes
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend

View File

@ -56,11 +56,11 @@ BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE ?= no # Mouse keys(+4700)
EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
CONSOLE_ENABLE ?= no # Console for debug(+400)
COMMAND_ENABLE ?= yes # Commands for debug and configuration
COMMAND_ENABLE ?= no # Commands for debug and configuration
NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE ?= yes # Enable keyboard backlight functionality
MIDI_ENABLE ?= no # MIDI controls
AUDIO_ENABLE ?= no # Audio output on port C6
MIDI_ENABLE ?= yes # MIDI controls
AUDIO_ENABLE ?= yes # Audio output on port C6
UNICODE_ENABLE ?= no # Unicode
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.

View File

@ -18,7 +18,7 @@ void voice_iterate() {
}
void voice_deiterate() {
voice = (voice - 1) % number_of_voices;
voice = (voice - 1 + number_of_voices) % number_of_voices;
}
float voice_envelope(float frequency) {
@ -31,6 +31,27 @@ float voice_envelope(float frequency) {
polyphony_rate = 0;
break;
case something:
polyphony_rate = 0;
switch (compensated_index) {
case 0 ... 9:
note_timbre = TIMBRE_12;
break;
case 10 ... 19:
note_timbre = TIMBRE_25;
break;
case 20 ... 200:
note_timbre = .25 + .125 + pow(((float)compensated_index - 20) / (200 - 20), 2)*.125;
break;
default:
note_timbre = .25;
break;
}
break;
case butts_fader:
polyphony_rate = 0;
switch (compensated_index) {

View File

@ -11,6 +11,7 @@ float voice_envelope(float frequency);
typedef enum {
default_voice,
something,
butts_fader,
octave_crunch,
duty_osc,

View File

@ -1,8 +1,8 @@
#include "process_music.h"
bool music_activated = false;
uint8_t starting_note = 0x0C;
int offset = 7;
uint8_t music_starting_note = 0x0C;
int music_offset = 7;
// music sequencer
static bool music_sequence_recording = false;
@ -115,7 +115,7 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
return false;
}
float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row));
float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + SCALE[record->event.key.col + music_offset])/12.0+(MATRIX_ROWS - record->event.key.row));
if (record->event.pressed) {
play_note(freq, 0xF);
if (music_sequence_recording) {

1559
readme.md

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@ CFLAGS += -fno-inline-small-functions
CFLAGS += -fno-strict-aliasing
CPPFLAGS += $(COMPILEFLAGS)
CPPFLAGS += -fno-exceptions
CPPFLAGS += -fno-exceptions -std=c++11
LDFLAGS +=-Wl,--gc-sections

View File

@ -50,6 +50,10 @@ ifeq ($(strip $(EXTRAKEY_ENABLE)), yes)
TMK_COMMON_DEFS += -DEXTRAKEY_ENABLE
endif
ifeq ($(strip $(RAW_ENABLE)), yes)
TMK_COMMON_DEFS += -DRAW_ENABLE
endif
ifeq ($(strip $(CONSOLE_ENABLE)), yes)
TMK_COMMON_DEFS += -DCONSOLE_ENABLE
else

View File

@ -0,0 +1,8 @@
#ifndef _RAW_HID_H_
#define _RAW_HID_H_
void raw_hid_receive( uint8_t *data, uint8_t length );
void raw_hid_send( uint8_t *data, uint8_t length );
#endif

View File

@ -86,7 +86,7 @@ struct queue_item {
uint16_t consumer;
struct __attribute__((packed)) {
uint8_t x, y, scroll, pan;
int8_t x, y, scroll, pan;
} mousemove;
};
};

View File

@ -40,6 +40,9 @@
#include "report.h"
#include "descriptor.h"
#ifndef USB_MAX_POWER_CONSUMPTION
#define USB_MAX_POWER_CONSUMPTION 500
#endif
/*******************************************************************************
* HID Report Descriptors
@ -164,6 +167,28 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM ExtrakeyReport[] =
};
#endif
#ifdef RAW_ENABLE
const USB_Descriptor_HIDReport_Datatype_t PROGMEM RawReport[] =
{
HID_RI_USAGE_PAGE(16, 0xFF60), /* Vendor Page 0xFF60 */
HID_RI_USAGE(8, 0x61), /* Vendor Usage 0x61 */
HID_RI_COLLECTION(8, 0x01), /* Application */
HID_RI_USAGE(8, 0x62), /* Vendor Usage 0x62 */
HID_RI_LOGICAL_MINIMUM(8, 0x00),
HID_RI_LOGICAL_MAXIMUM(16, 0x00FF),
HID_RI_REPORT_COUNT(8, RAW_EPSIZE),
HID_RI_REPORT_SIZE(8, 0x08),
HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
HID_RI_USAGE(8, 0x63), /* Vendor Usage 0x63 */
HID_RI_LOGICAL_MINIMUM(8, 0x00),
HID_RI_LOGICAL_MAXIMUM(16, 0x00FF),
HID_RI_REPORT_COUNT(8, RAW_EPSIZE),
HID_RI_REPORT_SIZE(8, 0x08),
HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE),
HID_RI_END_COLLECTION(0),
};
#endif
#ifdef CONSOLE_ENABLE
const USB_Descriptor_HIDReport_Datatype_t PROGMEM ConsoleReport[] =
{
@ -272,7 +297,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_REMOTEWAKEUP),
.MaxPowerConsumption = USB_CONFIG_POWER_MA(500)
.MaxPowerConsumption = USB_CONFIG_POWER_MA(USB_MAX_POWER_CONSUMPTION)
},
/*
@ -399,6 +424,58 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
},
#endif
/*
* Raw
*/
#ifdef RAW_ENABLE
.Raw_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = RAW_INTERFACE,
.AlternateSetting = 0x00,
.TotalEndpoints = 2,
.Class = HID_CSCP_HIDClass,
.SubClass = HID_CSCP_NonBootSubclass,
.Protocol = HID_CSCP_NonBootProtocol,
.InterfaceStrIndex = NO_DESCRIPTOR
},
.Raw_HID =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.HIDSpec = VERSION_BCD(1,1,1),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(RawReport)
},
.Raw_INEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_IN | RAW_IN_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = RAW_EPSIZE,
.PollingIntervalMS = 0x01
},
.Raw_OUTEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
.EndpointAddress = (ENDPOINT_DIR_OUT | RAW_OUT_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = RAW_EPSIZE,
.PollingIntervalMS = 0x01
},
#endif
/*
* Console
*/
@ -754,7 +831,6 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.PollingIntervalMS = 0x05
},
#endif
};
@ -846,6 +922,12 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
#endif
#ifdef RAW_ENABLE
case RAW_INTERFACE:
Address = &ConfigurationDescriptor.Raw_HID;
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
#endif
#ifdef CONSOLE_ENABLE
case CONSOLE_INTERFACE:
Address = &ConfigurationDescriptor.Console_HID;
@ -878,6 +960,12 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Size = sizeof(ExtrakeyReport);
break;
#endif
#ifdef RAW_ENABLE
case RAW_INTERFACE:
Address = &RawReport;
Size = sizeof(RawReport);
break;
#endif
#ifdef CONSOLE_ENABLE
case CONSOLE_INTERFACE:
Address = &ConsoleReport;

View File

@ -71,6 +71,14 @@ typedef struct
USB_Descriptor_Endpoint_t Extrakey_INEndpoint;
#endif
#ifdef RAW_ENABLE
// Raw HID Interface
USB_Descriptor_Interface_t Raw_Interface;
USB_HID_Descriptor_HID_t Raw_HID;
USB_Descriptor_Endpoint_t Raw_INEndpoint;
USB_Descriptor_Endpoint_t Raw_OUTEndpoint;
#endif
#ifdef CONSOLE_ENABLE
// Console HID Interface
USB_Descriptor_Interface_t Console_Interface;
@ -137,10 +145,16 @@ typedef struct
# define EXTRAKEY_INTERFACE MOUSE_INTERFACE
#endif
#ifdef CONSOLE_ENABLE
# define CONSOLE_INTERFACE (EXTRAKEY_INTERFACE + 1)
#ifdef RAW_ENABLE
# define RAW_INTERFACE (EXTRAKEY_INTERFACE + 1)
#else
# define CONSOLE_INTERFACE EXTRAKEY_INTERFACE
# define RAW_INTERFACE EXTRAKEY_INTERFACE
#endif
#ifdef CONSOLE_ENABLE
# define CONSOLE_INTERFACE (RAW_INTERFACE + 1)
#else
# define CONSOLE_INTERFACE RAW_INTERFACE
#endif
#ifdef NKRO_ENABLE
@ -182,12 +196,19 @@ typedef struct
# define EXTRAKEY_IN_EPNUM MOUSE_IN_EPNUM
#endif
#ifdef CONSOLE_ENABLE
# define CONSOLE_IN_EPNUM (EXTRAKEY_IN_EPNUM + 1)
# define CONSOLE_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 1)
//# define CONSOLE_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 2)
#ifdef RAW_ENABLE
# define RAW_IN_EPNUM (EXTRAKEY_IN_EPNUM + 1)
# define RAW_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 2)
#else
# define CONSOLE_OUT_EPNUM EXTRAKEY_IN_EPNUM
# define RAW_OUT_EPNUM EXTRAKEY_IN_EPNUM
#endif
#ifdef CONSOLE_ENABLE
# define CONSOLE_IN_EPNUM (RAW_OUT_EPNUM + 1)
//# define CONSOLE_OUT_EPNUM (RAW_OUT_EPNUM + 2)
# define CONSOLE_OUT_EPNUM (RAW_OUT_EPNUM + 1)
#else
# define CONSOLE_OUT_EPNUM RAW_OUT_EPNUM
#endif
#ifdef NKRO_ENABLE
@ -217,7 +238,6 @@ typedef struct
# define CDC_OUT_EPNUM MIDI_STREAM_OUT_EPNUM
#endif
#if defined(__AVR_ATmega32U2__) && CDC_OUT_EPNUM > 4
# error "Endpoints are not available enough to support all functions. Remove some in Makefile.(MOUSEKEY, EXTRAKEY, CONSOLE, NKRO, MIDI, SERIAL)"
#endif
@ -225,6 +245,7 @@ typedef struct
#define KEYBOARD_EPSIZE 8
#define MOUSE_EPSIZE 8
#define EXTRAKEY_EPSIZE 8
#define RAW_EPSIZE 32
#define CONSOLE_EPSIZE 32
#define NKRO_EPSIZE 32
#define MIDI_STREAM_EPSIZE 64

View File

@ -84,6 +84,10 @@
#include "sysex_tools.h"
#endif
#ifdef RAW_ENABLE
#include "raw_hid.h"
#endif
uint8_t keyboard_idle = 0;
/* 0: Boot Protocol, 1: Report Protocol(default) */
uint8_t keyboard_protocol = 1;
@ -179,6 +183,80 @@ USB_ClassInfo_CDC_Device_t cdc_device =
};
#endif
#ifdef RAW_ENABLE
void raw_hid_send( uint8_t *data, uint8_t length )
{
// TODO: implement variable size packet
if ( length != RAW_EPSIZE )
{
return;
}
if (USB_DeviceState != DEVICE_STATE_Configured)
{
return;
}
// TODO: decide if we allow calls to raw_hid_send() in the middle
// of other endpoint usage.
uint8_t ep = Endpoint_GetCurrentEndpoint();
Endpoint_SelectEndpoint(RAW_IN_EPNUM);
// Check to see if the host is ready to accept another packet
if (Endpoint_IsINReady())
{
// Write data
Endpoint_Write_Stream_LE(data, RAW_EPSIZE, NULL);
// Finalize the stream transfer to send the last packet
Endpoint_ClearIN();
}
Endpoint_SelectEndpoint(ep);
}
__attribute__ ((weak))
void raw_hid_receive( uint8_t *data, uint8_t length )
{
// Users should #include "raw_hid.h" in their own code
// and implement this function there. Leave this as weak linkage
// so users can opt to not handle data coming in.
}
static void raw_hid_task(void)
{
// Create a temporary buffer to hold the read in data from the host
uint8_t data[RAW_EPSIZE];
bool data_read = false;
// Device must be connected and configured for the task to run
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
Endpoint_SelectEndpoint(RAW_OUT_EPNUM);
// Check to see if a packet has been sent from the host
if (Endpoint_IsOUTReceived())
{
// Check to see if the packet contains data
if (Endpoint_IsReadWriteAllowed())
{
/* Read data */
Endpoint_Read_Stream_LE(data, sizeof(data), NULL);
data_read = true;
}
// Finalize the stream transfer to receive the last packet
Endpoint_ClearOUT();
if ( data_read )
{
raw_hid_receive( data, sizeof(data) );
}
}
}
#endif
/*******************************************************************************
* Console
@ -298,6 +376,8 @@ void EVENT_USB_Device_WakeUp()
#endif
}
#ifdef CONSOLE_ENABLE
static bool console_flush = false;
#define CONSOLE_FLUSH_SET(b) do { \
@ -317,6 +397,7 @@ void EVENT_USB_Device_StartOfFrame(void)
Console_Task();
console_flush = false;
}
#endif
/** Event handler for the USB_ConfigurationChanged event.
@ -345,6 +426,14 @@ void EVENT_USB_Device_ConfigurationChanged(void)
EXTRAKEY_EPSIZE, ENDPOINT_BANK_SINGLE);
#endif
#ifdef RAW_ENABLE
/* Setup Raw HID Report Endpoints */
ConfigSuccess &= ENDPOINT_CONFIG(RAW_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
RAW_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= ENDPOINT_CONFIG(RAW_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT,
RAW_EPSIZE, ENDPOINT_BANK_SINGLE);
#endif
#ifdef CONSOLE_ENABLE
/* Setup Console HID Report Endpoints */
ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
@ -1124,9 +1213,14 @@ int main(void)
CDC_Device_USBTask(&cdc_device);
#endif
#ifdef RAW_ENABLE
raw_hid_task();
#endif
#if !defined(INTERRUPT_CONTROL_ENDPOINT)
USB_USBTask();
#endif
}
}

View File

@ -28,52 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* ============================= MACROS ============================ */
#define PS2_MOUSE_SEND(command, message) \
do { \
uint8_t rcv = ps2_host_send(command); \
if (debug_mouse) { \
print((message)); \
xprintf(" command: %X, result: %X, error: %X \n", command, rcv, ps2_error); \
} \
} while(0)
#define PS2_MOUSE_SEND_SAFE(command, message) \
do { \
if (PS2_MOUSE_STREAM_MODE == ps2_mouse_mode) { \
ps2_mouse_disable_data_reporting(); \
} \
PS2_MOUSE_SEND(command, message); \
if (PS2_MOUSE_STREAM_MODE == ps2_mouse_mode) { \
ps2_mouse_enable_data_reporting(); \
} \
} while(0)
#define PS2_MOUSE_SET_SAFE(command, value, message) \
do { \
if (PS2_MOUSE_STREAM_MODE == ps2_mouse_mode) { \
ps2_mouse_disable_data_reporting(); \
} \
PS2_MOUSE_SEND(command, message); \
PS2_MOUSE_SEND(value, "Sending value"); \
if (PS2_MOUSE_STREAM_MODE == ps2_mouse_mode) { \
ps2_mouse_enable_data_reporting(); \
} \
} while(0)
#define PS2_MOUSE_RECEIVE(message) \
do { \
uint8_t rcv = ps2_host_recv_response(); \
if (debug_mouse) { \
print((message)); \
xprintf(" result: %X, error: %X \n", rcv, ps2_error); \
} \
} while(0)
static enum ps2_mouse_mode_e {
PS2_MOUSE_STREAM_MODE,
PS2_MOUSE_REMOTE_MODE,
} ps2_mouse_mode = PS2_MOUSE_STREAM_MODE;
static report_mouse_t mouse_report = {};
static inline void ps2_mouse_print_report(report_mouse_t *mouse_report);
@ -108,6 +62,12 @@ void ps2_mouse_init(void) {
#ifdef PS2_MOUSE_USE_2_1_SCALING
ps2_mouse_set_scaling_2_1();
#endif
ps2_mouse_init_user();
}
__attribute__((weak))
void ps2_mouse_init_user(void) {
}
void ps2_mouse_task(void) {

View File

@ -19,6 +19,53 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define PS2_MOUSE_H
#include <stdbool.h>
#include "debug.h"
#define PS2_MOUSE_SEND(command, message) \
do { \
uint8_t rcv = ps2_host_send(command); \
if (debug_mouse) { \
print((message)); \
xprintf(" command: %X, result: %X, error: %X \n", command, rcv, ps2_error); \
} \
} while(0)
#define PS2_MOUSE_SEND_SAFE(command, message) \
do { \
if (PS2_MOUSE_STREAM_MODE == ps2_mouse_mode) { \
ps2_mouse_disable_data_reporting(); \
} \
PS2_MOUSE_SEND(command, message); \
if (PS2_MOUSE_STREAM_MODE == ps2_mouse_mode) { \
ps2_mouse_enable_data_reporting(); \
} \
} while(0)
#define PS2_MOUSE_SET_SAFE(command, value, message) \
do { \
if (PS2_MOUSE_STREAM_MODE == ps2_mouse_mode) { \
ps2_mouse_disable_data_reporting(); \
} \
PS2_MOUSE_SEND(command, message); \
PS2_MOUSE_SEND(value, "Sending value"); \
if (PS2_MOUSE_STREAM_MODE == ps2_mouse_mode) { \
ps2_mouse_enable_data_reporting(); \
} \
} while(0)
#define PS2_MOUSE_RECEIVE(message) \
do { \
uint8_t rcv = ps2_host_recv_response(); \
if (debug_mouse) { \
print((message)); \
xprintf(" result: %X, error: %X \n", rcv, ps2_error); \
} \
} while(0)
static enum ps2_mouse_mode_e {
PS2_MOUSE_STREAM_MODE,
PS2_MOUSE_REMOTE_MODE,
} ps2_mouse_mode = PS2_MOUSE_STREAM_MODE;
/*
* Data format:
@ -107,6 +154,8 @@ typedef enum ps2_mouse_sample_rate_e {
void ps2_mouse_init(void);
void ps2_mouse_init_user(void);
void ps2_mouse_task(void);
void ps2_mouse_disable_data_reporting(void);