Commit Graph

372 Commits (partial-rewrite)

Author SHA1 Message Date
Ben Blazak 4628061b53 fixed probable timing bug in timer functions; documentation 2013-05-17 16:03:34 -07:00
Ben Blazak 193f443604 comments, and a small function name fix 2013-05-17 03:23:20 -07:00
Ben Blazak 0b6103d6c3 finished messing with timer :) (for now)
main.c is now out of the timer business (except for "ticking" cycles...
since there really is no other way to guarantee something runs exactly
once per scan cycle)
2013-05-17 03:02:20 -07:00
Ben Blazak 7371362576 intermediate checkin: working on timer
was about to start handling the scheduling for cycle counted events the
same way as for real time scheduled events, but i think i'll switch over
to using `<util/atomic.h>`, if i can
2013-05-16 21:52:18 -07:00
Ben Blazak 758e95b17e documentation; and minor LED functionality in main() 2013-05-11 13:10:33 -07:00
Ben Blazak b5b5db12a7 (minor comments)
also, tested `timer__schedule()` and it works too!  at least for 1
function.  soooooo cool :D
2013-05-09 21:11:30 -07:00
Ben Blazak 203aaf415b timers working!
keyboard scanning at almost exactly 200Hz (or maybe exactly... as close
as i can measure)

possible to schedule things to run in 'n' scan cycles!  haven't tested
scheduling things to run in 'n' milliseconds, but the code is so similar
that it should work too.  :D
2013-05-09 20:41:40 -07:00
Ben Blazak 1deed9d9ac fixed a bug... fix in source will be checked in later
what was happening was, the bottommost led would indicate keyboard
startup, but wouldn't turn on after that.  turns out, i had been setting
timer/counter 0 to output on that pin, unnecessarily - because i didn't
understand how to set up timers o_o .  complicated little things.
2013-05-09 19:54:56 -07:00
Ben Blazak a3445a539b (fixed a type error.. oops) 2013-05-09 04:26:49 -07:00
Ben Blazak f74293d630 (putting ideas into comments..) 2013-05-09 04:22:17 -07:00
Ben Blazak 36ed9d1974 timing changes
main() no longer waits an extra millisecond between scan cycles, just to
be safe.  before, i was thinking that perhaps the
timer__get_millisecond() call might catch the tail end of whatever
millisecond it was getting, and then the scan cycle would be anywhere
between 4ms and 5ms.  but since we wait for our OPT__DEBOUNCE_TIME to be
up *directly before* getting the new time, we shouldn't be catching the
tail end of anything.  we should be getting as close as practically
possible to *exactly* OPT__DEBOUNCE_TIME milliseconds.

the timer__ functions now use and return 16-bit values instead of 32-bit
ones.  the rational is that 16-bit counters for milliseconds are good up
to ~1 minute, which should be enough for most things.  if a greater
length of time is needed, a function can reschedule it self, and only
execute it's body code after being called a certain number of times.
also, i'm considering making a main__ timer, that counts scan cycles
instead of milliseconds.  that would have the advantage of having lower
resolution (so, less overhead) and being able to schedule functions to
run and such without executing anything in an interrupt vector.
2013-05-09 03:57:21 -07:00
Ben Blazak a03b9ec2a1 (documentation) 2013-05-09 03:57:08 -07:00
Ben Blazak ff2e90997d mostly comments; decided to leave layer-stack as is 2013-05-09 03:11:29 -07:00
Ben Blazak 49f3d4bdd5 re-added linked lists :D; and minor aesthetic changes 2013-05-09 02:02:48 -07:00
Ben Blazak 65ecf576d3 (minor doc updates) 2013-05-07 14:01:39 -07:00
Ben Blazak 414158768b finished documentation and such about timer
especially relating to the unexpected behavior i was getting last night
2013-05-07 13:53:15 -07:00
Ben Blazak f031c99c1d fixed a bug... :/
in the while loop in main() that busywaits until we can scan again, the
compiler was optimizing out the function call, it seems like, when i
wrote `(uint8_t)timer__get_milliseconds()`; if i cast the whole
expression (not just the function) to `(volatile uint8_t)`, or if i just
didn't cast anything at all, it worked.  not sure why the compiler would
optimize the function call out like that though, even if it was cast...
this happened when i put it in a for loop too.  i need to research it
just a little more, and write a warning about it in the timer
documentation.
2013-05-07 03:01:21 -07:00
Ben Blazak 9724cf9331 documentation update 2013-05-07 01:27:57 -07:00
Ben Blazak a7d11e0af2 finished timer code; now using in main()
untested, but it should work.  i'll test before pushing to github, and
update if i messed anything up
2013-05-06 23:25:41 -07:00
Ben Blazak 5e1877cb82 misc; and working on the timer function 2013-05-06 02:31:52 -07:00
Ben Blazak 75e0336f6b (minor doc update) 2013-05-05 18:27:34 -07:00
Ben Blazak 467615a4b6 (removed a cast from a call to realloc()) 2013-04-26 17:32:41 -07:00
Ben Blazak ca56ea4647 (minor: changed USB vendor and product name slightly) 2013-04-26 02:26:01 -07:00
Ben Blazak 20f9737b49 started work on lib/timer; and some housekeeping 2013-04-26 02:16:15 -07:00
Ben Blazak 580c5e75a9 (misc changes; additions for planning) 2013-04-23 20:12:27 -07:00
Ben Blazak 1130549da0 (small comment update)
Also, I just tested the scan rate without debounce (lol, should have
thought of that before) and it's about 471Hz.  This is much faster than
the 200Hz (every 5ms) that we need to limit ourselves to due to the
switches needing a 5ms debounce time.  It should be trivial to tune the
scan rate to closer to 200Hz once I get lib/timer implemented.
2013-04-23 13:23:01 -07:00
Ben Blazak eab3d541bf (minor change to a comment) 2013-04-23 00:49:36 -07:00
Ben Blazak f8f8bef3c1 (a little planning, and organization) 2013-04-19 23:06:13 -07:00
Ben Blazak f9dfb539d1 moved `_layout` to PROGMEM
where it should have been (and i thought it was) before ... oops :)
2013-04-19 22:30:14 -07:00
Ben Blazak 058981cb83 fixed (or... worked around) a silly macro bug 2013-04-19 16:47:32 -07:00
Ben Blazak a210660b24 now releasing keys on the same layer they were pressed
lol - i'd forgotten to do this before
2013-04-19 16:46:42 -07:00
Ben Blazak 81e7e32dbe (fixed a name, to go with the last commit) 2013-04-19 16:46:00 -07:00
Ben Blazak a6ec78cd34 fixed a comment, and made a few var names more consistent 2013-04-19 16:44:57 -07:00
Ben Blazak 316f54596e working! cleaned up a bit and found a silly bug
one bug left to fix before it's actually doing what it's supposed to

