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

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