keybrd library is an open source library for creating custom-keyboard firmware.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
このリポジトリはアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュや、課題・プルリクエストのオープンはできません。

LED_Port.h 918B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef LED_PORT_H
  2. #define LED_PORT_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include <LEDInterface.h>
  6. #include <PortWriteInterface.h>
  7. /* An LED_Port object is an I/O expander pin that is connected to an LED indicator light.
  8. LED_Port functions turn LED on and off.
  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. Example initialization:
  14. Port_ShiftRegs shiftRegs(8);
  15. LED_Port LED_fn(shiftRegs, 1<<6);
  16. */
  17. class LED_Port : public LEDInterface
  18. {
  19. private:
  20. PortWriteInterface& refPort;
  21. const uint8_t pin; //bit pattern, 1 is pin connected to LED
  22. public:
  23. LED_Port(PortWriteInterface& refPort, const uint8_t pin)
  24. : refPort(refPort), pin(pin) {}
  25. virtual void on();
  26. virtual void off();
  27. };
  28. #endif