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

Dependencies:   lcd neoPixelRing12 view2 BSP_DISCO_F746NG view1 button

Revision:
17:60720d5cb48f
Parent:
16:a5bfabe7c884
--- a/main.cpp	Wed Jun 24 19:08:56 2020 +0000
+++ b/main.cpp	Tue Jun 30 23:32:43 2020 +0000
@@ -24,43 +24,12 @@
 Thread t1;
 Thread t2;
 
-/*int main()
-{
-    
-    disco.initLCD();
-    v1.initView();
-    v2.initView();
-    npr.setLights(12, "000000");
-    CriticalSectionLock  lock;
-    //npr.setLights(12, "000000");
-    while(1)
-        npr.rainbowAnimations();
-    CriticalSectionLock  unlock;
-    while(1){
-        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());
-        }
-    }
-}*/
-
 void ui() {
     while (true) {
         if(!v1.getViewChanged()){
             v1.updateLCD();  
             if(v1.getSetNewColorEnabled()){
-                v1.getRGBmap(RGBmap);
-                CriticalSectionLock  lock;
-                npr.setLights(RGBmap);
-                CriticalSectionLock  unlock;
+                t2.signal_set(0x1);
             }
         }else{
             v2.updateLCD();
@@ -72,9 +41,12 @@
  
 void leds() {
     while (true) {
-        t2.signal_set(0x1);
-        Thread::signal_wait(0x1);
-        Thread::wait(1000);
+        //Set la couleur des LEDS configurés sur la view1
+        Thread::signal_wait(0x1, osWaitForever);
+        v1.getRGBmap(RGBmap);
+        CriticalSectionLock  lock;
+        npr.setLights(RGBmap);
+        CriticalSectionLock  unlock;
     }
 }