scanning at about 140Hz :D , and only slightly bigger than the old
firmware (though, with many fewer layers compiled in...) (also, the
winavr makefile gets the hex to be smaller somehow; i should probably
look into that)
2013-04-19 14:58:09 -07:00
Ben Blazak 0774d0dd09 cleaned up a bunch and worked on the makefile; now compiling! :D 2013-04-19 05:21:29 -07:00
Ben Blazak f47ab1315e makefile working; doesn't compile yet 2013-04-18 19:55:24 -07:00
Ben Blazak a12a83b555 (messing with makefiles; not working yet) 2013-04-18 19:22:30 -07:00
Ben Blazak a5e2c20a84 working on the layer-stack; finished! (for now)
- did not move any of the layer-stack code into code for a  'flex-array'
  type, or something similar.  i'm thinking that most of the things the
  layer-stack does aren't sufficiently generalizable. for instance, one
  of the biggest general functions in the layer-stack implementation is
  `_shift_elements()`; but shifing elements is only something you want
  to do when you're messing with elements not on the the top of the
  stack (which breaks the definition of a general stack).  so i think
  i'll leave things as they are for now.  the functionality can always
  be split out later if it turns out to be needed elsewhere.
2013-04-18 17:12:58 -07:00
Ben Blazak e4b1717657 changed 'KEY__' to 'KEYBOARD__' for keycode macros 2013-04-18 13:32:37 -07:00
Ben Blazak bf13abc274 working on .../lib/usb/usage-page/ 2013-04-18 02:54:44 -07:00
Ben Blazak 98970c0698 (still working on the layer-stack) 2013-04-12 00:01:02 -07:00
Ben Blazak e3df599b85 (updated references) 2013-04-10 23:09:17 -07:00
Ben Blazak 30ad5663d2 (still working on the layer-stack) 2013-04-09 19:49:38 -07:00
Ben Blazak 9ac5701e7e (minor TODO fix) 2013-04-09 13:22:01 -07:00
Ben Blazak e8bec2c0a2 (working on the layer-stack) 2013-04-09 04:01:58 -07:00
Ben Blazak 43d849606a (working) 2013-04-07 22:51:41 -07:00
Ben Blazak 75a987d5a8 (more progress) 2013-04-06 23:37:16 -07:00
Ben Blazak 03c07e0a99 (working; got a lot done in keys.c.h and with the layout!) 2013-04-05 23:17:05 -07:00
Ben Blazak f7ba0b6497 (still working on keys and stuff) 2013-04-05 00:46:58 -07:00
Ben Blazak 76c4bb6c1f (working on keys still, and how to write them) 2013-04-04 17:19:20 -07:00