public Tcs34725(I2cBus i2c, byte address, Tcs34725IntegrationTime it, Tcs34725Gain gain) : base(i2c, address) { _tcs34725Initialised = false; _tcs34725IntegrationTime = it; _tcs34725Gain = gain; }
private void IntegrationTime(Tcs34725IntegrationTime tcs34725IntegrationTime) { /* Set a Thread.Sleep for the integration time. * This is only necessary in the case where enabling and then * immediately trying to read values back. This is because setting * AEN triggers an automatic integration, so if a read RGBC is * performed too quickly, the data is not yet valid and all 0's are * returned */ switch (tcs34725IntegrationTime) { case Tcs34725IntegrationTime.TCS34725_INTEGRATIONTIME_2_4MS: Thread.Sleep(3); break; case Tcs34725IntegrationTime.TCS34725_INTEGRATIONTIME_24MS: Thread.Sleep(24); break; case Tcs34725IntegrationTime.TCS34725_INTEGRATIONTIME_50MS: Thread.Sleep(50); break; case Tcs34725IntegrationTime.TCS34725_INTEGRATIONTIME_101MS: Thread.Sleep(101); break; case Tcs34725IntegrationTime.TCS34725_INTEGRATIONTIME_154MS: Thread.Sleep(154); break; case Tcs34725IntegrationTime.TCS34725_INTEGRATIONTIME_700MS: Thread.Sleep(700); break; } }
/// <summary> /// </summary> /// <param name="tcs34725IntegrationTime"></param> public void SetIntegrationTime(Tcs34725IntegrationTime tcs34725IntegrationTime) { if (!_tcs34725Initialised) { Init(); } /* Update the timing register */ WriteByte(TCS34725_ATIME | TCS34725_COMMAND_BIT, (byte)tcs34725IntegrationTime); /* Update value placeholders */ _tcs34725IntegrationTime = tcs34725IntegrationTime; }
public Tcs34725(I2cBus i2c, Tcs34725IntegrationTime it, Tcs34725Gain gain) : this(i2c, TCS34725_ADDRESS, it, gain) { }