This package contains a simple test of tests for various elements of the SmartBoard hardware, which is a simple baseboard designed for easy embedding. It is able to run both a semi-automatic test suite as well as allow interactive testing.
Dependencies: EthernetNetIf NTPClient_NetServices mbed
This program is most of what you need to test your SmartBoard baseboard hardware. It provides a means to test the following:
- Two channels of CAN (with a loopback cable)
- RS-232 Ports
- Analog inputs
- PWM outputs
- Ethernet port
- Real time clock
- micro SD
- USB Host port
Diff: SmartBoard_Tester.cpp
- Revision:
- 3:2b4fe31e8d15
- Parent:
- 2:02e7d896824f
- Child:
- 4:ca93a8d4874d
--- a/SmartBoard_Tester.cpp Mon Jan 24 00:45:16 2011 +0000 +++ b/SmartBoard_Tester.cpp Tue Jan 25 02:02:19 2011 +0000 @@ -124,7 +124,7 @@ pc.printf("\r\n\r\n"); pc.printf("SmartBoard Hardware Tester\r\n"); pc.printf(" SmartBoard Hardware v0.05\r\n"); - pc.printf(" SmartBoard Software v0.09\r\n"); + pc.printf(" SmartBoard Software v0.10\r\n"); pc.printf("\r\n"); pc.printf(" [USB] [Eth/USB] \r\n"); pc.printf(" +---------------+------------+---+-------+---+\r\n"); @@ -346,43 +346,48 @@ struct tm *t = localtime(&seconds); int i; - printf("RTC Set:\r\n"); + pc.printf("RTC Set:\r\n"); ShowTime(seconds, tzOffsetHr, tzOffsetMin); - printf(" Enter the time MM/DD/YYYY HH:MM:SS\r\n"); + pc.printf(" Enter the time MM/DD/YYYY HH:MM:SS\r\n"); while (1) { + int _m, _d, _y, _H, _M, _S; printf(" > "); - if (GetNumber(2, &t->tm_mon)) { + if (GetNumber(2, &_m)) { pc.putc('/'); - if (!GetNumber(2, &t->tm_mday)) + if (!GetNumber(2, &_d)) continue; pc.putc('/'); - if (!GetNumber(4, &t->tm_year)) + if (!GetNumber(4, &_y)) continue; + t->tm_mon = _m - 1; + t->tm_mday = _d; + t->tm_year = _y - 1900; } else { pc.printf("%02d/%02d/%04d", t->tm_mon+1, t->tm_mday, t->tm_year+1900); } pc.putc(' '); - if (!GetNumber(2, &t->tm_hour)) { + if (GetNumber(2, &_H)) { + pc.putc(':'); + if (!GetNumber(2, &_M)) + continue; + pc.putc(':'); + if (!GetNumber(2, &_S)) + continue; + t->tm_hour = _H; + t->tm_min = _M; + t->tm_sec = _S; + pc.printf("\r\n"); + pc.printf("%02d/%02d/%04d ", t->tm_mon+1, t->tm_mday, t->tm_year+1900); + pc.printf("%02d:%02d:%02d\r\n", t->tm_hour, t->tm_min, t->tm_sec); + // convert to timestamp and display (1256729737) + time_t seconds = mktime(t); + seconds = seconds - (tzOffsetHr * 3600 + tzOffsetMin * 60); + set_time(seconds); + break; + } else { pc.printf("%02d:%02d:%02d\r\n", t->tm_hour, t->tm_min, t->tm_sec); break; // they can bail here } - pc.putc(':'); - if (!GetNumber(2, &t->tm_min)) - continue; - pc.putc(':'); - if (!GetNumber(2, &t->tm_sec)) - continue; - else { - t->tm_mon--; // 1-12 => 0-11 - t->tm_year -= 1900; - t->tm_hour -= tzOffsetHr; - t->tm_min -= tzOffsetMin; - pc.printf("\r\n"); - // convert to timestamp and display (1256729737) - time_t seconds = mktime(t); - set_time(seconds); - break; - } } for (i=0; i<5; i++) { ShowTime(tzOffsetHr, tzOffsetMin); @@ -524,7 +529,7 @@ static char result[15] = ""; int uSec = value % 1000000; int Sec = value / 1000000; - + if (Sec > 1000) sprintf(result, "%3i,%3i.%06i", Sec/1000, Sec%1000, uSec); else