
Interfaçage NeoPixel Ring 12, LPRO MECSE, Arnaud A.
Dependencies: lcd neoPixelRing12 view2 BSP_DISCO_F746NG view1 button
Diff: main.cpp
- Revision:
- 16:a5bfabe7c884
- Parent:
- 15:567aecbdc323
- Child:
- 17:60720d5cb48f
--- a/main.cpp Tue Jun 23 10:33:13 2020 +0000 +++ b/main.cpp Wed Jun 24 19:08:56 2020 +0000 @@ -8,6 +8,7 @@ #include "stm32746g_discovery_ts.h" #include "lcd/lcd.h" #include "view2/view2.h" +#include "rtos.h" #include <list> #define SCREENWIDTH 480 #define SCREENHEIGHT 272 @@ -20,8 +21,10 @@ View2 v2; TS_StateTypeDef TS_State; char RGBmap[12][7]; +Thread t1; +Thread t2; -int main() +/*int main() { disco.initLCD(); @@ -47,6 +50,44 @@ 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; + } + }else{ + v2.updateLCD(); + v1.setViewChanged(!v2.getViewChanged()); + } + Thread::wait(1); + } +} + +void leds() { + while (true) { + t2.signal_set(0x1); + Thread::signal_wait(0x1); + Thread::wait(1000); + } +} + +int main() { + npr.setLights(12, "000000"); + disco.initLCD(); + v1.initView(); + v2.initView(); + t1.start(ui); + t2.start(leds); + Thread::wait(osWaitForever); } + +