| RTOS_MSPM0 1.1 ECE445M starter code

Macros | Functions
SPI.h File Reference
SPI

160 by 128 pixel LCD More...

Go to the source code of this file.

## Macros
#define | SDC_CS GPIOB
#define | SDC_CS_PIN (1<<0)
#define | SDC_CS_INDEX (PB0INDEX)
#define | SDC_CS_LOW() (SDC_CS->DOUTCLR31_0 = SDC_CS_PIN)
#define | SDC_CS_HIGH() (SDC_CS->DOUTSET31_0 = SDC_CS_PIN)
#define | TFT_CS GPIOB
#define | TFT_CS_PIN (1<<6)
#define | TFT_CS_INDEX (PB6INDEX)
#define | TFT_CS_LOW() (TFT_CS->DOUTCLR31_0 = TFT_CS_PIN)
#define | TFT_CS_HIGH() (TFT_CS->DOUTSET31_0 = TFT_CS_PIN)
#define | TFT_DC GPIOB
#define | TFT_DC_PIN (1<<16)
#define | TFT_DC_INDEX (PB16INDEX)
#define | TFT_DC_LOW() (TFT_DC->DOUTCLR31_0 = TFT_DC_PIN)
#define | TFT_DC_HIGH() (TFT_DC->DOUTSET31_0 = TFT_DC_PIN)
#define | TFT_RST GPIOB
#define | TFT_RST_PIN (1<<15)
#define | TFT_RST_INDEX (PB15INDEX)
#define | TFT_RST_LOW() (TFT_RST->DOUTCLR31_0 = TFT_RST_PIN)
#define | TFT_RST_HIGH() (TFT_RST->DOUTSET31_0 = TFT_RST_PIN)

## Functions
void | SPI_OutData (char data)
| Output data. More...
void | SPI_OutCommand (char command)
| Output command. More...
void | SPI1_Reset (void)
| Reset LCD. More...
void | CS_Init (void)
| SDC CS initialization. More...
void | SPI1_Init (void)
| initialize SPI1 More...
void | TFT_OutCommand (char command)
| Output command. More...
void | TFT_OutData (char data)
| Output data. More...

## Detailed Description

160 by 128 pixel LCD

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

Copyright
  Copyright 2025 by Jonathan W. Valvano, valva.nosp@m.no@m.nosp@m.ail.u.nosp@m.texa.nosp@m.s.edu,

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.3 | Backlight
  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 | PB16 | Data/Command(GPIO), high for data, low for command
  3 | PB15 | RESET, low to reset, (GPIO)
  2 | +3.3 | VCC
  1 | Gnd | ground

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