[lm-sensors] How to define IN_TO_REG and IN_FROM_REG in w83627hf.c

Juerg Haefliger juergh at gmail.com
Thu Aug 9 17:22:21 CEST 2007


Hi Dave,


> Hello,
>
> I don't understand why the IN_TO_REG(val) is defined by
> (SENSORS_LIMIT((((val) + 8)/16),0,255))

(val+8)/16 is equal to val/16 with rounding, i.e. round(val/16), and
then the result is clipped to stay within the range 0-255.

Hope this helps
...juerg


> and IN_FROM_REG(val) is
> defined by ((val) * 16)
>
> Would you teach me? Thank you.
>
> BR,
> Dave.
>
> _______________________________________________
> lm-sensors mailing list
> lm-sensors at lm-sensors.org
> http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
>




More information about the lm-sensors mailing list