for thww WS2811 RGB

Files at this revision

API Documentation at this revision

Comitter:
Drohne
Date:
Sat Jun 25 18:53:38 2016 +0000
Parent:
2:ccf3f0c36dae
Commit message:
ads

Changed in this revision

WS2811.cpp Show annotated file Show diff for this revision Revisions of this file
WS2811.h Show annotated file Show diff for this revision Revisions of this file
--- a/WS2811.cpp	Fri Apr 29 07:46:25 2016 +0000
+++ b/WS2811.cpp	Sat Jun 25 18:53:38 2016 +0000
@@ -9,7 +9,7 @@
 
 uint8_t ledmatrix[LED_MAX][3];
 
-DigitalOut myled(p20);
+DigitalOut myled(P0_22);
 
 void writeled(int pos, uint8_t g, uint8_t r, uint8_t b){    // define the register
     ledmatrix[pos][0] = g;      // green register
@@ -35,7 +35,7 @@
 }
 
 void sendColours(int pos, uint8_t r, uint8_t g, uint8_t b){
-    __disable_irq;          // disable interrupt to speed up
+    //__disable_irq;          // disable interrupt to speed up
             writeled(pos, g, r, b);     // call the underprogramm
     
     for(int led = 0; led < LED_MAX; led++){     // write the matrix on the RGBs
@@ -46,36 +46,5 @@
         }
     }
     wait(DELAY);        // wait for the supply voltage
-    __enable_irq;          // enable interrupt pin for the basic uses
-}
-
-void clear(){     // set all RGBs off
-        sendColours(0, 0, 0, 0);
-        sendColours(1, 0, 0, 0);
-        sendColours(2, 0, 0, 0); 
-        wait_ms(OFF_DELAY);
-}
-
-void runlight(float waittime){
-        sendColours(0, 100, 0, 0);
-        wait(waittime);
-        sendColours(1, 0, 100, 0);  
-        wait(waittime);  
-        sendColours(2, 0, 0, 100);
-        wait(waittime);
-        //clear();
-        sendColours(0, 0, 0, 100);
-        wait(waittime);
-        sendColours(1, 100, 0, 0);
-        wait(waittime);
-        sendColours(2, 0, 100, 0);
-        wait(waittime);
-        //clear();
-        sendColours(0, 0, 100, 0);
-        wait(waittime);
-        sendColours(1, 0, 0, 100);
-        wait(waittime);
-        sendColours(2, 100, 0, 0);
-        wait(waittime);
-        //clear();
+   // __enable_irq;          // enable interrupt pin for the basic uses
 }
\ No newline at end of file
--- a/WS2811.h	Fri Apr 29 07:46:25 2016 +0000
+++ b/WS2811.h	Sat Jun 25 18:53:38 2016 +0000
@@ -1,8 +1,8 @@
 /*
 *           Creator: Matthias Hemmer
-*           created: 15.04.2016
-*       Board: Himbed v.2 Bulme
-*       Processor: Cortex M0       
+*           created: 22.06.2016
+*       Board: Himbed M0+
+*       Processor: LPC11U68       
 *
 *   function: write a register of 8 bits to the WS2811 RGBs 
 *   
@@ -16,8 +16,14 @@
 
 #define HIGH_SIGNAL 4       // Logic 1
 #define LOW_SIGNAL 1        // Logic 0
-#define DELAY 0.000000000001          
-#define LED_MAX 57           // define the RGBs you have
+#define DELAY 0.0000000000001   
+
+////////////////////       
+#define LED_MAX 60//           // switch the value for your number of pixels
+////////////////////
+#define middle 29//           // define the mid of the pixels: to make it work middle-1
+///////////////////
+
 #define OFF_DELAY 0.001
 
 // define a cleary blue light
@@ -25,6 +31,4 @@
 #define Red     255
 #define Blue    125
 
-void sendColours(int pos, uint8_t r, uint8_t g, uint8_t b);
-void clear();
-void runlight(float waittime);
\ No newline at end of file
+void sendColours(int pos, uint8_t r, uint8_t g, uint8_t b);
\ No newline at end of file