21 const uint16_t COGS = 8;
22 const uint16_t STACK_SIZE = 16;
23 static uint32_t cog_stack[STACK_SIZE][COGS];
24 static _thread_state_t thread_data;
26 volatile uint32_t wait_time;
27 volatile uint32_t startCnt;
28 volatile int8_t syncStart;
39 int main(
int argc,
char *argv[]) {
55 wait_time = 50 * MILLISECOND;
59 for (n = 1; n < COGS; n++) {
60 cog = (int8_t) _start_cog_thread(cog_stack[n] + STACK_SIZE,
run_cog, (
void *) &pins[n], &thread_data);
69 nextCnt = wait_time + startCnt;
72 nextCnt = waitcnt2(nextCnt, wait_time);
74 nextCnt = waitcnt2(nextCnt, wait_time);
86 while (syncStart == 0);
88 nextCnt = wait_time + startCnt;
91 nextCnt = waitcnt2(nextCnt, wait_time);
void set_mask(const PropWare::Port::Mask mask)
Utility class to handle general purpose I/O pins.
void set_dir(const PropWare::Port::Dir direction) const
Set port as either input or output.
void run_cog(void *arg)
Toggle thread function gets started in an LMM COG.
void clear() const
Clear selected output port (set it to 0)
const PropWare::Printer pwOut
Most common use of printing in PropWare applications (not thread safe; see PropWare::pwSyncOut for mu...
void printf(const char fmt[], const T first, const Targs...remaining) const
Similar in functionality to the C-standard function printf.
void toggle() const
Toggle the output value of a port.
void set() const
Set selected output port high (set all pins to 1)