Template automate NUCLEO 446RE

Dependencies:   C12832-font

Files at this revision

API Documentation at this revision

Comitter:
gr91
Date:
Mon Nov 16 17:48:01 2020 +0000
Parent:
1:fb8116164c8f
Commit message:
Template automate NUCLEO 446RE

Changed in this revision

C12832-font.lib Show annotated file Show diff for this revision Revisions of this file
ihm_L476_full.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r fb8116164c8f -r 51380e17562c C12832-font.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832-font.lib	Mon Nov 16 17:48:01 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/SNE-S1S2-prime/code/C12832-font/#b0a871f340ed
diff -r fb8116164c8f -r 51380e17562c ihm_L476_full.lib
--- a/ihm_L476_full.lib	Tue May 12 17:48:44 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://os.mbed.com/teams/IUT-CACHAN-GE1/code/ihm_L476_full/#e9777c284d79
diff -r fb8116164c8f -r 51380e17562c main.cpp
--- a/main.cpp	Tue May 12 17:48:44 2020 +0000
+++ b/main.cpp	Mon Nov 16 17:48:01 2020 +0000
@@ -1,23 +1,35 @@
 //Université Paris-Saclay - IUT de Cachan
-//SNE S1 Prime   GR DP mai 2020
+//SNE S2 Prime   GR DP nov 2020
 //***********************************************//
-//#include "mbed.h"  // commenté car présent dans l'include ihm
-#include "ihm_L476.h"
-DigitalIn BPC (PA_0,PullNone) ;  // bouton centre
-DigitalOut LG (PE_8) ;  // led verte
-DigitalOut LR (PB_2) ;  // led rouge
-IHM_L476 ihm;
+#include "mbed.h"
+#include "C12832.h"
+C12832 lcd(D11, D13, D12, D7, D10);
+Ticker horloge_automate;
+//
+DigitalIn BPC (D4) ;  // bouton centre
+DigitalOut LG (D9) ;  // led verte
+DigitalOut LR (D5) ;  // led rouge
 
 // prototype et variables globales et constantes
 void automate(void);
+int horloge_automate_flag=0;
+
+void horloge_automate_isr(void)
+{
+    horloge_automate_flag=1;
+}
 //
 int main()
 {
-    ihm.LCD_printf("AUTO1");
-    // début de l'application
+    horloge_automate.attach(&horloge_automate_isr,0.1);
+    lcd.cls();          
+    lcd.locate(0,3);    
+    lcd.printf("Automate");
     while(1) {
-        wait(0.2);  //c'est la clock (5 Hz)
-        automate(); // ce qui se produit sur top de clock
+        if(horloge_automate_flag) {
+            automate();
+            horloge_automate_flag=0;
+        }
     }
 }
 void automate(void)
@@ -47,17 +59,20 @@
     // valeurs des  sorties en fonction de l'état actuel
     switch(etat_actuel) {
         case etat0 :
-            ihm.BAR_set(0);
+            lcd.locate(0,12);
+            lcd.printf("Etat 0");
             LG=1;
             LR=1;
             break;
         case etat1 :
-            ihm.BAR_set(1);
+            lcd.locate(0,12);
+            lcd.printf("Etat 1");
             LG=0;
             LR=1;
             break;
         case etat2 :
-            ihm.BAR_set(2);
+            lcd.locate(0,12);
+            lcd.printf("Etat 2");
             LG=1;
             LR=0;
             break;