(Phil) It should now handle negative temps going to and from registers.

I tested the new macros from a simple stand alone C app, but actual
system testing is still desired.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@852 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Philip Edelbrock committed 2000-08-03 23:01:30 +00:00
1 parent 622594be1e
commit 40a6e0e631
1 file changed
+1 -1
+1 -1
View File
@@ -58,7 +58,7 @@ SENSORS_INSMOD_1(lm75);
these macros are called: arguments may be evaluated more than once.
Fixing this is just not worth it. */
#define TEMP_FROM_REG(val) ((((val & 0x7fff) >> 7) * 5) | ((val & 0x8000)?-256:0))
#define TEMP_TO_REG(val) (SENSORS_LIMIT(((((val) + 2) / 5) << 7),0,0xffff))
#define TEMP_TO_REG(val) (SENSORS_LIMIT((val<0?(0x200+((val)/5))<<7:(((val) + 2) / 5) << 7),0,0xffff))
/* Initial values */
#define LM75_INIT_TEMP_OS 600