From b0a0a39f7aa1882de5874092d873157220cdc1a0 Mon Sep 17 00:00:00 2001 From: Gregory Nutt <gnutt@nuttx.org> Date: Fri, 9 Mar 2018 12:31:29 -0600 Subject: [PATCH] Squashed commit of the following: apps/examples/ft80x: Fix some size calculations. Add option to disable primitive tests... just too boring to have to watch over and over again. apps/graphics/ft80x: Fix a typo in backlight fade logic; Fix error in formmatted display light debug dump output. apps/graphics/ft80x: Fix some warnings when debug features are enabled. --- examples/ft80x/Kconfig | 7 +++++++ examples/ft80x/Makefile | 6 +++++- examples/ft80x/ft80x_coprocessor.c | 2 +- examples/ft80x/ft80x_main.c | 10 +++++++--- graphics/ft80x/ft80x_backlight.c | 3 +-- graphics/ft80x/ft80x_dl.c | 6 +++--- graphics/ft80x/ft80x_regs.c | 6 +++--- include/graphics/ft80x.h | 1 - 8 files changed, 27 insertions(+), 14 deletions(-) diff --git a/examples/ft80x/Kconfig b/examples/ft80x/Kconfig index fcffa71b3..d289266d1 100644 --- a/examples/ft80x/Kconfig +++ b/examples/ft80x/Kconfig @@ -18,6 +18,13 @@ config EXAMPLES_FT80X_DEVPATH default "/dev/ft800" if LCD_FT800 default "/dev/ft801" if LCD_FT801 +config EXAMPLES_FT80X_PRIMITIVES + bool "Enable primitive examples" + default n + ---help--- + Enable some low level tests of GPU primitives. Not very interesting + for the most part. + config EXAMPLES_FT80X_EXCLUDE_BITMAPS bool "Exclude bitmaps" default n diff --git a/examples/ft80x/Makefile b/examples/ft80x/Makefile index bea76f563..f9a38f357 100644 --- a/examples/ft80x/Makefile +++ b/examples/ft80x/Makefile @@ -47,8 +47,12 @@ STACKSIZE = $(CONFIG_EXAMPLES_FT80X_STACKSIZE) # FT80X example ASRCS = +CSRCS = ft80x_coprocessor.c + +ifeq ($(CONFIG_EXAMPLES_FT80X_PRIMITIVES),y) +CSRCS += ft80x_primitives.c +endif -CSRCS = ft80x_primitives.c ft80x_coprocessor.c ifneq ($(CONFIG_EXAMPLES_FT80X_EXCLUDE_BITMAPS),y) CSRCS += ft80x_bitmaps.c endif diff --git a/examples/ft80x/ft80x_coprocessor.c b/examples/ft80x/ft80x_coprocessor.c index e3b293860..1d49225d7 100644 --- a/examples/ft80x/ft80x_coprocessor.c +++ b/examples/ft80x/ft80x_coprocessor.c @@ -1154,7 +1154,7 @@ int ft80x_coproc_gauge(int fd, FAR struct ft80x_dlbuffer_s *buffer) return ret; } - /* no background color */ + /* No background color */ xoffset += xdist; diff --git a/examples/ft80x/ft80x_main.c b/examples/ft80x/ft80x_main.c index cc4050831..39766f165 100644 --- a/examples/ft80x/ft80x_main.c +++ b/examples/ft80x/ft80x_main.c @@ -64,6 +64,7 @@ struct ft80x_exampleinfo_s * Private Data ****************************************************************************/ +#ifdef CONFIG_EXAMPLES_FT80X_PRIMITIVES /* GPU Primitive display examples. Most primitives are used, but not many of * their various options. * @@ -102,7 +103,8 @@ static const struct ft80x_exampleinfo_s g_primitives[] = { "Alpha Blend", ft80x_prim_alphablend } }; -#define NPRIMITIVES (sizeof(g_primitives) / sizeof(ft80x_example_t)) +#define NPRIMITIVES (sizeof(g_primitives) / sizeof(struct ft80x_exampleinfo_s)) +#endif /* CONFIG_EXAMPLES_FT80X_PRIMITIVES */ /* Co-processor display examples. Only a small, but interesting, subset * here co-processor command are exercised and these with only a few of the @@ -133,6 +135,7 @@ static const struct ft80x_exampleinfo_s g_primitives[] = static const struct ft80x_exampleinfo_s g_coproc[] = { + { "Calibrate", ft80x_coproc_calibrate }, /* Need to calibrate before Interactive. */ { "Button", ft80x_coproc_button }, { "Clock", ft80x_coproc_clock }, { "Gauge", ft80x_coproc_gauge }, @@ -144,7 +147,6 @@ static const struct ft80x_exampleinfo_s g_coproc[] = { "Dial", ft80x_coproc_dial }, { "Toggle", ft80x_coproc_toggle }, { "Number", ft80x_coproc_number }, - { "Calibrate", ft80x_coproc_calibrate }, { "Spinner", ft80x_coproc_spinner }, #ifndef CONFIG_EXAMPLES_FT80X_EXCLUDE_BITMAPS { "Screen Saver", ft80x_coproc_screensaver }, @@ -152,7 +154,7 @@ static const struct ft80x_exampleinfo_s g_coproc[] = { "Logo", ft80x_coproc_logo } }; -#define NCOPROC (sizeof(g_primitives) / sizeof(ft80x_example_t)) +#define NCOPROC (sizeof(g_coproc) / sizeof(struct ft80x_exampleinfo_s)) /**************************************************************************** * Private Functions @@ -320,6 +322,7 @@ int ft80x_main(int argc, char *argv[]) return EXIT_FAILURE; } +#ifdef CONFIG_EXAMPLES_FT80X_PRIMITIVES /* Perform tests on a few of the FT80x primitive functions */ ft80x_info("FT80x Primitive Functions\n"); @@ -328,6 +331,7 @@ int ft80x_main(int argc, char *argv[]) { (void)ft80x_example(fd, buffer, &g_primitives[i]); } +#endif /* Perform tests on a few of the FT80x Co-processor functions */ diff --git a/graphics/ft80x/ft80x_backlight.c b/graphics/ft80x/ft80x_backlight.c index 009e21a20..b85190151 100644 --- a/graphics/ft80x/ft80x_backlight.c +++ b/graphics/ft80x/ft80x_backlight.c @@ -63,7 +63,6 @@ * fd - The file descriptor of the FT80x device. Opened by the caller * with write access. * duty - The new backlight duty (as a percentage 0..100) - * delay - The duration of the fade in milliseconds. * * Returned Value: * Zero (OK) on success. A negated errno value on failure. @@ -118,7 +117,7 @@ int ft80x_backlight_fade(int fd, uint8_t duty, uint16_t delay) /* Perform the IOCTL to perform the fade */ - fade.delay = duty; + fade.duty = duty; fade.delay = delay; ret = ioctl(fd, FT80X_IOC_FADE, (unsigned long)((uintptr_t)&fade)); diff --git a/graphics/ft80x/ft80x_dl.c b/graphics/ft80x/ft80x_dl.c index 7ae4080e3..802267182 100644 --- a/graphics/ft80x/ft80x_dl.c +++ b/graphics/ft80x/ft80x_dl.c @@ -96,7 +96,7 @@ static void ft80x_dl_dump(FAR struct ft80x_dlbuffer_s *buffer, max = i + 4; if (max >= nwords) { - max = nwords - i; + max = nwords; } for (j = i; j < max; j++) @@ -107,9 +107,9 @@ static void ft80x_dl_dump(FAR struct ft80x_dlbuffer_s *buffer, putchar(' '); max = i + 8; - if (i + max >= nwords) + if (max >= nwords) { - max = nwords - i; + max = nwords; } for (j = i + 4; j < max; j++) diff --git a/graphics/ft80x/ft80x_regs.c b/graphics/ft80x/ft80x_regs.c index 802404e36..fb2708f4e 100644 --- a/graphics/ft80x/ft80x_regs.c +++ b/graphics/ft80x/ft80x_regs.c @@ -225,7 +225,7 @@ int ft80x_putreg8(int fd, uint32_t addr, uint8_t value) struct ft80x_register_s reg; int ret; - DEBUGASSERT(value != NULL && (addr & 3) == 0 && addr < 0xffc00000); + DEBUGASSERT((addr & 3) == 0 && addr < 0xffc00000); /* Perform the IOCTL to get the register value */ @@ -248,7 +248,7 @@ int ft80x_putreg16(int fd, uint32_t addr, uint16_t value) struct ft80x_register_s reg; int ret; - DEBUGASSERT(value != NULL && (addr & 3) == 0 && addr < 0xffc00000); + DEBUGASSERT((addr & 3) == 0 && addr < 0xffc00000); /* Perform the IOCTL to get the register value */ @@ -271,7 +271,7 @@ int ft80x_putreg32(int fd, uint32_t addr, uint32_t value) struct ft80x_register_s reg; int ret; - DEBUGASSERT(value != NULL && (addr & 3) == 0 && addr < 0xffc00000); + DEBUGASSERT((addr & 3) == 0 && addr < 0xffc00000); /* Perform the IOCTL to get the register value */ diff --git a/include/graphics/ft80x.h b/include/graphics/ft80x.h index 5c796a512..c83dabb50 100644 --- a/include/graphics/ft80x.h +++ b/include/graphics/ft80x.h @@ -510,7 +510,6 @@ int ft80x_audio_playfile(int fd, FAR struct ft80x_dlbuffer_s *buffer, * fd - The file descriptor of the FT80x device. Opened by the caller * with write access. * duty - The new backlight duty (as a percentage 0..100) - * delay - The duration of the fade in milliseconds. * * Returned Value: * Zero (OK) on success. A negated errno value on failure.