
Interfaçage NeoPixel Ring 12, LPRO MECSE, Arnaud A.
Dependencies: lcd neoPixelRing12 view2 BSP_DISCO_F746NG view1 button
main.cpp
- Committer:
- Rhamao
- Date:
- 2020-06-23
- Revision:
- 15:567aecbdc323
- Parent:
- 14:7b74ad030896
- Child:
- 16:a5bfabe7c884
File content as of revision 15:567aecbdc323:
#include "mbed.h" #include "Thread.h" #include "rtos_idle.h" #include "mbed_critical.h" #include "neoPixelRing12/neoPixelRing12.h" #include "view1.h" #include "stm32746g_discovery_lcd.h" #include "stm32746g_discovery_ts.h" #include "lcd/lcd.h" #include "view2/view2.h" #include <list> #define SCREENWIDTH 480 #define SCREENHEIGHT 272 #define USE_CRITICAL_SECTION_LOCK 1 // Set 0 to see race condition NeoPixelRing12 npr(D8); LCD disco; View1 v1; View2 v2; TS_StateTypeDef TS_State; char RGBmap[12][7]; 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()); } } }