Moved remotely
git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@110 9fe90eed-be63-e94b-8204-d34ff4c2ff93
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
/* ---------------------------------------------------------------------------
|
||||
* test_leds.c (c) 2008 Micro-key bv
|
||||
* ---------------------------------------------------------------------------
|
||||
* Micro-key bv
|
||||
* Industrieweg 28, 9804 TG Noordhorn
|
||||
* Postbus 92, 9800 AB Zuidhorn
|
||||
* The Netherlands
|
||||
* Tel: +31 594 503020
|
||||
* Fax: +31 594 505825
|
||||
* Email: support@microkey.nl
|
||||
* Web: www.microkey.nl
|
||||
* ---------------------------------------------------------------------------
|
||||
* Description: remote LED test sequence
|
||||
* ---------------------------------------------------------------------------
|
||||
* Version(s): 0.1, Dez 16, 2008, MMi
|
||||
* Creation.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* System include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "LPC23xx.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Application include files
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "protocolfunctions.h"
|
||||
#include "BusProtocol.h"
|
||||
#include "SerOut.h"
|
||||
|
||||
#include "remote_analogue.h"
|
||||
#include "remote_digital.h"
|
||||
#include "remote_relay.h"
|
||||
#include "dio.h"
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local constant and macro definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Global variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local variable definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Local function definitions
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
BOOLEAN remoteLEDTestMBexecute (void)
|
||||
{
|
||||
UINT32 loopcnt;
|
||||
UINT8 buffer;
|
||||
BOOLEAN ledTest = TRUE;
|
||||
BOOLEAN receive = FALSE;
|
||||
|
||||
|
||||
/* Drive LEDs to status ON */
|
||||
sendString (SerOutPort, GotoNewLine, testMessage,
|
||||
"Set local digital outputs to HIGH... ", Dummy, Dummy);
|
||||
/* Set digital input LEDs to ON */
|
||||
for (loopcnt = 0; loopcnt < maxDO_Channels; loopcnt++)
|
||||
{
|
||||
dioWrite(thisDeviceNumber, loopcnt, TRUE);
|
||||
}
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"Done", Dummy, Dummy);
|
||||
|
||||
/* Set remote digital output LEDs to on */
|
||||
sendString (SerOutPort, GotoNewLine, testMessage,
|
||||
"Set remote digital outputs to HIGH... ", Dummy, Dummy);
|
||||
if (remoteDioWriteAll(remoteDeviceNumber, digital_mb, TRUE) == OK)
|
||||
{
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"Done", Dummy, Dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"Failed", Dummy, Dummy);
|
||||
}
|
||||
|
||||
/* Set remote relay througput LEDs to on */
|
||||
sendString (SerOutPort, GotoNewLine, testMessage,
|
||||
"Set remote relay outputs to HIGH... ", Dummy, Dummy);
|
||||
if (remoteRelaySetAll(remoteDeviceNumber, relay_mb, TRUE) == OK)
|
||||
{
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"Done", Dummy, Dummy);
|
||||
}
|
||||
else
|
||||
{
|
||||
sendString (SerOutPort, FALSE, testMessage,
|
||||
"Failed", Dummy, Dummy);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
sendString (SerOutPort, TRUE, noteMessage,
|
||||
"\tAre all LEDs turned on? ",
|
||||
"\n\r\tPRESS y (YES) oder n (NO): ",
|
||||
NewLine);
|
||||
|
||||
do /* do-while loop for String input */
|
||||
{
|
||||
receive = serGet(SerOutPort, &buffer);
|
||||
|
||||
} while ((buffer != 121) && (buffer != 110));
|
||||
|
||||
if (buffer == 121) /* 121 = y (ScanCode) */
|
||||
{
|
||||
sendString (SerOutPort, TRUE, noteMessage,
|
||||
"All LEDs working", Dummy, Dummy);
|
||||
ledTest = TRUE;
|
||||
}
|
||||
else if (buffer == 110) /* 110 = n (ScanCode) */
|
||||
{
|
||||
sendString (SerOutPort, TRUE, noteMessage,
|
||||
"LEDs broken", Dummy, Dummy);
|
||||
ledTest = FALSE;
|
||||
}
|
||||
|
||||
// \TODO CALCULATE RESULT
|
||||
}
|
||||
Reference in New Issue
Block a user