The PIC32MX7 MMB's mio832qt2 LCD is functional
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4803 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
1db2607409
commit
0b43f10d73
@ -50,33 +50,33 @@
|
||||
/* Register Offsets *****************************************************************/
|
||||
|
||||
#define PIC32MX_PMP_CON_OFFSET 0x0000 /* Parallel Port Control Register */
|
||||
#define PIC32MX_PMP_CONCLR_OFFSET 0x0000 /* Parallel Port Control Clear Register */
|
||||
#define PIC32MX_PMP_CONSET_OFFSET 0x0000 /* Parallel Port Control Set Register */
|
||||
#define PIC32MX_PMP_CONINV_OFFSET 0x0000 /* Parallel Port Control Invert Register */
|
||||
#define PIC32MX_PMP_MODE_OFFSET 0x0000 /* Parallel Port Mode Register */
|
||||
#define PIC32MX_PMP_MODECLR_OFFSET 0x0000 /* Parallel Port Mode Clear Register */
|
||||
#define PIC32MX_PMP_MODESET_OFFSET 0x0000 /* Parallel Port Mode Set Register */
|
||||
#define PIC32MX_PMP_MODEINV_OFFSET 0x0000 /* Parallel Port Mode Invert Register */
|
||||
#define PIC32MX_PMP_ADDR_OFFSET 0x0000 /* Parallel Port Address Register */
|
||||
#define PIC32MX_PMP_ADDRCLR_OFFSET 0x0000 /* Parallel Port Address Clear Register */
|
||||
#define PIC32MX_PMP_ADDRSET_OFFSET 0x0000 /* Parallel Port Address Set Register */
|
||||
#define PIC32MX_PMP_ADDRINV_OFFSET 0x0000 /* Parallel Port Address Invert Register */
|
||||
#define PIC32MX_PMP_DOUT_OFFSET 0x0000 /* Parallel Port Data Output Register */
|
||||
#define PIC32MX_PMP_DOUTCLR_OFFSET 0x0000 /* Parallel Port Data Output Clear Register */
|
||||
#define PIC32MX_PMP_DOUTSET_OFFSET 0x0000 /* Parallel Port Data Output Set Register */
|
||||
#define PIC32MX_PMP_DOUTINV_OFFSET 0x0000 /* Parallel Port Data Output Invert Register */
|
||||
#define PIC32MX_PMP_DIN_OFFSET 0x0000 /* Parallel Port Data Input Register */
|
||||
#define PIC32MX_PMP_DINCLR_OFFSET 0x0000 /* Parallel Port Data Input Clear Register */
|
||||
#define PIC32MX_PMP_DINSET_OFFSET 0x0000 /* Parallel Port Data Input Set Register */
|
||||
#define PIC32MX_PMP_DININV_OFFSET 0x0000 /* Parallel Port Data Input Invert Register */
|
||||
#define PIC32MX_PMP_AEN_OFFSET 0x0000 /* Parallel Port Pin Enable Register */
|
||||
#define PIC32MX_PMP_AENCLR_OFFSET 0x0000 /* Parallel Port Pin Enable Clear Register */
|
||||
#define PIC32MX_PMP_AENSET_OFFSET 0x0000 /* Parallel Port Pin Enable Set Register */
|
||||
#define PIC32MX_PMP_AENINV_OFFSET 0x0000 /* Parallel Port Pin Enable Invert Register */
|
||||
#define PIC32MX_PMP_STAT_OFFSET 0x0000 /* Parallel Port Status Register */
|
||||
#define PIC32MX_PMP_STATCLR_OFFSET 0x0000 /* Parallel Port Status Clear Register */
|
||||
#define PIC32MX_PMP_STATSET_OFFSET 0x0000 /* Parallel Port Status Set Register */
|
||||
#define PIC32MX_PMP_STATINV_OFFSET 0x0000 /* Parallel Port Status Invert Register */
|
||||
#define PIC32MX_PMP_CONCLR_OFFSET 0x0004 /* Parallel Port Control Clear Register */
|
||||
#define PIC32MX_PMP_CONSET_OFFSET 0x0008 /* Parallel Port Control Set Register */
|
||||
#define PIC32MX_PMP_CONINV_OFFSET 0x000c /* Parallel Port Control Invert Register */
|
||||
#define PIC32MX_PMP_MODE_OFFSET 0x0010 /* Parallel Port Mode Register */
|
||||
#define PIC32MX_PMP_MODECLR_OFFSET 0x0014 /* Parallel Port Mode Clear Register */
|
||||
#define PIC32MX_PMP_MODESET_OFFSET 0x0018 /* Parallel Port Mode Set Register */
|
||||
#define PIC32MX_PMP_MODEINV_OFFSET 0x001c /* Parallel Port Mode Invert Register */
|
||||
#define PIC32MX_PMP_ADDR_OFFSET 0x0020 /* Parallel Port Address Register */
|
||||
#define PIC32MX_PMP_ADDRCLR_OFFSET 0x0024 /* Parallel Port Address Clear Register */
|
||||
#define PIC32MX_PMP_ADDRSET_OFFSET 0x0028 /* Parallel Port Address Set Register */
|
||||
#define PIC32MX_PMP_ADDRINV_OFFSET 0x002c /* Parallel Port Address Invert Register */
|
||||
#define PIC32MX_PMP_DOUT_OFFSET 0x0030 /* Parallel Port Data Output Register */
|
||||
#define PIC32MX_PMP_DOUTCLR_OFFSET 0x0034 /* Parallel Port Data Output Clear Register */
|
||||
#define PIC32MX_PMP_DOUTSET_OFFSET 0x0038 /* Parallel Port Data Output Set Register */
|
||||
#define PIC32MX_PMP_DOUTINV_OFFSET 0x003c /* Parallel Port Data Output Invert Register */
|
||||
#define PIC32MX_PMP_DIN_OFFSET 0x0040 /* Parallel Port Data Input Register */
|
||||
#define PIC32MX_PMP_DINCLR_OFFSET 0x0044 /* Parallel Port Data Input Clear Register */
|
||||
#define PIC32MX_PMP_DINSET_OFFSET 0x0048 /* Parallel Port Data Input Set Register */
|
||||
#define PIC32MX_PMP_DININV_OFFSET 0x004c /* Parallel Port Data Input Invert Register */
|
||||
#define PIC32MX_PMP_AEN_OFFSET 0x0050 /* Parallel Port Pin Enable Register */
|
||||
#define PIC32MX_PMP_AENCLR_OFFSET 0x0054 /* Parallel Port Pin Enable Clear Register */
|
||||
#define PIC32MX_PMP_AENSET_OFFSET 0x0058 /* Parallel Port Pin Enable Set Register */
|
||||
#define PIC32MX_PMP_AENINV_OFFSET 0x005c /* Parallel Port Pin Enable Invert Register */
|
||||
#define PIC32MX_PMP_STAT_OFFSET 0x0060 /* Parallel Port Status Register */
|
||||
#define PIC32MX_PMP_STATCLR_OFFSET 0x0064 /* Parallel Port Status Clear Register */
|
||||
#define PIC32MX_PMP_STATSET_OFFSET 0x0068 /* Parallel Port Status Set Register */
|
||||
#define PIC32MX_PMP_STATINV_OFFSET 0x006c /* Parallel Port Status Invert Register */
|
||||
|
||||
/* Register Addresses ***************************************************************/
|
||||
|
||||
|
@ -745,6 +745,15 @@ Where <subdir> is one of the following:
|
||||
Adding LCD and graphics support to the nsh configuration:
|
||||
--------------------------------------------------------
|
||||
|
||||
LCD support is already enabled in defconfig (nuttx/.config):
|
||||
|
||||
CONFIG_NX=y : Enable graphics suppport
|
||||
CONFIG_PIC32MX_PMP=y : Enable parallel port support
|
||||
CONFIG_LCD_MIO283QT2=y : MIO283QT2 LCD support
|
||||
|
||||
But you will have to enable a specific graphics example application
|
||||
in order to see anything.
|
||||
|
||||
appconfig (apps/.config): Enable the application configurations that you
|
||||
want to use. Asexamples:
|
||||
|
||||
@ -753,6 +762,3 @@ Where <subdir> is one of the following:
|
||||
CONFIGURED_APPS += examples/nximage :
|
||||
CONFIGURED_APPS += examples/nxlines :
|
||||
|
||||
defconfig (nuttx/.config):
|
||||
|
||||
CONFIG_NX=y : Enable graphics suppport
|
||||
|
@ -150,7 +150,7 @@ CONFIG_PIC32MX_UART3=n
|
||||
CONFIG_PIC32MX_UART4=n
|
||||
CONFIG_PIC32MX_UART5=n
|
||||
CONFIG_PIC32MX_UART6=n
|
||||
CONFIG_PIC32MX_PMP=n
|
||||
CONFIG_PIC32MX_PMP=y
|
||||
CONFIG_PIC32MX_ADC=n
|
||||
CONFIG_PIC32MX_CVR=n
|
||||
CONFIG_PIC32MX_CM1=n
|
||||
@ -1132,7 +1132,7 @@ CONFIG_USBMSC_REMOVABLE=y
|
||||
# too many messages (CONFIG_PREALLOC_MQ_MSGS controls how many
|
||||
# messages are pre-allocated).
|
||||
#
|
||||
CONFIG_NX=n
|
||||
CONFIG_NX=y
|
||||
CONFIG_NX_MULTIUSER=n
|
||||
CONFIG_NX_NPLANES=1
|
||||
CONFIG_NX_DISABLE_1BPP=y
|
||||
@ -1234,12 +1234,12 @@ CONFIG_NXCONSOLE_CACHESIZE=32
|
||||
# PIC32MX7 MMB's LCD ribbon cable is at the top of the display.
|
||||
# Default is 320x240 "landscape" orientation.
|
||||
#
|
||||
CONFIG_LCD_MIO283QT2=n
|
||||
CONFIG_LCD_MIO283QT2=y
|
||||
CONFIG_LCD_NOGETRUN=n
|
||||
CONFIG_LCD_LANDSCAPE=n
|
||||
CONFIG_LCD_RLANDSCAPE=n
|
||||
CONFIG_LCD_PORTRAIT=n
|
||||
CONFIG_LCD_RPORTRAIT=y
|
||||
CONFIG_LCD_PORTRAIT=y
|
||||
CONFIG_LCD_RPORTRAIT=n
|
||||
|
||||
#
|
||||
# PIC32MX7 MMB specific LCD settings
|
||||
@ -1405,6 +1405,168 @@ CONFIG_I2CTOOL_DEFFREQ=100000
|
||||
# 10.0.0.1
|
||||
# CONFIG_EXAMPLE_FTPD_NETMASK - The network mask. Default: 255.255.255.0
|
||||
|
||||
#
|
||||
# Settings for examples/nx
|
||||
#
|
||||
# CONFIG_EXAMPLES_NX_BUILTIN -- Build the NX example as a "built-in"
|
||||
# that can be executed from the NSH command line
|
||||
# CONFIG_EXAMPLES_NX_VPLANE -- The plane to select from the frame-
|
||||
# buffer driver for use in the test. Default: 0
|
||||
# CONFIG_EXAMPLES_NX_DEVNO - The LCD device to select from the LCD
|
||||
# driver for use in the test: Default: 0
|
||||
# CONFIG_EXAMPLES_NX_BGCOLOR -- The color of the background. Default depends on
|
||||
# CONFIG_EXAMPLES_NX_BPP.
|
||||
# CONFIG_EXAMPLES_NX_COLOR1 -- The color of window 1. Default depends on
|
||||
# CONFIG_EXAMPLES_NX_BPP.
|
||||
# CONFIG_EXAMPLES_NX_COLOR2 -- The color of window 2. Default depends on
|
||||
# CONFIG_EXAMPLES_NX_BPP.
|
||||
# CONFIG_EXAMPLES_NX_TBCOLOR -- The color of the toolbar. Default depends on
|
||||
# CONFIG_EXAMPLES_NX_BPP.
|
||||
# CONFIG_EXAMPLES_NX_FONTID - Selects the font (see font ID numbers in
|
||||
# include/nuttx/nx/nxfonts.h)
|
||||
# CONFIG_EXAMPLES_NX_FONTCOLOR -- The color of the toolbar. Default depends on
|
||||
# CONFIG_EXAMPLES_NX_BPP.
|
||||
# CONFIG_EXAMPLES_NX_BPP -- Pixels per pixel to use. Valid options
|
||||
# include 2, 4, 8, 16, 24, and 32. Default is 32.
|
||||
# CONFIG_EXAMPLES_NX_RAWWINDOWS -- Use raw windows; Default is to
|
||||
# use pretty, framed NXTK windows with toolbars.
|
||||
# CONFIG_EXAMPLES_NX_STACKSIZE -- The stacksize to use when creating
|
||||
# the NX server. Default 2048
|
||||
# CONFIG_EXAMPLES_NX_CLIENTPRIO -- The client priority. Default: 80
|
||||
# CONFIG_EXAMPLES_NX_SERVERPRIO -- The server priority. Default: 120
|
||||
# CONFIG_EXAMPLES_NX_NOTIFYSIGNO -- The signal number to use with
|
||||
# nx_eventnotify(). Default: 4
|
||||
#
|
||||
CONFIG_EXAMPLES_NX_BUILTIN=y
|
||||
CONFIG_EXAMPLES_NX_VPLANE=0
|
||||
CONFIG_EXAMPLES_NX_DEVNO=0
|
||||
CONFIG_EXAMPLES_NX_BGCOLOR=0x0011
|
||||
CONFIG_EXAMPLES_NX_COLOR1=0xaedc
|
||||
CONFIG_EXAMPLES_NX_COLOR2=0xe7ff
|
||||
CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a
|
||||
CONFIG_EXAMPLES_NX_FONTID=0
|
||||
CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000
|
||||
CONFIG_EXAMPLES_NX_BPP=16
|
||||
CONFIG_EXAMPLES_NX_RAWWINDOWS=n
|
||||
CONFIG_EXAMPLES_NX_STACKSIZE=2048
|
||||
CONFIG_EXAMPLES_NX_CLIENTPRIO=80
|
||||
CONFIG_EXAMPLES_NX_SERVERPRIO=120
|
||||
CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
|
||||
CONFIG_EXAMPLES_NX_EXTERNINIT=n
|
||||
|
||||
#
|
||||
# Settings for examples/nxhello
|
||||
#
|
||||
# CONFIG_EXAMPLES_NXHELLO_BUILTIN -- Build the NXHELLO example as a "built-in"
|
||||
# that can be executed from the NSH command line
|
||||
# CONFIG_EXAMPLES_NXHELLO_VPLANE -- The plane to select from the frame-
|
||||
# buffer driver for use in the test. Default: 0
|
||||
# CONFIG_EXAMPLES_NXHELLO_DEVNO - The LCD device to select from the LCD
|
||||
# driver for use in the test: Default: 0
|
||||
# CONFIG_EXAMPLES_NXHELLO_BGCOLOR -- The color of the background. Default
|
||||
# depends on CONFIG_EXAMPLES_NXHELLO_BPP.
|
||||
# CONFIG_EXAMPLES_NXHELLO_FONTID - Selects the font (see font ID numbers in
|
||||
# include/nuttx/nx/nxfonts.h)
|
||||
# CONFIG_EXAMPLES_NXHELLO_FONTCOLOR -- The color of the fonts used in the
|
||||
# background window. Default depends on CONFIG_EXAMPLES_NXHELLO_BPP.
|
||||
# CONFIG_EXAMPLES_NXHELLO_BPP -- Pixels per pixel to use. Valid options
|
||||
# include 2, 4, 8, 16, 24, and 32. Default is 32.
|
||||
# CONFIG_EXAMPLES_NXHELLO_EXTERNINIT - The driver for the graphics device on
|
||||
# this platform requires some unusual initialization. This is the
|
||||
# for, for example, SPI LCD/OLED devices. If this configuration is
|
||||
# selected, then the platform code must provide an LCD initialization
|
||||
# function.
|
||||
#
|
||||
CONFIG_EXAMPLES_NXHELLO_BUILTIN=y
|
||||
CONFIG_EXAMPLES_NXHELLO_VPLANE=0
|
||||
CONFIG_EXAMPLES_NXHELLO_DEVNO=0
|
||||
CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011
|
||||
CONFIG_EXAMPLES_NXHELLO_FONTID=6
|
||||
CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf
|
||||
CONFIG_EXAMPLES_NXHELLO_BPP=16
|
||||
CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n
|
||||
|
||||
#
|
||||
# Settings for examples/nximage
|
||||
#
|
||||
# CONFIG_EXAMPLES_NXIMAGE_BUILTIN -- Build the NXIMAGE example as a "built-in"
|
||||
# that can be executed from the NSH command line
|
||||
# CONFIG_EXAMPLES_NXIMAGE_VPLANE -- The plane to select from the frame-
|
||||
# buffer driver for use in the test. Default: 0
|
||||
# CONFIG_EXAMPLES_NXIMAGE_DEVNO - The LCD device to select from the LCD
|
||||
# driver for use in the test: Default: 0
|
||||
# CONFIG_EXAMPLES_NXIMAGE_BPP -- Pixels per pixel to use. Valid options
|
||||
# include 8, 16, and 24. Default is 16.
|
||||
# CONFIG_EXAMPLES_NXIMAGE_XSCALEp5, CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5,
|
||||
# CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0 -- The logo image width is 160 columns.
|
||||
# One of these may be defined to rescale the image horizontally by .5, 1.5,
|
||||
# or 2.0.
|
||||
# CONFIG_EXAMPLES_NXIMAGE_YSCALEp5, CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5,
|
||||
# CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0 -- The logo image height is 160 rows.
|
||||
# One of these may be defined to rescale the image vertically by .5, 1.5,
|
||||
# or 2.0.
|
||||
# CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT - The driver for the graphics device on
|
||||
# this platform requires some unusual initialization. This is the
|
||||
# for, for example, SPI LCD/OLED devices. If this configuration is
|
||||
# selected, then the platform code must provide an LCD initialization
|
||||
# function.
|
||||
#
|
||||
CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y
|
||||
CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
|
||||
CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
|
||||
CONFIG_EXAMPLES_NXIMAGE_BPP=16
|
||||
CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n
|
||||
CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y
|
||||
CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n
|
||||
CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n
|
||||
CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y
|
||||
CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n
|
||||
CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n
|
||||
|
||||
#
|
||||
# Settings for examples/nxlines
|
||||
#
|
||||
# CONFIG_EXAMPLES_NXLINES_BUILTIN -- Build the NXLINES example as a "built-in"
|
||||
# that can be executed from the NSH command line
|
||||
# CONFIG_EXAMPLES_NXLINES_VPLANE -- The plane to select from the frame-
|
||||
# buffer driver for use in the test. Default: 0
|
||||
# CONFIG_EXAMPLES_NXLINES_DEVNO - The LCD device to select from the LCD
|
||||
# driver for use in the test: Default: 0
|
||||
# CONFIG_EXAMPLES_NXLINES_BGCOLOR -- The color of the background. Default
|
||||
# depends on CONFIG_EXAMPLES_NXLINES_BPP.
|
||||
# CONFIG_EXAMPLES_NXLINES_LINEWIDTH - Selects the width of the lines in
|
||||
# pixels (default: 16)
|
||||
# CONFIG_EXAMPLES_NXLINES_LINECOLOR -- The color of the central lines drawn
|
||||
# in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
|
||||
# (there really is no meaningful default).
|
||||
# CONFIG_EXAMPLES_NXLINES_BORDERWIDTH -- The width of the circular border
|
||||
# drawn in the background window. (default: 4).
|
||||
# CONFIG_EXAMPLES_NXLINES_BORDERCOLOR -- The color of the circular border
|
||||
# drawn in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
|
||||
# (there really is no meaningful default).
|
||||
# CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR -- The color of the circular region
|
||||
# filled in the background window. Default depends on CONFIG_EXAMPLES_NXLINES_BPP
|
||||
# (there really is no meaningful default).
|
||||
# CONFIG_EXAMPLES_NXLINES_BPP -- Pixels per pixel to use. Valid options
|
||||
# include 2, 4, 8, 16, 24, and 32. Default is 16.
|
||||
# CONFIG_EXAMPLES_NXLINES_EXTERNINIT - The driver for the graphics device on
|
||||
# this platform requires some unusual initialization. This is the
|
||||
# for, for example, SPI LCD/OLED devices. If this configuration is
|
||||
# selected, then the platform code must provide an LCD initialization
|
||||
# function.
|
||||
#
|
||||
CONFIG_EXAMPLES_NXLINES_BUILTIN=y
|
||||
CONFIG_EXAMPLES_NXLINES_VPLANE=0
|
||||
CONFIG_EXAMPLES_NXLINES_DEVNO=0
|
||||
CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320
|
||||
CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16
|
||||
CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0
|
||||
CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4
|
||||
CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0
|
||||
CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb
|
||||
CONFIG_EXAMPLES_NXLINES_BPP=16
|
||||
CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n
|
||||
|
||||
#
|
||||
# Settings for examples/usbserial
|
||||
#
|
||||
|
@ -141,8 +141,8 @@
|
||||
/* Debug ******************************************************************************/
|
||||
|
||||
#ifdef CONFIG_DEBUG_LCD
|
||||
# define lcddbg dbg
|
||||
# define lcdvdbg vdbg
|
||||
# define lcddbg dbg
|
||||
# define lcdvdbg vdbg
|
||||
#else
|
||||
# define lcddbg(x...)
|
||||
# define lcdvdbg(x...)
|
||||
@ -154,10 +154,11 @@
|
||||
|
||||
struct pic32mx7mmb_dev_s
|
||||
{
|
||||
struct mio283qt2_lcd_s dev; /* The externally visible part of the driver */
|
||||
bool rs; /* true=data selected */
|
||||
bool cs; /* true=LCD selected */
|
||||
FAR struct lcd_dev_s *drvr; /* The saved instance of the LCD driver */
|
||||
struct mio283qt2_lcd_s dev; /* The externally visible part of the driver */
|
||||
bool data; /* true=data selected */
|
||||
bool selected; /* true=LCD selected */
|
||||
bool reading; /* true=We are in a read sequence */
|
||||
FAR struct lcd_dev_s *drvr; /* The saved instance of the LCD driver */
|
||||
};
|
||||
|
||||
/**************************************************************************************
|
||||
@ -210,10 +211,12 @@ static void pic32mx_command(FAR struct pic32mx7mmb_dev_s *priv)
|
||||
{
|
||||
/* Low selects command */
|
||||
|
||||
if (priv->rs)
|
||||
if (priv->data)
|
||||
{
|
||||
pic32mx_gpiowrite(GPIO_LCD_RS, false);
|
||||
priv->rs = false;
|
||||
|
||||
priv->data = false; /* Command, not data */
|
||||
priv->reading = false; /* No read sequence in progress */
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,10 +232,12 @@ static void pic32mx_data(FAR struct pic32mx7mmb_dev_s *priv)
|
||||
{
|
||||
/* Hi selects data */
|
||||
|
||||
if (!priv->rs)
|
||||
if (!priv->data)
|
||||
{
|
||||
pic32mx_gpiowrite(GPIO_LCD_RS, true);
|
||||
priv->rs = true;
|
||||
|
||||
priv->data = true; /* Data, not command */
|
||||
priv->reading = false; /* No read sequence in progress */
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,10 +268,12 @@ static void pic32mx_select(FAR struct mio283qt2_lcd_s *dev)
|
||||
|
||||
/* CS low selects */
|
||||
|
||||
if (!priv->cs)
|
||||
if (!priv->selected)
|
||||
{
|
||||
pic32mx_gpiowrite(GPIO_LCD_CS, false);
|
||||
priv->cs = true;
|
||||
|
||||
priv->selected = true; /* LCD selected */
|
||||
priv->reading = false; /* No read sequence in progress */
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,10 +291,12 @@ static void pic32mx_deselect(FAR struct mio283qt2_lcd_s *dev)
|
||||
|
||||
/* CS high de-selects */
|
||||
|
||||
if (priv->cs)
|
||||
if (priv->selected)
|
||||
{
|
||||
pic32mx_gpiowrite(GPIO_LCD_CS, true);
|
||||
priv->cs = false;
|
||||
|
||||
priv->selected = false; /* LCD not selected */
|
||||
priv->reading = false; /* No read sequence in progress */
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,6 +336,7 @@ static void pic32mx_index(FAR struct mio283qt2_lcd_s *dev, uint8_t index)
|
||||
static uint16_t pic32mx_read(FAR struct mio283qt2_lcd_s *dev)
|
||||
{
|
||||
FAR struct pic32mx7mmb_dev_s *priv = (FAR struct pic32mx7mmb_dev_s *)dev;
|
||||
uint16_t data;
|
||||
|
||||
/* Make sure that the PMP is not busy from the last transaction. Read data is not
|
||||
* available until the busy bit becomes zero.
|
||||
@ -337,7 +347,18 @@ static uint16_t pic32mx_read(FAR struct mio283qt2_lcd_s *dev)
|
||||
/* Read 16-bits of data */
|
||||
|
||||
pic32mx_data(priv);
|
||||
return getreg16(PIC32MX_PMP_DIN);
|
||||
data = getreg16(PIC32MX_PMP_DIN);
|
||||
|
||||
/* We need to discard the first 16-bits of data that we read and re-read inorder
|
||||
* to get valid data (that is just the way that the PMP works).
|
||||
*/
|
||||
|
||||
if (!priv->reading)
|
||||
{
|
||||
data = getreg16(PIC32MX_PMP_DIN);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -361,6 +382,10 @@ static void pic32mx_write(FAR struct mio283qt2_lcd_s *dev, uint16_t data)
|
||||
|
||||
pic32mx_data(priv);
|
||||
putreg16(data, PIC32MX_PMP_DIN);
|
||||
|
||||
/* We are not in a write sequence */
|
||||
|
||||
priv->reading = false;
|
||||
}
|
||||
|
||||
/**************************************************************************************
|
||||
|
@ -284,14 +284,17 @@ struct mio283qt2_dev_s
|
||||
/* Low Level LCD access */
|
||||
|
||||
static void mio283qt2_putreg(FAR struct mio283qt2_lcd_s *lcd, uint8_t regaddr,
|
||||
uint16_t regval);
|
||||
uint16_t regval);
|
||||
#ifndef CONFIG_LCD_NOGETRUN
|
||||
static uint16_t mio283qt2_readreg(FAR struct mio283qt2_lcd_s *lcd, uint8_t regaddr);
|
||||
#endif
|
||||
static inline void mio283qt2_gramwrite(FAR struct mio283qt2_lcd_s *lcd, uint16_t rgbcolor);
|
||||
static inline void mio283qt2_gramwrite(FAR struct mio283qt2_lcd_s *lcd,
|
||||
uint16_t rgbcolor);
|
||||
#ifndef CONFIG_LCD_NOGETRUN
|
||||
static inline void mio283qt2_readsetup(FAR struct mio283qt2_lcd_s *lcd, FAR uint16_t *accum);
|
||||
static inline uint16_t mio283qt2_gramread(FAR struct mio283qt2_lcd_s *lcd, FAR uint16_t *accum);
|
||||
static inline void mio283qt2_readsetup(FAR struct mio283qt2_lcd_s *lcd,
|
||||
FAR uint16_t *accum);
|
||||
static inline uint16_t mio283qt2_gramread(FAR struct mio283qt2_lcd_s *lcd,
|
||||
FAR uint16_t *accum);
|
||||
#endif
|
||||
static void mio283qt2_setarea(FAR struct mio283qt2_lcd_s *lcd,
|
||||
uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
|
||||
@ -356,7 +359,8 @@ static struct mio283qt2_dev_s g_lcddev;
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
static void mio283qt2_putreg(FAR struct mio283qt2_lcd_s *lcd, uint8_t regaddr, uint16_t regval)
|
||||
static void mio283qt2_putreg(FAR struct mio283qt2_lcd_s *lcd,
|
||||
uint8_t regaddr, uint16_t regval)
|
||||
{
|
||||
/* Set the index register to the register address and write the register contents */
|
||||
|
||||
@ -375,7 +379,7 @@ static void mio283qt2_putreg(FAR struct mio283qt2_lcd_s *lcd, uint8_t regaddr, u
|
||||
#ifndef CONFIG_LCD_NOGETRUN
|
||||
static uint16_t mio283qt2_readreg(FAR struct mio283qt2_lcd_s *lcd, uint8_t regaddr)
|
||||
{
|
||||
/* Set the index register to the register address and read the register contents */
|
||||
/* Set the index register to the register address and read the register contents. */
|
||||
|
||||
lcd->index(lcd, regaddr);
|
||||
return lcd->read(lcd);
|
||||
@ -421,11 +425,14 @@ static inline void mio283qt2_gramwrite(FAR struct mio283qt2_lcd_s *lcd, uint16_t
|
||||
**************************************************************************************/
|
||||
|
||||
#ifndef CONFIG_LCD_NOGETRUN
|
||||
static inline void mio283qt2_readsetup(FAR struct mio283qt2_lcd_s *lcd, FAR uint16_t *accum)
|
||||
static inline void mio283qt2_readsetup(FAR struct mio283qt2_lcd_s *lcd,
|
||||
FAR uint16_t *accum)
|
||||
{
|
||||
#if 0 /* Probably not necessary... untested */
|
||||
/* Read-ahead one pixel */
|
||||
|
||||
*accum = lcd->read(lcd);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -441,7 +448,8 @@ static inline void mio283qt2_readsetup(FAR struct mio283qt2_lcd_s *lcd, FAR uint
|
||||
**************************************************************************************/
|
||||
|
||||
#ifndef CONFIG_LCD_NOGETRUN
|
||||
static inline uint16_t mio283qt2_gramread(FAR struct mio283qt2_lcd_s *lcd, FAR uint16_t *accum)
|
||||
static inline uint16_t mio283qt2_gramread(FAR struct mio283qt2_lcd_s *lcd,
|
||||
FAR uint16_t *accum)
|
||||
{
|
||||
/* Read the value (GRAM register already selected) */
|
||||
|
||||
@ -516,7 +524,7 @@ static void mio283qt2_dumprun(FAR const char *msg, FAR uint16_t *run, size_t npi
|
||||
**************************************************************************************/
|
||||
|
||||
static int mio283qt2_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer,
|
||||
size_t npixels)
|
||||
size_t npixels)
|
||||
{
|
||||
FAR struct mio283qt2_dev_s *priv = &g_lcddev;
|
||||
FAR struct mio283qt2_lcd_s *lcd = priv->lcd;
|
||||
@ -564,7 +572,7 @@ static int mio283qt2_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *b
|
||||
**************************************************************************************/
|
||||
|
||||
static int mio283qt2_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
|
||||
size_t npixels)
|
||||
size_t npixels)
|
||||
{
|
||||
#ifndef CONFIG_LCD_NOGETRUN
|
||||
FAR struct mio283qt2_dev_s *priv = &g_lcddev;
|
||||
@ -620,7 +628,7 @@ static int mio283qt2_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
|
||||
**************************************************************************************/
|
||||
|
||||
static int mio283qt2_getvideoinfo(FAR struct lcd_dev_s *dev,
|
||||
FAR struct fb_videoinfo_s *vinfo)
|
||||
FAR struct fb_videoinfo_s *vinfo)
|
||||
{
|
||||
DEBUGASSERT(dev && vinfo);
|
||||
lcdvdbg("fmt: %d xres: %d yres: %d nplanes: 1\n",
|
||||
@ -642,7 +650,7 @@ static int mio283qt2_getvideoinfo(FAR struct lcd_dev_s *dev,
|
||||
**************************************************************************************/
|
||||
|
||||
static int mio283qt2_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno,
|
||||
FAR struct lcd_planeinfo_s *pinfo)
|
||||
FAR struct lcd_planeinfo_s *pinfo)
|
||||
{
|
||||
FAR struct mio283qt2_dev_s *priv = (FAR struct mio283qt2_dev_s *)dev;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user