Added some debugging support
This commit is contained in:
parent
6db62d5607
commit
4d63ceced3
7 changed files with 172 additions and 11 deletions
17
App/App.cpp
17
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);
|
||||
}
|
||||
|
|
13
App/Config.h
13
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_ */
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue