Code for driving 9x OLED displays and reding from an HX711 load cell aplifier.

Dependencies:   Adafruit_GFX SPI_TFT_ILI9341 TFT_fonts hx711 mbed

Files at this revision

API Documentation at this revision

Comitter:
jimconner
Date:
Thu Feb 05 22:08:34 2015 +0000
Parent:
0:3745349c0c83
Child:
2:c5f60c130f9a
Commit message:
Test code for running 9 oled displays - I seem to only be able to get 7 working at a time - I suspect I'm running out of memory on the KL25-Z

Changed in this revision

Adafruit_GFX.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
--- a/Adafruit_GFX.lib	Fri Jan 30 00:01:26 2015 +0000
+++ b/Adafruit_GFX.lib	Thu Feb 05 22:08:34 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/nkhorman/code/Adafruit_GFX/#bf0e4072b06d
+http://developer.mbed.org/users/nkhorman/code/Adafruit_GFX/#f393e67ed0b5
--- a/main.cpp	Fri Jan 30 00:01:26 2015 +0000
+++ b/main.cpp	Thu Feb 05 22:08:34 2015 +0000
@@ -18,6 +18,8 @@
 PwmOut led1(LED1);
 PwmOut led2(LED2);
 
+#define MUX_MASK 0x0000000F
+PortOut MuxPortOut(PortB, MUX_MASK);
 
 // an SPI sub-class that provides a constructed default
 class SPIPreInit : public SPI
@@ -46,10 +48,20 @@
 //Adafruit_SSD1306_Spi gOled1(gSpi,p26,p25,p24);
  
 I2CPreInit gI2C(PTE0,PTE1);
