forked from Archive/PX4-Autopilot
Add driver for Univision UG-2864AMBAG01
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5319 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
ae6c7f885a
commit
44b76a4244
|
@ -3577,3 +3577,6 @@
|
|||
* configs/stm32f100_generic: Support for generic STM32F100RC board
|
||||
contributed by Freddie Chopin.
|
||||
* arch/arm/src/stm32_otgfsdev.c: Partial fix from Petteri Aimonen.
|
||||
* drivers/lcd/ug-2864ambag01.c and include/nuttx/lcd/ug_2864ambag01.h:
|
||||
LCD driver for the Univision OLED of the same name.
|
||||
|
||||
|
|
|
@ -183,12 +183,95 @@ config NOKIA6100_RGBORD
|
|||
endif
|
||||
|
||||
config LCD_UG9664HSWAG01
|
||||
bool "9664HSWAG01 OLED Display Module"
|
||||
bool "UG-9664HSWAG01 OLED Display Module"
|
||||
default n
|
||||
---help---
|
||||
ug-9664hswag01.c. OLED Display Module, UG-9664HSWAG01", Univision
|
||||
Technology Inc. Used with the LPC Xpresso and Embedded Artists
|
||||
base board.
|
||||
OLED Display Module, UG-9664HSWAG01, Univision Technology Inc. Used
|
||||
with the LPCXpresso and Embedded Artists base board.
|
||||
|
||||
Required LCD driver settings:
|
||||
LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be accepted.
|
||||
LCD_MAXPOWER should be 1: 0=off, 1=on
|
||||
|
||||
Required SPI driver settings:
|
||||
SPI_CMDDATA - Include support for cmd/data selection.
|
||||
|
||||
if LCD_UG9664HSWAG01
|
||||
|
||||
config UG9664HSWAG01_SPIMODE
|
||||
int "UG-9664HSWAG01 SPI Mode"
|
||||
default 0
|
||||
---help---
|
||||
Controls the SPI mode
|
||||
|
||||
config UG9664HSWAG01_FREQUENCY
|
||||
int "UG-9664HSWAG01 SPI Frequency"
|
||||
default 3500000
|
||||
---help---
|
||||
Define to use a different bus frequency
|
||||
|
||||
config UG9664HSWAG01_NINTERFACES
|
||||
int "Number of UG-9664HSWAG01 Devices"
|
||||
default 1
|
||||
---help---
|
||||
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
|
||||
bool "Power control"
|
||||
default n
|
||||
---help---
|
||||
If the hardware supports a controllable OLED a power supply, this
|
||||
configuration should be defined. In this case the system must
|
||||
provide an interface ug_power().
|
||||
|
||||
endif
|
||||
|
||||
config LCD_UG2864AMBAG01
|
||||
bool "UG-2864AMBAG01 OLED Display Module"
|
||||
default n
|
||||
---help---
|
||||
OLED Display Module, UG-2864AMBAG01, Univision Technology Inc.
|
||||
|
||||
Required LCD driver settings:
|
||||
LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be accepted.
|
||||
LCD_MAXPOWER should be 1: 0=off, 1=on
|
||||
|
||||
Required SPI driver settings:
|
||||
SPI_CMDDATA - Include support for cmd/data selection.
|
||||
|
||||
if LCD_UG2864AMBAG01
|
||||
|
||||
config UG2864AMBAG01_SPIMODE
|
||||
int "UG-2864AMBAG01 SPI Mode"
|
||||
default 3
|
||||
---help---
|
||||
Controls the SPI mode
|
||||
|
||||
config UG2864AMBAG01_FREQUENCY
|
||||
int "UG-2864AMBAG01 SPI Frequency"
|
||||
default 3500000
|
||||
---help---
|
||||
Define to use a different bus frequency
|
||||
|
||||
config UG2864AMBAG01_NINTERFACES
|
||||
int "Number of UG-2864AMBAG01 Devices"
|
||||
default 1
|
||||
---help---
|
||||
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 UG2864AMBAG01_FRAMEBUFFER
|
||||
bool "UG-2864AMBAG01 Framebuffer"
|
||||
default y
|
||||
---help---
|
||||
If defined, accesses will be performed using an in-memory copy of the
|
||||
OLED's GRAM. This cost of this buffer is 128 * 64 / 8 = 1Kb.
|
||||
|
||||
If G2864AMBAG01_FRAMEBUFFER is not defined and the LCD is a LANDSCAPE
|
||||
mode, then a 128 byte buffer is still required.
|
||||
|
||||
endif
|
||||
|
||||
config LCD_SSD1289
|
||||
bool "LCD Based on SSD1289 Controller"
|
||||
|
|
|
@ -47,6 +47,10 @@ ifeq ($(CONFIG_LCD_NOKIA6100),y)
|
|||
CSRCS += nokia6100.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_UG2864AMBAG01),y)
|
||||
CSRCS += ug-2864ambag01.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LCD_UG9664HSWAG01),y)
|
||||
CSRCS += ug-9664hswag01.c
|
||||
endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -73,8 +73,6 @@
|
|||
* 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
|
||||
|
@ -119,11 +117,10 @@
|
|||
|
||||
#ifndef CONFIG_DEBUG
|
||||
# undef CONFIG_DEBUG_VERBOSE
|
||||
# undef CONFIG_DEBUG_GRAPHICS
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DEBUG_VERBOSE
|
||||
# undef CONFIG_LCD_UGDEBUG
|
||||
# undef CONFIG_DEBUG_LCD
|
||||
#endif
|
||||
|
||||
/* Check contrast selection */
|
||||
|
@ -198,10 +195,10 @@
|
|||
|
||||
/* Debug ******************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LCD_UGDEBUG
|
||||
# define ugdbg(format, arg...) vdbg(format, ##arg)
|
||||
#ifdef CONFIG_DEBUG_LCD
|
||||
# define lcddbg(format, arg...) vdbg(format, ##arg)
|
||||
#else
|
||||
# define ugdbg(x...)
|
||||
# define lcddbg(x...)
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
|
@ -997,7 +994,7 @@ FAR struct lcd_dev_s *ug_initialize(FAR struct spi_dev_s *spi, unsigned int devn
|
|||
|
||||
SPI_CMDDATA(spi, SPIDEV_DISPLAY, true);
|
||||
|
||||
/* Set the starting position for the run */
|
||||
/* Configure the device */
|
||||
|
||||
(void)SPI_SEND(spi, SSD1305_SETCOLL + 2); /* Set low column address */
|
||||
(void)SPI_SEND(spi, SSD1305_SETCOLH + 2); /* Set high column address */
|
||||
|
|
|
@ -0,0 +1,243 @@
|
|||
/**************************************************************************************
|
||||
* include/nuttx/lcd/ug-2864ambag01.h
|
||||
* Driver for Univision UG-2864AMBAG01 OLED display (wih SH1101A controller)
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* References:
|
||||
* 1. Product Specification (Preliminary), Part Name: OEL Display Module, Part ID:
|
||||
* UG-2864AMBAG01, Doc No: SASI-9015-A, Univision Technology Inc.
|
||||
* 2. SH1101A, 132 X 64 Dot Matrix OLED/PLED, Preliminary Segment/Common Driver with
|
||||
* Controller, Sino Wealth
|
||||
*
|
||||
* 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_8264AMBAG01_H
|
||||
#define __INCLUDE_NUTTX_UG_8264AMBAG01_H
|
||||
|
||||
/**************************************************************************************
|
||||
* Included Files
|
||||
**************************************************************************************/
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/**************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
**************************************************************************************/
|
||||
/* Configuration **********************************************************************/
|
||||
/* UG-2864AMBAG01 Configuration Settings:
|
||||
*
|
||||
* CONFIG_UG2864AMBAG01_SPIMODE - Controls the SPI mode
|
||||
* CONFIG_UG2864AMBAG01_FREQUENCY - Define to use a different bus frequency
|
||||
* CONFIG_UG2864AMBAG01_NINTERFACES - Specifies the number of physical UG-2864AMBAG01
|
||||
* devices that will be supported.
|
||||
* CONFIG_UG2864AMBAG01_FRAMEBUFFER - If defined, accesses will be performed using an
|
||||
* in-memory copy of the OLEDs GDDRAM. This cost of this buffer is 128 * 64 / 8 =
|
||||
* 1Kb.
|
||||
*
|
||||
* If CONFIG_UG2864AMBAG01_FRAMEBUFFER is not defined and the LCD is a LANDSCAPE mode,
|
||||
* then a 128 byte buffer is still required.
|
||||
*
|
||||
* Required LCD driver settings:
|
||||
*
|
||||
* CONFIG_LCD_UG28AMBAG01 - Enable UG-2864AMBAG01 support
|
||||
* CONFIG_LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be accepted.
|
||||
* CONFIG_LCD_MAXPOWER must be 1
|
||||
*
|
||||
* Option LCD driver settings:
|
||||
* CONFIG_LCD_LANDSCAPE, CONFIG_LCD_PORTRAIT, CONFIG_LCD_RLANDSCAPE, and
|
||||
* CONFIG_LCD_RPORTRAIT - Display orientation.
|
||||
*
|
||||
* Required SPI driver settings:
|
||||
* CONFIG_SPI_CMDDATA - Include support for cmd/data selection.
|
||||
*/
|
||||
|
||||
/* SPI Interface
|
||||
*
|
||||
* "The serial interface consists of serial clock SCL, serial data SI, A0 and
|
||||
* CS . SI is shifted into an 8-bit shift register on every rising edge of
|
||||
* SCL in the order of D7, D6, … and D0. A0 is sampled on every eighth clock
|
||||
* and the data byte in the shift register is written to the display data RAM
|
||||
* or command register in the same clock."
|
||||
*
|
||||
* MODE 3:
|
||||
* Clock polarity: High (CPOL=1)
|
||||
* Clock phase: Sample on trailing (rising edge) (CPHA 1)
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_UG2864AMBAG01_SPIMODE
|
||||
# define CONFIG_UG2864AMBAG01_SPIMODE SPIDEV_MODE3
|
||||
#endif
|
||||
|
||||
/* "This module determines whether the input data is interpreted as data or
|
||||
* command. When A0 = “H”, the inputs at D7 - D0 are interpreted as data and be
|
||||
* written to display RAM. When A0 = “L”, the inputs at D7 - D0 are interpreted
|
||||
* as command, they will be decoded and be written to the corresponding command
|
||||
* registers.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_SPI_CMDDATA
|
||||
# error "CONFIG_SPI_CMDDATA must be defined in your NuttX configuration"
|
||||
#endif
|
||||
|
||||
/* CONFIG_UG2864AMBAG01_NINTERFACES determines the number of physical interfaces
|
||||
* that will be supported.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_UG2864AMBAG01_NINTERFACES
|
||||
# define CONFIG_UG2864AMBAG01_NINTERFACES 1
|
||||
#endif
|
||||
|
||||
/* Check contrast selection */
|
||||
|
||||
#if !defined(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 1
|
||||
#endif
|
||||
|
||||
#if CONFIG_LCD_MAXPOWER != 1
|
||||
# warning "CONFIG_LCD_MAXPOWER exceeds supported maximum"
|
||||
# undef CONFIG_LCD_MAXPOWER
|
||||
# define CONFIG_LCD_MAXPOWER 1
|
||||
#endif
|
||||
|
||||
/* Color is 1bpp monochrome with leftmost column contained in bits 0 */
|
||||
|
||||
#ifdef CONFIG_NX_DISABLE_1BPP
|
||||
# warning "1 bit-per-pixel support needed"
|
||||
#endif
|
||||
|
||||
/* Orientation */
|
||||
|
||||
#if defined(CONFIG_LCD_LANDSCAPE)
|
||||
# undef CONFIG_LCD_PORTRAIT
|
||||
# undef CONFIG_LCD_RLANDSCAPE
|
||||
# undef CONFIG_LCD_RPORTRAIT
|
||||
#elif defined(CONFIG_LCD_PORTRAIT)
|
||||
# undef CONFIG_LCD_LANDSCAPE
|
||||
# undef CONFIG_LCD_RLANDSCAPE
|
||||
# undef CONFIG_LCD_RPORTRAIT
|
||||
#elif defined(CONFIG_LCD_RLANDSCAPE)
|
||||
# undef CONFIG_LCD_LANDSCAPE
|
||||
# undef CONFIG_LCD_PORTRAIT
|
||||
# undef CONFIG_LCD_RPORTRAIT
|
||||
#elif defined(CONFIG_LCD_RPORTRAIT)
|
||||
# undef CONFIG_LCD_LANDSCAPE
|
||||
# undef CONFIG_LCD_PORTRAIT
|
||||
# undef CONFIG_LCD_RLANDSCAPE
|
||||
#else
|
||||
# define CONFIG_LCD_LANDSCAPE 1
|
||||
# warning "Assuming landscape orientation"
|
||||
#endif
|
||||
|
||||
/* Some important "colors" */
|
||||
|
||||
#define UG_Y1_BLACK 0
|
||||
#define UG_Y1_WHITE 1
|
||||
|
||||
/**************************************************************************************
|
||||
* Public Types
|
||||
**************************************************************************************/
|
||||
|
||||
/**************************************************************************************
|
||||
* Public Data
|
||||
**************************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
* Public Function Prototypes
|
||||
**************************************************************************************/
|
||||
|
||||
/**************************************************************************************
|
||||
* Name: ug2864ambag01_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the UG-2864AMBAG01 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 through CONFIG_UG2864AMBAG01_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 */
|
||||
FAR struct lcd_dev_s *ug2864ambag01_initialize(FAR struct spi_dev_s *spi,
|
||||
unsigned int devno);
|
||||
|
||||
/************************************************************************************************
|
||||
* Name: ug2864ambag01_fill
|
||||
*
|
||||
* Description:
|
||||
* This non-standard method can be used to clear the entire display by writing one
|
||||
* color to the display. This is much faster than writing a series of runs.
|
||||
*
|
||||
* Input Parameters:
|
||||
* priv - Reference to private driver structure
|
||||
*
|
||||
* Assumptions:
|
||||
* Caller has selected the OLED section.
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
void ug2864ambag01_fill(FAR struct lcd_dev_s *dev, uint8_t color);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_UG_8264AMBAG01_H */
|
|
@ -3,7 +3,7 @@
|
|||
* Driver for the Univision UG-9664HSWAG01 Display with the Solomon Systech
|
||||
* SSD1305 LCD controller.
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -58,8 +58,6 @@
|
|||
* 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
|
||||
|
@ -90,10 +88,8 @@
|
|||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -123,7 +119,7 @@ extern "C" {
|
|||
|
||||
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);
|
||||
FAR struct lcd_dev_s *ug_initialize(FAR struct spi_dev_s *spi, unsigned int devno);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: ug_power
|
||||
|
@ -145,12 +141,11 @@ EXTERN FAR struct lcd_dev_s *ug_initialize(FAR struct spi_dev_s *spi, unsigned i
|
|||
**************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_UG9664HSWAG01_POWER
|
||||
EXTERN void ug_power(unsigned int devno, bool on);
|
||||
void ug_power(unsigned int devno, bool on);
|
||||
#else
|
||||
# define ug_power(a,b)
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue