- 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..
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