From 284b52c8b6e510dc74b6aed13b2a85b91ea7bdf0 Mon Sep 17 00:00:00 2001 From: firmwareguru Date: Mon, 14 Jan 2019 19:23:13 -0700 Subject: [PATCH 1/2] Fix cc26x0-cc13x0 example not building --- examples/platform-specific/cc26x0-cc13x0/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/platform-specific/cc26x0-cc13x0/Makefile b/examples/platform-specific/cc26x0-cc13x0/Makefile index 9962ab32a..bd9600c78 100644 --- a/examples/platform-specific/cc26x0-cc13x0/Makefile +++ b/examples/platform-specific/cc26x0-cc13x0/Makefile @@ -1,4 +1,4 @@ -CONTIKI_PROJECT = cc26xx-demo +CONTIKI_PROJECT = cc26x0-demo PLATFORMS_ONLY = cc26x0-cc13x0 From 8203abb2e7063206d477752aa8073bc971646d93 Mon Sep 17 00:00:00 2001 From: firmwareguru Date: Mon, 14 Jan 2019 19:35:12 -0700 Subject: [PATCH 2/2] fixes contiki-ng/contiki-ng#768 simplelink opt3001 wrong value --- .../cc13xx-cc26xx/sensortag/opt-3001-sensor.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/opt-3001-sensor.c b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/opt-3001-sensor.c index 885fefe88..42e3976d8 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/sensortag/opt-3001-sensor.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/sensortag/opt-3001-sensor.c @@ -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));