keybrd library is an open source library for creating custom-keyboard firmware.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
Ce dépôt est archivé. Vous pouvez voir les fichiers et le cloner, mais vous ne pouvez pas pousser ni ouvrir de ticket/demande d'ajout.

PortWrite_MCP23S17.h 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef PORTWRITE_MCP23S17_H
  2. #define PORTWRITE_MCP23S17_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include <SPI.h>
  6. #include <PortWriteInterface.h>
  7. #include "PortMCP23S17.h"
  8. #include "PortIOE.h"
  9. /* One MCP23S17 I/O expander port connected to matrix rows.
  10. write() can output logiclevel to strobePin, one LED pin, or multiple pins.
  11. This class has Slave Select hardcoded to Arduino Pin 10.
  12. Arduino Pin 10 avoids the speed penalty of digitalWrite.
  13. Instantiation
  14. ------------
  15. Example instantiation:
  16. const uint8_t PortIOE::DEVICE_ADDR = 0x20; //MCP23S17 address, all 3 ADDR pins are grounded
  17. PortIOE port_B(1);
  18. PortWrite_MCP23S17 portWrite_B(port_B);
  19. Diode orientation
  20. ----------------
  21. Diode orientation is explained in keybrd_library_user_guide.md > Diode orientation
  22. MCP23S17 data sheet
  23. ------------------
  24. http://www.onsemi.com/pub_link/Collateral/MCP23S17-D.PDF
  25. */
  26. class PortWrite_MCP23S17 : public PortWriteInterface, public PortMCP23S17
  27. {
  28. private:
  29. PortIOE& port;
  30. public:
  31. PortWrite_MCP23S17(PortIOE& port) : port(port) {}
  32. void begin();
  33. virtual void write(const uint8_t pin, const bool logicLevel);
  34. };
  35. #endif