sample program using TextLCD_ostream

Dependencies:   TextLCD_ostream mbed

This is sample program using std::ostream with TextLCD
Because a large amount of memory is needed, it does not work in low memory MPU.
(It works fine on mbed LPC1768 and STM32 Nucleo-L476RG. But linker error occard on TG-LPC11U35-501)

Revision:
6:96bc6126d7f0
Parent:
5:4d1ddc9177b0
--- a/main.cpp	Sun Jun 26 08:36:08 2016 +0000
+++ b/main.cpp	Sat Jul 30 07:03:01 2016 +0000
@@ -1,30 +1,43 @@
+//#define AKIDUKI_I2CPIC
+
 #include "mbed.h"
 #include "TextLCD_ostream.h"
 #include <iomanip>
  
+#ifdef TARGET_MBED_LPC1768
 I2C i2c(p28,p27); // SDA, SCL
+#else
+I2C i2c(I2C_SDA, I2C_SCL);
+#endif
 
+#ifdef AKIDUKI_I2CPIC
+//秋月 PIC搭載I2C 16x2
+#include "ACM1602NI.h"
+ACM1602NI lcd(i2c);
+TextLCD_ostream<ACM1602NI> lcds(&lcd);
+#else
+#include "TextLCD.h"
 //マルツ MI2CLCD-01 I2C 16x2+icon
 //ストロベリーリナックス I2C 16x2+icon
 //秋月 小型I2C 16x2
 TextLCD_I2C_N lcd(&i2c);
 const int LCDCONTRAST=32;
-
 //秋月 超小型I2C 8x2
 //TextLCD_I2C_N lcd(&i2c, ST7032_SA, TextLCD::LCD8x2);
 //const int LCDCONTRAST=20;
-//秋月 PIC搭載 I2C 16x2 これはうまくいかない
-//TextLCD_I2C_N lcd(&i2c, 0xA0, TextLCD::LCD16x2,NC,TextLCD::ST7066_ACM);
-//const int LCDCONTRAST=0; //contrast control is not supported
 
-lcd_ostream lcds(&lcd);
+//lcd_ostream lcds(&lcd);
+TextLCD_ostream<TextLCD_I2C_N> lcds(&lcd);
+#endif
 
 int main() {
     using namespace std;
+    #if(LCD_CONTRAST == 1)
     // lcds.lcd() で元の TextLCDにアクセス出来る
-    if(LCDCONTRAST) lcds.lcd().setContrast(LCDCONTRAST);
+    lcds.lcd().setContrast(LCDCONTRAST);
+    #endif
     while(true) {
-        // lcds.cls() は lcd_ostream& を返すので、そこにそのまま << 出来る
+        // lcds.cls() は TextLCD_ostream& を返すので、そこにそのまま << 出来る
         // endl で次の行の先頭に行く
         lcds.cls() << "Hello world" << endl << "LCD ostream";
         wait(2);