Skip to content

Commit 3e37dd2

Browse files
TimJTiacassis
authored andcommitted
Add Framebuffer Console Example App
1 parent 60e4052 commit 3e37dd2

File tree

5 files changed

+2955
-0
lines changed

5 files changed

+2955
-0
lines changed

examples/fbcon/CMakeLists.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# ##############################################################################
2+
# apps/examples/fbcon/CMakeLists.txt
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
7+
# license agreements. See the NOTICE file distributed with this work for
8+
# additional information regarding copyright ownership. The ASF licenses this
9+
# file to you under the Apache License, Version 2.0 (the "License"); you may not
10+
# use this file except in compliance with the License. You may obtain a copy of
11+
# the License at
12+
#
13+
# http://www.apache.org/licenses/LICENSE-2.0
14+
#
15+
# Unless required by applicable law or agreed to in writing, software
16+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
18+
# License for the specific language governing permissions and limitations under
19+
# the License.
20+
#
21+
# ##############################################################################
22+
23+
if(CONFIG_EXAMPLES_FBCON)
24+
nuttx_add_application(
25+
NAME
26+
fbcon
27+
STACKSIZE
28+
${CONFIG_EXAMPLES_FBCON_STACKSIZE}
29+
MODULE
30+
${CONFIG_EXAMPLES_FBCON}
31+
SRCS
32+
fbcon_main.c)
33+
target_sources(apps PRIVATE fbcon_main.c)
34+
endif()

examples/fbcon/Kconfig

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
#
2+
# For a description of the syntax of this configuration file,
3+
# see the file kconfig-language.txt in the NuttX tools repository.
4+
#
5+
6+
config EXAMPLES_FBCON
7+
tristate "Framebuffer console example"
8+
default n
9+
---help---
10+
Enable the Framebuffer console example.
11+
This example allows STDOUT and/or STDERR to be redirected and displayed
12+
on a framebuffer character device.
13+
14+
A chosen builtin app can be spawned - such as "nsh" - to create a
15+
console and, if required, STDIN can be intercepted to allow input
16+
characters to be interpreted and pre-processed before passing them
17+
on to the spawned app.
18+
19+
Relies on and uses NX and NXFONTS
20+
21+
if EXAMPLES_FBCON
22+
23+
comment "Console STDIN and/or STDOUT setup"
24+
25+
config EXAMPLES_FBCON_PIPE_STDOUT
26+
bool "Pipe stdout to this console"
27+
default y
28+
29+
config EXAMPLES_FBCON_PIPE_STDERR
30+
bool "Pipe stderr to this console"
31+
default y
32+
33+
config EXAMPLES_FBCON_PIPE_STDIN
34+
bool "Pipe stdin via this console"
35+
default y
36+
---help---
37+
This is usually needed if the spawned App is "nsh" as we need to
38+
intercept input characters in some cases
39+
40+
comment "Console Framebuffer setup"
41+
42+
config EXAMPLES_FBCON_DEF_FB
43+
string "Default framebuffer driver"
44+
default "/dev/fb0"
45+
---help---
46+
Default framebuffer drivers. This selection can be overridden from
47+
the command line.
48+
49+
comment "BPP setup"
50+
51+
choice EXAMPLES_FBCON_BPP_SELECTION
52+
prompt "BPP Configuration"
53+
default EXAMPLES_FBCON_BPP_NX_DEFAULT
54+
55+
config EXAMPLES_FBCON_BPP_NX_DEFAULT
56+
bool "Use smallest BPP as enabled via NXFONTS setup"
57+
58+
config EXAMPLES_FBCON_CUSTOM_BPP
59+
bool "Choose custom BPP (must not be disabled in NX)"
60+
61+
choice EXAMPLES_FBCON_CUSTOM_BPP
62+
prompt "Custom Font pixel depth (BPP - Bits Per Pixel)"
63+
depends on EXAMPLES_FBCON_CUSTOM_BPP
64+
---help---
65+
Note: The required BPP must not be disabled via the NXFONT setup
66+
67+
config EXAMPLES_FBCON_1BPP
68+
bool "1 BPP"
69+
depends on !NX_DISABLE_1BPP
70+
71+
config EXAMPLES_FBCON_2BPP
72+
bool "2 BPP"
73+
depends on !NX_DISABLE_2BPP
74+
75+
config EXAMPLES_FBCON_4BPP
76+
bool "4 BPP"
77+
depends on !NX_DISABLE_4BPP
78+
79+
config EXAMPLES_FBCON_8BPP
80+
bool "8 BPP"
81+
depends on !NX_DISABLE_8BPP
82+
83+
config EXAMPLES_FBCON_16BPP
84+
bool "16 BPP"
85+
depends on !NX_DISABLE_16BPP
86+
87+
config EXAMPLES_FBCON_24BPP
88+
bool "24 BPP"
89+
depends on !NX_DISABLE_24BPP
90+
91+
config EXAMPLES_FBCON_32BPP
92+
bool "32 BPP"
93+
depends on !NX_DISABLE_32BPP
94+
95+
endchoice # EXAMPLES_FBCON_CUSTOM_BPP
96+
endchoice # EXAMPLES_FBCON_BPP_SELECTION
97+
98+
comment "Console appearance"
99+
100+
config EXAMPLES_FBCON_SHOW_WELCOME
101+
bool "Display welcome messages on stdout and/or stdin"
102+
default y
103+
104+
config EXAMPLES_FBCON_DEFAULT_COLORS
105+
bool "Use Default Colors (white characters on black background)"
106+
default y
107+
108+
if !EXAMPLES_FBCON_DEFAULT_COLORS
109+
110+
config EXAMPLES_FBCON_BGCOLOR
111+
hex "Background color"
112+
default 0x0
113+
---help---
114+
The color of the background. Default depends on config
115+
EXAMPLES_FBCON_BPP.
116+
117+
config EXAMPLES_FBCON_FCOLOR
118+
hex "Console font color"
119+
default 0x0
120+
---help---
121+
The color of the fonts used by the console.
122+
endif # !EXAMPLES_FBCON_DEFAULT_COLORS
123+
124+
config EXAMPLES_FBCON_LINESPACING
125+
int "Line spacing"
126+
default 0
127+
range 0 4
128+
---help---
129+
The vertical distance between lines is the sum of (1) the vertical
130+
bounding box dimension of the font, and (2) this additional line
131+
space. This value may be zero, but not negative.
132+
133+
config EXAMPLES_FBCON_NOWRAP
134+
bool "No wrap"
135+
default n
136+
---help---
137+
By default, lines will wrap when the test reaches the right hand side
138+
of the window. This setting can be defining to change this behavior so
139+
that the text is simply truncated until a new line is encountered.
140+
141+
choice EXAMPLES_FBCON_FONT
142+
prompt "Font Configuration"
143+
default EXAMPLES_FBCON_DEFAULT_FONT
144+
145+
config EXAMPLES_FBCON_DEFAULT_FONT
146+
bool "Use Default Font"
147+
148+
config EXAMPLES_FBCON_CUSTOM_FONTID
149+
bool "Use Custom Font ID"
150+
151+
config EXAMPLES_FBCON_FONTID
152+
int "Custom font ID"
153+
depends on EXAMPLES_FBCON_CUSTOM_FONTID
154+
default 0
155+
---help---
156+
Selects the font used by the console (see font ID numbers
157+
in include/nuttx/nx/nxfonts.h)
158+
159+
endchoice # EXAMPLES_FBCON_FONT
160+
161+
config EXAMPLES_FBCON_CURSORCHAR
162+
int "Character code to use as the cursor"
163+
default 95
164+
---help---
165+
The bitmap code to use as the cursor. Default '_' (95)
166+
167+
comment "FB Console App Escape code decoding"
168+
169+
config EXAMPLES_FBCON_VT100_DECODE
170+
bool "Decode VT100 Escape Codes"
171+
default y
172+
---help--
173+
Decode VT100 ESC codes - only minimal supporting functions
174+
175+
comment "FB Console spawn task configuration"
176+
177+
config EXAMPLES_FBCON_SPAWN_TASK
178+
string "Built-in application, or task, to spawn after console setup"
179+
default "nsh"
180+
---help---
181+
The required App must be enabled via Kconfig, of course. Its
182+
priority and stack size will be determined by this example and passed
183+
on during the spawn of the chosen app.
184+
185+
comment "FB Console App stack and priority options and glyph cache size"
186+
187+
config EXAMPLES_FBCON_STACKSIZE
188+
int "Stack Size"
189+
default DEFAULT_TASK_STACKSIZE
190+
---help---
191+
The stacksize to use when starting the example.
192+
193+
config EXAMPLES_FBCON_PRIORITY
194+
int "Task Priority"
195+
default 100
196+
---help---
197+
The priority of the example.
198+
199+
config EXAMPLES_FBCON_GLCACHE
200+
int "Glyph cache size"
201+
default 94
202+
---help---
203+
Size of the glyph cache. Default allows all usual ASCII characters to be cached
204+
205+
endif # EXAMPLES_FBCON

examples/fbcon/Make.defs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
############################################################################
2+
# apps/examples/fbcon/Make.defs
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# Licensed to the Apache Software Foundation (ASF) under one or more
7+
# contributor license agreements. See the NOTICE file distributed with
8+
# this work for additional information regarding copyright ownership. The
9+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
10+
# "License"); you may not use this file except in compliance with the
11+
# License. You may obtain a copy of the License at
12+
#
13+
# http://www.apache.org/licenses/LICENSE-2.0
14+
#
15+
# Unless required by applicable law or agreed to in writing, software
16+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
18+
# License for the specific language governing permissions and limitations
19+
# under the License.
20+
#
21+
############################################################################
22+
23+
ifneq ($(CONFIG_EXAMPLES_FBCON),)
24+
CONFIGURED_APPS += $(APPDIR)/examples/fbcon
25+
endif

examples/fbcon/Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
############################################################################
2+
# apps/examples/fbcon/Makefile
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# Licensed to the Apache Software Foundation (ASF) under one or more
7+
# contributor license agreements. See the NOTICE file distributed with
8+
# this work for additional information regarding copyright ownership. The
9+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
10+
# "License"); you may not use this file except in compliance with the
11+
# License. You may obtain a copy of the License at
12+
#
13+
# http://www.apache.org/licenses/LICENSE-2.0
14+
#
15+
# Unless required by applicable law or agreed to in writing, software
16+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
18+
# License for the specific language governing permissions and limitations
19+
# under the License.
20+
#
21+
############################################################################
22+
23+
include $(APPDIR)/Make.defs
24+
25+
# NuttX NX Framebuffer Console Example.
26+
27+
MAINSRC = fbcon_main.c
28+
29+
# NXTEXT built-in application info
30+
31+
PROGNAME = fbcon
32+
PRIORITY = $(CONFIG_EXAMPLES_FBCON_PRIORITY)
33+
STACKSIZE = $(CONFIG_EXAMPLES_FBCON_STACKSIZE)
34+
MODULE = $(CONFIG_EXAMPLES_FBCON)
35+
36+
include $(APPDIR)/Application.mk

0 commit comments

Comments
 (0)