Merge branch 'master' of https://github.com/jackhumbert/qmk_firmware
This commit is contained in:
commit
d649ab3433
244 changed files with 3622 additions and 21395 deletions
105
README.md
105
README.md
|
|
@ -85,6 +85,7 @@ The following shortcuts automatically add `LSFT()` to keycodes to get commonly u
|
|||
KC_RPRN )
|
||||
KC_UNDS _
|
||||
KC_PLUS +
|
||||
KC_DQUO "
|
||||
KC_LCBR {
|
||||
KC_RCBR }
|
||||
KC_LABK <
|
||||
|
|
@ -118,6 +119,56 @@ We've added shortcuts to make common modifier/tap (mod-tap) mappings more compac
|
|||
* `LCAG_T(kc)` - is CtrlAltGui when held and *kc* when tapped
|
||||
* `MEH_T(kc)` - is like Hyper, but not as cool -- does not include the Cmd/Win key, so just sends Alt+Ctrl+Shift.
|
||||
|
||||
### Space Cadet Shift: The future, built in
|
||||
|
||||
Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) the Space Cadet Shift quite well. Essentially, you hit the left Shift on its own, and you get an opening parenthesis; hit the right Shift on its own, and you get the closing one. When hit with other keys, the Shift key keeps working as it always does. Yes, it's as cool as it sounds.
|
||||
|
||||
To use it, use `KC_LSPO` (Left Shift, Parens Open) for your left Shift on your keymap, and `KC_RSPC` (Right Shift, Parens Close) for your right Shift.
|
||||
|
||||
The only other thing you're going to want to do is create a `makefile.mk` in your keymap directory and set the following:
|
||||
|
||||
```
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
```
|
||||
|
||||
This is just to keep the keyboard from going into command mode when you hold both Shift keys at the same time.
|
||||
|
||||
### The Leader key: A new kind of modifier
|
||||
|
||||
If you've ever used Vim, you know what a Leader key is. If not, you're about to discover a wonderful concept. :) Instead of hitting Alt+Shift+W for example (holding down three keys at the same time), what if you could hit a _sequence_ of keys instead? So you'd hit our special modifier (the Leader key), followed by W and then C (just a rapid succession of keys), and something would happen.
|
||||
|
||||
That's what `KC_LEAD` does. Here's an example:
|
||||
|
||||
1. Pick a key on your keyboard you want to use as the Leader key. Assign it the keycode `KC_LEAD`. This key would be dedicated just for this -- it's a single action key, can't be used for anything else.
|
||||
2. Include the line `#define LEADER_TIMEOUT 300` somewhere in your keymap.c file, probably near the top. The 300 there is 300ms -- that's how long you have for the sequence of keys following the leader. You can tweak this value for comfort, of course.
|
||||
3. Within your `matrix_scan_user` function, do something like this:
|
||||
|
||||
```
|
||||
void matrix_scan_user(void) {
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_ONE_KEY(KC_F) {
|
||||
register_code(KC_S);
|
||||
unregister_code(KC_S);
|
||||
}
|
||||
SEQ_TWO_KEYS(KC_A, KC_S) {
|
||||
register_code(KC_H);
|
||||
unregister_code(KC_H);
|
||||
}
|
||||
SEQ_THREE_KEYS(KC_A, KC_S, KC_D) {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_S);
|
||||
unregister_code(KC_S);
|
||||
unregister_code(KC_LGUI);
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
As you can see, you have three function. you can use - `SEQ_ONE_KEY` for single-key sequences (Leader followed by just one key), and `SEQ_TWO_KEYS` and `SEQ_THREE_.EYS` for longer sequences. Each of these accepts one or more keycodes as arguments. This is an important point: You can use keycodes from **any layer on your keyboard**. That layer would need to be active for the leader macro to fire, obviously.
|
||||
|
||||
### Temporarily setting the default layer
|
||||
|
||||
`DF(layer)` - sets default layer to *layer*. The default layer is the one at the "bottom" of the layer stack - the ultimate fallback layer. This currently does not persist over power loss. When you plug the keyboard back in, layer 0 will always be the default. It is theoretically possible to work around that, but that's not what `DF` does.
|
||||
|
|
@ -258,9 +309,9 @@ if (timer_elapsed(key_timer) < 100) {
|
|||
}
|
||||
```
|
||||
|
||||
It's best to declare the `static uint16_t key_timer;` outside of the macro block (top of file, etc).
|
||||
It's best to declare the `static uint16_t key_timer;` outside of the macro block (top of file, etc).
|
||||
|
||||
#### Example 1: Single-key copy/paste (hold to copy, tap to paste)
|
||||
#### Example: Single-key copy/paste (hold to copy, tap to paste)
|
||||
|
||||
With QMK, it's easy to make one key do two things, as long as one of those things is being a modifier. :) So if you want a key to act as Ctrl when held and send the letter R when tapped, that's easy: `CTL_T(KC_R)`. But what do you do when you want that key to send Ctrl-V (paste) when tapped, and Ctrl-C (copy) when held?
|
||||
|
||||
|
|
@ -276,7 +327,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
|||
case 0: {
|
||||
if (record->event.pressed) {
|
||||
key_timer = timer_read(); // if the key is being pressed, we start the timer.
|
||||
}
|
||||
}
|
||||
else { // this means the key was just released, so we can figure out how long it was pressed for (tap or "held down").
|
||||
if (timer_elapsed(key_timer) > 150) { // 150 being 150ms, the threshhold we pick for counting something as a tap.
|
||||
return MACRO( D(LCTL), T(C), U(LCTL), END );
|
||||
|
|
@ -294,52 +345,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
|||
|
||||
And then, to assign this macro to a key on your keyboard layout, you just use `M(0)` on the key you want to press for copy/paste.
|
||||
|
||||
#### Example 2: Space Cadet Shift (making it easy to send opening and closing parentheses)
|
||||
|
||||
In the [Modern Space Cadet Keyboard](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/#shift-parentheses), one of cooler features is the Shift Parentheses. To quote Steve Losh:
|
||||
|
||||
> When held while pressing other keys, act like Shift.
|
||||
> When pressed and released on their own, type an opening or closing parenthesis (left and right shift respectively).
|
||||
|
||||
```
|
||||
static uint16_t key_timer;
|
||||
|
||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||
{
|
||||
switch(id) {
|
||||
case 0: {
|
||||
if (record->event.pressed) {
|
||||
key_timer = timer_read(); // if the key is being pressed, we start the timer.
|
||||
register_code(KC_LSFT); // we're now holding down Shift.
|
||||
} else { // this means the key was just released, so we can figure out how long it was pressed for (tap or "held down").
|
||||
if (timer_elapsed(key_timer) < 150) { // 150 being 150ms, the threshhold we pick for counting something as a tap.
|
||||
register_code(KC_9); // sending 9 while Shift is held down gives us an opening paren
|
||||
unregister_code(KC_9); // now let's let go of that key
|
||||
}
|
||||
unregister_code(KC_LSFT); // let's release the Shift key now.
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
if (record->event.pressed) {
|
||||
key_timer = timer_read(); // Now we're doing the same thing, only for the right shift/close paren key
|
||||
register_code(KC_RSFT);
|
||||
} else {
|
||||
if (timer_elapsed(key_timer) < 150) {
|
||||
register_code(KC_0);
|
||||
unregister_code(KC_0);
|
||||
}
|
||||
unregister_code(KC_RSFT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return MACRO_NONE;
|
||||
};
|
||||
```
|
||||
|
||||
And then, to assign this macro to a key on your keyboard layout, you just use `M(0)` on the key you want to press for left shift/opening parens, and `M(1)` for right shift/closing parens.
|
||||
|
||||
## Additional keycode aliases for software-implemented layouts (Colemak, Dvorak, etc)
|
||||
|
||||
Everything is assuming you're in Qwerty (in software) by default, but there is built-in support for using a Colemak or Dvorak layout by including this at the top of your keymap:
|
||||
|
|
@ -510,4 +515,4 @@ what things are (and likely aren't) too risky.
|
|||
- EEPROM has around a 100000 write cycle. You shouldn't rewrite the
|
||||
firmware repeatedly and continually; that'll burn the EEPROM
|
||||
eventually.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,95 +0,0 @@
|
|||
#----------------------------------------------------------------------------
|
||||
# On command line:
|
||||
#
|
||||
# make all = Make software.
|
||||
#
|
||||
# make clean = Clean out built project files.
|
||||
#
|
||||
# make coff = Convert ELF to AVR COFF.
|
||||
#
|
||||
# make extcoff = Convert ELF to AVR Extended COFF.
|
||||
#
|
||||
# make program = Download the hex file to the device.
|
||||
# Please customize your programmer settings(PROGRAM_CMD)
|
||||
#
|
||||
# make teensy = Download the hex file to the device, using teensy_loader_cli.
|
||||
# (must have teensy_loader_cli installed).
|
||||
#
|
||||
# make dfu = Download the hex file to the device, using dfu-programmer (must
|
||||
# have dfu-programmer installed).
|
||||
#
|
||||
# make flip = Download the hex file to the device, using Atmel FLIP (must
|
||||
# have Atmel FLIP installed).
|
||||
#
|
||||
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
|
||||
# (must have dfu-programmer installed).
|
||||
#
|
||||
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
|
||||
# (must have Atmel FLIP installed).
|
||||
#
|
||||
# make debug = Start either simulavr or avarice as specified for debugging,
|
||||
# with avr-gdb or avr-insight as the front end for debugging.
|
||||
#
|
||||
# make filename.s = Just compile filename.c into the assembler code only.
|
||||
#
|
||||
# make filename.i = Create a preprocessed source file for use in submitting
|
||||
# bug reports to the GCC project.
|
||||
#
|
||||
# To rebuild project do "make clean" then "make all".
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = IIgs_Standard
|
||||
|
||||
# Directory common source filess exist
|
||||
TMK_DIR = ../../tmk_core
|
||||
|
||||
# Directory keyboard dependent files exist
|
||||
TARGET_DIR = .
|
||||
|
||||
# keyboard dependent files
|
||||
SRC = keymap.c \
|
||||
matrix.c \
|
||||
led.c
|
||||
|
||||
CONFIG_H = config.h
|
||||
|
||||
|
||||
# MCU name, you MUST set this to match the board you are using
|
||||
# type "make clean" after changing this, so all files will be rebuilt
|
||||
#MCU = at90usb162 # Teensy 1.0
|
||||
#MCU = atmega32u4 # Teensy 2.0
|
||||
#MCU = at90usb646 # Teensy++ 1.0
|
||||
MCU = at90usb1286 # Teensy++ 2.0
|
||||
|
||||
|
||||
# Processor frequency.
|
||||
# Normally the first thing your program should do is set the clock prescaler,
|
||||
# so your program will run at the correct speed. You should also set this
|
||||
# variable to same clock speed. The _delay_ms() macro uses this, and many
|
||||
# examples use this variable to calculate timings. Do not add a "UL" here.
|
||||
F_CPU = 16000000
|
||||
|
||||
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
MOUSEKEY_ENABLE = no # 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
|
||||
|
||||
|
||||
|
||||
# Search Path
|
||||
VPATH += $(TARGET_DIR)
|
||||
VPATH += $(TMK_DIR)
|
||||
|
||||
include $(TMK_DIR)/protocol/pjrc.mk
|
||||
include $(TMK_DIR)/common.mk
|
||||
include $(TMK_DIR)/rules.mk
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
Replaceable USB Controller for Apple IIgs/Standard(M0116)
|
||||
JeffreySung(nattyman@gmail.com)
|
||||
|
||||
===============================
|
||||
|
||||
Feature
|
||||
-------
|
||||
- Replaceable keyboard controller for Apple IIgs(A9M0330)/Standard(M0116)
|
||||
- Teensy++ 2.0 required
|
||||
- Some signal bypass required
|
||||
- ADB keyboard doesn't use matrix for modifier keys. With virtual row for modifier keys,
|
||||
these keys are merged into key matrix using virtual row.
|
||||
|
||||
History
|
||||
=======
|
||||
- 2012.09.17 First Release
|
||||
- 2012.09.17 CapsLock support
|
||||
- 2012.09.19 Power button added
|
||||
Build
|
||||
=====
|
||||
0. Just Type "Make" and return.
|
||||
|
||||
Hardware
|
||||
========
|
||||
PJRC Teensy
|
||||
-----------
|
||||
0. The following ports should not be connected to board.
|
||||
From top view of Teensy++, from GND and counter clock wise.
|
||||
-7,26(in keyboard PCB, these pins are VDD,GND)
|
||||
-30,31(in Teensy++, these pins are Ref,GND respectively)
|
||||
-5,6(D2,D3 for bluetooth in future)
|
||||
1. Bypass #31 pin(from board) to E4(Teensy)
|
||||
2. Bypass #30 pin(from board) to F2(Teensy)
|
||||
3. Bypass #6 pin(from board) to A0(Teensy)
|
||||
4. Refer to documentation directory
|
||||
|
||||
To Do
|
||||
=====
|
||||
0. When DEBOUNCE defined, there is a errors.
|
||||
1. Layer Change by toggling Clear Key
|
||||
2. Eject Key add. (following files should be modified.)
|
||||
common/keycode.h
|
||||
common/keyboard.c
|
||||
3. Use bluetooth
|
||||
EOF
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
/* for Apple
|
||||
#define VENDOR_ID 0x05AC
|
||||
#define PRODUCT_ID 0xBEE0
|
||||
*/
|
||||
#define VENDOR_ID 0xFEED
|
||||
#define PRODUCT_ID 0xBEE0
|
||||
#define DEVICE_VER 0x0202
|
||||
#define MANUFACTURER t.m.k.
|
||||
#define PRODUCT Apple Desktop Bus Keyboard
|
||||
|
||||
|
||||
/* message strings */
|
||||
#define DESCRIPTION Apple M0116/A9M0660 keyboard firmware
|
||||
|
||||
|
||||
/* matrix size */
|
||||
#define MATRIX_ROWS 11 // last row is virtual for modifier
|
||||
#define MATRIX_COLS 8
|
||||
/* define if matrix has ghost */
|
||||
#define MATRIX_HAS_GHOST
|
||||
/* Set 0 if need no debouncing */
|
||||
#define DEBOUNCE 5
|
||||
|
||||
|
||||
/* key combination for command */
|
||||
#define IS_COMMAND() ( \
|
||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LCTRL) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LGUI)) || \
|
||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||
)
|
||||
|
||||
|
||||
/* layer switching */
|
||||
#define LAYER_SWITCH_DELAY 100
|
||||
#define LAYER_SEND_FN_TERM 300
|
||||
|
||||
|
||||
/* legacy keymap support */
|
||||
#define USE_LEGACY_KEYMAP
|
||||
|
||||
|
||||
#endif
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 322 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 72 KiB |
Binary file not shown.
|
|
@ -1,142 +0,0 @@
|
|||
/*
|
||||
Copyright 2012 Jeffrey Sung <nattyman@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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Keymap for Apple IIgs/Standard Keyboard
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include "keycode.h"
|
||||
#include "print.h"
|
||||
#include "debug.h"
|
||||
#include "util.h"
|
||||
#include "keymap.h"
|
||||
|
||||
|
||||
// Convert physical keyboard layout to matrix array.
|
||||
// This is a macro to define keymap easily in keyboard layout form.
|
||||
#define KEYMAP( R10C5, \
|
||||
R3C7, R3C6, R3C5, R3C4, R3C3, R3C2, R3C1, R8C1, R8C0, R3C0, R0C0, R0C1, R0C2, R0C3, R4C4, R4C5, R4C6, R4C7, \
|
||||
R9C7, R9C6, R9C5, R9C4, R9C3, R9C2, R9C1, R9C0, R1C0, R1C1, R1C2, R1C3, R1C4, R2C4, R2C5, R2C6, R2C3, \
|
||||
R10C0,R7C7, R7C6, R7C5, R7C4, R7C3, R7C2, R7C1, R7C0, R0C4, R1C6, R1C7, R1C5, R2C0, R2C1, R2C2, R2C7, \
|
||||
R10C1,R6C7, R6C6, R6C5, R6C4, R6C3, R6C2, R6C1, R6C0, R0C5, R0C6, R4C0, R4C1, R4C2, \
|
||||
R10C4,R10C2,R10C3,R5C4, R5C7, R5C5, R5C6, R5C0, R5C2, R0C7, R5C1, R5C3, R4C3 \
|
||||
) { \
|
||||
{ R0C0, R0C1, R0C2, R0C3, R0C4, R0C5, R0C6, R0C7 }, \
|
||||
{ R1C0, R1C1, R1C2, R1C3, R1C4, R1C5, R1C6, R1C7 }, \
|
||||
{ R2C0, R2C1, R2C2, R2C3, R2C4, R2C5, R2C6, R2C7 }, \
|
||||
{ R3C0, R3C1, R3C2, R3C3, R3C4, R3C5, R3C6, R3C7 }, \
|
||||
{ R4C0, R4C1, R4C2, R4C3, R4C4, R4C5, R4C6, R4C7 }, \
|
||||
{ R5C0, R5C1, R5C2, R5C3, R5C4, R5C5, R5C6, R5C7 }, \
|
||||
{ R6C0, R6C1, R6C2, R6C3, R6C4, R6C5, R6C6, R6C7 }, \
|
||||
{ R7C0, R7C1, R7C2, R7C3, R7C4, R7C5, R7C6, R7C7 }, \
|
||||
{ R8C0, R8C1, KC_NO, KC_NO, KC_NO,KC_NO, KC_NO, KC_NO }, \
|
||||
{ R9C0, R9C1, R9C2, R9C3, R9C4, R9C5, R9C6, R9C7 }, \
|
||||
{ R10C0,R10C1, R10C2, R10C3, R10C4,R10C5, KC_NO, KC_NO} \
|
||||
}
|
||||
|
||||
#define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)]))
|
||||
|
||||
|
||||
// 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
|
||||
1, // Fn1
|
||||
2, // Fn2
|
||||
3, // Fn3
|
||||
4, // Fn4
|
||||
0, // Fn5
|
||||
3, // Fn6
|
||||
3 // Fn7
|
||||
};
|
||||
|
||||
// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
|
||||
// See layer.c for details.
|
||||
static const uint8_t PROGMEM fn_keycode[] = {
|
||||
KC_NO, // Fn0
|
||||
KC_NO, // Fn1
|
||||
KC_SLSH, // Fn2
|
||||
KC_SCLN, // Fn3
|
||||
KC_SPC, // Fn4
|
||||
KC_NO, // Fn5
|
||||
KC_NO, // Fn6
|
||||
KC_NO // Fn7
|
||||
};
|
||||
|
||||
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Layer 0: Default Layer
|
||||
* ,-----------------------------------------------------------. ,---------------,
|
||||
* | POWER | | |
|
||||
* |-----------------------------------------------------------| |---------------|
|
||||
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |FN0| = | / | * |
|
||||
* |-----------------------------------------------------------| |---------------|
|
||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | 7 | 8 | 9 | + |
|
||||
* |-----------------------------------------------------' | |---------------|
|
||||
* |Contro| A| S| D| F| G| H| J| K| L|Fn3| '|Return | | 4 | 5 | 6 | - |
|
||||
* |-----------------------------------------------------------| |---------------|
|
||||
* |Shift | Z| X| C| V| B| N| M| ,| .| / |Shift | | 1 | 2 | 3 | E |
|
||||
* |-----------------------------------------------------------| |-----------| N |
|
||||
* |CAPS|Alt |Gui |` |SPC |BSLS |LFT|RGT|DN|UP| | 0 | . | T |
|
||||
* `-----------------------------------------------------------' |---------------'
|
||||
*/
|
||||
KEYMAP( KC_PWR,
|
||||
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_BSPC, KC_FN1, KC_PEQL, KC_PSLS, KC_PAST, \
|
||||
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_P7, KC_P8, KC_P9, KC_PPLS, \
|
||||
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_ENT, KC_P4, KC_P5, KC_P6, KC_PMNS, \
|
||||
KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_P1, KC_P2, KC_P3, \
|
||||
KC_CAPS,KC_LALT,KC_LGUI,KC_GRV, KC_SPC, KC_BSLS,KC_LEFT,KC_RGHT,KC_DOWN,KC_UP, KC_P0, KC_PDOT, KC_PENT),
|
||||
|
||||
|
||||
/* Layer 1: Tenkey use Layer
|
||||
* ,-----------------------------------------------------------. ,---------------,
|
||||
* | POWER | | |
|
||||
* |-----------------------------------------------------------| |---------------|
|
||||
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |NLK| = | / | * |
|
||||
* |-----------------------------------------------------------| |---------------|
|
||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |INS| 8 |PGU|V+ |
|
||||
* |-----------------------------------------------------' | |---------------|
|
||||
* |Contro| A| S| D| F| G| H| J| K| L|Fn3| '|Return | |DEL|UP |PGD|V- |
|
||||
* |-----------------------------------------------------------| |---------------|
|
||||
* |Shift | Z| X| C| V| B| N| M| ,| .| / |Shift | |LFT|DN |RGT| E |
|
||||
* |-----------------------------------------------------------| |-----------| N |
|
||||
* |CAPS|Alt |Gui |` |SPC |BSLS |LFT|RGT|DN|UP| | 0 | . | T |
|
||||
* `-----------------------------------------------------------' `---------------'
|
||||
*/
|
||||
KEYMAP( KC_PWR, \
|
||||
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_BSPC, KC_FN1, KC_PEQL, KC_PSLS, KC_MUTE, \
|
||||
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_INS, KC_P8, KC_PGUP, KC_VOLU, \
|
||||
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_ENT, KC_DEL, KC_UP, KC_PGDN, KC_VOLD, \
|
||||
KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_LEFT, KC_DOWN, KC_RIGHT, \
|
||||
KC_CAPS,KC_LALT,KC_LGUI,KC_GRV, KC_SPC, KC_BSLS,KC_LEFT,KC_RGHT,KC_DOWN,KC_UP, KC_P0, KC_PDOT, KC_PENT),
|
||||
};
|
||||
|
||||
|
||||
uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
|
||||
{
|
||||
return KEYCODE(layer, row, col);
|
||||
}
|
||||
|
||||
uint8_t keymap_fn_layer(uint8_t index)
|
||||
{
|
||||
return pgm_read_byte(&fn_layer[index]);
|
||||
}
|
||||
|
||||
uint8_t keymap_fn_keycode(uint8_t index)
|
||||
{
|
||||
return pgm_read_byte(&fn_keycode[index]);
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
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 "led.h"
|
||||
|
||||
|
||||
void led_set(uint8_t usb_led)
|
||||
{
|
||||
}
|
||||
|
|
@ -1,363 +0,0 @@
|
|||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* scan matrix
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
#include "print.h"
|
||||
#include "debug.h"
|
||||
#include "util.h"
|
||||
#include "matrix.h"
|
||||
#include "led.h"
|
||||
|
||||
|
||||
#if (MATRIX_COLS > 16)
|
||||
# error "MATRIX_COLS must not exceed 16"
|
||||
#endif
|
||||
#if (MATRIX_ROWS > 255)
|
||||
# error "MATRIX_ROWS must not exceed 255"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef DEBOUNCE
|
||||
# define DEBOUNCE 0
|
||||
#endif
|
||||
static uint8_t debouncing = DEBOUNCE;
|
||||
|
||||
// matrix state buffer(1:on, 0:off)
|
||||
#if (MATRIX_COLS <= 8)
|
||||
static uint8_t *matrix;
|
||||
static uint8_t *matrix_prev;
|
||||
static uint8_t _matrix0[MATRIX_ROWS];
|
||||
static uint8_t _matrix1[MATRIX_ROWS];
|
||||
#else
|
||||
static uint16_t *matrix;
|
||||
static uint16_t *matrix_prev;
|
||||
static uint16_t _matrix0[MATRIX_ROWS];
|
||||
static uint16_t _matrix1[MATRIX_ROWS];
|
||||
#endif
|
||||
|
||||
#ifdef MATRIX_HAS_GHOST
|
||||
static bool matrix_has_ghost_in_row(uint8_t row);
|
||||
#endif
|
||||
static uint8_t read_col(uint8_t row);
|
||||
static void unselect_rows(void);
|
||||
static void select_row(uint8_t row);
|
||||
|
||||
|
||||
inline
|
||||
uint8_t matrix_rows(void)
|
||||
{
|
||||
return MATRIX_ROWS;
|
||||
}
|
||||
|
||||
inline
|
||||
uint8_t matrix_cols(void)
|
||||
{
|
||||
return MATRIX_COLS;
|
||||
}
|
||||
|
||||
void matrix_init(void)
|
||||
{
|
||||
// initialize row and col
|
||||
unselect_rows();
|
||||
// Input with pull-up(DDR:0, PORT:1)
|
||||
// Column C1 ~ C7 (PortC0-6)
|
||||
// Column C0(Port E1)
|
||||
DDRC &= ~0b01111111;
|
||||
PORTC |= 0b01111111;
|
||||
DDRE &= ~0b00000010;
|
||||
PORTE |= 0b00000010;
|
||||
//DDRB &= ~0b00000100;
|
||||
//PORTB |= 0b00000100;
|
||||
// modifier B3/4,F4/5,E4 always input
|
||||
// A0
|
||||
//DDRA |= 0b00000001;
|
||||
//PORTA &= 0b00000001;
|
||||
//DDRB |= 0b00011000;
|
||||
//PORTB &= 0b00011000;
|
||||
//DDRF |= ~0b00110000;
|
||||
//PORTF &= 0b00110000;
|
||||
//DDRB &= ~0b00011000;
|
||||
//PORTB |= 0b00011000;
|
||||
//DDRF &= ~0b00110000;
|
||||
//PORTF |= 0b00110000;
|
||||
//DDRE &= ~0b00010000;
|
||||
//PORTE |= 0b00010000;
|
||||
|
||||
// initialize matrix state: all keys off
|
||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix0[i] = 0x00;
|
||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix1[i] = 0x00;
|
||||
matrix = _matrix0;
|
||||
matrix_prev = _matrix1;
|
||||
}
|
||||
|
||||
uint8_t matrix_scan(void)
|
||||
{
|
||||
if (!debouncing) {
|
||||
uint8_t *tmp = matrix_prev;
|
||||
matrix_prev = matrix;
|
||||
matrix = tmp;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
unselect_rows();
|
||||
select_row(i);
|
||||
_delay_us(30); // without this wait read unstable value.
|
||||
if ( i == ( MATRIX_ROWS - 1 ) ) { // CHECK CAPS LOCK
|
||||
if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { // CAPS LOCK is ON on HOST
|
||||
if ( ~read_col(i) & (1<< 4) ) { // CAPS LOCK is still DOWN ( 0bXXX1_XXXX)
|
||||
matrix[i] = ~read_col(i) & 0b11101111; // change CAPS LOCK as released
|
||||
} else { // CAPS LOCK in UP
|
||||
matrix[i] = ~read_col(i) | 0b00010000; // send fake caps lock down
|
||||
}
|
||||
} else { // CAPS LOCK is OFF on HOST
|
||||
if (matrix[i] != (uint8_t)~read_col(i)) {
|
||||
matrix[i] = (uint8_t)~read_col(i);
|
||||
if (debouncing) {
|
||||
debug("bounce!: "); debug_hex(debouncing); print("\n");
|
||||
}
|
||||
debouncing = DEBOUNCE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (matrix[i] != (uint8_t)~read_col(i)) {
|
||||
matrix[i] = (uint8_t)~read_col(i);
|
||||
if (debouncing) {
|
||||
debug("bounce!: "); debug_hex(debouncing); print("\n");
|
||||
}
|
||||
debouncing = DEBOUNCE;
|
||||
}
|
||||
}
|
||||
}
|
||||
unselect_rows();
|
||||
|
||||
if (debouncing) {
|
||||
debouncing--;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool matrix_is_modified(void)
|
||||
{
|
||||
if (debouncing) return false;
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
if (matrix[i] != matrix_prev[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline
|
||||
bool matrix_has_ghost(void)
|
||||
{
|
||||
#ifdef MATRIX_HAS_GHOST
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
if (matrix_has_ghost_in_row(i))
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
inline
|
||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
||||
{
|
||||
// if ( row == ( MATRIX_ROWS - 1 ) && col == 4) { // CHECK CAPS LOCK
|
||||
// if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { // CAPS LOCK is ON on HOST
|
||||
// if ((matrix_prev[row] & 0b00010000) && (~matrix[row] & 0b00010000)) {
|
||||
// debug("CapsLock Reverse:");debug_hex(matrix[row]);
|
||||
// matrix[row] |= 0b00010000;
|
||||
// matrix_prev[row] &= ~0b00010000;
|
||||
// debug("->");debug_hex(matrix[row]);debug("\n");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return (matrix[row] & (1<<col));
|
||||
}
|
||||
|
||||
inline
|
||||
#if (MATRIX_COLS <= 8)
|
||||
uint8_t matrix_get_row(uint8_t row)
|
||||
#else
|
||||
uint16_t matrix_get_row(uint8_t row)
|
||||
#endif
|
||||
{
|
||||
return matrix[row];
|
||||
}
|
||||
|
||||
void matrix_print(void)
|
||||
{
|
||||
print("\nr/c 01234567\n");
|
||||
for (uint8_t row = 0; row < matrix_rows(); row++) {
|
||||
phex(row); print(": ");
|
||||
#if (MATRIX_COLS <= 8)
|
||||
pbin_reverse(matrix_get_row(row));
|
||||
#else
|
||||
pbin_reverse16(matrix_get_row(row));
|
||||
#endif
|
||||
#ifdef MATRIX_HAS_GHOST
|
||||
if (matrix_has_ghost_in_row(row)) {
|
||||
print(" <ghost");
|
||||
}
|
||||
#endif
|
||||
print("\n");
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t matrix_key_count(void)
|
||||
{
|
||||
uint8_t count = 0;
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
#if (MATRIX_COLS <= 8)
|
||||
count += bitpop(matrix[i]);
|
||||
#else
|
||||
count += bitpop16(matrix[i]);
|
||||
#endif
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
#ifdef MATRIX_HAS_GHOST
|
||||
inline
|
||||
static bool matrix_has_ghost_in_row(uint8_t row)
|
||||
{
|
||||
// no ghost exists in case less than 2 keys on
|
||||
if (((matrix[row] - 1) & matrix[row]) == 0)
|
||||
return false;
|
||||
|
||||
// ghost exists in case same state as other row
|
||||
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
|
||||
if (i != row && (matrix[i] & matrix[row]) == matrix[row])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline
|
||||
static uint8_t read_col(uint8_t row)
|
||||
{
|
||||
// For normal : Column C1 ~ C7 (PortC0-6), C0(Port E1)
|
||||
// For modifier : B3(CNTRL)/4(SHIFT),F4(CMD/GUI)/5(OPTION,ALT)
|
||||
// Modifier would be copied to report->mods except E4(CAPSLOCK)
|
||||
uint8_t tmp;
|
||||
if ( row == 10 ) {
|
||||
tmp = 0xC0;
|
||||
tmp |= (PINB >> 3 ) & 0b00000011; // LEFT CTRL is 0bit in modifier (HID Spec)
|
||||
// LEFT SHIFT is 1bit in modifier (HID Spec)
|
||||
tmp |= (PINF >> 3 ) & 0b00000100; // LEFT ALT is 2bit in modifier (HID Spec)
|
||||
tmp |= (PINF >> 1 ) & 0b00001000; // LEFT GUI is 3bit in modifier (HID Spec)
|
||||
tmp |= (PINA << 4 ) & 0b00010000; // CAPSLOCK
|
||||
tmp |= (PINB << 3 ) & 0b00100000; // POWER
|
||||
} else {
|
||||
tmp = 0x00;
|
||||
tmp = (PINE >> 1)&0b00000001;
|
||||
tmp |= PINC << 1 ;
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
inline
|
||||
static void unselect_rows(void)
|
||||
{
|
||||
// Hi-Z(DDR:0, PORT:0) to unselect
|
||||
// DDR : 1, output 0, input
|
||||
DDRB &= ~0b00000011; // PB: 1,0
|
||||
PORTB &= ~0b00000011;
|
||||
DDRD &= ~0b00010000; // PD: 4
|
||||
PORTD &= ~0b00010000;
|
||||
DDRE &= ~0b11000000; // PE: 7,6
|
||||
PORTE &= ~0b11000000;
|
||||
DDRF &= ~0b11000111; // PF: 7,6,2,1,0
|
||||
PORTF &= ~0b11000111;
|
||||
// to unselect virtual row(modifier), set port to output with low
|
||||
DDRA |= 0b00000001; // PA: 0 for CAPSLOCK
|
||||
PORTA &= ~0b00000001;
|
||||
DDRB |= 0b00011100; // PB: 3,4 for modifier(row10)
|
||||
PORTB &= ~0b00011100; // PB: 2 for power
|
||||
DDRF |= 0b00110000; // PF: 4,5 for modifier
|
||||
PORTF &= ~0b00110000;
|
||||
}
|
||||
|
||||
inline
|
||||
static void select_row(uint8_t row)
|
||||
{
|
||||
// Output low(DDR:1, PORT:0) to select
|
||||
// with row enable, column could send low to AVR when pressed
|
||||
// row: 0 1 2 3 4 5 6 7 8 9
|
||||
// pin: PB1, PB0, PE7, PE6, PD4, PF2, PF0, PF1, PF6 PF7
|
||||
switch (row) {
|
||||
case 0:
|
||||
DDRB |= (1<<1);
|
||||
PORTB &= ~(1<<1);
|
||||
break;
|
||||
case 1:
|
||||
DDRB |= (1<<0);
|
||||
PORTB &= ~(1<<0);
|
||||
break;
|
||||
case 2:
|
||||
DDRE |= (1<<7);
|
||||
PORTE &= ~(1<<7);
|
||||
break;
|
||||
case 3:
|
||||
DDRE |= (1<<6);
|
||||
PORTE &= ~(1<<6);
|
||||
break;
|
||||
case 4:
|
||||
DDRD |= (1<<4);
|
||||
PORTD &= ~(1<<4);
|
||||
break;
|
||||
case 5:
|
||||
DDRF |= (1<<2);
|
||||
PORTF &= ~(1<<2);
|
||||
break;
|
||||
case 6:
|
||||
DDRF |= (1<<0);
|
||||
PORTF &= ~(1<<0);
|
||||
break;
|
||||
case 7:
|
||||
DDRF |= (1<<1);
|
||||
PORTF &= ~(1<<1);
|
||||
break;
|
||||
case 8:
|
||||
DDRF |= (1<<6);
|
||||
PORTF &= ~(1<<6);
|
||||
break;
|
||||
case 9:
|
||||
DDRF |= (1<<7);
|
||||
PORTF &= ~(1<<7);
|
||||
break;
|
||||
case 10:
|
||||
// modifier has no row enable
|
||||
// to select virtual row, set port as input
|
||||
DDRA &= ~0b00000001;
|
||||
PORTA |= 0b00000001;
|
||||
DDRB &= ~0b00011100;
|
||||
PORTB |= 0b00011100;
|
||||
DDRF &= ~0b00110000;
|
||||
PORTF |= 0b00110000;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
25
keyboard/bantam44/Bantam44.c
Normal file
25
keyboard/bantam44/Bantam44.c
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "Bantam44.h"
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_user(void) {
|
||||
// leave these blank
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_scan_user(void) {
|
||||
// leave these blank
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
29
keyboard/bantam44/Bantam44.h
Normal file
29
keyboard/bantam44/Bantam44.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef BANTAM44_H
|
||||
#define BANTAM44_H
|
||||
|
||||
#include "matrix.h"
|
||||
#include "keymap_common.h"
|
||||
#include "backlight.h"
|
||||
#include <stddef.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, K0A, K0B, \
|
||||
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
|
||||
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \
|
||||
K30, K31, K32, K33, K34, K35, K36, K37, K38 \
|
||||
) \
|
||||
{ \
|
||||
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B }, \
|
||||
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, KC_NO, K2A }, \
|
||||
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B }, \
|
||||
{ K30, K31, K32, KC_NO, K33, KC_NO, K34, KC_NO, K35, K36, K37, K38 }, \
|
||||
}
|
||||
|
||||
void matrix_init_user(void);
|
||||
void matrix_scan_user(void);
|
||||
|
||||
#endif
|
||||
139
keyboard/bantam44/Makefile
Normal file
139
keyboard/bantam44/Makefile
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
#----------------------------------------------------------------------------
|
||||
# On command line:
|
||||
#
|
||||
# make all = Make software.
|
||||
#
|
||||
# make clean = Clean out built project files.
|
||||
#
|
||||
# make coff = Convert ELF to AVR COFF.
|
||||
#
|
||||
# make extcoff = Convert ELF to AVR Extended COFF.
|
||||
#
|
||||
# make program = Download the hex file to the device.
|
||||
# Please customize your programmer settings(PROGRAM_CMD)
|
||||
#
|
||||
# make teensy = Download the hex file to the device, using teensy_loader_cli.
|
||||
# (must have teensy_loader_cli installed).
|
||||
#
|
||||
# make dfu = Download the hex file to the device, using dfu-programmer (must
|
||||
# have dfu-programmer installed).
|
||||
#
|
||||
# make flip = Download the hex file to the device, using Atmel FLIP (must
|
||||
# have Atmel FLIP installed).
|
||||
#
|
||||
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
|
||||
# (must have dfu-programmer installed).
|
||||
#
|
||||
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
|
||||
# (must have Atmel FLIP installed).
|
||||
#
|
||||
# make debug = Start either simulavr or avarice as specified for debugging,
|
||||
# with avr-gdb or avr-insight as the front end for debugging.
|
||||
#
|
||||
# make filename.s = Just compile filename.c into the assembler code only.
|
||||
#
|
||||
# make filename.i = Create a preprocessed source file for use in submitting
|
||||
# bug reports to the GCC project.
|
||||
#
|
||||
# To rebuild project do "make clean" then "make all".
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = Bantam44
|
||||
|
||||
|
||||
# Directory common source filess exist
|
||||
TOP_DIR = ../..
|
||||
TMK_DIR = ../../tmk_core
|
||||
|
||||
# Directory keyboard dependent files exist
|
||||
TARGET_DIR = .
|
||||
|
||||
# # project specific files
|
||||
SRC = Bantam44.c
|
||||
|
||||
ifdef KEYMAP
|
||||
SRC := keymaps/$(KEYMAP).c $(SRC)
|
||||
else
|
||||
SRC := keymaps/default.c $(SRC)
|
||||
endif
|
||||
|
||||
CONFIG_H = config.h
|
||||
|
||||
# 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
|
||||
# comment out to disable the options.
|
||||
#
|
||||
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
|
||||
|
||||
|
||||
# Optimize size but this may cause error "relocation truncated to fit"
|
||||
#EXTRALDFLAGS = -Wl,--relax
|
||||
|
||||
# Search Path
|
||||
VPATH += $(TARGET_DIR)
|
||||
VPATH += $(TOP_DIR)
|
||||
VPATH += $(TMK_DIR)
|
||||
|
||||
include $(TOP_DIR)/quantum/quantum.mk
|
||||
|
||||
24
keyboard/bantam44/README.md
Normal file
24
keyboard/bantam44/README.md
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
Bantam44 keyboard firmware
|
||||
======================
|
||||
|
||||
## Quantum MK Firmware
|
||||
|
||||
For the full Quantum feature list, see [the parent README.md](/README.md).
|
||||
|
||||
## Building
|
||||
|
||||
Download or clone the whole firmware and navigate to the keyboard/Bantam44 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`.
|
||||
|
||||
### 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.
|
||||
|
||||
To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like:
|
||||
```
|
||||
$ make KEYMAP=[default|jack|<name>]
|
||||
```
|
||||
Keymaps follow the format **__\<name\>.c__** and are stored in the `keymaps` folder.
|
||||
82
keyboard/bantam44/config.h
Normal file
82
keyboard/bantam44/config.h
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
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 Bantam Keyboards
|
||||
#define PRODUCT Bantam44
|
||||
#define DESCRIPTION A custom keyboard
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 4
|
||||
#define MATRIX_COLS 12
|
||||
|
||||
// Planck PCB default pin-out
|
||||
// Change this to how you wired your keyboard
|
||||
// COLS: Left to right, ROWS: Top to bottom
|
||||
#define MATRIX_ROW_PINS { F0, D6, D4, D5 }
|
||||
#define MATRIX_COL_PINS { B0, B1, B2, B3, B7, D0, B6, F7, F6, F5, F4, F1 }
|
||||
#define UNUSED_PINS
|
||||
|
||||
/* COL2ROW or ROW2COL */
|
||||
#define DIODE_DIRECTION COL2ROW
|
||||
|
||||
/* 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
|
||||
|
||||
/* key combination for command */
|
||||
#define IS_COMMAND() ( \
|
||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||
)
|
||||
|
||||
/*
|
||||
* 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
|
||||
30
keyboard/bantam44/keymaps/default.c
Normal file
30
keyboard/bantam44/keymaps/default.c
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#include "Bantam44.h"
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = { /* Base */
|
||||
{KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC },
|
||||
{KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_NO, KC_ENT },
|
||||
{KC_CAPS, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_RSFT },
|
||||
{KC_LCTL, KC_LGUI, KC_LALT, KC_NO, MO(1), KC_NO, KC_SPC, KC_NO, MO(2), KC_SCLN, KC_QUOT, KC_SLSH }
|
||||
},
|
||||
[1] = { /* LOWER */
|
||||
{KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DELT },
|
||||
{KC_TAB, KC_MPRV, KC_MPLY, KC_MNXT, KC_GRV, KC_BSLS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_NO, KC_ENT },
|
||||
{KC_CAPS, KC_LSFT, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_NO, KC_HOME, KC_PGUP, KC_RSFT },
|
||||
{KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_TRNS, KC_NO, KC_SPC, KC_NO, KC_TRNS, KC_END, KC_PGDN, KC_EXLM }
|
||||
},
|
||||
[2] = { /* RAISE */
|
||||
{KC_ESC, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DELT },
|
||||
{KC_TAB, KC_MUTE, KC_VOLD, KC_VOLU, KC_TILD, KC_PIPE, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_NO, KC_ENT },
|
||||
{KC_CAPS, KC_LSFT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, KC_UP, KC_RSFT },
|
||||
{KC_LCTL, KC_LGUI, KC_LALT, KC_NO, KC_TRNS, KC_NO, KC_SPC, KC_NO, KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT }
|
||||
}
|
||||
};
|
||||
|
||||
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
|
||||
{
|
||||
return MACRO_NONE;
|
||||
};
|
||||
|
|
@ -1,13 +1,9 @@
|
|||
#ifndef ERGODOX_EZ_H
|
||||
#define ERGODOX_EZ_H
|
||||
|
||||
#include "matrix.h"
|
||||
#include "keymap_common.h"
|
||||
#include "backlight.h"
|
||||
#include <stddef.h>
|
||||
#include "quantum.h"
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <avr/io.h>
|
||||
#include "i2cmaster.h"
|
||||
#include <util/delay.h>
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -7,8 +7,7 @@
|
|||
#define SYMB 1 // symbols
|
||||
#define MDIA 2 // media keys
|
||||
|
||||
#define LSFTO M(0) // Left shift, open parens when tapped
|
||||
#define RSFTC M(1) // Right shift, close parens when tapped
|
||||
#define LEADER_TIMEOUT 300
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Keymap 0: Basic layer
|
||||
|
|
@ -27,28 +26,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* ,-------------. ,-------------.
|
||||
* | App | LGui | | Alt |Ctrl/Esc|
|
||||
* ,------|------|------| |------+--------+------.
|
||||
* | | L1 | Home | | PgUp | | |
|
||||
* | Space| Tap/ |------| |------| Tab/L1 |Enter |
|
||||
* | |Toggle| End | | PgDn | | |
|
||||
* | | | Home | | PgUp | | |
|
||||
* | Space|Leader|------| |------| Tab/L1 |Enter |
|
||||
* | | | End | | PgDn | | |
|
||||
* `--------------------' `----------------------'
|
||||
*/
|
||||
// If it accepts an argument (i.e, is a function), it doesn't need KC_.
|
||||
// Otherwise, it needs KC_*
|
||||
[BASE] = KEYMAP( // layer 0 : default
|
||||
// left hand
|
||||
KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT,
|
||||
KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB),
|
||||
KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G,
|
||||
LSFTO, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_LBRC),
|
||||
LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT,
|
||||
ALT_T(KC_APP), KC_LGUI,
|
||||
KC_HOME,
|
||||
KC_SPC,KC_FN1,KC_END,
|
||||
KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT,
|
||||
KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB),
|
||||
KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G,
|
||||
KC_LSPO, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_LBRC),
|
||||
LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT,
|
||||
ALT_T(KC_APP), KC_LGUI,
|
||||
KC_HOME,
|
||||
KC_SPC,KC_LEAD,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,ALT_T(KC_J),KC_K, KC_L, LT(MDIA,KC_SCLN),GUI_T(KC_QUOT),
|
||||
MEH_T(KC_RBRC),KC_N,KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), RSFTC,
|
||||
MEH_T(KC_RBRC),KC_N,KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSPC,
|
||||
KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, LT(SYMB,KC_MINS),
|
||||
KC_LALT, CTL_T(KC_ESC),
|
||||
KC_PGUP,
|
||||
|
|
@ -149,48 +148,7 @@ static uint16_t key_timer;
|
|||
|
||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
|
||||
{
|
||||
switch(id) {
|
||||
case 0:
|
||||
if (record->event.pressed) {
|
||||
register_mods(MOD_BIT(KC_LSFT));
|
||||
if (record->tap.count && !record->tap.interrupted) {
|
||||
register_code(KC_9);
|
||||
}
|
||||
else {
|
||||
record->tap.count = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (record->tap.count) {
|
||||
unregister_code(KC_9);
|
||||
}
|
||||
else {
|
||||
}
|
||||
unregister_mods(MOD_BIT(KC_LSFT));
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (record->event.pressed) {
|
||||
register_mods(MOD_BIT(KC_LSFT));
|
||||
if (record->tap.count && !record->tap.interrupted) {
|
||||
register_code(KC_0);
|
||||
}
|
||||
else {
|
||||
record->tap.count = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (record->tap.count) {
|
||||
unregister_code(KC_0);
|
||||
}
|
||||
else {
|
||||
}
|
||||
unregister_mods(MOD_BIT(KC_LSFT));
|
||||
}
|
||||
break;
|
||||
}
|
||||
return MACRO_NONE;
|
||||
return MACRO_NONE;
|
||||
};
|
||||
|
||||
// Runs just one time when the keyboard initializes.
|
||||
|
|
@ -198,28 +156,48 @@ void matrix_init_user(void) {
|
|||
|
||||
};
|
||||
|
||||
LEADER_EXTERNS();
|
||||
|
||||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
uint8_t layer = biton32(layer_state);
|
||||
uint8_t layer = biton32(layer_state);
|
||||
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
ergodox_right_led_2_off();
|
||||
ergodox_right_led_3_off();
|
||||
switch (layer) {
|
||||
// TODO: Make this relevant to the ErgoDox EZ.
|
||||
case 1:
|
||||
ergodox_right_led_1_on();
|
||||
break;
|
||||
case 2:
|
||||
ergodox_right_led_2_on();
|
||||
break;
|
||||
default:
|
||||
// none
|
||||
break;
|
||||
ergodox_board_led_off();
|
||||
ergodox_right_led_1_off();
|
||||
ergodox_right_led_2_off();
|
||||
ergodox_right_led_3_off();
|
||||
switch (layer) {
|
||||
// TODO: Make this relevant to the ErgoDox EZ.
|
||||
case 1:
|
||||
ergodox_right_led_1_on();
|
||||
break;
|
||||
case 2:
|
||||
ergodox_right_led_2_on();
|
||||
break;
|
||||
default:
|
||||
// none
|
||||
break;
|
||||
}
|
||||
|
||||
LEADER_DICTIONARY() {
|
||||
leading = false;
|
||||
leader_end();
|
||||
|
||||
SEQ_ONE_KEY(KC_W) {
|
||||
register_code(KC_LALT);
|
||||
register_code(KC_F4);
|
||||
unregister_code(KC_F4);
|
||||
unregister_code(KC_LALT);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
SEQ_ONE_KEY(KC_O) {
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_O);
|
||||
unregister_code(KC_O);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LCTL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
# for your own particular keymap
|
||||
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue