FreeRTOS Real Time Operating System, Modified from Kenji Arai's initial port. See freertos.org for full documentation.
Fork of FreeRTOS_on_mbed_v1 by
ParTest.c
00001 /* 00002 FreeRTOS V6.0.3 - Copyright (C) 2010 Real Time Engineers Ltd. 00003 00004 *************************************************************************** 00005 * * 00006 * If you are: * 00007 * * 00008 * + New to FreeRTOS, * 00009 * + Wanting to learn FreeRTOS or multitasking in general quickly * 00010 * + Looking for basic training, * 00011 * + Wanting to improve your FreeRTOS skills and productivity * 00012 * * 00013 * then take a look at the FreeRTOS eBook * 00014 * * 00015 * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * 00016 * http://www.FreeRTOS.org/Documentation * 00017 * * 00018 * A pdf reference manual is also available. Both are usually delivered * 00019 * to your inbox within 20 minutes to two hours when purchased between 8am * 00020 * and 8pm GMT (although please allow up to 24 hours in case of * 00021 * exceptional circumstances). Thank you for your support! * 00022 * * 00023 *************************************************************************** 00024 00025 This file is part of the FreeRTOS distribution. 00026 00027 FreeRTOS is free software; you can redistribute it and/or modify it under 00028 the terms of the GNU General Public License (version 2) as published by the 00029 Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 00030 ***NOTE*** The exception to the GPL is included to allow you to distribute 00031 a combined work that includes FreeRTOS without being obliged to provide the 00032 source code for proprietary components outside of the FreeRTOS kernel. 00033 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT 00034 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00035 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00036 more details. You should have received a copy of the GNU General Public 00037 License and the FreeRTOS license exception along with FreeRTOS; if not it 00038 can be viewed here: http://www.freertos.org/a00114.html and also obtained 00039 by writing to Richard Barry, contact details for whom are available on the 00040 FreeRTOS WEB site. 00041 00042 1 tab == 4 spaces! 00043 00044 http://www.FreeRTOS.org - Documentation, latest information, license and 00045 contact details. 00046 00047 http://www.SafeRTOS.com - A version that is certified for use in safety 00048 critical systems. 00049 00050 http://www.OpenRTOS.com - Commercial support, development, porting, 00051 licensing and training services. 00052 */ 00053 00054 /* 00055 * Modified for mbed NXP LPC1768 board 00056 * By Kenji Arai / JH1PJL on March 13th,2010 00057 * April 12th, 2010 Changed LPC17xx.h then convert all "GPIO" to "LPC_GPIO" 00058 * August 1st, 2010 Change Port definition 00059 * August 28th, 2010 00060 */ 00061 00062 00063 /* FreeRTOS.org includes. */ 00064 #include "FreeRTOS.h" 00065 00066 /* Demo application includes. */ 00067 #include "partest.h" 00068 00069 /*----------------------------------------------------------- 00070 * Simple parallel port IO routines. 00071 *-----------------------------------------------------------*/ 00072 #if (USE_XPRESSO == 1) 00073 void vParTestInitialise( void ) 00074 { 00075 /* LEDs on port 1. */ 00076 LPC_GPIO0->FIODIR = partstFIO1_BITS; 00077 /* Start will all LEDs off. */ 00078 LPC_GPIO0->FIOCLR = partstFIO1_BITS; 00079 00080 // Switch 00081 LPC_GPIO2->FIODIR &= ~0x00; // Input mode 00082 LPC_PINCON->PINMODE4 |= 0x3f3; // Pull-down P2.0,.2,.3,.4 00083 //xprintf("GPIO2 = %x\r\n", LPC_GPIO2->FIOPIN); 00084 //xprintf("GPIO2.DIR = %x\r\n", LPC_GPIO2->FIODIR); 00085 } 00086 /*-----------------------------------------------------------*/ 00087 00088 void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue ) 00089 { 00090 if( uxLED < partstNUM_LEDS ) 00091 { 00092 /* Set or clear the output. */ 00093 if( xValue ) 00094 { 00095 LPC_GPIO0->FIOCLR = ulLEDs[ uxLED ]; 00096 } 00097 else 00098 { 00099 LPC_GPIO0->FIOSET = ulLEDs[ uxLED ]; 00100 } 00101 } 00102 } 00103 /*-----------------------------------------------------------*/ 00104 00105 void vParTestToggleLED( unsigned portBASE_TYPE uxLED ) 00106 { 00107 if( uxLED < partstNUM_LEDS ) 00108 { 00109 if( LPC_GPIO0->FIOPIN & ulLEDs[ uxLED ] ) 00110 { 00111 LPC_GPIO0->FIOCLR = ulLEDs[ uxLED ]; 00112 } 00113 else 00114 { 00115 LPC_GPIO0->FIOSET = ulLEDs[ uxLED ]; 00116 } 00117 } 00118 } 00119 /*-----------------------------------------------------------*/ 00120 00121 unsigned portBASE_TYPE uxParTextGetLED( unsigned portBASE_TYPE uxLED ) 00122 { 00123 if( uxLED < partstNUM_LEDS ) 00124 { 00125 return ( LPC_GPIO0->FIOPIN & ulLEDs[ uxLED ] ); 00126 } 00127 else 00128 { 00129 return 0; 00130 } 00131 } 00132 /*-----------------------------------------------------------*/ 00133 #else 00134 void vParTestInitialise( void ) 00135 { 00136 /* LEDs on port 1. */ 00137 LPC_GPIO1->FIODIR = partstFIO1_BITS; 00138 /* Start will all LEDs off. */ 00139 LPC_GPIO1->FIOCLR = partstFIO1_BITS; 00140 00141 // Switch 00142 LPC_GPIO2->FIODIR &= ~0x00; // Input mode 00143 LPC_PINCON->PINMODE4 |= 0x3f3; // Pull-down P2.0,.2,.3,.4 00144 //xprintf("GPIO2 = %x\r\n", LPC_GPIO2->FIOPIN); 00145 //xprintf("GPIO2.DIR = %x\r\n", LPC_GPIO2->FIODIR); 00146 } 00147 /*-----------------------------------------------------------*/ 00148 00149 void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue ) 00150 { 00151 if( uxLED < partstNUM_LEDS ) 00152 { 00153 /* Set or clear the output. */ 00154 if( xValue ) 00155 { 00156 LPC_GPIO1->FIOCLR = ulLEDs[ uxLED ]; 00157 } 00158 else 00159 { 00160 LPC_GPIO1->FIOSET = ulLEDs[ uxLED ]; 00161 } 00162 } 00163 } 00164 /*-----------------------------------------------------------*/ 00165 00166 void vParTestToggleLED( unsigned portBASE_TYPE uxLED ) 00167 { 00168 if( uxLED < partstNUM_LEDS ) 00169 { 00170 if( LPC_GPIO1->FIOPIN & ulLEDs[ uxLED ] ) 00171 { 00172 LPC_GPIO1->FIOCLR = ulLEDs[ uxLED ]; 00173 } 00174 else 00175 { 00176 LPC_GPIO1->FIOSET = ulLEDs[ uxLED ]; 00177 } 00178 } 00179 } 00180 /*-----------------------------------------------------------*/ 00181 00182 unsigned portBASE_TYPE uxParTextGetLED( unsigned portBASE_TYPE uxLED ) 00183 { 00184 if( uxLED < partstNUM_LEDS ) 00185 { 00186 return ( LPC_GPIO1->FIOPIN & ulLEDs[ uxLED ] ); 00187 } 00188 else 00189 { 00190 return 0; 00191 } 00192 } 00193 /*-----------------------------------------------------------*/ 00194 #endif 00195 00196 unsigned int vParTestSW_Rec( void ){ //Record switch = P2.3 (mbed p23) 00197 //xputs("mbed P23 (LPC1768 p2.3) = "); 00198 //if (LPC_GPIO2->FIOPIN & 0x08){ 00199 // xputs("ON \r\n"); 00200 //} else { 00201 // xputs("OFF \r\n"); 00202 //} 00203 if (LPC_GPIO2->FIOPIN & 0x08){ 00204 //xputs("ON \r\n"); 00205 return 0; 00206 } else { 00207 //xputs("OFF \r\n"); 00208 return 1; 00209 } 00210 } 00211 00212 unsigned int vParTestSW_Mode( void ){ //Record switch = P2.4 (mbed p22) 00213 //xputs("mbed P22 (LPC1768 p2.4) = "); 00214 //if (LPC_GPIO2->FIOPIN & 0x10){ 00215 // xputs("ON \r\n"); 00216 //} else { 00217 // xputs("OFF \r\n"); 00218 //} 00219 if (LPC_GPIO2->FIOPIN & 0x10){ 00220 //xputs("ON \r\n"); 00221 return 0; 00222 } else { 00223 //xputs("OFF \r\n"); 00224 return 1; 00225 } 00226 } 00227 /*-----------------------------------------------------------*/ 00228 00229 00230 00231 00232 00233 00234
Generated on Fri Jul 15 2022 10:21:25 by
1.7.2
