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.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef PORTWRITE_PCA9655E_H
  2. #define PORTWRITE_PCA9655E_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include <Wire.h>
  6. #include <PortWrite.h>
  7. #include "PortIOE.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. If PortRead_PCA9655E is instantiated on the same port, do not use PortWrite_PCA9655E::begin().
  12. Use PortRead_PCA9655E::begin() instead. Otherwise READ_PINS could be overwritten.
  13. Instantiation
  14. ------------
  15. Example instantiation for row port 0:
  16. PortIOE port0(0, 0);
  17. PortWrite_PCA9655E rowPort0(port0);
  18. Example instantiation for row port 1:
  19. PortIOE port1(1, 0);
  20. PortWrite_PCA9655E rowPort1(port1);
  21. Diode orientation
  22. ----------------
  23. PCA9655E does not have internal pull-up resistors, external pull-down resistors are required.
  24. Rows, columns, and diode orientation are explained in Matrix.h
  25. PCA9655E data sheet
  26. ----------------
  27. http://www.onsemi.com/pub_link/Collateral/PCA9655E-D.PDF
  28. */
  29. class PortWrite_PCA9655E : public PortWrite
  30. {
  31. private:
  32. PortIOE& port;
  33. const uint8_t configurationByteCommand;
  34. const uint8_t outputByteCommand;
  35. public:
  36. //The constructor initialization list is in .cpp
  37. PortWrite_PCA9655E(PortIOE& port);
  38. void begin();
  39. virtual void write(const uint8_t pin, const bool level);
  40. };
  41. #endif