
Interfaçage NeoPixel Ring 12, LPRO MECSE, Arnaud A.
Dependencies: lcd neoPixelRing12 view2 BSP_DISCO_F746NG view1 button
Diff: main.cpp
- Revision:
- 13:0708365334c4
- Parent:
- 9:89d39fc98b17
- Child:
- 14:7b74ad030896
--- 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); }