Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
François Revol
firmware
Commits
07c92f18
Commit
07c92f18
authored
Oct 1, 2021
by
rahix
Browse files
Options
Downloads
Patches
Plain Diff
feat(epicardium): Add a boot animation to show off CTX
parent
cf092b1e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
epicardium/epic_boot.c
+53
-0
53 additions, 0 deletions
epicardium/epic_boot.c
epicardium/main.c
+31
-6
31 additions, 6 deletions
epicardium/main.c
with
84 additions
and
6 deletions
epicardium/epic_boot.c
0 → 100644
+
53
−
0
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
);
}
This diff is collapsed.
Click to expand it.
epicardium/main.c
+
31
−
6
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 ..."
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment