--- /dev/null
+/*\r
+ FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd.\r
+ \r
+\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS tutorial books are available in pdf and paperback. *\r
+ * Complete, revised, and edited pdf reference manuals are also *\r
+ * available. *\r
+ * *\r
+ * Purchasing FreeRTOS documentation will not only help you, by *\r
+ * ensuring you get running as quickly as possible and with an *\r
+ * in-depth knowledge of how to use FreeRTOS, it will also help *\r
+ * the FreeRTOS project to continue with its mission of providing *\r
+ * professional grade, cross platform, de facto standard solutions *\r
+ * for microcontrollers - completely free of charge! *\r
+ * *\r
+ * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *\r
+ * *\r
+ * Thank you for using FreeRTOS, and thank you for your support! *\r
+ * *\r
+ ***************************************************************************\r
+\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+ >>>NOTE<<< The modification to the GPL is included to allow you to\r
+ distribute a combined work that includes FreeRTOS without being obliged to\r
+ provide the source code for proprietary components outside of the FreeRTOS\r
+ kernel. FreeRTOS is distributed in the hope that it will be useful, but\r
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
+ more details. You should have received a copy of the GNU General Public\r
+ License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+ can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+ by writing to Richard Barry, contact details for whom are available on the\r
+ FreeRTOS WEB site.\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and\r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety\r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting,\r
+ licensing and training services.\r
+*/\r
+\r
+/**\r
+ * Repeatedly toggles one or more LEDs using software timers - one timer per\r
+ * LED.\r
+ */\r
+ \r
+/* Scheduler include files. */\r
+#include "FreeRTOS.h"\r
+#include "timers.h"\r
+\r
+/* Demo program include files. */\r
+#include "partest.h"\r
+#include "flash_timer.h"\r
+\r
+/* The toggle rates are all a multple of ledFLASH_RATE_BASE. */\r
+#define ledFLASH_RATE_BASE ( ( ( portTickType ) 333 ) / portTICK_RATE_MS )\r
+\r
+/* A block time of zero simple means "don't block". */\r
+#define ledDONT_BLOCK ( ( portTickType ) 0 )\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * The callback function used by each LED flashing timer. All the timers use\r
+ * this function, and the timer ID is used within the function to determine\r
+ * which timer has actually expired.\r
+ */\r
+static void prvLEDTimerCallback( xTimerHandle xTimer );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void vStartLEDFlashTimers( unsigned portBASE_TYPE xNumberOfLEDs )\r
+{\r
+portBASE_TYPE xLEDTimer;\r
+xTimerHandle xTimer;\r
+\r
+ /* Create and start the requested number of timers. */\r
+ for( xLEDTimer = 0; xLEDTimer < xNumberOfLEDs; ++xLEDTimer )\r
+ {\r
+ /* Create the timer. */\r
+ xTimer = xTimerCreate( "Flasher", /* A text name, purely to help debugging. */\r
+ ledFLASH_RATE_BASE * ( xLEDTimer + 1 ), /* The timer period, which is a multiple of ledFLASH_RATE_BASE. */\r
+ pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */\r
+ ( void * ) xLEDTimer, /* The ID is used to identify the timer within the timer callback function, as each timer uses the same callback. */\r
+ prvLEDTimerCallback /* Each timer uses the same callback. */\r
+ );\r
+ \r
+ /* If the timer was created successfully, attempt to start it. If the\r
+ scheduler has not yet been started then the timer command queue must\r
+ be long enough to hold each command sent to it until such time that the\r
+ scheduler is started. The timer command queue length is set by\r
+ configTIMER_QUEUE_LENGTH in FreeRTOSConfig.h. */\r
+ if( xTimer != NULL )\r
+ {\r
+ xTimerStart( xTimer, ledDONT_BLOCK );\r
+ } \r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvLEDTimerCallback( xTimerHandle xTimer )\r
+{\r
+portBASE_TYPE xTimerID;\r
+\r
+ /* The timer ID is used to identify the timer that has actually expired as\r
+ each timer uses the same callback. The ID is then also used as the number\r
+ of the LED that is to be toggled. */\r
+ xTimerID = ( portBASE_TYPE ) pvTimerGetTimerID( xTimer );\r
+ vParTestToggleLED( xTimerID );\r
+}\r
+\r
+\r
--- /dev/null
+/*\r
+ FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd.\r
+ \r
+\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS tutorial books are available in pdf and paperback. *\r
+ * Complete, revised, and edited pdf reference manuals are also *\r
+ * available. *\r
+ * *\r
+ * Purchasing FreeRTOS documentation will not only help you, by *\r
+ * ensuring you get running as quickly as possible and with an *\r
+ * in-depth knowledge of how to use FreeRTOS, it will also help *\r
+ * the FreeRTOS project to continue with its mission of providing *\r
+ * professional grade, cross platform, de facto standard solutions *\r
+ * for microcontrollers - completely free of charge! *\r
+ * *\r
+ * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *\r
+ * *\r
+ * Thank you for using FreeRTOS, and thank you for your support! *\r
+ * *\r
+ ***************************************************************************\r
+\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+ >>>NOTE<<< The modification to the GPL is included to allow you to\r
+ distribute a combined work that includes FreeRTOS without being obliged to\r
+ provide the source code for proprietary components outside of the FreeRTOS\r
+ kernel. FreeRTOS is distributed in the hope that it will be useful, but\r
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
+ more details. You should have received a copy of the GNU General Public\r
+ License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+ can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+ by writing to Richard Barry, contact details for whom are available on the\r
+ FreeRTOS WEB site.\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and\r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety\r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting,\r
+ licensing and training services.\r
+*/\r
+\r
+#ifndef FLASH_TIMER_H\r
+#define FLASH_TIMER_H\r
+\r
+/*\r
+ * Creates the LED flashing timers. xNumberOfLEDs specifies how many timers to\r
+ * create, with each timer toggling a different LED. The first LED to be \r
+ * toggled is LED 0, with subsequent LEDs following on in numerical order. Each\r
+ * timer uses the exact same callback function, with the timer ID being used\r
+ * within the callback function to determine which timer has actually expired\r
+ * (and therefore which LED to toggle).\r
+ */\r
+void vStartLEDFlashTimers( unsigned portBASE_TYPE xNumberOfLEDs );\r
+\r
+#endif FLASH_TIMER_H\r