9
0
Fork 0

Add NX configuration for LPCXpresso

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3521 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2011-04-18 17:16:24 +00:00
parent 6879cf48d5
commit 9a69e7e562
18 changed files with 1925 additions and 79 deletions

View File

@ -1700,4 +1700,9 @@
be '#if CONFIG_NFILE_DESCRIPTORS > 0'. This causes a dup2() failure in THTTPD
and a failure to get a CGI page. The consequence can be a very serious bug!
* configs/lpcxpresso-lpc1768/usbstorage, thttpd, and dhcpd: Add an USB storage,
THTTPD web server, and DHCP server configurations for the NXP LPCXpresso board.
THTTPD web server, and DHCP server configurations for the NXP LPCXpresso board.
* drivers/lcd/ug-9664hswag01.c and ssd1305.h: Add support for Univision UG-9664SWAG01
OLED with Solomon Systech SD1305 LCD controller.
* configs/lpcxpresso-lpc1668/nx: Add a NX graphics configuration for the LPCXPRESO
board.

View File

@ -123,6 +123,8 @@ SD Slot
CLK PIO2_11-SCK 7 P0.9 SCK1
CD PIO2_10 52 P2.11
These jumper settings are required:
*J55 must be set to provide chip select PIO1_11 signal as the SD slot
chip select.
@ -137,6 +139,9 @@ USB Device
USB_DP 37 USB_D+
PIO0_3-VBUS_SENSE** 39 P0.5
These jumper settings are listed for information only. They are *not*
required for use with NuttX and LPCXpresso.
*J14 must be set to permit GPIO control of the USB connect pin
**J12 must be set to permit GPIO control of the USB vbus sense pin
J23 is associated the LEDs used for USB support

View File

