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_uC.h 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef ROW_UC_H
  2. #define ROW_UC_H
  3. #include <Row.h>
  4. #include <Scanner_uC.h>
  5. #include <Debouncer_Samples.h>
  6. /* Row_uC is a row connected to a micro controller.
  7. Instantiation
  8. -------------
  9. keybrd_library_developer_guide.md has instructions for ## Active state and diode orientation
  10. Example instantiation of a Row_uC:
  11. const bool Scanner_uC::STROBE_ON = LOW; //logic level of strobe on, active low
  12. const bool Scanner_uC::STROBE_OFF = HIGH; //logic level of strobe off
  13. const uint8_t readPins[] = {0,1,2,3,7,8};
  14. const uint8_t readPinCount = sizeof(readPins)/sizeof(*readPins);
  15. Key* const ptrsKeys_0[] = { &k_00, &k_01, &k_02, &k_03, &k_04, &k_05 };
  16. Row_uC row_0(21, readPins, readPinCount, ptrsKeys_0);
  17. Number of readPins should equal number of keys in ptrsKeys_0[] array.
  18. if a readPins is missing, a key will be unresposive
  19. if a Key pointer is missing, the keyboard will fail in an unpredictable way
  20. */
  21. class Row_uC : public Row
  22. {
  23. private:
  24. Scanner_uC scanner;
  25. Debouncer_Samples debouncer;
  26. const uint8_t readPinCount;
  27. public:
  28. Row_uC(const uint8_t strobePin, const uint8_t readPins[], const uint8_t readPinCount,
  29. Key* const ptrsKeys[])
  30. : Row(ptrsKeys), scanner(strobePin, readPins, readPinCount),
  31. readPinCount(readPinCount) { }
  32. void process();
  33. };
  34. #endif