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

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef MATRIX_H
  2. #define MATRIX_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include "Row.h"
  6. /*
  7. Diode orientation
  8. ----------------
  9. A keyboard's physically matrix is composed of rows and columns.
  10. The rows and columns are physically connected to the keys.
  11. The rows and columns are distinguishable by diode orientation (not horizontal/vertical).
  12. For active low diode orientation is:
  13. cathodes on rows
  14. anodes on columns
  15. For active high diode orientation is reversed:
  16. anodes on rows
  17. cathodes on columns
  18. Pull-down resistors
  19. -------------------
  20. If Matrix uses active low, IC requires one pull-up resistor on each ColPort::colPins.
  21. If Matrix uses active high, IC requires one pull-down resistor on each ColPort::colPins.
  22. External pull-down resistors should have a value between 10k Ohms and 2.2k Ohms.
  23. */
  24. class Matrix
  25. {
  26. private:
  27. Row *const *const ptrsRows; //array of row pointers
  28. const uint8_t rowCount;
  29. const bool activeHigh; //logic level of strobe pin: 0=activeLow, 1=activeHigh
  30. public:
  31. Matrix( Row *const ptrsRows[], const uint8_t rowCount, const bool activeHigh)
  32. : ptrsRows(ptrsRows), rowCount(rowCount), activeHigh(activeHigh) {}
  33. void scan();
  34. };
  35. #endif