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

1234567891011121314151617181920212223242526
  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. */
  11. class Scanner_Port
  12. {
  13. private:
  14. static const bool STROBE_ON; //HIGH or LOW logic level of strobe on, active state
  15. static const bool STROBE_OFF; //logic level of strobe off, complement of STROBE_ON
  16. PortWrite& refPortWrite; //the IC port containing the STROBE_PIN
  17. const uint8_t STROBE_PIN; //bitwise, 1 indicates IC pin connected to this row
  18. PortRead& refPortRead; //the IC's read port
  19. public:
  20. Scanner_Port(PortWrite &refPortWrite, const uint8_t STROBE_PIN, PortRead& refPortRead)
  21. : refPortWrite(refPortWrite), STROBE_PIN(STROBE_PIN), refPortRead(refPortRead) {}
  22. uint8_t scan();
  23. };
  24. #endif