keybrd library is an open source library for creating custom-keyboard firmware.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
此仓库已存档。您可以查看文件和克隆,但不能推送或创建工单/合并请求。

Row_IOE.h 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef ROWIOE_H
  2. #define ROWIOE_H
  3. #include <RowBase.h>
  4. #include <RowScanner_PinsBitwise.h>
  5. #include <Debouncer_4Samples.h>
  6. #include <ColPort.h>
  7. /* Row_DH_IOE is a row connected to an Input/Output Expander.
  8. Instantiation
  9. -------------
  10. Definition of DELAY_MICROSECONDS is explained in RowBase.cpp.
  11. Definition of activeHigh is explained in RowScanner_Interface.h
  12. Example instantiation of a row:
  13. const unsigned int RowBase::DELAY_MICROSECONDS = 1000;
  14. const bool RowScanner_PinsArray::activeHigh = 0;
  15. const uint8_t IOExpanderPort::ADDR = 0x18;
  16. IOExpanderPort port1(1, 0);
  17. RowPort_PCA9655E rowPort1(port1);
  18. IOExpanderPort port0(0, 0);
  19. ColPort_PCA9655E colPort0(port0, 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 );
  20. Key* const ptrsKeys_0[] = { &k_00, &k_01, &k_02, &k_03, &k_04, &k_05 };
  21. Row_IOE row_0(rowPort1, 1<<0, colPort0, ptrsKeys_0);
  22. Number of pins in colPort0 should equal number of keys in ptrsKeys_0[] array.
  23. if a pin is missing, a key will be unresposive
  24. if a Key pointer is missing, the keyboard will fail in an unprdictable way
  25. */
  26. class Row_IOE : public RowBase
  27. {
  28. private:
  29. RowScanner_PinsBitwise scanner;
  30. Debouncer_4Samples debouncer;
  31. public:
  32. Row_IOE( RowPort& refRowPort, const uint8_t strobePin,
  33. ColPort& refColPort, Key *const ptrsKeys[], const uint8_t KEY_COUNT) //todo if KEY_COUNT is passed in, store it in private
  34. : RowBase(ptrsKeys), scanner(refRowPort, strobePin, refColPort) { }
  35. void process();
  36. uint8_t getRowState(ColPort* ptrColPort, uint8_t& KEY_COUNT);
  37. };
  38. #endif