diff --git a/.cproject b/.cproject index a6b3e75..0a729c4 100644 --- a/.cproject +++ b/.cproject @@ -155,7 +155,7 @@ - + @@ -172,7 +172,7 @@ - + diff --git a/App/App.cpp b/App/App.cpp index 7f73ba0..0d76864 100644 --- a/App/App.cpp +++ b/App/App.cpp @@ -41,6 +41,7 @@ inline uint16_t rr(uint16_t top) uint16_t ChoosePixel() { +#ifndef DBG_CHOSEN_PIXEL volatile uint16_t chosen; uint16_t spi; @@ -52,6 +53,9 @@ uint16_t ChoosePixel() } } while(spi < NUMSPARKLES); return chosen; +#else + return DBG_CHOSEN_PIXEL; +#endif // DBG_CHOSEN_PIXEL } void StartSparkle( Sparkle &s ) @@ -68,9 +72,12 @@ extern "C" void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi) extern "C" void App() { - g_ledBits[sizeof(g_ledBits)-1] = 0; - memset(g_pixels, 0, sizeof(g_pixels)); - uint32_t lastTick = HAL_GetTick() - FRAMETIME; + g_spibuffer[sizeof(g_spibuffer)-1] = 0; + + for(uint16_t px = 0; px < NUMPIXELS; ++px) + g_pixels[px] = Pixel( DEFAULT_COLOR ); + + uint32_t lastTick = HAL_GetTick(); while(1) { @@ -86,11 +93,11 @@ extern "C" void App() } HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13); - convert((uint8_t*)g_pixels, g_ledBits, sizeof(g_pixels)); + convert((uint8_t*)g_pixels, g_spibuffer, sizeof(g_pixels)); HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13); g_done = false; - HAL_SPI_Transmit_DMA(&hspi1, g_ledBits, sizeof(g_ledBits)); + HAL_SPI_Transmit_DMA(&hspi1, g_spibuffer, sizeof(g_spibuffer)); while(!g_done); HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13); } diff --git a/App/Config.h b/App/Config.h index 1fb417c..31b12ce 100644 --- a/App/Config.h +++ b/App/Config.h @@ -8,7 +8,16 @@ #ifndef CONFIG_H_ #define CONFIG_H_ -#define NUMPIXELS 144 -#define NUMSPARKLES (NUMPIXELS/12) +//#define DBG_CHOSEN_PIXEL 2 + +#ifndef DBG_CHOSEN_PIXEL +# define NUMPIXELS 144 +# define NUMSPARKLES (NUMPIXELS/12+1) +#else +# define NUMPIXELS 6 +# define NUMSPARKLES 1 +#endif + #define FRAMETIME 20 +#define DEFAULT_COLOR 0,0,0 #endif /* CONFIG_H_ */ diff --git a/App/LedBuffers.cpp b/App/LedBuffers.cpp index 2c07eec..6268c2f 100644 --- a/App/LedBuffers.cpp +++ b/App/LedBuffers.cpp @@ -7,7 +7,7 @@ #include "LedBuffers.h" Pixel_t g_pixels[NUMPIXELS]; -uint8_t g_ledBits[sizeof(g_pixels) * 8 / 2 + 1]; +uint8_t g_spibuffer[sizeof(g_pixels) * 8 / 2 + 1]; diff --git a/App/LedBuffers.h b/App/LedBuffers.h index bf6cdff..df32021 100644 --- a/App/LedBuffers.h +++ b/App/LedBuffers.h @@ -12,6 +12,6 @@ #include "Pixel.h" extern Pixel_t g_pixels[NUMPIXELS]; -extern uint8_t g_ledBits[sizeof(g_pixels) * 8 / 2 + 1]; +extern uint8_t g_spibuffer[sizeof(g_pixels) * 8 / 2 + 1]; #endif /* LEDBUFFERS_H_ */ diff --git a/NeoPixelF103MVP Debug.launch b/NeoPixelF103MVP Debug.launch new file mode 100644 index 0000000..f7ecac3 --- /dev/null +++ b/NeoPixelF103MVP Debug.launch @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/NeoPixelF103MVP Release.launch b/NeoPixelF103MVP Release.launch new file mode 100644 index 0000000..dc86ccb --- /dev/null +++ b/NeoPixelF103MVP Release.launch @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +