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.

Scanner_Port.h 1.1KB

12345678910111213141516171819202122232425262728
  1. #ifndef SCANNER_PORT_H
  2. #define SCANNER_PORT_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include <PortWrite.h>
  6. #include <PortRead.h>
  7. /* Scanner_Port uses bit manipulation to read all pins of one port.
  8. The ports are normally from an I/O Expander, but could also be ports from an AVR uC.
  9. The maximum keys per row is 8, because ports have a maximum of 8 pins each.
  10. keybrd_library_developer_guide.md has instructions for ## Active state and diode orientation
  11. */
  12. class Scanner_Port
  13. {
  14. private:
  15. static const bool STROBE_ON; //HIGH or LOW logic level of strobe on, active state
  16. static const bool STROBE_OFF; //logic level of strobe off, complement of STROBE_ON
  17. PortWrite& refPortWrite; //the IC port containing the strobePin
  18. const uint8_t strobePin; //bitwise, 1 indicates IC pin connected to this row
  19. PortRead& refPortRead; //the IC's read port
  20. public:
  21. Scanner_Port(PortWrite &refPortWrite, const uint8_t strobePin, PortRead& refPortRead)
  22. : refPortWrite(refPortWrite), strobePin(strobePin), refPortRead(refPortRead) {}
  23. uint8_t scan();
  24. };
  25. #endif