one hour slave program this waits for entry from master and initialize queue in the begninng and execute the data.
Diff: main.cpp
- Revision:
- 0:6be670be8b35
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Dec 04 06:09:47 2010 +0000 @@ -0,0 +1,62 @@ + +#include "problemb1.h" + +Ticker debug; + + +int main() { + + + // wait(2); + + pc.printf("ENTERING MAIN JOBS\n"); + sync.baud(460800); + //pc.baud(9600); + + + initialSetup(); + int p; + + sync.attach(&calculate_offset); + + // 1 PPS Code + //pps.tv_sec = 10; + //pps.tv_usec = 500000; + //runAtTime(&pinToggle,&pps); + + + + + toggle =1; +// myLED = 1; + + sync_with_master(); + synch.attach_us(&sync_with_master,4500000); + + union { + timeval t; + char BYTE[8]; + } ttt; + + + + while (1) { + + + if ( serial2.readable()) { + + ttt.BYTE[0]= serial2.getc(); + ttt.BYTE[1]=serial2.getc(); + ttt.BYTE[2]=serial2.getc(); + ttt.BYTE[3]=serial2.getc(); + ttt.BYTE[4]=serial2.getc(); + ttt.BYTE[5]=serial2.getc(); + ttt.BYTE[6]=serial2.getc(); + ttt.BYTE[7]=serial2.getc(); + + pc.printf("THE serial data recev %d %d \n",ttt.t.tv_sec, ttt.t.tv_usec); + runAtTime(&pinToggle,&ttt.t); + + } + } +} \ No newline at end of file