-mux_SSD1306_I2c gOled1(gI2C,PTD1,PTB0, 0, 0x78,64);
-mux_SSD1306_I2c gOled2(gI2C,PTD1,PTB0, 0, 0x7A,64);
-mux_SSD1306_I2c gOled3(gI2C,PTD1,PTB0, 1, 0x78,64);
-mux_SSD1306_I2c gOled4(gI2C,PTD1,PTB0, 1, 0x7A,64);
+//mux_SSD1306_I2c gOled1(gI2C,Reset_Pin,muxport, muxmask, 0, 0x78,64);
+
+mux_SSD1306_I2c gOled1(gI2C,PTD1,MuxPortOut, 0, 0x78,64);
+mux_SSD1306_I2c gOled2(gI2C,PTD1,MuxPortOut, 0, 0x7A,64);
+mux_SSD1306_I2c gOled3(gI2C,PTD1,MuxPortOut, 1, 0x78,64);
+//mux_SSD1306_I2c gOled4(gI2C,PTD1,MuxPortOut, 1, 0x7A,64);
+mux_SSD1306_I2c gOled5(gI2C,PTD1,MuxPortOut, 2, 0x78,64);
+mux_SSD1306_I2c gOled6(gI2C,PTD1,MuxPortOut, 2, 0x7A,64);
+//mux_SSD1306_I2c gOled7(gI2C,PTD1,MuxPortOut, 3, 0x78,64);
+mux_SSD1306_I2c gOled8(gI2C,PTD1,MuxPortOut, 3, 0x7A,64);
+mux_SSD1306_I2c gOled9(gI2C,PTD1,MuxPortOut, 4, 0x78,64);
+
+
+
 
 void testdrawline() {
     for (int16_t i=0; i<gOled1.width(); i+=4) {
@@ -64,9 +76,29 @@
         gOled3.drawLine(0, 0, gOled3.width()-1, i, WHITE);
         gOled3.display();
     }
-    for (int16_t i=0; i<gOled4.width(); i+=4) {
-        gOled4.drawLine(0, 0, i, gOled4.height()-1, WHITE);
-        gOled4.display();
+//    for (int16_t i=0; i<gOled4.width(); i+=4) {
+//        gOled4.drawLine(0, 0, i, gOled4.height()-1, WHITE);
+//        gOled4.display();
+//    }
+    for (int16_t i=0; i<gOled5.width(); i+=4) {
+        gOled5.drawLine(0, 0, i, gOled5.height()-1, WHITE);
+        gOled5.display();
+    }
+    for (int16_t i=0; i<gOled6.width(); i+=4) {
+        gOled6.drawLine(0, 0, i, gOled6.height()-1, WHITE);
+        gOled6.display();
+    }
+//    for (int16_t i=0; i<gOled7.width(); i+=4) {
+//        gOled7.drawLine(0, 0, i, gOled7.height()-1, WHITE);
+//        gOled7.display();
+//    }
+    for (int16_t i=0; i<gOled8.width(); i+=4) {
+        gOled8.drawLine(0, 0, i, gOled8.height()-1, WHITE);
+        gOled8.display();
+    }
+    for (int16_t i=0; i<gOled9.width(); i+=4) {
+        gOled9.drawLine(0, 0, i, gOled9.height()-1, WHITE);
+        gOled9.display();
     }
 
 }
@@ -85,23 +117,41 @@
     gOled1.clearDisplay();
     gOled2.clearDisplay();
     gOled3.clearDisplay();
-    gOled4.clearDisplay();    
+//    gOled4.clearDisplay();
+    gOled5.clearDisplay();    
+    gOled6.clearDisplay();    
+//    gOled7.clearDisplay();    
+    gOled8.clearDisplay();    
+    gOled9.clearDisplay();    
     
     testdrawline();
 
     gOled1.clearDisplay();
     gOled2.clearDisplay();
     gOled3.clearDisplay();
-    gOled4.clearDisplay();
+//    gOled4.clearDisplay();
+    gOled5.clearDisplay();
+    gOled6.clearDisplay();
+//    gOled7.clearDisplay();
+    gOled8.clearDisplay();
+    gOled9.clearDisplay();
  
-    gOled1.printf("      Counting Up \r\n\n\n\n", gOled1.width(), gOled1.height());
-    gOled2.printf("     Counting Down \r\n\n\n\n", gOled2.width(), gOled2.height());
-    gOled3.printf("    More going up \r\n\n\n\n", gOled3.width(), gOled3.height());
-    gOled4.printf("   More going down \r\n\n\n\n", gOled4.width(), gOled4.height());
+    gOled1.printf("      Aqua Vega A \r\n\n\n\n", gOled1.width(), gOled1.height());
+    gOled2.printf("      Aqua Vega B \r\n\n\n\n", gOled2.width(), gOled2.height());
+    gOled3.printf("      Cannazyme \r\n\n\n\n", gOled3.width(), gOled3.height());
+//    gOled4.printf("      Rhizotonic \r\n\n\n\n", gOled4.width(), gOled4.height());
+    gOled5.printf("      Aqua Flores A \r\n\n\n\n", gOled5.width(), gOled5.height());
+    gOled6.printf("      Aqua Flores B \r\n\n\n\n", gOled6.width(), gOled6.height());
+//    gOled7.printf("      PK13/14 \r\n\n\n\n", gOled7.width(), gOled7.height());
+    gOled8.printf("      Cannaboost \r\n\n\n\n", gOled8.width(), gOled8.height());
+    gOled9.printf("      pH-Down \r\n\n\n\n", gOled9.width(), gOled9.height());
     gOled1.setTextSize(2);
     gOled2.setTextSize(2);
     gOled3.setTextSize(2);
-    gOled4.setTextSize(2);
+    gOled5.setTextSize(2);
+    gOled6.setTextSize(2);
+    gOled8.setTextSize(2);
+    gOled9.setTextSize(2);
 
     
     while(1)
@@ -109,14 +159,23 @@
         led1 = 0.98;
         gOled1.printf("  %uml\r",x);
         gOled1.display();
+        gOled6.printf("  %uml\r",x);
+        gOled6.display();
+
         led1 = 1;
         led2 = 0.98;
         gOled2.printf("  %uml\r",y);
         gOled2.display();
-        gOled3.printf("  %uK\r",a);
+//        gOled7.printf("  %uml\r",y);
+//        gOled7.display();
+        gOled3.printf("  %uml\r",a);
         gOled3.display();
-        gOled4.printf("  %uK\r",b);
-        gOled4.display();
+        gOled8.printf("  %uml\r",a);
+        gOled8.display();
+        gOled5.printf("  %uml\r",b);
+        gOled5.display();
+        gOled9.printf("  %uml\r",b);
+        gOled9.display();
         led2 = 1;
         x++;
         y--;