This enables the initializing of the lcd device connected on the
stm32f429i-disco. The following methods are provided:
- up_lcdinitialize
- up_lcduninitialize
- up_lcdgetdev
The corresponding ili9341 lcd device in the nuttx driver section can be
configured by Kconfig. Interface 0 is used by default.
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
This implements the lcd interface to displaying data on the lcd display powered
by the ili9341 lcd driver.
This driver implements all methods defined in the lcd_dev_s structure except
getcontrast and setcontrast. They are not supported by the hardware.
Furthermore the driver allows to use multiple displays powered by the ili9342 IC
with only one driver instance. So it is theoretically possible to support more
than one connected ili9341 lcd display. The displays can be configured
independently. Currently two lcd devices supported. This should be enough for
now. Read the corresponding code section of how to add more devices if
neccessary.
The following settings are configurable:
1. Pixel format
Define the pixel format of the connected display. Currently only
RGB-565 supported.
2. Orientation
Define the orientation of the display. This can be portrait or
landscape and reversed values.
1. Write only
The driver allows to disable any getrun method if not neccessary to
reduce code size. This is done by enable CONFIG_LCD_NOGETRUN in the nuttx
configuration.
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
This add a new sub driver ili93414ws which implements the ili9341
interface. This allows to control the ili9341 lcd display of the
stm32f429i-disco board. This also modifies the board specific header to
make the entry point to the sub driver known.
Generally the display supports two different ways to drawing pixel data. This
can be done by RGB interface or MCU interface. Second one is supported by this
driver.
The configuration of the MCU interface is fixed by the hardware pinout.
In the case of the stm32f429i-disco board it is a 4-wire serial (spi)
interface. The display is connected on spi5 and acts as a slave device.
It supports half duplex bidirectional mode for transmitting and receiving data.
Nuttx spi interface only support full duplex so the interface can not be used
for the driver in conventional way. Therefore the driver has its own logic for
the communication with the spi5 device.
But if multiple devices share the same spi5 bus, e.g. if MEMS support enabled
the spi bus must be locked to avoid inconsistency. This is done by enable
CONFIG_STM32_SPI5 in the nuttx configuration. In this case the driver uses the
spi_dev_s instance for the spi5 port to interact with the nuttx spi interface,
e.g. using method SPI_LOCK to lock the bus for the current usage. So it is safe
to share the spi bus. Keep in mind this is a possible workaround.
I would be happy if nuttx spi interface supports different spi modes other
than full duplex only. Are there any plans?
Futhermore the driver supports a few configurable settings:
1. SPI Frequency.
This allows to configure the spi frequency for the communication with the
display. As a result of the spi devices of the stm32f429 only allow fixed
frequency by divider depending on PCLK1, it is not possible to configure each
spi clock we want. A divider of 4, what means ~10Mhz spi clock, gives me the
best results and should be near the upper limit.
2. SPI 16-bit mode.
This allows to setup the spi hardware to 16-bit mode for read or write
operations when receiving or transmitting pixel data from or to the gram of the
display. This is not documented in the ili9341 reference manual but this trick
works just fine because we use only one read or write operation for each pixel,
instead two. This gives a small performance boost.
The driver implements all functions described in the header (see
include/nuttx/lcd/ili9341.h).
Note! Using the backlight function has no effect, because the board
doesn't support controlling of the backlight in the current hardware
layout.
Todo: Add support for dma transfer for writing pixel data to the displays gram.
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
This adds the description of the generic interface to communicate with
the ili9341 lcd single chip driver used by any displays.
The interface have to be implemented by the platform specific subdriver.
The following functions must be exported:
-select
Select the spi device before starting an operations.
-deselect
Deselect the spi device after operations finished and if the device was
selected before.
-sendcmd
Send any command to the ili9341 display driver.
-sendparam
Send any parameter corresponding to the ili9341 display driver.
-recvparam
Receive any parameter from the ili9341 display driver. This is only possible
for the read commands supported by the ili9341.
-sendgram
Send pixel data to the gram of the display. This i similar to the function
sendparam, but pixel data operations needs another handling of how to send the
data to the display.
-recvgram
Receive pixel data to the gram of the display. This i similar to the function
recvparam, but pixel data operations needs another handling of how to receive
the data from the display.
-backlight
Change the backlight level of the display.
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>
This renames the stm32 spi frame format definition to the short description
name as well as the other cr2 register flags.
Note! STM32_SPI3_FRF was never used by nuttx somewhere
Signed-off-by: Marco Krahl <ocram.lhark@gmail.com>