/*############################################################# Program Name : ex4_LM6029ACW_char_graphics Author : Grant Phillips Date Modified : 08/02/2016 Compiler : ARMmbed Tested On : STM32F4-Discovery Description : Example program that demonstrates the use of the graphics functions combined with the character functions in the LM6029ACW class library. Requirements : * STM32F4-Discovery Board Circuit : * The LM6029ACW is connected as described in ex1_lcd.HelloWorld. ##############################################################*/ #include "mbed.h" #include "LM6029ACW.h" 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); //Create a LM6029ACW object called lcd // CS1 RES RS WR RD DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 DigitalOut backlight(PB_7); //if the lcd's backlight is connected to a transistor/FET circuit to switch it on and off int main() { unsigned char i; backlight = 0; //turn on the lcd's backlight while(1) { lcd.ClrScr(0); //clear the display and clear the dots (=0) lcd.GotoXY(1,3); lcd.PutStr("Text under graphics", 1); //print text before drawing graphics over it - normal mode lcd.DrawLine(0,0,127,63,1); //Draw a line from the top left corner to bottom right in color=1 lcd.DrawLine(0,0,0,63,1); //Draw a line from the top left corner to bottom left in color=1 lcd.DrawLine(0,63,127,63,1); //Draw a line from the bottom left corner to bottom right in color=1 lcd.DrawCircle(30,40,20,0,1); //Draw a circle with radius=10, fill=0, color=1 lcd.DrawCircle(100,24,20,1,1); //Draw a circle with radius=10, fill=0, color=1 lcd.DrawPixel(30,40,1); //Draw a pixel in the left circle with color=1 lcd.GotoXY(1,4); lcd.PutStr("Text over graphics", 1); //print text over the graphics - normal mode for(i=0;i<10;i++) //Flash a pixel in the right circle 10 times by alternating the color between 0 and 1 { lcd.DrawPixel(100,24,0); //Draw a pixel in the right circle with color=0 wait(0.2); lcd.DrawPixel(100,24,1); //Draw a pixel in the right circle with color=1 wait(0.2); } wait(0.5); //repeat, but this time on a black background and clear foreground lcd.ClrScr(1); //clear the display and fill with dots (=1) lcd.GotoXY(1,3); lcd.PutStr("Text under graphics", 0); //print text before drawing graphics over it - inverted mode lcd.DrawLine(0,0,127,63,0); //Draw a line from the top left corner to bottom right in color=0 lcd.DrawLine(0,0,0,63,0); //Draw a line from the top left corner to bottom left in color=0 lcd.DrawLine(0,63,127,63,0); //Draw a line from the bottom left corner to bottom right in color=0 lcd.DrawCircle(30,40,20,0,0); //Draw a circle with radius=10, fill=0, color=0 lcd.DrawCircle(100,24,20,1,0); //Draw a circle with radius=10, fill=0, color=0 lcd.DrawPixel(30,40,0); //Draw a pixel in the left circle with color=0 lcd.GotoXY(1,4); lcd.PutStr("Text over graphics", 0); //print text over the graphics - inverted mode for(i=0;i<20;i++) //Flash a pixel in the right circle 10 times by alternating the color between 0 and 1 { lcd.DrawPixel(100,24,2); //Draw a pixel in the right circle with color=2 (toggle color) wait(0.2); } wait(0.5); } }