Merge pull request #821 from firmwaremodules/bugfix/simplelink-opt3001

Fix a couple of simplelink platform bugs
This commit is contained in:
George Oikonomou 2019-01-17 18:10:35 +00:00 committed by GitHub
commit 9ac015013e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -303,9 +303,13 @@ value(int type)
result_value = SWAP16(result_value);
uint32_t e = (result_value & 0x0FFF) >> 0;
uint32_t m = (result_value & 0xF000) >> 12;
uint32_t converted = m * 100 * (1 << e);
/* formula for computing lux: lux = 0.01 * 2^e * m
* scale up by 100 to avoid floating point, then require
* users to scale down by same.
*/
uint32_t m = (result_value & 0x0FFF) >> 0;
uint32_t e = (result_value & 0xF000) >> 12;
uint32_t converted = m * (1 << e);
PRINTF("OPT: %04X r=%d (centilux)\n", result_value,
(int)(converted));

View File

@ -1,4 +1,4 @@
CONTIKI_PROJECT = cc26xx-demo
CONTIKI_PROJECT = cc26x0-demo
PLATFORMS_ONLY = cc26x0-cc13x0