MYNEWT-748 SensorAPI: Add BME280 support - Make OIC observe rate configurable - Use the OIC observe rate as the LED blink rate in the app
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/f2a8e66a Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f2a8e66a Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f2a8e66a Branch: refs/heads/bluetooth5 Commit: f2a8e66af0947699269814ff13fa562fc27323d5 Parents: c9ca827 Author: Vipul Rahane <[email protected]> Authored: Fri May 12 17:13:38 2017 -0700 Committer: Vipul Rahane <[email protected]> Committed: Fri May 12 17:13:38 2017 -0700 ---------------------------------------------------------------------- apps/sensors_test/src/main.c | 2 +- hw/sensor/src/sensor_oic.c | 2 +- hw/sensor/syscfg.yml | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f2a8e66a/apps/sensors_test/src/main.c ---------------------------------------------------------------------- diff --git a/apps/sensors_test/src/main.c b/apps/sensors_test/src/main.c index 3c07e21..585a230 100755 --- a/apps/sensors_test/src/main.c +++ b/apps/sensors_test/src/main.c @@ -323,7 +323,7 @@ task1_handler(void *arg) ++g_task1_loops; /* Wait one second */ - os_time_delay(OS_TICKS_PER_SEC); + os_time_delay(OS_TICKS_PER_SEC * MYNEWT_VAL(SENSOR_OIC_OBS_RATE)); /* Toggle the LED */ (void)hal_gpio_toggle(g_led_pin); http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f2a8e66a/hw/sensor/src/sensor_oic.c ---------------------------------------------------------------------- diff --git a/hw/sensor/src/sensor_oic.c b/hw/sensor/src/sensor_oic.c index 53c5406..651e0ff 100644 --- a/hw/sensor/src/sensor_oic.c +++ b/hw/sensor/src/sensor_oic.c @@ -598,7 +598,7 @@ sensor_oic_init(void) oc_resource_set_default_interface(res, OC_IF_R); oc_resource_set_discoverable(res); - oc_resource_set_periodic_observable(res, 1); + oc_resource_set_periodic_observable(res, MYNEWT_VAL(SENSOR_OIC_OBS_RATE)); oc_resource_set_request_handler(res, OC_GET, sensor_oic_get_data); oc_add_resource(res); http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f2a8e66a/hw/sensor/syscfg.yml ---------------------------------------------------------------------- diff --git a/hw/sensor/syscfg.yml b/hw/sensor/syscfg.yml index 761d62b..581802f 100644 --- a/hw/sensor/syscfg.yml +++ b/hw/sensor/syscfg.yml @@ -36,3 +36,7 @@ syscfg.defs: MATHLIB_SUPPORT: description: 'Is MATHLIB support present' value: 0 + + SENSOR_OIC_OBS_RATE: + description: 'Set OIC server observation rate in seconds' + value: 1
