Interfaçage NeoPixel Ring 12, LPRO MECSE, Arnaud A.

Dependencies:   lcd neoPixelRing12 view2 BSP_DISCO_F746NG view1 button

Revision:
14:7b74ad030896
Parent:
13:0708365334c4
Child:
15:567aecbdc323
--- a/main.cpp	Wed Jun 17 16:34:21 2020 +0000
+++ b/main.cpp	Mon Jun 22 21:56:12 2020 +0000
@@ -2,50 +2,50 @@
 #include "Thread.h"
 #include "rtos_idle.h"
 #include "mbed_critical.h"
-#include "neoPixelRing12.h"
-#include "view.h"
+#include "neoPixelRing12/neoPixelRing12.h"
+#include "view1.h"
 #include "stm32746g_discovery_lcd.h"
 #include "stm32746g_discovery_ts.h"
 #include "lcd/lcd.h"
+#include "view2/view2.h"
 #include <list>
 #define SCREENWIDTH 480
 #define SCREENHEIGHT 272
  
 #define  USE_CRITICAL_SECTION_LOCK      1   // Set 0 to see race condition
 
-uint8_t text[30];
-DigitalOut myled(D8);
-DigitalOut led1(LED1);
 NeoPixelRing12 npr(D8);
 LCD disco;
-View v;
+View1 v1;
+View2 v2;
+TS_StateTypeDef TS_State;
+char RGBmap[12][7];
 
 int main()
 {
     
     disco.initLCD();
-    v.initView();
-    
-    //lcd->initLCD();
+    v1.initView();
+    v2.initView();
+    npr.setLights(12, "000000");
+    CriticalSectionLock  lock;
+    //npr.setLights(12, "000000");
+    npr.ironManRepulsorBlastAnimations();
+    CriticalSectionLock  unlock;
     while(1){
-        v.updateLCD();  
-    } 
-    //*************************************************
-     int i=0;
-        //CriticalSectionLock  lock;
-        //bit0();
-        //CriticalSectionLock  unlock;
-        
-        //Une led à 0 avant d'envoyer la trame pour éviter
-        //le bug de trame
-        npr.setLights(1, "ff0000");
-        npr.rst();
-        //la trame
-        npr.setLights(5, "00ff00");
-        npr.setLights(2, "ff0000");
-        npr.setLights(4, "0000ff");
-        npr.rst();
-        wait(100.0);
+        if(!v1.getViewChanged()){
+            v1.updateLCD();  
+            if(v1.getSetNewColorEnabled()){
+                v1.getRGBmap(RGBmap);
+                CriticalSectionLock  lock;
+                npr.setLights(RGBmap);
+                CriticalSectionLock  unlock;
+            }
+        }else{
+            v2.updateLCD();
+            v1.setViewChanged(!v2.getViewChanged());
+        }
+    }
 }