- made short keycode macros for the USB keycodes (under "lib/...")
- refactored "keyboard/.../layout.c", to make way for multiple layouts,
and to make it easier to read (by using short keycode macros)
- layout.h has a computed include line now, and the code (and layout
specific header stuff) is in a subdirectory. the makefile should
take care of which layout gets included and compiled
- changed kbfun_press() and kbfun_release() to be able to handle the
modifier keys (instead of requiring a separate function for the
modifiers)
- added a makefile variable for which keyboard gets compiled. even
though there's only one right now
- merge from branch 'dev'
implementation / version notes:
- needs testing still (a lot), but with the little i could do on my
breadboard it looked stable. 6-KRO looks like it works, and the key
press/release and modifier press/release functions, and LED indicators
look like they work. yay!
- looks like it's scanning at about 167 Hz (as accurately as i could
measure with a prescaling loop, an LED, and a stopwatch). most of
this (almost all of it, actually) is due to i2c. it has the potential
to get a little faster (maybe slightly past 200 Hz, if i try), but i'm
not sure if i will since most keyboards i found speeds for online
scanned at a little less than 100 Hz - so that should be fast enough.
- also, my method of assigning a keycode, press function, and release
function to each key on each layer seems like it should be time and
space consuming; but we have plenty of space (we're only using ~11%
currently), and plenty of time apparently, since the teensy is running
at 16MHz, and the time used by the extra function calls pales in
comparison to the time used by the i2c functions.
other notes:
- see the *.md files for documentation about everything. i did my best
to make and keep them accurate with the source, so hopefully nothing
(too important..) got past me.
- also, there's a nice circuit diagram under
"src/keyboard/ergodox/_circuit-diagram.svg" :) . i like it a lot, and
it's accurate for now, but i'm not sure how maintainable it'll be if
the pins change.
yay!! :D i'm so happy i got it working.
- simple bug fix in kbfun_press() and kbfun_release()
- no longer check for previous init() in the mcp23018 functions;
something would happen when i tried to read from it, sometimes, when
it'd been unplugged or stoped some other way, and it would hang - and
the only thing that would make it better was running the test_twi_2
function (a series of writes, with stops after each). so now
mcp23018_init() is a series of writes, with stops after each. it
doesn't take appreciably longer to run... maybe it should be looked
into later though.
- changed the main() loop a little
also, mcp23018_init() needs fixing: `twi_stop()` needs to be at the end
of transmission blocks. i wouldn't think that would be necessary, but
it seems to be the only thing that'll make it work, and it also seems
consistent with the protocol diagram in the datasheet (lol, imagine
that), so i think that's what i'll have to do. not as though it matters
much i guess, since it's a single master / single slave system anyway, i
was just hoping not to release the bus till i was finished..
- fixed some includes (`uint8_t` comes from a header, not the language)
- put code from some of the .h files into .c files
- now using open drain logic (hi-Z or GND) on both chips instead of
driving the row pins high on the teensy, or using a pull-up resistor
on the row pins with the mcp23018
- put `return 0;` at the end of some functions that weren't void
- fixed/updated some documentation; esp. the row assignments for the
mcp23018
- generalized the unused/row/column pin assignment and init code using
macros, so they'll be much easier to move around if necessary
- fixed a redefinition error in "lib/usb/keyboard-usage-page.h"
also, i didn't make a note of it in the *.md file, but Waveform
Generation Mode 15 for fast PWM wasn't working right (well.. wasn't
working how i expected it to). i misinterpreted what the modes were
doing, partially (haha, or all-ly?) because i didn't read the
description of fast pwm thoroughly enough... in any case, all the
information's in the datasheet, and it's actually not terribly long.
i'm not sure how to correctly use Mode 15 yet, but i think i'll leave it
alone for now, since Mode 5 works as expected, and i think what the
datasheet says about *that* makes enough sense to me for me to be
content for the moment.
- removed the comment about the RESET pin on the MCP23018: i think these
chips reset on powerup
- the partitioning of code into files is all wrong at the moment... i
need to write some more and then fix that