Skip to content

Commit

Permalink
driver: ILI9340 LCD display driver
Browse files Browse the repository at this point in the history
Minimal driver for ILI9340 LCD display driver including support
for adafruit 2.2" LCD display (1480)

Signed-off-by: Jan Van Winkel <[email protected]>
  • Loading branch information
vanwinkeljan authored and nashif committed May 18, 2018
1 parent 00bbbae commit ca16779
Show file tree
Hide file tree
Showing 17 changed files with 562 additions and 27 deletions.
2 changes: 1 addition & 1 deletion drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
add_definitions(-D__ZEPHYR_SUPERVISOR__)

add_subdirectory(console)
add_subdirectory(display)
add_subdirectory(interrupt_controller)

add_subdirectory_if_kconfig(adc)
add_subdirectory_if_kconfig(clock_control)
add_subdirectory_if_kconfig(counter)
add_subdirectory_if_kconfig(crypto)
add_subdirectory_if_kconfig(display)
add_subdirectory_if_kconfig(dma)
add_subdirectory_if_kconfig(flash)
add_subdirectory_if_kconfig(gpio)
Expand Down
4 changes: 4 additions & 0 deletions drivers/display/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ zephyr_sources_ifdef(CONFIG_MICROBIT_DISPLAY
mb_display.c
mb_font.c
)
zephyr_sources_ifdef(CONFIG_ILI9340 display_ili9340.c)
zephyr_sources_ifdef(CONFIG_ILI9340_LCD_ADAFRUIT_1480
display_ili9340_adafruit_1480.c
)
35 changes: 9 additions & 26 deletions drivers/display/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,17 @@
# SPDX-License-Identifier: Apache-2.0
#

config MICROBIT_DISPLAY
bool "BBC micro:bit 5x5 LED Display support"
depends on BOARD_BBC_MICROBIT
depends on PRINTK
depends on GPIO
menuconfig DISPLAY
bool
prompt "Display Drivers"
default n
help
Enable this to be able to display images and text on the 5x5
LED matrix display on the BBC micro:bit.
Enable display drivers

if MICROBIT_DISPLAY
if DISPLAY

config MICROBIT_DISPLAY_PIN_GRANULARITY
bool "Access the GPIO on a per-pin instead of per-port basis"
help
By default, the micro:bit display driver will update the GPIO
pins of the display (pins 4 through 15) by accessing the entire
GPIO port. This is done for efficiency, however it may interfere
with other peripherals connected to the same GPIO port. Select
this option if other peripherals are connected to the same GPIO
port.
source "drivers/display/Kconfig.microbit"

config MICROBIT_DISPLAY_STR_MAX
int "Maximum length of strings that can be shown on the display"
range 3 255
default 40
help
This value specifies the maximum length of strings that can
be displayed using the mb_display_string() and mb_display_print()
APIs.
source "drivers/display/Kconfig.ili9340"

endif # MICROBIT_DISPLAY
endif # DISPLAY
114 changes: 114 additions & 0 deletions drivers/display/Kconfig.ili9340
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Kconfig - ILI9340 display driver configuration options

#
# Copyright (c) 2017 dXplore
#
# SPDX-License-Identifier: Apache-2.0
#

menuconfig ILI9340
bool "ILI9340 display driver"
depends on SPI
default n
help
Enable driver for ILI9340 display driver.

if ILI9340

config ILI9340_DEV_NAME
string "ILI9340 device name"
default "ILI9340"

config ILI9340_SPI_DEV_NAME
string "SPI master where ILI9340 is connected"
default "SPI_0"
help
Specify the device name of the SPI master device to which ILI9340 is
connected.

config ILI9340_SPI_SLAVE_NUMBER
int "SPI Slave number where ILI9340 is connected"
default 0
help
The number of the slave on the host controller to which ILI9340 is
connected.

config ILI9340_SPI_FREQ
int "SPI Frequency"
default 15151515
help
Frequency to be used to communicate with the ILI9340.

config SYS_LOG_ILI9340_LEVEL
int "ILI9340 Sys Log level"
depends on SYS_LOG
default 0
range 0 4
help
Sets log level for ILI9340 display driver.
Levels are:
- 0 OFF: do not write
- 1 ERROR: only write SYS_LOG_ERR
- 2 WARNING: write SYS_LOG_WRN in addition to previous level
- 3 INFO: write SYS_LOG_INF in addition to previous levels
- 4 DEBUG: write SYS_LOG_DBG in addition to previous levels

config ILI9340_RESET_GPIO_PORT_NAME
string "Reset GPIO controller port name"
default "GPIO_0"
help
GPIO controller where the interrupt pin is attached to.

config ILI9340_RESET_PIN
int "ILI9340 Reset pin"
default 0
help
ILI9340 reset pin.

config ILI9340_CMD_DATA_GPIO_PORT_NAME
string "Command/Data GPIO controller port name"
default "GPIO_0"
help
GPIO controller where the command/data pin is attached to.

config ILI9340_CMD_DATA_PIN
int "ILI9340 command/data pin"
default 1
help
ILI9340 command data pin.

config ILI9340_GPIO_CS
bool "Use GPIO pin for chip select"
default n
help
Use GPIO pin for chips select.

if ILI9340_GPIO_CS

config ILI9340_CS_GPIO_PORT_NAME
string "Chip select GPIO controller port name"
default "GPIO_0"
help
GPIO controller where the chip select pin is attached to.

config ILI9340_CS_GPIO_PIN
int "ILI9340 GPIO chip select"
default 1
help
ILI9340 GPIO chip select pin.

endif #ILI9340_GPIO_CS

choice
prompt "LCD"
default ILI9340_LCD_ADAFRUIT_1480
help
Specify the type of LCD connected to the ILI9340 display controller.

config ILI9340_LCD_ADAFRUIT_1480
bool
prompt "Adafruit 2.2\" TFT 1480"

endchoice

endif #ILI9340
39 changes: 39 additions & 0 deletions drivers/display/Kconfig.microbit
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Kconfig - Microbit display driver configuration options

#
# Copyright (c) 2017 dXplore
#
# SPDX-License-Identifier: Apache-2.0
#

config MICROBIT_DISPLAY
bool "BBC micro:bit 5x5 LED Display support"
depends on BOARD_BBC_MICROBIT
depends on PRINTK
depends on GPIO
help
Enable this to be able to display images and text on the 5x5
LED matrix display on the BBC micro:bit.

if MICROBIT_DISPLAY

config MICROBIT_DISPLAY_PIN_GRANULARITY
bool "Access the GPIO on a per-pin instead of per-port basis"
help
By default, the micro:bit display driver will update the GPIO
pins of the display (pins 4 through 15) by accessing the entire
GPIO port. This is done for efficiency, however it may interfere
with other peripherals connected to the same GPIO port. Select
this option if other peripherals are connected to the same GPIO
port.

config MICROBIT_DISPLAY_STR_MAX
int "Maximum length of strings that can be shown on the display"
range 3 255
default 40
help
This value specifies the maximum length of strings that can
be displayed using the mb_display_string() and mb_display_print()
APIs.

endif # MICROBIT_DISPLAY
Loading

0 comments on commit ca16779

Please sign in to comment.