keybrd library is an open source library for creating custom-keyboard firmware.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

Row_ShiftRegisters.h 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef ROW_SHIFTREGISTERS_H
  2. #define ROW_SHIFTREGISTERS_H
  3. #include <RowBase.h>
  4. #include <RowScanner_SPIShiftRegisters.h>
  5. #include <Debouncer_4Samples.h>
  6. /* Row_DH_IOE is a row connected to an Input/Output Expander.
  7. Instantiation
  8. -------------
  9. Definition of DELAY_MICROSECONDS is explained in RowBase.cpp.
  10. Example instantiation of a row:
  11. const unsigned int RowBase::DELAY_MICROSECONDS = 1000;
  12. todo
  13. Key* const ptrsKeys_0[] = { &k_00, &k_01, &k_02, &k_03, &k_04, &k_05 };
  14. Row_ShiftRegisters row_0(uint8_t BYTE_COUNT, ptrsKeys_0);
  15. Number of pins in colPort0 should equal number of keys in ptrsKeys_0[] array.
  16. if a pin is missing, a key will be unresposive
  17. if a Key pointer is missing, the keyboard will fail in an unprdictable way
  18. */
  19. class Row_ShiftRegisters : public RowBase
  20. {
  21. private:
  22. RowScanner_SPIShiftRegisters scanner;
  23. Debouncer_4Samples debouncer;
  24. public:
  25. Row_ShiftRegisters(const uint8_t SS, uint8_t BYTE_COUNT, Key *const ptrsKeys[], uint16_t KEY_COUNT)
  26. : RowBase(ptrsKeys), scanner(SS, BYTE_COUNT, KEY_COUNT) { }
  27. void begin();
  28. uint8_t scan(uint16_t& rowEnd);
  29. uint8_t debounce(const uint8_t rowState, uint8_t& debounced);
  30. };
  31. #endif