uint16_t max7301::readAddress(byte addr){ startSend(1); SPI.transfer(addr); #if !defined(__SAM3X8E__) && ((ARDUINO >= 160) || (TEENSYDUINO > 121)) uint16_t temp = SPI.transfer16(0x0); endSend(); return temp; #else byte low_byte = SPI.transfer(0x0); byte high_byte = SPI.transfer(0x0); endSend(); uint16_t temp = low_byte | (high_byte << 8); return temp; #endif }
void mcp23s17::writeWord(byte addr, uint16_t data){ startSend(0); SPI.transfer(addr); SPI.transfer(word2lowByte(data)); SPI.transfer(word2highByte(data)); endSend(); }
uint8_t mcp23s08::gpioRegisterReadByte(byte reg){ uint8_t data = 0; startSend(1); SPI.transfer(reg); data = SPI.transfer(0); endSend(); return data; }
uint8_t mcp23s08::readAddress(byte addr){ byte low_byte = 0x00; startSend(1); SPI.transfer(addr); low_byte = SPI.transfer(0x0); endSend(); return low_byte; }
uint16_t mcp23s17::readAddress(byte addr){ startSend(1); SPI.transfer(addr); byte low_byte = SPI.transfer(0x0); byte high_byte = SPI.transfer(0x0); endSend(); return byte2word(high_byte,low_byte); }
uint16_t mcp23s17::gpioRegisterReadWord(byte reg){ uint16_t data = 0; startSend(1); SPI.transfer(reg); data = SPI.transfer(0); data = SPI.transfer(0) << 8; endSend(); return data; }
void max7301::writeWord(byte addr, uint16_t data){ startSend(0); SPI.transfer(addr); #if !defined(__SAM3X8E__) && ((ARDUINO >= 160) || (TEENSYDUINO > 121)) SPI.transfer16(data); #else SPI.transfer(word2lowByte(data)); SPI.transfer(word2highByte(data)); #endif endSend(); }
uint16_t max7301::gpioRegisterReadWord(byte reg){ uint16_t data = 0; startSend(1); SPI.transfer(reg); #if !defined(__SAM3X8E__) && ((ARDUINO >= 160) || (TEENSYDUINO > 121)) data = SPI.transfer16(0); #else data = SPI.transfer(0); data = SPI.transfer(0) << 8; #endif endSend(); return data; }
void mcp23s08::writeByte(byte addr, byte data){ startSend(0); SPI.transfer(addr); SPI.transfer(data); endSend(); }