![](/media/cache/profiles/dream_vangogh.jpg.50x50_q85.jpg)
LCD example for NXP Rapid IoT Prototyping kit using hexiwear SDK. Read more at https://www.hackster.io/marcomerli/riotwear-mbed-2b2011.
Dependencies: GraphicsDisplay ColorMemLCD Large_fonts
Diff: main.cpp
- Revision:
- 2:25d611652243
- Parent:
- 0:375bc0c22bf6
diff -r 19961b4a7239 -r 25d611652243 main.cpp --- a/main.cpp Thu Jun 23 02:35:10 2016 +0000 +++ b/main.cpp Fri Nov 29 16:46:40 2019 +0000 @@ -1,7 +1,6 @@ #include "stdio.h" #include "mbed.h" #include "ColorMemLCD.h" -//#include "SDFileSystem.h" #include "string" #include "Prototype24x27.h" @@ -15,14 +14,24 @@ #include "symb_block.h" #include "symb_block_rev.h" -//SDFileSystem sd( PTE3, PTE1, PTE2, PTE4, "sd" ); // mosi,miso,sck,cs -ColorMemLCD LCD( PTD2, PTD3, PTD1, PTD0, PTC4, PTD3, "TFT" ); // mosi, miso, sclk, cs, reset, (power) +DigitalOut lcd_light(PTE12, 1); // 1 = ON, 0 = OFF + // mosi, miso, sclk, cs, reset, power +ColorMemLCD LCD( PTB22, PTB23, PTB21, PTB20, PTD15, PTD9, "TFT"); + +#if(1) +#define WAIT_S(x) wait(x) +#else +#define WAIT_S(x) Thread::wait(x*1000) +#endif + Ticker pollingTimer; +/* void pollingTimerHandler() { LCD.polling(); } +*/ int main() { @@ -31,12 +40,9 @@ int Divide = 8; // separate for 8 windows to save memory int Block = LCD_DISP_HEIGHT / Divide; - pollingTimer.attach( &pollingTimerHandler, 1.0 ); + // pollingTimer.attach( &pollingTimerHandler, 1.0 ); LCD.command_AllClear(); - /* SD read */ - //LCD.BMP_24(0,0,"/sd/sample.bmp"); - while(1) { /* Turn white - whole the screen */ @@ -58,7 +64,7 @@ LCD.set_font( (unsigned char*)Prototype24x27 ); LCD.printf("Hello"); LCD.update(); - wait(0.8); + WAIT_S(0.8); /* world */ pic_height = 88; @@ -74,22 +80,22 @@ LCD.Bitmap4bit( 0, 60, 176, pic_height, (unsigned char *)bmp_leaf_4bit ); LCD.update(); } - wait(0.8); + WAIT_S(0.8); LCD.fillcircle( 40, 136, 18, LCD_COLOR_WHITE ); - LCD.update(); - wait(1); + LCD.update(); + WAIT_S(1); LCD.fillcircle( 160, 122, 12, LCD_COLOR_WHITE ); - LCD.update(); - wait(0.2); + LCD.update(); + WAIT_S(0.2); LCD.fillcircle( 120, 132, 14, LCD_COLOR_WHITE ); LCD.update(); - wait(1); + WAIT_S(1); - LCD.setBlinkMode( LCD_BLINKMODE_INVERSE ); - wait(0.2); + LCD.setBlinkMode( LCD_BLINKMODE_INVERSE ); + WAIT_S(0.2); LCD.setBlinkMode( LCD_BLINKMODE_NONE ); - wait(0.2); + WAIT_S(0.2); /* Cube */ LCD.background( LCD_COLOR_WHITE); @@ -103,13 +109,13 @@ } LCD.update(); } - wait(0.2); + WAIT_S(0.2); LCD.setBlinkMode( LCD_BLINKMODE_INVERSE ); - wait(0.2); + WAIT_S(0.2); LCD.setBlinkMode( LCD_BLINKMODE_NONE ); - wait(0.2); + WAIT_S(0.2); } - wait(0.5); + WAIT_S(0.5); /* Watch */ LCD.background( LCD_COLOR_WHITE); @@ -128,7 +134,7 @@ LCD.locate(72, 54); LCD.printf("%02d",k+20); LCD.update(); - wait((double)exp((double)(-k/3))); // time constant =3 + WAIT_S((double)exp((double)(-k/3))); // time constant =3 } } }