upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Public Member Functions | Data Fields

API for the ST7735 LCD. More...

Detailed Description

This module defines the interface for the ST7735 display library

st7735.jpg
upm::ST7735 lcd(7, 4, 9, 8);
lcd.fillScreen(ST7735_RED);
lcd.refresh();
lcd.fillScreen(ST7735_CYAN);
lcd.refresh();
lcd.fillScreen(ST7735_BLACK);
lcd.refresh();
lcd.drawLine(10, 10, 10, 100, ST7735_MAGENTA);
lcd.drawLine(20, 20, 10, 100, ST7735_YELLOW);
lcd.drawLine(30, 30, 50, 100, ST7735_WHITE);
lcd.refresh();
lcd.drawPixel(20, 20, ST7735_GREEN);
lcd.refresh();
lcd.drawTriangle(50, 50, 80, 80, 60, 90, ST7735_GREEN);
lcd.refresh();
lcd.drawCircle(100, 110, 10, ST7735_BLUE);
lcd.refresh();
lcd.setTextWrap(0x0);
lcd.setCursor(0, 30);
lcd.setTextColor(ST7735_RED, ST7735_RED);
lcd.setTextSize(1);
lcd.print("Hello World!");
lcd.setCursor(10, 50);
lcd.setTextColor(ST7735_RED, ST7735_YELLOW);
lcd.setTextSize(2);
lcd.print("BIG");
lcd.refresh();
std::cout << "exiting application" << std::endl;

Public Member Functions

 ST7735 (int csLCD, int cSD, int rs, int rst)
 
std::string name ()
 
void initModule ()
 
void configModule ()
 
void write (uint8_t value)
 
void data (uint8_t value)
 
void executeCMDList (const uint8_t *addr)
 
void setAddrWindow (uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)
 
void drawPixel (int16_t x, int16_t y, uint16_t color)
 
void refresh ()
 
mraa::Result lcdCSOn ()
 
mraa::Result lcdCSOff ()
 
mraa::Result sdCSOn ()
 
mraa::Result sdCSOff ()
 
mraa::Result rsHIGH ()
 
mraa::Result rsLOW ()
 
- Public Member Functions inherited from GFX
 GFX (int16_t w, int16_t h)
 
virtual ~GFX ()
 
virtual void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 
virtual void drawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 
virtual void drawFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color)
 
virtual void drawRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 
virtual void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 
virtual void fillScreen (uint16_t color)
 
virtual void invertDisplay (bool i)
 
void drawCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 
void drawCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color)
 
void fillCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 
void fillCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color)
 
void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 
void fillTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 
void drawRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
 
void fillRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
 
void drawChar (int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size)
 
int16_t getCursorX (void) const
 
int16_t getCursorY (void) const
 
void setCursor (int16_t x, int16_t y)
 
void setTextColor (uint16_t c)
 
void setTextColor (uint16_t c, uint16_t bg)
 
void setTextSize (uint8_t s)
 
void setTextWrap (bool w)
 
uint8_t getRotation (void) const
 
void setRotation (uint8_t r)
 
void cp437 (bool x)
 
void print (std::string msg)
 
int16_t width (void) const
 
int16_t height (void) const
 
 GFX (int width, int height)
 
virtual ~GFX ()
 
void drawChar (int16_t x, int16_t y, uint8_t data, uint16_t color, uint16_t bg, uint8_t size)
 
void print (std::string msg)
 
void fillScreen (uint16_t color)
 
void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 
void drawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 
void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 
void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 
void drawCircle (int16_t x, int16_t y, int16_t r, uint16_t color)
 
void setCursor (int16_t x, int16_t y)
 
void setTextColor (uint16_t textColor, uint16_t textBGColor)
 
void setTextSize (uint8_t size)
 
void setTextWrap (uint8_t wrap)
 
 GFX (int width, int height, uint8_t *screenBuffer, const unsigned char *font)
 
