Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
card10
firmware
Commits
07c92f18
Commit
07c92f18
authored
Oct 01, 2021
by
Rahix
Browse files
feat(epicardium): Add a boot animation to show off CTX
parent
cf092b1e
Pipeline
#5317
passed with stages
in 45 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
epicardium/epic_boot.c
0 → 100644
View file @
07c92f18
#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
.
0
f
);
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
.
0
f
,
58
.
0
f
);
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
.
0
f
,
78
.
0
f
);
ctx_text
(
epicardium_ctx
,
CARD10_VERSION
);
}
else
{
ctx_move_to
(
epicardium_ctx
,
80
.
0
f
,
78
.
0
f
);
ctx_text
(
epicardium_ctx
,
"Queer Quinoa"
);
}
ctx_restore
(
epicardium_ctx
);
}
epicardium/main.c
View file @
07c92f18
...
...
@@ -20,6 +20,8 @@
#include <string.h>
#include <machine/endian.h>
#include "epic_boot.c"
int
main
(
void
)
{
watchdog_init
();
...
...
@@ -37,15 +39,14 @@ int main(void)
epic_leds_set
(
12
,
0
,
0
,
1
);
epic_leds_set
(
13
,
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
);
#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
#if BYTE_ORDER == LITTLE_ENDIAN
for (size_t i = 0; i < sizeof(epicardium_ctx_fb); i += 2) {
...
...
@@ -74,6 +75,30 @@ int main(void)
}
epic_disp_update
();
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 ..."
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment