upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Public Member Functions | List of all members

API for the ST7735 LCD. More...

Detailed Description

This module defines the interface for the ST7735 display library

st7735.jpg
upm_st7735.ST7735 lcd = new upm_st7735.ST7735((short) 7, (short) 4, (short) 9, (short) 8);
lcd.fillScreen(upm_st7735.javaupm_st7735Constants.ST7735_RED);
lcd.refresh();
lcd.fillScreen(upm_st7735.javaupm_st7735Constants.ST7735_CYAN);
lcd.refresh();
lcd.fillScreen(upm_st7735.javaupm_st7735Constants.ST7735_BLACK);
lcd.refresh();
lcd.drawLine((short) 10, (short) 10, (short) 10, (short) 100,
upm_st7735.javaupm_st7735Constants.ST7735_MAGENTA);
lcd.drawLine((short) 20, (short) 20, (short) 10, (short) 100,
upm_st7735.javaupm_st7735Constants.ST7735_YELLOW);
lcd.drawLine((short) 30, (short) 30, (short) 50, (short) 100,
upm_st7735.javaupm_st7735Constants.ST7735_WHITE);
lcd.refresh();
lcd.drawPixel((short) 20, (short) 20, upm_st7735.javaupm_st7735Constants.ST7735_GREEN);
lcd.refresh();
lcd.drawTriangle((short) 50, (short) 50, (short) 80, (short) 80, (short) 60, (short) 90,
upm_st7735.javaupm_st7735Constants.ST7735_GREEN);
lcd.refresh();
lcd.drawCircle((short) 100, (short) 110, (short) 10,
upm_st7735.javaupm_st7735Constants.ST7735_BLUE);
lcd.refresh();
lcd.setTextWrap((short) 0);
lcd.setCursor((short) 0, (short) 30);
lcd.setTextColor(upm_st7735.javaupm_st7735Constants.ST7735_RED,
upm_st7735.javaupm_st7735Constants.ST7735_RED);
lcd.setTextSize((short) 1);
lcd.print("Hello World!");
lcd.setCursor((short) 10, (short) 50);
lcd.setTextColor(upm_st7735.javaupm_st7735Constants.ST7735_RED,
upm_st7735.javaupm_st7735Constants.ST7735_YELLOW);
lcd.setTextSize((short) 2);
lcd.print("BIG");
lcd.refresh();

Public Member Functions

synchronized void delete ()
 
 ST7735 (short csLCD, short cSD, short rs, short rst)
 
String name ()
 
void initModule ()
 
void configModule ()
 
void write (short value)
 
void data (short value)
 
void executeCMDList (byte[] addr)
 
void setAddrWindow (short x0, short y0, short x1, short y1)
 
void drawPixel (short x, short y, int color)
 
void refresh ()
 
int lcdCSOn ()
 
int lcdCSOff ()
 
int sdCSOn ()
 
int sdCSOff ()
 
int rsHIGH ()
 
int rsLOW ()
 
- Public Member Functions inherited from GFX
synchronized void delete ()
 
void setAddrWindow (short x0, short y0, short x1, short y1)
 
void drawPixel (short x, short y, int color)
 
void refresh ()
 
void drawChar (short x, short y, short data, int color, int bg, short size)
 
void print (String msg)
 
int setPixel (int x, int y, int color)
 
void fillScreen (int color)
 
void fillRect (short x, short y, short w, short h, int color)
 
void drawFastVLine (short x, short y, short h, int color)
 
void drawLine (short x0, short y0, short x1, short y1, int color)
 
void drawTriangle (short x0, short y0, short x1, short y1, short x2, short y2, int color)
 
void drawCircle (short x, short y, short r, int color)
 
void setCursor (short x, short y)
 
void setTextColor (int textColor, int textBGColor)
 
void setTextSize (short size)
 
void setTextWrap (short wrap)
 
void setM_height (int value)
 
int getM_height ()
 
void setM_width (int value)
 
int getM_width ()
 
void setM_textSize (int value)
 
int getM_textSize ()
 
void setM_textColor (int value)
 
int getM_textColor ()
 
void setM_textBGColor (int value)
 
int getM_textBGColor ()
 
void setM_cursorX (int value)
 
int getM_cursorX ()
 
void setM_cursorY (int value)
 
int getM_cursorY ()
 
void setM_wrap (int value)
 
int getM_wrap ()
 

Constructor & Destructor Documentation

ST7735 ( short  csLCD,
short  cSD,
short  rs,
short  rst 
)

Instantiates an ST7735 object

Parameters
csLCDLCD chip select pin
cSDSD card chip select pin
rsData/command pin
rstReset pin

Member Function Documentation

void configModule ( )

Configures the chip via the SPI

void data ( short  value)

Sends data to an SPI bus (rs must be HIGH)

Parameters
valueCommand number
void drawPixel ( short  x,
short  y,
int  color 
)

Sends a pixel color (RGB) to the chip.

Parameters
xAxis on the horizontal scale
yAxis on the vertical scale
colorRGB (16-bit) color (R[0-4], G[5-10], B[11-15])
void executeCMDList ( byte[]  addr)

Executes a set of commands and data

Parameters
addrPointer to the start of the commands/data section
void initModule ( )

Initializes the module GPIOs

int lcdCSOff ( )

LCD chip select is HIGH

int lcdCSOn ( )

LCD chip select is LOW

String name ( )

Returns the name of the component

void refresh ( )

Copies the buffer to the chip via the SPI.

int rsHIGH ( )

Data select is HIGH

int rsLOW ( )

Data select is LOW

int sdCSOff ( )

CD card select is HIGH

int sdCSOn ( )

CD card chip select is LOW

void setAddrWindow ( short  x0,
short  y0,
short  x1,
short  y1 
)

Sets the window size inside the screen where pixels data is written.

Parameters
x0First coordinate
y0First coordinate
x1Second coordinate
y1Second coordinate
void write ( short  value)

Sends a command to an SPI bus (rs must be LOW)

Parameters
valueCommand number
Inheritance diagram for ST7735:
Inheritance graph
[legend]
Collaboration diagram for ST7735:
Collaboration graph
[legend]

The documentation for this class was generated from the following file: