keybrd library is an open source library for creating custom-keyboard firmware.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
Este repositório está arquivado. Você pode visualizar os arquivos e realizar clone, mas não poderá realizar push nem abrir issues e pull requests.

Matrix.h 1.3KB

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