mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
Add Framebuffer Console Example App
This commit is contained in:
parent
60e4052f81
commit
3e37dd2517
5 changed files with 2955 additions and 0 deletions
34
examples/fbcon/CMakeLists.txt
Normal file
34
examples/fbcon/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# ##############################################################################
|
||||
# apps/examples/fbcon/CMakeLists.txt
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
|
||||
# license agreements. See the NOTICE file distributed with this work for
|
||||
# additional information regarding copyright ownership. The ASF licenses this
|
||||
# file to you under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
#
|
||||
# ##############################################################################
|
||||
|
||||
if(CONFIG_EXAMPLES_FBCON)
|
||||
nuttx_add_application(
|
||||
NAME
|
||||
fbcon
|
||||
STACKSIZE
|
||||
${CONFIG_EXAMPLES_FBCON_STACKSIZE}
|
||||
MODULE
|
||||
${CONFIG_EXAMPLES_FBCON}
|
||||
SRCS
|
||||
fbcon_main.c)
|
||||
target_sources(apps PRIVATE fbcon_main.c)
|
||||
endif()
|
||||
205
examples/fbcon/Kconfig
Normal file
205
examples/fbcon/Kconfig
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
config EXAMPLES_FBCON
|
||||
tristate "Framebuffer console example"
|
||||
default n
|
||||
---help---
|
||||
Enable the Framebuffer console example.
|
||||
This example allows STDOUT and/or STDERR to be redirected and displayed
|
||||
on a framebuffer character device.
|
||||
|
||||
A chosen builtin app can be spawned - such as "nsh" - to create a
|
||||
console and, if required, STDIN can be intercepted to allow input
|
||||
characters to be interpreted and pre-processed before passing them
|
||||
on to the spawned app.
|
||||
|
||||
Relies on and uses NX and NXFONTS
|
||||
|
||||
if EXAMPLES_FBCON
|
||||
|
||||
comment "Console STDIN and/or STDOUT setup"
|
||||
|
||||
config EXAMPLES_FBCON_PIPE_STDOUT
|
||||
bool "Pipe stdout to this console"
|
||||
default y
|
||||
|
||||
config EXAMPLES_FBCON_PIPE_STDERR
|
||||
bool "Pipe stderr to this console"
|
||||
default y
|
||||
|
||||
config EXAMPLES_FBCON_PIPE_STDIN
|
||||
bool "Pipe stdin via this console"
|
||||
default y
|
||||
---help---
|
||||
This is usually needed if the spawned App is "nsh" as we need to
|
||||
intercept input characters in some cases
|
||||
|
||||
comment "Console Framebuffer setup"
|
||||
|
||||
config EXAMPLES_FBCON_DEF_FB
|
||||
string "Default framebuffer driver"
|
||||
default "/dev/fb0"
|
||||
---help---
|
||||
Default framebuffer drivers. This selection can be overridden from
|
||||
the command line.
|
||||
|
||||
comment "BPP setup"
|
||||
|
||||
choice EXAMPLES_FBCON_BPP_SELECTION
|
||||
prompt "BPP Configuration"
|
||||
default EXAMPLES_FBCON_BPP_NX_DEFAULT
|
||||
|
||||
config EXAMPLES_FBCON_BPP_NX_DEFAULT
|
||||
bool "Use smallest BPP as enabled via NXFONTS setup"
|
||||
|
||||
config EXAMPLES_FBCON_CUSTOM_BPP
|
||||
bool "Choose custom BPP (must not be disabled in NX)"
|
||||
|
||||
choice EXAMPLES_FBCON_CUSTOM_BPP
|
||||
prompt "Custom Font pixel depth (BPP - Bits Per Pixel)"
|
||||
depends on EXAMPLES_FBCON_CUSTOM_BPP
|
||||
---help---
|
||||
Note: The required BPP must not be disabled via the NXFONT setup
|
||||
|
||||
config EXAMPLES_FBCON_1BPP
|
||||
bool "1 BPP"
|
||||
depends on !NX_DISABLE_1BPP
|
||||
|
||||
config EXAMPLES_FBCON_2BPP
|
||||
bool "2 BPP"
|
||||
depends on !NX_DISABLE_2BPP
|
||||
|
||||
config EXAMPLES_FBCON_4BPP
|
||||
bool "4 BPP"
|
||||
depends on !NX_DISABLE_4BPP
|
||||
|
||||
config EXAMPLES_FBCON_8BPP
|
||||
bool "8 BPP"
|
||||
depends on !NX_DISABLE_8BPP
|
||||
|
||||
config EXAMPLES_FBCON_16BPP
|
||||
bool "16 BPP"
|
||||
depends on !NX_DISABLE_16BPP
|
||||
|
||||
config EXAMPLES_FBCON_24BPP
|
||||
bool "24 BPP"
|
||||
depends on !NX_DISABLE_24BPP
|
||||
|
||||
config EXAMPLES_FBCON_32BPP
|
||||
bool "32 BPP"
|
||||
depends on !NX_DISABLE_32BPP
|
||||
|
||||
endchoice # EXAMPLES_FBCON_CUSTOM_BPP
|
||||
endchoice # EXAMPLES_FBCON_BPP_SELECTION
|
||||
|
||||
comment "Console appearance"
|
||||
|
||||
config EXAMPLES_FBCON_SHOW_WELCOME
|
||||
bool "Display welcome messages on stdout and/or stdin"
|
||||
default y
|
||||
|
||||
config EXAMPLES_FBCON_DEFAULT_COLORS
|
||||
bool "Use Default Colors (white characters on black background)"
|
||||
default y
|
||||
|
||||
if !EXAMPLES_FBCON_DEFAULT_COLORS
|
||||
|
||||
config EXAMPLES_FBCON_BGCOLOR
|
||||
hex "Background color"
|
||||
default 0x0
|
||||
---help---
|
||||
The color of the background. Default depends on config
|
||||
EXAMPLES_FBCON_BPP.
|
||||
|
||||
config EXAMPLES_FBCON_FCOLOR
|
||||
hex "Console font color"
|
||||
default 0x0
|
||||
---help---
|
||||
The color of the fonts used by the console.
|
||||
endif # !EXAMPLES_FBCON_DEFAULT_COLORS
|
||||
|
||||
config EXAMPLES_FBCON_LINESPACING
|
||||
int "Line spacing"
|
||||
default 0
|
||||
range 0 4
|
||||
---help---
|
||||
The vertical distance between lines is the sum of (1) the vertical
|
||||
bounding box dimension of the font, and (2) this additional line
|
||||
space. This value may be zero, but not negative.
|
||||
|
||||
config EXAMPLES_FBCON_NOWRAP
|
||||
bool "No wrap"
|
||||
default n
|
||||
---help---
|
||||
By default, lines will wrap when the test reaches the right hand side
|
||||
of the window. This setting can be defining to change this behavior so
|
||||
that the text is simply truncated until a new line is encountered.
|
||||
|
||||
choice EXAMPLES_FBCON_FONT
|
||||
prompt "Font Configuration"
|
||||
default EXAMPLES_FBCON_DEFAULT_FONT
|
||||
|
||||
config EXAMPLES_FBCON_DEFAULT_FONT
|
||||
bool "Use Default Font"
|
||||
|
||||
config EXAMPLES_FBCON_CUSTOM_FONTID
|
||||
bool "Use Custom Font ID"
|
||||
|
||||
config EXAMPLES_FBCON_FONTID
|
||||
int "Custom font ID"
|
||||
depends on EXAMPLES_FBCON_CUSTOM_FONTID
|
||||
default 0
|
||||
---help---
|
||||
Selects the font used by the console (see font ID numbers
|
||||
in include/nuttx/nx/nxfonts.h)
|
||||
|
||||
endchoice # EXAMPLES_FBCON_FONT
|
||||
|
||||
config EXAMPLES_FBCON_CURSORCHAR
|
||||
int "Character code to use as the cursor"
|
||||
default 95
|
||||
---help---
|
||||
The bitmap code to use as the cursor. Default '_' (95)
|
||||
|
||||
comment "FB Console App Escape code decoding"
|
||||
|
||||
config EXAMPLES_FBCON_VT100_DECODE
|
||||
bool "Decode VT100 Escape Codes"
|
||||
default y
|
||||
---help--
|
||||
Decode VT100 ESC codes - only minimal supporting functions
|
||||
|
||||
comment "FB Console spawn task configuration"
|
||||
|
||||
config EXAMPLES_FBCON_SPAWN_TASK
|
||||
string "Built-in application, or task, to spawn after console setup"
|
||||
default "nsh"
|
||||
---help---
|
||||
The required App must be enabled via Kconfig, of course. Its
|
||||
priority and stack size will be determined by this example and passed
|
||||
on during the spawn of the chosen app.
|
||||
|
||||
comment "FB Console App stack and priority options and glyph cache size"
|
||||
|
||||
config EXAMPLES_FBCON_STACKSIZE
|
||||
int "Stack Size"
|
||||
default DEFAULT_TASK_STACKSIZE
|
||||
---help---
|
||||
The stacksize to use when starting the example.
|
||||
|
||||
config EXAMPLES_FBCON_PRIORITY
|
||||
int "Task Priority"
|
||||
default 100
|
||||
---help---
|
||||
The priority of the example.
|
||||
|
||||
config EXAMPLES_FBCON_GLCACHE
|
||||
int "Glyph cache size"
|
||||
default 94
|
||||
---help---
|
||||
Size of the glyph cache. Default allows all usual ASCII characters to be cached
|
||||
|
||||
endif # EXAMPLES_FBCON
|
||||
25
examples/fbcon/Make.defs
Normal file
25
examples/fbcon/Make.defs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
############################################################################
|
||||
# apps/examples/fbcon/Make.defs
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
ifneq ($(CONFIG_EXAMPLES_FBCON),)
|
||||
CONFIGURED_APPS += $(APPDIR)/examples/fbcon
|
||||
endif
|
||||
36
examples/fbcon/Makefile
Normal file
36
examples/fbcon/Makefile
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
############################################################################
|
||||
# apps/examples/fbcon/Makefile
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(APPDIR)/Make.defs
|
||||
|
||||
# NuttX NX Framebuffer Console Example.
|
||||
|
||||
MAINSRC = fbcon_main.c
|
||||
|
||||
# NXTEXT built-in application info
|
||||
|
||||
PROGNAME = fbcon
|
||||
PRIORITY = $(CONFIG_EXAMPLES_FBCON_PRIORITY)
|
||||
STACKSIZE = $(CONFIG_EXAMPLES_FBCON_STACKSIZE)
|
||||
MODULE = $(CONFIG_EXAMPLES_FBCON)
|
||||
|
||||
include $(APPDIR)/Application.mk
|
||||
2655
examples/fbcon/fbcon_main.c
Normal file
2655
examples/fbcon/fbcon_main.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue