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.

LED_Port.h 769B

12345678910111213141516171819202122232425262728
  1. #ifndef LED_PORT_H
  2. #define LED_PORT_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include <Wire.h>
  6. #include <LEDInterface.h>
  7. #include <PortInterface.h>
  8. /* An LED_Port object is an I/O expander pin that is connected to an LED indicator light.
  9. Example initialization:
  10. const uint8_t IOE_ADDR = 0x20;
  11. Port_MCP23S17 portA(IOE_ADDR, 0, 1<<0 | 1<<1 );
  12. LED_Port LED_fn(portA, 1<<5);
  13. */
  14. class LED_Port : public LEDInterface
  15. {
  16. private:
  17. PortInterface& refPort;
  18. const uint8_t pin; //bit pattern, 1 is IOE pin to LED
  19. public:
  20. LED_Port(PortInterface& refPort, const uint8_t pin)
  21. : refPort(refPort), pin(pin) {}
  22. virtual void on();
  23. virtual void off();
  24. };
  25. #endif