diff options
author | Keith Packard <keithp@keithp.com> | 2010-01-10 16:31:50 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-01-10 16:35:58 -0800 |
commit | 9856b7c4397afcecc8f541af9a83824e817b3612 (patch) | |
tree | 71d2d68717c29cd96addd22d1734bbb5040a4b56 /ao-tools/lib | |
parent | 0c2533be15858774ef9381aa8c8344356fd5b971 (diff) |
Switch to using internal cc1111 temperature sensor
v0.2 has no temperature sensor, and several of the v0.1 boards didn't
get a temperature sensor loaded. Use the internal temperature sensor
on the cc1111 in all cases instead.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/lib')
-rw-r--r-- | ao-tools/lib/cc-convert.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ao-tools/lib/cc-convert.c b/ao-tools/lib/cc-convert.c index ac6962ba..8d6876a0 100644 --- a/ao-tools/lib/cc-convert.c +++ b/ao-tools/lib/cc-convert.c @@ -213,10 +213,19 @@ cc_accelerometer_to_acceleration(double accel, double ground_accel) return (ground_accel - accel) / count_per_mss; } +/* Value for the CC1111 built-in temperature sensor + * Output voltage at 0°C = 0.755V + * Coefficient = 0.00247V/°C + * Reference voltage = 1.25V + * + * temp = ((value / 32767) * 1.25 - 0.755) / 0.00247 + * = (value - 19791.268) / 32768 * 1.25 / 0.00247 + */ + double cc_thermometer_to_temperature(double thermo) { - return ((thermo / 32767 * 3.3) - 0.5) / 0.01; + return (thermo - 19791.268) / 32728.0 * 1.25 / 0.00247; } double |