12 #include <propeller.h> 13 #include <sys/thread.h> 18 static int cog1_stack[STACK_SIZE];
21 static _thread_state_t thread_data;
24 volatile unsigned int wait_time;
25 volatile unsigned int pins;
32 do_toggle(
void *arg __attribute__((unused)) )
40 nextcnt = _CNT + wait_time;
47 nextcnt = __builtin_propeller_waitcnt(nextcnt, wait_time);
57 #define MIN_GAP 400000 63 unsigned int startTime;
65 unsigned int executionTime;
68 printf(
"hello, world!\n");
75 n = _start_cog_thread(cog1_stack + STACK_SIZE, do_toggle, NULL, &thread_data);
76 printf(
"toggle cog %d has started\n", n);
82 wait_time = wait_time >> 1;
83 if (wait_time < MIN_GAP)