Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of USBSerial_HelloWorld by
Revision 10:ee0528f8d38e, committed 2018-02-07
- Comitter:
- bomilkar
- Date:
- Wed Feb 07 10:30:36 2018 +0000
- Parent:
- 9:d88699a0905a
- Commit message:
- This testcase demonstrates the incompatibility of time_t when using gcc-arm-none-eabi-7-2017-q4-major.; The symptom is apparent with "sizeof(time_t)"; The 2017-q4 release shows 8 "long long int"; Older releases show 4 "long int"
Changed in this revision
diff -r d88699a0905a -r ee0528f8d38e USBDevice.lib --- a/USBDevice.lib Fri Mar 01 13:33:02 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/USBDevice/#335f2506f422
diff -r d88699a0905a -r ee0528f8d38e main.cpp --- a/main.cpp Fri Mar 01 13:33:02 2013 +0000 +++ b/main.cpp Wed Feb 07 10:30:36 2018 +0000 @@ -1,14 +1,43 @@ #include "mbed.h" -#include "USBSerial.h" - -//Virtual serial port over USB -USBSerial serial; - -int main(void) { - - while(1) - { - serial.printf("I am a virtual serial port\r\n"); + +#define SERIAL_TX PA_9 +#define SERIAL_RX PA_10 +Serial pc(SERIAL_TX, SERIAL_RX, 115200); + +int main(void) +{ + time_t t; + struct tm *tx; + + pc.printf("++++++++++++++++++++++\nsizeof(time_t) = %d\n++++++++++++++++++++++\n",sizeof(time_t)); + + time(&t); + pc.printf("read RTC: %u\n",(int)t); + tx = localtime(&t); + pc.printf("ctime: %s", ctime(&t)); + pc.printf("T: %d:%d:%d D: %d.%d.%d X: %d\n", + tx->tm_hour,tx->tm_min,tx->tm_sec, + tx->tm_mday,tx->tm_mon+1,tx->tm_year+1900, + tx->tm_isdst); + + pc.printf("t = 0\n"); + t = 0; + tx = localtime(&t); + pc.printf("ctime: %s", ctime(&t)); + pc.printf("T: %d:%d:%d D: %d.%d.%d X: %d\n", + tx->tm_hour,tx->tm_min,tx->tm_sec, + tx->tm_mday,tx->tm_mon+1,tx->tm_year+1900, + tx->tm_isdst); + + pc.printf("loop start\n"); + while (1) { + tx = localtime(&t); + pc.printf("ctime: %s", ctime(&t)); + pc.printf("T: %d:%d:%d D: %d.%d.%d X: %d\n", + tx->tm_hour,tx->tm_min,tx->tm_sec, + tx->tm_mday,tx->tm_mon+1,tx->tm_year+1900, + tx->tm_isdst); wait(1); + t += 1; } -} \ No newline at end of file +}
diff -r d88699a0905a -r ee0528f8d38e mbed.bld --- a/mbed.bld Fri Mar 01 13:33:02 2013 +0000 +++ b/mbed.bld Wed Feb 07 10:30:36 2018 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/3d0ef94e36ec \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/7130f322cb7e \ No newline at end of file