Diese Library dient zum zeichnen von Punkten, Linien und Kreisen auf dem LC-Display.
Es können auch im Flash gespeicherte Bilder auf das Display gezeichnet werden.
Sie benötigt dazu die LCD-Library “STM32_UB_LCD_ILI9341″
Im Moment werden 3 Bildformate unterstützt :
1. = 16Bit (RGB565) – Image-Files
2. = Bitmap Files (BMP, 24bpp, unkompremiert)
3. = JPG Files
Für das Format Nr. 1 habe ich das PC-Programm “ImageGenerator” geschrieben. Das wandelt beliebige BMP-Files in das RGB565-Format um und erzeugt ein C-File, das in der CooCox-IDE eingebunden werden kann.
Für die beiden anderen Formate (2 und 3) habe ich das PC-Programm “FileConverter” geschrieben. Dieses ließt ein beliebiges Hex-File (z.B. ein JPG-File) und erzeugt daraus ein C-File, das in der CooCox-IDE eingebunden werden kann.
Speicherverbrauch :
Ein Image-Bild mit 240×320 Pixel braucht 153.600 Bytes
Ein BMP-Bild mit 240×320 Pixel braucht 230.454 Bytes
Ein JPG-Bild mit 240×320 Pixel braucht ca. 15.323 Bytes
Beispielbild :
Enumerationen :
1 2 3 4 5 6 7 8 9 10 11 | typedef enum { GRAPHIC_OK =0, GRAPHIC_FILE_ERR, GRAPHIC_SIZE_ERR, GRAPHIC_ID_ERR, GRAPHIC_HEAD_ERR, GRAPHIC_WIDTH_ERR, GRAPHIC_HEIGHT_ERR, GRAPHIC_BPP_ERR, GRAPHIC_COMPR_ERR }GRAPHIC_ERR_t; |
Funktionen :
1 2 3 4 5 6 | void UB_Graphic_DrawPixel(int16_t xpos, int16_t ypos, uint16_t color); // zeichnet einen Pixel void UB_Graphic_DrawLine(int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color); // zeichnet eine Linie zwischen zwei Punkten void UB_Graphic_DrawCircle(int16_t x0, int16_t y0, int16_t radius, uint16_t color); // zeichnet einen Kreis an Punkt x,y mit Radius r GRAPHIC_ERR_t UB_Graphic_DrawImage(UB_Image *img, int16_t xpos, int16_t ypos); // zeichnet ein Image aus dem Flash GRAPHIC_ERR_t UB_Graphic_DrawBmp(UB_Picture *bmp, uint16_t xpos, uint16_t ypos); // zeichnet ein BMP-File aus dem Flash GRAPHIC_ERR_t UB_Graphic_DrawJpg(UB_Picture *jpg, uint16_t xpos, uint16_t ypos); |
Beispiel :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | //-------------------------------------------------------------- // File : main.c // Datum : 06.11.2013 // Version : 1.0 // Autor : UB // EMail : mc-4u(@)t-online.de // Web : www.mikrocontroller-4u.de // CPU : STM32F429 // IDE : CooCox CoIDE 1.7.4 // GCC : 4.7 2012q4 // Module : CMSIS_BOOT, M4_CMSIS_CORE // Funktion : Demo der LCD-Graphic-Library // Hinweis : Diese zwei Files muessen auf 8MHz stehen // "cmsis_boot/stm32f4xx.h" // "cmsis_boot/system_stm32f4xx.c" // In Configuration diese Define hinzufügen : // "STM32F429_439xx" , "__ASSEMBLY__" , "USE_STDPERIPH_DRIVER" //-------------------------------------------------------------- #include "main.h" #include "stm32_ub_lcd_ili9341.h" #include "stm32_ub_graphic.h" int main(void) { SystemInit(); // Quarz Einstellungen aktivieren // Init vom LCD UB_LCD_Init(); // Init der Layer UB_LCD_LayerInit_Fullscreen(); // auf Hintergrund schalten UB_LCD_SetLayer_1(); // Hintergrund komplett mit einer Farbe füllen UB_LCD_FillLayer(RGB_COL_WHITE); // auf Vordergrund schalten UB_LCD_SetLayer_2(); // Vordergrund komplett mit einer Farbe füllen UB_LCD_FillLayer(RGB_COL_GREEN); UB_LCD_Rotate_180(); // Ein Image (aus dem Flash) Zeichnen UB_Graphic_DrawImage(&Emo2_Image,0,0); // Ein BMP-File (aus dem Flash) Zeichnen UB_Graphic_DrawBmp(&Emo2_Bmp,30,95); // Ein JPG-File (aus dem Flash) Zeichnen UB_Graphic_DrawJpg(&Emo2_Jpg,60,190); // rote Linie zeichnen UB_Graphic_DrawLine(10,20,100,150,RGB_COL_RED); // weißen kreis zeichnen UB_Graphic_DrawCircle(70,75,50,RGB_COL_WHITE); while(1) { } } |
Hier die Library zum Download :
Hier der komplette CooCox-Projektordner zum Download :
Hier der Link zu meinen PC-Programmen :
Wie könnte man am einfachsten die Lib um einen Kreis gefüllt mit Farbe erweitern? Oder wäre die Funktion DrawPixel da vllt. einfacher für ein Zeichenprogramm zu handhaben?
bei den STM-Beispielen sind alle möglichen Funktionen dabei, auch gefüllte Kreise.
Habe mich dem fertigen Paint bedient, wobei ich das Ganze nichdiri Libs kopiert habe, sondern einfach alle zusätzlichen Funktion in der main untergebracht ha.
Der 3 Achsen Sensor ist ja mal genial. Danke fur die lib 20.
Nice work.
Have you ever bothered with using uGFX as your graphics and GUI library? http://ugfx.org
no
First off your work is amazing helpful to people that are not STM32F4 experts. The examples ST provides especially graphics and touch for the STM32F429 are so unnecessarily complex while your code makes it so much easier to grasp the concepts behind the functions.
I devised a rounded rectangle function using a combination of your 2d functions. It is not as optimized as it should be because I cheat by drawing filled circles in each corner but it is easy to use. I thought I would share it below.
void UB_Graphic2D_DrawRoundedRecDMA(uint16_t xp, uint16_t yp, uint16_t w, uint16_t h, uint16_t r, uint16_t c)
{
UB_Graphic2D_DrawFullRectDMA(xp+r, yp, w-2*r, h, c);
UB_Graphic2D_DrawFullRectDMA(xp, yp+r, r, h-2*r, c);
UB_Graphic2D_DrawFullRectDMA(xp+w-r, yp+r, r, h-2*r, c);
UB_Graphic2D_DrawFullCircleDMA(xp+r, yp+r, r, c);
UB_Graphic2D_DrawFullCircleDMA(xp+w-r-1, yp+r, r, c);
UB_Graphic2D_DrawFullCircleDMA(xp+r, yp+h-r-1, r, c);
UB_Graphic2D_DrawFullCircleDMA(xp+w-r-1, yp+h-r-1, r, c);
}
nice idea
for a outline version you need a arc function
(perhaps you can modify the circle function to draw only one quarter
I love a challenge.
Here is a more optimized filled rounded rectangle and also a rounded rectangle outline version
void UB_Graphic2D_RoundedRect(uint16_t xp, uint16_t yp,uint16_t width,uint16_t height, uint16_t radius, uint16_t color)
{
int32_t D;/* Decision Variable */
uint32_t CurX;/* Current X Value */
uint32_t CurY;/* Current Y Value */
if(xp>=LCD_MAXX) xp=LCD_MAXX-1;
if(yp>=LCD_MAXY) yp=LCD_MAXY-1;
if(radius==0) return;
D = 3 – (radius << 1);
CurX = 0;
CurY = radius;
/*
*
Q4 * Q1
*
*************
*
Q3 * Q2
*
*/
UB_Graphic2D_DrawStraightDMA(xp+radius, yp, width-2*radius, LCD_DIR_HORIZONTAL, color);
UB_Graphic2D_DrawStraightDMA(xp+radius, yp+height-1, width-2*radius, LCD_DIR_HORIZONTAL, color);
UB_Graphic2D_DrawStraightDMA(xp, yp+radius, height-2*radius, LCD_DIR_VERTICAL, color);
UB_Graphic2D_DrawStraightDMA(xp+width-1, yp+radius, height-2*radius, LCD_DIR_VERTICAL, color);
while (CurX <= CurY)
{
UB_Graphic2D_DrawPixelNormal(xp + width-radius-1+CurX, yp+radius – CurY, color); //Q1
UB_Graphic2D_DrawPixelNormal(xp + width-radius-1+CurY, yp+radius – CurX, color); //Q1
UB_Graphic2D_DrawPixelNormal(xp + width-radius-1+CurX, yp +height-radius-1+ CurY, color); //Q2
UB_Graphic2D_DrawPixelNormal(xp + width-radius-1+CurY, yp + height-radius-1+CurX, color); //Q2
UB_Graphic2D_DrawPixelNormal(xp+radius – CurX, yp+height-radius-1+ CurY, color); //Q3
UB_Graphic2D_DrawPixelNormal(xp+radius – CurY, yp+height-radius-1+ CurX, color); //Q3
UB_Graphic2D_DrawPixelNormal(xp+radius – CurX, yp+radius – CurY, color); //Q4
UB_Graphic2D_DrawPixelNormal(xp+radius – CurY, yp+radius – CurX, color); //Q4
if (D < 0)
{
D += (CurX << 2) + 6;
}
else
{
D += ((CurX – CurY) <=LCD_MAXX) xp=LCD_MAXX-1;
if(yp>=LCD_MAXY) yp=LCD_MAXY-1;
if(radius==0) return;
D = 3 – (radius << 1);
CurX = 0;
CurY = radius;
/*
*
Q4 * Q1
*
*************
*
Q3 * Q2
*
*/
//Draw filled rectangles first
/*
________
__| |__
| |
|__ __|
|________|
*/
UB_Graphic2D_DrawFullRectDMA(xp+radius, yp, width-2*radius, height, color);
UB_Graphic2D_DrawFullRectDMA(xp, yp+radius, radius, height-2*radius, color);
UB_Graphic2D_DrawFullRectDMA(xp+width-radius, yp+radius, radius, height-2*radius, color);
//draw 1/4 filled circles in each corner
while (CurX <= CurY)
{
UB_Graphic2D_DrawStraightDMA(xp + width-radius, yp+radius – CurY, radius-(radius-CurX), LCD_DIR_HORIZONTAL, color); //Q1
UB_Graphic2D_DrawStraightDMA(xp + width-radius, yp+radius – CurX, radius-(radius-CurY), LCD_DIR_HORIZONTAL, color); //Q1
UB_Graphic2D_DrawStraightDMA(xp + width-radius, yp+height-radius-1 + CurY, radius-(radius-CurX), LCD_DIR_HORIZONTAL, color); //Q2
UB_Graphic2D_DrawStraightDMA(xp + width-radius, yp+height-radius-1 + CurX, radius-(radius-CurY), LCD_DIR_HORIZONTAL, color); //Q2
UB_Graphic2D_DrawStraightDMA(xp+radius – CurX,yp+radius – CurY, xp-radius + CurX, LCD_DIR_HORIZONTAL, color); //Q4
UB_Graphic2D_DrawStraightDMA(xp+radius – CurY,yp+radius – CurX, xp-radius + CurY, LCD_DIR_HORIZONTAL, color); //Q4
UB_Graphic2D_DrawStraightDMA(xp+radius – CurX, yp+height-radius-1+ CurY,xp-radius + CurX,LCD_DIR_HORIZONTAL, color); //Q3
UB_Graphic2D_DrawStraightDMA(xp+radius – CurY, yp+height-radius-1+ CurX,xp-radius + CurY,LCD_DIR_HORIZONTAL, color); //Q3
if (D < 0)
{
D += (CurX << 2) + 6;
}
else
{
D += ((CurX – CurY) << 2) + 10;
CurY–;
}
CurX++;
}
}
Sorry that really got screwed up. Here it is again
void UB_Graphic2D_FullRoundedRect(uint16_t xp, uint16_t yp,uint16_t width,uint16_t height, uint16_t radius, uint16_t color)
{
int32_t D;/* Decision Variable */
uint32_t CurX;/* Current X Value */
uint32_t CurY;/* Current Y Value */
if(xp>=LCD_MAXX) xp=LCD_MAXX-1;
if(yp>=LCD_MAXY) yp=LCD_MAXY-1;
if(radius==0) return;
D = 3 – (radius << 1);
CurX = 0;
CurY = radius;
/*
*
Q4 * Q1
*
*************
*
Q3 * Q2
*
*/
//Draw filled rectangles first
/*
________
__| |__
| |
|__ __|
|________|
*/
UB_Graphic2D_DrawFullRectDMA(xp+radius, yp, width-2*radius, height, color);
UB_Graphic2D_DrawFullRectDMA(xp, yp+radius, radius, height-2*radius, color);
UB_Graphic2D_DrawFullRectDMA(xp+width-radius, yp+radius, radius, height-2*radius, color);
//draw 1/4 filled circles in each corner
while (CurX <= CurY)
{
UB_Graphic2D_DrawStraightDMA(xp + width-radius, yp+radius – CurY, radius-(radius-CurX), LCD_DIR_HORIZONTAL, color); //Q1
UB_Graphic2D_DrawStraightDMA(xp + width-radius, yp+radius – CurX, radius-(radius-CurY), LCD_DIR_HORIZONTAL, color); //Q1
UB_Graphic2D_DrawStraightDMA(xp + width-radius, yp+height-radius-1 + CurY, radius-(radius-CurX), LCD_DIR_HORIZONTAL, color); //Q2
UB_Graphic2D_DrawStraightDMA(xp + width-radius, yp+height-radius-1 + CurX, radius-(radius-CurY), LCD_DIR_HORIZONTAL, color); //Q2
UB_Graphic2D_DrawStraightDMA(xp+radius – CurX,yp+radius – CurY, xp-radius + CurX, LCD_DIR_HORIZONTAL, color); //Q4
UB_Graphic2D_DrawStraightDMA(xp+radius – CurY,yp+radius – CurX, xp-radius + CurY, LCD_DIR_HORIZONTAL, color); //Q4
UB_Graphic2D_DrawStraightDMA(xp+radius – CurX, yp+height-radius-1+ CurY,xp-radius + CurX,LCD_DIR_HORIZONTAL, color); //Q3
UB_Graphic2D_DrawStraightDMA(xp+radius – CurY, yp+height-radius-1+ CurX,xp-radius + CurY,LCD_DIR_HORIZONTAL, color); //Q3
if (D < 0)
{
D += (CurX << 2) + 6;
}
else
{
D += ((CurX – CurY) <=LCD_MAXX) xp=LCD_MAXX-1;
if(yp>=LCD_MAXY) yp=LCD_MAXY-1;
if(radius==0) return;
D = 3 – (radius << 1);
CurX = 0;
CurY = radius;
/*
*
Q4 * Q1
*
*************
*
Q3 * Q2
*
*/
UB_Graphic2D_DrawStraightDMA(xp+radius, yp, width-2*radius, LCD_DIR_HORIZONTAL, color);
UB_Graphic2D_DrawStraightDMA(xp+radius, yp+height-1, width-2*radius, LCD_DIR_HORIZONTAL, color);
UB_Graphic2D_DrawStraightDMA(xp, yp+radius, height-2*radius, LCD_DIR_VERTICAL, color);
UB_Graphic2D_DrawStraightDMA(xp+width-1, yp+radius, height-2*radius, LCD_DIR_VERTICAL, color);
while (CurX <= CurY)
{
UB_Graphic2D_DrawPixelNormal(xp + width-radius-1+CurX, yp+radius – CurY, color); //Q1
UB_Graphic2D_DrawPixelNormal(xp + width-radius-1+CurY, yp+radius – CurX, color); //Q1
UB_Graphic2D_DrawPixelNormal(xp + width-radius-1+CurX, yp +height-radius-1+ CurY, color); //Q2
UB_Graphic2D_DrawPixelNormal(xp + width-radius-1+CurY, yp + height-radius-1+CurX, color); //Q2
UB_Graphic2D_DrawPixelNormal(xp+radius – CurX, yp+height-radius-1+ CurY, color); //Q3
UB_Graphic2D_DrawPixelNormal(xp+radius – CurY, yp+height-radius-1+ CurX, color); //Q3
UB_Graphic2D_DrawPixelNormal(xp+radius – CurX, yp+radius – CurY, color); //Q4
UB_Graphic2D_DrawPixelNormal(xp+radius – CurY, yp+radius – CurX, color); //Q4
if (D < 0)
{
D += (CurX << 2) + 6;
}
else
{
D += ((CurX – CurY) << 2) + 10;
CurY–;
}
CurX++;
}
}
I can’t seem to post it complete as the site is messing with my code. If you know a better way I will try.
Thanks
use Code-Tags or send it over email
Hier meine Methoden:
Für das abgerundete Rechteck werden zunächst die verkürzten geraden gezeichnet
und die Ecken mittels modifizierten Bresenham Kreis (Offset für jeden Quadranten) gezeichnet.
//--------------------------------------------------------------
// Zeichnet ein abgerundetes Rechteck mit einer Farbe
// Ecke = xp, yp [x = 0...LCD_MAXX, y = 0...LCD_MAXY]
// Breite = w
// Hoehe = h
// Radius = r
// Color = c
//--------------------------------------------------------------
void UB_Graphic2D_DrawRoundedRectDMA(uint16_t xp, uint16_t yp, uint16_t w, uint16_t h, uint16_t r, uint16_t c)
{
int16_t d;
int16_t f = 1 - r, ddF_x = 0, ddF_y = -2 * r, x = 0, y = r;
// check auf Limit
if (xp >= LCD_MAXX) xp = LCD_MAXX – 1;
if (yp >= LCD_MAXY) yp = LCD_MAXY – 1;
if (w == 0 || h == 0) return;
if (w < 2 * r || h w || 2 * r > h) r = h / 2;
if (LCD_DISPLAY_MODE == LANDSCAPE)
{
// Richtung Drehen
d = w;
w = h;
h = d;
}
// check auf Limit
if ((xp + w) > LCD_MAXX) w = LCD_MAXX – xp;
if ((yp + h) > LCD_MAXY) h = LCD_MAXY – yp;
if (LCD_DISPLAY_MODE == LANDSCAPE)
{
UB_Graphic2D_DrawStraightDMA(xp, yp + r, h – 2 * r, LCD_DIR_HORIZONTAL, c);
UB_Graphic2D_DrawStraightDMA((xp + w – 1), yp + r, h – 2 * r, LCD_DIR_HORIZONTAL, c);
UB_Graphic2D_DrawStraightDMA(xp + r, yp, w – 2 * r, LCD_DIR_VERTICAL, c);
UB_Graphic2D_DrawStraightDMA(xp + r, yp + h – 1, w – 2 * r, LCD_DIR_VERTICAL, c);
}
else
{
UB_Graphic2D_DrawStraightDMA(xp + r, yp, w – 2 * r, LCD_DIR_HORIZONTAL, c);
UB_Graphic2D_DrawStraightDMA(xp + r, yp + h – 1, w – 2 * r, LCD_DIR_HORIZONTAL, c);
UB_Graphic2D_DrawStraightDMA(xp, yp + r, h – 2 * r, LCD_DIR_VERTICAL, c);
UB_Graphic2D_DrawStraightDMA(xp + w – 1, yp + r, h – 2 * r, LCD_DIR_VERTICAL, c);
}
// check auf Limit
if (r == 0) return;
while(x = 0)
{
y–;
ddF_y += 2;
f += ddF_y;
}
x++;
ddF_x += 2;
f += ddF_x + 1;
UB_Graphic2D_DrawPixelNormal(xp – r + w – 1 + x,yp – r + h – 1 + y,c);
UB_Graphic2D_DrawPixelNormal(xp + r – x,yp – r + h – 1 + y,c);
UB_Graphic2D_DrawPixelNormal(xp – r + w – 1 + x,yp + r – y,c);
UB_Graphic2D_DrawPixelNormal(xp + r – x,yp + r – y,c);
UB_Graphic2D_DrawPixelNormal(xp – r + w – 1 + y,yp – r + h – 1 + x,c);
UB_Graphic2D_DrawPixelNormal(xp + r – y,yp – r + h – 1 + x,c);
UB_Graphic2D_DrawPixelNormal(xp – r + w – 1 + y,yp + r – x,c);
UB_Graphic2D_DrawPixelNormal(xp + r – y,yp + r – x,c);
}
}
Für das abgerundete gefüllte Viereck wird zuänchst das “innere” gefüllte Rechteck gezeichnet. Für den Rest wird der “Bresenham Kreis” zum Zeichnen der Linien benutzt.
//--------------------------------------------------------------
// Zeichnet ein gefuelltes abgerundetes Rechteck mit einer Farbe
// Ecke = xp, yp [x = 0...LCD_MAXX, y = 0...LCD_MAXY]
// Breite = w
// Hoehe = h
// Radius = r
// Farbe = c
// Farbe der Umrandung = oc
//--------------------------------------------------------------
void UB_Graphic2D_DrawFullRoundedRectDMA(uint16_t xp, uint16_t yp, uint16_t w, uint16_t h, uint16_t r, COLOR_TYPE c, uint16_t oc)
{
int16_t f = 1 - r, ddF_x = 0, ddF_y = -2 * r, x = 0, y = r;
// check auf Limit
if (xp >= LCD_MAXX) xp = LCD_MAXX – 1;
if (yp >= LCD_MAXY) yp = LCD_MAXY – 1;
if (w == 0 || h == 0) return;
if (w < 2 * r || h w || 2 * r > h) r = h / 2;
// check auf Limit
if (r == 0)
{
// keine Rundung => zeichne normale Rechteck
UB_Graphic2D_DrawFullRectDMA(xp, yp, w, h, c, oc);
return;
}
// Zeichne inneres Rechteck
UB_Graphic2D_DrawFullRectDMA(xp, yp + r, w, h – 2 * r, c, c);
// Zeichne den Rest
while(x = 0)
{
y–;
ddF_y += 2;
f += ddF_y;
}
x++;
ddF_x += 2;
f += ddF_x + 1;
UB_Graphic2D_DrawStraightDMA(xp + r – x,yp – r + h – 1 + y,w – 1 – 2 * (r – x),LCD_DIR_HORIZONTAL,c);
UB_Graphic2D_DrawStraightDMA(xp + r – x,yp + r – y,w – 1 – 2 * (r – x),LCD_DIR_HORIZONTAL,c);
UB_Graphic2D_DrawStraightDMA(xp + r – y,yp – r + h – 1 + x,w – 1 – 2 * (r – y),LCD_DIR_HORIZONTAL,c);
UB_Graphic2D_DrawStraightDMA(xp + r – y,yp + r – x,w – 1 – 2 * (r – y),LCD_DIR_HORIZONTAL,c);
}
// Zeichne Außenlinie
UB_Graphic2D_DrawRoundedRectDMA(xp, yp, w, h, r, oc);
}
Looks good thanks. I’ll try it out and see if it’s more efficient than mine
BTW I just found an amazing font tool called LCD bitmap converter
It does proportional fonts as we’ll. the draw string functions get next char sub function on the website needs tweeting to work as the font data size is not defined by the generated code but is easy to add and the counter needs to be zeroed at the beginning of each width for loop. It doesn’t work otherwise. The font tool on this site is also great but the above program is a lot more comprehensive. I haven’t figured out how to do anti aliased fonts with it yet but it looks possible
I tried your code and there are a few weird parts that may have been messed up by this web site like
if (w h) r = h / 2;
hw?
and this part
while(x = 0)
{
y--;
ddF_y += 2;
f += ddF_y;
}
x++;
ddF_x += 2;
f += ddF_x + 1;
The result I get is more like a bevel or 45 degree corner than a radius
The code output on this website looks strange
the GT and LT signs cut some other signs, so the code seems useless with a lot of errors compared to my original
so unfortunately the code take does not work very good
I have modified the ub-libraries for RGB16, RGB24 and ARGB32 color modes and also added a lot of functions like flood fill, edge fill, ellipse, … but have not fond the time check them all
If I have, I will post the source
Is there a place to link Source or text files?
sorry, the code tags do not work correctly in wordpress. please send the sourcefiles per email and i will upload it here with a “untested” comment
Hello. I’m trying to use this example with STM32F405VG, this is possible? Some libraries isn’t available for this. Do you sugest some example to try to put this working?
try this lib
http://mikrocontroller.bplaced.net/wordpress/?page_id=507
i think the f405 dont have a ltdc controller
This library is used with a LCD with controller. I’m trying to use a LCD without controller, like this example for STM32F429Disco…
as i wrote the stm32f405 dont have a internal lcd controller (like the stm32f429) so you can’t connect a lcd directly. perhaps you can generate the signals with the cpu (two timers and the dma like in my vga lib) but this isnt a good way. use another lcd or another cpu.
Well, I’ll try another soluction. Thank you. Your sites helps me a lot
Hi again UB,
I would like to store some images in memory IS42S16400J.
How can I do this using this library?
Thanks Again!!
this library is only for “painting” an image (bmp, jpg, raw) on a display.
i dont understand your task. what sort of “image” and where they come from ?
In a RAM you can only store temporarily. So you need a ROM as source.
Now I saw that IS42S16400J is not ROM.
I am very beginner, loved their libraries, I’m doing a little game to play with my brother.
We are struggling to insert multiple images, the memory becomes full after a few images.
When we used the PIC18 microchip we used SD cards, but do not know how I could do with STM, if we insert Flash Memory or if we can use SD card.
Some personal suggestions?
Thanks again..
You can go both ways. Flash or SD-Card.
This Lib can draw JPG-Files. So you need only 15kByte
for a complete picture. The F429 has 2MByte Flash !!
is this enough ? If not, load the pictures from a 2GB Card.
Hi Uwe,
ich hab in der Funktion “UB_Graphic_DrawImage” einen Fehler entdeckt.
“UB_LCD_SetCursor2Draw(img->height+xpos-ypos-1,ypos);” müsste korrekterweise
“UB_LCD_SetCursor2Draw(img->height+xpos-1,ypos+yn);” heißen, ansonsten wird permanent die selbe Zeile überschrieben und das Bild wird nicht gezeichnet.
* Korrektur: die Funktion heißt eigentlich
UB_LCD_SetCursor2Draw(img->height+xpos-yn-1,ypos);