00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00038
00039 #include "femtoos_code.h"
00040
00041 #define delay07 349U
00042 #define delay06 342U
00043 #define delay05 335U
00044 #define delay04 328U
00045 #define delay03 321U
00046 #define delay02 314U
00047 #define delay01 307U
00048 #define delay00 300U
00049
00050 static Tbool bSync = false;
00051
00052
00053
00054 void appBoot(void)
00055 { devLedDRR = 0xFF;
00056 devLedPORT = 0xFF;
00057 devSwitchDRR = 0x00; }
00058
00059
00060
00061 #define setLed(lednr,state) if (state) { devLedPORT |= (1 << lednr); } else { devLedPORT &= ~(1 << lednr); }
00062
00063
00064
00065
00066
00067
00068 #if (preTaskDefined(LEDtask0))
00069
00070 void appLoop_LEDtask0(void)
00071 { Tuint08 led = false;
00072 while (true)
00073 { led = !led;
00074 setLed(0,led);
00075 taskDelayFromNow(delay00);
00076 led = !led;
00077 setLed(0,led);
00078 taskDelayFromNow(delay00);
00079 if (bSync)
00080 { taskWaitForTasksOnName(TrefPunt,defNumberOfTasks-1);
00081 bSync = false; } } }
00082
00083
00084 #endif
00085
00086 #if (preTaskDefined(LEDtask1))
00087
00088 void appLoop_LEDtask1(void)
00089 { Tuint08 led = false;
00090 while (true)
00091 { led = !led;
00092 setLed(1,led);
00093 taskDelayFromNow(delay01);
00094 led = !led;
00095 setLed(1,led);
00096 taskDelayFromNow(delay01);
00097 if (bSync)
00098 { taskWaitForTasksOnName(TrefPunt,defNumberOfTasks-1);
00099 bSync = false; } } }
00100
00101 #endif
00102
00103 #if (preTaskDefined(LEDtask2))
00104
00105 void appLoop_LEDtask2(void)
00106 { Tuint08 led = false;
00107 while (true)
00108 { led = !led;
00109 setLed(2,led);
00110 taskDelayFromNow(delay02);
00111 led = !led;
00112 setLed(2,led);
00113 taskDelayFromNow(delay02);
00114 if (bSync)
00115 { taskWaitForTasksOnName(TrefPunt,defNumberOfTasks-1);
00116 bSync = false; } } }
00117
00118 #endif
00119
00120 #if (preTaskDefined(LEDtask3))
00121
00122 void appLoop_LEDtask3(void)
00123 { Tuint08 led = false;
00124 while (true)
00125 { led = !led;
00126 setLed(3,led);
00127 taskDelayFromNow(delay03);
00128 led = !led;
00129 setLed(3,led);
00130 taskDelayFromNow(delay03);
00131 if (bSync)
00132 { taskWaitForTasksOnName(TrefPunt,defNumberOfTasks-1);
00133 bSync = false; } } }
00134
00135 #endif
00136
00137 #if (preTaskDefined(LEDtask4))
00138
00139 void appLoop_LEDtask4(void)
00140 { Tuint08 led = false;
00141 while (true)
00142 { led = !led;
00143 setLed(4,led);
00144 taskDelayFromNow(delay04);
00145 led = !led;
00146 setLed(4,led);
00147 taskDelayFromNow(delay04);
00148 if (bSync)
00149 { taskWaitForTasksOnName(TrefPunt,defNumberOfTasks-1);
00150 bSync = false; } } }
00151
00152 #endif
00153
00154 #if (preTaskDefined(LEDtask5))
00155
00156 void appLoop_LEDtask5(void)
00157 { Tuint08 led = false;
00158 while (true)
00159 { led = !led;
00160 setLed(5,led);
00161 taskDelayFromNow(delay05);
00162 led = !led;
00163 setLed(5,led);
00164 taskDelayFromNow(delay05);
00165 if (bSync)
00166 { taskWaitForTasksOnName(TrefPunt,defNumberOfTasks-1);
00167 bSync = false; } } }
00168
00169 #endif
00170
00171 #if (preTaskDefined(LEDtask6))
00172
00173 void appLoop_LEDtask6(void)
00174 { Tuint08 led = false;
00175 while (true)
00176 { led = !led;
00177 setLed(6,led);
00178 taskDelayFromNow(delay06);
00179 led = !led;
00180 setLed(6,led);
00181 taskDelayFromNow(delay06);
00182 if (bSync)
00183 { taskWaitForTasksOnName(TrefPunt,defNumberOfTasks-1);
00184 bSync = false; } } }
00185
00186 #endif
00187
00188 #if (preTaskDefined(LEDtask7))
00189
00190 void appLoop_LEDtask7(void)
00191 { Tuint08 led = false;
00192 while (true)
00193 { led = !led;
00194 setLed(7,led);
00195 taskDelayFromNow(delay07);
00196 led = !led;
00197 setLed(7,led);
00198 taskDelayFromNow(delay07);
00199 if (bSync)
00200 { taskWaitForTasksOnName(TrefPunt,defNumberOfTasks-1);
00201 bSync = false; } } }
00202
00203 #endif
00204
00205
00206
00207
00208
00209 #if (preTaskDefined(Synchronize))
00210
00211 void appLoop_Synchronize(void)
00212 { Tuint08 button = devSwitchPIN & 01;
00213 Tuint08 lastbutton = button;
00214 while (true)
00215 { button = devSwitchPIN & 01;
00216 if (button != lastbutton) { bSync = true; }
00217 taskDelayFromNow(100); } }
00218
00219 #endif
00220