UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

ILI9341 Class

Module: ili9341

This module defines the interface for the ILI9341 display library
ili9341.jpg

Methods

ILI9341

(
  • csLCD
  • csSD
  • dc
  • rst
)
Number

Instantiates an ILI9341 object

Parameters:

  • csLCD Number

    LCD chip select pin

  • csSD Number

    SD card select pin

  • dc Number

    Data/command pin

  • rst Number

    Reset pin

Returns:

Number:

name

() String

Returns the name of the component

Returns:

String:

initModule

()

Initializes GPIOs used to talk to the LCD

configModule

()

Configures the LCD driver chip via SPI

setAddrWindow

(
  • x0
  • y0
  • x1
  • y1
)

Sets the window size inside the screen where pixel data is written. Concrete implementation from GFX interface.

Parameters:

  • x0 Number

    First coordinate

  • y0 Number

    First coordinate

  • x1 Number

    Second coordinate

  • y1 Number

    Second coordinate

drawPixel

(
  • x
  • y
  • color
)

Sends a pixel color (RGB) to the driver chip. Concrete implementation from GFX interface.

Parameters:

  • x Number

    Axis on the horizontal scale

  • y Number

    Axis on the vertical scale

  • color Number

    RGB (16-bit) color (R[0-4], G[5-10], B[11-15]

drawFastVLine

(
  • x
  • y
  • h
  • color
)

Draws a vertical line using minimal SPI writes.

Parameters:

  • x Number

    Axis on the horizontal scale to begin line

  • y Number

    Axis on the vertical scale to begin line

  • h Number

    Height of line in pixels

  • color Number

    RGB (16-bit) color (R[0-4], G[5-10], B[11-15]

drawFastHLine

(
  • x
  • y
  • w
  • color
)

Draws a horizontal line using minimal SPI writes.

Parameters:

  • x Number

    Axis on the horizontal scale to begin line

  • y Number

    Axis on the vertical scale to begin line

  • w Number

    Width of line in pixels

  • color Number

    RGB (16-bit) color (R[0-4], G[5-10], B[11-15]

fillRect

(
  • x
  • y
  • w
  • h
  • color
)

Draw a filled rectangle.

Parameters:

  • x Number

    Axis on the horizontal scale of upper-left corner

  • y Number

    Axis on the vertical scale of upper-left corner

  • w Number

    Width of rectangle in pixels

  • h Number

    Height of rectangle in pixels

  • color Number

    RGB (16-bit) color (R[0-4], G[5-10], B[11-15]

fillScreen

(
  • color
)

Fill the screen with a single color.

Parameters:

  • color Number

    RGB (16-bit) color (R[0-4], G[5-10], B[11-15]

setRotation

(
  • r
)

Sets the screen to one of four 90 deg rotations.

Parameters:

  • r Number

    Rotation setting: 0, 1, 2, 3

invertDisplay

(
  • i
)

Invert colors on the display.

Parameters:

  • i Boolean

    True or false to invert colors

color565

(
  • r
  • g
  • b
)
Number

Pass 8-bit R, G, B values and get back 16-bit packed color.

Parameters:

  • r Number

    Red color 0-31

  • g Number

    Green color 0-63

  • b Number

    blue color 0-31

Returns:

Number:

16-bit packed color (RGB) value

executeCMDList

(
  • addr
)

Executes a set of commands and data.

Parameters:

  • addr Const uint8_t *

    Pointer to the start of the commands/data section

writecommand

(
  • c
)

Sends a command to the display driver via SPI.

Parameters:

  • c Number

    Command to be written

writedata

(
  • d
)

Sends data to the display driver via SPI

Parameters:

  • d Number

    Data to be written

lcdCSOn

() Mraa::Result

Set LCD chip select to LOW

Returns:

Mraa::Result:

lcdCSOff

() Mraa::Result

Set LCD chip select to HIGH

Returns:

Mraa::Result:

sdCSOn

() Mraa::Result

Set SD card chip select to LOW

Returns:

Mraa::Result:

sdCSOff

() Mraa::Result

Set SD card chip select to HIGH

Returns:

Mraa::Result:

dcHigh

() Mraa::Result

Set data/command line to HIGH

Returns:

Mraa::Result:

dcLow

() Mraa::Result

Set data/command line to LOW

Returns:

Mraa::Result:

rstHigh

() Mraa::Result

Set reset line to HIGH

Returns:

Mraa::Result:

rstLow

() Mraa::Result

Set reset line to LOW

Returns:

Mraa::Result: