Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
fwatch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
fwatch
Commits
9b78d3d6
Commit
9b78d3d6
authored
Aug 20, 2014
by
Projects
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
menu: Displays a fake list of application. It is possible to switch between menu & clock screens.
parent
da3daf58
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
5 deletions
+52
-5
menu.c
sw/freertos/src/apps/menu.c
+52
-5
No files found.
sw/freertos/src/apps/menu.c
View file @
9b78d3d6
...
...
@@ -26,25 +26,72 @@
#include "menu.h"
#include "clock.h"
#include "
event
.h"
#include "
widgets/status_bar
.h"
#include <gfx/graphics.h>
static
int
selected_item
=
0
;
static
void
menu_screen_redraw
(
struct
ui_widget
*
w
)
{
const
int
LINE_HEIGHT
=
17
;
int
i
;
gfx_clear
(
&
w
->
dc
,
0
);
for
(
i
=
0
;
i
<
5
;
++
i
)
gfx_text
(
&
w
->
dc
,
&
font_helv17
,
15
,
i
*
LINE_HEIGHT
,
"Application"
);
}
static
void
menu_screen_event
(
struct
ui_widget
*
w
,
const
struct
event
*
evt
)
{
// TODO change the selected item
(
void
)(
w
);
(
void
)(
evt
);
}
struct
ui_widget
menu_screen
=
{
menu_screen_redraw
,
menu_screen_event
,
{
0
,
20
,
127
,
107
},
0
,
WF_ACTIVE
|
WF_VISIBLE
};
static
void
run
(
Application
*
app
)
{
// Run the application
app
->
main
(
NULL
);
// Reinitialize user interface when finished
ui_clear
();
ui_init_widget
(
&
menu_screen
);
ui_add_widget
(
&
menu_screen
);
ui_init_widget
(
&
status_bar
);
ui_add_widget
(
&
status_bar
);
ui_update
(
NULL
);
}
void
menu_main
(
void
*
params
)
{
(
void
)(
params
);
// suppress unused parameter warning
struct
event
evt
;
// Run the clock application as the default one
clock
.
main
(
NULL
);
run
(
&
clock
);
// Once it is deactivated - display the menu
while
(
1
)
{
// TODO
if
(
xQueueReceive
(
appQueue
,
&
evt
,
0
))
{
switch
(
evt
.
type
)
{
case
BUTTON_PRESSED
:
if
(
evt
.
data
.
button
==
BUT_TL
)
run
(
&
clock
);
// return to the clock screen
break
;
default:
// suppress warnings
break
;
ui_update
(
&
evt
);
break
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
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