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
931f04b8
Commit
931f04b8
authored
Aug 21, 2014
by
Projects
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
menu: Scrollable menu.
parent
c4b78f9c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
menu.c
sw/freertos/src/apps/menu.c
+21
-7
No files found.
sw/freertos/src/apps/menu.c
View file @
931f04b8
...
...
@@ -33,18 +33,33 @@ static int selected_item = 0;
static
void
menu_screen_redraw
(
struct
ui_widget
*
w
)
{
const
int
LINE_HEIGHT
=
17
;
const
int
LEFT_MARGIN
=
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"
);
{
if
(
i
==
selected_item
)
{
gfx_box
(
&
w
->
dc
,
LEFT_MARGIN
,
i
*
LINE_HEIGHT
,
127
,
(
i
+
1
)
*
LINE_HEIGHT
,
1
);
}
gfx_text
(
&
w
->
dc
,
&
font_helv17
,
LEFT_MARGIN
,
i
*
LINE_HEIGHT
,
"Application"
,
i
!=
selected_item
);
}
}
static
void
menu_screen_event
(
struct
ui_widget
*
w
,
const
struct
event
*
evt
)
{
// TODO change the selected item
(
void
)(
w
);
(
void
)(
evt
);
if
(
evt
->
type
==
BUTTON_PRESSED
)
{
if
(
evt
->
data
.
button
==
BUT_BL
)
{
++
selected_item
;
w
->
flags
|=
WF_DIRTY
;
}
else
if
(
evt
->
data
.
button
==
BUT_BR
)
{
--
selected_item
;
w
->
flags
|=
WF_DIRTY
;
}
}
}
struct
ui_widget
menu_screen
=
{
...
...
@@ -79,19 +94,18 @@ void menu_main(void* params) {
// 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
else
ui_update
(
&
evt
);
break
;
default:
// suppress warnings
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