keybrd library is an open source library for creating custom-keyboard firmware.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

Row.cpp 765B

123456789101112131415161718192021
  1. /* debounce() sets debounced and returns debouncedChanged. All variables are bitwise.
  2. For parameter, 1 means pressed, 0 means released.
  3. For return, 1 means debounced changed.
  4. */
  5. #include "Row.h"
  6. /*
  7. process() scans the row and calls any newly pressed or released keys.
  8. */
  9. void Row::process()
  10. {
  11. //these variables are all bitwise, one bit per key
  12. uint8_t rowState; //1 means pressed, 0 means released
  13. uint16_t rowEnd; //1 bit marks positioned after last key of row
  14. uint8_t debouncedChanged; //1 means debounced changed
  15. wait();
  16. rowState = scanner.scan(rowEnd);
  17. debouncedChanged = debouncer.debounce(rowState, debounced);
  18. pressRelease(rowEnd, debouncedChanged);
  19. }