From 226d78fcab4c89e9a123c502bd9c406034585efc Mon Sep 17 00:00:00 2001 From: Richard Barry Date: Wed, 13 Feb 2008 13:53:24 +0000 Subject: [PATCH] --- Demo/MB91460_Softune/SRC/partest/partest.c | 82 +++++++++++++++------- 1 file changed, 58 insertions(+), 24 deletions(-) diff --git a/Demo/MB91460_Softune/SRC/partest/partest.c b/Demo/MB91460_Softune/SRC/partest/partest.c index 6ea629b9f..852e3ff57 100644 --- a/Demo/MB91460_Softune/SRC/partest/partest.c +++ b/Demo/MB91460_Softune/SRC/partest/partest.c @@ -40,8 +40,6 @@ *************************************************************************** */ -/* Hardware specific includes. */ -#include "mb91467d.h" /* Scheduler includes. */ #include "FreeRTOS.h" @@ -49,16 +47,15 @@ #define partstNUM_LEDs 8 -static unsigned portSHORT sState[ partstNUM_LEDs ] = { pdFALSE }; +static unsigned portCHAR sState[ 2 ] = { 0xFF, 0xFF }; /*-----------------------------------------------------------*/ void vParTestInitialise( void ) { - /* Set port for LED outputs. */ - DDR16 = 0xFF; - - /* Start with LEDs off. */ - PDR25 = 0x00; + DDR00 = 0xFF; + PDR00 = 0xFF; + DDR09 = 0xFF; + PDR09 = 0xFF; } /*-----------------------------------------------------------*/ @@ -66,21 +63,40 @@ void vParTestToggleLED( unsigned portBASE_TYPE uxLED ) { if( uxLED < partstNUM_LEDs ) { - taskENTER_CRITICAL(); - + vTaskSuspendAll(); + /* Toggle the state of the single genuine on board LED. */ - if( sState[ uxLED ]) + if( ( sState[ 0 ] & ( ( unsigned portCHAR ) ( 1 << uxLED ) ) ) == 0 ) { - PDR25 |= ( 1 << uxLED ); + PDR09 |= ( 1 << uxLED ); + sState[ 0 ] |= ( 1 << uxLED ); } else { - PDR25 &= ~( 1 << uxLED ); + PDR09 &= ~( 1 << uxLED ); + sState[ 0 ] &= ~( 1 << uxLED ); } - - sState[ uxLED ] = !( sState[ uxLED ] ); - - taskEXIT_CRITICAL(); + + xTaskResumeAll(); + } + else + { + vTaskSuspendAll(); + + uxLED -= partstNUM_LEDs; + + if( ( sState[ 1 ] & ( ( unsigned portCHAR ) ( 1 << uxLED ) ) ) == 0 ) + { + PDR00 |= ( 1 << uxLED ); + sState[ 1 ] |= ( 1 << uxLED ); + } + else + { + PDR00 &= ~( 1 << uxLED ); + sState[ 1 ] &= ~( 1 << uxLED ); + } + + xTaskResumeAll(); } } /*-----------------------------------------------------------*/ @@ -90,21 +106,39 @@ void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue ) /* Set or clear the output [in this case show or hide the '*' character. */ if( uxLED < partstNUM_LEDs ) { - taskENTER_CRITICAL(); + vTaskSuspendAll(); { if( xValue ) { - PDR25 |= ( 1 << uxLED ); - sState[ uxLED ] = 1; + PDR09 &= ~( 1 << uxLED ); + sState[ 0 ] &= ~( 1 << uxLED ); } else { - PDR25 &= ~( 1 << uxLED ); - sState[ uxLED ] = 0; + PDR09 |= ( 1 << uxLED ); + sState[ 0 ] |= ( 1 << uxLED ); } } - taskEXIT_CRITICAL(); + + xTaskResumeAll(); + } + else + { + vTaskSuspendAll(); + { + if( xValue ) + { + PDR00 &= ~( 1 << uxLED ); + sState[ 1 ] &= ~( 1 << uxLED ); + } + else + { + PDR00 |= ( 1 << uxLED ); + sState[ 1 ] |= ( 1 << uxLED ); + } + } + + xTaskResumeAll(); } } -/*-----------------------------------------------------------*/