Commit 54cc7fd3 authored by Rahix's avatar Rahix
Browse files

fix(epicardium): Make the version splash work with ctx

parent 4b900ff2
......@@ -7,9 +7,8 @@
#include "os/config.h"
#include "card10-version.h"
#include "user_core/interrupts.h"
#include "drivers/display/epic_ctx.h"
#include "gfx.h"
#include "display.h"
#include "leds.h"
#include "version-splash.h"
......@@ -19,6 +18,7 @@
#include <stdlib.h>
#include <string.h>
#include <machine/endian.h>
int main(void)
{
......@@ -32,11 +32,6 @@ int main(void)
load_config();
/*
* Version Splash
*/
const char *version_buf = CARD10_VERSION;
//LED feedback in case of dead display
epic_leds_set(11, 0, 0, 1);
epic_leds_set(12, 0, 0, 1);
......@@ -51,16 +46,31 @@ int main(void)
epic_disp_clear(0x0000);
gfx_copy_region(
&display_screen, 0, 0, 160, 80, GFX_RGB565, version_splash
);
// TODO: Use blit function here
#if BYTE_ORDER == LITTLE_ENDIAN
for (size_t i = 0; i < sizeof(epicardium_ctx_fb); i += 2) {
epicardium_ctx_fb[i] = version_splash[i + 1];
epicardium_ctx_fb[i + 1] = version_splash[i];
}
#else
memcpy(epicardium_ctx_fb, version_splash, sizeof(epicardium_ctx_fb));
#endif
if (strcmp(CARD10_VERSION, "v1.17") != 0) {
const int off = (160 - (int)strlen(version_buf) * 14) / 2;
epic_disp_print(10, 20, "Epicardium", 0xfe20, 0xfe20);
epic_disp_print(
off > 0 ? off : 0, 40, version_buf, 0xfe20, 0xfe20
);
ctx_font_size(epicardium_ctx, 20.0f);
ctx_text_baseline(epicardium_ctx, CTX_TEXT_BASELINE_BOTTOM);
ctx_rgba8(epicardium_ctx, 0xff, 0xc6, 0x00, 0xff);
ctx_text_align(epicardium_ctx, CTX_TEXT_ALIGN_CENTER);
ctx_move_to(epicardium_ctx, 80.0f, 58.0f);
ctx_text(epicardium_ctx, "Epicardium");
ctx_text_align(epicardium_ctx, CTX_TEXT_ALIGN_LEFT);
ctx_move_to(epicardium_ctx, 2.0f, 78.0f);
ctx_text(epicardium_ctx, CARD10_VERSION);
/* re-init for the first app */
disp_ctx_reinit();
}
epic_disp_update();
mxc_delay(2000000);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment