Browse Source

Add AVR twi_writeTo compatibility function

main
PaulStoffregen 7 years ago
parent
commit
53bad9ba2b
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      WireKinetis.cpp

+ 15
- 0
WireKinetis.cpp View File

return count; return count;
} }


// for compatibility with examples that directly call this AVR-specific function
// https://learn.adafruit.com/adafruit-tca9548a-1-to-8-i2c-multiplexer-breakout/wiring-and-test
// https://forum.pjrc.com/threads/44922-Undefined-reference-to-twi_writeTo
extern "C"
uint8_t twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait, uint8_t sendStop)
{
if (!wait) return 4;
Wire.beginTransmission(address);
while (length) {
Wire.write(*data++);
length--;
}
return Wire.endTransmission(sendStop);
}

constexpr TwoWire::I2C_Hardware_t TwoWire::i2c0_hardware = { constexpr TwoWire::I2C_Hardware_t TwoWire::i2c0_hardware = {
SIM_SCGC4, SIM_SCGC4_I2C0, SIM_SCGC4, SIM_SCGC4_I2C0,
#if defined(__MKL26Z64__) || defined(__MK20DX128__) || defined(__MK20DX256__) #if defined(__MKL26Z64__) || defined(__MK20DX128__) || defined(__MK20DX256__)

Loading…
Cancel
Save