virtual ~GFX ()
 
void drawChar (int16_t x, int16_t y, uint8_t data, uint16_t color, uint16_t bg, uint8_t size)
 
void print (std::string msg)
 
mraa::Result setPixel (int x, int y, uint16_t color)
 
void fillScreen (uint16_t color)
 
void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 
void drawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 
void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 
void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 
void drawCircle (int16_t x, int16_t y, int16_t r, uint16_t color)
 
void setCursor (int16_t x, int16_t y)
 
void setTextColor (uint16_t textColor, uint16_t textBGColor)
 
void setTextSize (uint8_t size)
 
void setTextWrap (uint8_t wrap)
 

Data Fields

uint8_t m_map [160 *128 *2]
 
- Data Fields inherited from GFX
uint8_t * m_map
 

Additional Inherited Members

- Protected Attributes inherited from GFX
const int16_t WIDTH
 
const int16_t HEIGHT
 
int16_t _width
 
int16_t _height
 
uint8_t rotation
 
uint16_t textcolor
 
uint16_t textbgcolor
 
int16_t cursor_x
 
int16_t cursor_y
 
uint8_t textsize
 
bool wrap
 
bool _cp437
 
int m_width
 
int m_height
 
int m_textSize
 
int m_textColor
 
int m_textBGColor
 
int m_cursorX
 
int m_cursorY
 
int m_wrap
 
const unsigned char * m_font
 
- Static Protected Attributes inherited from GFX
static const unsigned char font []
 

Constructor & Destructor Documentation

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

Instantiates an ST7735 object

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

Here is the call graph for this function:

Member Function Documentation

std::string name ( )
inline

Returns the name of the component

Here is the call graph for this function:

void initModule ( )

Initializes the module GPIOs

Here is the call graph for this function:

Here is the caller graph for this function:

void configModule ( )

Configures the chip via the SPI

Here is the call graph for this function:

Here is the caller graph for this function:

void write ( uint8_t  value)
virtual

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

Parameters
valueCommand number

Reimplemented from GFX.

Here is the call graph for this function:

Here is the caller graph for this function:

void data ( uint8_t  value)

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

Parameters
valueCommand number

Here is the call graph for this function:

Here is the caller graph for this function:

void executeCMDList ( const uint8_t *  addr)

Executes a set of commands and data

Parameters
addrPointer to the start of the commands/data section

Here is the call graph for this function:

Here is the caller graph for this function:

void setAddrWindow ( uint8_t  x0,
uint8_t  y0,
uint8_t  x1,
uint8_t  y1 
)
virtual

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

Parameters
x0First coordinate
y0First coordinate
x1Second coordinate
y1Second coordinate

Implements GFX.

Here is the call graph for this function:

Here is the caller graph for this function:

void drawPixel ( int16_t  x,
int16_t  y,
uint16_t  color 
)
virtual

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])

Implements GFX.

Here is the call graph for this function:

Here is the caller graph for this function:

void refresh ( )
virtual

Copies the buffer to the chip via the SPI.

Implements GFX.

Here is the call graph for this function:

Here is the caller graph for this function:

mraa::Result lcdCSOn ( )

LCD chip select is LOW

Here is the caller graph for this function:

mraa::Result lcdCSOff ( )

LCD chip select is HIGH

Here is the caller graph for this function:

mraa::Result sdCSOn ( )

CD card chip select is LOW

Here is the caller graph for this function:

mraa::Result sdCSOff ( )

CD card select is HIGH

Here is the caller graph for this function:

mraa::Result rsHIGH ( )

Data select is HIGH

Here is the caller graph for this function:

mraa::Result rsLOW ( )

Data select is LOW

Here is the caller graph for this function:

Field Documentation

uint8_t m_map[160 *128 *2]

Screens buffer

Inheritance diagram for ST7735:
Inheritance graph
[legend]
Collaboration diagram for ST7735:
Collaboration graph
[legend]

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