(intermediate checkin)

partial-rewrite
Ben Blazak 2013-01-21 23:33:08 -08:00
parent f70568c1c0
commit be26a411f2
8 changed files with 774 additions and 72 deletions

View File

@ -0,0 +1,229 @@
/* ----------------------------------------------------------------------------
* Copyright (c) 2012, 2013 Ben Blazak <benblazak.dev@gmail.com>
* Released under The MIT License (MIT) (see "license.md")
* Project located at <https://github.com/benblazak/ergodox-firmware>
* ------------------------------------------------------------------------- */
/*
* Teensy 2.0 specific code, helping to implement the "controller" section of
* '.../firmware/keyboard.h'
*/
#include <stdbool.h>
#include <stdint.h>
#include <avr/io.h>
#include <util/delay.h>
#include "../../../../firmware/keyboard.h"
#include "../../../../firmware/lib/twi.h"
// ----------------------------------------------------------------------------
#if F_CPU != 16000000
#error "Expecting different CPU frequency"
#endif
#if KB__ROWS != 6 || KB__COLUMNS != 14
#error "Expecting different keyboard dimensions"
#endif
// ----------------------------------------------------------------------------
// processor frequency (from <http://www.pjrc.com/teensy/prescaler.html>)
#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
#define CPU_16MHz 0x00
#define CPU_8MHz 0x01
#define CPU_4MHz 0x02
#define CPU_2MHz 0x03
#define CPU_1MHz 0x04
#define CPU_500kHz 0x05
#define CPU_250kHz 0x06
#define CPU_125kHz 0x07
#define CPU_62kHz 0x08
/*
* pin macros
* - note: you can move the `UNUSED`, `ROW`, and `COLUMN` pins around, but be
* sure to keep the set of all the pins listed constant. other pins are not
* movable, and either are referenced explicitly or have macros defined for
* them elsewhere.
* - note: if you change pin assignments, please be sure to update
* "teensy-2-0.md", and the '.svg' circuit diagram.
*/
// --- unused
#define UNUSED_0 C, 7
#define UNUSED_1 D, 7
#define UNUSED_2 D, 4 // hard to use with breadboard (on the end)
#define UNUSED_3 D, 5 // hard to use with breadboard (on the end)
#define UNUSED_4 E, 6 // hard to use with breadboard (internal)
// --- rows
#define ROW_0 F, 7
#define ROW_1 F, 6
#define ROW_2 F, 5
#define ROW_3 F, 4
#define ROW_4 F, 1
#define ROW_5 F, 0
// --- columns
#define COLUMN_7 B, 0
#define COLUMN_8 B, 1
#define COLUMN_9 B, 2
#define COLUMN_A B, 3
#define COLUMN_B D, 2
#define COLUMN_C D, 3
#define COLUMN_D C, 6
// --- helpers
#define SET |=
#define CLEAR &=~
#define _teensypin_write(register, operation, pin_letter, pin_number) \
do { \
((register##pin_letter) operation (1<<(pin_number))); \
_delay_us(1); /* allow pins time to stabilize */ \
} while(0)
#define teensypin_write(register, operation, pin) \
_teensypin_write(register, operation, pin)
#define _teensypin_read(pin_letter, pin_number) \
((PIN##pin_letter) & (1<<(pin_number)))
#define teensypin_read(pin) \
_teensypin_read(pin)
#define teensypin_write_all_unused(register, operation) \
do { \
teensypin_write(register, operation, UNUSED_0); \
teensypin_write(register, operation, UNUSED_1); \
teensypin_write(register, operation, UNUSED_2); \
teensypin_write(register, operation, UNUSED_3); \
teensypin_write(register, operation, UNUSED_4); } \
while(0)
#define teensypin_write_all_row(register, operation) \
do { \
teensypin_write(register, operation, ROW_0); \
teensypin_write(register, operation, ROW_1); \
teensypin_write(register, operation, ROW_2); \
teensypin_write(register, operation, ROW_3); \
teensypin_write(register, operation, ROW_4); \
teensypin_write(register, operation, ROW_5); } \
while(0)
#define teensypin_write_all_column(register, operation) \
do { \
teensypin_write(register, operation, COLUMN_7); \
teensypin_write(register, operation, COLUMN_8); \
teensypin_write(register, operation, COLUMN_9); \
teensypin_write(register, operation, COLUMN_A); \
teensypin_write(register, operation, COLUMN_B); \
teensypin_write(register, operation, COLUMN_C); \
teensypin_write(register, operation, COLUMN_D); } \
while(0)
/*
* update macros
*/
#define update_rows_for_column(matrix, column) \
do { \
/* set column low (set as output) */ \
teensypin_write(DDR, SET, COLUMN_##column); \
/* read rows 0..5 and update matrix */ \
matrix[0x0][0x##column] = ! teensypin_read(ROW_0); \
matrix[0x1][0x##column] = ! teensypin_read(ROW_1); \
matrix[0x2][0x##column] = ! teensypin_read(ROW_2); \
matrix[0x3][0x##column] = ! teensypin_read(ROW_3); \
matrix[0x4][0x##column] = ! teensypin_read(ROW_4); \
matrix[0x5][0x##column] = ! teensypin_read(ROW_5); \
/* set column hi-Z (set as input) */ \
teensypin_write(DDR, CLEAR, COLUMN_##column); \
} while(0)
#define update_columns_for_row(matrix, row) \
do { \
/* set row low (set as output) */ \
teensypin_write(DDR, SET, ROW_##row); \
/* read columns 7..D and update matrix */ \
matrix[0x##row][0x7] = ! teensypin_read(COLUMN_7); \
matrix[0x##row][0x8] = ! teensypin_read(COLUMN_8); \
matrix[0x##row][0x9] = ! teensypin_read(COLUMN_9); \
matrix[0x##row][0xA] = ! teensypin_read(COLUMN_A); \
matrix[0x##row][0xB] = ! teensypin_read(COLUMN_B); \
matrix[0x##row][0xC] = ! teensypin_read(COLUMN_C); \
matrix[0x##row][0xD] = ! teensypin_read(COLUMN_D); \
/* set row hi-Z (set as input) */ \
teensypin_write(DDR, CLEAR, ROW_##row); \
} while(0)
// ----------------------------------------------------------------------------
/*
* returns
* - success: 0
*/
uint8_t teensy__init(void) {
// CPU speed : should match F_CPU in makefile
CPU_PRESCALE(CPU_16MHz);
// onboard LED
// (tied to GND for hardware convenience)
DDRD &= ~(1<<6); // set D(6) as input
PORTD &= ~(1<<6); // set D(6) internal pull-up disabled
// (tied to Vcc for hardware convenience)
DDRB &= ~(1<<4); // set B(4) as input
PORTB &= ~(1<<4); // set B(4) internal pull-up disabled
// keyboard LEDs (see "PWM on ports OC1(A|B|C)" in "teensy-2-0.md")
kb__led__all_off(); // (just to put the pins in a known state)
TCCR1A = 0b10101001; // set and configure fast PWM
TCCR1B = 0b00001001; // set and configure fast PWM
// I2C (TWI)
twi_init(); // on pins D(1,0)
// unused pins
teensypin_write_all_unused(DDR, CLEAR); // set as input
teensypin_write_all_unused(PORT, SET); // set internal pull-up enabled
// rows and columns
teensypin_write_all_row(DDR, CLEAR); // set as input (hi-Z)
teensypin_write_all_column(DDR, CLEAR); // set as input (hi-Z)
#if MAKE__TEENSY__DRIVE_ROWS
teensypin_write_all_row(PORT, CLEAR); // pull-up disabled
teensypin_write_all_column(PORT, SET); // pull-up enabled
#elif MAKE__TEENSY__DRIVE_COLUMNS
teensypin_write_all_row(PORT, SET); // pull-up enabled
teensypin_write_all_column(PORT, CLEAR); // pull-up disabled
#endif
return 0; // success
}
/*
* returns
* - success: 0
*/
uint8_t teensy__update_matrix(bool matrix[KB__ROWS][KB__COLUMNS]) {
#if MAKE__TEENSY__DRIVE_ROWS
update_columns_for_row(matrix, 0);
update_columns_for_row(matrix, 1);
update_columns_for_row(matrix, 2);
update_columns_for_row(matrix, 3);
update_columns_for_row(matrix, 4);
update_columns_for_row(matrix, 5);
#elif MAKE__TEENSY__DRIVE_COLUMNS
update_rows_for_column(matrix, 7);
update_rows_for_column(matrix, 8);
update_rows_for_column(matrix, 9);
update_rows_for_column(matrix, A);
update_rows_for_column(matrix, B);
update_rows_for_column(matrix, C);
update_rows_for_column(matrix, D);
#endif
return 0; // success
}

View File

@ -0,0 +1,205 @@
/* ----------------------------------------------------------------------------
* Copyright (c) 2013 Ben Blazak <benblazak.dev@gmail.com>
* Released under The MIT License (see "license.md")
* Project located at <https://github.com/benblazak/ergodox-firmware>
* ------------------------------------------------------------------------- */
/**
* - description: |
* A Colemak layout (modified from the Kinesis layout).
*
* Notes:
* * This layout *does not* contain a key mapped to the bootloader function.
* To reflash from this layout, you will need to physically press the
* button on the top right of the Teensy.
*
* History:
* * Originally submitted by Jason Trill [jjt] (https://github.com/jjt) (who
* declined to be added to the copyright above).
* * Transcribed by Ben Blazak when the layout format changed.
*
*/
#include "../../../../firmware/keyboard/ergodox/matrix.h"
#include "./default/common.h"
// ----------------------------------------------------------------------------
// matrix control
// ----------------------------------------------------------------------------
#include "./default/exec_key.c.h"
// ----------------------------------------------------------------------------
// LED control
// ----------------------------------------------------------------------------
void kb__led__logical_on(char led) {
switch led {
case 'N': kb__led__on(1); break; // numlock
case 'C': kb__led__on(2); break; // capslock
case 'S': kb__led__on(3); break; // scroll lock
case 'O': break; // compose
case 'K': break; // kana
};
}
void kb__led__logical_off(char led) {
switch led {
case 'N': kb__led__off(1); break; // numlock
case 'C': kb__led__off(2); break; // capslock
case 'S': kb__led__off(3); break; // scroll lock
case 'O': break; // compose
case 'K': break; // kana
};
}
// ----------------------------------------------------------------------------
// keys
// ----------------------------------------------------------------------------
#include "./default/keys.h"
// layer
key_t L0pu1po = { &kf__layer__push, 0x0001, &kf__layer__pop, 0x00 };
key_t L1pu2 = { &kf__layer__push, 0x0102, NULL, 0 };
key_t L1po = { &kf__layer__pop, 0x01, NULL, 0 };
key_t L1pu2po = { &kf__layer__push, 0x0102, &kf__layer__pop, 0x01 };
// --- NumPush
const uint16_t PROGMEM NumPush__press[] = {
2, &kf__layer__push, 0x0203,
&kf__press, KEY__LockingNumLock };
key_t NumPush = { &kf__macro__progmem, &NumPush__press,
&kf__release, KEY__LockingNumLock };
// --- NumPop
const uint16_t PROGMEM NumPop__press[] = {
2, &kf__layer__pop, 0x02,
&kf__press, KEY__LockingNumLock };
key_t NumPop = { &kf__macro__progmem, &NumPop__press,
&kf__release, KEY__LockingNumLock };
// --- NumPuPo
const uint16_t PROGMEM NumPuPo__press[] = {
3, &kf__layer__push, 0x0203,
&kf__press, KEY__LockingNumLock,
&kf__release, KEY__LockingNumLock };
const uint16_t PROGMEM NumPuPo__release[] = {
3, &kf__layer__pop, 0x02,
&kf__press, KEY__LockingNumLock,
&kf__release, KEY__LockingNumLock };
key_t NumPuPo = { &kf__macro__progmem, &NumPuPo__press,
&kf__macro__progmem, &NumPuPo__release };
// ----------------------------------------------------------------------------
// layout
// ----------------------------------------------------------------------------
key_t layout[][KB__ROWS][KB__COLUMNS] = {
// ............................................................................
MATRIX__LAYER( // layer 0 : default (colemak)
// unused
NA,
// left hand ...... ......... ......... ......... ......... ......... .........
Equal, K1, K2, K3, K4, K5, L1pu2,
Tab, Q, W, F, P, G, Esc,
CtrlL, A, R, S, T, D,
Sh2KCapL, Z, X, C, V, B, L1pu2po,
GUIL, Grave, Bkslash, AltL, L0pu1po,
CtrlL, AltL,
NA, NA, Home,
Space, Enter, End,
// right hand ..... ......... ......... ......... ......... ......... .........
NumPush, K6, K7, K8, K9, K0, Dash,
Esc, J, L, U, Y, Semicol, Bkslash,
H, N, E, I, O, Quote,
NumPuPo, K, M, Comma, Period, Slash, Sh2KCapR,
L0pu1po, ArrowL, ArrowD, ArrowU, ArrowR,
AltR, CtrlR,
PageU, NA, NA,
PageD, Del, Bs ),
// ............................................................................
MATRIX__LAYER( // layer 1 : function and symbol keys
// unused
NA,
// left hand ...... ......... ......... ......... ......... ......... .........
Transp, F1, F2, F3, F4, F5, F11,
Transp, BraceL, BraceR, BrktL, BrktR, Colon, Transp,
Transp, Bkslash, Slash, ParenL, ParenR, Semicol,
Transp, Exclam, At, Pound, Dollar, Percent, Transp,
Transp, Transp, Transp, Transp, Transp,
Transp, Transp,
Transp, Transp, Transp,
Transp, Transp, Transp,
// right hand ..... ......... ......... ......... ......... ......... .........
F12, F6, F7, F8, F9, F10, Power,
Transp, NA, Equal, Plus, Dash, Undersc, NA,
ArrowL, ArrowD, ArrowU, ArrowR, NA, NA,
Transp, Caret, Amp, Asterisk, ParenL, ParenR, Transp,
Transp, Transp, Transp, Transp, Transp,
Transp, Transp,
Transp, Transp, Transp,
Transp, Transp, Transp ),
// ............................................................................
MATRIX__LAYER( // layer 2 : QWERTY alphanum
// unused
NA,
// left hand ...... ......... ......... ......... ......... ......... .........
Transp, K1, K2, K3, K4, K5, L1po,
Transp, Q, W, E, R, T, Transp,
Transp, A, S, D, F, G,
Transp, Z, X, C, V, B, Transp,
Transp, Transp, Transp, Transp, Transp, Transp,
Transp, Transp,
Transp, Transp, Transp,
Transp, Transp, Transp,
// right hand ..... ......... ......... ......... ......... ......... .........
Transp, K6, K7, K8, K9, K0, Transp,
Transp, Y, U, I, O, P, Transp,
H, J, K, L, Semicol, Transp,
Transp, N, M, Comma, Period, Slash, Transp,
Transp, Transp, Transp, Transp, Transp,
Transp, Transp,
Transp, Transp, Transp,
Transp, Transp, Transp ),
// ............................................................................
MATRIX__LAYER( // layer 3 : numpad
// unused
NA,
// left hand ...... ......... ......... ......... ......... ......... .........
Transp, Transp, Transp, Transp, Transp, Transp, Transp,
Transp, Transp, Transp, Transp, Transp, Transp, Transp,
Transp, Transp, Transp, Transp, Transp, Transp,
Transp, Transp, Transp, Transp, Transp, Transp, Transp,
Transp, Ins, Transp, Transp, Transp,
Transp, Transp,
Transp, Transp, Transp,
Transp, Transp, Transp,
// right hand ..... ......... ......... ......... ......... ......... .........
NumPop, Transp, NumPop, Equal, KPDiv, KPMul,
Transp, Transp, KP7, KP8, KP9, KPSub, Transp,
Transp, KP4, KP5, KP6, KPAdd, Transp,
Transp, Transp, KP1, KP2, KP3, KPEnter, Transp,
Transp, Transp, Period, KPEnter, Transp,
Transp, Transp,
Transp, Transp, Transp,
Transp, Transp, KP0 ),
// ............................................................................
};

View File

@ -28,8 +28,7 @@
.press_function = &kf__press, \
.press_value = value, \
.release_function = &kf__release, \
.release_value = value, \
}
.release_value = value }
#define KEYS__SHIFTED(name, value) \
const uint16_t PROGMEM name##__press[] = { \
@ -42,10 +41,6 @@
&kf__macro__progmem, &name##__release }
// default key definitions
#include "../../../../firmware/lib/layout/keys.h"
// other `keys__` macros (in the `keys__` namespace for consistency)
#define KEYS__TWO_KEYS_CAPSLOCK_PRESS_RELEASE(name, value) \
@ -60,10 +55,15 @@
// ----------------------------------------------------------------------------
// default key definitions
#include "../../../../firmware/lib/layout/keys.h"
// special meaning
key_t Transp = NULL; // transparent
key_t NA = { NULL, 0, NULL, 0 }; // do nothing
key_t Transp = NULL; // transparent
key_t NA = { NULL, 0, NULL, 0 }; // "not applicable" (do nothing)
// special keycode
@ -85,20 +85,6 @@ KEYS__TWO_KEYS_CAPSLOCK_PRESS_RELEASE( Sh2KCapR, KEY__RightShift );
// --- Btldr
key_t Btldr = { &kf__jump_to_bootloader, 0, NULL, 0 };
// --- NumPush
const uint16_t PROGMEM NumPush__press[] = {
2, &kf__layer__push, 0x0203,
&kf__press, KEY__LockingNumLock };
key_t NumPush = { &kf__macro__progmem, &NumPush__press,
&kf__release, KEY__LockingNumLock };
// --- NumPop
const uint16_t PROGMEM NumPop__press[] = {
2, &kf__layer__pop, 0x02,
&kf__press, KEY__LockingNumLock };
key_t NumPop = { &kf__macro__progmem, &NumPop__press,
&kf__release, KEY__LockingNumLock };
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------

View File

@ -0,0 +1,182 @@
/* ----------------------------------------------------------------------------
* Copyright (c) 2013 Ben Blazak <benblazak.dev@gmail.com>
* Released under The MIT License (see "license.md")
* Project located at <https://github.com/benblazak/ergodox-firmware>
* ------------------------------------------------------------------------- */
/**
* - description: |
* A Dvorak layout adapted from the default Kinesis layout. The position of
* the symbol keys on the function layer was taken from the Arensito layout.
*/
#include "../../../../firmware/keyboard/ergodox/matrix.h"
#include "./default/common.h"
// ----------------------------------------------------------------------------
// matrix control
// ----------------------------------------------------------------------------
#include "./default/exec_key.c.h"
// ----------------------------------------------------------------------------
// LED control
// ----------------------------------------------------------------------------
void kb__led__logical_on(char led) {
switch led {
case 'N': kb__led__on(1); break; // numlock
case 'C': kb__led__on(2); break; // capslock
case 'S': kb__led__on(3); break; // scroll lock
case 'O': break; // compose
case 'K': break; // kana
};
}
void kb__led__logical_off(char led) {
switch led {
case 'N': kb__led__off(1); break; // numlock
case 'C': kb__led__off(2); break; // capslock
case 'S': kb__led__off(3); break; // scroll lock
case 'O': break; // compose
case 'K': break; // kana
};
}
// ----------------------------------------------------------------------------
// keys
// ----------------------------------------------------------------------------
#include "./default/keys.h"
// layer
key_t L0pu1 = { &kf__layer__push, 0x0001, NULL, 0 };
key_t L0po = { &kf__layer__pop, 0x00, NULL, 0 };
key_t L0pu1po = { &kf__layer__push, 0x0001, &kf__layer__pop, 0x00 };
key_t L1pu2po = { &kf__layer__push, 0x0102, &kf__layer__pop, 0x01 };
// --- NumPush
const uint16_t PROGMEM NumPush__press[] = {
2, &kf__layer__push, 0x0203,
&kf__press, KEY__LockingNumLock };
key_t NumPush = { &kf__macro__progmem, &NumPush__press,
&kf__release, KEY__LockingNumLock };
// --- NumPop
const uint16_t PROGMEM NumPop__press[] = {
2, &kf__layer__pop, 0x02,
&kf__press, KEY__LockingNumLock };
key_t NumPop = { &kf__macro__progmem, &NumPop__press,
&kf__release, KEY__LockingNumLock };
// ----------------------------------------------------------------------------
// layout
// ----------------------------------------------------------------------------
key_t layout[][KB__ROWS][KB__COLUMNS] = {
// ............................................................................
MATRIX__LAYER( // layer 0 : default
// unused
NA,
// left hand ...... ......... ......... ......... ......... ......... .........
Equal, K1, K2, K3, K4, K5, Esc,
Bkslash, Quote, Comma, Period, P, Y, L0pu1,
Tab, A, O, E, U, I,
Sh2KCapL, Semicol, Q, J, K, X, L0pu1po,
GUIL, Grave, Bkslash, ArrowL, ArrowR,
CtrlL, AltL,
NA, NA, Home,
Bs, Del, End,
// right hand ..... ......... ......... ......... ......... ......... .........
NumPush, K6, K7, K8, K9, K0, Dash,
BrktL, F, G, C, R, L, BrktR,
D, H, T, N, S, Slash,
L0pu1po, B, M, W, V, Z, Sh2KCapR,
ArrowL, ArrowD, ArrowU, ArrowR, GUIR,
AltR, CtrlR,
PageU, NA, NA,
PageD, Enter, Space ),
// ............................................................................
MATRIX__LAYER( // layer 1 : function and symbol keys
// unused
NA,
// left hand ...... ......... ......... ......... ......... ......... .........
NA, F1, F2, F3, F4, F5, F11,
Transp, BraceL, BraceR, BrktL, BrktR, NA, L0po,
Transp, Semicol, Slash, Dash, KP0, Colon,
Transp, KP6, KP7, KP8, KP9, Plus, L1pu2po,
Transp, Transp, Transp, Transp, Transp,
Transp, Transp,
Transp, Transp, Transp,
Transp, Transp, Transp,
// right hand ..... ......... ......... ......... ......... ......... .........
F12, F6, F7, F8, F9, F10, Power,
Transp, NA, Undersc, LessThan, GrtrThan, Dollar, VolumeU,
Bkslash, KP1, ParenL, ParenR, Equal, VolumeD,
L1pu2po, Asterisk, KP2, KP3, KP4, KP5, Mute,
Transp, Transp, Transp, Transp, Transp,
Transp, Transp,
Transp, Transp, Transp,
Transp, Transp, Transp ),
// ............................................................................
MATRIX__LAYER( // layer 2 : keyboard functions
// unused
NA,
// left hand ...... ......... ......... ......... ......... ......... .........
Btldr, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA,
NA, NA,
NA, NA, NA,
NA, NA, NA,
// right hand ..... ......... ......... ......... ......... ......... .........
NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA,
NA, NA,
NA, NA, NA,
NA, NA, NA ),
// ............................................................................
MATRIX__LAYER( // layer 3 : numpad
// unused
NA,
// left hand ...... ......... ......... ......... ......... ......... .........
Transp, Transp, Transp, Transp, Transp, Transp, Transp,
Transp, Transp, Transp, Transp, Transp, Transp, Transp,
Transp, Transp, Transp, Transp, Transp, Transp,
Transp, Transp, Transp, Transp, Transp, Transp, Transp,
Transp, Ins, Transp, Transp, Transp,
Transp, Transp,
Transp, Transp, Transp,
Transp, Transp, Transp,
// right hand ..... ......... ......... ......... ......... ......... .........
NumPop, Transp, NumPop, Equal, KPDiv, KPMul,
Transp, Transp, KP7, KP8, KP9, KPSub, Transp,
Transp, KP4, KP5, KP6, KPAdd, Transp,
Transp, Transp, KP1, KP2, KP3, KPEnter, Transp,
Transp, Transp, Period, KPEnter, Transp,
Transp, Transp,
Transp, Transp, Transp,
Transp, Transp, KP0 ),
// ............................................................................
};

View File

@ -11,12 +11,8 @@
*/
#include <stddef.h>
#include <avr/pgmspace.h>
#include "../../../../firmware/lib/layout/key-functions.h"
#include "../../../../firmware/lib/usb/usage-page/keyboard.h"
#include "../../../../firmware/keyboard.h"
#include "../../../../firmware/keyboard/ergodox/matrix.h"
#include "./default/common.h"
// ----------------------------------------------------------------------------
@ -63,6 +59,20 @@ key_t L0po = { &kf__layer__pop, 0x00, NULL, 0 };
key_t L0pu1po = { &kf__layer__push, 0x0001, &kf__layer__pop, 0x00 };
key_t L1pu2po = { &kf__layer__push, 0x0102, &kf__layer__pop, 0x01 };
// --- NumPush
const uint16_t PROGMEM NumPush__press[] = {
2, &kf__layer__push, 0x0203,
&kf__press, KEY__LockingNumLock };
key_t NumPush = { &kf__macro__progmem, &NumPush__press,
&kf__release, KEY__LockingNumLock };
// --- NumPop
const uint16_t PROGMEM NumPop__press[] = {
2, &kf__layer__pop, 0x02,
&kf__press, KEY__LockingNumLock };
key_t NumPop = { &kf__macro__progmem, &NumPop__press,
&kf__release, KEY__LockingNumLock };
// ----------------------------------------------------------------------------
// layout
@ -70,7 +80,7 @@ key_t L1pu2po = { &kf__layer__push, 0x0102, &kf__layer__pop, 0x01 };
key_t layout[][KB__ROWS][KB__COLUMNS] = {
// ----------------------------------------------------------------------------
// ............................................................................
MATRIX__LAYER( // layer 0 : default
@ -95,7 +105,7 @@ Sh2KCapL, Z, X, C, V, B, L0pu1po,
PageU, NA, NA,
PageD, Enter, Space ),
// ----------------------------------------------------------------------------
// ............................................................................
MATRIX__LAYER( // layer 1 : function and symbol keys
// unused
@ -119,7 +129,7 @@ NA,
Transp, Transp, Transp,
Transp, Transp, Transp ),
// ----------------------------------------------------------------------------
// ............................................................................
MATRIX__LAYER( // layer 2 : keyboard functions
// unused
@ -143,7 +153,7 @@ NA,
NA, NA, NA,
NA, NA, NA ),
// ----------------------------------------------------------------------------
// ............................................................................
MATRIX__LAYER( // layer 3 : numpad
// unused
@ -167,6 +177,6 @@ NA,
Transp, Transp, Transp,
Transp, Transp, KP0 ),
// ----------------------------------------------------------------------------
// ............................................................................
};

View File

@ -41,8 +41,9 @@
*
**************************************************************************/
// TODO: make the product name, etc., makefile options
// You can change these to give your code its own name.
#define STR_MANUFACTURER L"unspecified" // TODO
#define STR_MANUFACTURER L"custom"
#define STR_PRODUCT L"ErgoDox ergonomic keyboard"

View File

@ -8,3 +8,92 @@
# TODO
ifeq($(MAKE__KEYBOARD),ergodox)
# TODO: move this part of the options to keyboard/ergodox/options.mk
MCU := atmega32u4
# processor type (for the teensy 2.0)
F_CPU := 16000000
# processor speed, in Hz
MAKE__LED_BRIGHTNESS := 0.5
# a multiplier, with 1 being the max
MAKE__DEBOUNCE_TIME := 5
# in milliseconds; 5ms should be good for cherry mx switches (per the
# keyswitch spec)
MAKE__TWI_FREQ := 400000
# TWI frequency, in Hz; should be no greater than 400000 (400kHz) (per
# the Teensy datasheet sec 20.1); we want it as fast as possible
# .....................................................................
# DRIVE_ROWS and DRIVE_COLUMNS
# .....................................................................
# Select which set of pins will drive (alternate between hi-Z and drive
# low) and which will be inputs (hi-Z)
#
#
# Notes
#
# - You must set exactly one of each 'TEENSY' variable, and one of each
# 'MCP23018' variable, to '1', and the other must be set to '0'
#
# - If you are using internal diodes (inside the key switches), set
# MAKE__TEENSY__DRIVE_COLUMNS := 1
# MAKE__MCP23018__DRIVE_ROWS := 1
#
# - If the diode cathode is towards the square solder pad, set
# MAKE__TEENSY__DRIVE_COLUMNS := 1
# MAKE__MCP23018__DRIVE_COLUMNS := 1
#
# - If the diode cathode is towards the circular solder pad, set
# MAKE__TEENSY__DRIVE_ROWS := 1
# MAKE__MCP23018__DRIVE_ROWS := 1
# .....................................................................
# set variables
MAKE__TEENSY__DRIVE_ROWS := 0
MAKE__TEENSY__DRIVE_COLUMNS := 1
MAKE__MCP23018__DRIVE_ROWS := 0
MAKE__MCP23018__DRIVE_COLUMNS := 1
# check variables
ERROR := "see the 'DRIVE_ROWS and DRIVE_COLUMNS section in 'options.mk'"
# --- teensy
ifeq($(MAKE__TEENSY__DRIVE_ROWS),1)
ifneq($(MAKE__TEENSY__DRIVE_COLUMNS),0)
$(error $(ERROR))
endif
else
ifeq($(MAKE__TEENSY__DRIVE_ROWS),0)
ifneq($(MAKE__TEENSY__DRIVE_COLUMNS),1)
$(error $(ERROR))
endif
else
$(error $(ERROR))
endif
endif
# --- mcp23018
ifeq($(MAKE__MCP23018__DRIVE_ROWS),1)
ifneq($(MAKE__MCP23018__DRIVE_COLUMNS),0)
$(error $(ERROR))
endif
else
ifeq($(MAKE__MCP23018__DRIVE_ROWS),0)
ifneq($(MAKE__MCP23018__DRIVE_COLUMNS),1)
$(error $(ERROR))
endif
else
$(error $(ERROR))
endif
endif
# .....................................................................
# .....................................................................
endif

View File

@ -25,56 +25,56 @@ external tools to generate documentation, and for other purposes.
* The element `.ignore` may appear in any list, and should be ignored.
- &atom '<boolean>|<number>|<string.markdown>'
- &atom '<boolean>|<number>|<string.markdown>'
- &value-map
type: *atom
name: *atom
description: *atom
values: [ *value-map ]
notes: [ *atom ]
- &value-map
type: *atom
name: *atom
description: *atom
values: [ *value-map ]
notes: [ *atom ]
- &description-map
# the file description
description: *atom
- &description-map
# the file description
description: *atom
- &function-map
function:
<< : *value-map
arguments: *value-map
return value: *value-map
- &function-map
function:
<< : *value-map
arguments: *value-map
return value: *value-map
- &macro-map
macro: { << : *value-map }
- &macro-map
macro: { << : *value-map }
- &typedef-map
typedef: { << : *value-map }
- &typedef-map
typedef: { << : *value-map }
- &file-map
file:
# name: taken from the filesystem
# description: taken from the '[filename].md' if it exists
<< : [ *description-map, *value-map ]
functions: [ *function-map ]
macros: [ *macro-map ]
typedefs: [ *typedef-map ]
- &file-map
file:
# name: taken from the filesystem
# description: taken from the '[filename].md' if it exists
<< : [ *description-map, *value-map ]
functions: [ *function-map ]
macros: [ *macro-map ]
typedefs: [ *typedef-map ]
- &directory-map
directory:
# name: taken from filesystem
# description: taken from the 'readme.md' if it exists
<< : *value-map
files: [ *file-map ]
directories: [ *directory-map ]
- &directory-map
directory:
# name: taken from filesystem
# description: taken from the 'readme.md' if it exists
<< : *value-map
files: [ *file-map ]
directories: [ *directory-map ]
- &project-map
project:
<< : *value-map
directories: [ *directory-map ]
- &project-map
project:
<< : *value-map
directories: [ *directory-map ]
- projects: [ *project-map ]
- projects: [ *project-map ]
-------------------------------------------------------------------------------