RTOS_MSPM0  1.1
ECE445M starter code
Macros | Enumerations | Functions
ST7735_SDC.h File Reference

160 by 128 pixel LCD with SDC More...

#include <stdint.h>

Go to the source code of this file.

Macros

#define ST7735_TFTWIDTH   128
 128 pixels wide
 
#define ST7735_TFTHEIGHT   160
 160 pixels tall
 
#define ST7735_BLACK   0x0000
 The following constants are possible colors for the LCD in RGB format.
 
#define ST7735_BLUE   0xF800
 
#define ST7735_RED   0x001F
 
#define ST7735_GREEN   0x07E0
 
#define ST7735_CYAN   0xFFE0
 
#define ST7735_MAGENTA   0xF81F
 
#define ST7735_YELLOW   0x07FF
 
#define ST7735_WHITE   0xFFFF
 
#define ST7735_LIGHTGREY   ST7735_Color565(228,228,228)
 
#define ST7735_DARKGREY   ST7735_Color565(32,32,32)
 
#define ST7735_ORANGE   ST7735_Color565(255,102,0)
 
#define ST7735_PURPLE   ST7735_Color565(106,13,173)
 

Enumerations

enum  initRFlags {
  none , INITR_GREENTAB , INITR_REDTAB , INITR_BLACKTAB ,
  none , INITR_GREENTAB , INITR_REDTAB , INITR_BLACKTAB
}
 some flags for ST7735_InitR()
 

Functions

void ST7735_InitB (void)
 Initialize ST7735B LCD. More...
 
void ST7735_InitR (enum initRFlags option)
 Initialize ST7735R LCD. More...
 
void ST7735_DrawPixel (int16_t x, int16_t y, uint16_t color)
 Color one pixel. More...
 
void ST7735_DrawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 Draw a vertical line. More...
 
void ST7735_DrawFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color)
 Draw a horizontal line. More...
 
void ST7735_FillScreen (uint16_t color)
 Fill the screen. More...
 
void ST7735_FillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 Draw a filled rectangle. More...
 
void ST7735_DrawSmallCircle (int16_t x, int16_t y, uint16_t color)
 Draw a small circle. More...
 
void ST7735_DrawCircle (int16_t x, int16_t y, uint16_t color)
 Draw a circle. More...
 
uint16_t ST7735_Color565 (uint8_t r, uint8_t g, uint8_t b)
 RGB to color creation. More...
 
uint16_t ST7735_SwapColor (uint16_t x)
 Swaps red and blue. More...
 
void ST7735_DrawBitmap (int16_t x, int16_t y, const uint16_t *image, int16_t w, int16_t h)
 Displays a BMP image. More...
 
void ST7735_DrawCharS (int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size)
 Draw a character. More...
 
void ST7735_DrawChar (int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size)
 Draw a character. More...
 
uint32_t ST7735_DrawString (uint16_t x, uint16_t y, char *pt, int16_t textColor)
 Draw a string. More...
 
void ST7735_SetCursor (uint32_t newX, uint32_t newY)
 Move the cursor. More...
 
void ST7735_OutUDec (uint32_t n)
 Output an unsigned decimal. More...
 
void ST7735_OutUDec4 (uint32_t n)
 Output a 4-digit unsigned decimal. More...
 
void ST7735_OutUDec5 (uint32_t n)
 Output a 5-digit unsigned decimal. More...
 
void ST7735_OutUFix2_1 (uint32_t n, int16_t textColor)
 Output a 2-digit fixed-point decimal. More...
 
void ST7735_OutUHex2 (uint32_t n, int16_t textColor)
 Output a 2-digit hexadecimal number. More...
 
void ST7735_SetRotation (uint8_t m)
 Change rotation. More...
 
void ST7735_InvertDisplay (int i)
 invert display More...
 
void ST7735_Drawaxes (uint16_t axisColor, uint16_t bgColor, char *xLabel, char *yLabel1, uint16_t label1Color, char *yLabel2, uint16_t label2Color, int32_t ymax, int32_t ymin)
 Initializes a plot. More...
 
void ST7735_PlotClear (int32_t ymin, int32_t ymax)
 Clear plot. More...
 
void ST7735_PlotPoint (int32_t y)
 Plot one point. More...
 
void ST7735_PlotPoint2 (int32_t data1, uint16_t color1)
 Plot one point with color. More...
 
void ST7735PlotIncrement (void)
 Moves the plot cursor in time. More...
 
void ST7735_PlotLine (int32_t y)
 Plot one line. More...
 
void ST7735_PlotPoints (int32_t y1, int32_t y2)
 Plot two points. More...
 
void ST7735_PlotBar (int32_t y)
 Plot one bar. More...
 
void ST7735_PlotdBfs (int32_t y)
 Plot one bar. More...
 
void ST7735_PlotNext (void)
 Move x-axis parameter. More...
 
void ST7735_PlotNextErase (void)
 Move X coordinate
More...
 
void ST7735_OutChar (char ch)
 Output a character. More...
 
void ST7735_OutString (char *ptr)
 Output a string. More...
 
void ST7735_SetTextColor (uint16_t color)
 sets the text color More...
 
void ST7735_InitPrintf (void)
 use ST7735 LCD to output from printf More...
 
void ST7735_sDecOut2 (int32_t n)
 fixed point output resolution 0.01 More...
 
void ST7735_uBinOut6 (uint32_t n)
 fixed point output resolution 1/64 More...
 
void ST7735_XYplotInit (char *title, int32_t minX, int32_t maxX, int32_t minY, int32_t maxY)
 initialize XY plot More...
 
void ST7735_XYplot (uint32_t num, int32_t bufX[], int32_t bufY[])
 XY plot. More...
 
void ST7735_Line (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
 Draws line. More...
 
void ST7735_SetX (int32_t newX)
 set X-position More...
 
void ST7735_Message (uint32_t d, uint32_t l, char *pt, int32_t value)
 

Detailed Description

160 by 128 pixel LCD with SDC

Software driver functions for ST7735R display
This is a library for the Adafruit 1.8" SPI display.<br> This library works with the Adafruit 1.8" TFT Breakout w/SD card
-—> http://www.adafruit.com/products/358
as well as Adafruit raw 1.8" TFT display
-—> http://www.adafruit.com/products/618
Check out the links above for our tutorials and wiring diagrams
These displays use SPI to communicate, 4 or 5 pins are required to interface (RST is optional) Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Written by Limor Fried/Ladyada for Adafruit Industries. MIT license, all text above must be included in any redistribution

Version
ECE445M RTOS
Author
Daniel Valvano and Jonathan Valvano
Warning
AS-IS
Note
For more information see http://users.ece.utexas.edu/~valvano/
Date
December 27, 2025 interface



ST7735 160 by 128 pixel LCD

Adafruit ST7735R pins
Pin Connection Description
10+3.3Backlight
9 PB7 SPI1 MISO (used for SDC)
8 PB9 SPI1 SCLK clock out
7 PB8 SPI1 PICO data out
6 PB6 GPIO CS0=TFT_CS
5 PB0 CARD_CS (used for SDC)
4 PB16Data/Command(GPIO), high for data, low for command
3 PB15RESET, low to reset, (GPIO)
2 +3.3VCC
1 Gnd ground
HiLetgo ST7735 TFT and SDC pins
signalPinConnection
LED- 16TFT, to ground
LED+ 15TFT, to +3.3 V
SD_CS 14SDC, to PB0 chip select
MOSI 13SDC, to PB8 MOSI
MISO 12SDC, to PB7 MISO
SCK 11SDC, to PB9 serial clock
CS 10TFT, to PB6 SPI1 CS0
SCL 9TFT, to PB9 SPI1 SCLK
SDA 8TFT, to PB8 MOSI SPI1 PICO
A0 7TFT, to PB16 Data/Command, high for data, low for command
RESET 6TFT, to PB15 reset (GPIO), low to reset
NC 3,4,5not connected
VCC 2to +3.3 V
GND 1to ground