@ -0,0 +1,174 @@
############################################################################
# configs/lpcxpresso-lpc1768/nx/Make.defs
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# 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}/.config
# Setup for the selected toolchain
ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
# CodeSourcery under Windows
CROSSDEV = arm-none-eabi-
WINTOOL = y
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif
ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
# CodeSourcery under Linux
CROSSDEV = arm-none-eabi-
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
MAXOPTIMIZATION = -O2
endif
ifeq ($(CONFIG_LPC17_DEVKITARM),y)
# devkitARM under Windows
CROSSDEV = arm-eabi-
WINTOOL = y
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif
ifeq ($(CONFIG_LPC17_BUILDROOT),y)
# NuttX buildroot under Linux or Cygwin
CROSSDEV = arm-elf-
ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
MAXOPTIMIZATION = -Os
endif
ifeq ($(CONFIG_LPC17_CODEREDW),y)
# CodeSourcery under Windows
CROSSDEV = arm-none-eabi-
WINTOOL = y
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -D__NEWLIB__
endif
ifeq ($(CONFIG_LPC17_CODEREDL),y)
# CodeSourcery under Linux
CROSSDEV = arm-none-eabi-
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft -D__NEWLIB__
MAXOPTIMIZATION = -O2
endif
ifeq ($(WINTOOL),y)
# Windows-native toolchains
DIRLINK = $(TOPDIR)/tools/winlink.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nx/ld.script}"
MAXOPTIMIZATION = -O2
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nx/ld.script
endif
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
ARCHOPTIMIZATION = -g
else
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES =
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
OBJEXT = .o
LIBEXT = .a
EXEEXT =
ifneq ($(CROSSDEV),arm-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif
define PREPROCESS
@echo "CPP: $1->$2"
@$(CPP) $(CPPFLAGS) $1 -o $2
endef
define COMPILE
@echo "CC: $1"
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define COMPILEXX
@echo "CXX: $1"
@$(CXX) -c $(CXXFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
endef
define ARCHIVE
echo "AR: $2"; \
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
endef
define CLEAN
@rm -f *.o *.a
endef
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =

View File

@ -0,0 +1,39 @@
############################################################################
# configs/lpcxpresso-lpc1768/nx/appconfig
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# 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.
#
############################################################################
# Path to example in apps/examples containing the user_start entry point
CONFIGURED_APPS += examples/nx

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,110 @@
/****************************************************************************
* configs/lpcxpresso-lpc1768/nx/ld.script
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* 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.
*
****************************************************************************/
/* The LPC1768 has 512Kb of FLASH beginning at address 0x0000:0000 and
* 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
* 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
* 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
* into the 32Kb CPU SRAM address range.
*/
MEMORY
{
flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K
sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
}
OUTPUT_ARCH(arm)
ENTRY(_stext)
SECTIONS
{
.text : {
_stext = ABSOLUTE(.);
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > flash
_eronly = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
} > sram AT > flash
.ARM.extab : {
*(.ARM.extab*)
} >sram
__exidx_start = ABSOLUTE(.);
.ARM.exidx : {
*(.ARM.exidx*)
} >sram
__exidx_end = ABSOLUTE(.);
.bss : {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
} > sram
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}

View File

@ -0,0 +1,59 @@
#!/bin/bash
# configs/lpcxpresso-lpc1768/nx/setenv.sh
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# 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.
#
if [ "$(basename $0)" = "setenv.sh" ] ; then
echo "You must source this script, not run it!" 1>&2
exit 1
fi
if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
WD=`pwd`
# This is where the buildroot might reside on a Linux or Cygwin system
# export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
# This is the default install location for Code Red on Linux
export TOOLCHAIN_BIN="/usr/local/LPCXpresso/tools/bin"
# This the Cygwin path to the LPCXpresso 3.6 install location under Windows
#export TOOLCHAIN_BIN="/cygdrive/c/nxp/lpcxpresso_3.6/Tools/bin"
# This is the path to the LPCXpression tool subdirectory
export LPCTOOL_DIR="${WD}/configs/lpcxpresso-lpc1768/tools"
# Add the path to the toolchain to the PATH varialble
export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
echo "PATH : ${PATH}"

View File

@ -168,14 +168,18 @@
* PIO0_6-USB_CONNECT* 23 P0.21/RI1/RD1
* PIO0_3-VBUS_SENSE 39 P0.5/I2SRX-WS/TD2/CAP2.1
*
* Noes:
* Notes:
* - The standard USB CONNECT (P0.9) provides USB D+ pullup on board the
* LPCXpresso card; it should be un-necessary to use the based board
* version of the pullup.
* - J14 must be set to permit GPIO control of the base board USB connect
* pin
* - The standard VBUS (P1.30) is not connected.
* - J12 must be set to permit GPIO control of the USB vbus sense pin
* - No changes to jumper settings are required. There are few USB-
* related jumpers on the based board, but none are required:
* - J14 must be set to permit GPIO control of the base board USB
* connect pin. NOT USED
* - J12 must be set to permit GPIO control of the USB vbus sense pin
* - The standard VBUS (P1.30) is not connected. As a consequence, the
* USB driver will not correctly respond to USB insertion or removal
* events.
* - The standard USB LED (P1.18) is not connected.
*/

View File

@ -46,7 +46,7 @@
#include <nuttx/spi.h>
#include <nuttx/lcd/lcd.h>
#include <nuttx/lcd/p14201.h>
#include <nuttx/lcd/ug-9664hswag01.h>
#include "lpc17_internal.h"
#include "lpcxpresso_internal.h"
@ -60,11 +60,15 @@
*/
#ifndef CONFIG_LPC17_SSP1
# error "The OLED driver required CONFIG_LPC17_SSP1 in the configuration"
# error "The OLED driver requires CONFIG_LPC17_SSP1 in the configuration"
#endif
#ifndef CONFIG_UG9664HSWAG01_POWER
# error "This logic requires CONFIG_UG9664HSWAG01_POWER in the configuration"
#endif
/* Debug ********************************************************************/
/* Define the CONFIG_LCD_RITDEBUG to enable detailed debug output (stuff you
/* Define the CONFIG_LCD_UGDEBUG to enable detailed debug output (stuff you
* would never want to see unless you are debugging this file).
*
* Verbose debug must also be enabled
@ -76,15 +80,15 @@
#endif
#ifndef CONFIG_DEBUG_VERBOSE
# undef CONFIG_LCD_RITDEBUG
# undef CONFIG_LCD_UGDEBUG
#endif
#ifdef CONFIG_LCD_RITDEBUG
# define ritdbg(format, arg...) vdbg(format, ##arg)
# define oleddc_dumpgpio(m) lm3s_dumpgpio(LPCXPRESSO_OLED_POWER, m)
# define oledcs_dumpgpio(m) lm3s_dumpgpio(LPCXPRESSO_OLED_CS, m)
#ifdef CONFIG_LCD_UGDEBUG
# define ugdbg(format, arg...) vdbg(format, ##arg)
# define oleddc_dumpgpio(m) lpc17_dumpgpio(LPCXPRESSO_OLED_POWER, m)
# define oledcs_dumpgpio(m) lpc17_dumpgpio(LPCXPRESSO_OLED_CS, m)
#else
# define ritdbg(x...)
# define ugdbg(x...)
# define oleddc_dumpgpio(m)
# define oledcs_dumpgpio(m)
#endif
@ -129,7 +133,7 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
{
/* Bind the SSI port to the OLED */
dev = rit_initialize(spi, devno);
dev = ug_initialize(spi, devno);
if (!dev)
{
glldbg("Failed to bind SSI port 1 to OLED %d: %d\n", devno);
@ -138,10 +142,9 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
{
gllvdbg("Bound SSI port 1 to OLED %d\n", devno);
/* And turn the OLED on (CONFIG_LCD_MAXPOWER should be 1) */
/* And turn the OLED on (dim) */
(void)lpc17_gpiowrite(LPCXPRESSO_OLED_POWER, true);
(void)dev->setpower(dev, CONFIG_LCD_MAXPOWER);
(void)dev->setpower(dev, UG_POWER_DIM);
return dev;
}
}
@ -149,7 +152,7 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
}
/******************************************************************************
* Name: lm3s_spicmddata
* Name: lpc17_ssp1cmddata
*
* Description:
* Set or clear the SD1329 D/Cn bit to select data (true) or command
@ -171,7 +174,7 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
*
******************************************************************************/
int lm3s_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
int lpc17_ssp1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
{
if (devid == SPIDEV_DISPLAY)
{
@ -182,3 +185,30 @@ int lm3s_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
}
return -ENODEV;
}
/****************************************************************************
* Name: ug_power
*
* Description:
* If the hardware supports a controllable OLED a power supply, this
* interface should be provided. It may be called by the driver to turn
* the OLED power on and off as needed.
*
* Input Parameters:
*
* devno - A value in the range of 0 throuh CONFIG_UG9664HSWAG01_NINTERFACES-1.
* This allows support for multiple OLED devices.
* on - true:turn power on, false: turn power off.
*
* Returned Value:
* None
*
**************************************************************************************/
#ifdef CONFIG_UG9664HSWAG01_POWER
void ug_power(unsigned int devno, bool on)
{
gllvdbg("on: \n", on ? "TRUE" : "FALSE");
(void)lpc17_gpiowrite(LPCXPRESSO_OLED_POWER, on);
}
#endif

View File

@ -48,8 +48,8 @@ ifeq ($(CONFIG_LCD_NOKIA6100),y)
LCD_CSRCS = nokia6100.c
endif
ifeq ($(CONFIG_LCD_UG9664HSWAG0),y)
LCD_CSRCS = ug-9664hswag0.c
ifeq ($(CONFIG_LCD_UG9664HSWAG01),y)
LCD_CSRCS = ug-9664hswag01.c
endif
endif

View File

@ -307,7 +307,7 @@ static int skel_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
* Name: skel_getpower
*
* Description:
* Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on. On
* Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on). On
* backlit LCDs, this setting may correspond to the backlight setting.
*
**************************************************************************************/

View File

@ -100,7 +100,7 @@
# define SSD1305_SETBANK14(c) (c << 2) /* Data 4, Bits 2-3: Bank 14 color */
# define SSD1305_SETBANK15(c) (c << 4) /* Data 4, Bits 4-5: Bank 15 color */
# define SSD1305_SETBANK16(c) (c << 6) /* Data 4, Bits 6-7: Bank 16 color */
#define SSD1305_SETBANKCOLOR1 0x93 /* 0x93: Set bank 17-32 color */
#define SSD1305_SETBANKCOLOR2 0x93 /* 0x93: Set bank 17-32 color */
# define SSD1305_SETBANK17(c) (c) /* Data 1, Bits 0-1: Bank 17 color */
# define SSD1305_SETBANK18(c) (c << 2) /* Data 1, Bits 2-3: Bank 18 color */
# define SSD1305_SETBANK19(c) (c << 4) /* Data 1, Bits 4-5: Bank 19 color */

View File

@ -54,22 +54,68 @@
#include <nuttx/arch.h>
#include <nuttx/spi.h>
#include <nuttx/lcd/lcd.h>
#include <nuttx/lcd/ug-9664hswag01.h>
#include "up_arch.h"
#inclu;de "ssd1305.h"
#include "ssd1305.h"
/**************************************************************************************
* Pre-processor Definitions
**************************************************************************************/
/* Configuration **********************************************************************/
/* UG-9664HSWAG01 Configuration Settings:
*
* CONFIG_UG9664HSWAG01_SPIMODE - Controls the SPI mode
* CONFIG_UG9664HSWAG01_FREQUENCY - Define to use a different bus frequency
* CONFIG_UG9664HSWAG01_NINTERFACES - Specifies the number of physical
* UG-9664HSWAG01 devices that will be supported. NOTE: At present, this
* must be undefined or defined to be 1.
* CONFIG_UG9664HSWAG01_POWER
* If the hardware supports a controllable OLED a power supply, this
* configuration shold be defined. (See ug_power() below).
* CONFIG_LCD_UGDEBUG - Enable detailed UG-9664HSWAG01 debug output
* (CONFIG_DEBUG and CONFIG_VERBOSE must also be enabled).
*
* Required LCD driver settings:
* CONFIG_LCD_UG9664HSWAG01 - Enable UG-9664HSWAG01 support
* CONFIG_LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be accepted.
* CONFIG_LCD_MAXPOWER should be 2: 0=off, 1=dim, 2=normal
*
* Required SPI driver settings:
* CONFIG_SPI_CMDDATA - Include support for cmd/data selection.
*/
/* Verify that all configuration requirements have been met */
/* Define the following to enable register-level debug output */
/* The UG-9664HSWAG01 spec says that is supports SPI mode 0,0 only. However, somtimes
* you need to tinker with these things.
*/
#undef CONFIG_LCD_UGDEBUG
#ifndef CONFIG_UG9664HSWAG01_SPIMODE
# define CONFIG_UG9664HSWAG01_SPIMODE SPIDEV_MODE2
#endif
/* Verbose debug must also be enabled */
/* SPI frequency */
#ifndef CONFIG_UG9664HSWAG01_FREQUENCY
# define CONFIG_UG9664HSWAG01_FREQUENCY SPIDEV_MODE2
#endif
/* CONFIG_UG9664HSWAG01_NINTERFACES determines the number of physical interfaces
* that will be supported.
*/
#ifndef CONFIG_UG9664HSWAG01_NINTERFACES
# define CONFIG_UG9664HSWAG01_NINTERFACES 1
#endif
#if CONFIG_UG9664HSWAG01_NINTERFACES != 1
# warning "Only a single UG-9664HSWAG01 interface is supported"
# undef CONFIG_UG9664HSWAG01_NINTERFACES
# define CONFIG_UG9664HSWAG01_NINTERFACES 1
#endif
/* Verbose debug must also be enabled to use the extra OLED debug */
#ifndef CONFIG_DEBUG
# undef CONFIG_DEBUG_VERBOSE
@ -80,6 +126,44 @@
# undef CONFIG_LCD_UGDEBUG
#endif
/* Check contrast selection */
#ifndef CONFIG_LCD_MAXCONTRAST
# define CONFIG_LCD_MAXCONTRAST 255
#endif
#if CONFIG_LCD_MAXCONTRAST <= 0 || CONFIG_LCD_MAXCONTRAST > 255
# error "CONFIG_LCD_MAXCONTRAST exceeds supported maximum"
#endif
#if CONFIG_LCD_MAXCONTRAST < 255
# warning "Optimal setting of CONFIG_LCD_MAXCONTRAST is 255"
#endif
/* Check power setting */
#if !defined(CONFIG_LCD_MAXPOWER)
# define CONFIG_LCD_MAXPOWER 2
#endif
#if CONFIG_LCD_MAXPOWER != 2
# warning "CONFIG_LCD_MAXPOWER should be 2"
# undef CONFIG_LCD_MAXPOWER
# define CONFIG_LCD_MAXPOWER 2
#endif
/* The OLED requires CMD/DATA SPI support */
#ifndef CONFIG_SPI_CMDDATA
# error "CONFIG_SPI_CMDDATA must be defined in your NuttX configuration"
#endif
/* Color is 1bpp monochrome with leftmost column contained in bits 0 */
#if defined(CONFIG_NX_DISABLE_1BPP) || !defined(CONFIG_NX_PACKEDMSFIRST)
# warning "1-bit, big-endian pixel support needed"
#endif
/* Color Properties *******************************************************************/
/* The SSD1305 display controller can handle a resolution of 132x64. The OLED
* on the base board is 96x64.
@ -131,6 +215,14 @@ struct ug_dev_s
FAR struct spi_dev_s *spi;
uint8_t contrast;
bool powered;
/* The SSD1305 does not support reading from the display memory in SPI mode.
* Since there is 1 BPP and access is byte-by-byte, it is necessary to kee
* a shadow copy of the framebuffer memory.
*/
uint8_t fb[UG_XRES >> 3][UG_YRES];
};
/**************************************************************************************
@ -201,13 +293,6 @@ static inline void up_clear(FAR struct ug_dev_s *priv);
static uint8_t g_runbuffer[UG_XRES >> 8];
/* The SSD1305 does not support reading from the display memory in SPI mode.
* Since there is 1 BPP and access is byte-by-byte, it is necessary to kee
* a shadow copy of the framebuffer memory.
*/
static uint8_t g_ugfb[UG_XRES >> 3][UG_YRES];
/* This structure describes the overall LCD video controller */
static const struct fb_videoinfo_s g_videoinfo =
@ -281,14 +366,14 @@ static inline void ug_select(FAR struct spi_dev_s *spi)
#else
static void ug_select(FAR struct spi_dev_s *spi)
{
/* Select P14201 chip (locking the SPI bus in case there are multiple
/* Select UG-9664HSWAG01 chip (locking the SPI bus in case there are multiple
* devices competing for the SPI bus
*/
SPI_LOCK(spi, true);
SPI_SELECT(spi, SPIDEV_DISPLAY, true);
/* Now make sure that the SPI bus is configured for the P14201 (it
/* Now make sure that the SPI bus is configured for the UG-9664HSWAG01 (it
* might have gotten configured for a different device while unlocked)
*/
@ -326,7 +411,7 @@ static inline void ug_deselect(FAR struct spi_dev_s *spi)
#else
static void ug_deselect(FAR struct spi_dev_s *spi)
{
/* De-select P14201 chip and relinquish the SPI bus. */
/* De-select UG-9664HSWAG01 chip and relinquish the SPI bus. */
SPI_SELECT(spi, SPIDEV_DISPLAY, false);
SPI_LOCK(spi, false);
@ -353,13 +438,12 @@ static int ug_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
/* Because of this line of code, we will only be able to support a single UG device */
FAR struct ug_dev_s *priv = &g_ugdev;
uint8_t *rowptr;
FAR uint8_t *fbptr;
uint8_t devcol;
uint8_t startcol;
uint8_t endcol;
uint8_t addrlo;
uint8_t addrhi;
uint8_t page;
uint8_t pixelno;
uint8_t i;
int pixlen;
@ -378,24 +462,25 @@ static int ug_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
if (pixlen <= 0 || row > UG_YRES)
{
return;
return OK;
}
/* Update the shadow frame buffer memory */
rowptr = &g_ugfb[0][row];
endcol = col + pixlen;
fbptr = &priv->fb[0][row];
pixelno = 0;
endcol = col + pixlen;
for (i = col; i < endcol; i++)
{
/* Point to the byte to be modified */
uint8_t *ptr = &rowptr[i >> 8];
FAR uint8_t *ptr = &fbptr[i >> 8];
/* Set or clear the corresponding bit */
uint8_t mask = (1 << (i & 7));
if (color > 0)
if ((*buffer & (1 << pixelno)) != 0)
{
*ptr |= mask;
}
@ -403,6 +488,14 @@ static int ug_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
{
*ptr &= ~mask;
}
/* Increment to the next source pixel */
if (++pixelno >= 8)
{
buffer++;
pixelno = 0;
}
}
/* Get the page number. The range of 64 lines is divided up into eight
@ -423,27 +516,27 @@ static int ug_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
/* Select command transfer */
SPI_CMDDATA(spi, SPIDEV_DISPLAY, true);
SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, true);
/* Set the starting position for the run */
(void)SPI_SEND(priv->spi, SSD1305_SETPAGESTART+page); /* Set the page start */
(void)SPI_SEND(priv->spi, SSD1305_SETCOLL + (devcol & 0x0f); /* Set the low column */
(void)SPI_SEND(priv->spi, SSD1305_SETCOLH + (devcol >> 4)); /* Set the high column */
(void)SPI_SEND(priv->spi, SSD1305_SETPAGESTART+page); /* Set the page start */
(void)SPI_SEND(priv->spi, SSD1305_SETCOLL + (devcol & 0x0f)); /* Set the low column */
(void)SPI_SEND(priv->spi, SSD1305_SETCOLH + (devcol >> 4)); /* Set the high column */
/* Select data transfer */
SPI_CMDDATA(spi, SPIDEV_DISPLAY, false);
SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, false);
/* Then transfer all of the data */
startcol = col >> 3;
endcol = (col + pixlen + 7) >> 3;
(void)SPI_SNDBLOCK(priv->spi, &rowptr[startcol], endcol - startcol + 1);
(void)SPI_SNDBLOCK(priv->spi, &fbptr[startcol], endcol - startcol + 1);
/* Unlock and de-select the device */
ug_deselect(spi);
ug_deselect(priv->spi);
return OK;
}
@ -467,7 +560,9 @@ static int ug_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
/* Because of this line of code, we will only be able to support a single UG device */
FAR struct ug_dev_s *priv = &g_ugdev;
uint8_t *rowptr;
uint8_t *fbptr;
uint8_t endcol;
uint8_t pixelno;
uint8_t i;
int pixlen;
@ -484,13 +579,38 @@ static int ug_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
/* Fetch the data from the shadow frame buffer memory */
rowptr = &g_ugfb[0][row];
fbptr = &priv->fb[0][row];
/* Then transfer all of the data */
startcol = col >> 3;
endcol = (col + pixlen + 7) >> 3;
memcpy(buffer, &rowptr[startcol], endcol - startcol + 1);
fbptr = &priv->fb[0][row];
pixelno = 0;
endcol = col + pixlen;
*buffer = 0;
for (i = col; i < endcol; i++)
{
/* Point to the byte to be modified */
uint8_t *ptr = &fbptr[i >> 8];
/* Set or clear the corresponding bit */
if ((*ptr & (1 << (i & 7))) != 0)
{
*buffer |= (1 << pixelno);
}
/* Increment to the next source pixel */
if (++pixelno >= 8)
{
pixelno = 0;
buffer++;
*buffer = 0;
}
}
return OK;
}
@ -533,7 +653,7 @@ static int ug_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
* Name: ug_getpower
*
* Description:
* Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on. On
* Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on). On
* backlit LCDs, this setting may correspond to the backlight setting.
*
**************************************************************************************/
@ -541,8 +661,9 @@ static int ug_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
static int ug_getpower(struct lcd_dev_s *dev)
{
struct ug_dev_s *priv = (struct ug_dev_s *)dev;
gvdbg("power: %d\n", 0);
return 0;
DEBUGASSERT(priv);
gvdbg("powered: %s\n", priv->powered ? "TRUE" : "FALSE");
return priv->powered ? 1 : 0;
}
/**************************************************************************************
@ -558,10 +679,46 @@ static int ug_setpower(struct lcd_dev_s *dev, int power)
{
struct ug_dev_s *priv = (struct ug_dev_s *)dev;
gvdbg("power: %d\n", power);
DEBUGASSERT(power <= CONFIG_LCD_MAXPOWER);
gvdbg("power: %s powered: %s\n",
power != 0 ? "TRUE" : "FALSE",
priv->powered != 0 ? "TRUE" : "FALSE");
/* Set new power level */
DEBUGASSERT(priv && (unsigned)power <= CONFIG_LCD_MAXPOWER);
/* Select and lock the device */
ug_select(priv->spi);
if (power <= 0)
{
/* Turn the display off */
(void)SPI_SEND(priv->spi, SSD1305_DISPOFF); /* Display off */
/* Remove power to the device */
ug_power(0, false);
priv->powered = false;
}
else
{
/* Turn the display on, dim or normal */
if (power == 1)
{
(void)SPI_SEND(priv->spi, SSD1305_DISPONDIM); /* Display on, dim mode */
}
else /* if (power > 1) */
{
(void)SPI_SEND(priv->spi, SSD1305_DISPON); /* Display on, normal mode */
}
(void)SPI_SEND(priv->spi, SSD1305_DISPRAM); /* Resume to RAM content display */
/* Restore power to the device */
ug_power(0, true);
priv->powered = true;
}
ug_deselect(priv->spi);
return OK;
}
@ -578,7 +735,7 @@ static int ug_getcontrast(struct lcd_dev_s *dev)
{
struct ug_dev_s *priv = (struct ug_dev_s *)dev;
DEBUGASSERT(priv);
return return (int)priv->contrast;
return (int)priv->contrast;
}
/**************************************************************************************
@ -607,7 +764,7 @@ static int ug_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
/* Select command transfer */
SPI_CMDDATA(spi, SPIDEV_DISPLAY, true);
SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, true);
/* Set the contrast */
@ -617,7 +774,7 @@ static int ug_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
/* Unlock and de-select the device */
ug_deselect(spi);
ug_deselect(priv->spi);
return OK;
}
@ -638,7 +795,7 @@ static inline void up_clear(FAR struct ug_dev_s *priv)
/* Clear the framebuffer */
memset(g_ugfb, 0, UG_FBSIZE);
memset(priv->fb, UG_Y1_BLACK, UG_FBSIZE);
/* Select and lock the device */
@ -666,7 +823,7 @@ static inline void up_clear(FAR struct ug_dev_s *priv)
for (j = 0; j < 8; j++, row++)
{
(void)SPI_SNDBLOCK(priv->spi, &g_ugfb[0][row], UG_XRES >> 3);
(void)SPI_SNDBLOCK(priv->spi, &priv->fb[0][row], UG_XRES >> 3);
}
}
@ -689,19 +846,27 @@ static inline void up_clear(FAR struct ug_dev_s *priv)
*
**************************************************************************************/
FAR struct lcd_dev_s *up_oledinitialize(FAR struct spi_dev_s *spi)
FAR struct lcd_dev_s *ug_initialize(FAR struct spi_dev_s *spi, unsigned int devno)
{
gvdbg("Initializing\n");
/* Configure and enable LCD */
FAR struct ug_dev_s *priv = &g_ugdev;
FAR struct spi_dev_s *spi = priv->spi;
gvdbg("Initializing\n");
DEBUGASSERT(spi && devno == 0);
/* Save the reference to the SPI device */
priv->spi = spi;
/* Select and lock the device */
ug_select(spi);
/* Make sure that the OLED off */
ug_power(0, false);
/* Select command transfer */
SPI_CMDDATA(spi, SPIDEV_DISPLAY, true);

View File

@ -92,6 +92,7 @@ all: mklibgraphics
gen1bppsources:
@$(MAKE) -C nxglib -f Makefile.sources TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=1 EXTRADEFINES=$(EXTRADEFINES)
@$(MAKE) -C nxfonts -f Makefile.sources TOPDIR=$(TOPDIR) NXFONTS_BITSPERPIXEL=1 EXTRADEFINES=$(EXTRADEFINES)
gen2bppsource:
@$(MAKE) -C nxglib -f Makefile.sources TOPDIR=$(TOPDIR) NXGLIB_BITSPERPIXEL=2 EXTRADEFINES=$(EXTRADEFINES)

View File

@ -34,7 +34,8 @@
############################################################################
NXFONTS_ASRCS =
NXFCONV_CSRC = nxfonts_convert_2bpp.c nxfonts_convert_4bpp.c \
nxfonts_convert_8bpp.c nxfonts_convert_16bpp.c \
nxfonts_convert_24bpp.c nxfonts_convert_32bpp.c
NXFCONV_CSRC = nxfonts_convert_1bpp.c nxfonts_convert_2bpp.c \
nxfonts_convert_4bpp.c nxfonts_convert_8bpp.c \
nxfonts_convert_16bpp.c nxfonts_convert_24bpp.c \
nxfonts_convert_32bpp.c
NXFONTS_CSRCS = nxfonts_bitmaps.c nxfonts_getfont.c $(NXFCONV_CSRC)

View File

@ -36,6 +36,10 @@
-include $(TOPDIR)/.config
-include $(TOPDIR)/Make.defs
ifeq ($(NXFONTS_BITSPERPIXEL),1)
NXFONTS_SUFFIX := _1bpp
CONV_CSRC := nxfonts_convert_1bpp.c
endif
ifeq ($(NXFONTS_BITSPERPIXEL),2)
NXFONTS_SUFFIX := _2bpp
CONV_CSRC := nxfonts_convert_2bpp.c

View File

@ -60,7 +60,17 @@
/* Set up bit blit macros for this BPP */
#if NXFONTS_BITSPERPIXEL == 2
#if NXFONTS_BITSPERPIXEL == 1
# define NXF_PIXELMASK 0x01
# define NXF_SCALEX(x) ((x) >> 3)
# define NXF_PIXEL_T uint8_t
# define NXF_MULTIPIXEL(p) ((uint8_t)(p) << 7 | (uint8_t)(p) << 6 | \
(uint8_t)(p) << 5 | (uint8_t)(p) << 4 | \
(uint8_t)(p) << 3 | (uint8_t)(p) << 2 | \
(uint8_t)(p) << 1 | (p))
#elif NXFONTS_BITSPERPIXEL == 2
# define NXF_PIXELMASK 0x03
# define NXF_SCALEX(x) ((x) >> 2)

View File

@ -0,0 +1,158 @@
/****************************************************************************
* include/nuttx/lcd/ug-9664hswag01.h
* Driver for the Univision UG-9664HSWAG01 Display with the Solomon Systech
* SSD1305 LCD controller.
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* 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 __INCLUDE_NUTTX_UG_9664HSWAG01_H
#define __INCLUDE_NUTTX_UG_9664HSWAG01_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdbool.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* UG-9664HSWAG01 Configuration Settings:
*
* CONFIG_UG9664HSWAG01_SPIMODE - Controls the SPI mode
* CONFIG_UG9664HSWAG01_FREQUENCY - Define to use a different bus frequency
* CONFIG_UG9664HSWAG01_NINTERFACES - Specifies the number of physical
* UG-9664HSWAG01 devices that will be supported. NOTE: At present, this
* must be undefined or defined to be 1.
* CONFIG_UG9664HSWAG01_POWER
* If the hardware supports a controllable OLED a power supply, this
* configuration shold be defined. (See ug_power() below).
* CONFIG_LCD_UGDEBUG - Enable detailed UG-9664HSWAG01 debug output
* (CONFIG_DEBUG and CONFIG_VERBOSE must also be enabled).
*
* Required LCD driver settings:
* CONFIG_LCD_UG9664HSWAG01 - Enable UG-9664HSWAG01 support
* CONFIG_LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be accepted.
* CONFIG_LCD_MAXPOWER should be 2: 0=off, 1=dim, 2=normal
*
* Required SPI driver settings:
* CONFIG_SPI_CMDDATA - Include support for cmd/data selection.
*/
/* Some important "colors" */
#define UG_Y1_BLACK 0
#define UG_Y1_WHITE 1
/* Only three power settings are supported: */
#define UG_POWER_OFF 0
#define UG_POWER_DIM 1
#define UG_POWER_ON 2
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: ug_initialize
*
* Description:
* Initialize the UG-9664HSWAG01 video hardware. The initial state of the
* OLED is fully initialized, display memory cleared, and the OLED ready to
* use, but with the power setting at 0 (full off == sleep mode).
*
* Input Parameters:
*
* spi - A reference to the SPI driver instance.
* devno - A value in the range of 0 throuh CONFIG_UG9664HSWAG01_NINTERFACES-1.
* This allows support for multiple OLED devices.
*
* Returned Value:
*
* On success, this function returns a reference to the LCD object for the specified
* OLED. NULL is returned on any failure.
*
**************************************************************************************/
struct lcd_dev_s; /* see nuttx/lcd.h */
struct spi_dev_s; /* see nuttx/spi.h */
EXTERN FAR struct lcd_dev_s *ug_initialize(FAR struct spi_dev_s *spi, unsigned int devno);
/****************************************************************************
* Name: ug_power
*
* Description:
* If the hardware supports a controllable OLED a power supply, this
* interface should be provided. It may be called by the driver to turn
* the OLED power on and off as needed.
*
* Input Parameters:
*
* devno - A value in the range of 0 throuh CONFIG_UG9664HSWAG01_NINTERFACES-1.
* This allows support for multiple OLED devices.
* on - true:turn power on, false: turn power off.
*
* Returned Value:
* None
*
**************************************************************************************/
#ifdef CONFIG_UG9664HSWAG01_POWER
EXTERN void ug_power(unsigned int devno, bool on);
#else
# define ug_power(a,b)
#endif
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __INCLUDE_NUTTX_UG_9664HSWAG01_H */