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.
Revision 3:efb21ee0d7dd, committed 2019-12-17
- Comitter:
- rashidpkvm
- Date:
- Tue Dec 17 13:58:12 2019 +0000
- Parent:
- 2:3be003301107
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Jun 26 21:07:13 2013 +0000 +++ b/main.cpp Tue Dec 17 13:58:12 2019 +0000 @@ -14,30 +14,32 @@ Rtc_Ds1307::Time_rtc tm = {}; while(1) { - pc.printf("*************************************\n"); - pc.printf("* Menu for RTC Test : *\n"); - pc.printf("* read - reads the clock *\n"); - pc.printf("* start - start the clock *\n"); - pc.printf("* stop - stop the clock *\n"); - pc.printf("* write - write the clock *\n"); - pc.printf("* ena - enable Square wave output *\n"); - pc.printf("* dis - disable square wave outp. *\n"); - pc.printf("*************************************\n"); + pc.printf("*************************************\n\r"); + pc.printf("* Menu for RTC Test : *\n\r"); + pc.printf("* read - reads the clock *\n\r"); + pc.printf("* start - start the clock *\n\r"); + pc.printf("* stop - stop the clock *\n\r"); + pc.printf("* write - write the clock *\n\r"); + pc.printf("* ena - enable Square wave output *\n\r"); + pc.printf("* dis - disable square wave outp. *\n\r"); + pc.printf("*************************************\n\r"); - while( (c = pc.getc()) != '\n') { + while( (c = pc.getc()) != '\r') { buffer[readptr++] = c; } + //pc.gets(c); + // pc.printf("%s\n",c); buffer[readptr++] = 0; - if (strncmp(buffer, "read", 4) == 0) { + if (!strcmp(buffer, "read")) { // perform read - pc.printf("Performing read operation\n"); + pc.printf("Performing read operation\n\r"); if (rtc.getTime(tm) ) { - pc.printf("The current time is : %02d:%02d:%02d\n", tm.hour, tm.min, tm.sec); - pc.printf("The current date is : %s, %02d/%02d/%04d\n", rtc.weekdayToString(tm.wday), tm.mon, tm.date, tm.year); + pc.printf("The current time is : %02d:%02d:%02d\n\r", tm.hour, tm.min, tm.sec); + pc.printf("The current date is : %s, %02d/%02d/%04d\n\r", rtc.weekdayToString(tm.wday), tm.mon, tm.date, tm.year); } } - else if (strncmp(buffer, "write", 5) == 0) { + else if (!strcmp(buffer, "write")) { // perform write pc.printf("Enter the date (date 0..31)"); pc.scanf("%d", &tm.date); @@ -57,24 +59,24 @@ pc.getc(); rtc.setTime(tm, false, false); } - else if (strncmp(buffer, "start", 5) == 0) { + else if (!strcmp(buffer, "start")) { // start - pc.printf("Performing start operation\n"); + pc.printf("Performing start operation\n\r"); rtc.startClock(); } - else if (strncmp(buffer, "stop", 4) == 0) { + else if (!strcmp(buffer, "stop")) { // stop - pc.printf("Performing stop operation\n"); + pc.printf("Performing stop operation\n\r"); rtc.stopClock(); } - else if (strncmp(buffer, "ena", 3) == 0) { + else if (!strcmp(buffer, "ena")) { int rs; pc.printf("Please specify the frequency : [0 = 1Hz, 1 = 4.096kHz, 2 = 8.192kHz, 3 = 32.768kHz] "); scanf("%d", &rs); - pc.printf("Enabling the output with %d option\n", rs); + pc.printf("Enabling the output with %d option\n\r", rs); rtc.setSquareWaveOutput(true, (Rtc_Ds1307::SqwRateSelect_t)rs); } - else if (strncmp(buffer, "dis", 3) == 0) { + else if (!strcmp(buffer, "dis")) { pc.printf("Disableing square wave output\n"); rtc.setSquareWaveOutput(false, Rtc_Ds1307::RS1Hz); }
--- a/mbed.bld Wed Jun 26 21:07:13 2013 +0000 +++ b/mbed.bld Tue Dec 17 13:58:12 2019 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17 \ No newline at end of file +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file