// ------------------------------------------------------------------------------------------------------ // Finish - blocking routine with timeout, loops until Tx/Rx is complete or timeout occurs // return: 1=success (Tx or Rx completed, no error), 0=fail (NAK, timeout or Arb Lost) // parameters: // timeout = timeout in microseconds // uint8_t i2c_t3::finish_(struct i2cStruct* i2c, uint32_t timeout) { elapsedMicros deltaT; // wait for completion or timeout while(!done_(i2c) && (timeout == 0 || deltaT < timeout)); // check exit status, if still Tx/Rx then timeout occurred if(i2c->currentStatus == I2C_SENDING || i2c->currentStatus == I2C_SEND_ADDR || i2c->currentStatus == I2C_RECEIVING) i2c->currentStatus = I2C_TIMEOUT; // set to timeout state // delay to allow bus to settle (eg. allow STOP to complete and be recognized, // not just on our side, but on slave side also) delayMicroseconds(10); if(i2c->currentStatus == I2C_WAITING) return 1; return 0; }
bool step() { static_cast<PoseChangerPlugin *>(plugin)->pose_changer.prefix = prefix; return done_(); }
bool step() { sound_plugin()->player.stopAll(); return done_(); }
bool step() { static_cast<PoseChangerPlugin *>(plugin)->pose_changer.cancel(); return done_(); }
bool step() { sound_plugin()->player.playFile(file); return done_(); }