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

PortMCP23S17.cpp 696B

12345678910111213141516
  1. #include "PortMCP23S17.h"
  2. /* transfer() writes data to registerAddr, reads portSate from registerAddr, and returns portState.
  3. */
  4. uint8_t PortMCP23S17::transfer(const uint8_t command, const uint8_t registerAddr, const uint8_t data)
  5. {
  6. uint8_t portState; //bit pattern
  7. digitalWrite(SS, LOW); //enable Slave Select
  8. SPI.transfer(command); //write or read command
  9. SPI.transfer(registerAddr); //register address to write data to
  10. portState = SPI.transfer(data); //write data, read portState
  11. digitalWrite(SS, HIGH); //disable Slave Select
  12. return portState;
  13. }