RobG 1,892 Posted September 12, 2013 Share Posted September 12, 2013 This is my new universal graphics library (original one is here.) Supported boards (this is out of the "box" support, but the library will work with any board after small changes.) TI's MSP430FR5969 LaunchPad (ugl16msp only for now) TI's MSP430F5529 LaunchPad TI's MSP430G2 LaunchPad with G2553 chip RobG's MSP430G2955 Dev Board RobG's MSP430F5172 Dev Board RobG's MSP430F5510 Dev Board Supported displays 1.8" ST7735 based JD-T1800 - ugl8 2.2" HX8340 based displays - ugl8 2.2" ILI9225 based displays (touch panel) - ugl8 2.2" ILI9341 based displays 320x240 pixels - ugl16 Tiva versions are right here ugl8msp.zip (name change 4/18/14) ugl16msp.zip (updated 4/19/14) maralme, Druzyek, tripwire and 7 others 9 1 Quote Link to post Share on other sites
bluehash 1,581 Posted September 12, 2013 Share Posted September 12, 2013 Pretty! Quote Link to post Share on other sites
dpharris 13 Posted September 15, 2013 Share Posted September 15, 2013 Hi Rob --- I have your latest 2.2 240x320 ...however, I only have MSP430G2452 and Stellaris/Tiva... is it worth me trying to port this code over to one of those? Thanks, David Quote Link to post Share on other sites
RobG 1,892 Posted September 16, 2013 Author Share Posted September 16, 2013 Porting to Stellaris/Tiva would require many changes. G2452 should work as is in software SPI mode (use G2553.) If you want to use hardware SPI, you only need to update SPI configuration (change from USCI to USI.) I will try to find some time this week and add G2452. Quote Link to post Share on other sites
dpharris 13 Posted September 17, 2013 Share Posted September 17, 2013 Thanks! I will try the software SPI. I am new to msp430-Dom, and am missing the subtleties ... Too many salta sheets, too little time. David Quote Link to post Share on other sites
dpharris 13 Posted September 17, 2013 Share Posted September 17, 2013 Yay! Success with the softSPI on the G2452. Drawing a diagonal line of pixels erases the surrounding pixels. Fixing that will need a R/modify/W, I think David PS -- the swallow is nice, too! drawBitmap(blackbird_96_64, 96, 64/8, 0, 0); Quote Link to post Share on other sites
RobG 1,892 Posted September 17, 2013 Author Share Posted September 17, 2013 ...Drawing a diagonal line of pixels erases the surrounding pixels. Fixing that will need a R/modify/W, I think Can you attach screen shot of the problem? Line is made up of single pixels, so no surrounding pixels should be affected. In any case, r/m/w is possible on 320x240 (ILI934x.) Quote Link to post Share on other sites
dpharris 13 Posted September 18, 2013 Share Posted September 18, 2013 Can you attach screen shot of the problem? Line is made up of single pixels, so no surrounding pixels should be affected. In any case, r/m/w is possible on 320x240 (ILI934x.) I have attached a screen shot. Since we are writing a full byte, I would expect it to overwrite the bits. Perhaps I have missed a mode setting? My code is: setpixelmode(0); for(int i=0; i<64; i++) setpixel(i,i); Thanks, David Quote Link to post Share on other sites
RobG 1,892 Posted September 18, 2013 Author Share Posted September 18, 2013 This library is for color displays, not Nokia B&W @@bluehash, can we move last few posts to the appropriate thread? Quote Link to post Share on other sites
dpharris 13 Posted September 18, 2013 Share Posted September 18, 2013 oops, sorry! David Quote Link to post Share on other sites
Donzap 0 Posted September 19, 2013 Share Posted September 19, 2013 Is there any library to manage 2.2" ILI9340/ILI9342 based displays on stellaris? I don't mind if not everything is ported... Is only for investigate and learn... Quote Link to post Share on other sites
RobG 1,892 Posted September 19, 2013 Author Share Posted September 19, 2013 Is there any library to manage 2.2" ILI9340/ILI9342 based displays on stellaris? I don't mind if not everything is ported... Is only for investigate and learn... Here's something you can use for testing (software SPI only.) ugl16stella.zip Donzap 1 Quote Link to post Share on other sites
Donzap 0 Posted September 19, 2013 Share Posted September 19, 2013 It works!!! But after some seconds running, first time in drawLogicLines(), I get a white screen. Quote Link to post Share on other sites
RobG 1,892 Posted September 19, 2013 Author Share Posted September 19, 2013 Hmmm, this sounds like a bug I had and fixed in main (attached code runs on my LP for few minutes w/o any issues.) This can also happen if you read some memory addresses. Disable drawLogicLines() and see if that fixes it. Quote Link to post Share on other sites
Donzap 0 Posted September 20, 2013 Share Posted September 20, 2013 Hmmm, this sounds like a bug I had and fixed in main (attached code runs on my LP for few minutes w/o any issues.) This can also happen if you read some memory addresses. Disable drawLogicLines() and see if that fixes it. Only works fine if I disable both shesGotColors() and drawLogicLines() if one of those is on, I get the white screen. If I can help testing something, let me know ;-) Thanks a lot for your work!!!!!! That's the way it works. I use Energia, Did I Do something wrong? /* * main.c * * Created on: May 6, 2013 * Author: RobG */ #include "lm4f120h5qr.h" #include "msp.h" #include "lcd.h" #include "graphics.h" #include "color.h" #include "typedefs.h" u_char cc = 0; u_char sx = 0; u_char sy = 0; u_char d = 0; u_char o = 0; u_char orientation = 0; const u_char starty[13] = { 30, 48, 150, 50, 40, 85, 38, 105, 66, 130, 35, 71, 117 }; const u_char startx[17] = { 180, 30, 100, 96, 48, 50, 150, 70, 40, 38, 123, 132, 80, 35, 110, 55, 99 }; const u_char dim[9] = { 20, 14, 5, 17, 10, 5, 3, 18, 12 }; const u_char offset[10] = { 6, 4, 1, 9, 7, 2, 8, 0, 3, 5 }; void drawLogicLines(u_char h); void shesGotColors(u_int repeatTimes); void setUpMCU(); void main(void) { SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOB; SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOE; long ulLoop = SYSCTL_RCGC2_R; GPIO_PORTB_DIR_R |= LCD_MOSI_PIN + LCD_SCLK_PIN + LCD_CS_PIN; GPIO_PORTB_DEN_R |= LCD_MOSI_PIN + LCD_SCLK_PIN + LCD_CS_PIN; GPIO_PORTB_DATA_R |= LCD_CS_PIN; GPIO_PORTE_DIR_R = LCD_DC_PIN; GPIO_PORTE_DEN_R = LCD_DC_PIN; initLCD(); for (ulLoop = 0; ulLoop < 200; ulLoop++) { } initLCD(); while (1) { delay(10); clearScreen(1); setColor(COLOR_16_RED); drawString(5, 5, FONT_SM, "Texas Instruments"); setColor(COLOR_16_WHITE); drawString(5, 20, FONT_MD, "LaunchPad Booster Pack"); setColor(COLOR_16_BLUE); drawString(5, 40, FONT_LG, "2.2\" Color LCD"); setColor(COLOR_16_YELLOW); drawString(5, 60, FONT_LG, "MSP430, Stellaris, Tiva"); setColor(COLOR_16_ORANGE); drawString(5, 80, FONT_MD, "240 x 320 pixels"); setColor(COLOR_16_PURPLE); drawString(5, 100, FONT_MD, "16bit color"); // delay(100); // // shesGotColors(50); // // delay(100); // // clearScreen(1); // // drawLogicLines(8); // delay(100); // setOrientation(++orientation & 0x03); } } /////////////////////////// // needed for test only /////////////////////////// void drawLogicLines(u_char h) { u_char * addr = 0; u_int y = 0; u_char c = 1; while (y < getScreenHeight()) { setColor(colors[c]); drawLogicLine(1, y, getScreenWidth(), h, (u_char*) addr); y += (h + 2); c++; addr += getScreenWidth(); } } u_int getColor() { cc++; if (cc == 43) cc = 0; return colors[cc]; } u_char getX() { sx++; if (sx == 17) sx = 0; return startx[sx]; } u_char getY() { sy++; if (sy == 13) sy = 0; return starty[sy]; } u_char getD() { d++; if (d == 9) d = 0; return dim[d]; } u_char getO() { o++; if (o == 10) o = 0; return offset[o]; } void shesGotColors(u_int times) { u_char x; u_char y; u_char d; u_int repeatTimes = times; while (repeatTimes > 0) { setColor(getColor()); x = getX(); y = getY(); d = getD(); drawLine(x - d - getO(), y - d - getO(), x + d + getO(), y + d + getO()); setColor(getColor()); x = getX(); y = getY(); d = getD(); fillRect(x - d - getO(), y - d - getO(), x + d + getO(), y + d + getO()); setColor(getColor()); x = getX(); y = getY(); d = getD(); drawRect(x - d - getO(), y - d - getO(), x + d + getO(), y + d + getO()); setColor(getColor()); x = getX(); y = getY(); d = getD(); fillCircle(x, y, d + getO()); setColor(getColor()); x = getX(); y = getY(); d = getD(); drawLine(x - d - getO(), y + d + getO(), x + d + getO(), y - d - getO()); setColor(getColor()); x = getX(); y = getY(); d = getD(); drawCircle(x, y, d + getO()); repeatTimes--; } } ///////////////////////////////////////// // end of test ///////////////////////////////////////// Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.