software opt

Dependencies:   Hexi_KW40Z Hexi_OLED_SSD1351

Fork of Hexi_BLE_Time by Adam S

Revision:
7:88af507a85bd
Parent:
6:ae8a23b0735b
Child:
8:25985d2711e0
--- a/main.cpp	Sat Jun 09 18:47:06 2018 +0000
+++ b/main.cpp	Sun Jun 10 13:04:58 2018 +0000
@@ -82,9 +82,37 @@
 {
     StartHaptic();
     data[19] = 0;
+    char buf[20];
+    char buffer[30];
+    char *smallbuff;
     pc.printf("%s\n\r", data);
-    
+    for(int i=0;i<20;i++)
+    {
+        printf("%c",data[i]);
+        }
+   
     if (data) {
+         //time_t seconds = (uint8_t)data;
+        std::time_t timeinfo;
+        //time(&rawtime); 
+        
+        //timeinfo = data;
+        sprintf(buf,"%s",data);
+        //printf("%s\n",buf);
+        int timedata= atoi(buf);
+        //printf("%d\n",timedata);
+        timeinfo=(time_t)timedata;
+        //printf("%ld\n",long(timeinfo));
+        //printf("Time as a string = %s", ctime(&timeinfo));
+        sprintf(buffer,"%s",ctime(&timeinfo));
+        printf("%s",buffer);
+        for(int i=0;i<10;i++)
+        {
+            sprintf(smallbuff,"%s",buffer[i]);
+            }
+        printf("%s\n",smallbuff);
+        strcpy((char *) text,"sun jun 10 88");
+        oled.Label((uint8_t *)text,17,65);
         blueLed = LED_OFF;
         greenLed = LED_ON;
         wait_ms(1000);
@@ -142,16 +170,16 @@
     
     /* Display Bluetooth Label at x=17,y=65 */ 
     strcpy((char *) text,"BLUETOOTH");
-    oled.Label((uint8_t *)text,17,65);
+    //oled.Label((uint8_t *)text,17,65);
     
     /* Change font color to white */ 
-    textProperties.fontColor   = COLOR_WHITE;
+    /*textProperties.fontColor   = COLOR_WHITE;
     textProperties.alignParam = OLED_TEXT_ALIGN_CENTER;
-    oled.SetTextProperties(&textProperties);
+    oled.SetTextProperties(&textProperties);*/
     
     /* Display Label at x=22,y=80 */ 
     strcpy((char *) text,"Tap Below");
-    oled.Label((uint8_t *)text,22,80);
+    //oled.Label((uint8_t *)text,22,80);
 
     // txThread.start(txTask); /*Start transmitting Sensor Tag Data */
     
@@ -163,9 +191,9 @@
         counter += 1; 
         status = !kw40z_device.GetAdvertisementMode(); /*Indicate BLE Advertisment Mode*/   
         blueLed = status;
-        pc.printf("[%i] blueLed = %i\r\n",counter, status);
+        //pc.printf("[%i] blueLed = %i\r\n",counter, status);
         
-        time_t rawtime;
+        /*time_t rawtime;
         struct tm * timeinfo;
         time(&rawtime); 
         timeinfo = localtime (&rawtime);
@@ -194,7 +222,7 @@
         */
         
         // Display the time on screen
-        // oled_status_t SSD1351::TextBox(const uint8_t* text, int8_t xCrd, int8_t yCrd,uint8_t width,uint8_t height)
+        // oled_status_t SSD1351::TextBox(const uint8_t* text, int8_t xCrd, int8_t yCrd,uint8_t width,uint8_t height)*/
         oled.TextBox((uint8_t *)time_text,2,2, 91, 15); 
         oled.TextBox((uint8_t *)date_text,2,16, 91, 15); 
         redLed = !redLed;