diff options
author | TerryMathews <terry@terrymathews.net> | 2016-12-31 13:19:05 -0500 |
---|---|---|
committer | TerryMathews <terry@terrymathews.net> | 2016-12-31 13:19:05 -0500 |
commit | 925ed44405c979f0b37e9d12bb088738cd33e04e (patch) | |
tree | 2b43afa4e425201bf684ebec23c1c76ae9cc24a6 | |
parent | 6dbcc50f564e8df3e29190425747b56a4ad605c2 (diff) | |
download | qmk_firmware-925ed44405c979f0b37e9d12bb088738cd33e04e.tar.gz qmk_firmware-925ed44405c979f0b37e9d12bb088738cd33e04e.zip |
Establish support for AMJPAD
-rw-r--r-- | keyboards/amjpad/Makefile | 3 | ||||
-rw-r--r-- | keyboards/amjpad/amjpad.c | 30 | ||||
-rw-r--r-- | keyboards/amjpad/amjpad.h | 46 | ||||
-rw-r--r-- | keyboards/amjpad/config.h | 94 | ||||
-rw-r--r-- | keyboards/amjpad/keymaps/default/keymap.c | 101 | ||||
-rw-r--r-- | keyboards/amjpad/rules.mk | 66 |
6 files changed, 340 insertions, 0 deletions
diff --git a/keyboards/amjpad/Makefile b/keyboards/amjpad/Makefile new file mode 100644 index 000000000..4e2a6f00f --- /dev/null +++ b/keyboards/amjpad/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | ifndef MAKEFILE_INCLUDED | ||
2 | include ../../Makefile | ||
3 | endif \ No newline at end of file | ||
diff --git a/keyboards/amjpad/amjpad.c b/keyboards/amjpad/amjpad.c new file mode 100644 index 000000000..ac5991bd0 --- /dev/null +++ b/keyboards/amjpad/amjpad.c | |||
@@ -0,0 +1,30 @@ | |||
1 | #include "amjpad.h" | ||
2 | #include "led.h" | ||
3 | |||
4 | void matrix_init_kb(void) { | ||
5 | // put your keyboard start-up code here | ||
6 | // runs once when the firmware starts up | ||
7 | matrix_init_user(); | ||
8 | led_init_ports(); | ||
9 | }; | ||
10 | |||
11 | void matrix_scan_kb(void) { | ||
12 | // put your looping keyboard code here | ||
13 | // runs every cycle (a lot) | ||
14 | matrix_scan_user(); | ||
15 | }; | ||
16 | |||
17 | void led_init_ports(void) { | ||
18 | // * Set our LED pins as output | ||
19 | DDRD |= (1<<6); | ||
20 | } | ||
21 | |||
22 | void led_set_kb(uint8_t usb_led) { | ||
23 | if (usb_led & (1<<USB_LED_NUM_LOCK)) { | ||
24 | // Turn numlock on | ||
25 | PORTD &= ~(1<<6); | ||
26 | } else { | ||
27 | // Turn numlock off | ||
28 | PORTD |= (1<<6); | ||
29 | } | ||
30 | } | ||
diff --git a/keyboards/amjpad/amjpad.h b/keyboards/amjpad/amjpad.h new file mode 100644 index 000000000..b9b4d3686 --- /dev/null +++ b/keyboards/amjpad/amjpad.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef AMJPAD_H | ||
2 | #define ADMJPAD_H | ||
3 | |||
4 | #include "quantum.h" | ||
5 | |||
6 | // readability | ||
7 | #define XXX KC_NO | ||
8 | |||
9 | /* AMJPAD matrix layout | ||
10 | * ,-------------------. | ||
11 | * | 00 | 01 | 02 | 03 | | ||
12 | * |----|----|----|----| | ||
13 | * | 10 | 11 | 12 | 13 | | ||
14 | * |----|----|----|----| | ||
15 | * | 20 | 21 | 22 | | | ||
16 | * |----|----|----| 23 | | ||
17 | * | 30 | 31 | 32 | | | ||
18 | * |----|----|----|----| | ||
19 | * | 40 | 41 | 42 | | | ||
20 | * |----|----|----| 43 | | ||
21 | * | 50 | 52 | | | ||
22 | * `-------------------' | ||
23 | */ | ||
24 | // The first section contains all of the arguments | ||
25 | // The second converts the arguments into a two-dimensional array | ||
26 | #define KEYMAP( \ | ||
27 | k00, k01, k02, k03, \ | ||
28 | k10, k11, k12, k13, \ | ||
29 | k20, k21, k22, k23, \ | ||
30 | k30, k31, k32, \ | ||
31 | k40, k41, k42, k43, \ | ||
32 | k50, k52 \ | ||
33 | ) \ | ||
34 | { \ | ||
35 | {k00, k01, k02, k03}, \ | ||
36 | {k10, k11, k12, k13}, \ | ||
37 | {k20, k21, k22, k23}, \ | ||
38 | {k30, k31, k32, XXX}, \ | ||
39 | {k40, k41, k42, k43}, \ | ||
40 | {k50, XXX, k52, XXX} \ | ||
41 | } | ||
42 | |||
43 | void matrix_init_user(void); | ||
44 | void matrix_scan_user(void); | ||
45 | |||
46 | #endif | ||
diff --git a/keyboards/amjpad/config.h b/keyboards/amjpad/config.h new file mode 100644 index 000000000..1a26d2ab6 --- /dev/null +++ b/keyboards/amjpad/config.h | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #ifndef CONFIG_H | ||
19 | #define CONFIG_H | ||
20 | |||
21 | #include "config_common.h" | ||
22 | |||
23 | /* USB Device descriptor parameter */ | ||
24 | #define VENDOR_ID 0xFEED | ||
25 | #define PRODUCT_ID 0x6060 | ||
26 | #define DEVICE_VER 0x0003 | ||
27 | #define MANUFACTURER AMJ | ||
28 | #define PRODUCT PAD | ||
29 | #define DESCRIPTION QMK keyboard firmware for AMJ PAD | ||
30 | |||
31 | /* key matrix size */ | ||
32 | #define MATRIX_ROWS 6 | ||
33 | #define MATRIX_COLS 4 | ||
34 | |||
35 | // ROWS: Top to bottom, COLS: Left to right | ||
36 | |||
37 | #define MATRIX_ROW_PINS { F7, F6, F5, F4, D5, D0 } | ||
38 | #define MATRIX_COL_PINS { F1, F0, E6, C7 } | ||
39 | #define UNUSED_PINS | ||
40 | |||
41 | #define BACKLIGHT_PIN B6 | ||
42 | |||
43 | /* COL2ROW or ROW2COL */ | ||
44 | #define DIODE_DIRECTION COL2ROW | ||
45 | |||
46 | /* define if matrix has ghost */ | ||
47 | //#define MATRIX_HAS_GHOST | ||
48 | |||
49 | /* Set 0 if debouncing isn't needed */ | ||
50 | #define DEBOUNCING_DELAY 5 | ||
51 | |||
52 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
53 | #define LOCKING_SUPPORT_ENABLE | ||
54 | /* Locking resynchronize hack */ | ||
55 | #define LOCKING_RESYNC_ENABLE | ||
56 | |||
57 | /* key combination for command */ | ||
58 | #define IS_COMMAND() ( \ | ||
59 | keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
60 | ) | ||
61 | |||
62 | /* Backlight configuration | ||
63 | */ | ||
64 | #define BACKLIGHT_LEVELS 4 | ||
65 | |||
66 | /* Underlight configuration | ||
67 | */ | ||
68 | |||
69 | #define RGB_DI_PIN E2 | ||
70 | #define RGBLIGHT_ANIMATIONS | ||
71 | #define RGBLED_NUM 8 // Number of LEDs | ||
72 | #define RGBLIGHT_HUE_STEP 10 | ||
73 | #define RGBLIGHT_SAT_STEP 17 | ||
74 | #define RGBLIGHT_VAL_STEP 17 | ||
75 | |||
76 | /* | ||
77 | * Feature disable options | ||
78 | * These options are also useful to firmware size reduction. | ||
79 | */ | ||
80 | |||
81 | /* disable debug print */ | ||
82 | //#define NO_DEBUG | ||
83 | |||
84 | /* disable print */ | ||
85 | //#define NO_PRINT | ||
86 | |||
87 | /* disable action features */ | ||
88 | //#define NO_ACTION_LAYER | ||
89 | //#define NO_ACTION_TAPPING | ||
90 | //#define NO_ACTION_ONESHOT | ||
91 | //#define NO_ACTION_MACRO | ||
92 | //#define NO_ACTION_FUNCTION | ||
93 | |||
94 | #endif | ||
diff --git a/keyboards/amjpad/keymaps/default/keymap.c b/keyboards/amjpad/keymaps/default/keymap.c new file mode 100644 index 000000000..362afd107 --- /dev/null +++ b/keyboards/amjpad/keymaps/default/keymap.c | |||
@@ -0,0 +1,101 @@ | |||
1 | #include "amjpad.h" | ||
2 | |||
3 | #ifdef RGBLIGHT_ENABLE | ||
4 | #include "rgblight.h" | ||
5 | #endif | ||
6 | |||
7 | // Used for SHIFT_ESC | ||
8 | #define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) | ||
9 | |||
10 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
11 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
12 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
13 | // entirely and just use numbers. | ||
14 | #define _BL 0 | ||
15 | #define _FL 1 | ||
16 | |||
17 | #define _______ KC_TRNS | ||
18 | |||
19 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
20 | /* Keymap _BL: (Base Layer) Default Layer | ||
21 | * ,-------------------. | ||
22 | * |Esc |TAB |BS | = | | ||
23 | * |----|----|----|----| | ||
24 | * | NL | / | * | - | | ||
25 | * |----|----|----|----| | ||
26 | * | 7 | 8 | 9 | | | ||
27 | * |----|----|----| + | | ||
28 | * | 4 | 5 | 6 | | | ||
29 | * |----|----|----|----| | ||
30 | * | 1 | 2 | 3 | | | ||
31 | * |----|----|----| En | | ||
32 | * | 0 |./FN| | | ||
33 | * `-------------------' | ||
34 | */ | ||
35 | |||
36 | [_BL] = KEYMAP( | ||
37 | KC_ESC,KC_TAB,KC_BSPC,KC_PEQL, \ | ||
38 | KC_NLCK,KC_PSLS,KC_PAST,KC_PMNS, \ | ||
39 | KC_P7, KC_P8, KC_P9, KC_PPLS, \ | ||
40 | KC_P4, KC_P5, KC_P6, \ | ||
41 | KC_P1, KC_P2, KC_P3, KC_PENT, \ | ||
42 | KC_P0, LT(_FL,KC_PDOT)), | ||
43 | |||
44 | /* Keymap _FL: Function Layer | ||
45 | * ,-------------------. | ||
46 | * |Esc |TAB |BS | = | | ||
47 | * |----|----|----|----| | ||
48 | * | NL | / | * | - | | ||
49 | * |----|----|----|----| | ||
50 | * | 7 | 8 | 9 | | | ||
51 | * |----|----|----|RST | | ||
52 | * | 4 | 5 | 6 | | | ||
53 | * |----|----|----|----| | ||
54 | * | 1 | 2 | 3 | | | ||
55 | * |----|----|----| En | | ||
56 | * | 0 |./FN| | | ||
57 | * `-------------------' | ||
58 | */ | ||
59 | [_FL] = KEYMAP( | ||
60 | |||
61 | KC_ESC,KC_TAB,KC_BSPC,KC_PEQL, \ | ||
62 | KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \ | ||
63 | KC_P7, KC_P8, KC_P9, RESET, \ | ||
64 | KC_P4, KC_P5, KC_P6, \ | ||
65 | KC_P1, KC_P2, KC_P3, KC_PENT, \ | ||
66 | KC_P0, LT(_FL,KC_PDOT)), | ||
67 | }; | ||
68 | |||
69 | enum function_id { | ||
70 | SHIFT_ESC, | ||
71 | }; | ||
72 | |||
73 | const uint16_t PROGMEM fn_actions[] = { | ||
74 | [0] = ACTION_FUNCTION(SHIFT_ESC), | ||
75 | }; | ||
76 | |||
77 | void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { | ||
78 | static uint8_t shift_esc_shift_mask; | ||
79 | switch (id) { | ||
80 | case SHIFT_ESC: | ||
81 | shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK; | ||
82 | if (record->event.pressed) { | ||
83 | if (shift_esc_shift_mask) { | ||
84 | add_key(KC_GRV); | ||
85 | send_keyboard_report(); | ||
86 | } else { | ||
87 | add_key(KC_ESC); | ||
88 | send_keyboard_report(); | ||
89 | } | ||
90 | } else { | ||
91 | if (shift_esc_shift_mask) { | ||
92 | del_key(KC_GRV); | ||
93 | send_keyboard_report(); | ||
94 | } else { | ||
95 | del_key(KC_ESC); | ||
96 | send_keyboard_report(); | ||
97 | } | ||
98 | } | ||
99 | break; | ||
100 | } | ||
101 | } | ||
diff --git a/keyboards/amjpad/rules.mk b/keyboards/amjpad/rules.mk new file mode 100644 index 000000000..d8ec42365 --- /dev/null +++ b/keyboards/amjpad/rules.mk | |||
@@ -0,0 +1,66 @@ | |||
1 | |||
2 | # MCU name | ||
3 | #MCU = at90usb1287 | ||
4 | MCU = atmega32u4 | ||
5 | |||
6 | # Processor frequency. | ||
7 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
8 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
9 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
10 | # automatically to create a 32-bit value in your source code. | ||
11 | # | ||
12 | # This will be an integer division of F_USB below, as it is sourced by | ||
13 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
14 | # does not *change* the processor frequency - it should merely be updated to | ||
15 | # reflect the processor speed set externally so that the code can use accurate | ||
16 | # software delays. | ||
17 | F_CPU = 16000000 | ||
18 | |||
19 | |||
20 | # | ||
21 | # LUFA specific | ||
22 | # | ||
23 | # Target architecture (see library "Board Types" documentation). | ||
24 | ARCH = AVR8 | ||
25 | |||
26 | # Input clock frequency. | ||
27 | # This will define a symbol, F_USB, in all source code files equal to the | ||
28 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
29 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
30 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
31 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
32 | # at the end, this will be done automatically to create a 32-bit value in your | ||
33 | # source code. | ||
34 | # | ||
35 | # If no clock division is performed on the input clock inside the AVR (via the | ||
36 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
37 | F_USB = $(F_CPU) | ||
38 | |||
39 | # Interrupt driven control endpoint task(+60) | ||
40 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
41 | |||
42 | |||
43 | # Boot Section Size in *bytes* | ||
44 | # Teensy halfKay 512 | ||
45 | # Teensy++ halfKay 1024 | ||
46 | # Atmel DFU loader 4096 | ||
47 | # LUFA bootloader 4096 | ||
48 | # USBaspLoader 2048 | ||
49 | OPT_DEFS += -DBOOTLOADER_SIZE=4096 | ||
50 | |||
51 | |||
52 | # Build Options | ||
53 | # comment out to disable the options. | ||
54 | # | ||
55 | BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) | ||
56 | MOUSEKEY_ENABLE ?= no # Mouse keys(+4700) | ||
57 | EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) | ||
58 | CONSOLE_ENABLE ?= yes # Console for debug(+400) | ||
59 | COMMAND_ENABLE ?= yes # Commands for debug and configuration | ||
60 | NKRO_ENABLE ?= yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
61 | RGBLIGHT_ENABLE ?= no # Enable keyboard underlight functionality (+4870) | ||
62 | BACKLIGHT_ENABLE ?= yes # Enable keyboard backlight functionality (+1150) | ||
63 | MIDI_ENABLE ?= no # MIDI controls | ||
64 | AUDIO_ENABLE ?= no | ||
65 | UNICODE_ENABLE ?= no # Unicode | ||
66 | BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID | ||