diff --git a/examples/ft80x/.gitignore b/examples/ft80x/.gitignore new file mode 100644 index 000000000..fa1ec7579 --- /dev/null +++ b/examples/ft80x/.gitignore @@ -0,0 +1,11 @@ +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/examples/ft80x/Kconfig b/examples/ft80x/Kconfig new file mode 100644 index 000000000..47dd3a74c --- /dev/null +++ b/examples/ft80x/Kconfig @@ -0,0 +1,37 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +config EXAMPLES_FT80X + bool "FT80x example" + default n + depends on LCD_FT80X + select GRAPHICS_FT80X + ---help--- + Enable the FT80X example + +if EXAMPLES_FT80X + +config EXAMPES_FT80X_DEVPATH + string "FT80x device path" + default "/dev/ft800" if LCD_FT800 + default "/dev/ft801" if LCD_FT801 + +config EXAMPLES_FT80X_PROGNAME + string "FT80x program name" + default "ft80x" + depends on BUILD_KERNEL + ---help--- + This is the name of the program that will be use when the NSH ELF + program is installed. + +config EXAMPLES_FT80X_PRIORITY + int "FT80x task priority" + default 100 + +config EXAMPLES_FT80X_STACKSIZE + int "FT80x stack size" + default 2048 + +endif diff --git a/examples/ft80x/Make.defs b/examples/ft80x/Make.defs new file mode 100644 index 000000000..a353f9ccb --- /dev/null +++ b/examples/ft80x/Make.defs @@ -0,0 +1,39 @@ +############################################################################ +# apps/examples/ft80x/Make.defs +# Adds selected applications to apps/ build +# +# Copyright (C) 2018 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +ifeq ($(CONFIG_EXAMPLES_FT80X),y) +CONFIGURED_APPS += examples/ft80x +endif diff --git a/examples/ft80x/Makefile b/examples/ft80x/Makefile new file mode 100644 index 000000000..a4d48e509 --- /dev/null +++ b/examples/ft80x/Makefile @@ -0,0 +1,56 @@ +############################################################################ +# apps/examples/ft80x/Makefile +# +# Copyright (C) 2018 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/Make.defs + +# FT80X example built-in application info + +CONFIG_EXAMPLES_FT80X_PRIORITY ?= SCHED_PRIORITY_DEFAULT +CONFIG_EXAMPLES_FT80X_STACKSIZE ?= 2048 + +APPNAME = ft80x +PRIORITY = $(CONFIG_EXAMPLES_FT80X_PRIORITY) +STACKSIZE = $(CONFIG_EXAMPLES_FT80X_STACKSIZE) + +# FT80X example + +ASRCS = +CSRCS = ft80x_primitives.c ft80x_coprocessor.c +MAINSRC = ft80x_main.c + +CONFIG_EXAMPLES_FT80X_PROGNAME ?= ft80x$(EXEEXT) +PROGNAME = $(CONFIG_EXAMPLES_FT80X_PROGNAME) + +include $(APPDIR)/Application.mk diff --git a/examples/ft80x/ft80x.h b/examples/ft80x/ft80x.h new file mode 100644 index 000000000..deacf096c --- /dev/null +++ b/examples/ft80x/ft80x.h @@ -0,0 +1,133 @@ +/**************************************************************************** + * apps/examples/ft80x/ft80x.h + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __APPS_EXAMPLES_FT80X_FT80X_H +#define __APPS_EXAMPLES_FT80X_FT80X_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#include +#include + +#ifdef CONFIG_EXAMPLES_FT80X + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* NOTE: These rely on internal definitions from compiler.h and debug.h. + * Could be a porting issue. + */ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef GRAPHICS_FT80X_DEBUG_ERROR +# define ft80x_err(format, ...) \ + fprintf(stderr, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__) +# else +# define ft80x_err(format, ...) +# endif + +# ifdef GRAPHICS_FT80X_DEBUG_WARN +# define ft80x_warn(format, ...) \ + fprintf(stderr, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__) +# else +# define ft80x_warn(format, ...) +# endif + +# ifdef GRAPHICS_FT80X_DEBUG_INFO +# define ft80x_info(format, ...) \ + printf(EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__) +# else +# define ft80x_info(format, ...) +# endif +#else +# ifdef GRAPHICS_FT80X_DEBUG_ERROR +# define ft80x_err printf +# else +# define ft80x_err (void) +# endif + +# ifdef GRAPHICS_FT80X_DEBUG_WARN +# define ft80x_warn printf +# else +# define ft80x_warn (void) +# endif + +# ifdef GRAPHICS_FT80X_DEBUG_INFO +# define ft80x_info printf +# else +# define ft80x_info (void) +# endif +#endif + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* This is the type of one display example entry point */ + +typedef CODE int (*ft80x_example_t)(int fd, + FAR struct ft80x_dlbuffer_s *buffer); + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/* GPU Primitive display examples */ + +int ft80x_rectangles(int fd, FAR struct ft80x_dlbuffer_s *buffer); + +/* Co-processor display examples */ + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* CONFIG_EXAMPLES_FT80X */ +#endif /* __APPS_EXAMPLES_FT80X_FT80X_H */ diff --git a/examples/ft80x/ft80x_coprocessor.c b/examples/ft80x/ft80x_coprocessor.c new file mode 100644 index 000000000..6852a6df1 --- /dev/null +++ b/examples/ft80x/ft80x_coprocessor.c @@ -0,0 +1,58 @@ +/**************************************************************************** + * examples/ft80x/ft80x_coprocessor.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include + +#include "graphics/ft80x.h" +#include "ft80x.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: + * + * Description: + * + ****************************************************************************/ diff --git a/examples/ft80x/ft80x_main.c b/examples/ft80x/ft80x_main.c new file mode 100644 index 000000000..92c37dd83 --- /dev/null +++ b/examples/ft80x/ft80x_main.c @@ -0,0 +1,230 @@ +/**************************************************************************** + * examples/ft80x/ft80x_main.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include + +#include "graphics/ft80x.h" +#include "ft80x.h" + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct ft80x_exampleinfo_s +{ + FAR const char *name; + ft80x_example_t func; +}; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const struct ft80x_exampleinfo_s g_primitives[] = +{ + { "Rectangles", ft80x_rectangles } +}; + +#define NPRIMITIVES (sizeof(g_primitives) / sizeof(ft80x_example_t)) + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: ft80x_showname + * + * Description: + * Show the name of the test + * + ****************************************************************************/ + +static int ft80x_showname(int fd, FAR struct ft80x_dlbuffer_s *buffer, + FAR const char *name) +{ + struct ft80x_cmd_text_s text; + int ret; + + /* Create the display list */ + + ret = ft80x_dl_start(fd, buffer); + if (ret < 0) + { + ft80x_err("ERROR: ft80x_dl_start failed: %d\n", ret); + return ret; + } + + /* Use the CMD_TEXT co-processor command */ + + text.cmd = FT80X_CMD_TEXT; + text.x = 80; + text.y = 60; + text.font = 31; + text.options = FT80X_OPT_CENTER; + + ret = ft80x_dl_data(fd, buffer, &text, sizeof(struct ft80x_cmd_text_s)); + if (ret < 0) + { + ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret); + return ret; + } + + ret = ft80x_dl_string(fd, buffer, name); + if (ret < 0) + { + ft80x_err("ERROR: ft80x_dl_string failed: %d\n", ret); + return ret; + } + + /* And terminate the display list */ + + ret = ft80x_dl_end(fd, buffer); + if (ret < 0) + { + ft80x_err("ERROR: ft80x_dl_end failed: %d\n", ret); + return ret; + } + + /* Wait bit so that the user can read the name */ + + sleep(2); + return OK; +} + +/**************************************************************************** + * Name: ft80x_example + * + * Description: + * Execute one example + * + ****************************************************************************/ + +static int ft80x_example(int fd, FAR struct ft80x_dlbuffer_s *buffer, + FAR const struct ft80x_exampleinfo_s *example) +{ + int ret; + + /* Show the name of the example */ + + ret = ft80x_showname(fd, buffer, example->name); + if (ret < 0) + { + ft80x_err("ERROR: ft80x_showname failed: %d\n", ret); + return ret; + } + + /* Then executte the example */ + + ret = example->func(fd, buffer); + if (ret < 0) + { + ft80x_err("ERROR: \"%s\" example failed: %d\n", example->name, ret); + return ret; + } + + /* Wait a bit */ + + sleep(4); + return OK; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * ft80x_main + ****************************************************************************/ + +#ifdef CONFIG_BUILD_KERNEL +int main(int argc, FAR char *argv[]) +#else +int ft80x_main(int argc, char *argv[]) +#endif +{ + FAR struct ft80x_dlbuffer_s *buffer; + int fd; + int i; + + /* Open the configured FT80x device */ + + fd = open(CONFIG_EXAMPES_FT80X_DEVPATH, O_WRONLY); + if (fd < 0) + { + int errcode = errno; + ft80x_err("ERROR: Failed to open %s: %d\n", + CONFIG_EXAMPES_FT80X_DEVPATH, errcode); + UNUSED(errcode); + return EXIT_FAILURE; + } + + /* Allocate the display list buffer structure */ + + buffer = (FAR struct ft80x_dlbuffer_s *) + malloc(sizeof(struct ft80x_dlbuffer_s)); + + if (buffer == NULL) + { + ft80x_err("ERROR: Failed to allocate display list buffer\n"); + close(fd); + return EXIT_FAILURE; + } + + /* Perform tests on a few of the FT80x primitive functions */ + + for (i = 0; i < NPRIMITIVES; i++) + { + (void)ft80x_example(fd, buffer, &g_primitives[i]); + } + + /* Perform tests on a few of the FT80x Co-processor functions */ +#warning missing logic + + free(buffer); + close(fd); + return EXIT_SUCCESS; +} diff --git a/examples/ft80x/ft80x_primitives.c b/examples/ft80x/ft80x_primitives.c new file mode 100644 index 000000000..99707c9ea --- /dev/null +++ b/examples/ft80x/ft80x_primitives.c @@ -0,0 +1,131 @@ +/**************************************************************************** + * examples/ft80x/ft80x_primitives.c + * + * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include + +#include "graphics/ft80x.h" +#include "ft80x.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: ft80x_rectangles + * + * Description: + * Demonstate some rectanges + * + ****************************************************************************/ + +int ft80x_rectangles(int fd, FAR struct ft80x_dlbuffer_s *buffer) +{ + uint32_t cmds[15]; + uint32_t width; + uint32_t height; + int ret; + + cmds[0] = FT80X_CLEAR(1, 1, 1); /* Clear screen */ + cmds[1] = FT80X_COLOR_RGB(0, 0, 128); + cmds[2] = FT80X_LINE_WIDTH(1 * 16); /* LINE_WIDTH is used for corner curvature */ + cmds[3] = FT80X_BEGIN(FT80X_PRIM_RECTS); /* Start rectangle primitive */ + + width = 5; + height = 25; + + cmds[4] = FT80X_VERTEX2F(((FT80X_DISPLAY_WIDTH / 4) - (width / 2)) * 16, + ((FT80X_DISPLAY_HEIGHT - height) / 2) * 16); + cmds[5] = FT80X_VERTEX2F(((FT80X_DISPLAY_WIDTH / 4) + (width / 2)) * 16, + ((FT80X_DISPLAY_HEIGHT + height) / 2) * 16); + cmds[6] = FT80X_COLOR_RGB(0, 128, 0); + cmds[7] = FT80X_LINE_WIDTH(5 * 16); + + width = 10; + height = 40; + + cmds[8] = FT80X_VERTEX2F((((FT80X_DISPLAY_WIDTH * 2) / 4) - (width / 2)) * 16, + ((FT80X_DISPLAY_HEIGHT - height) / 2) * 16); + cmds[9] = FT80X_VERTEX2F((((FT80X_DISPLAY_WIDTH * 2) /4) + (width / 2)) * 16, + ((FT80X_DISPLAY_HEIGHT + height) / 2) * 16); + cmds[10] = FT80X_COLOR_RGB(128, 128, 0); + cmds[11] = FT80X_LINE_WIDTH(10 * 16); + + width = 20; + height = 55; + + cmds[12] = FT80X_VERTEX2F((((FT80X_DISPLAY_WIDTH * 3) / 4) - (width / 2)) * 16, + ((FT80X_DISPLAY_HEIGHT - height) / 2) * 16); + cmds[13] = FT80X_VERTEX2F((((FT80X_DISPLAY_WIDTH * 3) / 4) + (width /2 )) * 16, + ((FT80X_DISPLAY_HEIGHT + height) / 2) * 16); + + cmds[14] = FT80X_DISPLAY(); + + /* Create the hardware display list */ + + ret = ft80x_dl_start(fd, buffer); + if (ret < 0) + { + ft80x_err("ERROR: ft80x_dl_start failed: %d\n", ret); + return ret; + } + + /* Copy the rectangle data into the display list */ + + ret = ft80x_dl_data(fd, buffer, cmds, 15 * sizeof(uint32_t)); + if (ret < 0) + { + ft80x_err("ERROR: ft80x_dl_data failed: %d\n", ret); + return ret; + } + + /* And terminate the display list */ + + ret = ft80x_dl_end(fd, buffer); + if (ret < 0) + { + ft80x_err("ERROR: ft80x_dl_end failed: %d\n", ret); + return ret; + } + + return OK; +}