You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by vi...@apache.org on 2017/02/23 22:33:44 UTC
[50/50] incubator-mynewt-core git commit: SensorAPI - Add test app
SensorAPI - Add test app
- Add test app: currently is same as Slinky with some more extra code.
- revert slinky now that a seperate app is there
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/60cd598c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/60cd598c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/60cd598c
Branch: refs/heads/sensors_branch
Commit: 60cd598c8106fac4f318253a08bc0405b49a79a8
Parents: 8d1bde9
Author: Vipul Rahane <vi...@apache.org>
Authored: Thu Feb 23 14:29:58 2017 -0800
Committer: Vipul Rahane <vi...@apache.org>
Committed: Thu Feb 23 14:29:58 2017 -0800
----------------------------------------------------------------------
apps/sensors_test/pkg.yml | 51 +++++
apps/sensors_test/src/main.c | 437 ++++++++++++++++++++++++++++++++++++++
apps/sensors_test/syscfg.yml | 57 +++++
apps/slinky/pkg.yml | 5 -
apps/slinky/src/main.c | 143 -------------
5 files changed, 545 insertions(+), 148 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/60cd598c/apps/sensors_test/pkg.yml
----------------------------------------------------------------------
diff --git a/apps/sensors_test/pkg.yml b/apps/sensors_test/pkg.yml
new file mode 100644
index 0000000..406ad30
--- /dev/null
+++ b/apps/sensors_test/pkg.yml
@@ -0,0 +1,51 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+pkg.name: apps/sensors_test
+pkg.type: app
+pkg.description: "Example application which uses a variety of mynewt features."
+pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+
+pkg.deps:
+ - test/flash_test
+ - mgmt/imgmgr
+ - mgmt/newtmgr
+ - mgmt/newtmgr/transport/nmgr_shell
+ - kernel/os
+ - hw/sensor
+ - hw/drivers/sensors/sim
+ - hw/drivers/sensors/lsm303dlhc
+ - hw/drivers/sensors/tsl2561
+ - hw/drivers/sensors/bno055
+ - boot/bootutil
+ - sys/shell
+ - sys/config
+ - sys/console/full
+ - sys/id
+ - sys/log/full
+ - sys/stats/full
+ - boot/split
+
+pkg.deps.CONFIG_NFFS:
+ - fs/nffs
+
+pkg.deps.CONFIG_FCB:
+ - fs/fcb
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/60cd598c/apps/sensors_test/src/main.c
----------------------------------------------------------------------
diff --git a/apps/sensors_test/src/main.c b/apps/sensors_test/src/main.c
new file mode 100755
index 0000000..d17c61a
--- /dev/null
+++ b/apps/sensors_test/src/main.c
@@ -0,0 +1,437 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "syscfg/syscfg.h"
+#include "sysinit/sysinit.h"
+#include "sysflash/sysflash.h"
+#include <os/os.h>
+#include <bsp/bsp.h>
+#include <hal/hal_gpio.h>
+#include <hal/hal_flash.h>
+#include <console/console.h>
+#include <shell/shell.h>
+#include <log/log.h>
+#include <stats/stats.h>
+#include <config/config.h>
+#include <sensor/sensor.h>
+#include <lsm303dlhc/lsm303dlhc.h>
+#include <tsl2561/tsl2561.h>
+#include <bno055/bno055.h>
+#include "flash_map/flash_map.h"
+#include <hal/hal_system.h>
+#if MYNEWT_VAL(SPLIT_LOADER)
+#include "split/split.h"
+#endif
+#include <newtmgr/newtmgr.h>
+#include <bootutil/image.h>
+#include <bootutil/bootutil.h>
+#include <imgmgr/imgmgr.h>
+#include <assert.h>
+#include <string.h>
+#include <flash_test/flash_test.h>
+#include <reboot/log_reboot.h>
+#include <os/os_time.h>
+#include <id/id.h>
+
+#ifdef ARCH_sim
+#include <mcu/mcu_sim.h>
+#endif
+
+/* Task 1 */
+#define TASK1_PRIO (8)
+#define TASK1_STACK_SIZE OS_STACK_ALIGN(192)
+#define MAX_CBMEM_BUF 600
+static struct os_task task1;
+static volatile int g_task1_loops;
+
+/* Task 2 */
+#define TASK2_PRIO (9)
+#define TASK2_STACK_SIZE OS_STACK_ALIGN(64)
+static struct os_task task2;
+
+static struct log my_log;
+
+static volatile int g_task2_loops;
+
+/* Global test semaphore */
+static struct os_sem g_test_sem;
+
+/* For LED toggling */
+static int g_led_pin;
+
+STATS_SECT_START(gpio_stats)
+STATS_SECT_ENTRY(toggles)
+STATS_SECT_END
+
+static STATS_SECT_DECL(gpio_stats) g_stats_gpio_toggle;
+
+static STATS_NAME_START(gpio_stats)
+STATS_NAME(gpio_stats, toggles)
+STATS_NAME_END(gpio_stats)
+
+static char *test_conf_get(int argc, char **argv, char *val, int max_len);
+static int test_conf_set(int argc, char **argv, char *val);
+static int test_conf_commit(void);
+static int test_conf_export(void (*export_func)(char *name, char *val),
+ enum conf_export_tgt tgt);
+
+static struct conf_handler test_conf_handler = {
+ .ch_name = "test",
+ .ch_get = test_conf_get,
+ .ch_set = test_conf_set,
+ .ch_commit = test_conf_commit,
+ .ch_export = test_conf_export
+};
+
+static uint8_t test8;
+static uint8_t test8_shadow;
+static char test_str[32];
+static uint32_t cbmem_buf[MAX_CBMEM_BUF];
+static struct cbmem cbmem;
+
+static char *
+test_conf_get(int argc, char **argv, char *buf, int max_len)
+{
+ if (argc == 1) {
+ if (!strcmp(argv[0], "8")) {
+ return conf_str_from_value(CONF_INT8, &test8, buf, max_len);
+ } else if (!strcmp(argv[0], "str")) {
+ return test_str;
+ }
+ }
+ return NULL;
+}
+
+static int
+test_conf_set(int argc, char **argv, char *val)
+{
+ if (argc == 1) {
+ if (!strcmp(argv[0], "8")) {
+ return CONF_VALUE_SET(val, CONF_INT8, test8_shadow);
+ } else if (!strcmp(argv[0], "str")) {
+ return CONF_VALUE_SET(val, CONF_STRING, test_str);
+ }
+ }
+ return OS_ENOENT;
+}
+
+static int
+test_conf_commit(void)
+{
+ test8 = test8_shadow;
+
+ return 0;
+}
+
+static int
+test_conf_export(void (*func)(char *name, char *val), enum conf_export_tgt tgt)
+{
+ char buf[4];
+
+ conf_str_from_value(CONF_INT8, &test8, buf, sizeof(buf));
+ func("test/8", buf);
+ func("test/str", test_str);
+ return 0;
+}
+
+static void
+task1_handler(void *arg)
+{
+ struct os_task *t;
+ int prev_pin_state, curr_pin_state;
+ struct image_version ver;
+
+ /* Set the led pin for the E407 devboard */
+ g_led_pin = LED_BLINK_PIN;
+ hal_gpio_init_out(g_led_pin, 1);
+
+ if (imgr_my_version(&ver) == 0) {
+ console_printf("\nSensors Test %u.%u.%u.%u\n",
+ ver.iv_major, ver.iv_minor, ver.iv_revision,
+ (unsigned int)ver.iv_build_num);
+ } else {
+ console_printf("\nSensors Test\n");
+ }
+
+ while (1) {
+ t = os_sched_get_current_task();
+ assert(t->t_func == task1_handler);
+
+ ++g_task1_loops;
+
+ /* Wait one second */
+ os_time_delay(OS_TICKS_PER_SEC);
+
+ /* Toggle the LED */
+ prev_pin_state = hal_gpio_read(g_led_pin);
+ curr_pin_state = hal_gpio_toggle(g_led_pin);
+ LOG_INFO(&my_log, LOG_MODULE_DEFAULT, "GPIO toggle from %u to %u",
+ prev_pin_state, curr_pin_state);
+ STATS_INC(g_stats_gpio_toggle, toggles);
+
+ /* Release semaphore to task 2 */
+ os_sem_release(&g_test_sem);
+ }
+}
+
+static void
+task2_handler(void *arg)
+{
+ struct os_task *t;
+
+ while (1) {
+ /* just for debug; task 2 should be the running task */
+ t = os_sched_get_current_task();
+ assert(t->t_func == task2_handler);
+
+ /* Increment # of times we went through task loop */
+ ++g_task2_loops;
+
+ /* Wait for semaphore from ISR */
+ os_sem_pend(&g_test_sem, OS_TIMEOUT_NEVER);
+ }
+}
+
+/**
+ * init_tasks
+ *
+ * Called by main.c after sysinit(). This function performs initializations
+ * that are required before tasks are running.
+ *
+ * @return int 0 success; error otherwise.
+ */
+static void
+init_tasks(void)
+{
+ os_stack_t *pstack;
+
+ /* Initialize global test semaphore */
+ os_sem_init(&g_test_sem, 0);
+
+ pstack = malloc(sizeof(os_stack_t)*TASK1_STACK_SIZE);
+ assert(pstack);
+
+ os_task_init(&task1, "task1", task1_handler, NULL,
+ TASK1_PRIO, OS_WAIT_FOREVER, pstack, TASK1_STACK_SIZE);
+
+ pstack = malloc(sizeof(os_stack_t)*TASK2_STACK_SIZE);
+ assert(pstack);
+
+ os_task_init(&task2, "task2", task2_handler, NULL,
+ TASK2_PRIO, OS_WAIT_FOREVER, pstack, TASK2_STACK_SIZE);
+}
+
+#if !ARCH_sim
+static int
+config_sensor(void)
+{
+ struct os_dev *dev;
+ int rc;
+
+#if MYNEWT_VAL(TSL2561_PRESENT)
+ struct tsl2561_cfg tslcfg;
+
+ dev = (struct os_dev *) os_dev_open("light0", OS_TIMEOUT_NEVER, NULL);
+ assert(dev != NULL);
+ rc = tsl2561_init(dev, NULL);
+ if (rc) {
+ os_dev_close(dev);
+ goto err;
+ }
+
+ /* Gain set to 1X and Inetgration time set to 13ms */
+ tslcfg.gain = TSL2561_LIGHT_GAIN_1X;
+ tslcfg.integration_time = TSL2561_LIGHT_ITIME_13MS;
+
+ rc = tsl2561_config((struct tsl2561 *)dev, &tslcfg);
+ if (rc) {
+ os_dev_close(dev);
+ goto err;
+ }
+ os_dev_close(dev);
+#endif
+
+#if MYNEWT_VAL(LSM303DLHC_PRESENT)
+ struct lsm303dlhc_cfg lsmcfg;
+
+ dev = (struct os_dev *) os_dev_open("accel0", OS_TIMEOUT_NEVER, NULL);
+ assert(dev != NULL);
+
+ rc = lsm303dlhc_init(dev, NULL);
+ if (rc) {
+ os_dev_close(dev);
+ goto err;
+ }
+
+ /* read once per sec. API should take this value in ms. */
+ lsmcfg.accel_rate = LSM303DLHC_ACCEL_RATE_1;
+ lsmcfg.accel_range = LSM303DLHC_ACCEL_RANGE_2;
+
+ rc = lsm303dlhc_config((struct lsm303dlhc *) dev, &lsmcfg);
+ if (rc) {
+ os_dev_close(dev);
+ goto err;
+ }
+ os_dev_close(dev);
+#endif
+
+#if MYNEWT_VAL(BNO055_PRESENT)
+ struct bno055_cfg bcfg;
+
+ dev = (struct os_dev *) os_dev_open("accel1", OS_TIMEOUT_NEVER, NULL);
+ assert(dev != NULL);
+
+ rc = bno055_init(dev, NULL);
+ if (rc) {
+ os_dev_close(dev);
+ assert(0);
+ goto err;
+ }
+
+ bcfg.bc_units = BNO055_ACC_UNIT_MS2 | BNO055_ANGRATE_UNIT_DPS |
+ BNO055_EULER_UNIT_DEG | BNO055_TEMP_UNIT_DEGC |
+ BNO055_DO_FORMAT_ANDROID;
+
+ bcfg.bc_opr_mode = BNO055_OPR_MODE_ACCONLY;
+
+ bcfg.bc_pwr_mode = BNO055_PWR_MODE_NORMAL;
+
+ rc = bno055_config((struct bno055 *) dev, &bcfg);
+ if (rc) {
+ os_dev_close(dev);
+ goto err;
+ }
+ os_dev_close(dev);
+#endif
+
+ return (0);
+err:
+ return rc;
+}
+
+#endif
+
+#ifdef ARCH_sim
+static int
+config_sensor(void)
+{
+ struct os_dev *dev;
+ struct cfg;
+ int rc;
+
+ dev = (struct os_dev *) os_dev_open("simaccel0", OS_TIMEOUT_NEVER, NULL);
+ assert(dev != NULL);
+
+ rc = sim_accel_init(dev, NULL);
+ if (rc != 0) {
+ os_dev_close(dev);
+ goto err;
+ }
+
+ cfg.sac_nr_samples = 10;
+ cfg.sac_nr_axises = 1;
+ /* read once per sec. API should take this value in ms. */
+ cfg.sac_sample_itvl = OS_TICKS_PER_SEC;
+
+ rc = sim_accel_config((struct sim_accel *) dev, &cfg);
+ if (rc != 0) {
+ os_dev_close(dev);
+ goto err;
+ }
+
+ os_dev_close(dev);
+
+ return (0);
+err:
+ return (rc);
+}
+#endif
+
+/**
+ * main
+ *
+ * The main task for the project. This function initializes the packages, calls
+ * init_tasks to initialize additional tasks (and possibly other objects),
+ * then starts serving events from default event queue.
+ *
+ * @return int NOTE: this function should never return!
+ */
+int
+main(int argc, char **argv)
+{
+ int rc;
+
+#ifdef ARCH_sim
+ mcu_sim_parse_args(argc, argv);
+#endif
+
+ sysinit();
+
+ rc = conf_register(&test_conf_handler);
+ assert(rc == 0);
+
+ cbmem_init(&cbmem, cbmem_buf, MAX_CBMEM_BUF);
+ log_register("log", &my_log, &log_cbmem_handler, &cbmem, LOG_SYSLEVEL);
+
+ stats_init(STATS_HDR(g_stats_gpio_toggle),
+ STATS_SIZE_INIT_PARMS(g_stats_gpio_toggle, STATS_SIZE_32),
+ STATS_NAME_INIT_PARMS(gpio_stats));
+
+ stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle));
+
+ flash_test_init();
+
+ conf_load();
+
+ log_reboot(hal_reset_cause());
+
+ init_tasks();
+
+ /* If this app is acting as the loader in a split image setup, jump into
+ * the second stage application instead of starting the OS.
+ */
+#if MYNEWT_VAL(SPLIT_LOADER)
+ {
+ void *entry;
+ rc = split_app_go(&entry, true);
+ if(rc == 0) {
+ hal_system_restart(entry);
+ }
+ }
+#endif
+
+#if MYNEWT_VAL(TSL2561_CLI)
+ tsl2561_shell_init();
+#endif
+
+#if MYNEWT_VAL(BNO055_CLI)
+ bno055_shell_init();
+#endif
+
+ config_sensor();
+
+ /*
+ * As the last thing, process events from default event queue.
+ */
+ while (1) {
+ os_eventq_run(os_eventq_dflt_get());
+ }
+
+ return (0);
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/60cd598c/apps/sensors_test/syscfg.yml
----------------------------------------------------------------------
diff --git a/apps/sensors_test/syscfg.yml b/apps/sensors_test/syscfg.yml
new file mode 100644
index 0000000..5507f28
--- /dev/null
+++ b/apps/sensors_test/syscfg.yml
@@ -0,0 +1,57 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Package: apps/sensors_test
+
+syscfg.vals:
+ # Enable the shell task.
+ SHELL_TASK: 1
+
+ # Include names for statistics.
+ STATS_NAMES: 1
+
+ # Log reboot messages to a flash circular buffer.
+ REBOOT_LOG_FCB: 1
+ LOG_FCB: 1
+
+ CONFIG_FCB: 1
+
+ # Enable shell commands.
+ STATS_CLI: 1
+ LOG_CLI: 1
+ CONFIG_CLI: 1
+
+ # Enable newtmgr commands.
+ STATS_NEWTMGR: 1
+ LOG_NEWTMGR: 1
+ CONFIG_NEWTMGR: 1
+
+ TSL2561_CLI: 1
+ BNO055_CLI: 1
+
+syscfg.defs:
+ TSL2561_PRESENT:
+ description: 'TSL2561 is present'
+ value : 1
+ LSM303DLHC_PRESENT:
+ description: 'LSM303 is present'
+ value : 1
+ BNO055_PRESENT:
+ description: 'BNO055 is present'
+ value : 1
+
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/60cd598c/apps/slinky/pkg.yml
----------------------------------------------------------------------
diff --git a/apps/slinky/pkg.yml b/apps/slinky/pkg.yml
index db9cc10..3159cb9 100644
--- a/apps/slinky/pkg.yml
+++ b/apps/slinky/pkg.yml
@@ -30,11 +30,6 @@ pkg.deps:
- mgmt/newtmgr
- mgmt/newtmgr/transport/nmgr_shell
- kernel/os
- - hw/sensor
- - hw/drivers/sensors/sim
- - hw/drivers/sensors/lsm303dlhc
- - hw/drivers/sensors/tsl2561
- - hw/drivers/sensors/bno055
- boot/bootutil
- sys/shell
- sys/config
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/60cd598c/apps/slinky/src/main.c
----------------------------------------------------------------------
diff --git a/apps/slinky/src/main.c b/apps/slinky/src/main.c
index 0abdcc6..7ab13d6 100755
--- a/apps/slinky/src/main.c
+++ b/apps/slinky/src/main.c
@@ -29,10 +29,6 @@
#include <log/log.h>
#include <stats/stats.h>
#include <config/config.h>
-#include <sensor/sensor.h>
-#include <lsm303dlhc/lsm303dlhc.h>
-#include <tsl2561/tsl2561.h>
-#include <bno055/bno055.h>
#include "flash_map/flash_map.h"
#include <hal/hal_system.h>
#if MYNEWT_VAL(SPLIT_LOADER)
@@ -237,133 +233,6 @@ init_tasks(void)
TASK2_PRIO, OS_WAIT_FOREVER, pstack, TASK2_STACK_SIZE);
}
-#if !ARCH_sim
-static int
-config_sensor(void)
-{
- struct os_dev *dev;
- int rc;
-
-#if MYNEWT_VAL(TSL2561_PRESENT)
- struct tsl2561_cfg tslcfg;
-
- dev = (struct os_dev *) os_dev_open("light0", OS_TIMEOUT_NEVER, NULL);
- assert(dev != NULL);
- rc = tsl2561_init(dev, NULL);
- if (rc) {
- os_dev_close(dev);
- goto err;
- }
-
- /* Gain set to 1X and Inetgration time set to 13ms */
- tslcfg.gain = TSL2561_LIGHT_GAIN_1X;
- tslcfg.integration_time = TSL2561_LIGHT_ITIME_13MS;
-
- rc = tsl2561_config((struct tsl2561 *)dev, &tslcfg);
- if (rc) {
- os_dev_close(dev);
- goto err;
- }
- os_dev_close(dev);
-#endif
-
-#if MYNEWT_VAL(LSM303DLHC_PRESENT)
- struct lsm303dlhc_cfg lsmcfg;
-
- dev = (struct os_dev *) os_dev_open("accel0", OS_TIMEOUT_NEVER, NULL);
- assert(dev != NULL);
-
- rc = lsm303dlhc_init(dev, NULL);
- if (rc) {
- os_dev_close(dev);
- goto err;
- }
-
- /* read once per sec. API should take this value in ms. */
- lsmcfg.accel_rate = LSM303DLHC_ACCEL_RATE_1;
- lsmcfg.accel_range = LSM303DLHC_ACCEL_RANGE_2;
-
- rc = lsm303dlhc_config((struct lsm303dlhc *) dev, &lsmcfg);
- if (rc) {
- os_dev_close(dev);
- goto err;
- }
- os_dev_close(dev);
-#endif
-
-#if MYNEWT_VAL(BNO055_PRESENT)
- struct bno055_cfg bcfg;
-
- dev = (struct os_dev *) os_dev_open("accel1", OS_TIMEOUT_NEVER, NULL);
- assert(dev != NULL);
-
- rc = bno055_init(dev, NULL);
- if (rc) {
- os_dev_close(dev);
- assert(0);
- goto err;
- }
-
- bcfg.bc_units = BNO055_ACC_UNIT_MS2 | BNO055_ANGRATE_UNIT_DPS |
- BNO055_EULER_UNIT_DEG | BNO055_TEMP_UNIT_DEGC |
- BNO055_DO_FORMAT_ANDROID;
-
- bcfg.bc_opr_mode = BNO055_OPR_MODE_ACCONLY;
-
- bcfg.bc_pwr_mode = BNO055_PWR_MODE_NORMAL;
-
- rc = bno055_config((struct bno055 *) dev, &bcfg);
- if (rc) {
- os_dev_close(dev);
- //assert(0);
- goto err;
- }
- os_dev_close(dev);
-#endif
-
- return (0);
-err:
- return rc;
-}
-
-#endif
-
-#ifdef ARCH_sim
-static int
-config_sensor(void)
-{
- struct os_dev *dev;
- struct cfg;
- int rc;
-
- dev = (struct os_dev *) os_dev_open("simaccel0", OS_TIMEOUT_NEVER, NULL);
- assert(dev != NULL);
-
- rc = sim_accel_init(dev, NULL);
- if (rc != 0) {
- os_dev_close(dev);
- goto err;
- }
-
- cfg.sac_nr_samples = 10;
- cfg.sac_nr_axises = 1;
- /* read once per sec. API should take this value in ms. */
- cfg.sac_sample_itvl = OS_TICKS_PER_SEC;
-
- rc = sim_accel_config((struct sim_accel *) dev, &cfg);
- if (rc != 0) {
- os_dev_close(dev);
- goto err;
- }
-
- os_dev_close(dev);
-
- return (0);
-err:
- return (rc);
-}
-#endif
-
/**
* main
*
@@ -417,22 +286,10 @@ main(int argc, char **argv)
}
#endif
-#if MYNEWT_VAL(TSL2561_CLI)
- tsl2561_shell_init();
-#endif
-
-#if MYNEWT_VAL(BNO055_CLI)
- bno055_shell_init();
-#endif
-
- config_sensor();
-
/*
* As the last thing, process events from default event queue.
*/
while (1) {
os_eventq_run(os_eventq_dflt_get());
}
-
- return (0);
}