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í.

PortIOE.h 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef PORTIOE_H
  2. #define PORTIOE_H
  3. #include <inttypes.h>
  4. /* The pins of an IC's port can be split between PortWrite, PortRead, and LED.
  5. PortIOE contains outputVal, the value of a port's output register.
  6. outputVal is used for port manipulation by classes PortWrite and LED.
  7. One port's outputVal can be shared by strobe pins and multiple LED pins.
  8. PortIOE is only used by I/O expander port classes.
  9. AVR port classes do not need a similar class because PORTx is global in the Arduino library.
  10. Instantiation
  11. ------------
  12. Example PortIOE::DEVICE_ADDR initilization:
  13. const uint8_t PortIOE::DEVICE_ADDR = 0x18;
  14. Be careful with the DEVICE_ADDR.
  15. Table 6 in PCA9655E datasheet lists 8-bit versions of I2C addresses.
  16. The Arduino Wire library uses 7-bit addresses throughout, so drop the low bit.
  17. For example, I2C address with AD2=GND AD1=SCL AD0=SCL,
  18. Table 6 lists 8-bit DEVICE_ADDR = 0x30 (b 00110000)
  19. while Arduino uses 7-bit DEVICE_ADDR = 0x18 (b 00011000)
  20. http://playground.arduino.cc/Main/WireLibraryDetailedReference
  21. The PCA9655E data sheet is on http://www.onsemi.com/pub_link/Collateral/PCA9655E-D.PDF
  22. portNumber: If the I/O expander uses port letters, use 0 inplace of A, use 1 inplace of B.
  23. */
  24. struct PortIOE
  25. {
  26. static const uint8_t DEVICE_ADDR;
  27. const uint8_t num; //port identification number
  28. uint8_t outputVal; //bit value of output register for LEDs
  29. PortIOE(const uint8_t portNumber)
  30. : num(portNumber), outputVal(0) {}
  31. };
  32. #endif