STM32F103C8T6_Internal_RTC

Dependencies:   mbed-STM32F103C8T6 mbed

Fork of STM32F103C8T6_GPRS_TCP by Shivanand Gowda

Revision:
13:bf9a5ca067bf
Parent:
12:91de57777095
--- a/main.cpp	Fri Jul 13 07:36:58 2018 +0000
+++ b/main.cpp	Fri Jul 13 08:22:41 2018 +0000
@@ -1,101 +1,37 @@
 #include "stm32f103c8t6.h"
 #include "mbed.h"
-#include "gprs.h"
+#include "Time.h"
+
 
-    char Server[20]="119.81.0.11" ;              //write your Server IP here shoud be a static IP
-    char Port[5]="8080";                         // write your port Number 
-    char Phone_No[11]="1234567890";
-    char Service_Provider[40]="airtelgprs.com";
-    char Data[100]="Hellow World to Server";
-    
-    Serial      pc(PA_2, PA_3);
-    DigitalOut  myled(LED1);
-    GPRS   gprs(PB_6,PB_7,9600,Phone_No);
-    char Reply[100]={'\0'};
+Serial  pc(PA_2, PA_3);
+DigitalOut  myled(LED1);
+  
+
 int main()
  {
-    confSysClock();     
+    confSysClock();        
         myled = 0;      // turn the LED on
         wait_ms(200);   // 200 millisecond
         myled = 1;      // turn the LED off
         wait_ms(1000);  // 1000 millisecond
         pc.printf("Blink\r\n");
-        
-          
-    pc.printf("Am here.... GOOD\r\n"); 
-    gprs.init();
-    if(gprs.checkSIMStatus()==0)
-    { 
-        pc.printf("SIM Status is GOOD\r\n"); 
-        }
-    else
-    {
-        pc.printf("SIM NOT Preset \r\n"); 
-        }
-    
-     if(gprs.checkSignalStrength ()>=3)
-     {
-         pc.printf("Signal strength Good \r\n");  
-           
-        }  
-        else
-        {
-        pc.printf("Signal strength Weak\r\n");  
-        }
-        
-        if(gprs.checkSIMStatus()==0)
-        {
-             pc.printf("SIM Status is GOOD\r\n"); 
-        }  
-            
-        else
-        {
-             pc.printf("SIM NOT Present \r\n"); 
-        }  
+        char DATE[12]={'\0'};
+        char TIME[10]={'\0'};
+             
+        int success=iSetTerminalTime("14072018101113");
         
-//        gprs.networkInit( "202.56.231.117:8080");
-         int success= gprs.networkInit(Service_Provider);   //write your apn here
-         if(success==0)
-         pc.printf("Network Initialised \r\n");
-         else
-         pc.printf("Unable Initialise Network  \r\n");
-          
-          
-          success=gprs.connectTCP(Server,Port);
-          
-         if(success==0)
-         pc.printf("Connected to Server  \r\n");
-         else
-         pc.printf("Unable connect to Server   \r\n");
-         
-         success= gprs.sendTCPData(Data);
-         
-         if(success==0)
-         pc.printf("Data Sent  \r\n");
-         else
-         pc.printf("Unable connect to Server   \r\n");
-         
-         success=gprs.waitforReply(Reply);
-         
-         if(success==0)
-         pc.printf("Data Received form Server  \r\n");
-         else
-         pc.printf("No Reply from Server \r\n");
-
-         success=gprs.closeTCP();
-         
-         if(success==0)
-         pc.printf("Close TCP Connection  \r\n");
-         else
-         pc.printf("Unable to detach from Server \r\n");
-         
-         success=gprs.shutTCP();
-         
-         if(success==0)
-         pc.printf("Shut TCP Connection  \r\n");
-         else
-         pc.printf("Unable to Shut TCP Connection \r\n");
+        if(success==0)
+        pc.printf(" Time Set Successfull\r\n");
+        else
+        pc.printf(" Unable to set terminal time \r\n");
         
+        while(success==0)
+        {
+         Get_Date_Time(DATE,TIME);
+          pc.printf("Date : %s\r\n",DATE);
+          pc.printf("Time : %s\r\n",TIME);
+        }
+             
     }