D:/DRISSI/arduino-0022/arduino-0022/libraries/ArduinoTestSuite/ArduinoTestSuite.h
00001 //************************************************************************
00002 //************************************************************************
00003 //*     Aug 31, 2010    <MLS> Started on TestArduino
00004 //************************************************************************
00005 
00006 #ifndef _AVR_IO_H_
00007         #include        <avr/io.h>
00008 #endif
00009 
00010 #ifndef WProgram_h
00011         #include        "WProgram.h"
00012 #endif
00013 #ifndef HardwareSerial_h
00014         #include        "HardwareSerial.h"
00015 #endif
00016 
00017 
00018 #if defined(USART3_RX_vect)
00019         #define SERIAL_PORT_COUNT               4
00020 #elif  defined(USART1_RX_vect)
00021         #define SERIAL_PORT_COUNT               2
00022 #else
00023         #define SERIAL_PORT_COUNT               1
00024 #endif
00025 
00026 
00027 void    ATS_begin(char *manufName, char *testSuiteName);
00028 void    ATS_end();
00029 
00030 void    ATS_PrintTestStatus(char *testString, boolean passed);
00031 boolean ATS_Test_DigitalPin(uint8_t digitalPinToTest);
00032 boolean ATS_Test_PWM_Pin(uint8_t digitalPinToTest);
00033 boolean ATS_Test_AnalogInput(uint8_t analogPintoTest);
00034 boolean ATS_Test_EEPROM(void);
00035 
00036 short   ATS_TestSerialLoopback(HardwareSerial *theSerialPort, char *serialPortName);
00037 
00038 
00039 int             ATS_GetFreeMemory();
00040 
00041 //************************************************************************
00042 //*     this has to be an inline function because calling subroutines affects free memory
00043 inline void ATS_ReportMemoryUsage(int _memoryUsageAtStart)
00044 {
00045 int             freeMemoryAtEnd;
00046 int             lostMemory;
00047 boolean memoryOK;
00048 char    memoryUsage[48];
00049 
00050         freeMemoryAtEnd =       ATS_GetFreeMemory();
00051         lostMemory      =       _memoryUsageAtStart - freeMemoryAtEnd;
00052         if (lostMemory == 0)
00053         {
00054                 strcpy(memoryUsage, "Memory Usage");
00055                 memoryOK        =       true;
00056         }
00057         else
00058         {
00059                 sprintf(memoryUsage, "Memory Usage (lost %d bytes)", lostMemory);
00060                 memoryOK        =       false;
00061         }
00062         ATS_PrintTestStatus(memoryUsage, memoryOK);
00063 }
00064 
00065 
00066 
00067 extern  unsigned long   gTestStartTime;
00068 extern  int                             gYotalErrors;
00069 extern  int                             gTestCount;
00070 
00071 
00072 #define PASSED  true
00073 #define FAILED  false
00074