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
ShowTime.c@5:42b456ce6f71, 2011-04-04 (annotated)
- Committer:
- WiredHome
- Date:
- Mon Apr 04 11:33:23 2011 +0000
- Revision:
- 5:42b456ce6f71
- Parent:
- 1:586392c0e935
Several minor updates
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WiredHome | 1:586392c0e935 | 1 | /// @file ShowTime.cpp contains a couple of simple time printing apis |
WiredHome | 1:586392c0e935 | 2 | /// |
WiredHome | 1:586392c0e935 | 3 | /// APIs for showing the time from the RTC, or from a passed in value. |
WiredHome | 1:586392c0e935 | 4 | /// |
WiredHome | 1:586392c0e935 | 5 | /// @note Copyright © 2011 by Smartware Computing, all rights reserved. |
WiredHome | 1:586392c0e935 | 6 | /// @author David Smart |
WiredHome | 1:586392c0e935 | 7 | /// |
WiredHome | 0:5db287f0060b | 8 | #include "mbed.h" |
WiredHome | 1:586392c0e935 | 9 | #include "ShowTime.h" |
WiredHome | 0:5db287f0060b | 10 | |
WiredHome | 0:5db287f0060b | 11 | static int SignOf(const int i) { |
WiredHome | 0:5db287f0060b | 12 | return (i >= 0) ? 1 : -1; |
WiredHome | 0:5db287f0060b | 13 | } |
WiredHome | 0:5db287f0060b | 14 | |
WiredHome | 1:586392c0e935 | 15 | void ShowTime(int hOffset, int mOffset) { |
WiredHome | 1:586392c0e935 | 16 | ShowTime(0, hOffset, mOffset); |
WiredHome | 1:586392c0e935 | 17 | } |
WiredHome | 0:5db287f0060b | 18 | |
WiredHome | 1:586392c0e935 | 19 | void ShowTime(time_t tValue, int hOffset, int mOffset) { |
WiredHome | 0:5db287f0060b | 20 | time_t ctTime; |
WiredHome | 0:5db287f0060b | 21 | char timbuf[70]; |
WiredHome | 0:5db287f0060b | 22 | |
WiredHome | 0:5db287f0060b | 23 | if (tValue == 0) |
WiredHome | 0:5db287f0060b | 24 | tValue = time(NULL); |
WiredHome | 0:5db287f0060b | 25 | ctTime = tValue + hOffset * 3600 + SignOf(hOffset) * mOffset * 60; |
WiredHome | 0:5db287f0060b | 26 | strcpy(timbuf, ctime(&ctTime)); |
WiredHome | 0:5db287f0060b | 27 | timbuf[strlen(timbuf)-1] = '\0'; |
WiredHome | 0:5db287f0060b | 28 | printf(" %s (offset: %02i:%02i)\r\n", timbuf, hOffset, mOffset); |
WiredHome | 0:5db287f0060b | 29 | } |