mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
Add SSD1783 LCD driver for C155 phone
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4981 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -40,5 +40,10 @@ CONFIGURED_APPS += nshlib
|
||||
|
||||
|
||||
# Path to example in apps/examples
|
||||
CONFIGURED_APPS += examples/hello
|
||||
#CONFIGURED_APPS += examples/hello #fails not finding hello_main despite of good config
|
||||
CONFIGURED_APPS += vsn/poweroff
|
||||
CONFIGURED_APPS += examples/ostest
|
||||
CONFIGURED_APPS += examples/nxtext
|
||||
CONFIGURED_APPS += examples/nxhello
|
||||
CONFIGURED_APPS += examples/nxlines
|
||||
CONFIGURED_APPS += examples/nximage
|
||||
|
||||
@@ -207,6 +207,7 @@ CONFIG_HAVE_LIBM=n
|
||||
#
|
||||
#CONFIG_APPS_DIR=
|
||||
CONFIG_DEBUG=n
|
||||
CONFIG_DEBUG_GRAPHICS=n
|
||||
CONFIG_DEBUG_VERBOSE=n
|
||||
CONFIG_DEBUG_SYMBOLS=n
|
||||
CONFIG_ARCH_LOWPUTC=y
|
||||
@@ -434,6 +435,49 @@ CONFIG_NSH_BUILTIN_APPS=y
|
||||
#
|
||||
# Settings for examples/hello
|
||||
CONFIG_EXAMPLES_HELLO_BUILTIN=y
|
||||
CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
|
||||
CONFIG_EXAMPLES_NXTEXT_BUILTIN=y
|
||||
CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
|
||||
CONFIG_EXAMPLES_NXLINES_BUILTIN=y
|
||||
|
||||
CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=2
|
||||
CONFIG_EXAMPLES_NXLINES_LINEWIDTH=4
|
||||
|
||||
CONFIG_EXAMPLES_NXTEXT_NOGETRUN=y
|
||||
CONFIG_EXAMPLES_NXTEXT_BPP=16
|
||||
CONFIG_EXAMPLES_NXTEXT_BGFONTID=14
|
||||
CONFIG_EXAMPLES_NXHELLO_BPP=16
|
||||
CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=y
|
||||
CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=y
|
||||
#CONFIG_EXAMPLES_NXLINES_EXTERNINIT=y
|
||||
#CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=y
|
||||
#CONFIG_EXAMPLES_NXTEXT_EXTERNINIT=y
|
||||
#CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=y
|
||||
|
||||
# LCD Drivers settings
|
||||
CONFIG_NX_LCDDRIVER=y
|
||||
CONFIG_LCD_SSD1783=y
|
||||
|
||||
#
|
||||
# Graphics
|
||||
CONFIG_NX=y
|
||||
CONFIG_NXCONSOLE=n
|
||||
CONFIG_NX_KBD=y
|
||||
CONFIG_LCD_MAXPOWER=1
|
||||
CONFIG_NX_BLOCKING=y
|
||||
CONFIG_NX_DISABLE_1BPP=y
|
||||
CONFIG_NX_DISABLE_2BPP=y
|
||||
CONFIG_NX_DISABLE_4BPP=y
|
||||
CONFIG_NX_DISABLE_8BPP=y
|
||||
CONFIG_NX_DISABLE_16BPP=n
|
||||
CONFIG_NX_DISABLE_24BPP=y
|
||||
CONFIG_NX_DISABLE_32BPP=y
|
||||
CONFIG_NXCONSOLE_BPP=16
|
||||
CONFIG_NXCONSOLE_NOGETRUN=y
|
||||
CONFIG_NXFONT_SANS17X22=y
|
||||
CONFIG_NX_MULTIUSER=n
|
||||
CONFIG_EXAMPLES_NXTEXT_BPP=16
|
||||
CONFIG_EXAMPLES_NXTEXT_DEVNO=0
|
||||
|
||||
#
|
||||
# Settings for examples/wget
|
||||
|
||||
@@ -14,9 +14,9 @@ MEMORY
|
||||
/* 0x800000-0xa00000 */
|
||||
/* compal-loaded binary: our text, initialized data */
|
||||
LRAM (rw) : ORIGIN = 0x00800000, LENGTH = 0x00020000
|
||||
TRAM (rw) : ORIGIN = 0x00820000, LENGTH = 0x00019000
|
||||
TRAM (rw) : ORIGIN = 0x00820000, LENGTH = 0x0001d000
|
||||
/* compal-loaded binary: our unitialized data, stacks, heap */
|
||||
IRAM (rw) : ORIGIN = 0x00839000, LENGTH = 0x00006000
|
||||
IRAM (rw) : ORIGIN = 0x0083d000, LENGTH = 0x00002000
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ CFLAGS += -I$(TOPDIR)/sched
|
||||
|
||||
ASRCS =
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
CSRCS = dummy.c
|
||||
CSRCS = dummy.c ssd1783.c
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,110 @@
|
||||
#ifndef SSD1783_H_
|
||||
#define SSD1783_H_
|
||||
|
||||
#include <nuttx/lcd/lcd.h>
|
||||
|
||||
#define FB_COLOR_TO_R(v) (((v)>>16) & 0xff)
|
||||
#define FB_COLOR_TO_G(v) (((v)>> 8) & 0xff)
|
||||
#define FB_COLOR_TO_B(v) ( (v) & 0xff)
|
||||
|
||||
#define SSD1783_UWIRE_BITLEN 9
|
||||
#define SSD1783_DEV_ID 0
|
||||
|
||||
#define ARMIO_LATCH_OUT 0xfffe4802
|
||||
#define IO_CNTL_REG 0xfffe4804
|
||||
#define ASIC_CONF_REG 0xfffef008
|
||||
|
||||
#define ASCONF_PWL_ENA (1 << 4)
|
||||
|
||||
/* begin backlight.c */
|
||||
#define BASE_ADDR_PWL 0xfffe8000
|
||||
#define PWL_REG(m) (BASE_ADDR_PWL + (m))
|
||||
|
||||
enum pwl_reg {
|
||||
PWL_LEVEL = 0,
|
||||
PWL_CTRL = 1,
|
||||
};
|
||||
|
||||
enum ssd1783_cmdflag { CMD, DATA, END };
|
||||
|
||||
struct ssd1783_cmdlist {
|
||||
enum ssd1783_cmdflag is_cmd:8; /* 1: is a command, 0: is data, 2: end marker! */
|
||||
uint8_t data; /* 8 bit to send to LC display */
|
||||
} __attribute__((packed));
|
||||
|
||||
static const struct ssd1783_cmdlist nop[] = {
|
||||
{ CMD, 0x25 }, // NOP command
|
||||
{ END, 0x00 }
|
||||
};
|
||||
|
||||
static const struct ssd1783_cmdlist
|
||||
ssd1783_initdata[] = {
|
||||
{ CMD, 0xD1 }, /* CMD set internal oscillator on */
|
||||
{ CMD, 0x94 }, /* CMD leave sleep mode */
|
||||
{ CMD, 0xbb }, /* CMD Set COM Output Scan Direction: */
|
||||
{ DATA, 0x01 }, /* DATA: 01: COM0-79, then COM159-80 */
|
||||
/* -------- DIFFERENT FROM ORIGINAL CODE: -------------- */
|
||||
/* we use 8bit per pixel packed RGB 332 */
|
||||
{ CMD, 0xbc }, /* CMD Set Data Output Scan Direction */
|
||||
{ DATA, 0x00 }, /* DATA: column scan, normal rotation, normal display */
|
||||
{ DATA, 0x00 }, /* DATA: RGB color arrangement R G B R G B ... */
|
||||
/*-->*/ { DATA, 0x01 }, /* DATA: 8 bit per pixel mode MSB <RRRGGGBB> LSB */
|
||||
/* --------- /DIFFERENT ---------- */
|
||||
{ CMD, 0xce }, /* CMD Set 256 Color Look Up Table LUT */
|
||||
{ DATA, 0x00 }, /* DATA red 000 */
|
||||
{ DATA, 0x03 }, /* DATA red 001 */
|
||||
{ DATA, 0x05 }, /* DATA red 010 */
|
||||
{ DATA, 0x07 }, /* DATA red 011 */
|
||||
{ DATA, 0x09 }, /* DATA red 100 */
|
||||
{ DATA, 0x0b }, /* DATA red 101 */
|
||||
{ DATA, 0x0d }, /* DATA red 110 */
|
||||
{ DATA, 0x0f }, /* DATA red 111 */
|
||||
{ DATA, 0x00 }, /* DATA green 000 */
|
||||
{ DATA, 0x03 }, /* DATA green 001 */
|
||||
{ DATA, 0x05 }, /* DATA green 010 */
|
||||
{ DATA, 0x07 }, /* DATA green 011 */
|
||||
{ DATA, 0x09 }, /* DATA green 100 */
|
||||
{ DATA, 0x0b }, /* DATA green 101 */
|
||||
{ DATA, 0x0d }, /* DATA green 110 */
|
||||
{ DATA, 0x0f }, /* DATA green 111 */
|
||||
{ DATA, 0x00 }, /* DATA blue 00 */
|
||||
{ DATA, 0x05 }, /* DATA blue 01 */
|
||||
{ DATA, 0x0a }, /* DATA blue 10 */
|
||||
{ DATA, 0x0f }, /* DATA blue 11 */
|
||||
{ CMD, 0xca }, /* CMD Set Display Control - Driver Duty Selection */
|
||||
{ DATA, 0xff }, // can't find description of the values in the original
|
||||
{ DATA, 0x10 }, // display/ssd1783.c in my datasheet :-(
|
||||
{ DATA, 0x01 }, //
|
||||
{ CMD, 0xab }, /* CMD Set Scroll Start */
|
||||
{ DATA, 0x00 }, /* DATA: Starting address at block 0 */
|
||||
{ CMD, 0x20 }, /* CMD Set power control register */
|
||||
{ DATA, 0x0b }, /* DATA: booster 6x, reference gen. & int regulator */
|
||||
{ CMD, 0x81 }, /* CMD Contrast Lvl & Int. Regul. Resistor Ratio */
|
||||
{ DATA, 0x29 }, /* DATA: contrast = 0x29 */
|
||||
{ DATA, 0x05 }, /* DATA: 0x05 = 0b101 -> 1+R2/R1 = 11.37 */
|
||||
{ CMD, 0xa7 }, /* CMD Invert Display */
|
||||
{ CMD, 0x82 }, /* CMD Set Temperature Compensation Coefficient */
|
||||
{ DATA, 0x00 }, /* DATA: Gradient is -0.10 % / degC */
|
||||
{ CMD, 0xfb }, /* CMD Set Biasing Ratio */
|
||||
{ DATA, 0x03 }, /* DATA: 1/10 bias */
|
||||
{ CMD, 0xf2 }, /* CMD Set Frame Frequency and N-line inversion */
|
||||
{ DATA, 0x08 }, /* DATA: 75 Hz (POR) */
|
||||
{ DATA, 0x06 }, /* DATA: n-line inversion: 6 lines */
|
||||
{ CMD, 0xf7 }, /* CMD Select PWM/FRC Select Full Col./8col mode */
|
||||
{ DATA, 0x28 }, /* DATA: always 0x28 */
|
||||
{ DATA, 0x8c }, /* DATA: 4bit PWM + 2 bit FRC */
|
||||
{ DATA, 0x05 }, /* DATA: full color mode */
|
||||
{ CMD, 0xaf }, /* CMD Display On */
|
||||
{ END, 0x00 }, /* MARKER: end of list */
|
||||
};
|
||||
|
||||
struct ssd1783_dev_s
|
||||
{
|
||||
/* Publicly visible device structure */
|
||||
struct lcd_dev_s dev;
|
||||
|
||||
/* Private LCD-specific information follows */
|
||||
uint8_t power; /* Current power setting */
|
||||
};
|
||||
|
||||
#endif /* SSD1783_H_ */
|
||||
@@ -60,8 +60,11 @@ export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
|
||||
|
||||
# This the Cygwin path to the location where I installed the Pinguino
|
||||
# toolchain under Windows. You will have to edit this if you install the
|
||||
# tool chain in a different location or use a different version
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/PinguinoX.3/win32/p32/bin"
|
||||
# tool chain in a different location or use a different version. /bin
|
||||
# needs to precede the tool path or otherwise you will get
|
||||
# /cygdrive/c/PinguinoX.3/win32/p32/bin/make which does not like POSIX
|
||||
# style paths.
|
||||
#export TOOLCHAIN_BIN="/bin:/cygdrive/c/PinguinoX.3/win32/p32/bin"
|
||||
|
||||
# This the Linux path to the location where I installed the microchipOpen
|
||||
# toolchain under Linux. You will have to edit this if you use the
|
||||
|
||||
@@ -60,8 +60,11 @@ export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
|
||||
|
||||
# This the Cygwin path to the location where I installed the Pinguino
|
||||
# toolchain under Windows. You will have to edit this if you install the
|
||||
# tool chain in a different location or use a different version
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/PinguinoX.3/win32/p32/bin"
|
||||
# tool chain in a different location or use a different version. /bin
|
||||
# needs to precede the tool path or otherwise you will get
|
||||
# /cygdrive/c/PinguinoX.3/win32/p32/bin/make which does not like POSIX
|
||||
# style paths.
|
||||
#export TOOLCHAIN_BIN="/bin:/cygdrive/c/PinguinoX.3/win32/p32/bin"
|
||||
|
||||
# This the Linux path to the location where I installed the microchipOpen
|
||||
# toolchain under Linux. You will have to edit this if you use the
|
||||
|
||||
@@ -60,8 +60,11 @@ export TOOLCHAIN_BIN="/cygdrive/c/MicroChip/mplabc32/v1.12/bin"
|
||||
|
||||
# This the Cygwin path to the location where I installed the Pinguino
|
||||
# toolchain under Windows. You will have to edit this if you install the
|
||||
# tool chain in a different location or use a different version
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/PinguinoX.3/win32/p32/bin"
|
||||
# tool chain in a different location or use a different version. /bin
|
||||
# needs to precede the tool path or otherwise you will get
|
||||
# /cygdrive/c/PinguinoX.3/win32/p32/bin/make which does not like POSIX
|
||||
# style paths.
|
||||
#export TOOLCHAIN_BIN="/bin:/cygdrive/c/PinguinoX.3/win32/p32/bin"
|
||||
|
||||
# This the Linux path to the location where I installed the microchipOpen
|
||||
# toolchain under Linux. You will have to edit this if you use the
|
||||
|
||||
Reference in New Issue
Block a user