Skip to content
Snippets Groups Projects
Commit db8f0f82 authored by schneider's avatar schneider
Browse files

Merge branch 'rahix/bootanimation' into 'master'

Add a boot animation to show off CTX

See merge request !494
parents 81200c2a 07c92f18
Branches
No related tags found
No related merge requests found
#include <math.h>
static const uint8_t pride_colors[6][3] = {
{ 0xe4, 0x02, 0x02 }, { 0xff, 0x8c, 0x00 }, { 0xff, 0xed, 0x00 },
{ 0x00, 0x80, 0x26 }, { 0x00, 0x4d, 0xff }, { 0x75, 0x06, 0x87 },
};
static void epic_frame(Ctx *epicardium_ctx, float frame)
{
int num_colors = sizeof(pride_colors) / sizeof(pride_colors[0]);
for (int color = 0; color < num_colors; color++) {
ctx_rgba8_stroke(
epicardium_ctx,
pride_colors[color][0],
pride_colors[color][1],
pride_colors[color][2],
0xff
);
ctx_line_width(epicardium_ctx, 10.0);
ctx_line_cap(epicardium_ctx, CTX_CAP_ROUND);
float width =
expf(-pow(frame / 2.0 - 5 + color / 2.0, 2)) * 55.0 +
5.0;
float ypos = color * 10.0 + 40.0 - (num_colors - 1) * 5.0;
ctx_move_to(epicardium_ctx, 80.0 - width, ypos);
ctx_line_to(epicardium_ctx, 80.0 + width, ypos);
ctx_stroke(epicardium_ctx);
}
ctx_save(epicardium_ctx);
ctx_font_size(epicardium_ctx, 20.0f);
ctx_text_baseline(epicardium_ctx, CTX_TEXT_BASELINE_BOTTOM);
ctx_rgba8(epicardium_ctx, 0xff, 0xff, 0xff, 0xff);
ctx_text_align(epicardium_ctx, CTX_TEXT_ALIGN_CENTER);
ctx_move_to(epicardium_ctx, 80.0f, 58.0f);
ctx_text(epicardium_ctx, "Epicardium");
if (strcmp(CARD10_VERSION, "v1.18") != 0) {
ctx_text_align(epicardium_ctx, CTX_TEXT_ALIGN_LEFT);
ctx_move_to(epicardium_ctx, 2.0f, 78.0f);
ctx_text(epicardium_ctx, CARD10_VERSION);
} else {
ctx_move_to(epicardium_ctx, 80.0f, 78.0f);
ctx_text(epicardium_ctx, "Queer Quinoa");
}
ctx_restore(epicardium_ctx);
}
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <string.h> #include <string.h>
#include <machine/endian.h> #include <machine/endian.h>
#include "epic_boot.c"
int main(void) int main(void)
{ {
watchdog_init(); watchdog_init();
...@@ -37,15 +39,14 @@ int main(void) ...@@ -37,15 +39,14 @@ int main(void)
epic_leds_set(12, 0, 0, 1); epic_leds_set(12, 0, 0, 1);
epic_leds_set(13, 0, 0, 1); epic_leds_set(13, 0, 0, 1);
epic_leds_set(14, 0, 0, 1); epic_leds_set(14, 0, 0, 1);
for (int i = 0; i < 3; i++) {
epic_leds_set_rocket(i, 31);
mxc_delay(166666);
epic_leds_set_rocket(i, 0);
}
epic_leds_clear_all(0, 0, 0);
epic_disp_clear(0x0000); epic_disp_clear(0x0000);
#if 0 /* reenable for future releases */
epic_leds_set_rocket(0, 31);
epic_leds_set_rocket(1, 31);
epic_leds_set_rocket(2, 31);
// TODO: Use blit function here // TODO: Use blit function here
#if BYTE_ORDER == LITTLE_ENDIAN #if BYTE_ORDER == LITTLE_ENDIAN
for (size_t i = 0; i < sizeof(epicardium_ctx_fb); i += 2) { for (size_t i = 0; i < sizeof(epicardium_ctx_fb); i += 2) {
...@@ -74,6 +75,30 @@ int main(void) ...@@ -74,6 +75,30 @@ int main(void)
} }
epic_disp_update(); epic_disp_update();
mxc_delay(2000000); mxc_delay(2000000);
#else
for (uint32_t frame = 0; frame < 15; frame++) {
switch (frame) {
case 0:
epic_leds_set_rocket(0, 31);
break;
case 5:
epic_leds_set_rocket(1, 31);
break;
case 10:
epic_leds_set_rocket(2, 31);
break;
}
epic_disp_clear(0x0000);
epic_frame(epicardium_ctx, frame);
epic_disp_update();
}
/* re-init for the first app */
disp_ctx_reinit();
#endif
epic_leds_clear_all(0, 0, 0);
LOG_DEBUG("startup", "Initializing tasks ..."); LOG_DEBUG("startup", "Initializing tasks ...");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment