Add SSD1351 OLED controller support

This commit is contained in:
Paul A. Patience 2015-08-24 13:12:52 -04:00
parent 569ff602ea
commit 01b68e90d0
4 changed files with 1570 additions and 0 deletions

View File

@ -366,6 +366,177 @@ config SSD1306_I2CFREQ
endif # LCD_SSD1306_I2C
config LCD_SSD1351
bool "SSD1351 OLED Display Module"
default n
---help---
OLED Display Module, SSD1351, Solomon Systech.
if LCD_SSD1351
choice
prompt "Interface"
default SSD1351_SPI4WIRE
config SSD1351_SPI3WIRE
bool "3-wire SPI Interface"
select SPI
---help---
Enables support for the 3-wire SPI interface.
config SSD1351_SPI4WIRE
bool "4-wire SPI Interface"
select SPI
select SPI_CMDDATA
---help---
Enables support for the 4-wire SPI interface.
endchoice
config SSD1351_SPIMODE
int "SPI Mode"
default 0
range 0 3
---help---
Specifies the SPI mode.
config SSD1351_SPIFREQ
int "SPI Frequency"
default 1000000
---help---
Specifies the SPI frequency.
config SSD1351_NINTERFACES
int "Number of SSD1351 Devices"
default 1
range 1 1
---help---
Specifies the number of physical SSD1351 devices that will
be supported.
config SSD1351_XRES
int "X Resolution"
default 128
range 1 128
---help---
Specifies the X resolution of the display.
config SSD1351_YRES
int "Y Resolution"
default 128
range 1 128
---help---
Specifies the Y resolution of the display.
config SSD1351_MIRRORX
bool "Mirror X"
default n
---help---
Mirrors the display along the X axis.
config SSD1351_MIRRORY
bool "Mirror Y"
default n
---help---
Mirrors the display along the Y axis.
config SSD1351_INVERT
bool "Invert Display"
default n
---help---
Inverts the display.
config SSD1351_VDDEXT
bool "External VDD"
default n
---help---
Specifies that VDD is external.
config SSD1351_TRST
int "Reset Period"
default 5
range 5 31
---help---
Specifies the reset period in DCLKs.
config SSD1351_TPRECHG1
int "First Pre-charge Period"
default 8
range 3 15
---help---
Specifies the first pre-charge period in DCLKs.
config SSD1351_PERFENHANCE
bool "Enhance Display Performance"
default n
---help---
Enhances the display performance.
config SSD1351_CLKDIV
int "Clock Divider"
default 0
range 0 10
---help---
Specifies the clock divider.
config SSD1351_OSCFREQ
int "Oscillator Frequency"
default 15
range 0 15
---help---
Specifies the oscillator frequency.
config SSD1351_TPRECHG2
int "Second Pre-charge Period"
default 8
range 1 15
---help---
Specifies the second pre-charge period in DCLKs.
config SSD1351_VPRECHG
int "Voltage Pre-charge Level"
default 50
range 20 60
---help---
Specifies the pre-charge voltage level as a percentage of VCC.
config SSD1351_VCOMH
int "COM Deselect Voltage Level"
default 82
range 72 86
---help---
Specifies the COM deselect voltage level as a percentage of VCC.
config SSD1351_CONTRASTA
int "Color A Contrast"
default 138
range 0 255
---help---
Specifies the contrast of color A.
config SSD1351_CONTRASTB
int "Color B Contrast"
default 81
range 0 255
---help---
Specifies the contrast of color B.
config SSD1351_CONTRASTC
int "Color C Contrast"
default 138
range 0 255
---help---
Specifies the contrast of color C.
config SSD1351_MSTRCONTRAST
int "Master Contrast Ratio"
default 16
range 1 16
---help---
Specifies the master contrast ratio in sixteenths.
endif
config LCD_ST7565
bool "ST7565 LCD Display Module"
default n

View File

@ -71,6 +71,10 @@ ifeq ($(CONFIG_LCD_SSD1289),y)
CSRCS += ssd1289.c
endif
ifeq ($(CONFIG_LCD_SSD1351),y)
CSRCS += ssd1351.c
endif
ifeq ($(CONFIG_LCD_MIO283QT2),y)
CSRCS += mio283qt2.c
endif

1256
drivers/lcd/ssd1351.c Normal file

File diff suppressed because it is too large Load Diff

139
include/nuttx/lcd/ssd1351.h Normal file
View File

@ -0,0 +1,139 @@
/****************************************************************************
* include/nuttx/lcd/ssd1351.h
*
* Copyright (C) 2015 Omni Hoverboards Inc. All rights reserved.
* Author: Paul Alexander Patience <paul-a.patience@polymtl.ca>
*
* 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_LCD_SSD1351_H
#define __INCLUDE_NUTTX_LCD_SSD1351_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifdef CONFIG_LCD_SSD1351
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* SSD1351 configuration settings:
* CONFIG_SSD1351_SPI3WIRE - 3-wire SPI interface
* CONFIG_SSD1351_SPI4WIRE - 4-wire SPI interface
* CONFIG_SSD1351_SPIMODE - SPI mode
* CONFIG_SSD1351_SPIFREQ - SPI frequency
* CONFIG_SSD1351_NINTERFACES - number of physical devices supported
* CONFIG_SSD1351_XRES - X resolution
* CONFIG_SSD1351_YRES - Y resolution
* CONFIG_SSD1351_MIRRORX - mirror along the X axis
* CONFIG_SSD1351_MIRRORY - mirror along the Y axis
* CONFIG_SSD1351_INVERT - invert the display
* CONFIG_SSD1351_VDDEXT - external VDD
* CONFIG_SSD1351_TRST - reset period
* CONFIG_SSD1351_TPRECHG1 - first pre-charge period
* CONFIG_SSD1351_PERFENHANCE - enhace display performance
* CONFIG_SSD1351_CLKDIV - clock divider
* CONFIG_SSD1351_OSCFREQ - oscillator frequency
* CONFIG_SSD1351_TPRECHG2 - second pre-charge period
* CONFIG_SSD1351_VPRECHG - pre-charge voltage level
* CONFIG_SSD1351_VCOMH - COM deselect voltage level
* CONFIG_SSD1351_CONTRASTA - color A contrast
* CONFIG_SSD1351_CONTRASTB - color B contrast
* CONFIG_SSD1351_CONTRASTC - color C contrast
* CONFIG_SSD1351_MSTRCONTRAST - master contrast ratio
*
* Required LCD driver settings:
* CONFIG_LCD_SSD1351 - enables SSD1351 support
* CONFIG_LCD_MAXPOWER - maximum power, must be 1
*
* Additional LCD driver settings:
* CONFIG_LCD_LANDSCAPE - landscape
* CONFIG_LCD_RLANDSCAPE - reverse landscape
* CONFIG_LCD_PORTRAIT - portrait
* CONFIG_LCD_RPORTRAIT - reverse portrait
*
* Required SPI driver settings:
* CONFIG_SPI - enables support for SPI
* CONFIG_SPI_CMDDATA - enables support for cmd/data selection
* (if using 4-wire SPI)
*
* NX settings that must be undefined:
* CONFIG_NX_DISABLE_16BPP - disables 16 bpp support
*/
/****************************************************************************
* Public Types
****************************************************************************/
struct spi_dev_s;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/****************************************************************************
* Name: ssd1351_initialize
*
* Description:
* Initialize the video hardware. The initial state of the device
* is fully initialized, display memory cleared, and 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_SSD1351_NINTERFACES-1.
* This allows support for multiple devices.
*
* Returned Value:
* On success, this function returns a reference to the LCD object for the
* specified device. NULL is returned on failure.
*
****************************************************************************/
FAR struct lcd_dev_s *ssd1351_initialize(FAR struct spi_dev_s *spi,
unsigned int devno);
#ifdef __cplusplus
}
#endif
#endif /* CONFIG_LCD_SSD1351 */
#endif /* __INCLUDE_NUTTX_LCD_SSD1351_H */