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.

StrobePort_PCA9655E.h 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef STROBEPORT_PCA9655E_H
  2. #define STROBEPORT_PCA9655E_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include <Wire.h>
  6. #include <StrobePort.h>
  7. #include "IOEPort.h"
  8. /* One PCA9655E I/O expander port connected to matrix rows.
  9. begin() configures column port's configuration and output.
  10. This should normally be called only once.
  11. Instantiation
  12. ------------
  13. Example instantiation for row port 0:
  14. IOEPort port0(0, 0);
  15. StrobePort_PCA9655E rowPort0(port0);
  16. Example instantiation for row port 1:
  17. IOEPort port1(1, 0);
  18. StrobePort_PCA9655E rowPort1(port1);
  19. Diode orientation
  20. ----------------
  21. PCA9655E does not have internal pull-up resistors, external pull-down resistors are required.
  22. Rows, columns, and diode orientation are explained in Matrix.h
  23. PCA9655E data sheet
  24. ----------------
  25. http://www.onsemi.com/pub_link/Collateral/PCA9655E-D.PDF
  26. */
  27. class StrobePort_PCA9655E : public StrobePort
  28. {
  29. private:
  30. IOEPort& port;
  31. const uint8_t configurationByteCommand;
  32. const uint8_t outputByteCommand;
  33. public:
  34. //The constructor initialization list is in .cpp
  35. StrobePort_PCA9655E(IOEPort& port);
  36. void begin();
  37. virtual void setActivePinLow(const uint8_t activePin); //activePin is a port mask todo delete
  38. virtual void setActivePinHigh(const uint8_t activePin); //todo delete also in StrobePort.h
  39. virtual void write(const uint8_t pin, const bool level);
  40. };
  41. #endif