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.

Port_MCP23018.h 1.2KB

12345678910111213141516171819202122232425262728293031
  1. #ifndef PORT_MCP23018_H
  2. #define PORT_MCP23018_H
  3. #include "Port_MCP23017.h"
  4. /* Port_MCP23018
  5. write pins are connected to matrix Row (strobe pin) or LED.
  6. readPins are connected to matrix column to read which keys are pressed.
  7. Port_MCP23018 can only be active low (Scanner_IOE::activeState = LOW).
  8. Open-drain active high would not work because pull down resistors have no effect on sink.
  9. https://en.wikipedia.org/wiki/Open_collector
  10. Use LED_PortOpenDrain class for indicator LEDs.
  11. Example instantiation:
  12. const uint8_t IOE_ADDR = 0x20; //MCP23018 address pin grounded
  13. Port_MCP23018 portB(IOE_ADDR, 1, 0); //all pins are set to output for strobes and LEDs
  14. Port_MCP23018 portA(IOE_ADDR, 0, 1<<0 | 1<<1 ); //pin 0 and pin 1 are set to input for reading,
  15. //remaining pins can be used for LEDs
  16. Diode orientation
  17. ----------------
  18. Diode orientation is explained in keybrd_library_user_guide.md > Diode orientation
  19. */
  20. class Port_MCP23018 : public Port_MCP23017
  21. {
  22. public:
  23. Port_MCP23018(const uint8_t deviceAddr, const uint8_t portNum, const uint8_t readPins)
  24. : Port_MCP23017(deviceAddr, portNum, readPins) {}
  25. };
  26. #endif