Class library for a Nextion graphics LCD to provide basic graphics and touch functions.

Dependents:   ProjectCardDisplay ProjectCardDisplay TUTORIA_GARCIA_ACOSTA

Revision:
2:ea278c2b9437
Parent:
1:3b96605ca27a
Child:
3:72f3dadfab71
--- a/NextionLCD.h	Sun Feb 04 20:37:26 2018 +0000
+++ b/NextionLCD.h	Sun Feb 04 20:43:57 2018 +0000
@@ -43,26 +43,41 @@
  * Example:
  * @code
  * #include "mbed.h"
- * #include "LM6029ACW.h"
+ * #include "NextionLCD.h"
+ *
+ * NextionLCD lcd(PB_6, PB_7);     //Tx, Rx
  * 
- * LM6029ACW lcd(PD_7, PE_2, PD_6, PD_3, PD_2, PC_15, PC_14, PC_13, PC_11, PC_9, PC_8, PC_6, PC_2);
- * //            CS1   RES   RS    WR    RD    DB7    DB6    DB5    DB4    DB3   DB2   DB1   DB0
- * 
- * DigitalOut backlight(PB_7);
+ * int main() 
+ * {
+ *     char str[20];
+ *     
+ *     lcd.ClrScr(BLACK);  //clear the display and fill it with BLACK pixels
+ *     
+ *     //draw some shapes
+ *     lcd.FillCircle(100,100,50,RED);
+ *     lcd.DrawPixel(100,100,WHITE);
+ *     lcd.DrawRectangle(50,50,100,100,BLUE);
+ *     lcd.DrawLine(50,50,100,150,YELLOW);
  * 
- * int main() { 
- *     backlight = 0;                      //turn on the lcd's backlight
- *     while(1) {
- *         lcd.GotoXY(4, 3);               //move cursor to row, col
- *         lcd.ClrScr(0);                  //clear all the pixels on the display
- *         lcd.PutStr("Hello World!", 1);  //print text in black pixels
- *         wait(2.0);
- *         
- *         lcd.GotoXY(4, 3);               //move cursor to row, col
- *         lcd.ClrScr(1);                  //fill all the pixels on the display
- *         lcd.PutStr("Hello World!", 0);  //print text in clear pixels
- *         wait(2.0);
- *     } 
+ *     while(1) 
+ *     {
+ *         if (lcd.Touch())        //test if the lcd was touched
+ *         {
+ *             sprintf(str, "Touched: %d,%d", lcd.TouchX(), lcd.TouchY()); //print to string buffer
+ *             lcd.DrawString(0,0,200,30,0,GREEN,GRAY,0,0,str);            //display string on LCD:
+ *                                                                         // x,y          : 0,0
+ *                                                                         // width, height: 200, 300
+ *                                                                         // font         : 0
+ *                                                                         // fontcolor    : GREEN
+ *                                                                         // backcolor    : GRAY
+ *                                                                         // x alignment  : 0 (left)
+ *                                                                         // y alignment  : 0 (top)
+ *         }
+ *         else
+ *         {
+ *             lcd.DrawString(0,0,200,30,0,BLACK,BLACK,0,0,"");            //blank display area when not touched
+ *         }
+ *     }
  * }
  * @endcode
  */