pong game added to the main sketch
Dependencies: RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor
Fork of MainSketch by
Diff: RTC.h
- Revision:
- 11:1da15361a35b
- Parent:
- 9:eee503060d69
diff -r 9d9b3b9b28b8 -r 1da15361a35b RTC.h --- a/RTC.h Wed May 24 11:21:37 2017 +0000 +++ b/RTC.h Wed May 24 13:27:07 2017 +0000 @@ -1,4 +1,4 @@ - #include "Rtc_Ds1307.h" +#include "Rtc_Ds1307.h" Rtc_Ds1307 rtc(I2C_SDA, I2C_SCL); Rtc_Ds1307::Time_rtc tm_c = {}; Rtc_Ds1307::Time_rtc tm_a = {}; @@ -6,19 +6,21 @@ int readptr = 0; -void read_time(){ - // perform read +void read_time() +{ +// perform read pc.printf("Performing read operation\n\r"); int n = 0; do { n++; } while(!rtc.getTime(tm_c)); -pc.printf("The current time is : %02d:%02d:%02d\n\r", tm_c.hour, tm_c.min, tm_c.sec); -pc.printf("The current date is : %s, %02d/%02d/%04d\n\r", rtc.weekdayToString(tm_c.wday), tm_c.mon, tm_c.date, tm_c.year); -pc.printf("Tried to read %d times\n\r",n); + pc.printf("The current time is : %02d:%02d:%02d\n\r", tm_c.hour, tm_c.min, tm_c.sec); + pc.printf("The current date is : %s, %02d/%02d/%04d\n\r", rtc.weekdayToString(tm_c.wday), tm_c.mon, tm_c.date, tm_c.year); + pc.printf("Tried to read %d times\n\r",n); } -void write(){ +void write() +{ // perform write pc.printf("Enter the date (date 0..31)"); pc.scanf("%d", &tm_c.date); @@ -33,15 +35,15 @@ pc.printf("Enter the time (seconds 0..59)"); pc.scanf("%d", &tm_c.sec); pc.printf("Performing write operation\n\r"); - - while(pc.readable()) - + + while(pc.readable()) + pc.getc(); int n = 0; - while (!rtc.setTime(tm_c, true, false)){ //set the Time in RTC Param : ( Time container, Start Clock, Twelve Hour Clock) - n++; + while (!rtc.setTime(tm_c, true, false)) { //set the Time in RTC Param : ( Time container, Start Clock, Twelve Hour Clock) + n++; } - pc.printf("Tried to write %d times\n\r",n); + pc.printf("Tried to write %d times\n\r",n); } //other RTC functions: