Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nuttx-apps
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
f4grx
nuttx-apps
Commits
a423026e
Commit
a423026e
authored
11 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
More SLCD-related fixes
parent
892774bb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/slcd/slcd_main.c
+21
-16
21 additions, 16 deletions
examples/slcd/slcd_main.c
with
21 additions
and
16 deletions
examples/slcd/slcd_main.c
+
21
−
16
View file @
a423026e
...
...
@@ -250,6 +250,7 @@ int slcd_main(int argc, char *argv[])
{
FAR
struct
slcd_test_s
*
priv
=
&
g_slcdtest
;
FAR
const
char
*
str
=
g_slcdhello
;
int
fd
;
int
ret
;
/* Parse the command line. For now, only a single optional string argument
...
...
@@ -261,11 +262,22 @@ int slcd_main(int argc, char *argv[])
{
str
=
argv
[
1
];
}
#endif
/* Open the SLCD device */
printf
(
"Opening %s for read/write access
\n
"
,
CONFIG_EXAMPLES_SLCD_DEVNAME
);
fd
=
open
(
CONFIG_EXAMPLES_SLCD_DEVNAME
,
O_RDWR
);
if
(
priv
->
fd
<
0
)
{
printf
(
"Failed to open %s: %d
\n
"
,
CONFIG_EXAMPLES_SLCD_DEVNAME
,
errno
);
goto
errout
;
}
/* Are we already initialized? */
if
(
!
priv
->
initialized
)
#endif
{
/* Initialize the output stream */
...
...
@@ -275,20 +287,9 @@ int slcd_main(int argc, char *argv[])
priv
->
stream
.
flush
=
slcd_flush
;
#endif
/* Open the SLCD device */
printf
(
"Opening %s for read/write access
\n
"
,
CONFIG_EXAMPLES_SLCD_DEVNAME
);
priv
->
fd
=
open
(
CONFIG_EXAMPLES_SLCD_DEVNAME
,
O_RDWR
);
if
(
priv
->
fd
<
0
)
{
printf
(
"Failed to open %s: %d
\n
"
,
CONFIG_EXAMPLES_SLCD_DEVNAME
,
errno
);
goto
errout
;
}
/* Get the geometry of the SCLD device */
ret
=
ioctl
(
priv
->
fd
,
SLCDIOC_GEOMETRY
,
(
unsigned
long
)
&
priv
->
geo
);
ret
=
ioctl
(
fd
,
SLCDIOC_GEOMETRY
,
(
unsigned
long
)
&
priv
->
geo
);
if
(
ret
<
0
)
{
printf
(
"ioctl(SLCDIOC_GEOMETRY) failed: %d
\n
"
,
errno
);
...
...
@@ -307,8 +308,12 @@ int slcd_main(int argc, char *argv[])
priv
->
initialized
=
true
;
}
/* Set the cursor to the beginning of the current row and erase to the end
* of the line.
/* Save the file descriptor in a place where slcd_flush can find it */
priv
->
fd
=
fd
;
/* Set the cursor to the beginning of the current row by homing the cursor
* then going down as necessary, and erase to the end of the line.
*/
slcd_encode
(
SLCDCODE_HOME
,
0
,
&
priv
->
stream
);
...
...
@@ -331,7 +336,7 @@ int slcd_main(int argc, char *argv[])
/* Normal exit */
printf
(
"Test complete
\n
"
);
close
(
priv
->
fd
);
close
(
fd
);
return
0
;
errout_with_fd:
...
...
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