forked from arduino/Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathATS_General.pde
95 lines (67 loc) · 1.98 KB
/
ATS_General.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//************************************************************************
//* Arduino Test Suite
//* (C) 2010 by Mark Sproul
//* Open source as per standard Arduino code
//*
//************************************************************************
//* Aug 31, 2010 <MLS> Started on TestArduino
//* Oct 18, 2010 <MLS> Added memory testing
//************************************************************************
#include <ArduinoTestSuite.h>
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
#define kBoard_PinCount 20
#define kBoard_AnalogCount 6
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define kBoard_PinCount 70
#define kBoard_AnalogCount 16
#elif defined(CORE_TEENSY)
#define kBoard_PinCount CORE_NUM_TOTAL_PINS
#define kBoard_AnalogCount CORE_NUM_ANALOG
#define SERIAL_PORT_COUNT 2
HardwareSerial Serial1 = HardwareSerial();
#endif
//************************************************************************
void setup()
{
short ii;
uint8_t timerNumber;
int startMemoryUsage;
startMemoryUsage = ATS_GetFreeMemory();
ATS_begin("Arduino", "general");
//* test digital pins
//* we start at 2 because 0/1 are RXD/TXD
for (ii=2; ii<kBoard_PinCount; ii++)
{
ATS_Test_DigitalPin(ii);
}
//* test PWM pins
//* we start at 2 because 0/1 are RXD/TXD
for (ii=2; ii<kBoard_PinCount; ii++)
{
timerNumber = digitalPinToTimer(ii);
if (timerNumber != NOT_ON_TIMER)
{
ATS_Test_PWM_Pin(ii);
}
}
for (ii=0; ii<kBoard_AnalogCount; ii++)
{
ATS_Test_AnalogInput(ii);
}
#if (SERIAL_PORT_COUNT > 1)
ATS_TestSerialLoopback(&Serial1, "Serial1");
#endif
#if (SERIAL_PORT_COUNT > 2)
ATS_TestSerialLoopback(&Serial2, "Serial2");
#endif
#if (SERIAL_PORT_COUNT > 3)
ATS_TestSerialLoopback(&Serial3, "Serial3");
#endif
ATS_Test_EEPROM();
ATS_ReportMemoryUsage(startMemoryUsage);
ATS_end();
}
//************************************************************************
void loop()
{
}