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.

PortWrite_PCA9655E.h 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef PORTWRITE_PCA9655E_H
  2. #define PORTWRITE_PCA9655E_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include <Wire.h>
  6. #include <PortWriteInterface.h>
  7. #include "PortIOE.h"
  8. /* One PCA9655E I/O expander port connected to matrix rows.
  9. PCA9655E does not have internal pull-up resistors (PCA9535E does).
  10. begin() configures column port's configuration and output.
  11. This should normally be called once in sketch's setup().
  12. If PortRead_PCA9655E is instantiated on the same port, do NOT use PortWrite_PCA9655E::begin().
  13. Otherwise readPins could be overwritten.
  14. Instantiation
  15. ------------
  16. Example instantiation for row port 0:
  17. PortIOE port0(0, 0);
  18. PortWrite_PCA9655E rowPort0(port0);
  19. Example instantiation for row port 1:
  20. PortIOE port1(1, 0);
  21. PortWrite_PCA9655E rowPort1(port1);
  22. Diode orientation
  23. ----------------
  24. Diode orientation is explained in keybrd_library_user_guide.md > Diode orientation
  25. PCA9655E data sheet
  26. ----------------
  27. http://www.onsemi.com/pub_link/Collateral/PCA9655E-D.PDF
  28. */
  29. class PortWrite_PCA9655E : public PortWriteInterface
  30. {
  31. private:
  32. PortIOE& port;
  33. public:
  34. PortWrite_PCA9655E(PortIOE& port) : port(port) {}
  35. void begin();
  36. virtual void write(const uint8_t pin, const bool level);
  37. };
  38. #endif