working mbed program for Adafruit ST7735

Dependencies:   Adafruit_GFX Adafruit_ST7735 SDFileSystem mbed-os

Fork of mbed-OLED-example-NCS36510 by ON Semiconductor

Files at this revision

API Documentation at this revision

Comitter:
jacobjohnson
Date:
Tue Jan 31 17:16:30 2017 +0000
Parent:
1:fe4baf28935e
Commit message:
working code. need to get it into codeblocks to be able to trace function calls and learn how the libraries work, since they are not very well documented.

Changed in this revision

Adafruit_GFX.lib Show annotated file Show diff for this revision Revisions of this file
Adafruit_ST7735.lib Show annotated file Show diff for this revision Revisions of this file
SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
SeeedGrayOLED.lib Show diff for this revision Revisions of this file
img/uvision.png 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Adafruit_GFX.lib	Tue Jan 31 17:16:30 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/nkhorman/code/Adafruit_GFX/#7fb1d4d3525d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Adafruit_ST7735.lib	Tue Jan 31 17:16:30 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/jacobjohnson/code/Adafruit_ST7735/#5842518d1feb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Tue Jan 31 17:16:30 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/mbed/code/SDFileSystem/#8db0d3b02cec
--- a/SeeedGrayOLED.lib	Wed Jan 25 20:58:55 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://developer.mbed.org/teams/onsemi/code/SeeedGrayOLED/#e14364aac2ca
--- a/main.cpp	Wed Jan 25 20:58:55 2017 +0000
+++ b/main.cpp	Tue Jan 31 17:16:30 2017 +0000
@@ -1,27 +1,41 @@
+/***************************************
+This is a working copy. It is not finished.
+***************************************/
+
 #include "mbed.h"
-#include "SeeedGrayOLED.h"
+#include "Adafruit_ST7735.h"
+#include "SDFileSystem.h"
+//#include <string>
 
 DigitalOut led1(LED1);
-SeeedGrayOLED SeeedGrayOled(I2C1_SDATA_1, I2C1_SCLK_1);
+SDFileSystem sd(D11, D12, D13, D4, "SD"); // the pinout on the mbed // mosi, miso, sclk, cs
+Adafruit_ST7735 tft(D11, D12, D13, D10, D6, D9); // MOSI, MISO, SCLK, SSEL, TFT_DC, TFT_RST
+AnalogIn joystick(A3);
 
+uint8_t readButton(void);
+
+// main() runs in its own thread in the OS
+// (note the calls to wait below for delays)
 int main() {
-      
-    SeeedGrayOled.init();
-    SeeedGrayOled.clearDisplay();
-    SeeedGrayOled.setNormalDisplay();
-    SeeedGrayOled.setVerticalMode();
+    
+    tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab
+    tft.fillScreen(ST7735_BLACK);
     
-    while (true) 
-    {        
-        for(char i=1; i<11; i++)
-        {
-            led1 = !led1;
-            SeeedGrayOled.setTextXY(i,1);       //1st row, 0th column
-            SeeedGrayOled.setGrayLevel(i);      //Set Grayscale level. Any number between 0 - 15.
-            SeeedGrayOled.putString("Hello World");
-            Thread::wait(10);
-       }
-        Thread::wait(5000);
+    int result = tft.DrawBitmapFile("/SD/ON.bmp");
+    
+    while (true) {
+        
+        float b = joystick.read();
+        
+        tft.setTextColor(ST7735_GREEN);
+        //tft.setCursor(0, 60);  //claims that this is not in the Adafruit_ST7735 library?  How are these files linked together?  
+        tft.printf("%f \n\r", b); 
+        printf("%f \n\r", b);
+        wait_ms(100);
+        
+        
     }
 }
 
+
+