This commit is contained in:
Richard Barry 2008-02-13 13:53:24 +00:00
parent f315c91f38
commit 226d78fcab

View File

@ -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();
}
}
/*-----------------------------------------------------------*/