diff options
author | Bill Richardson <wfrichar@chromium.org> | 2013-07-31 13:08:11 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-08-07 17:24:09 -0700 |
commit | 6f8e276cc842d0804292d473fe3305295d2e7052 (patch) | |
tree | 3b66c44e86db4b8f2ebbc157666e6ed62f6e3ff1 /include/common.h | |
parent | e98bde3fec5e53314a15fd031c83ee630973483f (diff) | |
download | chrome-ec-6f8e276cc842d0804292d473fe3305295d2e7052.tar.gz |
Use macros for C <-> K conversions
This just replaces all the "X - 273", "Y + 273" stuff with a macro.
BUG=none
BRANCH=falco,peppy
TEST=manual
Run the EC console command "temps". It should print human-readable things.
Change-Id: Icc4284c89fdbc0cd3b206a0faacf121973652a63
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65005
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/common.h')
-rw-r--r-- | include/common.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h index 235540d220..03fd7affee 100644 --- a/include/common.h +++ b/include/common.h @@ -44,6 +44,12 @@ #define __packed __attribute__((packed)) #endif +/* There isn't really a better place for this */ +#define C_TO_K(temp_c) ((temp_c) + 273) +#define K_TO_C(temp_c) ((temp_c) - 273) +#define CELSIUS_TO_DECI_KELVIN(temp_c) ((temp_c) * 10 + 2731) +#define DECI_KELVIN_TO_CELSIUS(temp_dk) ((temp_dk - 2731) / 10) + /* Include top-level configuration file */ #include "config.h" |