Hardware/LPC/IT87XX.cs
changeset 170 31858ba46e9c
parent 166 fa9dfbfc4145
child 182 4801e9eaf979
     1.1 --- a/Hardware/LPC/IT87XX.cs	Tue Aug 17 20:25:27 2010 +0000
     1.2 +++ b/Hardware/LPC/IT87XX.cs	Tue Aug 17 21:44:02 2010 +0000
     1.3 @@ -53,6 +53,8 @@
     1.4      private float?[] voltages = new float?[0];
     1.5      private float?[] temperatures = new float?[0];
     1.6      private float?[] fans = new float?[0];
     1.7 +
     1.8 +    private readonly float voltageGain;
     1.9     
    1.10      // Consts
    1.11      private const byte ITE_VENDOR_ID = 0x90;
    1.12 @@ -102,6 +104,13 @@
    1.13        voltages = new float?[9];
    1.14        temperatures = new float?[3];
    1.15        fans = new float?[5];
    1.16 +
    1.17 +      // The IT8721F uses a 12mV resultion ADC, all others 16mV
    1.18 +      if (chip == Chip.IT8721F) {
    1.19 +        voltageGain = 0.012f;
    1.20 +      } else {
    1.21 +        voltageGain = 0.016f;
    1.22 +      }
    1.23      }
    1.24  
    1.25      public Chip Chip { get { return chip; } }
    1.26 @@ -156,8 +165,10 @@
    1.27  
    1.28        for (int i = 0; i < voltages.Length; i++) {
    1.29          bool valid;
    1.30 -        float value = 0.001f * ((int)ReadByte(
    1.31 -          (byte)(VOLTAGE_BASE_REG + i), out valid) << 4);
    1.32 +        
    1.33 +        float value = 
    1.34 +          voltageGain * ReadByte((byte)(VOLTAGE_BASE_REG + i), out valid);   
    1.35 +
    1.36          if (!valid)
    1.37            continue;
    1.38          if (value > 0)