Add completed LCD driver for the STM3240G-EVAL
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4662 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
65288b5057
commit
30fb95e880
5 changed files with 428 additions and 270 deletions
|
@ -334,7 +334,7 @@ config ARCH_BOARD_STM3220G_EVAL
|
|||
microcontroller (ARM Cortex-M3).
|
||||
|
||||
config ARCH_BOARD_STM3240G_EVAL
|
||||
bool "STMicro STM3210G-EVAL development board"
|
||||
bool "STMicro STM3240G-EVAL development board"
|
||||
depends on ARCH_CHIP_STM32F407IG
|
||||
---help---
|
||||
STMicro STM3240G-EVAL development board based on the STMicro STM32F103ZET6
|
||||
|
|
|
@ -16,4 +16,62 @@ config ARCH_BUTTONS
|
|||
---help---
|
||||
"Support interfaces to use buttons provided by the board."
|
||||
|
||||
config STM3240G_LCD
|
||||
bool "Select support for the STM3210E-EVAL LCD"
|
||||
default y
|
||||
depends on STM32_FSMC
|
||||
|
||||
choice
|
||||
prompt "STM3240G-EVAL LCD Orientation"
|
||||
default LCD_LANDSCAPE
|
||||
depends on STM3240G_LCD
|
||||
|
||||
config LCD_LANDSCAPE
|
||||
bool "320x240 landscape display"
|
||||
---help---
|
||||
Define for 320x240 display "landscape" support. Default is this 320x240
|
||||
"landscape" orientation (this setting is informative only... not used).
|
||||
|
||||
config LCD_PORTRAIT
|
||||
bool "240x320 portrait display"
|
||||
---help---
|
||||
Define for 240x320 display "portrait" orientation support. In this
|
||||
orientation, the STM3210E-EVAL's LCD ribbon cable is at the bottom of
|
||||
the display. Default is 320x240 "landscape" orientation.
|
||||
|
||||
config LCD_RPORTRAIT
|
||||
bool "240x320 reverse portrait display"
|
||||
---help---
|
||||
Define for 240x320 display "reverse portrait" orientation support. In
|
||||
this orientation, the STM3210E-EVAL's LCD ribbon cable is at the top
|
||||
of the display. Default is 320x240 "landscape" orientation.
|
||||
|
||||
endchoice
|
||||
|
||||
config LCD_RDSHIFT
|
||||
int "LCD data shift"
|
||||
default 5
|
||||
depends on STM3240G_LCD
|
||||
---help---
|
||||
When reading 16-bit gram data, there appears to be a shift in the returned
|
||||
data. This value fixes the offset. Default 5.
|
||||
|
||||
config CONFIG_STM32_ILI9320_DISABLE
|
||||
bool "Disable LCD_ILI9320 (and LCD_ILI9321) support"
|
||||
default n
|
||||
depends on STM3240G_LCD
|
||||
---help---
|
||||
The LCD driver dynamically selects the LCD based on the reported LCD
|
||||
ID value. However, code size can be reduced by suppressing support for
|
||||
individual LCDs using this option.
|
||||
|
||||
config CONFIG_STM32_ILI9325_DISABLE
|
||||
bool "Disable LCD_ILI9325 support"
|
||||
default n
|
||||
depends on STM3240G_LCD
|
||||
---help---
|
||||
The LCD driver dynamically selects the LCD based on the reported LCD
|
||||
ID value. However, code size can be reduced by suppressing support for
|
||||
individual LCDs using this option
|
||||
|
||||
endif
|
||||
|
|
|
@ -768,6 +768,42 @@ STM3240G-EVAL-specific Configuration Options
|
|||
|
||||
STM3240G-EVAL LCD Hardware Configuration
|
||||
|
||||
The LCD driver supports the following LCDs on the STM324xG_EVAL board:
|
||||
|
||||
AM-240320L8TNQW00H (LCD_ILI9320 or LCD_ILI9321) OR
|
||||
AM-240320D5TOQW01H (LCD_ILI9325)
|
||||
|
||||
Configuration options.
|
||||
|
||||
CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape"
|
||||
support. Default is this 320x240 "landscape" orientation
|
||||
(this setting is informative only... not used).
|
||||
CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait"
|
||||
orientation support. In this orientation, the STM3210E-EVAL's
|
||||
LCD ribbon cable is at the bottom of the display. Default is
|
||||
320x240 "landscape" orientation.
|
||||
CONFIG_LCD_RPORTRAIT - Define for 240x320 display "reverse
|
||||
portrait" orientation support. In this orientation, the
|
||||
STM3210E-EVAL's LCD ribbon cable is at the top of the display.
|
||||
Default is 320x240 "landscape" orientation.
|
||||
CONFIG_LCD_BACKLIGHT - Define to support a backlight.
|
||||
CONFIG_LCD_PWM - If CONFIG_STM32_TIM1 is also defined, then an
|
||||
adjustable backlight will be provided using timer 1 to generate
|
||||
various pulse widthes. The granularity of the settings is
|
||||
determined by CONFIG_LCD_MAXPOWER. If CONFIG_LCD_PWM (or
|
||||
CONFIG_STM32_TIM1) is not defined, then a simple on/off backlight
|
||||
is provided.
|
||||
CONFIG_LCD_RDSHIFT - When reading 16-bit gram data, there appears
|
||||
to be a shift in the returned data. This value fixes the offset.
|
||||
Default 5.
|
||||
|
||||
The LCD driver dynamically selects the LCD based on the reported LCD
|
||||
ID value. However, code size can be reduced by suppressing support for
|
||||
individual LCDs using:
|
||||
|
||||
CONFIG_STM32_ILI9320_DISABLE (includes ILI9321)
|
||||
CONFIG_STM32_ILI9325_DISABLE
|
||||
|
||||
Configurations
|
||||
==============
|
||||
|
||||
|
@ -909,7 +945,7 @@ Where <subdir> is one of the following:
|
|||
CONFIG_STM32_IWDG=y : Enables the IWDG timer facility (but not both)
|
||||
|
||||
The WWDG watchdog is driven off the (fast) 42MHz PCLK1 and, as result,
|
||||
has a maximum timeout value of 49 milliseconds. for WWDG watchdog, you
|
||||
has a maximum timeout value of 49 milliseconds. For WWDG watchdog, you
|
||||
should also add the fillowing to the configuration file:
|
||||
|
||||
CONFIG_EXAMPLES_WATCHDOG_PINGDELAY=20
|
||||
|
@ -917,6 +953,21 @@ Where <subdir> is one of the following:
|
|||
|
||||
The IWDG timer has a range of about 35 seconds and should not be an issue.
|
||||
|
||||
7. Adding LCD and graphics support:
|
||||
|
||||
appconfig (apps/.config): Enable the application configurations that you
|
||||
want to use. Asexamples:
|
||||
|
||||
CONFIGURED_APPS += examples/nx : Pick one or more
|
||||
CONFIGURED_APPS += examples/nxhello :
|
||||
CONFIGURED_APPS += examples/nximage :
|
||||
CONFIGURED_APPS += examples/nxlines :
|
||||
|
||||
defconfig (nuttx/.config):
|
||||
|
||||
CONFIG_STM32_FSMC=y : FSMC support is required for the LCD
|
||||
CONFIG_NX=y : Enable graphics suppport
|
||||
|
||||
8. This configuration requires that jumper JP22 be set to enable RS-232 operation.
|
||||
|
||||
nsh2:
|
||||
|
|
|
@ -527,6 +527,7 @@ CONFIG_DEBUG_ANALOG=n
|
|||
CONFIG_DEBUG_PWM=n
|
||||
CONFIG_DEBUG_CAN=n
|
||||
CONFIG_DEBUG_I2C=n
|
||||
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_MM_REGIONS=2
|
||||
|
@ -1197,6 +1198,67 @@ CONFIG_NX_BLOCKING=y
|
|||
CONFIG_NX_MXSERVERMSGS=32
|
||||
CONFIG_NX_MXCLIENTMSGS=16
|
||||
|
||||
#
|
||||
# NxConsole Configuration Settings:
|
||||
#
|
||||
# CONFIG_NXCONSOLE
|
||||
# Enables building of the NxConsole driver.
|
||||
# CONFIG_NXCONSOLE_BPP
|
||||
# Currently, NxConsole supports only a single pixel depth. This
|
||||
# configuration setting must be provided to support that single pixel depth.
|
||||
# Default: The smallest enabled pixel depth. (see CONFIG_NX_DISABLE_*BPP)
|
||||
# CONFIG_NXCONSOLE_NOGETRUN
|
||||
# NxConsole needs to know if it can read from the LCD or not. If reading
|
||||
# from the LCD is supported, then NxConsole can do more efficient
|
||||
# scrolling. Default: Supported
|
||||
# CONFIG_NXCONSOLE_MXCHARS
|
||||
# NxConsole needs to remember every character written to the console so
|
||||
# that it can redraw the window. This setting determines the size of some
|
||||
# internal memory allocations used to hold the character data. Default: 128.
|
||||
# CONFIG_NXCONSOLE_CACHESIZE
|
||||
# NxConsole supports caching of rendered fonts. This font caching is required
|
||||
# for two reasons: (1) First, it improves text performance, but more
|
||||
# importantly (2) it preserves the font memory. Since the NX server runs on
|
||||
# a separate server thread, it requires that the rendered font memory persist
|
||||
# until the server has a chance to render the font. (NOTE: There is still
|
||||
# inherently a race condition in this!). Unfortunately, the font cache would
|
||||
# be quite large if all fonts were saved. The CONFIG_NXCONSOLE_CACHESIZE setting
|
||||
# will control the size of the font cache (in number of glyphs). Only that
|
||||
# number of the most recently used glyphs will be retained. Default: 16.
|
||||
# CONFIG_NXCONSOLE_LINESEPARATION
|
||||
# This the space (in rows) between each row of test. Default: 2
|
||||
# CONFIG_NXCONSOLE_NOWRAP
|
||||
# By default, lines will wrap when the test reaches the right hand side
|
||||
# of the window. This setting can be defining to change this behavior so
|
||||
# that the text is simply truncated until a new line is encountered.
|
||||
#
|
||||
CONFIG_NXCONSOLE=n
|
||||
CONFIG_NXCONSOLE_BPP=16
|
||||
CONFIG_NXCONSOLE_NOGETRUN=y
|
||||
CONFIG_NXCONSOLE_MXCHARS=256
|
||||
CONFIG_NXCONSOLE_CACHESIZE=32
|
||||
# CONFIG_NXCONSOLE_LINESEPARATION
|
||||
# CONFIG_NXCONSOLE_NOWRAP
|
||||
|
||||
#
|
||||
# STM3240G-EVAL LCD Hardware Configuration
|
||||
#
|
||||
# CONFIG_LCD_LANDSCAPE - Define for 320x240 display "landscape"
|
||||
# support. Default is this 320x240 "landscape" orientation
|
||||
# (this setting is informative only... not used).
|
||||
# CONFIG_LCD_PORTRAIT - Define for 240x320 display "portrait"
|
||||
# orientation support. In this orientation, the STM3240G-EVAL's
|
||||
# LCD ribbon cable is at the bottom of the display. Default is
|
||||
# 320x240 "landscape" orientation.
|
||||
# CONFIG_LCD_RPORTRAIT - Define for 240x320 display "reverse
|
||||
# portrait" orientation support. In this orientation, the
|
||||
# STM3240G-EVAL's LCD ribbon cable is at the top of the display.
|
||||
# Default is 320x240 "landscape" orientation.
|
||||
#
|
||||
CONFIG_LCD_LANDSCAPE=n
|
||||
CONFIG_LCD_PORTRAIT=n
|
||||
CONFIG_LCD_RPORTRAIT=y
|
||||
|
||||
#
|
||||
# Settings for examples/uip
|
||||
#
|
||||
|
@ -1366,6 +1428,254 @@ CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n
|
|||
# built-in, the default is 32. Otherwise messages are sent and received
|
||||
# indefinitely.
|
||||
|
||||
#
|
||||
# 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=n
|
||||
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/usbstorage
|
||||
#
|
||||
# CONFIG_EXAMPLES_USBMSC_BUILTIN
|
||||
# This example can be built as two NSH "built-in" commands if this option
|
||||
# is selection: 'msconn' will connect the USB mass storage device; 'msdis'
|
||||
# will disconnect the USB storage device.
|
||||
# CONFIG_EXAMPLES_USBMSC_NLUNS
|
||||
# Defines the number of logical units (LUNs) exported by the USB storage
|
||||
# driver. Each LUN corresponds to one exported block driver (or partition
|
||||
# of a block driver). May be 1, 2, or 3. Default is 1.
|
||||
# CONFIG_EXAMPLES_USBMSC_DEVMINOR1
|
||||
# The minor device number of the block driver for the first LUN. For
|
||||
# example, N in /dev/mmcsdN. Used for registering the block driver. Default
|
||||
# is zero.
|
||||
# CONFIG_EXAMPLES_USBMSC_DEVPATH1
|
||||
# The full path to the registered block driver. Default is "/dev/mmcsd0"
|
||||
# CONFIG_EXAMPLES_USBMSC_DEVMINOR2 and CONFIG_EXAMPLES_USBMSC_DEVPATH2
|
||||
# Similar parameters that would have to be provided if CONFIG_EXAMPLES_USBMSC_NLUNS
|
||||
# is 2 or 3. No defaults.
|
||||
# CONFIG_EXAMPLES_USBMSC_DEVMINOR3 and CONFIG_EXAMPLES_USBMSC_DEVPATH3
|
||||
# Similar parameters that would have to be provided if CONFIG_EXAMPLES_USBMSC_NLUNS
|
||||
# is 3. No defaults.
|
||||
# CONFIG_EXAMPLES_USBMSC_DEBUGMM
|
||||
# Enables some debug tests to check for memory usage and memory leaks.
|
||||
#
|
||||
# If CONFIG_USBDEV_TRACE is enabled (or CONFIG_DEBUG and CONFIG_DEBUG_USB), then
|
||||
# the example code will also manage the USB trace output. The amount of trace output
|
||||
# can be controlled using:
|
||||
#
|
||||
# CONFIG_EXAMPLES_USBMSC_TRACEINIT
|
||||
# Show initialization events
|
||||
# CONFIG_EXAMPLES_USBMSC_TRACECLASS
|
||||
# Show class driver events
|
||||
# CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS
|
||||
# Show data transfer events
|
||||
# CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER
|
||||
# Show controller events
|
||||
# CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS
|
||||
# Show interrupt-related events.
|
||||
#
|
||||
CONFIG_EXAMPLES_USBMSC_BUILTIN=y
|
||||
CONFIG_EXAMPLES_USBMSC_NLUNS=1
|
||||
CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0
|
||||
CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0"
|
||||
CONFIG_EXAMPLES_USBMSC_DEBUGMM=n
|
||||
CONFIG_EXAMPLES_USBMSC_TRACEINIT=n
|
||||
CONFIG_EXAMPLES_USBMSC_TRACECLASS=n
|
||||
CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n
|
||||
CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n
|
||||
CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n
|
||||
|
||||
#
|
||||
# Settings for examples/watchdog
|
||||
#
|
||||
# This test depends on these specific Watchdog/NSH configurations settings (your
|
||||
# specific watchdog hardware settings might require additional settings).
|
||||
#
|
||||
# CONFIG_WATCHDOG- Enables watchdog timer support support.
|
||||
# CONFIG_NSH_BUILTIN_APPS - Build the watchdog time test as an NSH
|
||||
# built-in function. Default: Not built! The example can only be used
|
||||
# as an NSH built-in application
|
||||
#
|
||||
# The STM32 also needs one of the following enabled:
|
||||
#
|
||||
# CONFIG_STM32_WWDG=y, OR
|
||||
# CONFIG_STM32_IWDG=y (but not both)
|
||||
#
|
||||
# Specific configuration options for this example include:
|
||||
#
|
||||
# CONFIG_EXAMPLES_WATCHDOG_DEVPATH - The path to the Watchdog device.
|
||||
# Default: /dev/watchdog0
|
||||
# CONFIG_EXAMPLES_WATCHDOG_PINGTIME - Time in milliseconds that the example
|
||||
# will ping the watchdog before letting the watchdog expire. Default: 5000
|
||||
# milliseconds
|
||||
# CONFIG_EXAMPLES_WATCHDOG_PINGDELAY - Time delay between pings in
|
||||
# milliseconds. Default: 500 milliseconds.
|
||||
# CONFIG_EXAMPLES_WATCHDOG_TIMEOUT - The watchdog timeout value in
|
||||
# milliseconds before the watchdog timer expires. Default: 2000
|
||||
# milliseconds.
|
||||
#
|
||||
# CONFIG_EXAMPLES_WATCHDOG_DEVPATH
|
||||
# CONFIG_EXAMPLES_WATCHDOG_PINGTIME
|
||||
# CONFIG_EXAMPLES_WATCHDOG_PINGDELAY
|
||||
# CONFIG_EXAMPLES_WATCHDOG_TIMEOUT
|
||||
|
||||
#
|
||||
# Settings for examples/pwm
|
||||
#
|
||||
|
|
|
@ -34,9 +34,9 @@
|
|||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
**************************************************************************************/
|
||||
/* This driver supports the following LCDs on the STM324xG_EVAL board:
|
||||
/* This driver supports the following LCDs on the STM324xG_EVAL board:
|
||||
*
|
||||
* AM-240320L8TNQW00H (LCD_ILI9320 or LCD_ILI9321) and
|
||||
* AM-240320L8TNQW00H (LCD_ILI9320 or LCD_ILI9321) OR
|
||||
* AM-240320D5TOQW01H (LCD_ILI9325)
|
||||
*/
|
||||
|
||||
|
@ -80,50 +80,16 @@
|
|||
# define CONFIG_LCD_MAXCONTRAST 1
|
||||
#endif
|
||||
|
||||
/* Backlight */
|
||||
|
||||
#ifndef CONFIG_LCD_BACKLIGHT
|
||||
# undef CONFIG_LCD_PWM
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_LCD_BACKLIGHT) && defined(CONFIG_LCD_PWM)
|
||||
# if !defined(CONFIG_STM32_TIM1)
|
||||
# warning "CONFIG_LCD_PWM requires CONFIG_STM32_TIM1"
|
||||
# undef CONFIG_LCD_PWM
|
||||
# endif
|
||||
# if defined(CONFIG_STM32_TIM1_FULL_REMAP)
|
||||
# warning "PA8 cannot be configured as TIM1 CH1 with full remap"
|
||||
# undef CONFIG_LCD_PWM
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_LCD_BACKLIGHT) && defined(CONFIG_LCD_PWM)
|
||||
# if CONFIG_LCD_MAXPOWER < 2
|
||||
# warning "A larger value of CONFIG_LCD_MAXPOWER is recommended"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Check power setting */
|
||||
|
||||
#if !defined(CONFIG_LCD_MAXPOWER) || CONFIG_LCD_MAXPOWER < 1
|
||||
# undef CONFIG_LCD_MAXPOWER
|
||||
# if defined(CONFIG_LCD_BACKLIGHT) && defined(CONFIG_LCD_PWM)
|
||||
# define CONFIG_LCD_MAXPOWER 100
|
||||
# else
|
||||
# define CONFIG_LCD_MAXPOWER 1
|
||||
# endif
|
||||
# define CONFIG_LCD_MAXPOWER 1
|
||||
#endif
|
||||
|
||||
#if CONFIG_LCD_MAXPOWER > 255
|
||||
# error "CONFIG_LCD_MAXPOWER must be less than 256 to fit in uint8_t"
|
||||
#endif
|
||||
|
||||
/* PWM Frequency */
|
||||
|
||||
#ifndef CONFIG_LCD_PWMFREQUENCY
|
||||
# define CONFIG_LCD_PWMFREQUENCY 100
|
||||
#endif
|
||||
|
||||
/* Check orientation */
|
||||
|
||||
#if defined(CONFIG_LCD_PORTRAIT)
|
||||
|
@ -330,10 +296,6 @@ struct stm3240g_dev_s
|
|||
|
||||
struct lcd_dev_s dev;
|
||||
|
||||
#if defined(CONFIG_LCD_BACKLIGHT) && defined(CONFIG_LCD_PWM)
|
||||
uint32_t reload;
|
||||
#endif
|
||||
|
||||
/* Private LCD-specific information follows */
|
||||
|
||||
uint8_t type; /* LCD type. See enum lcd_type_e */
|
||||
|
@ -391,11 +353,6 @@ static int stm3240g_setcontrast(struct lcd_dev_s *dev, unsigned int contrast);
|
|||
/* Initialization */
|
||||
|
||||
static inline void stm3240g_lcdinitialize(void);
|
||||
#ifdef CONFIG_LCD_BACKLIGHT
|
||||
static void stm3240g_backlight(void);
|
||||
#else
|
||||
# define stm3240g_backlight()
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
* Private Data
|
||||
|
@ -878,22 +835,6 @@ static int stm3240g_poweroff(void)
|
|||
|
||||
stm3240g_writereg(LCD_REG_7, 0);
|
||||
|
||||
/* Disable timer 1 clocking */
|
||||
|
||||
#if defined(CONFIG_LCD_BACKLIGHT)
|
||||
# if defined(CONFIG_LCD_PWM)
|
||||
modifyreg32(STM32_RCC_APB2ENR, RCC_APB2ENR_TIM1EN, 0);
|
||||
#endif
|
||||
|
||||
/* Configure the PA8 pin as an output */
|
||||
|
||||
stm32_configgpio(GPIO_LCD_BACKLIGHT);
|
||||
|
||||
/* Turn the backlight off */
|
||||
|
||||
stm32_gpiowrite(GPIO_LCD_BACKLIGHT, false);
|
||||
#endif
|
||||
|
||||
/* Remember the power off state */
|
||||
|
||||
g_lcddev.power = 0;
|
||||
|
@ -918,43 +859,6 @@ static int stm3240g_setpower(struct lcd_dev_s *dev, int power)
|
|||
|
||||
if (power > 0)
|
||||
{
|
||||
#ifdef CONFIG_LCD_BACKLIGHT
|
||||
#ifdef CONFIG_LCD_PWM
|
||||
uint32_t frac;
|
||||
uint32_t duty;
|
||||
|
||||
/* If we are coming up from the power off state, then re-configure the timer */
|
||||
|
||||
if (g_lcddev.power == 0)
|
||||
{
|
||||
stm3240g_backlight();
|
||||
}
|
||||
|
||||
/* Make sure that the power value is within range */
|
||||
|
||||
if (power > CONFIG_LCD_MAXPOWER)
|
||||
{
|
||||
power = CONFIG_LCD_MAXPOWER;
|
||||
}
|
||||
|
||||
/* Caclulate the new backlight duty. It is a faction of the timer1
|
||||
* period based on the ration of the current power setting to the
|
||||
* maximum power setting.
|
||||
*/
|
||||
|
||||
frac = (power << 16) / CONFIG_LCD_MAXPOWER;
|
||||
duty = (g_lcddev.reload * frac) >> 16;
|
||||
if (duty > 0)
|
||||
{
|
||||
duty--;
|
||||
}
|
||||
putreg16((uint16_t)duty, STM32_TIM1_CCR1);
|
||||
#else
|
||||
/* Turn the backlight on */
|
||||
|
||||
stm32_gpiowrite(GPIO_LCD_BACKLIGHT, true);
|
||||
#endif
|
||||
#endif
|
||||
/* Then turn the display on */
|
||||
|
||||
#if !defined(CONFIG_STM32_ILI9320_DISABLE) || !defined(CONFIG_STM32_ILI9325_DISABLE)
|
||||
|
@ -1200,180 +1104,14 @@ static inline void stm3240g_lcdinitialize(void)
|
|||
|
||||
stm3240g_writereg(LCD_REG_3, 0x1018);
|
||||
|
||||
stm3240g_writereg(LCD_REG_7, 0x0); /* display off*/
|
||||
stm3240g_writereg(LCD_REG_7, 0x0); /* display off */
|
||||
|
||||
#else
|
||||
lcddbg("Unsupported LCD type\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************************
|
||||
* Name: stm3240g_backlight
|
||||
*
|
||||
* Description:
|
||||
* The LCD backlight is driven from PA8 which must be configured as TIM1
|
||||
* CH1. TIM1 must then be configured to output a clock on PA8; the duty
|
||||
* of the clock determineds the backlight level.
|
||||
*
|
||||
**************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LCD_BACKLIGHT
|
||||
static void stm3240g_backlight(void)
|
||||
{
|
||||
#ifdef CONFIG_LCD_PWM
|
||||
uint32_t prescaler;
|
||||
uint32_t reload;
|
||||
uint32_t timclk;
|
||||
uint16_t bdtr;
|
||||
uint16_t ccmr;
|
||||
uint16_t ccer;
|
||||
uint16_t cr2;
|
||||
|
||||
/* Calculate the TIM1 prescaler value */
|
||||
|
||||
prescaler = (STM32_PCLK2_FREQUENCY / CONFIG_LCD_PWMFREQUENCY + 65534) / 65535;
|
||||
if (prescaler < 1)
|
||||
{
|
||||
prescaler = 1;
|
||||
}
|
||||
else if (prescaler > 65536)
|
||||
{
|
||||
prescaler = 65536;
|
||||
}
|
||||
|
||||
/* Calculate the TIM1 reload value */
|
||||
|
||||
timclk = STM32_PCLK2_FREQUENCY / prescaler;
|
||||
reload = timclk / CONFIG_LCD_PWMFREQUENCY;
|
||||
|
||||
if (reload < 1)
|
||||
{
|
||||
reload = 1;
|
||||
}
|
||||
else if (reload > 65535)
|
||||
{
|
||||
reload = 65535;
|
||||
}
|
||||
|
||||
g_lcddev.reload = reload;
|
||||
|
||||
/* Configure PA8 as TIM1 CH1 output */
|
||||
|
||||
stm32_configgpio(GPIO_TIM1_CH1OUT);
|
||||
|
||||
/* Enabled timer 1 clocking */
|
||||
|
||||
modifyreg32(STM32_RCC_APB2ENR, 0, RCC_APB2ENR_TIM1EN);
|
||||
|
||||
/* Reset timer 1 */
|
||||
|
||||
modifyreg32(STM32_RCC_APB2RSTR, 0, RCC_APB2RSTR_TIM1RST);
|
||||
modifyreg32(STM32_RCC_APB2RSTR, RCC_APB2RSTR_TIM1RST, 0);
|
||||
|
||||
/* Reset the Counter Mode and set the clock division */
|
||||
|
||||
putreg16(0, STM32_TIM1_CR1);
|
||||
|
||||
/* Set the Autoreload value */
|
||||
|
||||
putreg16(reload-1, STM32_TIM1_ARR);
|
||||
|
||||
/* Set the Prescaler value */
|
||||
|
||||
putreg16(prescaler-1, STM32_TIM1_PSC);
|
||||
|
||||
/* Generate an update event to reload the Prescaler value immediatly */
|
||||
|
||||
putreg16(ATIM_EGR_UG, STM32_TIM1_EGR);
|
||||
|
||||
/* Reset the Repetition Counter value */
|
||||
|
||||
putreg16(0, STM32_TIM1_RCR);
|
||||
|
||||
/* Set the main output enable (MOE) bit and clear the OSSI and OSSR
|
||||
* bits in the BDTR register.
|
||||
*/
|
||||
|
||||
bdtr = getreg16(STM32_TIM1_BDTR);
|
||||
bdtr &= ~(ATIM_BDTR_OSSI | ATIM_BDTR_OSSR);
|
||||
bdtr |= ATIM_BDTR_MOE;
|
||||
putreg16(bdtr, STM32_TIM1_BDTR);
|
||||
|
||||
/* Disable the Channel 1 */
|
||||
|
||||
ccer = getreg16(STM32_TIM1_CCER);
|
||||
ccer &= ~ATIM_CCER_CC1E;
|
||||
putreg16(ccer, STM32_TIM1_CCER);
|
||||
|
||||
/* Get the TIM1 CR2 register value */
|
||||
|
||||
cr2 = getreg16(STM32_TIM1_CR2);
|
||||
|
||||
/* Select the Output Compare Mode Bits */
|
||||
|
||||
ccmr = getreg16(STM32_TIM1_CCMR1);
|
||||
ccmr &= ATIM_CCMR1_OC1M_MASK;
|
||||
ccmr |= (ATIM_CCMR_MODE_PWM1 << ATIM_CCMR1_OC1M_SHIFT);
|
||||
ccmr |= (ATIM_CCMR_CCS_CCOUT << ATIM_CCMR1_CC1S_SHIFT);
|
||||
|
||||
/* Set the power to the minimum value */
|
||||
|
||||
g_lcddev.power = 0;
|
||||
putreg16(0, STM32_TIM1_CCR1);
|
||||
|
||||
/* Select the output polarity level == LOW and enable */
|
||||
|
||||
ccer |= (ATIM_CCER_CC1E );
|
||||
|
||||
/* Reset the Output N Polarity level */
|
||||
|
||||
ccer &= ~(ATIM_CCER_CC1NP|ATIM_CCER_CC1NE);
|
||||
|
||||
/* Reset the Ouput Compare and Output Compare N IDLE State */
|
||||
|
||||
cr2 &= ~(ATIM_CR2_OIS1|ATIM_CR2_OIS1N);
|
||||
|
||||
/* Write the timer configuration */
|
||||
|
||||
putreg16(cr2, STM32_TIM1_CR2);
|
||||
putreg16(ccmr, STM32_TIM1_CCMR1);
|
||||
putreg16(ccer, STM32_TIM1_CCER);
|
||||
|
||||
/* Set the auto preload enable bit */
|
||||
|
||||
modifyreg16(STM32_TIM1_CR1, 0, ATIM_CR1_ARPE);
|
||||
|
||||
/* Enable Backlight Timer */
|
||||
|
||||
ccer |= ATIM_CR1_CEN;
|
||||
putreg16(ccer, STM32_TIM1_CR1);
|
||||
|
||||
/* Dump timer1 registers */
|
||||
|
||||
lcddbg("APB2ENR: %08x\n", getreg32(STM32_RCC_APB2ENR));
|
||||
lcddbg("CR1: %04x\n", getreg32(STM32_TIM1_CR1));
|
||||
lcddbg("CR2: %04x\n", getreg32(STM32_TIM1_CR2));
|
||||
lcddbg("SMCR: %04x\n", getreg32(STM32_TIM1_SMCR));
|
||||
lcddbg("DIER: %04x\n", getreg32(STM32_TIM1_DIER));
|
||||
lcddbg("SR: %04x\n", getreg32(STM32_TIM1_SR));
|
||||
lcddbg("BDTR: %04x\n", getreg32(STM32_TIM1_BDTR));
|
||||
lcddbg("CCMR1: %04x\n", getreg32(STM32_TIM1_CCMR1));
|
||||
lcddbg("CCMR2: %04x\n", getreg32(STM32_TIM1_CCMR2));
|
||||
lcddbg("CCER: %04x\n", getreg32(STM32_TIM1_CCER));
|
||||
lcddbg("CNT: %04x\n", getreg32(STM32_TIM1_CNT));
|
||||
lcddbg("PSC: %04x\n", getreg32(STM32_TIM1_PSC));
|
||||
lcddbg("ARR: %04x\n", getreg32(STM32_TIM1_ARR));
|
||||
lcddbg("RCR: %04x\n", getreg32(STM32_TIM1_RCR));
|
||||
lcddbg("CCR1: %04x\n", getreg32(STM32_TIM1_CCR1));
|
||||
lcddbg("CCR2: %04x\n", getreg32(STM32_TIM1_CCR2));
|
||||
lcddbg("CCR3: %04x\n", getreg32(STM32_TIM1_CCR3));
|
||||
lcddbg("CCR4: %04x\n", getreg32(STM32_TIM1_CCR4));
|
||||
lcddbg("DMAR: %04x\n", getreg32(STM32_TIM1_DMAR));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************************
|
||||
/**************************************************************************************
|
||||
* Public Functions
|
||||
**************************************************************************************/
|
||||
|
||||
|
@ -1404,7 +1142,7 @@ int up_lcdinitialize(void)
|
|||
|
||||
stm3240g_lcdclear(0);
|
||||
|
||||
/* Turn the backlight off */
|
||||
/* Turn the display off */
|
||||
|
||||
stm3240g_poweroff();
|
||||
return OK;
|
||||
|
@ -1461,3 +1199,4 @@ void stm3240g_lcdclear(uint16_t color)
|
|||
LCD->value = color;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue