forked from mirrors/qmk_firmware
Fix and keymap of hid_liber from alaricljs at geekhack.org.
This commit is contained in:
parent
98052b8afd
commit
ce4857e021
7 changed files with 160 additions and 137 deletions
|
@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define HOST_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "report.h"
|
||||
#include "host_driver.h"
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#----------------------------------------------------------------------------
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = macway_lufa
|
||||
TARGET = hid_liber_lufa
|
||||
|
||||
# Directory common source filess exist
|
||||
TOP_DIR = ../..
|
||||
|
@ -97,10 +97,10 @@ F_USB = $(F_CPU)
|
|||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
#MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
CONSOLE_ENABLE = yes # Console for debug
|
||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
||||
#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
|
||||
|
||||
|
||||
|
@ -108,7 +108,7 @@ CONSOLE_ENABLE = yes # Console for debug
|
|||
# Teensy halfKay 512
|
||||
# Atmel DFU loader 4096
|
||||
# LUFA bootloader 4096
|
||||
#OPT_DEFS += -DBOOT_SIZE=4096
|
||||
OPT_DEFS += -DBOOT_SIZE=4096
|
||||
|
||||
|
||||
# Search Path
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#----------------------------------------------------------------------------
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = macway_pjrc
|
||||
TARGET = hid_liber_pjrc
|
||||
|
||||
# Directory common source filess exist
|
||||
TOP_DIR = ../..
|
||||
|
@ -74,16 +74,11 @@ F_CPU = 16000000
|
|||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
#MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
|
||||
|
||||
|
||||
#---------------- Programming Options --------------------------
|
||||
PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex
|
||||
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
CONSOLE_ENABLE = yes # Console for debug
|
||||
|
||||
|
||||
# Search Path
|
||||
|
|
|
@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define PRODUCT_ID 0xB919
|
||||
#define DEVICE_VER 0x0001
|
||||
#define MANUFACTURER t.m.k.
|
||||
#define PRODUCT HID Leberation
|
||||
#define PRODUCT HID Liberation
|
||||
|
||||
|
||||
/* message strings */
|
||||
|
@ -39,7 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
//#define MATRIX_HAS_GHOST
|
||||
|
||||
/* Set 0 if need no debouncing */
|
||||
#define DEBOUNCE 5
|
||||
#define DEBOUNCE 7
|
||||
|
||||
|
||||
/* key combination for command */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
||||
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
|
||||
|
@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/
|
||||
|
||||
/*
|
||||
* Keymap for Macway mod
|
||||
* Keymap for HID Liberator controller
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
@ -30,60 +30,33 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
// Convert physical keyboard layout to matrix array.
|
||||
// This is a macro to define keymap easily in keyboard layout form.
|
||||
/*
|
||||
* Tenkeyless keyboard:
|
||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------.
|
||||
* |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| -| =|Backsp | |Ins|Hom|PgU|
|
||||
* |-----------------------------------------------------------| |-----------|
|
||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
|
||||
* |-----------------------------------------------------------| `-----------'
|
||||
* |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |
|
||||
* |-----------------------------------------------------------| ,---.
|
||||
* |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
|
||||
* |-----------------------------------------------------------| ,-----------.
|
||||
* |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig|
|
||||
* `-----------------------------------------------------------' `-----------'
|
||||
*
|
||||
* TODO: You should define follwing macro properly. It won't be compiled until done.
|
||||
*
|
||||
* Keymap array sapce has 18*8 slot, row is designated with A-Q and col with 0-7.
|
||||
* In this macro KA0 means key at row:A/col:0, KR7 means key at rowR/col7.
|
||||
* Empty slot of keymap should has KC_NO.For example row:B/col:0 has no key
|
||||
* so you must define KC_NO in this slot.(from hid_liber/ansi_iso_jis.c)
|
||||
* Esc key locates at row:A/col:1 so fist argument of macro should say KA1.
|
||||
* Right arrow key locates at row:Q/col:2 so last argument of macro should say KQ2.
|
||||
*
|
||||
* NOTE: Except above examples, the rest of macro definition is garbage just for place holder.
|
||||
*/
|
||||
#define KEYMAP( \
|
||||
KA1,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \
|
||||
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, \
|
||||
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, \
|
||||
K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, \
|
||||
K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, \
|
||||
K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KQ2 \
|
||||
KG1, KH7, KJ7, KJ6, KJ1, KO5, KL1, KA6, KA7, KD7, KD5, KD1, KD2, KB5, KB3, KO3, \
|
||||
KG7, KG5, KH5, KJ5, KI5, KI7, KK7, KK5, KL5, KA5, KC5, KC7, KL7, KD6, KQ7, KN7, KM7, \
|
||||
KG6, KG3, KH3, KJ3, KI3, KI6, KK6, KK3, KL3, KA3, KC3, KC6, KL6, KD4, KP7, KN5, KM5, \
|
||||
KH6, KG4, KH4, KJ4, KI4, KI1, KK1, KK4, KL4, KA4, KC4, KC1, KD0, \
|
||||
KF6, KQ0, KG0, KH0, KJ0, KI0, KI2, KK2, KK0, KL0, KA0, KC2, KF4, KN1, \
|
||||
KO7, KE6, KB1, KP1, KB2, KR4, KA2, KO0, KN2, KP2, KQ2 \
|
||||
) { \
|
||||
{ KC_##KA0, KC_##KA1, KC_##KA2, KC_##KA3, KC_##KA4, KC_##KA5, KC_##KA6, KC_##KA7 }, \
|
||||
{ KC_NO, KC_##KB1, KC_##KB2, KC_##KB3, KC_##KB4, KC_##KB5, KC_##KB6, KC_##KB7 }, \
|
||||
{ KC_##KC0, KC_##KC1, KC_##KC2, KC_##KC3, KC_##KC4, KC_##KC5, KC_##KC6, KC_##KC7 }, \
|
||||
{ KC_##KD0, KC_##KD1, KC_##KD2, KC_##KD3, KC_##KD4, KC_##KD5, KC_##KD6, KC_##KD7 }, \
|
||||
{ KC_##KE0, KC_##KE1, KC_##KE2, KC_##KE3, KC_##KE4, KC_##KE5, KC_##KE6, KC_##KE7 }, \
|
||||
{ KC_##KF0, KC_##KF1, KC_##KF2, KC_##KF3, KC_##KF4, KC_##KF5, KC_##KF6, KC_##KF7 }, \
|
||||
{ KC_##KG0, KC_##KG1, KC_##KG2, KC_##KG3, KC_##KG4, KC_##KG5, KC_##KG6, KC_##KG7 }, \
|
||||
{ KC_##KH0, KC_##KH1, KC_##KH2, KC_##KH3, KC_##KH4, KC_##KH5, KC_##KH6, KC_##KH7 }, \
|
||||
{ KC_##KI0, KC_##KI1, KC_##KI2, KC_##KI3, KC_##KI4, KC_##KI5, KC_##KI6, KC_##KI7 }, \
|
||||
{ KC_##KJ0, KC_##KJ1, KC_##KJ2, KC_##KJ3, KC_##KJ4, KC_##KJ5, KC_##KJ6, KC_##KJ7 }, \
|
||||
{ KC_##KK0, KC_##KK1, KC_##KK2, KC_##KK3, KC_##KK4, KC_##KK5, KC_##KK6, KC_##KK7 }, \
|
||||
{ KC_##KL0, KC_##KL1, KC_##KL2, KC_##KL3, KC_##KL4, KC_##KL5, KC_##KL6, KC_##KL7 }, \
|
||||
{ KC_##KM0, KC_##KM1, KC_##KM2, KC_##KM3, KC_##KM4, KC_##KM5, KC_##KM6, KC_##KM7 }, \
|
||||
{ KC_##KN0, KC_##KN1, KC_##KN2, KC_##KN3, KC_##KN4, KC_##KN5, KC_##KN6, KC_##KN7 }, \
|
||||
{ KC_##KO0, KC_##KO1, KC_##KO2, KC_##KO3, KC_##KO4, KC_##KO5, KC_##KO6, KC_##KO7 }, \
|
||||
{ KC_##KP0, KC_##KP1, KC_##KP2, KC_##KP3, KC_##KP4, KC_##KP5, KC_##KP6, KC_##KP7 }, \
|
||||
{ KC_##KQ0, KC_##KQ1, KC_##KQ2, KC_##KQ3, KC_##KQ4, KC_##KQ5, KC_##KQ6, KC_##KQ7 }, \
|
||||
{ KC_##KR0, KC_##KR1, KC_##KR2, KC_##KR3, KC_##KR4, KC_##KR5, KC_##KR6, KC_##KR7 } \
|
||||
/* 0 1 2 3 4 5 6 7 */ \
|
||||
/* A */ { KC_##KA0, KC_NO , KC_##KA2, KC_##KA3, KC_##KA4, KC_##KA5, KC_##KA6, KC_##KA7 }, \
|
||||
/* B */ { KC_NO , KC_##KB1, KC_##KB2, KC_##KB3, KC_NO , KC_##KB5, KC_NO , KC_NO }, \
|
||||
/* C */ { KC_NO , KC_##KC1, KC_##KC2, KC_##KC3, KC_##KC4, KC_##KC5, KC_##KC6, KC_##KC7 }, \
|
||||
/* D */ { KC_##KD0, KC_##KD1, KC_##KD2, KC_NO , KC_##KD4, KC_##KD5, KC_##KD6, KC_##KD7 }, \
|
||||
/* E */ { KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_##KE6, KC_NO }, \
|
||||
/* F */ { KC_NO , KC_NO , KC_NO , KC_NO , KC_##KF4, KC_NO , KC_##KF6, KC_NO }, \
|
||||
/* G */ { KC_##KG0, KC_##KG1, KC_NO , KC_##KG3, KC_##KG4, KC_##KG5, KC_##KG6, KC_##KG7 }, \
|
||||
/* H */ { KC_##KH0, KC_NO , KC_NO , KC_##KH3, KC_##KH4, KC_##KH5, KC_##KH6, KC_##KH7 }, \
|
||||
/* I */ { KC_##KI0, KC_##KI1, KC_##KI2, KC_##KI3, KC_##KI4, KC_##KI5, KC_##KI6, KC_##KI7 }, \
|
||||
/* J */ { KC_##KJ0, KC_##KJ1, KC_NO , KC_##KJ3, KC_##KJ4, KC_##KJ5, KC_##KJ6, KC_##KJ7 }, \
|
||||
/* K */ { KC_##KK0, KC_##KK1, KC_##KK2, KC_##KK3, KC_##KK4, KC_##KK5, KC_##KK6, KC_##KK7 }, \
|
||||
/* L */ { KC_##KL0, KC_##KL1, KC_NO , KC_##KL3, KC_##KL4, KC_##KL5, KC_##KL6, KC_##KL7 }, \
|
||||
/* M */ { KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_##KM5, KC_NO , KC_##KM7 }, \
|
||||
/* N */ { KC_NO , KC_##KN1, KC_##KN2, KC_NO , KC_NO , KC_##KN5, KC_NO , KC_##KN7 }, \
|
||||
/* O */ { KC_##KO0, KC_NO , KC_NO , KC_##KO3, KC_NO , KC_##KO5, KC_NO , KC_##KO7 }, \
|
||||
/* P */ { KC_NO , KC_##KP1, KC_##KP2, KC_NO , KC_NO , KC_NO , KC_NO , KC_##KP7 }, \
|
||||
/* Q */ { KC_NO , KC_NO , KC_##KQ2, KC_NO , KC_NO , KC_NO , KC_NO , KC_##KQ7 }, \
|
||||
/* R */ { KC_NO , KC_NO , KC_NO , KC_NO , KC_##KR4, KC_NO , KC_NO , KC_NO } \
|
||||
}
|
||||
|
||||
#define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)]))
|
||||
|
@ -92,13 +65,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
|
||||
static const uint8_t PROGMEM fn_layer[] = {
|
||||
0, // Fn0
|
||||
0, // Fn1
|
||||
0, // Fn2
|
||||
0, // Fn3
|
||||
0, // Fn4
|
||||
0, // Fn5
|
||||
0, // Fn6
|
||||
0 // Fn7
|
||||
1, // Fn1
|
||||
2, // Fn2
|
||||
3, // Fn3
|
||||
4, // Fn4
|
||||
5, // Fn5
|
||||
6, // Fn6
|
||||
7 // Fn7
|
||||
};
|
||||
|
||||
// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
|
||||
|
@ -114,32 +87,84 @@ static const uint8_t PROGMEM fn_keycode[] = {
|
|||
KC_NO // Fn7
|
||||
};
|
||||
|
||||
/* See common/keycode.h for short name of key symbol. */
|
||||
/*
|
||||
* Tenkeyless keyboard default layout, ISO & ANSI (ISO is next to right shift,
|
||||
* not present on ANSI, other ISO switches move from ANSI layout but are same
|
||||
* switch
|
||||
*
|
||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------.
|
||||
* |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| -| =|Backsp | |Ins|Hom|PgU|
|
||||
* |-----------------------------------------------------------| |-----------|
|
||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
|
||||
* |-----------------------------------------------------------| `-----------'
|
||||
* |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return |
|
||||
* |-----------------------------------------------------------| ,---.
|
||||
* |Shft|ISO| Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
|
||||
* |-----------------------------------------------------------| ,-----------.
|
||||
* |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig|
|
||||
* `-----------------------------------------------------------' `-----------'
|
||||
*/
|
||||
|
||||
|
||||
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Layer 0: Default Layer
|
||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------.
|
||||
* |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|
|
||||
* |-----------------------------------------------------------| |-----------|
|
||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
|
||||
* |-----------------------------------------------------------| `-----------'
|
||||
* |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return |
|
||||
* |-----------------------------------------------------------| ,---.
|
||||
* |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up |
|
||||
* |-----------------------------------------------------------| ,-----------.
|
||||
* |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig|
|
||||
* `-----------------------------------------------------------' `-----------'
|
||||
*/
|
||||
KEYMAP(
|
||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK,
|
||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP,
|
||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN,
|
||||
CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT,
|
||||
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP,
|
||||
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT
|
||||
),
|
||||
/* Layer 0: Default Layer
|
||||
*
|
||||
* ANSI:
|
||||
*
|
||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------.
|
||||
* |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| -| =|Backsp | |Ins|Hom|PgU|
|
||||
* |-----------------------------------------------------------| |-----------|
|
||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD|
|
||||
* |-----------------------------------------------------------| `-----------'
|
||||
* |FN1 | A| S| D| F| G| H| J| K| L| ;| '|Return |
|
||||
* |-----------------------------------------------------------| ,---.
|
||||
* |Shft | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up |
|
||||
* |-----------------------------------------------------------| ,-----------.
|
||||
* |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig|
|
||||
* `-----------------------------------------------------------' `-----------'
|
||||
*/
|
||||
|
||||
KEYMAP(\
|
||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR, SLCK, BRK, \
|
||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, BSPC, INS, HOME, PGUP, \
|
||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, BSLS, DEL, END, PGDN, \
|
||||
FN1, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, \
|
||||
LSFT, 0, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, \
|
||||
LCTL, LGUI, LALT, SPC, RALT, RGUI, APP, RCTL, LEFT, DOWN, RGHT),
|
||||
|
||||
|
||||
/*
|
||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------.
|
||||
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Slp|
|
||||
* `---' `---------------' `---------------' `---------------' `-----------'
|
||||
* ,-----------------------------------------------------------. ,-----------.
|
||||
* |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9|Mut|V- |V+ |Backsp | |Ins|Hom|PgU|
|
||||
* |-----------------------------------------------------------| |-----------|
|
||||
* |Tab | Q| W| E| R| T| Y| U| I|MSt|Ply|Prv|Nxt|Media| |Del|End|PgD|
|
||||
* |-----------------------------------------------------------| `-----------'
|
||||
* |FN1 | A| S| D| F| G| H| J| K| L| ;| '|Return |
|
||||
* |-----------------------------------------------------------| ,---.
|
||||
* |Shft | Z| X|Clc| V| B| N| M| ,| .| /|Caps | |Up |
|
||||
* |-----------------------------------------------------------| ,-----------.
|
||||
* |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig|
|
||||
* `-----------------------------------------------------------' `-----------'
|
||||
*/
|
||||
|
||||
KEYMAP(\
|
||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR, SLCK, SLEP, \
|
||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9,MUTE, VOLD, VOLU, BSPC, INS, HOME, PGUP, \
|
||||
TAB, Q, W, E, R, T, Y, U, I,MSTP,MPLY, MPRV, MNXT, MSEL, DEL, END, PGDN, \
|
||||
FN1, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, \
|
||||
LSFT, NO, Z, X,CALC, V, B, N, M, COMM, DOT, SLSH, CAPS, UP, \
|
||||
LCTL, LGUI, LALT, SPC, RALT, RGUI, APP, RCTL, LEFT, DOWN, RGHT),
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
|
||||
#ifndef DEBOUNCE
|
||||
# define DEBOUNCE 5
|
||||
# define DEBOUNCE 0
|
||||
#endif
|
||||
static uint8_t debouncing = DEBOUNCE;
|
||||
|
||||
|
@ -30,8 +30,6 @@ static matrix_row_t _matrix0[MATRIX_ROWS];
|
|||
static matrix_row_t _matrix1[MATRIX_ROWS];
|
||||
|
||||
|
||||
#define NROW 18
|
||||
#define NCOL 8
|
||||
#define _DDRA (uint8_t *const)&DDRA
|
||||
#define _DDRB (uint8_t *const)&DDRB
|
||||
#define _DDRC (uint8_t *const)&DDRC
|
||||
|
@ -64,35 +62,39 @@ static matrix_row_t _matrix1[MATRIX_ROWS];
|
|||
|
||||
/* Specifies the ports and pin numbers for the rows */
|
||||
static
|
||||
uint8_t *const row_ddr[NROW] = { _DDRB, _DDRB,
|
||||
_DDRC, _DDRC,
|
||||
_DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD,
|
||||
_DDRF, _DDRF, _DDRF, _DDRF, _DDRF, _DDRF};
|
||||
uint8_t *const row_ddr[MATRIX_ROWS] = {
|
||||
_DDRB, _DDRB,
|
||||
_DDRC, _DDRC,
|
||||
_DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD,
|
||||
_DDRF, _DDRF, _DDRF, _DDRF, _DDRF, _DDRF};
|
||||
|
||||
static
|
||||
uint8_t *const row_port[NROW] = { _PORTB, _PORTB,
|
||||
_PORTC, _PORTC,
|
||||
_PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD,
|
||||
_PORTF, _PORTF, _PORTF, _PORTF, _PORTF, _PORTF};
|
||||
uint8_t *const row_port[MATRIX_ROWS] = {
|
||||
_PORTB, _PORTB,
|
||||
_PORTC, _PORTC,
|
||||
_PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD,
|
||||
_PORTF, _PORTF, _PORTF, _PORTF, _PORTF, _PORTF};
|
||||
|
||||
static
|
||||
uint8_t *const row_pin[NROW] = { _PINB, _PINB,
|
||||
_PINC, _PINC,
|
||||
_PIND, _PIND, _PIND, _PIND, _PIND, _PIND, _PIND, _PIND,
|
||||
_PINF, _PINF, _PINF, _PINF, _PINF, _PINF};
|
||||
uint8_t *const row_pin[MATRIX_ROWS] = {
|
||||
_PINB, _PINB,
|
||||
_PINC, _PINC,
|
||||
_PIND, _PIND, _PIND, _PIND, _PIND, _PIND, _PIND, _PIND,
|
||||
_PINF, _PINF, _PINF, _PINF, _PINF, _PINF};
|
||||
|
||||
static
|
||||
const uint8_t row_bit[NROW] = { _BIT4, _BIT7,
|
||||
_BIT6, _BIT7,
|
||||
_BIT0, _BIT1, _BIT2, _BIT3, _BIT4, _BIT5, _BIT6, _BIT7,
|
||||
_BIT0, _BIT1, _BIT4, _BIT5, _BIT6, _BIT7};
|
||||
const uint8_t row_bit[MATRIX_ROWS] = {
|
||||
_BIT4, _BIT7,
|
||||
_BIT6, _BIT7,
|
||||
_BIT0, _BIT1, _BIT2, _BIT3, _BIT4, _BIT5, _BIT6, _BIT7,
|
||||
_BIT0, _BIT1, _BIT4, _BIT5, _BIT6, _BIT7};
|
||||
|
||||
static
|
||||
const uint8_t mask = 0x0E;
|
||||
|
||||
/* Specifies the ports and pin numbers for the columns */
|
||||
static
|
||||
const uint8_t col_bit[NCOL] = { 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E};
|
||||
const uint8_t col_bit[MATRIX_COLS] = { 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E};
|
||||
|
||||
static
|
||||
inline void pull_column(int col) {
|
||||
|
@ -110,7 +112,7 @@ void setup_io_pins(void) {
|
|||
uint8_t row;
|
||||
DDRB |= 0x0E;
|
||||
PORTB &= ~0x0E;
|
||||
for(row = 0; row < NROW; row++) {
|
||||
for(row = 0; row < MATRIX_ROWS; row++) {
|
||||
*row_ddr[row] &= ~row_bit[row];
|
||||
*row_port[row] &= ~row_bit[row];
|
||||
}
|
||||
|
@ -140,7 +142,7 @@ void matrix_init(void)
|
|||
// To use PORTF disable JTAG with writing JTD bit twice within four cycles.
|
||||
MCUCR |= (1<<JTD);
|
||||
MCUCR |= (1<<JTD);
|
||||
|
||||
|
||||
// initialize row and col
|
||||
setup_io_pins();
|
||||
setup_leds();
|
||||
|
@ -160,10 +162,10 @@ uint8_t matrix_scan(void)
|
|||
matrix = tmp;
|
||||
}
|
||||
|
||||
for (uint8_t col = 0; col < NCOL; col++) { // 0-7
|
||||
for (uint8_t col = 0; col < MATRIX_COLS; col++) { // 0-7
|
||||
pull_column(col); // output hi on theline
|
||||
_delay_us(1); // without this wait it won't read stable value.
|
||||
for (uint8_t row = 0; row < NROW; row++) { // 0-17
|
||||
_delay_us(3); // without this wait it won't read stable value.
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) { // 0-17
|
||||
bool prev_bit = matrix[row] & (1<<col);
|
||||
bool curr_bit = *row_pin[row] & row_bit[row];
|
||||
if (prev_bit != curr_bit) {
|
||||
|
|
|
@ -128,7 +128,7 @@ static const uint8_t PROGMEM endpoint_config_table[] = {
|
|||
// spec and relevant portions of any USB class specifications!
|
||||
|
||||
|
||||
static uint8_t PROGMEM device_descriptor[] = {
|
||||
static const uint8_t PROGMEM device_descriptor[] = {
|
||||
18, // bLength
|
||||
1, // bDescriptorType
|
||||
0x00, 0x02, // bcdUSB
|
||||
|
@ -146,7 +146,7 @@ static uint8_t PROGMEM device_descriptor[] = {
|
|||
};
|
||||
|
||||
// Keyboard Protocol 1, HID 1.11 spec, Appendix B, page 59-60
|
||||
static uint8_t PROGMEM keyboard_hid_report_desc[] = {
|
||||
static const uint8_t PROGMEM keyboard_hid_report_desc[] = {
|
||||
0x05, 0x01, // Usage Page (Generic Desktop),
|
||||
0x09, 0x06, // Usage (Keyboard),
|
||||
0xA1, 0x01, // Collection (Application),
|
||||
|
@ -181,7 +181,7 @@ static uint8_t PROGMEM keyboard_hid_report_desc[] = {
|
|||
0xc0 // End Collection
|
||||
};
|
||||
#ifdef NKRO_ENABLE
|
||||
static uint8_t PROGMEM keyboard2_hid_report_desc[] = {
|
||||
static const uint8_t PROGMEM keyboard2_hid_report_desc[] = {
|
||||
0x05, 0x01, // Usage Page (Generic Desktop),
|
||||
0x09, 0x06, // Usage (Keyboard),
|
||||
0xA1, 0x01, // Collection (Application),
|
||||
|
@ -222,7 +222,7 @@ static uint8_t PROGMEM keyboard2_hid_report_desc[] = {
|
|||
// http://www.microchip.com/forums/tm.aspx?high=&m=391435&mpage=1#391521
|
||||
// http://www.keil.com/forum/15671/
|
||||
// http://www.microsoft.com/whdc/device/input/wheel.mspx
|
||||
static uint8_t PROGMEM mouse_hid_report_desc[] = {
|
||||
static const uint8_t PROGMEM mouse_hid_report_desc[] = {
|
||||
/* mouse */
|
||||
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
|
||||
0x09, 0x02, // USAGE (Mouse)
|
||||
|
@ -273,7 +273,7 @@ static uint8_t PROGMEM mouse_hid_report_desc[] = {
|
|||
};
|
||||
#endif
|
||||
|
||||
static uint8_t PROGMEM debug_hid_report_desc[] = {
|
||||
static const uint8_t PROGMEM debug_hid_report_desc[] = {
|
||||
0x06, 0x31, 0xFF, // Usage Page 0xFF31 (vendor defined)
|
||||
0x09, 0x74, // Usage 0x74
|
||||
0xA1, 0x53, // Collection 0x53
|
||||
|
@ -289,7 +289,7 @@ static uint8_t PROGMEM debug_hid_report_desc[] = {
|
|||
#ifdef EXTRAKEY_ENABLE
|
||||
// audio controls & system controls
|
||||
// http://www.microsoft.com/whdc/archive/w2kbd.mspx
|
||||
static uint8_t PROGMEM extra_hid_report_desc[] = {
|
||||
static const uint8_t PROGMEM extra_hid_report_desc[] = {
|
||||
/* system control */
|
||||
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
|
||||
0x09, 0x80, // USAGE (System Control)
|
||||
|
@ -348,7 +348,7 @@ static uint8_t PROGMEM extra_hid_report_desc[] = {
|
|||
|
||||
#define NUM_INTERFACES (KBD2_HID_DESC_NUM + 1)
|
||||
#define CONFIG1_DESC_SIZE (9+(9+9+7)*NUM_INTERFACES)
|
||||
static uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = {
|
||||
static const uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = {
|
||||
// configuration descriptor, USB spec 9.6.3, page 264-266, Table 9-10
|
||||
9, // bLength;
|
||||
2, // bDescriptorType;
|
||||
|
@ -515,17 +515,17 @@ struct usb_string_descriptor_struct {
|
|||
uint8_t bDescriptorType;
|
||||
int16_t wString[];
|
||||
};
|
||||
static struct usb_string_descriptor_struct PROGMEM string0 = {
|
||||
static const struct usb_string_descriptor_struct PROGMEM string0 = {
|
||||
4,
|
||||
3,
|
||||
{0x0409}
|
||||
};
|
||||
static struct usb_string_descriptor_struct PROGMEM string1 = {
|
||||
static const struct usb_string_descriptor_struct PROGMEM string1 = {
|
||||
sizeof(STR_MANUFACTURER),
|
||||
3,
|
||||
STR_MANUFACTURER
|
||||
};
|
||||
static struct usb_string_descriptor_struct PROGMEM string2 = {
|
||||
static const struct usb_string_descriptor_struct PROGMEM string2 = {
|
||||
sizeof(STR_PRODUCT),
|
||||
3,
|
||||
STR_PRODUCT
|
||||
|
@ -533,7 +533,7 @@ static struct usb_string_descriptor_struct PROGMEM string2 = {
|
|||
|
||||
// This table defines which descriptor data is sent for each specific
|
||||
// request from the host (in wValue and wIndex).
|
||||
static struct descriptor_list_struct {
|
||||
static const struct descriptor_list_struct {
|
||||
uint16_t wValue; // descriptor type
|
||||
uint16_t wIndex;
|
||||
const uint8_t *addr;
|
||||
|
|
Loading…
Reference in a new issue