Arnaud Apelbaum / Mbed OS Led_circle

Dependencies:   lcd neoPixelRing12 view2 BSP_DISCO_F746NG view1 button

Files at this revision

API Documentation at this revision

Comitter:
Rhamao
Date:
Wed Jun 17 16:34:21 2020 +0000
Parent:
12:0217d269545e
Child:
14:7b74ad030896
Commit message:
View 1 finie

Changed in this revision

NeoPixelRing12/NeoPixelRing12.cpp Show diff for this revision Revisions of this file
NeoPixelRing12/NeoPixelRing12.h Show diff for this revision Revisions of this file
button.lib Show annotated file Show diff for this revision Revisions of this file
lcd.lib 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
neoPixelRing12.lib Show annotated file Show diff for this revision Revisions of this file
view.lib Show annotated file Show diff for this revision Revisions of this file
view2.lib Show annotated file Show diff for this revision Revisions of this file
--- a/NeoPixelRing12/NeoPixelRing12.cpp	Wed Jun 17 14:05:49 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-#include "NeoPixelRing12.h"
-#include "mbed.h"
-#include "string.h"
-
-NeoPixelRing12::NeoPixelRing12(DigitalOut _digitalOutPin):digitalOutPin(_digitalOutPin)
-{
-}
-
-bool NeoPixelRing12::rst( )
-{
-        digitalOutPin=0;
-        wait_us(RST_TIME_IN_US);
-        return true;
-}
-
-bool NeoPixelRing12::rgbToDataStructure(char* rgbCode){
-    uint8_t i = 0; 
-    uint8_t offset = 0; 
-    
-    //Red
-    for (i=0; i<6; i++) { 
-        if(i==0)
-            offset=11;
-        if(i==1)
-            offset=15;
-        if(i==2)
-            offset=3;
-        if(i==3)
-            offset=7;
-        if(i==4)
-            offset=19;
-        if(i==5)
-            offset=23; 
-        switch (rgbCode[i]) { 
-        case '0': 
-            //////////cout << "0000"; 
-            rgbDataStructure[offset]=false;
-            rgbDataStructure[offset-1]=false;
-            rgbDataStructure[offset-2]=false;
-            rgbDataStructure[offset-3]=false;          
-            break; 
-        case '1': 
-            ////////////////////cout << "0001"; 
-            rgbDataStructure[offset]=true;
-            rgbDataStructure[offset-1]=false;
-            rgbDataStructure[offset-2]=false;
-            rgbDataStructure[offset-3]=false; 
-            break; 
-        case '2': 
-            ////////cout << "0010"; 
-            rgbDataStructure[offset]=false;
-            rgbDataStructure[offset-1]=true;
-            rgbDataStructure[offset-2]=false;
-            rgbDataStructure[offset-3]=false; 
-            break; 
-        case '3': 
-            ////////cout << "0011"; 
-            rgbDataStructure[offset]=true;
-            rgbDataStructure[offset-1]=true;
-            rgbDataStructure[offset-2]=false;
-            rgbDataStructure[offset-3]=false; 
-            break; 
-        case '4': 
-            ////////cout << "0100"; 
-            rgbDataStructure[offset]=false;
-            rgbDataStructure[offset-1]=false;
-            rgbDataStructure[offset-2]=true;
-            rgbDataStructure[offset-3]=false; 
-            break; 
-        case '5': 
-            ////////cout << "0101"; 
-            rgbDataStructure[offset]=true;
-            rgbDataStructure[offset-1]=false;
-            rgbDataStructure[offset-2]=true;
-            rgbDataStructure[offset-3]=false; 
-            break; 
-        case '6': 
-            ////////cout << "0110"; 
-            rgbDataStructure[offset]=false;
-            rgbDataStructure[offset-1]=true;
-            rgbDataStructure[offset-2]=true;
-            rgbDataStructure[offset-3]=false; 
-            break; 
-        case '7': 
-            ////////cout << "0111"; 
-            rgbDataStructure[offset]=true;
-            rgbDataStructure[offset-1]=true;
-            rgbDataStructure[offset-2]=true;
-            rgbDataStructure[offset-3]=false; 
-            break; 
-        case '8': 
-            ////////cout << "1000"; 
-            rgbDataStructure[offset]=false;
-            rgbDataStructure[offset-1]=false;
-            rgbDataStructure[offset-2]=false;
-            rgbDataStructure[offset-3]=true;  
-            break; 
-        case '9': 
-            ////////cout << "1001"; 
-            rgbDataStructure[offset]=true;
-            rgbDataStructure[offset-1]=false;
-            rgbDataStructure[offset-2]=false;
-            rgbDataStructure[offset-3]=true;  
-            break; 
-        case 'A': 
-        case 'a': 
-            ////////cout << "1010"; 
-            rgbDataStructure[offset]=false;
-            rgbDataStructure[offset-1]=true;
-            rgbDataStructure[offset-2]=false;
-            rgbDataStructure[offset-3]=true;  
-            break; 
-        case 'B': 
-        case 'b': 
-            ////////cout << "1011"; 
-            rgbDataStructure[offset]=true;
-            rgbDataStructure[offset-1]=true;
-            rgbDataStructure[offset-2]=false;
-            rgbDataStructure[offset-3]=true;  
-            break; 
-        case 'C': 
-        case 'c': 
-            ////////cout << "1100"; 
-            rgbDataStructure[offset]=false;
-            rgbDataStructure[offset-1]=false;
-            rgbDataStructure[offset-2]=true;
-            rgbDataStructure[offset-3]=true;  
-            break; 
-        case 'D': 
-        case 'd': 
-            ////////cout << "1101"; 
-            rgbDataStructure[offset]=true;
-            rgbDataStructure[offset-1]=false;
-            rgbDataStructure[offset-2]=true;
-            rgbDataStructure[offset-3]=true; 
-            break; 
-        case 'E': 
-        case 'e': 
-            ////////cout << "1110"; 
-            rgbDataStructure[offset]=false;
-            rgbDataStructure[offset-1]=true;
-            rgbDataStructure[offset-2]=true;
-            rgbDataStructure[offset-3]=true;  
-            break; 
-        case 'F': 
-        case 'f': 
-            ////////cout << "1111"; 
-            rgbDataStructure[offset]=true;
-            rgbDataStructure[offset-1]=true;
-            rgbDataStructure[offset-2]=true;
-            rgbDataStructure[offset-3]=true;  
-            break; 
-        default: 
-            return false;
-        } 
-    }
-    return true;   
-}
-
-bool NeoPixelRing12::bit(bool value){
-    if(!value){
-        digitalOutPin = 1; 
-        wait_ns(190); 
-        digitalOutPin = 0;
-        wait_ns(740);
-    }
-    else{
-        digitalOutPin = 1; 
-        wait_ns(600); 
-        digitalOutPin = 0;
-        wait_ns(600);
-    }
-    return true;
-}
-
-bool NeoPixelRing12::setLights(int nbOfLeds, char* rgbCode){
-    rgbToDataStructure(rgbCode);
-    for(int i=0; i<nbOfLeds; i++){
-        for(int y=0; y<24; y++){
-            bit(rgbDataStructure[y]);
-        }
-    }
-    return true;
-}
-
-
--- a/NeoPixelRing12/NeoPixelRing12.h	Wed Jun 17 14:05:49 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#ifndef NEO_PIXEL_RING_12
-#define NEO_PIXEL_RING_12
- 
-#include "mbed.h"
-#include "string.h" 
-
-
-#define RST_TIME_IN_US 70
-
-class NeoPixelRing12
-{
-    public:
-        NeoPixelRing12(DigitalOut _digitalOutPin);
-        bool rst();
-        bool rgbToDataStructure(char* rgbCode);
-        bool bit(bool value);
-        bool setLights(int nbOfLeds, char* rgbCode);         
-  
-    private:
-        DigitalOut digitalOutPin;
-        bool rgbDataStructure[24];
-};
-
-#endif
\ No newline at end of file
--- a/button.lib	Wed Jun 17 14:05:49 2020 +0000
+++ b/button.lib	Wed Jun 17 16:34:21 2020 +0000
@@ -1,1 +1,1 @@
-button#c4038609e806
+button#ca859a221807
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lcd.lib	Wed Jun 17 16:34:21 2020 +0000
@@ -0,0 +1,1 @@
+lcd#8d73f4071c1a
--- a/main.cpp	Wed Jun 17 14:05:49 2020 +0000
+++ b/main.cpp	Wed Jun 17 16:34:21 2020 +0000
@@ -2,10 +2,11 @@
 #include "Thread.h"
 #include "rtos_idle.h"
 #include "mbed_critical.h"
