draw.c File Reference

Various utilities for drawings (characters, ..). More...


Defines

#define abs(X)   ( ( (X) < 0 ) ? -(X) : (X) )
#define sgn(X)   ( ( (X) < 0 ) ? -1 : 1 )

Functions

void DRAW_SetCharMagniCoeff (u16 Coeff)
u16 DRAW_GetCharMagniCoeff (void)
u16 DRAW_GetTextColor (void)
void DRAW_SetTextColor (u16 Color)
u16 DRAW_GetBGndColor (void)
void DRAW_SetBGndColor (u16 Color)
void DRAW_Clear (void)
void DRAW_SetLogoBW (void)
void DRAW_SetImage (const u16 *imageptr, u8 x, u8 y, u8 width, u8 height)
 Draw a color bitmap at the provided coordinates.
void DRAW_SetImageBW (const u8 *imageptr, u8 x, u8 y, u8 width, u8 height)
 Draw a monochrome bitmap at the provided coordinates.
void DRAW_DisplayVbat (u8 x, u8 y)
void DRAW_DisplayTime (u8 x, u8 y)
void DRAW_DisplayString (u8 x, u8 y, const u8 *ptr, u8 len)
void DRAW_DisplayStringInverted (u8 x, u8 y, const u8 *ptr, u8 len)
void DRAW_SetDefaultColor (void)
void DRAW_DisplayTemp (u8 x, u8 y)
void DRAW_Line (s16 x1, s16 y1, s16 x2, s16 y2, u16 color)


Detailed Description

Author:
FL

IB

Date:
07/2007

Define Documentation

#define abs (  )     ( ( (X) < 0 ) ? -(X) : (X) )

#define sgn (  )     ( ( (X) < 0 ) ? -1 : 1 )


Function Documentation

void DRAW_Clear ( void   ) 

Clear the LCD display. Draw Batterie and butterfly if main display.

void DRAW_DisplayString ( u8  x,
u8  y,
const u8 *  ptr,
u8  len 
)

This function is used to display a 17 character max string of characters on the LCD display at the provided coordinates.

Parameters:
[in] x The horizontal coordinate of the displayed string.
[in] y The vertical coordinate of the display string.
[in] *ptr Pointer to the string to display on LCD.
[in] len String length.
Warning:
The (0x0) point in on the low left corner.

void DRAW_DisplayStringInverted ( u8  x,
u8  y,
const u8 *  ptr,
u8  len 
)

This function is used to display a 17 character max string of characters on the LCD display at the provided coordinates with inverted colors.

Parameters:
[in] x The horizontal coordinate of the displayed string.
[in] y The vertical coordinate of the display string.
[in] *ptr Pointer to the string to display on LCD.
[in] len String length.
Warning:
The (0x0) point in on the low left corner.

void DRAW_DisplayTemp ( u8  x,
u8  y 
)

This function is used to display the current temperature in ascii. The choice between Celcius and Fahrenheit is fixed by UTIL_SetModeTemp()

Parameters:
[in] x The horizontal coordinate of the displayed string.
[in] y The vertical coordinate of the display string.
Warning:
The (0x0) point in on the low left corner.

void DRAW_DisplayTime ( u8  x,
u8  y 
)

This function is used to display time in ascii on the first line of LCD

Parameters:
[in] x The horizontal coordinate of the displayed string.
[in] y The vertical coordinate of the display string.
Warning:
The (0x0) point in on the low left corner.

void DRAW_DisplayVbat ( u8  x,
u8  y 
)

This function is used to display vbat in ascii

Parameters:
[in] x The horizontal coordinate of the displayed string.
[in] y The vertical coordinate of the display string.
Warning:
The (0x0) point in on the low left corner.

u16 DRAW_GetBGndColor ( void   ) 

Return current background color.

Returns:
The current RGB color used for the background.

u16 DRAW_GetCharMagniCoeff ( void   ) 

Return the current magnifying value for the characters

Returns:
Current magnifying value.

u16 DRAW_GetTextColor ( void   ) 

Return current text color.

Returns:
The current RGB color used to draw text.

void DRAW_Line ( s16  x1,
s16  y1,
s16  x2,
s16  y2,
u16  color 
)

Draw a line on the LCD screen. Optimized for horizontal/vertical lines, and use the Bresenham algorithm for other cases.

Parameters:
[in] x1 The x-coordinate of the first line endpoint.
[in] x2 The x-coordinate of the second line endpoint.
[in] y1 The y-coordinate of the first line endpoint.
[in] y2 The y-coordinate of the second line endpoint.
[in] color The line color.

void DRAW_SetBGndColor ( u16  Color  ) 

Set current background color

Parameters:
[in] Color The new RGB color for background.

void DRAW_SetCharMagniCoeff ( u16  Coeff  ) 

Set the magnifying value for the characters (should be 1 or 2)

Parameters:
[in] Coeff The new magnifying coefficent.

void DRAW_SetDefaultColor ( void   ) 

Reset text and background colors to their default values.

void DRAW_SetImage ( const u16 *  imageptr,
u8  x,
u8  y,
u8  width,
u8  height 
)

The provided bitmap is made width * height 2 byte words. Each 2 byte word contains the RGB color of a pixel.

Parameters:
[in] imageptr A pointer to an array of width * height 2 byte words.
[in] x The horizontal coordinate of the low left corner of the bitmap.
[in] y The vertical coordinate of the low left corner of the bitmap.
[in] width The bitmap width.
[in] height The bitmap height.
Warning:
The (0x0) point in on the low left corner.

void DRAW_SetImageBW ( const u8 *  imageptr,
u8  x,
u8  y,
u8  width,
u8  height 
)

The provided bitmap is made of width * height bits where a set bit means a pixel drawn in the current text color, whereas an unset bit means a pixel drawn in the current background color.

Parameters:
[in] imageptr A pointer to an array of width * height bits.
[in] x The horizontal coordinate of the low left corner of the bitmap.
[in] y The vertical coordinate of the low left corner of the bitmap.
[in] width The bitmap width.
[in] height The bitmap height.
Warning:
The (0x0) point in on the low left corner.

void DRAW_SetLogoBW ( void   ) 

Draw the butterfly logo

void DRAW_SetTextColor ( u16  Color  ) 

Set current text color.

Parameters:
[in] Color The new RGB color used when drawing text.