cleaned up :) and ready to merge

partial-rewrite
Ben Blazak 2012-04-11 21:05:45 -07:00
parent 98033358f4
commit 8b168bc88e
9 changed files with 236 additions and 120 deletions

View File

@ -4,12 +4,48 @@
[ergodox keyboard]: http://geekhack.org/showthread.php?22780-Interest-Check-Custom-split-ergo-keyboard
## dependencies
This project is definitely in beta, but I'll do my best to keep the 'stable'
branch working. Please see the source (and especially the accompanying '*.md'
files) for documentation.
## Notes
### (2012-04-11)
As of now, it looks like we have a working 6-KRO keyboard firmware for a Teensy
2.0 with a MCP23018 I/O expander. It's scanning at ~167 Hz, most of which is
spent communicating over I²C. This should be fast enough, I think.
Slight improvements might be possible (without finding a microprocessor capable
of > 400 kHz I²C or using SPI, that is, which I imagine would speed things
up a lot - but it'd also be much less convenient). I'll attempt them if I see
the need.
Also, layers are implemented, but untested, as no keymaps are written to use
them yet. Implementing on-keyboard hardware remapping seems like it'd be very
possible too, but I'd need to try it (and learn how to programmatically store
stuff in program space) to see if it'd work; and I'm not sure of a good way to
do the interface, since different people will likely have different keycap
layouts on the ergoDOX.
Getting to N-KRO is a goal, but I honestly have no idea whether it'll be
accomplished. Ideally, I'd like a variable-KRO, where the keyboard is 6-KRO
till you press the 7th key (so if you're worried about compatibility, just
don't press more than 6 keys at a time). From what I've read, it might be
possible, but I just finished everything else (so I'm slightly tired), and the
USB spec is scary.
Discussions about the project as a whole are going on at the forum page (linked
in the title) so if you have any imput (or want to participate in the group
buy!), please stop by. :) .
## Dependencies (for building from source)
* See the PJRC [Getting Started] (http://pjrc.com/teensy/first_use.html) page
for instructions on how to set up an AVR programming environment. This
project uses C (not Arduino).
-------------------------------------------------------------------------------
Copyright &copy; 2012 Ben Blazak <benblazak.dev@gmail.com>

View File

@ -14,6 +14,7 @@
#include "keyboard.h"
// ----------------------------------------------------------------------------
#if 0 // not being used right now
@ -36,6 +37,7 @@ static uint8_t _dec_current_layer(uint8_t * current_layer) {
}
#endif
// ----------------------------------------------------------------------------
void kbfun_press(

View File

@ -33,9 +33,9 @@ uint8_t kb_init(void) {
* - error: number of the function that failed
*/
uint8_t kb_update_matrix(bool matrix[KB_ROWS][KB_COLUMNS]) {
if (teensy_update_matrix(matrix)) // must be first
if (teensy_update_matrix(matrix))
return 1;
if (mcp23018_update_matrix(matrix)) // must be second
if (mcp23018_update_matrix(matrix))
return 2;
return 0; // success

View File

@ -1,5 +1,6 @@
/* ----------------------------------------------------------------------------
* ergoDOX specific exports
* includes (for centralization) the public exports from all subfiles
* ----------------------------------------------------------------------------
* Copyright (c) 2012 Ben Blazak <benblazak.dev@gmail.com>
* Released under The MIT License (MIT) (see "license.md")

View File

@ -12,7 +12,7 @@
inkscape:version="0.48.2 r9819"
version="1.1"
id="svg2"
height="367.06873"
height="398.98083"
width="950.8382"
sodipodi:docname="_circuit-diagram.svg"
inkscape:export-filename="/home/ben/Desktop/programs/20120227--ergodox-firmware--for-the-ergodox-keyboard/src/test - circuit diagram/inkscape/_circuit-diagram.png"
@ -26,12 +26,12 @@
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="1.4142136"
inkscape:cx="422.63041"
inkscape:cy="176.46238"
inkscape:cx="477.26232"
inkscape:cy="197.75046"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:current-layer="layer4"
showgrid="true"
inkscape:snap-global="true"
inkscape:snap-global="false"
inkscape:snap-bbox="false"
inkscape:snap-nodes="false"
inkscape:bbox-nodes="false"
@ -870,7 +870,7 @@
sodipodi:cy="185.44926"
sodipodi:rx="80.96373"
sodipodi:ry="82.024384"
d="m 49.497478,185.44926 a 80.96373,82.024384 0 1 1 -161.927458,0 l 80.963729,0 z"
d="m 49.497478,185.44926 c 0,45.30082 -36.248696,82.02439 -80.963729,82.02439 -44.715034,0 -80.963729,-36.72357 -80.963729,-82.02439 0,0 0,0 0,0 l 80.963729,0 z"
sodipodi:start="0"
sodipodi:end="3.1415927"
transform="matrix(0,-0.11858905,0.11219624,0,469.59545,178.62704)"
@ -902,7 +902,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -915,7 +915,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -928,7 +928,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -941,7 +941,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -954,7 +954,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -967,7 +967,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -980,7 +980,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -993,7 +993,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1006,7 +1006,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1019,7 +1019,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1032,7 +1032,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1045,7 +1045,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1058,7 +1058,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1071,7 +1071,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1084,7 +1084,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1097,7 +1097,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1110,7 +1110,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1123,7 +1123,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1136,7 +1136,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1149,7 +1149,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1162,7 +1162,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1175,7 +1175,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1188,7 +1188,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1201,7 +1201,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1214,7 +1214,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1227,7 +1227,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1240,7 +1240,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1253,7 +1253,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1266,7 +1266,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1279,7 +1279,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1292,7 +1292,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1305,7 +1305,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1318,7 +1318,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1331,7 +1331,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1344,7 +1344,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1357,7 +1357,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1370,7 +1370,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1383,7 +1383,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1396,7 +1396,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1409,7 +1409,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1422,7 +1422,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1435,7 +1435,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1448,7 +1448,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1461,7 +1461,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1474,7 +1474,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1487,7 +1487,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1500,7 +1500,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1513,7 +1513,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1526,7 +1526,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1539,7 +1539,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1552,7 +1552,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1565,7 +1565,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1578,7 +1578,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1591,7 +1591,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1604,7 +1604,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1617,7 +1617,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1630,7 +1630,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1643,7 +1643,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -1656,7 +1656,7 @@
<path
inkscape:transform-center-y="-54.545454"
inkscape:transform-center-x="22.727269"
d="m 53,237.36218 a 5,5 0 1 1 -10,0 5,5 0 1 1 10,0 z"
d="m 53,237.36218 c 0,2.76143 -2.238576,5 -5,5 -2.761424,0 -5,-2.23857 -5,-5 0,-2.76142 2.238576,-5 5,-5 2.761424,0 5,2.23858 5,5 z"
sodipodi:ry="5"
sodipodi:rx="5"
sodipodi:cy="237.36218"
@ -2638,6 +2638,62 @@
id="path11780-1-5-2-8-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<text
inkscape:transform-center-y="-7.0750605"
inkscape:transform-center-x="0.66599259"
transform="matrix(0.00480522,-0.99998845,0.99998845,0.00480522,0,0)"
xml:space="preserve"
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ff7700;fill-opacity:1;stroke:none;display:inline;font-family:Sans"
x="-146.45235"
y="386.95148"
id="text9941-8"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
x="-146.45235"
y="386.95148"
id="tspan9632-9"
style="font-style:normal;-inkscape-font-specification:Sans">LED 1</tspan></text>
<text
inkscape:transform-center-y="-7.0750605"
inkscape:transform-center-x="0.66599259"
transform="matrix(0.00480522,-0.99998845,0.99998845,0.00480522,0,0)"
xml:space="preserve"
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ff7700;fill-opacity:1;stroke:none;display:inline;font-family:Sans"
x="-146.23131"
y="408.64868"
id="text9941-8-8"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
x="-146.23131"
y="408.64868"
id="tspan9632-9-4"
style="font-style:normal;-inkscape-font-specification:Sans">LED 2</tspan></text>
<text
inkscape:transform-center-y="-7.0750605"
inkscape:transform-center-x="0.66599259"
transform="matrix(0.00480522,-0.99998845,0.99998845,0.00480522,0,0)"
xml:space="preserve"
style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ff7700;fill-opacity:1;stroke:none;display:inline;font-family:Sans"
x="-146.3121"
y="428.62506"
id="text9941-8-7"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
x="-146.3121"
y="428.62506"
id="tspan9632-9-43"
style="font-style:normal;-inkscape-font-specification:Sans">LED 3</tspan></text>
<text
xml:space="preserve"
style="font-size:14px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
x="37.24189"
y="388.43091"
id="text3443"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3445"
x="37.24189"
y="388.43091">- Please also see documentation (especially the notes) in the *.md files</tspan></text>
</g>
<g
inkscape:groupmode="layer"
@ -3344,6 +3400,31 @@
x="180"
sodipodi:role="line"
id="tspan5053-8">AREF</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4888-0-1-9"
y="191.5706"
x="150.63737"
style="font-size:18px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#bbbbbb;fill-opacity:1;stroke:none;display:inline;font-family:Sans"
xml:space="preserve"><tspan
y="191.5706"
x="150.63737"
sodipodi:role="line"
id="tspan5053-8-7"
style="font-size:18px;font-weight:bold;fill:#bbbbbb;fill-opacity:1;-inkscape-font-specification:Sans Bold">Teensy 2.0</tspan></text>
<text
sodipodi:linespacing="125%"
id="text4888-0-1-9-1"
y="188.34169"
x="570.96857"
style="font-size:18px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#bbbbbb;fill-opacity:1;stroke:none;display:inline;font-family:Sans"
xml:space="preserve"
inkscape:transform-center-x="-1.7677669"><tspan
y="188.34169"
x="570.96857"
sodipodi:role="line"
id="tspan5053-8-7-4"
style="font-size:18px;font-weight:bold;fill:#bbbbbb;fill-opacity:1;-inkscape-font-specification:Sans Bold">MCP23018</tspan></text>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 151 KiB

View File

@ -99,7 +99,7 @@ uint8_t mcp23018_update_matrix(bool matrix[KB_ROWS][KB_COLUMNS]) {
// if there was an error
if (ret) {
// clear the matrix
// clear our part of the matrix
for (uint8_t row=0x6; row<=0xB; row++)
for (uint8_t col=0; col<=6; col++)
matrix[row][col] = 0;

View File

@ -25,24 +25,26 @@
### MCP32018 Pin Assignments
power_negative Vss(GND) +01---.---28o
o02 27o
column0 GPB0 +03 26o
power_negative Vss(GND) +01---.---28o NC
NC o02 27o GPA7
column0 GPB0 +03 26o GPA6
column1 GPB1 +04 25+ GPA5 rowB
column2 GPB2 +05 24+ GPA4 rowA
column3 GPB3 +06 23+ GPA3 row9
column4 GPB4 +07 22+ GPA2 row8
column5 GPB5 +08 21+ GPA1 row7
column6 GPB6 +09 20+ GPA0 row6
o10 19o
power_positive Vdd(Vcc) +11 18o
I2C SCL +12 17o
GPB7 o10 19o INTA
power_positive Vdd(Vcc) +11 18o INTB
I2C SCL +12 17o NC
I2C SDA +13 16+ RESET (see note)
o14-------15+ ADDR (see note)
NC o14-------15+ ADDR (see note)
* notes:
* ADDR (pin15): Set slave address to `0b0100000` by connecting to Vss(GND).
(The user-defined bits are the three least significant).
* The user-defined bits are the three least significant
* I2C addresses are 7 bits long (the last bit in the byte is used for
indicating read/write)
* RESET (pin16) must be externally biased. Since we're not going to trigger
it ourselves, we can tie it high.
* This is not noted in the I2C Pinout Description section of the MCP23018

View File

@ -27,18 +27,21 @@
### Teensy 2.0 Pin Assignments
power_negative GND +---.....---+ Vcc power_positive
column6 PB0 + + PF0 row0
o + PF1 row1
o + PF4 row2
o o o + PF5 row3
LED3 OC1C + + PF6 row4
I2C SCL + + PF7 row5
I2C SDA + + OC1B LED2
column3 PD2 + + OC1A LED1
column4 PD3 + + PB4 column0
column1 PC6 + + PD7 column5
column2 PC7 +-o-o-o-o-o-+ PD6 onboardLED
power_negative GND +---.....---+ Vcc power_positive
column6 PB0 + + PF0 row0
PB1 o + PF1 row1
PB2 o + PF4 row2
PB3 o o o + PF5 row3
(OC1C) LED3 PB7 + PE6 AREF + PF6 row4
(SCL) I2C PD0 + + PF7 row5
(SDA) I2C PD1 + + PB6 LED2 (OC1B)
column3 PD2 + + PB5 LED1 (OC1A)
column4 PD3 + + PB4 column0
column1 PC6 + + PD7 column5
column2 PC7 +-o-o-o-o-o-+ PD6 onboardLED
PD5 --/ | | | \-- PD4
Vcc ----/ | \---- RST
GND-------/
* notes:
* SCL and SDA: Need external pull-up resistors. Sometimes the Teensy

View File

@ -14,47 +14,34 @@
#include "lib/data-types.h"
// #include "keyboard.h"
//dbg
#define KEYBOARD_INCLUDE_PRIVATE
#include "keyboard/ergodox/teensy-2-0.h"
#include "keyboard/ergodox/mcp23018.h"
#include "keyboard.h"
///
#define DEBOUNCE_TIME 5 // in ms; see the spec for your keyswitches
// note:
// - see your keyswitch specification for the necessary value. for cherry mx
// switches, bounce time should be <= 5ms. it looks like most switches are
// speced between 5 and 8ms.
// - if timing is important, balance this value with the main() loop run time
// (~5ms, last i checked, nearly all of it in the i2c update() function)
#define DEBOUNCE_TIME 5 // in ms
//dbg
static void _toggle_led3(void) {
static bool led_on = false;
if (led_on) {
KB_LED3_OFF;
led_on = false;
} else {
KB_LED3_ON;
led_on = true;
}
}
///
int main(void) {
kb_init(); // does controller initialization too
KB_LED1_ON;
KB_LED2_ON;
KB_LED3_ON;
usb_init();
while (!usb_configured());
_delay_ms(1000); // make sure the OS has had time to load drivers, etc.
KB_LED1_OFF;
KB_LED2_OFF;
KB_LED3_OFF;
for (;;) {
//dbg
// KB_LED1_ON; _delay_ms(200); KB_LED1_OFF; _delay_ms(200); //dbg
static int counter=0;
if (counter == 0)
_toggle_led3();
counter++;
if (counter >= 250)
counter = 0;
///
static uint8_t current_layer = 0;
// swap `kb_is_pressed` and `kb_was_pressed`, then update
@ -66,6 +53,10 @@ int main(void) {
// call the appropriate function for each key, then send the report if
// necessary
// - everything else is the key function's responsibility; see the
// keyboard layout file ("keyboard/ergodox/layout.c") for which key
// is assigned which function (per layer), and "key-functions.c" for
// their definitions
for (uint8_t row=0; row<KB_ROWS; row++) {
for (uint8_t col=0; col<KB_COLUMNS; col++) {
bool is_pressed = (*kb_is_pressed)[row][col];
@ -96,9 +87,9 @@ int main(void) {
}
// update LEDs
// (keyboard_leds & (1<<0)) ? KB_LED1_ON : KB_LED1_OFF; // num lock
// (keyboard_leds & (1<<1)) ? KB_LED2_ON : KB_LED2_OFF; // caps lock
// (keyboard_leds & (1<<2)) ? KB_LED3_ON : KB_LED3_OFF; // scroll lock
(keyboard_leds & (1<<0)) ? KB_LED1_ON : KB_LED1_OFF; // num lock
(keyboard_leds & (1<<1)) ? KB_LED2_ON : KB_LED2_OFF; // caps lock
(keyboard_leds & (1<<2)) ? KB_LED3_ON : KB_LED3_OFF; // scroll lock
#if 0 // not implemented right now
(keyboard_leds & (1<<3)) ? KB_LED4_ON : KB_LED4_OFF; // compose
(keyboard_leds & (1<<4)) ? KB_LED5_ON : KB_LED5_OFF; // kana