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_IOE.h 1.1KB

1234567891011121314151617181920212223242526272829
  1. #ifndef SCANNER_IOE_H
  2. #define SCANNER_IOE_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include "ScannerInterface.h"
  6. #include "PortInterface.h"
  7. /* Scanner_IOE uses bit manipulation to read all pins of one port.
  8. The maximum keys per row is 8, because ports have a maximum of 8 pins each.
  9. begin() should be called once from sketch setup().
  10. keybrd_library_developer_guide.md has instructions for ## Active state and diode orientation
  11. */
  12. class Scanner_IOE : public ScannerInterface
  13. {
  14. private:
  15. const bool activeState; //logic level of strobe on, HIGH or LOW
  16. PortInterface& refPortWrite; //the IC port containing the strobePin
  17. PortInterface& refPortRead; //the IC's read port
  18. public:
  19. Scanner_IOE(const bool activeState, PortInterface &refPortWrite, PortInterface& refPortRead)
  20. : activeState(activeState), refPortWrite(refPortWrite), refPortRead(refPortRead) {}
  21. void init(const uint8_t strobePin);
  22. void begin();
  23. read_pins_t scan(const uint8_t strobePin);
  24. };
  25. #endif