/* Sets the output voltage to a fraction of source vref. (Value can be 0..4095)  */
void mcp4725SetVoltage(uint16_t output, bool writeEEPROM)
/* Sets the output voltage to a fraction of source vref. (Value can be 0..4095)  */
void mcp4725SetVoltage(uint16_t output, bool writeEEPROM)
{
  if (!_mcp4725Initialised) mcp4725Init();
  uint32_t i;
  for ( i = 0; i < I2C_BUFSIZE; i++ )
  {
    I2CMasterBuffer[i] = 0x00;
  }
  I2CWriteLength = 4;
  I2CReadLength = 0;
  I2CMasterBuffer[0] = MCP4725_ADDRESS;
  if (writeEEPROM)
  {
    I2CMasterBuffer[1] = (MCP4726_CMD_WRITEDACEEPROM);
  }
  else
  {
    I2CMasterBuffer[1] = (MCP4726_CMD_WRITEDAC);
  }
  I2CMasterBuffer[2] = (output / 16);
  I2CMasterBuffer[3] = (output % 16) << 4;
  i2cEngine();
}