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.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef ROW_H
  2. #define ROW_H
  3. #include <RowBase.h>
  4. #include <RowScanner_PinsArray.h>
  5. #include <Debouncer_4Samples.h>
  6. /* Row_uC is a row connected to a micro controller.
  7. Configuration
  8. -------------
  9. Define and initilize DELAY_MICROSECONDS in sketch. Detailed how to is in RowBase.cpp.
  10. Instantiation
  11. -------------
  12. Example instantiation of a row:
  13. const uint8_t colPins[] = {0,1,2,3,7,8};
  14. const uint8_t COL_PIN_COUNT = sizeof(colPins)/sizeof(*colPins);
  15. Key* const ptrsKeys_0[] = { &k_00, &k_01, &k_02, &k_03, &k_04, &k_05 };
  16. Row_DH_uC row_0(21, colPins, COL_PIN_COUNT, ptrsKeys_0);
  17. Number of colPins should equal number of keys in ptrsKeys_0[] array.
  18. if a colPin is missing, a key will be unresposive
  19. if a Key pointer is missing, the keyboard will fail in an unprdictable way
  20. */
  21. class Row_uC : public RowBase
  22. {
  23. private:
  24. RowScanner_PinsArray scanner;
  25. Debouncer_4Samples debouncer;
  26. public:
  27. Row_uC(const uint8_t strobePin, const uint8_t readPins[], const uint8_t READ_PIN_COUNT,
  28. Key *const ptrsKeys[])
  29. : RowBase(ptrsKeys), scanner(strobePin, readPins, READ_PIN_COUNT) { }
  30. uint8_t scan(uint16_t& rowEnd);
  31. uint8_t debounce(const uint8_t rowState, uint8_t& debounced);
  32. };
  33. #endif