forked from buddhabrot/fusion-zauberstab
wip: image display
Signed-off-by: Thomas Schmid <tom@binary-kitchen.de>
This commit is contained in:
parent
68f3dcad09
commit
7d19b90cba
BIN
firmware/assets/-grayout.bin
Normal file
BIN
firmware/assets/-grayout.bin
Normal file
Binary file not shown.
BIN
firmware/assets/Fusion_Font.png
Normal file
BIN
firmware/assets/Fusion_Font.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
firmware/assets/out.png
Normal file
BIN
firmware/assets/out.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -30,3 +30,9 @@ struct FackelApp: public App {
|
|||||||
void deinit();
|
void deinit();
|
||||||
void loop();
|
void loop();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ImageDisplayApp: public App {
|
||||||
|
void init();
|
||||||
|
void deinit();
|
||||||
|
void loop();
|
||||||
|
};
|
BIN
firmware/src/applications/fusion_font.bin
Normal file
BIN
firmware/src/applications/fusion_font.bin
Normal file
Binary file not shown.
57
firmware/src/applications/image_display.cpp
Normal file
57
firmware/src/applications/image_display.cpp
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#include "app.h"
|
||||||
|
#include "zauberstab.h"
|
||||||
|
|
||||||
|
#define __stringify_1(x) #x
|
||||||
|
#define __stringify(x) __stringify_1(x)
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
asm(
|
||||||
|
".macro inc_sample name, filename\n\t"
|
||||||
|
".pushsection .rodata\n\t"
|
||||||
|
"\\name:\n\t"
|
||||||
|
".incbin \"\\filename\"\n\t"
|
||||||
|
"\\name\\()_size:\n\t"
|
||||||
|
".int \\name\\()_size - \\name\n\t"
|
||||||
|
".popsection\n\t"
|
||||||
|
".endm\n\t"
|
||||||
|
);
|
||||||
|
|
||||||
|
#define incbin(label, filename) \
|
||||||
|
asm("inc_sample " __stringify(label) ", " filename "\n\t"); \
|
||||||
|
extern const unsigned char label[]; \
|
||||||
|
extern const unsigned int label##_size; \
|
||||||
|
|
||||||
|
|
||||||
|
incbin(fusion_font, "C:/Users/Binarykitchen/Documents/tom/fusion-zauberstab/firmware/src/applications/fusion_font.bin")
|
||||||
|
}
|
||||||
|
|
||||||
|
static CRGB get_pixel(unsigned int x, unsigned int y, unsigned int sx, const unsigned char *data) {
|
||||||
|
unsigned int idx = (x + y * sx) * 3;
|
||||||
|
|
||||||
|
CRGB color{};
|
||||||
|
color.r = data[idx];
|
||||||
|
color.g = data[idx + 1];
|
||||||
|
color.b = data[idx + 2];
|
||||||
|
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageDisplayApp::init() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageDisplayApp::deinit() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageDisplayApp::loop() {
|
||||||
|
static unsigned int col = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i< NUM_LEDS; i++) {
|
||||||
|
leds[i] = get_pixel(col, i, 218, fusion_font);
|
||||||
|
}
|
||||||
|
col++;
|
||||||
|
col = col % 218;
|
||||||
|
FastLED.show();
|
||||||
|
}
|
@ -15,11 +15,13 @@ struct FFTTestApp fft_test_app
|
|||||||
struct FackelApp fackel_app
|
struct FackelApp fackel_app
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
struct ImageDisplayApp image_display {};
|
||||||
|
|
||||||
|
|
||||||
std::vector<std::reference_wrapper<App>> apps = {
|
std::vector<std::reference_wrapper<App>> apps = {
|
||||||
std::ref<App>(beat_detect_app),
|
std::ref<App>(beat_detect_app),
|
||||||
std::ref<App>(fackel_app)
|
std::ref<App>(fackel_app),
|
||||||
|
std::ref<App>(image_display),
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned int current_app = 0;
|
static unsigned int current_app = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user