private void Write16BitRegister(byte register, int value) { short res = (short)((Int16)value * ResolutionCalculationFactor); byte lsb = (byte)res; byte msb = (byte)((Int16)res >> 8); I2CTransactions.Write(_adt7410, register, new byte[] { msb, lsb }); }
private void UpdateResolution(Resolution resolution) { byte config = I2CTransactions.Read(_adt7410, ConfigurationRegister)[0]; if (resolution == Resolution.High) { config |= (1 << 7); } else { config = (byte)(config & ~(1 << 7)); } //set bit no 7; 1 = 16bit, 0 = 13bit resolution I2CTransactions.Write(_adt7410, ConfigurationRegister, config); }
private float Read16BitRegister(byte register) { byte[] result = I2CTransactions.Read(_adt7410, register, 2); return(((result[0] << 8) | result[1]) / ResolutionCalculationFactor); }
public void ResetRegisterValues() { I2CTransactions.Write(_adt7410, ResetRegister, 1); }
private void Initialize() { I2CTransactions.Write(_adt7410, ConfigurationRegister, (byte)0x10); //reset on comparator mode (bit 4 = 1) Resolution = Resolution.Default; }