demos_source/code_TestHelloWorld.c

Go to the documentation of this file.
00001 /*
00002  * Femto OS v 0.91 - Copyright (C) 2008-2009 Ruud Vlaming
00003  *
00004  * This file is part of the Femto OS distribution.
00005  *
00006  * This program is free software: you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation, version 3 of the License.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  *
00018  * Please note that, due to the GPLv3 license, for application of this
00019  * work and/or combined work in embedded systems special obligations apply.
00020  * If these are not to you liking, please know the Femto OS is dual
00021  * licensed. A commercial license and support are available.
00022  * See http://www.femtoos.org/ for details.
00023  */
00024 
00036 /* This this the only include needed in your code .*/
00037 #include "femtoos_code.h"
00038 
00039 
00040 static Tuint08 speed = 0;
00041 
00042 const Tchar HelloWorldStr[] PROGMEM = "Hello World.";
00043 
00044 void appBoot(void)
00045 { devLedDRR    = 0xFF;
00046   devLedPORT   = 0xFF;
00047   devSwitchDRR = 0x00; }
00048 
00049 
00050 #if (preTaskDefined(Display))
00051 
00052 void appLoop_Display(void)
00053 { speed = 64;
00054   while (true)
00055   { Tuint08 uiCharCount;
00056     Tchar cChar;
00057     for (uiCharCount = 0; uiCharCount<12; uiCharCount++)
00058     { cChar = portFlashReadByte(Tchar, HelloWorldStr[uiCharCount]);
00059       devLedPORT = ~cChar;
00060       taskDelayFromNow( ((Tuint16)speed)*4 + 64 );
00061       devLedPORT = 0xFF;
00062       taskDelayFromNow(64); }
00063     taskDelayFromNow(2000); } }
00064 
00065 #endif
00066 
00067 
00068 
00069 #if (preTaskDefined(Speed))
00070 
00071 void appLoop_Speed(void)
00072 { Tuint08 button  = devSwitchPIN & 01;
00073   Tuint08 lastbutton  = button;
00074   while (true)
00075   { button = devSwitchPIN & 01;
00076     if (button != lastbutton) { speed += 64; }
00077     taskDelayFromNow(100); } }
00078 
00079 #endif
00080 

Generated on Fri Oct 16 00:05:21 2009 for FemtoOS by  doxygen 1.5.2