Compare commits

..

104 Commits

Author SHA1 Message Date
83b35bf6f6 Update readme.md 2017-08-03 11:57:18 -04:00
07ba06d0b6 fix section in porting guide that refered to Makefile instead of rules.mk 2017-08-02 22:00:49 -04:00
b6280f979c Picture and details update
I fixed the picture of the layout and added a bit of an explanation. It now matches the readme file from the uppercase BASE folder
2017-08-02 21:52:31 -04:00
7371209ffb Adds Eagleheardt's XD60 keymap (#1528)
* Add files via upload

* Update readme.md

* Update readme.md

* Add files via upload
2017-08-02 21:23:36 -04:00
d28b2c395b tap-dance: key + layer helper
This adds the `ACTION_TAP_DANCE_DUAL_ROLE` helper, which makes it easy to have
keys that act as a key on the first tap, and as a layer toggle on the second.

Fixes #1532, reported by @Ptomerty.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2017-08-02 16:06:16 -04:00
bb30ff5f71 Fix HHKBish layout arrows 2017-08-02 16:05:46 -04:00
bc5c67b3b2 Change TG to TO 2017-08-02 16:05:46 -04:00
ea02a3ea23 Update keymap to have HHKB-ish support and readme along with it 2017-08-02 16:05:46 -04:00
29fcb64bb4 add KC_Grave and fix typo on readme 2017-08-02 16:05:46 -04:00
70cc193d14 Add a readme.md file for the keymap 2017-08-02 16:05:46 -04:00
aab5f349a2 New keymap for mechmerlin 2017-08-02 16:05:46 -04:00
a7b6292010 added missing media controls and mod-tap rshift/enter 2017-08-02 16:05:22 -04:00
8e66f65c77 add my keymap 2017-08-02 16:05:22 -04:00
xk
23549791eb Add keymap xk 2017-08-02 16:04:49 -04:00
dd3803f334 Normalize all line endings 2017-08-01 16:44:29 -04:00
bd0a888133 line-endings 2017-07-30 12:59:18 -04:00
d272111d46 added xd75 to list in /keyboards 2017-07-30 00:46:08 -04:00
0b528d2e36 updated readme and tweaked keymap 2017-07-30 00:46:08 -04:00
cc6043ca29 add backlight support (probably) 2017-07-30 00:46:08 -04:00
fffc5237a7 fix RGB 2017-07-30 00:46:08 -04:00
992a63c0f2 add xd75, preliminary RGB' 2017-07-30 00:46:08 -04:00
25659acb1c Add an Ergodox Colemak Mod-DH keymap for french layouts
[Colemak Mod-DH](https://colemakmods.github.io/mod-dh/) layout for
users keeping an `azerty` layout configuration on their OS.

The symbols layers was done after analysing various programming
languages sources codes and should be close to optimal for typing
confort.
2017-07-29 11:38:36 -04:00
07cb997b6d Changes lets_split to use timer based debouncing
The let's split code used delays in its debouncing algorithm which
increases input latency. This commit copies and adapts the code from
`quantum/matrix.c` to lets_split's `matrix.c`.
2017-07-29 11:38:00 -04:00
ac634aa455 Fixed error in readme 2017-07-28 23:41:53 -04:00
6b2a3492b7 Removed un-needed protosplit directory and updated readme 2017-07-28 10:45:34 -04:00
dcd64062d2 Reverted changes 2017-07-28 10:45:34 -04:00
4148aeee19 Figured out that I didn't need to include both keymaps in both files 2017-07-28 10:45:34 -04:00
1f78b62cd6 Hopefully compile issues are gone, and updated files 2017-07-28 10:45:34 -04:00
9f82d14eb9 Fixed all things jack suggested. 2017-07-28 10:45:34 -04:00
b710e21efb Added to blank spaces at end of protosplit to make it compile under make v2 2017-07-28 10:45:34 -04:00
9334986bd9 Updated readme to show compile rules that won't throw an error 2017-07-28 10:45:34 -04:00
f2824bca02 Fixed typo in my layout and updated 2017-07-28 10:45:34 -04:00
5023f55856 Fixed some capitalization issues 2017-07-28 10:45:34 -04:00
6d15f5a5b7 Another typo fix 2017-07-28 10:45:34 -04:00
ea1fd96c84 Fixed typo in my layout 2017-07-28 10:45:34 -04:00
1eea91f5f8 Updated my makefile..again 2017-07-28 10:45:34 -04:00
9546b180b9 Updated my makefile 2017-07-28 10:45:34 -04:00
2265e4ce41 Removed old keymaps 2017-07-28 10:45:34 -04:00
cbc5a08c40 Removed old protosplit folder 2017-07-28 10:45:34 -04:00
78f79ca6cc Removed old folder 2017-07-28 10:45:34 -04:00
f1dbf72e09 Changed case of protosplit
Also updated readme to have correct capitalization.
2017-07-28 10:45:34 -04:00
c71b60c82a Changed case of deltasplit75 to be lowercase.
To follow convention.
2017-07-28 10:45:34 -04:00
47c6d201aa Add my layout 2017-07-28 10:45:34 -04:00
f6438e42af Add files via upload 2017-07-28 10:45:34 -04:00
242c1da2c2 Delete deltasplit build guide.pdf 2017-07-28 10:45:34 -04:00
be1876aa76 Add files via upload 2017-07-28 10:45:34 -04:00
1ef6777723 Add files via upload 2017-07-28 10:45:34 -04:00
d3b6552fb7 Delete MX RIGHT B.dxf 2017-07-28 10:45:34 -04:00
ce3ea49743 Delete ALPS+MX RIGHT B.dxf 2017-07-28 10:45:34 -04:00
811c583636 Delete ALPS RIGHT B.dxf 2017-07-28 10:45:34 -04:00
173d1b7571 Delete middle layers - RIGHT B.dxf 2017-07-28 10:45:34 -04:00
98f977e95c Delete bottom layers - RIGHT B.dxf 2017-07-28 10:45:34 -04:00
1832b59266 Delete MX LEFT B.dxf 2017-07-28 10:45:34 -04:00
1bfe5b5723 Delete ALPS+MX LEFT B.dxf 2017-07-28 10:45:34 -04:00
038c12d59a Delete ALPS LEFT B.dxf 2017-07-28 10:45:34 -04:00
3d23a80c83 Delete Middle layers - LEFT B.dxf 2017-07-28 10:45:34 -04:00
f56884b253 Delete Bottom Layer - LEFT B.dxf 2017-07-28 10:45:34 -04:00
d4e695a136 Delete top bezel - blocked corner.dxf 2017-07-28 10:45:34 -04:00
2013f4fb83 Delete top bezel - Winkeyless.dxf 2017-07-28 10:45:34 -04:00
508cc7e56b Delete top bezel - Standard.dxf 2017-07-28 10:45:34 -04:00
8958a4f78b Delete PCB Dimesnsion.dxf 2017-07-28 10:45:34 -04:00
429971997c Delete MX RIGHT B.dwg 2017-07-28 10:45:34 -04:00
e898a8ecc8 Delete ALPS+MX RIGHT B.dwg 2017-07-28 10:45:34 -04:00
b6e8516d6d Delete ALPS RIGHT B.dwg 2017-07-28 10:45:34 -04:00
2077226fc2 Delete middle layers - RIGHT B.dwg 2017-07-28 10:45:34 -04:00
cfafa97227 Delete bottom layers - RIGHT B.dwg 2017-07-28 10:45:34 -04:00
3d73110795 Delete readme.md 2017-07-28 10:45:34 -04:00
727707ef0b Delete PCB Dimesnsion.dwg 2017-07-28 10:45:34 -04:00
2a3af90d9f Delete MX LEFT B.dwg 2017-07-28 10:45:34 -04:00
73e5a7fafe Delete ALPS+MX LEFT B.dwg 2017-07-28 10:45:34 -04:00
eceb2a4810 Delete ALPS LEFT B.dwg 2017-07-28 10:45:34 -04:00
b34dfeecdf Delete Middle layers - LEFT B.dwg 2017-07-28 10:45:34 -04:00
01458037de Delete Bottom Layer - LEFT B.dwg 2017-07-28 10:45:34 -04:00
461f95ce0b Update readme.md 2017-07-28 10:45:34 -04:00
f4bc404aa2 Delete top bezel - blocked corner.dwg 2017-07-28 10:45:34 -04:00
b70e68ac5b Delete top bezel - Winkeyless.dwg 2017-07-28 10:45:34 -04:00
e4d849ed95 Delete top bezel - Standard.dwg 2017-07-28 10:45:34 -04:00
4f193d6dc2 Add files via upload 2017-07-28 10:45:34 -04:00
934d35ea3f Add files via upload 2017-07-28 10:45:34 -04:00
a76a607a2b Add files via upload 2017-07-28 10:45:34 -04:00
9aec284f42 Update 2017-07-28 10:45:34 -04:00
3a0f7865da Update readme.md 2017-07-28 10:45:34 -04:00
b11d770bea Update Makefile 2017-07-28 10:45:34 -04:00
5a63aa29a9 Update readme.md 2017-07-28 10:45:34 -04:00
ab63ff8d2e Update readme.md 2017-07-28 10:45:34 -04:00
00e4079d5a Delete top bezel - blocked corner.bak 2017-07-28 10:45:34 -04:00
4d88634f07 Delete top bezel - Standard.bak 2017-07-28 10:45:34 -04:00
5ea3b1ea4d Delete PCB Dimesnsion.dwl2 2017-07-28 10:45:34 -04:00
c497a19e7b Delete PCB Dimesnsion.dwl 2017-07-28 10:45:34 -04:00
7e07bdbde3 Add files via upload 2017-07-28 10:45:34 -04:00
60e5277a8f Delete PCB Dimesnsion.dwg 2017-07-28 10:45:34 -04:00
96ec98b1ad Create readme.md 2017-07-28 10:45:34 -04:00
7a31ef8284 Add files via upload 2017-07-28 10:45:34 -04:00
0c2b0c7cc1 Update readme.md 2017-07-28 10:45:34 -04:00
42ea9460fe Update readme.md 2017-07-28 10:45:34 -04:00
e9daf0606f Update readme.md 2017-07-28 10:45:34 -04:00
be2c7aac31 Add files via upload 2017-07-28 10:45:34 -04:00
c5780647d8 Fix typo in docs. 2017-07-27 16:10:36 -04:00
26fb063be3 Link to steno docs from summary page. 2017-07-27 16:10:36 -04:00
e81e75c147 Move steno keycodes due to conflict with another PR. 2017-07-27 16:10:36 -04:00
3e96e8a6a1 Add copyright to steno files. 2017-07-27 16:10:36 -04:00
c0f63ca9dc Add documentation for Steno. 2017-07-27 16:10:36 -04:00
f30f12ec81 Add support for GeminiPR steno protocol.
This protocol breaks out "duplicate" keys into their own entry in the packet so that more complicated logic can be done on the software side, including support for additional languages and alternative theories.
2017-07-27 16:10:36 -04:00
5987f67989 Add TX Bolt protocol support for Stenography
Requires virtser; Allows QMK to speak the TX BOlt protocol used by stenography machines and software (such as Plover). The upside is that Plover can be configured to listen only to TX Bolt allow the keyboard to switch layers without need to enable/disable the Plover software, or to have a second non-Steno keyboard work concurrently.
2017-07-27 16:10:36 -04:00
78 changed files with 4447 additions and 76 deletions

View File

@ -54,6 +54,12 @@ ifeq ($(strip $(COMBO_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c
endif
ifeq ($(strip $(STENO_ENABLE)), yes)
OPT_DEFS += -DSTENO_ENABLE
VIRTSER_ENABLE := yes
SRC += $(QUANTUM_DIR)/process_keycode/process_steno.c
endif
ifeq ($(strip $(VIRTSER_ENABLE)), yes)
OPT_DEFS += -DVIRTSER_ENABLE
endif

View File

@ -1,4 +1,4 @@
* [Getting started](README.md)
* [Getting started](README.md)
* [QMK Overview](qmk_overview.md)
* [Build Environment Setup](build_environment_setup.md)
* [Vagrant Guide](vagrant_guide.md)
@ -16,6 +16,7 @@
* [Tap Dance](tap_dance.md)
* [Mouse keys](mouse_keys.md)
* [Unicode](unicode.md)
* [Stenography](stenography.md)
* Reference
* [Glossary](glossary.md)
@ -27,7 +28,7 @@
* [Customizing Functionality](custom_quantum_functions.md)
* [Documentation Best Practices](documentation_best_practices.md)
* [Unit Testing](unit_testing.md)
* For Makers and Modders
* [Adding a keyboard to QMK](adding_a_keyboard_to_qmk.md)
* [Adding features to QMK](adding_features_to_qmk.md)
@ -39,7 +40,7 @@
* For a Deeper Understanding
* [How Keyboards Work](basic_how_keyboards_work.md)
* [Understanding QMK](understanding_qmk.md)
* Other Topics
* [General FAQ](faq.md)
* [Using Eclipse with QMK](eclipse.md)

View File

@ -20,7 +20,7 @@ For the `DIODE_DIRECTION`, most hand-wiring guides will instruct you to wire the
`BACKLIGHT_LEVELS` is how many levels exist for your backlight - max is 15, and they are computed automatically from this number.
## `/keyboards/<keyboard>/Makefile`
## `/keyboards/<keyboard>/rules.mk`
The values at the top likely won't need to be changed, since most boards use the `atmega32u4` chip. The `BOOTLOADER_SIZE` will need to be adjusted based on your MCU type. It's defaulted to the Teensy, since that's the most common controller. Below is quoted from the `Makefile`.

108
docs/stenography.md Normal file
View File

@ -0,0 +1,108 @@
# Stenography in QMK
[Stenography](https://en.wikipedia.org/wiki/Stenotype) is a method of writing most often used by court reports, closed-captioning, and real-time transcription for the deaf. In stenography words are chorded syllable by syllable with a mixture of spelling, phonetic, and shortcut (briefs) strokes. Professional stenographers can reach 200-300 WPM without any of the strain usually found in standard typing and with far fewer errors (>99.9% accuracy).
The [Open Steno Project](http://www.openstenoproject.org/) has built an open-source program called Plover that provides real-time translation of steno strokes into words and commands. It has an established dictionary and supports
## Plover with QWERTY Keyboard
Plover can work with any standard QWERTY keyboard, although it is more efficient if the keyboard supports NKRO (n-key rollover) to allow Plover to see all the pressed keys at once. An example keymap for Plover can be found in `planck/keymaps/default`. Switching to the `PLOVER` layer adjusts the position of the keyboard to support the number bar.
To use Plover with QMK just enable NKRO and optionally adjust your layout if you have anything other than a standard layout. You may also want to purchase some steno-friendly keycaps to make it easier to hit multiple keys.
## Plover with Steno Protocol
Plover also understands the language of several steno machines. QMK can speak a couple of these languages, TX Bolt and GeminiRP. An example layout can be found in `planck/keymaps/steno`.
When QMK speaks to Plover over a steno protocol Plover will not use the keyboard as input. This means that you can switch back and forth between a standard keyboard and your steno keyboard, or even switch layers from Plover to standard and back without needing to activate/deactive Plover.
In this mode Plover expects to speak with a steno machine over a serial port so QMK will present itself to the operating system as a virtual serial port in addition to a keyboard. By default QMK will speak the TX Bolt protocol but can be switched to GeminiRP; the last protocol used is stored in non-volatile memory so QMK will use the same protocol on restart.
> Note: Due to hardware limitations you may not be able to run both a virtual serial port and mouse emulation at the same time.
### TX Bolt
TX Bolt communicates the status of 24 keys over a very simple protocol in variable-sized (1-5 byte) packets.
### GeminiRP
GeminiRP encodes 42 keys into a 6-byte packet. While TX Bolt contains everything that is necessary for standard stenography, GeminiRP opens up many more options, including supporting non-English theories.
## Configuring QMK for Steno
Firstly, enable steno in your keymap's Makefile. You should also diable mousekeys to prevent conflicts.
```Makefile
STENO_ENABLE = yes
MOUSEKEY_ENABLE = no
```
In your keymap create a new layer for Plover. You will need to include `keymap_steno.h`. See `planck/keymaps/steno/keymap.c` for an example. Remember to create a key to switch to the layer as well as a key for exiting the layer. If you would like to switch modes on the fly you can use the keycodes `QK_STENO_BOLT` and `QK_STENO_GEMINI`. If you only want to use one of the protocols you may set it up in your initialization function:
```C
void matrix_init_user() {
steno_set_mode(STENO_MODE_GEMINI); // or STENO_MODE_BOLT
}
```
Once you have your keyboard flashed launch Plover. Click the 'Configure...' button. In the 'Machine' tab select the Stenotype Machine that corresponds to your desired protocol. Click the 'Configure...' button on this tab and enter the serial port or click 'Scan'. Baud rate is fine at 9600 (although you should be able to set as high as 115200 with no issues). Use the default settings for everything else (Data Bits: 8, Stop Bits: 1, Parity: N, no flow control).
On the display tab click 'Open stroke display'. With Plover disabled you should be able to hit keys on your keyboard and see them show up in the stroke display window. Use this to make sure you have set up your keymap correctly. You are now ready to steno!
## Learning Stenography
* [Learn Plover!](https://sites.google.com/site/ploverdoc/)
* [QWERTY Steno](http://qwertysteno.com/Home/)
* [Steno Jig](https://joshuagrams.github.io/steno-jig/)
* More resources at the Plover [Learning Stenography](https://github.com/openstenoproject/plover/wiki/Learning-Stenography) wiki
## Keycode Reference
As defined in `keymap_steno.h`.
> Note: TX Bolt does not support the full set of keys. The TX Bolt implementation in QMK will map the GeminiRP keys to the nearest TX Bolt key so that one key map will work for both.
|GeminiRP|TX Bolt|Steno Key|
|--------|-------|-----------|
|`STN_N1`|`STN_NUM`|Number bar #1|
|`STN_N2`|`STN_NUM`|Number bar #2|
|`STN_N3`|`STN_NUM`|Number bar #3|
|`STN_N4`|`STN_NUM`|Number bar #4|
|`STN_N5`|`STN_NUM`|Number bar #5|
|`STN_N6`|`STN_NUM`|Number bar #6|
|`STN_N7`|`STN_NUM`|Number bar #7|
|`STN_N8`|`STN_NUM`|Number bar #8|
|`STN_N9`|`STN_NUM`|Number bar #9|
|`STN_NA`|`STN_NUM`|Number bar #A|
|`STN_NB`|`STN_NUM`|Number bar #B|
|`STN_NC`|`STN_NUM`|Number bar #C|
|`STN_S1`|`STN_SL`| `S-` upper|
|`STN_S2`|`STN_SL`| `S-` lower|
|`STN_TL`|`STN_TL`| `T-`|
|`STN_KL`|`STN_KL`| `K-`|
|`STN_PL`|`STN_PL`| `P-`|
|`STN_WL`|`STN_WL`| `W-`|
|`STN_HL`|`STN_HL`| `H-`|
|`STN_RL`|`STN_RL`| `R-`|
|`STN_A`|`STN_A`| `A` vowel|
|`STN_O`|`STN_O`| `O` vowel|
|`STN_ST1`|`STN_STR`| `*` upper-left |
|`STN_ST2`|`STN_STR`| `*` lower-left|
|`STN_ST3`|`STN_STR`| `*` upper-right|
|`STN_ST4`|`STN_STR`| `*` lower-right|
|`STN_E`|`STN_E`| `E` vowel|
|`STN_U`|`STN_U`| `U` vowel|
|`STN_FR`|`STN_FR`| `-F`|
|`STN_PR`|`STN_PR`| `-P`|
|`STN_RR`|`STN_RR`| `-R`|
|`STN_BR`|`STN_BR`| `-B`|
|`STN_LR`|`STN_LR`| `-L`|
|`STN_GR`|`STN_GR`| `-G`|
|`STN_TR`|`STN_TR`| `-T`|
|`STN_SR`|`STN_SR`| `-S`|
|`STN_DR`|`STN_DR`| `-D`|
|`STN_ZR`|`STN_ZR`| `-Z`|
|`STN_FN`|| (GeminiRP only)|
|`STN_RES1`||(GeminiRP only)|
|`STN_RES2`||(GeminiRP only)|
|`STN_PWR`||(GeminiRP only)|

View File

@ -0,0 +1,5 @@
SUBPROJECT_DEFAULT = v2
ifndef MAKEFILE_INCLUDED
include ../../Makefile
endif

View File

@ -0,0 +1,29 @@
/*
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"
#ifdef SUBPROJECT_protosplit
#include "protosplit/config.h"
#endif
#ifdef SUBPROJECT_v2
#include "v2/config.h"
#endif
#endif

View File

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

View File

@ -0,0 +1,13 @@
#ifndef DELTASPLIT75_H
#define DELTASPLIT75_H
#ifdef SUBPROJECT_v2
#include "v2.h"
#endif
#ifdef SUBPROJECT_protosplit
#include "protosplit.h"
#endif
#include "quantum.h"
#endif

View File

@ -0,0 +1,2 @@
:0B0000000000000000000000000001F4
:00000001FF

View File

@ -0,0 +1,2 @@
:0B0000000000000000000000000000F5
:00000001FF

View File

@ -0,0 +1,162 @@
#include <util/twi.h>
#include <avr/io.h>
#include <stdlib.h>
#include <avr/interrupt.h>
#include <util/twi.h>
#include <stdbool.h>
#include "i2c.h"
#ifdef USE_I2C
// Limits the amount of we wait for any one i2c transaction.
// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
// 9 bits, a single transaction will take around 90μs to complete.
//
// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit
// poll loop takes at least 8 clock cycles to execute
#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8
#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE)
volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
static volatile uint8_t slave_buffer_pos;
static volatile bool slave_has_register_set = false;
// Wait for an i2c operation to finish
inline static
void i2c_delay(void) {
uint16_t lim = 0;
while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT)
lim++;
// easier way, but will wait slightly longer
// _delay_us(100);
}
// Setup twi to run at 100kHz
void i2c_master_init(void) {
// no prescaler
TWSR = 0;
// Set TWI clock frequency to SCL_CLOCK. Need TWBR>10.
// Check datasheets for more info.
TWBR = ((F_CPU/SCL_CLOCK)-16)/2;
}
// Start a transaction with the given i2c slave address. The direction of the
// transfer is set with I2C_READ and I2C_WRITE.
// returns: 0 => success
// 1 => error
uint8_t i2c_master_start(uint8_t address) {
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA);
i2c_delay();
// check that we started successfully
if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START))
return 1;
TWDR = address;
TWCR = (1<<TWINT) | (1<<TWEN);
i2c_delay();
if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) )
return 1; // slave did not acknowledge
else
return 0; // success
}
// Finish the i2c transaction.
void i2c_master_stop(void) {
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
uint16_t lim = 0;
while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT)
lim++;
}
// Write one byte to the i2c slave.
// returns 0 => slave ACK
// 1 => slave NACK
uint8_t i2c_master_write(uint8_t data) {
TWDR = data;
TWCR = (1<<TWINT) | (1<<TWEN);
i2c_delay();
// check if the slave acknowledged us
return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1;
}
// Read one byte from the i2c slave. If ack=1 the slave is acknowledged,
// if ack=0 the acknowledge bit is not set.
// returns: byte read from i2c device
uint8_t i2c_master_read(int ack) {
TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA);
i2c_delay();
return TWDR;
}
void i2c_reset_state(void) {
TWCR = 0;
}
void i2c_slave_init(uint8_t address) {
TWAR = address << 0; // slave i2c address
// TWEN - twi enable
// TWEA - enable address acknowledgement
// TWINT - twi interrupt flag
// TWIE - enable the twi interrupt
TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN);
}
ISR(TWI_vect);
ISR(TWI_vect) {
uint8_t ack = 1;
switch(TW_STATUS) {
case TW_SR_SLA_ACK:
// this device has been addressed as a slave receiver
slave_has_register_set = false;
break;
case TW_SR_DATA_ACK:
// this device has received data as a slave receiver
// The first byte that we receive in this transaction sets the location
// of the read/write location of the slaves memory that it exposes over
// i2c. After that, bytes will be written at slave_buffer_pos, incrementing
// slave_buffer_pos after each write.
if(!slave_has_register_set) {
slave_buffer_pos = TWDR;
// don't acknowledge the master if this memory loctaion is out of bounds
if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) {
ack = 0;
slave_buffer_pos = 0;
}
slave_has_register_set = true;
} else {
i2c_slave_buffer[slave_buffer_pos] = TWDR;
BUFFER_POS_INC();
}
break;
case TW_ST_SLA_ACK:
case TW_ST_DATA_ACK:
// master has addressed this device as a slave transmitter and is
// requesting data.
TWDR = i2c_slave_buffer[slave_buffer_pos];
BUFFER_POS_INC();
break;
case TW_BUS_ERROR: // something went wrong, reset twi state
TWCR = 0;
default:
break;
}
// Reset everything, so we are ready for the next TWI interrupt
TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
}
#endif

View File

@ -0,0 +1,31 @@
#ifndef I2C_H
#define I2C_H
#include <stdint.h>
#ifndef F_CPU
#define F_CPU 16000000UL
#endif
#define I2C_READ 1
#define I2C_WRITE 0
#define I2C_ACK 1
#define I2C_NACK 0
#define SLAVE_BUFFER_SIZE 0x10
// i2c SCL clock frequency
#define SCL_CLOCK 100000L
extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
void i2c_master_init(void);
uint8_t i2c_master_start(uint8_t address);
void i2c_master_stop(void);
uint8_t i2c_master_write(uint8_t data);
uint8_t i2c_master_read(int);
void i2c_reset_state(void);
void i2c_slave_init(uint8_t address);
#endif

View File

@ -0,0 +1,31 @@
/*
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/>.
*/
#define USE_SERIAL
#define MASTER_LEFT
// #define _MASTER_RIGHT
// #define EE_HANDS
#ifdef SUBPROJECT_v2
#include "../../v2/config.h"
#endif
#ifdef SUBPROJECT_protosplit
#include "../../protosplit/config.h"
#endif

View File

@ -0,0 +1,31 @@
#include "deltasplit75.h"
#include "action_layer.h"
#include "eeconfig.h"
extern keymap_config_t keymap_config;
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
// Fillers to make layering more clear
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KEYMAP_V2(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_HOME, KC_PGUP,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_DEL, KC_END, KC_PGDN,
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_BSPC, KC_SLCK,
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_TRNS, KC_ENT, KC_PAUS, //modify KC_TRNS to enable ISO Support
KC_LSFT, KC_TRNS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_LSFT, KC_UP, KC_PSCR, //modify KC_TRNS to enable ISO Support
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
KEYMAP_V2(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET,
KC_BSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_VOLU, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
M(1), KC_LEFT, KC_DOWN, KC_RGHT, KC_PAUS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_VOLD, M(0), KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
};

View File

@ -0,0 +1,7 @@
RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
AUDIO_ENABLE = no # Audio disabled while using RGB underlight.
EXTRAKEY_ENABLE = yes
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

View File

@ -0,0 +1,31 @@
/*
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/>.
*/
#define USE_SERIAL
#define MASTER_LEFT
// #define _MASTER_RIGHT
// #define EE_HANDS
#ifdef SUBPROJECT_v2
#include "../../v2/config.h"
#endif
#ifdef SUBPROJECT_protosplit
#include "../../protosplit/config.h"
#endif

View File

@ -0,0 +1,46 @@
#include "deltasplit75.h"
#include "action_layer.h"
#include "eeconfig.h"
extern keymap_config_t keymap_config;
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
// Fillers to make layering more clear
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Layer 0: Default Layer
*,-----------------------------------------------------------------------.
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9| F10| F11| F12|Prnt|Ins|Del|
* |----------------------------------------------------------------------|
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| Backspace| Home|
* |----------------------------------------------------------------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| PgUp|
* |----------------------------------------------------------------------|
* |Ctrl| A| S| D| F| G| H| J| K| L| ;| '|Enter | PgDown|
* |----------------------------------------------------------------------|
* |Shif| | Z| X| C| V| B| N| M| ,| .| /|Shift | Up| End|
* |----------------------------------------------------------------------|
* |CapsLo|Gui |Alt |Sp |Mod | Sp| Alt| Gui| Ctrl| | Lef| Dow| Rig|
* `----------------------------------------------------------------------'
*/
KEYMAP_V2(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_INS, KC_DEL,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_TRNS, KC_HOME, // KC_TRNS is the unneeded key in the split backspace.
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP,
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_TRNS, KC_ENT, KC_PGDN, // KC_TRNS is unneeded ISO enter key.
KC_LSFT, KC_TRNS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, // KC_TRNS is uneeded ISO layout key.
KC_CAPS, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
KEYMAP_V2(
RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET,
RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLU,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, KC_VOLD,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_STOP, KC_MNXT),
};

View File

@ -0,0 +1,31 @@
/*
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/>.
*/
#define USE_SERIAL
#define MASTER_LEFT
// #define _MASTER_RIGHT
// #define EE_HANDS
#ifdef SUBPROJECT_v2
#include "../../v2/config.h"
#endif
#ifdef SUBPROJECT_protosplit
#include "../../protosplit/config.h"
#endif

View File

@ -0,0 +1,32 @@
#include "deltasplit75.h"
#include "action_layer.h"
#include "eeconfig.h"
extern keymap_config_t keymap_config;
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
// Fillers to make layering more clear
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KEYMAP_PROTOSPLIT(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_HOME, KC_PGUP,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_DEL, KC_END, KC_PGDN,
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_BSPC, KC_SLCK,
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_PAUS,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_LSFT, KC_UP, KC_PSCR,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_SPC, KC_RALT, KC_RGUI, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
KEYMAP_PROTOSPLIT(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET,
KC_BSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_VOLU, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
M(1), KC_LEFT, KC_DOWN, KC_RGHT, KC_PAUS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_VOLD, M(0), KC_PSCR, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,137 @@
DeltaSplit75
======
This readme and most of the code are from https://github.com/ahtn/tmk_keyboard/ and https://github.com/qmk/qmk_firmware/tree/master/keyboards/lets_split
Credit to ahtn and wootpatoot for work on the split keyboard firmware
Split keyboard firmware for Arduino Pro Micro or other ATmega32u4
based boards.
## Case Files
Files are available here: https://github.com/xyxjj/DeltaSplit75-Case-files
## Build Guide
The build guide should be found at https://qmk.fm/deltasplit75
## First Time Setup
Download or clone the whole firmware and navigate to the keyboards/deltasplit75 directory. Once your dev env is setup, you'll be able to generate the .hex using:
```
make v2
or
make v2-YOUR_KEYMAP_NAME (if you make a folder for your keymap)
or
make protosplit (if you have one of the prototype PCBs)
```
You will see a lot of output and if everything worked correctly you will see the built hex files:
```
deltasplit75_v2_protosplit.hex
or
deltasplit74_v2_YOUR_KEYMAP_NAME.hex
or
deltasplit75_v2_default.hex
```
For more information on customizing keymaps, take a look at the primary documentation for [Customizing Your Keymap](/readme.md##customizing-your-keymap) in the main readme.md.
### DeltaSplit75 V2
The PCBs available in groupbuy are all v2, if you've bought one of my prototype PCBs (it says DeltaSplit65 on the silkscreen instead of 75), use the code make protosplit instead
Features
--------
For the full Quantum Mechanical Keyboard feature list, see [the parent readme.md](/readme.md).
Some features supported by the firmware:
* Either half can connect to the computer via USB, or both halves can be used
independently.
* 75% formfactor
* Support for multiple Bottom Rows
* RGB underglow support
* Split Backspace and ISO support
Flashing
-------
I personally use xLoader to upload my hex files to the keyboard, though any other working software is fine too
Choosing which board to plug the USB cable into (choosing Master)
--------
Because the two boards are identical, the firmware has logic to differentiate the left and right board.
It uses two strategies to figure things out: look at the EEPROM (memory on the chip) or looks if the current board has the usb cable.
The EEPROM approach requires additional setup (flashing the eeeprom) but allows you to swap the usb cable to either side.
The USB cable approach is easier to setup and if you just want the usb cable on the left board, you do not need to do anything extra.
### Setting the left hand as master
If you always plug the usb cable into the left board, nothing extra is needed as this is the default. Comment out `EE_HANDS` and comment out `I2C_MASTER_RIGHT` or `MASTER_RIGHT` if for some reason it was set.
### Setting the right hand as master
If you always plug the usb cable into the right board, add an extra flag to your `config.h`
```
#define MASTER_RIGHT
```
### Setting EE_hands to use either hands as master
If you define `EE_HANDS` in your `config.h`, you will need to set the
EEPROM for the left and right halves.
The EEPROM is used to store whether the
half is left handed or right handed. This makes it so that the same firmware
file will run on both hands instead of having to flash left and right handed
versions of the firmware to each half. To flash the EEPROM file for the left
half run:
```
avrdude -p atmega32u4 -P $(COM_PORT) -c avr109 -U eeprom:w:eeprom-lefthand.eep
// or the equivalent in dfu-programmer
```
and similarly for right half
```
avrdude -p atmega32u4 -P $(COM_PORT) -c avr109 -U eeprom:w:eeprom-righhand.eep
// or the equivalent in dfu-programmer
```
NOTE: replace `$(COM_PORT)` with the port of your device (e.g. `/dev/ttyACM0`)
After you have flashed the EEPROM, you then need to set `EE_HANDS` in your config.h, rebuild the hex files and reflash.
Note that you need to program both halves, but you have the option of using
different keymaps for each half. You could program the left half with a QWERTY
layout and the right half with a Colemak layout using bootmagic's default layout option.
Then if you connect the left half to a computer by USB the keyboard will use QWERTY and Colemak when the
right half is connected.
Notes on Using Pro Micro 3.3V
-----------------------------
Do update the `F_CPU` parameter in `rules.mk` to `8000000` which reflects
the frequency on the 3.3V board.
Also, if the slave board is producing weird characters in certain columns,
update the following line in `matrix.c` to the following:
```
// _delay_us(30); // without this wait read unstable value.
_delay_us(300); // without this wait read unstable value.
```

View File

@ -0,0 +1,87 @@
SRC += matrix.c \
i2c.c \
split_util.c \
serial.c
# 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=4096
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700)
EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450)
CONSOLE_ENABLE ?= no # Console for debug(+400)
COMMAND_ENABLE ?= yes # Commands for debug and configuration
NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality
MIDI_ENABLE ?= no # MIDI controls
AUDIO_ENABLE ?= no # Audio output on port C6
UNICODE_ENABLE ?= no # Unicode
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
SUBPROJECT_rev1 ?= yes
USE_I2C ?= yes
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
CUSTOM_MATRIX = yes
avrdude: build
ls /dev/tty* > /tmp/1; \
echo "Reset your Pro Micro now"; \
while [[ -z $$USB ]]; do \
sleep 1; \
ls /dev/tty* > /tmp/2; \
USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \
done; \
avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex
.PHONY: avrdude

View File

@ -0,0 +1,228 @@
/*
* WARNING: be careful changing this code, it is very timing dependent
*/
#ifndef F_CPU
#define F_CPU 16000000
#endif
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <stdbool.h>
#include "serial.h"
#ifdef USE_SERIAL
// Serial pulse period in microseconds. Its probably a bad idea to lower this
// value.
#define SERIAL_DELAY 24
uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
#define SLAVE_DATA_CORRUPT (1<<0)
volatile uint8_t status = 0;
inline static
void serial_delay(void) {
_delay_us(SERIAL_DELAY);
}
inline static
void serial_output(void) {
SERIAL_PIN_DDR |= SERIAL_PIN_MASK;
}
// make the serial pin an input with pull-up resistor
inline static
void serial_input(void) {
SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK;
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
}
inline static
uint8_t serial_read_pin(void) {
return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK);
}
inline static
void serial_low(void) {
SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK;
}
inline static
void serial_high(void) {
SERIAL_PIN_PORT |= SERIAL_PIN_MASK;
}
void serial_master_init(void) {
serial_output();
serial_high();
}
void serial_slave_init(void) {
serial_input();
// Enable INT0
EIMSK |= _BV(INT0);
// Trigger on falling edge of INT0
EICRA &= ~(_BV(ISC00) | _BV(ISC01));
}
// Used by the master to synchronize timing with the slave.
static
void sync_recv(void) {
serial_input();
// This shouldn't hang if the slave disconnects because the
// serial line will float to high if the slave does disconnect.
while (!serial_read_pin());
serial_delay();
}
// Used by the slave to send a synchronization signal to the master.
static
void sync_send(void) {
serial_output();
serial_low();
serial_delay();
serial_high();
}
// Reads a byte from the serial line
static
uint8_t serial_read_byte(void) {
uint8_t byte = 0;
serial_input();
for ( uint8_t i = 0; i < 8; ++i) {
byte = (byte << 1) | serial_read_pin();
serial_delay();
_delay_us(1);
}
return byte;
}
// Sends a byte with MSB ordering
static
void serial_write_byte(uint8_t data) {
uint8_t b = 8;
serial_output();
while( b-- ) {
if(data & (1 << b)) {
serial_high();
} else {
serial_low();
}
serial_delay();
}
}
// interrupt handle to be used by the slave device
ISR(SERIAL_PIN_INTERRUPT) {
sync_send();
uint8_t checksum = 0;
for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
serial_write_byte(serial_slave_buffer[i]);
sync_send();
checksum += serial_slave_buffer[i];
}
serial_write_byte(checksum);
sync_send();
// wait for the sync to finish sending
serial_delay();
// read the middle of pulses
_delay_us(SERIAL_DELAY/2);
uint8_t checksum_computed = 0;
for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
serial_master_buffer[i] = serial_read_byte();
sync_send();
checksum_computed += serial_master_buffer[i];
}
uint8_t checksum_received = serial_read_byte();
sync_send();
serial_input(); // end transaction
if ( checksum_computed != checksum_received ) {
status |= SLAVE_DATA_CORRUPT;
} else {
status &= ~SLAVE_DATA_CORRUPT;
}
}
inline
bool serial_slave_DATA_CORRUPT(void) {
return status & SLAVE_DATA_CORRUPT;
}
// Copies the serial_slave_buffer to the master and sends the
// serial_master_buffer to the slave.
//
// Returns:
// 0 => no error
// 1 => slave did not respond
int serial_update_buffers(void) {
// this code is very time dependent, so we need to disable interrupts
cli();
// signal to the slave that we want to start a transaction
serial_output();
serial_low();
_delay_us(1);
// wait for the slaves response
serial_input();
serial_high();
_delay_us(SERIAL_DELAY);
// check if the slave is present
if (serial_read_pin()) {
// slave failed to pull the line low, assume not present
sei();
return 1;
}
// if the slave is present syncronize with it
sync_recv();
uint8_t checksum_computed = 0;
// receive data from the slave
for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) {
serial_slave_buffer[i] = serial_read_byte();
sync_recv();
checksum_computed += serial_slave_buffer[i];
}
uint8_t checksum_received = serial_read_byte();
sync_recv();
if (checksum_computed != checksum_received) {
sei();
return 1;
}
uint8_t checksum = 0;
// send data to the slave
for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) {
serial_write_byte(serial_master_buffer[i]);
sync_recv();
checksum += serial_master_buffer[i];
}
serial_write_byte(checksum);
sync_recv();
// always, release the line when not in use
serial_output();
serial_high();
sei();
return 0;
}
#endif

View File

@ -0,0 +1,26 @@
#ifndef MY_SERIAL_H
#define MY_SERIAL_H
#include "config.h"
#include <stdbool.h>
/* TODO: some defines for interrupt setup */
#define SERIAL_PIN_DDR DDRD
#define SERIAL_PIN_PORT PORTD
#define SERIAL_PIN_INPUT PIND
#define SERIAL_PIN_MASK _BV(PD0)
#define SERIAL_PIN_INTERRUPT INT0_vect
#define SERIAL_SLAVE_BUFFER_LENGTH ((MATRIX_COLS+7)/8 *MATRIX_ROWS/2)
#define SERIAL_MASTER_BUFFER_LENGTH 1
// Buffers for master - slave communication
extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
void serial_master_init(void);
void serial_slave_init(void);
int serial_update_buffers(void);
bool serial_slave_data_corrupt(void);
#endif

View File

@ -0,0 +1,81 @@
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <avr/eeprom.h>
#include "split_util.h"
#include "matrix.h"
#include "keyboard.h"
#include "config.h"
#ifdef USE_I2C
# include "i2c.h"
#else
# include "serial.h"
#endif
volatile bool isLeftHand = true;
static void setup_handedness(void) {
#ifdef EE_HANDS
isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS);
#else
// I2C_MASTER_RIGHT is deprecated use MASTER_RIGHT instead since this works for both serial and i2c
#if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT)
isLeftHand = !has_usb();
#else
isLeftHand = has_usb();
#endif
#endif
}
static void keyboard_master_setup(void) {
#ifdef USE_I2C
i2c_master_init();
#else
serial_master_init();
#endif
}
static void keyboard_slave_setup(void) {
#ifdef USE_I2C
i2c_slave_init(SLAVE_I2C_ADDRESS);
#else
serial_slave_init();
#endif
}
bool has_usb(void) {
USBCON |= (1 << OTGPADE); //enables VBUS pad
_delay_us(5);
return (USBSTA & (1<<VBUS)); //checks state of VBUS
}
void split_keyboard_setup(void) {
setup_handedness();
if (has_usb()) {
keyboard_master_setup();
} else {
keyboard_slave_setup();
}
sei();
}
void keyboard_slave_loop(void) {
matrix_init();
while (1) {
matrix_slave_scan();
}
}
// this code runs before the usb and keyboard is initialized
void matrix_setup(void) {
split_keyboard_setup();
if (!has_usb()) {
keyboard_slave_loop();
}
}

View File

@ -0,0 +1,22 @@
#ifndef SPLIT_KEYBOARD_UTIL_H
#define SPLIT_KEYBOARD_UTIL_H
#include <stdbool.h>
#ifdef EE_HANDS
#define EECONFIG_BOOTMAGIC_END (uint8_t *)10
#define EECONFIG_HANDEDNESS EECONFIG_BOOTMAGIC_END
#endif
#define SLAVE_I2C_ADDRESS 0x32
extern volatile bool isLeftHand;
// slave version of matix scan, defined in matrix.c
void matrix_slave_scan(void);
void split_keyboard_setup(void);
bool has_usb(void);
void keyboard_slave_loop(void);
#endif

View File

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

View File

@ -0,0 +1,90 @@
/*
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 0x3060
#define DEVICE_VER 0x0001
#define MANUFACTURER xyxjj
#define PRODUCT DeltaSplit75
#define DESCRIPTION 75% split keyboard
/* key matrix size */
// Rows are doubled-up
#define MATRIX_ROWS 14
#define MATRIX_COLS 8
// wiring of each half
#define MATRIX_ROW_PINS { F4, F5, F6, F7, B1, B3, B2 }
#define MATRIX_COL_PINS { B6, B5, B4, E6, D7, C6, D4, D1}
#define CATERINA_BOOTLOADER
/* 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)) \
)
/* ws2812 RGB LED */
#define RGB_DI_PIN D3
#define RGBLIGHT_TIMER
#define RGBLED_NUM 12 // Number of LEDs
#define ws2812_PORTREG PORTD
#define ws2812_DDRREG DDRD
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
// #define NO_DEBUG
/* disable print */
// #define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
#endif

View File

@ -0,0 +1,5 @@
BACKLIGHT_ENABLE = no
ifndef QUANTUM_DIR
include ../../../Makefile
endif

View File

@ -0,0 +1,14 @@
#include "deltasplit75.h"
void matrix_init_kb(void) {
// // green led on
// DDRD |= (1<<5);
// PORTD &= ~(1<<5);
// // orange led on
// DDRB |= (1<<0);
// PORTB &= ~(1<<0);
matrix_init_user();
};

Some files were not shown because too many files have changed in this diff Show More