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.h 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef ROW_H
  2. #define ROW_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include <config_keybrd.h>
  6. #include <Key.h>
  7. #include <ScannerInterface.h>
  8. #include <Debouncer_Samples.h>
  9. #include <Debouncer_Not.h>
  10. /*
  11. strobePin has one of two formats:
  12. 1. if strobe pin is on uC (Scanner_uC or Scanner_ShiftRegsRead),
  13. then strobePin is an Arduino pin number connected to this row.
  14. 2. if strobe pin is on I/O expander (Scanner_IOE), then strobePin is bit pattern,
  15. 1 indicating the I/O expander pin connected to this row
  16. todo instantiation examples - here or in Scanner?
  17. */
  18. class Row
  19. {
  20. private:
  21. virtual void keyWasPressed();
  22. protected:
  23. void send(const uint8_t keyCount, const read_pins_t debouncedChanged);
  24. ScannerInterface& refScanner;
  25. const uint8_t strobePin; //pin connected to this row (details above)
  26. private:
  27. Key *const *const ptrsKeys; //array of Key pointers
  28. protected:
  29. const uint8_t keyCount; //number of read pins
  30. //Debouncer_Samples debouncer;
  31. Debouncer_Not debouncer; //todo
  32. read_pins_t debounced; //bit pattern, state of keys after debouncing, 1=pressed, 0=released
  33. public:
  34. Row(ScannerInterface& refScanner, const uint8_t strobePin,
  35. Key* const ptrsKeys[], const uint8_t keyCount);
  36. virtual void process();
  37. };
  38. #endif