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 00025 00037 /* This this the only include needed in your code .*/ 00038 #include "femtoos_code.h" 00039 00040 /* use one (volatile!) byte to communicate from one task 00041 * to the other. Exercise: what happens when the keyword 00042 * volatile is left out?*/ 00043 volatile Tuint08 state; 00044 00045 /* Infinite task displaying the state */ 00046 void appLoop_LEDtask(void) 00047 { devLedDRR = 0xFF; 00048 while (true) 00049 { devLedPORT = state; } } 00050 00051 /* Infinite task reading the state */ 00052 void appLoop_SWITCHtask(void) 00053 { /* This register is already zero per default, so we can save two bytes: devSwitchDRR = 0x00; */ 00054 while (true) 00055 { state = devSwitchPIN; } } 00056 00057