-#include "NeoPixelRing12.h"
+#include "neoPixelRing12.h"
 #include "view.h"
 #include "stm32746g_discovery_lcd.h"
 #include "stm32746g_discovery_ts.h"
+#include "lcd/lcd.h"
 #include <list>
 #define SCREENWIDTH 480
 #define SCREENHEIGHT 272
@@ -13,52 +14,24 @@
 #define  USE_CRITICAL_SECTION_LOCK      1   // Set 0 to see race condition
 
 uint8_t text[30];
-InterruptIn button(USER_BUTTON);
 DigitalOut myled(D8);
 DigitalOut led1(LED1);
 NeoPixelRing12 npr(D8);
-char blank[7]   = "000000";
-char r[7]       = "ff0000";
-char g[7]       = "00ff00";
-char b[7]       = "0000ff";
-
-
-void bit0(){
-    myled = 1; 
-    wait_ns(190); 
-    myled = 0;
-    wait_ns(740);
-}
-
-void bit1(){
-    myled = 1; 
-    wait_ns(600); 
-    myled = 0;
-    wait_ns(600);
-}
-
-void press(){
-    led1=1;
-}
-
-void releas(){
-    npr.setLights(1, "000000");
-    npr.rst();
-    npr.setLights(12, "000000");
-    led1=true;
-}
-
+LCD disco;
+View v;
 
 int main()
 {
-    View v;
+    
+    disco.initLCD();
+    v.initView();
+    
+    //lcd->initLCD();
     while(1){
         v.updateLCD();  
     } 
     //*************************************************
      int i=0;
-     button.rise(&press);
-     button.fall(&releas);
         //CriticalSectionLock  lock;
         //bit0();
         //CriticalSectionLock  unlock;
@@ -68,9 +41,9 @@
         npr.setLights(1, "ff0000");
         npr.rst();
         //la trame
-        npr.setLights(5, r);
-        npr.setLights(2, g);
-        npr.setLights(4, b);
+        npr.setLights(5, "00ff00");
+        npr.setLights(2, "ff0000");
+        npr.setLights(4, "0000ff");
         npr.rst();
         wait(100.0);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/neoPixelRing12.lib	Wed Jun 17 16:34:21 2020 +0000
@@ -0,0 +1,1 @@
+neoPixelRing12#754bf033bd47
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/view.lib	Wed Jun 17 16:34:21 2020 +0000
@@ -0,0 +1,1 @@
+view#ebadb4efd479
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/view2.lib	Wed Jun 17 16:34:21 2020 +0000
@@ -0,0 +1,1 @@
+view2#c95a8c8c3c9b