/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Draw an integer on LCD with circleOS

Username:     
Password:     
             

Forum

# 1   2011-05-09 15:29:52 Draw an integer on LCD with circleOS

Fimbulvetr
New member
Registered: 2011-03-29
Posts: 7

Draw an integer on LCD with circleOS

Hi Guys, I just want to draw some values etc with my primer2 using the method:
"DRAW_DisplayStringWithMode()"

so this method is only able to print char´s.

I tried to use  "void uint2str( u8* ptr , u32 X, u16 digit, s32 fillwithzero );", but it didn´t work.

Code:

char* alGrenze;
u32 wert = 123;
UTIL_uint2str(alGrenze, wert,5,0);
DRAW_DisplayStringWithMode( 95, 89, alGrenze, sizeof(alGrenze), NORMAL_TEXT, CENTER);

hope you can help smile

Offline

 

# 2   2011-05-10 08:25:22 Draw an integer on LCD with circleOS

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: Draw an integer on LCD with circleOS

You forgot to declare the string pointed by alGrenze, and sizeof(alGrenze) would not return what you expected !
Try with :

Code:

char alGrenze[10];

Offline

 

# 3   2011-05-10 09:30:36 Draw an integer on LCD with circleOS

Fimbulvetr
New member
Registered: 2011-03-29
Posts: 7

Re: Draw an integer on LCD with circleOS

thank you very much, now it works fine ^^

Offline

 

# 4   2011-09-20 07:30:42 Draw an integer on LCD with circleOS

Johnmayor
New member
Registered: 2011-09-20
Posts: 3

Re: Draw an integer on LCD with circleOS

2 Drawing a square
Next we are going to draw a small square in the center of the LCD display.
The display area is 128 X 128 pixels large (although the whole display is 160x128, but some display
area is reserved for application buttons).
Let's choose, for example, to draw a 32X32 square.
We need to add the following definition/declarations to the source code in Step1.c. They define the
size and location of the square on the screen. Place them near the top of the source code, in the
“Public variables” section:
#define  SQUARE_WIDTH 32
int x = ( SCREEN_WIDTH - SQUARE_WIDTH ) / 2;
int y = ( SCREEN_HEIGHT - SQUARE_WIDTH ) / 2;
As we want to draw the square only once we can add the drawing code into the Application_Ini()
function (remember, Application_ini() is only called once when the application starts).
In the box below you will see the source code that draws the square.
Copy this block of code into the function Application_Ini() function body, in the “step1.c” file (replace
the “TODO: Write your application initialization function here” by this code:
    //Draw my square
    LCD_DrawRect( x, y, SQUARE_WIDTH, SQUARE_WIDTH, RGB_BLUE);
    LCD_FillRect( x+1, y+1, SQUARE_WIDTH-2, SQUARE_WIDTH-2, RGB_YELLOW);
The first function LCD_DrawRect() will draw (in blue) the square periphery, and the second fills the
area inside the square (in yellow).
- 9 -CircleOS Tutorial for STM32-Primer2

__________________

website development services in bangalore

Offline

 

Board footer