There are many examples on MBED for ST7735 controlled LCDs, but they're mostly for the AdaFruit LCD. This is a working example of the library used for the cheap-as-dirt KMR-1.8 SPI 128x160 TFT LCD, on a "Black Pill" STM32F407VE developement board.

Dependencies:   24_TFT_STMNUCLEO mbed

Files at this revision

API Documentation at this revision

Comitter:
katbar
Date:
Fri Sep 28 03:37:23 2018 +0000
Commit message:
Cheap ST7735 TFT LCD (KMR-1.8 SPI) with Todor Todorov's library.

Changed in this revision

24_TFT_STMNUCLEO.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/24_TFT_STMNUCLEO.lib	Fri Sep 28 03:37:23 2018 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/cdtsilva/code/24_TFT_STMNUCLEO/#060b167a46ba
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Sep 28 03:37:23 2018 +0000
@@ -0,0 +1,37 @@
+// WORKS with KMR-1.8 128x160 TFT LCD
+//
+// Hookup: 
+// VCC, LED+ - 3.3V
+// CS - PC_4
+// SCLK - PA_5
+// SDA - PA_7
+// A0 - PC_5
+// RESET - PA_4
+
+
+#include "mbed.h"
+#include "st7735.h"
+#include "terminus.h"
+  
+ // create the lcd instance
+ // ST7735_LCD( PinName CS, PinName RESET, PinName RS, PinName SCL, PinName SDA, PinName BL = NC, backlight_t blType = Constant, float defaultBackLightLevel = 1.0 );
+ ST7735_LCD lcd( PC_4, PA_4, PC_5, PA_5, PA_7 ); // control pins
+
+ int main()
+ {
+     // initialize display - place it in standard portrait mode and set background to black and
+     lcd.Initialize( LANDSCAPE_REV, RGB16  );   
+     lcd.ClearScreen();
+     // various graphics primitives
+     lcd.DrawPixel(1,1,0xFF9FFF);
+     lcd.DrawLine(10,10,150,10,0xFF29A9);
+     lcd.FillCircle(70,60,10,0x00FF00);
+     lcd.DrawRect(30,80,50,100,0x0000FF); 
+     lcd.DrawRect(60,80,80,100,0xFF00FF);   // any RGB mix XX-XX-XX
+     lcd.DrawRect(90,80,110,100,0x00FFFF);   // any RGB mix XX-XX-XX
+     lcd.DrawRect(120,80,140,100,0xFFFF00);   // any RGB mix XX-XX-XX
+     lcd.SetFont( &TerminusFont );
+     // print something on the screen
+     lcd.Print( "Hello, World!", CENTER, 25 ); // align text to center horizontally and use starndard colors
+     while ( 1 ) { }
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Sep 28 03:37:23 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187
\ No newline at end of file