You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2016/10/21 19:19:22 UTC

[2/2] incubator-mynewt-core git commit: No jira ticket. Some minor mods to timtest app so that task2 allows the idle task to hit the watchdog.

No jira ticket. Some minor mods to timtest app so that task2
allows the idle task to hit the watchdog.


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/a852d95f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/a852d95f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/a852d95f

Branch: refs/heads/develop
Commit: a852d95fa2f9f461d84c3f3f61d4f1a0ed99490b
Parents: 0d75df2
Author: William San Filippo <wi...@runtime.io>
Authored: Fri Oct 21 11:51:10 2016 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Fri Oct 21 12:19:15 2016 -0700

----------------------------------------------------------------------
 apps/timtest/src/main.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a852d95f/apps/timtest/src/main.c
----------------------------------------------------------------------
diff --git a/apps/timtest/src/main.c b/apps/timtest/src/main.c
index aa0cb8a..9c11e72 100755
--- a/apps/timtest/src/main.c
+++ b/apps/timtest/src/main.c
@@ -26,8 +26,6 @@
 #include <os/os_dev.h>
 #include <assert.h>
 #include <string.h>
-#include "app_util_platform.h"
-#include "app_error.h"
 
 /* Init all tasks */
 volatile int tasks_initialized;
@@ -49,7 +47,7 @@ struct os_task task2;
 os_stack_t stack2[TASK2_STACK_SIZE];
 
 #define TASK2_TIMER_NUM     (2)
-#define TASK2_TIMER_FREQ    (62500)
+#define TASK2_TIMER_FREQ    (31250)
 
 /* For LED toggling */
 int g_led1_pin;
@@ -116,6 +114,7 @@ task1_handler(void *arg)
 void
 task2_handler(void *arg)
 {
+    int cntr;
     int32_t delta;
     uint32_t tval1;
     uint32_t tval2;
@@ -123,6 +122,7 @@ task2_handler(void *arg)
     g_led2_pin = LED_2;
     hal_gpio_init_out(g_led2_pin, 1);
 
+    cntr = 8;
     while (1) {
         /* Read timer, block for 500 msecs, make sure timer counter counts! */
         tval1 = hal_timer_read(TASK2_TIMER_NUM);
@@ -133,6 +133,13 @@ task2_handler(void *arg)
 
         /* Toggle LED2 */
         hal_gpio_toggle(g_led2_pin);
+
+        /* We want to wait to hit watchdog so delay every now and then */
+        --cntr;
+        if (cntr == 0) {
+            os_time_delay(OS_TICKS_PER_SEC);
+            cntr = 8;
+        }
     }
 }