/* Sends a command and data to the chip over the I2C bus.  */
uint32_t SI7021_cmdWrite(uint8_t *cmd, size_t cmdLen, uint8_t *data, size_t dataLen)
/* Sends a command and data to the chip over the I2C bus.  */
uint32_t SI7021_cmdWrite(uint8_t *cmd, size_t cmdLen, uint8_t *data, size_t dataLen)
{
   I2C_TransferSeq_TypeDef seq;
   I2C_TransferReturn_TypeDef ret;
   seq.addr = SI7021_I2C_BUS_ADDRESS << 1;
   seq.buf[0].data = cmd;
   seq.buf[0].len = cmdLen;
   if( dataLen > 0 ) {
      seq.flags = I2C_FLAG_WRITE_WRITE;
      seq.buf[1].data = data;
      seq.buf[1].len = dataLen;
   }
   else {
      seq.flags = I2C_FLAG_WRITE;
   }
   ret = I2CSPM_Transfer( SI7021_I2C_DEVICE, &seq );
   if( ret == i2cTransferNack ) {
      return SI7021_ERROR_I2C_TRANSFER_NACK;
   }
   else if( ret != i2cTransferDone ) {
      return SI7021_ERROR_I2C_TRANSFER_FAILED;
   }
   return SI7021_OK;
}
/** @} {end defgroup Si7021_Functions}