Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
F
fernly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Craig Comstock
fernly
Commits
176f914b
Commit
176f914b
authored
Apr 07, 2015
by
Sean Cross
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19 from pfalcon/keypad-uart-exit
cmd-keypad: Exit also on key press on serial/USB connection.
parents
7402d869
bacfe8b8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
cmd-keypad.c
cmd-keypad.c
+2
-2
include/serial.h
include/serial.h
+1
-0
serial.c
serial.c
+12
-0
No files found.
cmd-keypad.c
View file @
176f914b
...
...
@@ -59,9 +59,9 @@ int cmd_keypad(int argc, char **argv)
int
end
=
0
;
uint32_t
key_state
[
18
]
=
{
0
};
printf
(
"Press %c on keypad to exit
\n
"
,
printf
(
"Press %c on keypad
or any key on serial
to exit
\n
"
,
key_vals
[
ARRAY_SIZE
(
key_vals
)
-
2
]);
while
(
!
end
)
{
while
(
!
end
&&
!
serial_available
()
)
{
int
key
;
for
(
key
=
0
;
key
<
(
ARRAY_SIZE
(
key_vals
)
-
1
);
key
++
)
{
...
...
include/serial.h
View file @
176f914b
...
...
@@ -9,6 +9,7 @@ void serial_puth(uint32_t hex, int digits); /* Put hex */
void
serial_write
(
const
void
*
d
,
int
bytes
);
uint8_t
serial_getc
(
void
);
int
serial_available
(
void
);
int
serial_print_hex
(
const
void
*
bfr
,
int
count
);
int
serial_read
(
void
*
data
,
int
bytes
);
...
...
serial.c
View file @
176f914b
...
...
@@ -100,6 +100,12 @@ uint8_t serial_getc(void)
return
uart_getreg
(
UART_RBR
);
}
/* Return true if there's pending received char */
int
serial_available
(
void
)
{
return
uart_getreg
(
UART_LSR
)
&
0x01
;
}
int
serial_puts
(
const
void
*
s
)
{
const
char
*
str
=
s
;
...
...
@@ -279,6 +285,12 @@ uint8_t serial_getc(void)
return
recv_bfr
[
recv_offset
++
];
}
int
serial_available
(
void
)
{
usb_handle_irqs
(
1
);
return
recv_size
!=
0
;
}
int
serial_puts
(
const
void
*
s
)
{
const
char
*
str
=
s
;
...
...
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