split the firmware into general/controller/keyboard files
parent
f628b56812
commit
4bcc0e5dc3
|
@ -1,31 +1,11 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
* Firmware for the ergoDOX keyboard
|
* Teensy 2.0 specific stuff
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
* Copyright (c) 2012 Ben Blazak
|
* Copyright (c) 2012 Ben Blazak
|
||||||
* Released under The MIT License (MIT) (see "license.md") at
|
* Released under The MIT License (MIT) (see "license.md") at
|
||||||
* <https://github.com/benblazak/ergodox-firmware>
|
* <https://github.com/benblazak/ergodox-firmware>
|
||||||
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
|
||||||
* Matrix [row.column] assignments
|
|
||||||
* - row and column numbers are in hex
|
|
||||||
* - coordinates without brackets are unused
|
|
||||||
* - left and right hands are mirrored, with `row += 6` for left hand rows
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
* ....... rows x columns = positions; assigned, unassigned .......
|
|
||||||
* ....... per hand: 6 x 7 = 42; 38, 4 .......
|
|
||||||
* ....... total: 12 x 7 = 84; 76, 8 .......
|
|
||||||
* ----------------------------------------------------------------------------
|
|
||||||
* [66][65][64][63][62][61][60] [00][01][02][03][04][05][06]
|
|
||||||
* [76][75][74][73][72][71][70] [10][11][12][13][14][15][16]
|
|
||||||
* [86][85][84][83][82][81] 80 20 [21][22][23][24][25][26]
|
|
||||||
* [96][95][94][93][92][91][90] [30][31][32][33][34][35][36]
|
|
||||||
* [A6][A5][A4][A3][A2] A1 A0 40 41 [42][43][44][45][46]
|
|
||||||
* [B1] B0 50 [51]
|
|
||||||
* [B3] [B2] [52] [53]
|
|
||||||
* [B6][B5][B4] [54][55][56]
|
|
||||||
* ------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
* Pinouts and Pin assignments
|
* Pinouts and Pin assignments
|
||||||
* - '+' indicates pin
|
* - '+' indicates pin
|
||||||
|
@ -113,10 +93,6 @@
|
||||||
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
#include "lib/twi.h"
|
|
||||||
#include "lib/print.h"
|
|
||||||
|
|
||||||
|
|
||||||
// processor frequency (from <http://www.pjrc.com/teensy/prescaler.html>)
|
// processor frequency (from <http://www.pjrc.com/teensy/prescaler.html>)
|
||||||
#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
|
#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
|
||||||
#define CPU_16MHz 0x00
|
#define CPU_16MHz 0x00
|
||||||
|
@ -132,58 +108,9 @@
|
||||||
// pins
|
// pins
|
||||||
// TODO: write some pretty macros
|
// TODO: write some pretty macros
|
||||||
|
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// - initialize pins
|
// - initialize pins
|
||||||
void init() {
|
void controller_init() {
|
||||||
CPU_PRESCALE(CPU_16MHz); // speed should match F_CPU in makefile
|
CPU_PRESCALE(CPU_16MHz); // speed should match F_CPU in makefile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define KB_LAYERS 1
|
|
||||||
#define KB_ROWS 12 // don't change
|
|
||||||
#define KB_COLUMNS 7 // don't change
|
|
||||||
|
|
||||||
uint8_t is_pressed[KB_ROWS][KB_COLUMNS] = {
|
|
||||||
// --- right hand ---
|
|
||||||
// column 0 1 2 3 4 5 6
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x0
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x1
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x2
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x3
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x4
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x5
|
|
||||||
|
|
||||||
// --- left hand ---
|
|
||||||
// column 0 1 2 3 4 5 6
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x6
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x7
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x8
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x9
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0xA
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0xB
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: this belongs in program space
|
|
||||||
uint8_t kb_maps[KB_LAYERS][KB_ROWS][KB_COLUMNS] = {
|
|
||||||
// --- layer: default ---
|
|
||||||
// column 0 1 2 3 4 5 6
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x0
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x1
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x2
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x3
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x4
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x5
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x6
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x7
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x8
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0x9
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0xA
|
|
||||||
0, 0, 0, 0, 0, 0, 0, //row 0xB
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* Firmware for the ergoDOX keyboard
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
* Copyright (c) 2012 Ben Blazak
|
||||||
|
* Released under The MIT License (MIT) (see "license.md") at
|
||||||
|
* <https://github.com/benblazak/ergodox-firmware>
|
||||||
|
* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
#include "keyboard/ergodox.h"
|
||||||
|
#include "controller/teensy-2-0.h"
|
||||||
|
#include "lib/twi.h"
|
||||||
|
#include "lib/print.h"
|
||||||
|
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void init() {
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* ergoDOX specific stuff
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
* Copyright (c) 2012 Ben Blazak
|
||||||
|
* Released under The MIT License (MIT) (see "license.md") at
|
||||||
|
* <https://github.com/benblazak/ergodox-firmware>
|
||||||
|
* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* Matrix [row.column] assignments
|
||||||
|
* - row and column numbers are in hex
|
||||||
|
* - coordinates without brackets are unused
|
||||||
|
* - left and right hands are mirrored, with `row += 6` for left hand rows
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
* ....... rows x columns = positions; assigned, unassigned .......
|
||||||
|
* ....... per hand: 6 x 7 = 42; 38, 4 .......
|
||||||
|
* ....... total: 12 x 7 = 84; 76, 8 .......
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
* [66][65][64][63][62][61][60] [00][01][02][03][04][05][06]
|
||||||
|
* [76][75][74][73][72][71][70] [10][11][12][13][14][15][16]
|
||||||
|
* [86][85][84][83][82][81] 80 20 [21][22][23][24][25][26]
|
||||||
|
* [96][95][94][93][92][91][90] [30][31][32][33][34][35][36]
|
||||||
|
* [A6][A5][A4][A3][A2] A1 A0 40 41 [42][43][44][45][46]
|
||||||
|
* [B1] B0 50 [51]
|
||||||
|
* [B3] [B2] [52] [53]
|
||||||
|
* [B6][B5][B4] [54][55][56]
|
||||||
|
* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
#define KB_LAYERS 1
|
||||||
|
#define KB_ROWS 12 // don't change
|
||||||
|
#define KB_COLUMNS 7 // don't change
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t is_pressed[KB_ROWS][KB_COLUMNS] = {
|
||||||
|
// --- right hand ---
|
||||||
|
// column 0 1 2 3 4 5 6
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x0
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x1
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x2
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x3
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x4
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x5
|
||||||
|
|
||||||
|
// --- left hand ---
|
||||||
|
// column 0 1 2 3 4 5 6
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x6
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x7
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x8
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x9
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0xA
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0xB
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: this belongs in program space
|
||||||
|
uint8_t kb_maps[KB_LAYERS][KB_ROWS][KB_COLUMNS] = {
|
||||||
|
// --- layer: default ---
|
||||||
|
// column 0 1 2 3 4 5 6
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x0
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x1
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x2
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x3
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x4
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x5
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x6
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x7
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x8
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0x9
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0xA
|
||||||
|
0, 0, 0, 0, 0, 0, 0, //row 0xB
|
||||||
|
}
|
||||||
|
|
14
src/makefile
14
src/makefile
|
@ -1,17 +1,23 @@
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# This is a stub at the moment, but I'm keeping it separate so I can mess with
|
# This is mostly a stub at the moment, but I'm keeping it separate so I can
|
||||||
# it later without changing the original
|
# mess with it later without changing the original
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Copyright (c) 2012 Ben Blazak
|
# Copyright (c) 2012 Ben Blazak
|
||||||
# Released under The MIT License (MIT) (see "license.md") at
|
# Released under The MIT License (MIT) (see "license.md") at
|
||||||
# <https://github.com/benblazak/ergodox-firmware>
|
# <https://github.com/benblazak/ergodox-firmware>
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
SRC = firmware.c
|
||||||
|
|
||||||
|
TEENSY_MAKE = $(MAKE) -f 'lib/teensy-makefile' SRC='$(SRC)'
|
||||||
|
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|
||||||
all:
|
all:
|
||||||
make -f lib/teensy-makefile all
|
$(TEENSY_MAKE) all
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
make -f lib/teensy-makefile clean
|
$(TEENSY_MAKE) clean
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue