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

123456789101112131415161718192021222324252627282930313233343536373839
  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. * if strobe pin is on uC (strobe for Scanner_uC or Scanner_ShiftRegsRead),
  13. then strobePin is an Arduino pin number connected to this row.
  14. * if strobe pin is on I/O expander (strobe for Scanner_IOE), then strobePin is bit pattern,
  15. 1 indicating the I/O expander pin connected to this row
  16. */
  17. class Row
  18. {
  19. private:
  20. virtual void keyWasPressed();
  21. protected:
  22. void send(const uint8_t keyCount, const read_pins_t debouncedChanged);
  23. ScannerInterface& refScanner;
  24. const uint8_t strobePin; //pin connected to this row (details above)
  25. private:
  26. Key *const *const ptrsKeys; //array of Key pointers
  27. protected:
  28. const uint8_t keyCount; //number of read pins
  29. //Debouncer_Samples debouncer;
  30. Debouncer_Not debouncer; //todo restore Debouncer_Samples after testing
  31. read_pins_t debounced; //bit pattern, state of keys after debouncing, 1=pressed, 0=released
  32. public:
  33. Row(ScannerInterface& refScanner, const uint8_t strobePin,
  34. Key* const ptrsKeys[], const uint8_t keyCount);
  35. virtual void process();
  36. };
  37. #endif