Contains the main execution of the clock uses headers to import functions
Dependencies: RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor
Fork of TFT_Mikroelectronika_IL9341_sketchpad by
settings.h@29:684e2a3e17b5, 2017-05-25 (annotated)
- Committer:
- Owenmatthewmcgowan
- Date:
- Thu May 25 13:16:32 2017 +0000
- Revision:
- 29:684e2a3e17b5
- Parent:
- 28:53a5429976e4
- Child:
- 30:af38c80391cb
changed demo screen
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Owenmatthewmcgowan | 28:53a5429976e4 | 1 | int setting_press() |
Owenmatthewmcgowan | 28:53a5429976e4 | 2 | { |
Owenmatthewmcgowan | 24:93e1474d6d8b | 3 | int x = readX(); |
Owenmatthewmcgowan | 24:93e1474d6d8b | 4 | int y = readY(); |
Owenmatthewmcgowan | 24:93e1474d6d8b | 5 | if (touching == 1) { |
Owenmatthewmcgowan | 28:53a5429976e4 | 6 | if (x > 0 && x < 50 && y > 0 & y < 100) { // side button 1 (set) |
Owenmatthewmcgowan | 28:53a5429976e4 | 7 | //set desired state to 1 |
Owenmatthewmcgowan | 24:93e1474d6d8b | 8 | return 1; |
Owenmatthewmcgowan | 28:53a5429976e4 | 9 | } else if (x > 0 && x < 50 && y > 100 & y < 200) { //side button 2 (cancel) |
Owenmatthewmcgowan | 28:53a5429976e4 | 10 | //set desired state to 2 |
Owenmatthewmcgowan | 24:93e1474d6d8b | 11 | return 2; |
Owenmatthewmcgowan | 28:53a5429976e4 | 12 | } else if (x > 0 && x < 50 && y > 200 && y < 240) { // button home |
Owenmatthewmcgowan | 24:93e1474d6d8b | 13 | //set desired state to 0 |
Owenmatthewmcgowan | 24:93e1474d6d8b | 14 | return 0; |
Owenmatthewmcgowan | 28:53a5429976e4 | 15 | } else if (x > 50 && x < 185 && y > 0 && y < 100) { // Alarm Hour |
Owenmatthewmcgowan | 24:93e1474d6d8b | 16 | return 11; |
Owenmatthewmcgowan | 28:53a5429976e4 | 17 | } else if (x > 185 && x < 320 && y > 0 && y < 100) { // Alarm Min |
Owenmatthewmcgowan | 24:93e1474d6d8b | 18 | return 12; |
Owenmatthewmcgowan | 28:53a5429976e4 | 19 | } else if (x > 50 && x < 185 && y > 100 && y < 200) { //Time Hour |
Owenmatthewmcgowan | 24:93e1474d6d8b | 20 | return 13; |
Owenmatthewmcgowan | 28:53a5429976e4 | 21 | } else if (x > 185 && x < 320 && y > 100 && y < 200) { //Time Min |
Owenmatthewmcgowan | 28:53a5429976e4 | 22 | return 14; |
Owenmatthewmcgowan | 28:53a5429976e4 | 23 | } else if (x > 50 && x < 140 && y > 200 && y < 300) { //Time Date |
Owenmatthewmcgowan | 28:53a5429976e4 | 24 | return 15; |
Owenmatthewmcgowan | 28:53a5429976e4 | 25 | } else if (x > 140 && x < 230 && y > 200 && y < 300) { //Time Month |
Owenmatthewmcgowan | 28:53a5429976e4 | 26 | return 16; |
Owenmatthewmcgowan | 28:53a5429976e4 | 27 | } else if (x > 230 && x < 320 && y > 200 && y < 300) { //Time Year |
Owenmatthewmcgowan | 28:53a5429976e4 | 28 | return 17; |
Owenmatthewmcgowan | 24:93e1474d6d8b | 29 | } |
Owenmatthewmcgowan | 24:93e1474d6d8b | 30 | } |
Owenmatthewmcgowan | 24:93e1474d6d8b | 31 | return -1; |
Owenmatthewmcgowan | 24:93e1474d6d8b | 32 | } |
Owenmatthewmcgowan | 12:50289d0ac834 | 33 | |
Owenmatthewmcgowan | 15:796e17680825 | 34 | void drawsettingback() //Navigation Buttons |
Owenmatthewmcgowan | 12:50289d0ac834 | 35 | { |
Owenmatthewmcgowan | 28:53a5429976e4 | 36 | TFT.fillrect(0,0,50,100,Blue); //set alarm button |
Owenmatthewmcgowan | 12:50289d0ac834 | 37 | TFT.fillrect(0,100,50,200,White); //set time button |
Owenmatthewmcgowan | 12:50289d0ac834 | 38 | |
Owenmatthewmcgowan | 28:53a5429976e4 | 39 | |
Owenmatthewmcgowan | 12:50289d0ac834 | 40 | TFT.rect(0,0,50,100,Blue); //outlines |
Owenmatthewmcgowan | 12:50289d0ac834 | 41 | TFT.rect(0,100,50,200,White); //outlines |
Owenmatthewmcgowan | 12:50289d0ac834 | 42 | TFT.rect(0,200,50,240,White); //outlines |
Owenmatthewmcgowan | 28:53a5429976e4 | 43 | |
Owenmatthewmcgowan | 15:796e17680825 | 44 | //alarm/time colons |
Owenmatthewmcgowan | 28:53a5429976e4 | 45 | int tx,ty = 0; |
Owenmatthewmcgowan | 28:53a5429976e4 | 46 | ty = 50; |
Owenmatthewmcgowan | 28:53a5429976e4 | 47 | tx = 185; |
Owenmatthewmcgowan | 28:53a5429976e4 | 48 | TFT.fillcircle(tx, ty - 10, 2, White); |
Owenmatthewmcgowan | 28:53a5429976e4 | 49 | TFT.fillcircle(tx, ty + 10, 2, White); |
Owenmatthewmcgowan | 28:53a5429976e4 | 50 | ty = 150; |
Owenmatthewmcgowan | 28:53a5429976e4 | 51 | TFT.fillcircle(tx, ty - 10, 2, White); |
Owenmatthewmcgowan | 28:53a5429976e4 | 52 | TFT.fillcircle(tx, ty + 10, 2, White); |
Owenmatthewmcgowan | 28:53a5429976e4 | 53 | TFT.rect(50,0,320,100,Blue); //set alarm box |
Owenmatthewmcgowan | 12:50289d0ac834 | 54 | TFT.rect(50,100,320,200,White); //set time box |
Owenmatthewmcgowan | 12:50289d0ac834 | 55 | TFT.rect(50,200,320,240,White); //set date box |
Owenmatthewmcgowan | 13:e74e09de81e4 | 56 | |
Owenmatthewmcgowan | 12:50289d0ac834 | 57 | TFT.set_font((unsigned char*) Arial12x12); //set alarm title |
Owenmatthewmcgowan | 15:796e17680825 | 58 | TFT.locate(157,8); |
Owenmatthewmcgowan | 12:50289d0ac834 | 59 | TFT.printf("Set Alarm"); |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 60 | TFT.set_font((unsigned char*) Arial12x12); //set time title |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 61 | TFT.locate(157,108); |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 62 | TFT.printf("Set Time"); |
Owenmatthewmcgowan | 28:53a5429976e4 | 63 | //Cancel button |
Owenmatthewmcgowan | 28:53a5429976e4 | 64 | TFT.set_font((unsigned char*) Arial12x12); |
mlin | 25:ff73360cd038 | 65 | TFT.locate(62,20); |
mlin | 25:ff73360cd038 | 66 | TFT.set_orientation(0); |
mlin | 25:ff73360cd038 | 67 | TFT.background(White); |
mlin | 25:ff73360cd038 | 68 | TFT.foreground(Black); |
mlin | 25:ff73360cd038 | 69 | TFT.printf("Cancel"); |
mlin | 25:ff73360cd038 | 70 | TFT.background(Black); |
mlin | 25:ff73360cd038 | 71 | TFT.foreground(White); |
mlin | 25:ff73360cd038 | 72 | TFT.set_orientation(1); |
mlin | 25:ff73360cd038 | 73 | |
mlin | 25:ff73360cd038 | 74 | //Set New button (used to set new alarm/time/date) |
Owenmatthewmcgowan | 28:53a5429976e4 | 75 | |
mlin | 25:ff73360cd038 | 76 | TFT.locate(161,20); |
mlin | 25:ff73360cd038 | 77 | TFT.set_orientation(0); |
mlin | 25:ff73360cd038 | 78 | TFT.background(Blue); |
mlin | 25:ff73360cd038 | 79 | TFT.printf("Set New"); |
mlin | 25:ff73360cd038 | 80 | TFT.background(Black); |
mlin | 25:ff73360cd038 | 81 | TFT.set_orientation(1); |
Owenmatthewmcgowan | 28:53a5429976e4 | 82 | //home button |
mlin | 25:ff73360cd038 | 83 | TFT.locate(5,217); |
mlin | 25:ff73360cd038 | 84 | TFT.foreground(Blue); |
mlin | 25:ff73360cd038 | 85 | TFT.printf("Home"); |
mlin | 25:ff73360cd038 | 86 | TFT.foreground(White); |
mlin | 25:ff73360cd038 | 87 | } |
mlin | 25:ff73360cd038 | 88 | |
Owenmatthewmcgowan | 28:53a5429976e4 | 89 | void drawsettinganimate(int a_h, int a_m, int t_h, int t_m, int t_d, int t_mo, int t_y) //draw alarm, time, date |
mlin | 25:ff73360cd038 | 90 | { |
Owenmatthewmcgowan | 28:53a5429976e4 | 91 | |
Owenmatthewmcgowan | 12:50289d0ac834 | 92 | |
mlin | 18:02667782b06f | 93 | |
Owenmatthewmcgowan | 12:50289d0ac834 | 94 | TFT.set_font((unsigned char*) Arial28x28); //set alarm hour |
mlin | 18:02667782b06f | 95 | |
Owenmatthewmcgowan | 15:796e17680825 | 96 | TFT.locate(90,40); |
Owenmatthewmcgowan | 28:53a5429976e4 | 97 | TFT.printf("%d",a_h); // print Alarm hour |
Owenmatthewmcgowan | 15:796e17680825 | 98 | TFT.locate(230,40); |
Owenmatthewmcgowan | 28:53a5429976e4 | 99 | TFT.printf("%d",a_m);//Alarm_Min |
Owenmatthewmcgowan | 12:50289d0ac834 | 100 | TFT.set_font((unsigned char*) Arial28x28); //set time hour |
Owenmatthewmcgowan | 15:796e17680825 | 101 | TFT.locate(90,140); |
Owenmatthewmcgowan | 28:53a5429976e4 | 102 | TFT.printf("%d",t_h); // Time_hour |
Owenmatthewmcgowan | 15:796e17680825 | 103 | TFT.locate(230,140); |
Owenmatthewmcgowan | 28:53a5429976e4 | 104 | TFT.printf("%d",t_m);//Time Min |
Owenmatthewmcgowan | 15:796e17680825 | 105 | TFT.set_font((unsigned char*) Arial12x12); |
Owenmatthewmcgowan | 15:796e17680825 | 106 | TFT.locate(60,215); |
Owenmatthewmcgowan | 28:53a5429976e4 | 107 | TFT.printf("%d",t_d); //print date |
Owenmatthewmcgowan | 15:796e17680825 | 108 | TFT.locate(150,215); |
Owenmatthewmcgowan | 28:53a5429976e4 | 109 | TFT.printf("%d",t_mo); //print month |
Owenmatthewmcgowan | 15:796e17680825 | 110 | TFT.locate(265,215); |
Owenmatthewmcgowan | 28:53a5429976e4 | 111 | TFT.printf("%d",t_y); //print year |
Owenmatthewmcgowan | 12:50289d0ac834 | 112 | |
Owenmatthewmcgowan | 28:53a5429976e4 | 113 | |
Owenmatthewmcgowan | 28:53a5429976e4 | 114 | |
Owenmatthewmcgowan | 15:796e17680825 | 115 | |
mlin | 16:3cb9b1fbc039 | 116 | } |
Owenmatthewmcgowan | 28:53a5429976e4 | 117 | void settings() |
Owenmatthewmcgowan | 28:53a5429976e4 | 118 | { |
mlin | 25:ff73360cd038 | 119 | int a_h, a_m, t_h, t_m,t_d,t_mo,t_y = 0; |
Owenmatthewmcgowan | 28:53a5429976e4 | 120 | a_h = tm_a_hr; |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 121 | a_m = tm_a_min; |
Owenmatthewmcgowan | 28:53a5429976e4 | 122 | t_h = tm_c.hour; |
Owenmatthewmcgowan | 28:53a5429976e4 | 123 | t_m = tm_c.min; |
Owenmatthewmcgowan | 28:53a5429976e4 | 124 | t_d = tm_c.date; |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 125 | t_mo = tm_c.mon; |
Owenmatthewmcgowan | 28:53a5429976e4 | 126 | t_y = tm_c.year; |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 127 | int multiplier = 8; |
Owenmatthewmcgowan | 26:47271cf8d6b2 | 128 | int o_setting = 11; |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 129 | drawsettingback(); |
Owenmatthewmcgowan | 28:53a5429976e4 | 130 | while (true){ |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 131 | drawsettinganimate(a_h, a_m,t_h,t_m,t_d,t_mo,t_y); |
Owenmatthewmcgowan | 26:47271cf8d6b2 | 132 | int option = setting_press(); |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 133 | int newval = 0; |
Owenmatthewmcgowan | 28:53a5429976e4 | 134 | if (option == 0 || option == 2) break; |
Owenmatthewmcgowan | 28:53a5429976e4 | 135 | switch (option) { |
Owenmatthewmcgowan | 28:53a5429976e4 | 136 | case (11): |
Owenmatthewmcgowan | 28:53a5429976e4 | 137 | o_setting = 11; |
Owenmatthewmcgowan | 28:53a5429976e4 | 138 | break; //Alarm Hour |
Owenmatthewmcgowan | 28:53a5429976e4 | 139 | case (12): |
Owenmatthewmcgowan | 28:53a5429976e4 | 140 | o_setting = 12; |
Owenmatthewmcgowan | 28:53a5429976e4 | 141 | break; //Alarm Min |
Owenmatthewmcgowan | 28:53a5429976e4 | 142 | case (13): |
Owenmatthewmcgowan | 28:53a5429976e4 | 143 | o_setting = 13; |
Owenmatthewmcgowan | 28:53a5429976e4 | 144 | break; // |
Owenmatthewmcgowan | 28:53a5429976e4 | 145 | case (14): |
Owenmatthewmcgowan | 28:53a5429976e4 | 146 | o_setting = 14; |
Owenmatthewmcgowan | 28:53a5429976e4 | 147 | break; // |
Owenmatthewmcgowan | 28:53a5429976e4 | 148 | case (15): |
Owenmatthewmcgowan | 28:53a5429976e4 | 149 | o_setting = 15; |
Owenmatthewmcgowan | 28:53a5429976e4 | 150 | break; // |
Owenmatthewmcgowan | 28:53a5429976e4 | 151 | case (16): |
Owenmatthewmcgowan | 28:53a5429976e4 | 152 | o_setting = 16; |
Owenmatthewmcgowan | 28:53a5429976e4 | 153 | break; // |
Owenmatthewmcgowan | 28:53a5429976e4 | 154 | case (17): |
Owenmatthewmcgowan | 28:53a5429976e4 | 155 | o_setting = 17; |
Owenmatthewmcgowan | 28:53a5429976e4 | 156 | break; // |
Owenmatthewmcgowan | 26:47271cf8d6b2 | 157 | } |
Owenmatthewmcgowan | 28:53a5429976e4 | 158 | switch (o_setting) { |
Owenmatthewmcgowan | 26:47271cf8d6b2 | 159 | case(11): |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 160 | newval = a_h + tsi_d() * multiplier; |
Owenmatthewmcgowan | 28:53a5429976e4 | 161 | while (newval < 0) { |
Owenmatthewmcgowan | 28:53a5429976e4 | 162 | newval += 24; |
Owenmatthewmcgowan | 28:53a5429976e4 | 163 | } |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 164 | a_h = newval % 25; |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 165 | TFT.fillrect(70, 40, 150, 80, Black); |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 166 | TFT.set_font((unsigned char*) Arial28x28); //set alarm hour |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 167 | TFT.locate(90,40); |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 168 | TFT.foreground(Red); |
Owenmatthewmcgowan | 28:53a5429976e4 | 169 | TFT.printf("%d", a_h);//Alarm_Hour |
Owenmatthewmcgowan | 28:53a5429976e4 | 170 | break; |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 171 | case(12): |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 172 | newval = a_m + tsi_d() * multiplier; |
Owenmatthewmcgowan | 28:53a5429976e4 | 173 | while (newval < 0) { |
Owenmatthewmcgowan | 28:53a5429976e4 | 174 | newval += 60; |
Owenmatthewmcgowan | 28:53a5429976e4 | 175 | } |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 176 | a_m = newval % 60; |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 177 | TFT.fillrect(200, 40, 300, 80, Black); |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 178 | TFT.set_font((unsigned char*) Arial28x28); //set alarm min |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 179 | TFT.locate(230,40); |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 180 | TFT.foreground(Red); |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 181 | TFT.printf("%d", a_m);//Alarm_Min |
Owenmatthewmcgowan | 28:53a5429976e4 | 182 | break; |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 183 | case(13): //set time hour |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 184 | newval = t_h + tsi_d() * multiplier; |
Owenmatthewmcgowan | 26:47271cf8d6b2 | 185 | if (newval < 0) newval += 24; |
Owenmatthewmcgowan | 28:53a5429976e4 | 186 | t_h = newval % 25; |
Owenmatthewmcgowan | 28:53a5429976e4 | 187 | TFT.fillrect(90, 140, 150, 180, Black); |
Owenmatthewmcgowan | 28:53a5429976e4 | 188 | TFT.set_font((unsigned char*) Arial28x28); |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 189 | TFT.foreground(Red); |
Owenmatthewmcgowan | 28:53a5429976e4 | 190 | TFT.locate(90,140); |
Owenmatthewmcgowan | 28:53a5429976e4 | 191 | TFT.printf("%d",t_h); // Time_hour |
Owenmatthewmcgowan | 28:53a5429976e4 | 192 | break; |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 193 | case(14): //set time min |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 194 | newval = t_m + tsi_d() * multiplier; |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 195 | if (newval < 0) newval += 60; |
Owenmatthewmcgowan | 28:53a5429976e4 | 196 | t_m = newval % 60; |
Owenmatthewmcgowan | 28:53a5429976e4 | 197 | TFT.fillrect(200, 140, 300, 180, Black); |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 198 | TFT.set_font((unsigned char*) Arial28x28); |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 199 | TFT.foreground(Red); |
Owenmatthewmcgowan | 28:53a5429976e4 | 200 | TFT.locate(230,140); |
Owenmatthewmcgowan | 28:53a5429976e4 | 201 | TFT.printf("%d",t_m);//Time Min |
Owenmatthewmcgowan | 28:53a5429976e4 | 202 | break; |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 203 | case(15): // set time date |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 204 | newval = t_d + tsi_d() * multiplier; |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 205 | if (newval < 0) newval += 31; |
Owenmatthewmcgowan | 28:53a5429976e4 | 206 | t_d = newval % 32; |
Owenmatthewmcgowan | 28:53a5429976e4 | 207 | TFT.fillrect(55, 202, 148, 238, Black); |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 208 | TFT.foreground(Red); |
Owenmatthewmcgowan | 28:53a5429976e4 | 209 | TFT.set_font((unsigned char*) Arial12x12); |
Owenmatthewmcgowan | 28:53a5429976e4 | 210 | TFT.locate(60,215); |
Owenmatthewmcgowan | 28:53a5429976e4 | 211 | TFT.printf("%d",t_d); //print date |
Owenmatthewmcgowan | 28:53a5429976e4 | 212 | break; |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 213 | case(16): // set time month |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 214 | newval = a_h + tsi_d() * multiplier; |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 215 | if (newval < 0) newval += 12; |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 216 | a_h = newval % 13; |
Owenmatthewmcgowan | 28:53a5429976e4 | 217 | TFT.fillrect(148, 202, 263, 238, Black); |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 218 | TFT.foreground(Red); |
Owenmatthewmcgowan | 28:53a5429976e4 | 219 | TFT.set_font((unsigned char*) Arial12x12); |
Owenmatthewmcgowan | 28:53a5429976e4 | 220 | TFT.locate(150,215); |
Owenmatthewmcgowan | 28:53a5429976e4 | 221 | TFT.printf("%d",t_mo); //print month |
Owenmatthewmcgowan | 28:53a5429976e4 | 222 | break; |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 223 | case(17): //set time year |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 224 | newval = a_h + tsi_d() * multiplier; |
Owenmatthewmcgowan | 27:a895a2c9acb8 | 225 | if (newval > 1970 && newval < 2700) a_h = newval; |
Owenmatthewmcgowan | 28:53a5429976e4 | 226 | TFT.fillrect(263, 202, 310, 238, Black); |
Owenmatthewmcgowan | 26:47271cf8d6b2 | 227 | TFT.foreground(Red); |
Owenmatthewmcgowan | 28:53a5429976e4 | 228 | TFT.set_font((unsigned char*) Arial12x12); |
Owenmatthewmcgowan | 28:53a5429976e4 | 229 | TFT.locate(265,215); |
Owenmatthewmcgowan | 28:53a5429976e4 | 230 | TFT.printf("%d",t_y); //print year |
Owenmatthewmcgowan | 28:53a5429976e4 | 231 | break; |
Owenmatthewmcgowan | 28:53a5429976e4 | 232 | } |
Owenmatthewmcgowan | 28:53a5429976e4 | 233 | TFT.foreground(White); |
Owenmatthewmcgowan | 28:53a5429976e4 | 234 | if (option == 1) { |
Owenmatthewmcgowan | 28:53a5429976e4 | 235 | tm_a_hr = a_h; |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 236 | tm_a_min = a_m; |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 237 | tm_c.min = t_m; |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 238 | tm_c.hour = t_h; |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 239 | tm_c.date = t_d; |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 240 | tm_c.mon = t_mo; |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 241 | tm_c.year = t_y; |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 242 | while (!rtc.setTime(tm_c, true, false)) { //set the Time in RTC Param : ( Time container, Start Clock, Twelve Hour Clock) |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 243 | // n++; |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 244 | } |
Owenmatthewmcgowan | 29:684e2a3e17b5 | 245 | // pc.printf("Tried to write %d times\n\r",n); |
Owenmatthewmcgowan | 28:53a5429976e4 | 246 | break; |
Owenmatthewmcgowan | 28:53a5429976e4 | 247 | } |
Owenmatthewmcgowan | 28:53a5429976e4 | 248 | } |
Owenmatthewmcgowan | 28:53a5429976e4 | 249 | f_state = 1; |
mlin | 25:ff73360cd038 | 250 | } |