wip: image display

Signed-off-by: Thomas Schmid <tom@binary-kitchen.de>
This commit is contained in:
Thomas 2022-06-27 01:53:46 +02:00
parent 68f3dcad09
commit 7d19b90cba
7 changed files with 66 additions and 1 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
firmware/assets/out.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -29,4 +29,10 @@ struct FackelApp: public App {
void init();
void deinit();
void loop();
};
struct ImageDisplayApp: public App {
void init();
void deinit();
void loop();
};

Binary file not shown.

View 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();
}

View File

@ -15,11 +15,13 @@ struct FFTTestApp fft_test_app
struct FackelApp fackel_app
{
};
struct ImageDisplayApp image_display {};
std::vector<std::reference_wrapper<App>> apps = {
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;