pull/4/head
Richard Barry 17 years ago
parent f315c91f38
commit 226d78fcab

@ -40,8 +40,6 @@
*************************************************************************** ***************************************************************************
*/ */
/* Hardware specific includes. */
#include "mb91467d.h"
/* Scheduler includes. */ /* Scheduler includes. */
#include "FreeRTOS.h" #include "FreeRTOS.h"
@ -49,16 +47,15 @@
#define partstNUM_LEDs 8 #define partstNUM_LEDs 8
static unsigned portSHORT sState[ partstNUM_LEDs ] = { pdFALSE }; static unsigned portCHAR sState[ 2 ] = { 0xFF, 0xFF };
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void vParTestInitialise( void ) void vParTestInitialise( void )
{ {
/* Set port for LED outputs. */ DDR00 = 0xFF;
DDR16 = 0xFF; PDR00 = 0xFF;
DDR09 = 0xFF;
/* Start with LEDs off. */ PDR09 = 0xFF;
PDR25 = 0x00;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -66,21 +63,40 @@ void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
{ {
if( uxLED < partstNUM_LEDs ) if( uxLED < partstNUM_LEDs )
{ {
taskENTER_CRITICAL(); vTaskSuspendAll();
/* Toggle the state of the single genuine on board LED. */ /* 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 else
{ {
PDR25 &= ~( 1 << uxLED ); PDR09 &= ~( 1 << uxLED );
sState[ 0 ] &= ~( 1 << uxLED );
} }
sState[ uxLED ] = !( sState[ uxLED ] ); xTaskResumeAll();
}
else
{
vTaskSuspendAll();
taskEXIT_CRITICAL(); 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. */ /* Set or clear the output [in this case show or hide the '*' character. */
if( uxLED < partstNUM_LEDs ) if( uxLED < partstNUM_LEDs )
{ {
taskENTER_CRITICAL(); vTaskSuspendAll();
{ {
if( xValue ) if( xValue )
{ {
PDR25 |= ( 1 << uxLED ); PDR09 &= ~( 1 << uxLED );
sState[ uxLED ] = 1; sState[ 0 ] &= ~( 1 << uxLED );
} }
else else
{ {
PDR25 &= ~( 1 << uxLED ); PDR09 |= ( 1 << uxLED );
sState[ uxLED ] = 0; 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();
} }
} }
/*-----------------------------------------------------------*/

Loading…
Cancel
Save