/// <summary> /// The BDU bit is used to inhibit the output register update between the reading of the upper and lower register parts. /// In default mode (BDU = Continuous), the lower and upper register parts are updated continuously. /// If it is not certain whether the read will be faster than output data rate, it is recommended to set the BDU bit to �Quiescent�. /// In this way, after the reading of the lower (upper) register part, the content of that output register is not updated until the upper (lower) part is read also. /// This feature prevents the reading of LSB and MSB related to different samples. /// </summary> /// <param name="value">The BlockDataUpdate to use.</param> /// <example> /// <code language = "C#"> /// _tempHum.SetBDU(TempHumClick.BDU.Quiescent); /// </code> /// </example> public void SetBDU(BDU value) // ToDo = Property or method? { registerData = ReadRegister(HTS221_CTRL_REG1); registerData &= ~HTS221_BDU_MASK; registerData |= (Byte)value << HTS221_BDU_BIT; WriteRegister(HTS221_CTRL_REG1, (Byte)registerData); }
/// <summary> /// Configures the sensor using the supplied parameters. /// </summary> /// <remarks>This method additionally Powers On the Temp<![CDATA[&]]>Hum Click.</remarks> /// <param name="tempResolution">The <see cref="TemperatureResolutions"/> to use.</param> /// <param name="humidResolution">The <see cref="HumidityResolutions"/> to use.</param> /// <param name="outputDataRate">The <see cref="ODR"/> to use.</param> /// <param name="blockDataUpdate">The <see cref="BDU"/> to use.</param> /// <example> /// <code language = "C#"> /// _tempHum.ConfigureSensor(TempHumClick.TemperatureResolutions.Average32, TempHumClick.HumidityResolutions.Average64, TempHumClick.ODR.Odr1Hz, TempHumClick.BDU.Quiescent); /// </code> /// </example> public void ConfigureSensor(TemperatureResolutions tempResolution, HumidityResolutions humidResolution, ODR outputDataRate, BDU blockDataUpdate) { /* The following code is equivalent to setting: * // PowerMode = PowerModes.On; * // SetHeaterState(false); * // TemperatureResolution = tempResolution; * // HumidityResolution = humidResolution; * // SetBDU(blockDataUpdate); * // OutputDataRate(outputDataRate); */ registerData = (Byte)(((Byte)tempResolution << HTS221_TEMPERATURE_RESOLUTION_BIT) | ((Byte)humidResolution << HTS221_HUMIDITY_RESOLUTION_BIT)); WriteRegister(HTS221_AV_CONF, (Byte)registerData); registerData = (Byte)((1 << HTS221_POWER_STATE_BIT) | ((Byte)blockDataUpdate << HTS221_BDU_BIT) | ((Byte)outputDataRate << HTS221_ODR_Bit)); WriteRegister(HTS221_CTRL_REG1, (Byte)registerData); }