keybrd library is an open source library for creating custom-keyboard firmware.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
Tento repozitář je archivovaný. Můžete prohlížet soubory, klonovat, ale nemůžete nahrávat a vytvářet nové úkoly a požadavky na natažení.

PortRead_MCP23S17.h 1.2KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef PORTREAD_MCP23S17_H
  2. #define PORTREAD_MCP23S17_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include <SPI.h>
  6. #include <PortRead.h>
  7. #include "PortIOE.h"
  8. /* One MCP23S17 I/O expander port connected to matrix columns.
  9. Instantiation todo
  10. ------------
  11. pullUp parameter is port's bitwise pin configuration
  12. 1=configure as input (for pins connected to column)
  13. 0=configure as output (for LED or not connected to a column)
  14. Example instantiation for column port 0, with pins 2 and 3 connected to columns:
  15. PortIOE port0(0, 0);
  16. PortRead_MCP23S17 colPort0(port0, 2<<0 | 1<<3 );
  17. Example instantiation for column port 1, with pins 2 and 3 connected to columns:
  18. PortIOE port1(1, 0);
  19. PortRead_MCP23S17 colPort1(port1, 2<<0 | 1<<3 );
  20. pullUp are read from pin 0 on up.
  21. */
  22. class PortRead_MCP23S17 : public PortRead
  23. {
  24. private:
  25. PortIOE& port;
  26. const uint8_t pullUp; //bitwise, 1 means internal pull-up resistor enabled
  27. public:
  28. PortRead_MCP23S17(PortIOE& port, const uint8_t pullUp) : port(port), pullUp(pullUp) {}
  29. void begin();
  30. virtual uint8_t read();
  31. };
  32. #endif