affichage calendrier

Dependencies:   F746_GUI mbed

Files at this revision

API Documentation at this revision

Comitter:
altaber
Date:
Mon Jun 07 08:09:48 2021 +0000
Commit message:
calendrier

Changed in this revision

F746_GUI.lib Show annotated file Show diff for this revision Revisions of this file
fonction.cpp Show annotated file Show diff for this revision Revisions of this file
fonction.h Show annotated file Show diff for this revision Revisions of this file
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
diff -r 000000000000 -r c2359ca01ec0 F746_GUI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/F746_GUI.lib	Mon Jun 07 08:09:48 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/MikamiUitOpen/code/F746_GUI/#50b8f7654c36
diff -r 000000000000 -r c2359ca01ec0 fonction.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fonction.cpp	Mon Jun 07 08:09:48 2021 +0000
@@ -0,0 +1,38 @@
+ 
+/**                                                                                                                                                          
+ * C++ version 0.4 char* style "itoa":                                                                                                                       
+ * Written by Lukás Chmela                                                                                                                                   
+ * Released under GPLv3.                                                                                                                                     
+*/
+ 
+char* itoa(int value, char* result, int base)                                                                                                          
+{                                                                                                                                                        
+    // check that the base if valid                                                                                                                      
+    if ( base < 2 || base > 36 ) {                                                                                                                       
+        *result = '\0';                                                                                                                                  
+        return result;                                                                                                                                   
+    }                                                                                                                                                    
+ 
+    char* ptr = result, *ptr1 = result, tmp_char;                                                                                                        
+    int tmp_value;                                                                                                                                       
+ 
+    do {                                                                                                                                                 
+        tmp_value = value;                                                                                                                               
+        value /= base;                                                                                                                                   
+        *ptr++ = "zyxwvutsrqponmlkjihgfedcba9876543210123456789abcdefghijklmnopqrstuvwxyz"[35 + (tmp_value - value * base)];                             
+    } while ( value );                                                                                                                                   
+ 
+    // Apply negative sign                                                                                                                               
+    if ( tmp_value < 0 )                                                                                                                                 
+    *ptr++ = '-';                                                                                                                                    
+    *ptr-- = '\0';                                                                                                                                       
+ 
+    while ( ptr1 < ptr ) {                                                                                                                               
+    tmp_char = *ptr;                                                                                                                                 
+    *ptr-- = *ptr1;                                                                                                                                  
+    *ptr1++ = tmp_char;                                                                                                                              
+    }                                                                                                                                                    
+ 
+    return result;                                                                                                                                       
+}
+ 
\ No newline at end of file
diff -r 000000000000 -r c2359ca01ec0 fonction.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fonction.h	Mon Jun 07 08:09:48 2021 +0000
@@ -0,0 +1,3 @@
+
+
+char* itoa(int value, char* result, int base) ;
\ No newline at end of file
diff -r 000000000000 -r c2359ca01ec0 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jun 07 08:09:48 2021 +0000
@@ -0,0 +1,113 @@
+#include <mbed.h>
+#include "F746_GUI.hpp"
+
+#include "fonction.h"
+
+
+int main(void)
+{
+    int h=23; // je mets la valeur de l'angle
+    
+    Label obj10(240, 2, "SEXTANT: Altaber Perez", Label::CENTER, Font16);
+    
+// JOUR DE L ANNEE _________________________________________________________________
+
+    const int NUMBER_BUTTONS1 = 31;
+    const string STR1[NUMBER_BUTTONS1] = {"01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"};
+    ButtonGroup Jour(15 ,30, 15, 15,  NUMBER_BUTTONS1, STR1, 2, 2, 11, 1,
+                        Font12, LCD_COLOR_WHITE, 0xFF003538, 0xFFB70068, 0xFFFF7FFF);
+    Label obj11(2, 7, "Jour", Label::LEFT, Font16);
+    
+// MOIS DE L ANNEE _________________________________________________________________
+
+    Label obj12(2, 110, "Mois", Label::LEFT, Font16);    
+    
+    const int NUMBER_BUTTONS2 = 12;
+    const string STR2[NUMBER_BUTTONS2] = {"Jan", "Fev", "Mar", "Avr","Mai", "Juin","Juill","Aou","Sep","Oct","Nov","Dec"};
+    ButtonGroup Mois(10,130, 40, 20,  NUMBER_BUTTONS2, STR2, 2, 2, 6, 1,
+                        Font12, LCD_COLOR_WHITE, 0xFF003538, 0xFFB70068, 0xFFFF7FFF);
+
+
+// HEURE ___________________________________________________________________________
+
+    Label obj13(270, 35, "Heure    minutes", Label::LEFT, Font16);
+    const int NUMBER_BUTTONS3 = 23;
+    const string STR3[NUMBER_BUTTONS3] = {"01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"};
+    ButtonGroup Heure(270, 60, 15, 15,  NUMBER_BUTTONS3, STR3, 2, 2,5, 1,
+                        Font12, LCD_COLOR_WHITE, 0xFF003538, 0xFFB70068, 0xFFFF7FFF);
+                        
+    Label obj14(2, 7, "Jour", Label::LEFT, Font16);
+    const int NUMBER_BUTTONS4 = 60;
+    const string STR4[NUMBER_BUTTONS4] = {"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"};
+    ButtonGroup Minutes(360, 60, 15, 15,  NUMBER_BUTTONS4, STR4, 2, 2, 7, 1,
+                        Font12, LCD_COLOR_WHITE, 0xFF003538, 0xFFB70068, 0xFFFF7FFF);
+    
+
+//OK______________________________________________________
+    Button valide(360, 224, 50, 30, "Valider");
+
+
+ while (true)
+    {
+        int num=0;
+        int a=0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12;
+        int mois;
+        int jour;
+        int heure;
+        int minute;
+        if (Jour.GetTouchedNumber(a)) {
+            jour=Jour.GetTouchedNumber()+1;} 
+        if (Heure.GetTouchedNumber(a)) {
+            heure= Heure.GetTouchedNumber();}  
+        if (Minutes.GetTouchedNumber(a)) {
+            minute= Minutes.GetTouchedNumber();} 
+        if (Mois.GetTouchedNumber(a)){
+            mois=Mois.GetTouchedNumber()+1;} 
+        if (valide.Touched()==true){
+            if (mois==1){
+                num=jour;}
+            if (mois==2){
+                num=jour+31;}
+            if (mois==3){
+                num=jour+59;}
+            if (mois==4){
+                num=jour+90;}
+            if (mois==5){
+                num=jour+120;}
+            if (mois==6){
+                num=jour+151;}
+            if (mois==7){
+                num=jour+182;}
+            if (mois==8){
+                num=jour+212;}
+            if (mois==9){
+                num=jour+243;}
+            if (mois==10){
+                num=jour+273;}
+            if (mois==11){
+                num=jour+304;}
+            if (mois==12){
+                num=jour+334;}
+            float declinaison=asin(sin(23.45*(3.141592/180))*sin(((360/365.25)*(num-79))*(3.141592/180)));
+            declinaison= (180/3.141592)*declinaison;
+            int latitude= 90+declinaison-h;
+            char lat[16];
+            char dec[16];
+            char j[16];
+            char m[16];
+            itoa(latitude, lat, 10); 
+            itoa(declinaison, dec, 10); 
+            itoa(num,j, 10); 
+            itoa(mois,m, 10);             
+            BSP_LCD_Clear(LCD_COLOR_DARKBLUE);
+            Label obj15(240, 2, "SEXTANT: Altaber Perez", Label::CENTER, Font16);
+            Label obj16(100, 100, "latitude = ", Label::LEFT, Font16);
+            Label obj17(220, 100, lat, Label::LEFT, Font16);
+            Label obj18(100, 130, dec, Label::LEFT, Font16);
+            Label obj19(100, 170, j, Label::LEFT, Font16);
+            Label obj20(100, 200, m, Label::LEFT, Font16);
+        wait(0.02f);
+
+        }
+    }
+}
diff -r 000000000000 -r c2359ca01ec0 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jun 07 08:09:48 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file