Update the function documentation in the header files
This commit is contained in:
@@ -51,12 +51,43 @@ typedef struct
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Init. the animation module
|
||||
*/
|
||||
void anim_init(void);
|
||||
|
||||
/**
|
||||
* Create an animation
|
||||
* @param anim_p an initialized 'anim_t' variable. Not required after call.
|
||||
*/
|
||||
void anim_create(anim_t * anim_p);
|
||||
anim_path_t * anim_get_path(anim_path_name_t type);
|
||||
|
||||
/**
|
||||
* Delete an animation for a variable with a given animatior function
|
||||
* @param var pointer to variable
|
||||
* @param fp a function pointer which is animating 'var',
|
||||
* or NULL to ignore it and delete all animation with 'var
|
||||
* @return true: at least 1 animation is deleted, false: no animation is deleted
|
||||
*/
|
||||
bool anim_del(void * var, anim_fp_t fp);
|
||||
|
||||
/**
|
||||
* Calculate the time of an animation with a given speed and the start and end values
|
||||
* @param speed speed of animation in unit/sec
|
||||
* @param start start value of the animation
|
||||
* @param end end value of the animation
|
||||
* @return the required time [ms] for the animation with the given parameters
|
||||
*/
|
||||
uint16_t anim_speed_to_time(uint16_t speed, int32_t start, int32_t end);
|
||||
|
||||
/**
|
||||
* Get a predefine animation path
|
||||
* @param name name of the path from 'anim_path_name_t'
|
||||
* @return pointer to the path array
|
||||
*/
|
||||
anim_path_t * anim_get_path(anim_path_name_t name);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -49,16 +49,32 @@ void area_set(area_t * area_p, cord_t x1, cord_t y1, cord_t x2, cord_t y2)
|
||||
area_p->y2 = y2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the width of an area
|
||||
* @param area_p pointer to an area
|
||||
* @param w the new width of the area (w == 1 makes x1 == x2)
|
||||
*/
|
||||
void area_set_width(area_t * area_p, cord_t w)
|
||||
{
|
||||
area_p->x2 = area_p->x1 + w - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the height of an area
|
||||
* @param area_p pointer to an area
|
||||
* @param h the new height of the area (h == 1 makes y1 == y2)
|
||||
*/
|
||||
void area_set_height(area_t * area_p, cord_t h)
|
||||
{
|
||||
area_p->y2 = area_p->y1 + h - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the position of an area (width and height will be kept)
|
||||
* @param area_p pointer to an area
|
||||
* @param x the new x coordinate of the area
|
||||
* @param y the new y coordinate of the area
|
||||
*/
|
||||
void area_set_pos(area_t * area_p, cord_t x, cord_t y)
|
||||
{
|
||||
cord_t w = area_get_width(area_p);
|
||||
@@ -146,7 +162,8 @@ bool area_is_point_on(const area_t * a_p, const point_t * p_p)
|
||||
* Check if two area has common parts
|
||||
* @param a1_p pointer to an area.
|
||||
* @param a2_p pointer to an other area
|
||||
* @return false: a1_p and a2_p has no common parts */
|
||||
* @return false: a1_p and a2_p has no common parts
|
||||
*/
|
||||
bool area_is_on(const area_t * a1_p, const area_t * a2_p)
|
||||
{
|
||||
/*Two area are on each other if... */
|
||||
|
||||
@@ -41,31 +41,115 @@ typedef struct
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize an area
|
||||
* @param area_p pointer to an area
|
||||
* @param x1 left coordinate of the area
|
||||
* @param y1 top coordinate of the area
|
||||
* @param x2 right coordinate of the area
|
||||
* @param y2 bottom coordinate of the area
|
||||
*/
|
||||
void area_set(area_t * area_p, cord_t x1, cord_t y1, cord_t x2, cord_t y2);
|
||||
|
||||
/**
|
||||
* Copy an area
|
||||
* @param dest pointer to the destination area
|
||||
* @param src pointer to the source area
|
||||
*/
|
||||
static void inline area_cpy(area_t * dest, const area_t * src)
|
||||
{
|
||||
memcpy(dest, src, sizeof(area_t));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the width of an area
|
||||
* @param area_p pointer to an area
|
||||
* @return the width of the area (if x1 == x2 -> width = 1)
|
||||
*/
|
||||
static inline cord_t area_get_width(const area_t * area_p)
|
||||
{
|
||||
return area_p->x2 - area_p->x1 + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the height of an area
|
||||
* @param area_p pointer to an area
|
||||
* @return the height of the area (if y1 == y2 -> height = 1)
|
||||
*/
|
||||
static inline cord_t area_get_height(const area_t * area_p)
|
||||
{
|
||||
return area_p->y2 - area_p->y1 + 1;
|
||||
}
|
||||
|
||||
void area_set(area_t * area_p, cord_t x1, cord_t y1, cord_t x2, cord_t y2);
|
||||
/**
|
||||
* Set the width of an area
|
||||
* @param area_p pointer to an area
|
||||
* @param w the new width of the area (w == 1 makes x1 == x2)
|
||||
*/
|
||||
void area_set_width(area_t * area_p, cord_t w);
|
||||
|
||||
/**
|
||||
* Set the height of an area
|
||||
* @param area_p pointer to an area
|
||||
* @param h the new height of the area (h == 1 makes y1 == y2)
|
||||
*/
|
||||
void area_set_height(area_t * area_p, cord_t h);
|
||||
|
||||
/**
|
||||
* Set the position of an area (width and height will be kept)
|
||||
* @param area_p pointer to an area
|
||||
* @param x the new x coordinate of the area
|
||||
* @param y the new y coordinate of the area
|
||||
*/
|
||||
void area_set_pos(area_t * area_p, cord_t x, cord_t y);
|
||||
|
||||
/**
|
||||
* Return with area of an area (x * y)
|
||||
* @param area_p pointer to an area
|
||||
* @return size of area
|
||||
*/
|
||||
uint32_t area_get_size(const area_t * area_p);
|
||||
|
||||
/**
|
||||
* Get the common parts of two areas
|
||||
* @param res_p pointer to an area, the result will be stored her
|
||||
* @param a1_p pointer to the first area
|
||||
* @param a2_p pointer to the second area
|
||||
* @return false: the two area has NO common parts, res_p is invalid
|
||||
*/
|
||||
bool area_union(area_t * res_p, const area_t * a1_p, const area_t * a2_p);
|
||||
|
||||
/**
|
||||
* Join two areas into a third which involves the other two
|
||||
* @param res_p pointer to an area, the result will be stored here
|
||||
* @param a1_p pointer to the first area
|
||||
* @param a2_p pointer to the second area
|
||||
*/
|
||||
void area_join(area_t * a_res_p, const area_t * a1_p, const area_t * a2_p);
|
||||
|
||||
/**
|
||||
* Check if a point is on an area
|
||||
* @param a_p pointer to an area
|
||||
* @param p_p pointer to a point
|
||||
* @return false:the point is out of the area
|
||||
*/
|
||||
bool area_is_point_on(const area_t * a_p, const point_t * p_p);
|
||||
|
||||
/**
|
||||
* Check if two area has common parts
|
||||
* @param a1_p pointer to an area.
|
||||
* @param a2_p pointer to an other area
|
||||
* @return false: a1_p and a2_p has no common parts
|
||||
*/
|
||||
bool area_is_on(const area_t * a1_p, const area_t * a2_p);
|
||||
bool area_is_in(const area_t * a_in, const area_t * a_holder);
|
||||
|
||||
/**
|
||||
* Check if an area is fully on an other
|
||||
* @param ain_p pointer to an area which could be on aholder_p
|
||||
* @param aholder pointer to an area which could involve ain_p
|
||||
* @return
|
||||
*/
|
||||
bool area_is_in(const area_t * ain_p, const area_t * aholder_p);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -40,8 +40,27 @@
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the circle drawing
|
||||
* @param c pointer to a point. The coordinates will be calculated here
|
||||
* @param tmp point to a variable. It will store temporary data
|
||||
* @param radius radius of the circle
|
||||
*/
|
||||
void circ_init(point_t * c, cord_t * tmp, cord_t radius);
|
||||
|
||||
/**
|
||||
* Test the circle drawing is ready or not
|
||||
* @param c same as in circ_init
|
||||
* @return true if the circle is not ready yet
|
||||
*/
|
||||
bool circ_cont(point_t * c);
|
||||
|
||||
/**
|
||||
* Get the next point from the circle
|
||||
* @param c same as in circ_init. The next point stored here.
|
||||
* @param tmp same as in circ_init.
|
||||
*/
|
||||
void circ_next(point_t * c, cord_t * tmp);
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -107,6 +107,40 @@ const font_t * font_get(font_types_t font_id)
|
||||
return font_p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return with the bitmap of a font.
|
||||
* @param font_p pointer to a font
|
||||
* @param letter a letter
|
||||
* @return pointer to the bitmap of the letter
|
||||
*/
|
||||
const uint8_t * font_get_bitmap(const font_t * font_p, uint8_t letter)
|
||||
{
|
||||
if(letter < font_p->start_ascii || letter >= font_p->start_ascii + font_p->letter_cnt) return NULL;
|
||||
|
||||
uint32_t index = (letter - font_p->start_ascii) * font_p->height_row * font_p->width_byte;
|
||||
return &font_p->bitmaps_a[index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the width of a letter in a font
|
||||
* @param font_p pointer to a font
|
||||
* @param letter a letter
|
||||
* @return the width of a letter
|
||||
*/
|
||||
uint8_t font_get_width(const font_t * font_p, uint8_t letter)
|
||||
{
|
||||
if(letter < font_p->start_ascii) return 0;
|
||||
|
||||
letter -= font_p->start_ascii;
|
||||
uint8_t w = 0;
|
||||
if(letter < font_p->letter_cnt) {
|
||||
w = font_p->fixed_width != 0 ? font_p->fixed_width :
|
||||
font_p->width_bit_a[letter];
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
@@ -64,25 +64,22 @@ typedef struct
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
const font_t * font_get(font_types_t letter);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Return with the bitmap of a font.
|
||||
* Get the font from its id
|
||||
* @param font_id: the id of a font (an element of font_types_t enum)
|
||||
* @return pointer to a font descriptor
|
||||
*/
|
||||
const font_t * font_get(font_types_t font_id);
|
||||
|
||||
|
||||
/**
|
||||
* Return with the bitmap of a font.
|
||||
* @param font_p pointer to a font
|
||||
* @param letter a letter
|
||||
* @return pointer to the bitmap of the letter
|
||||
*/
|
||||
static inline const uint8_t * font_get_bitmap(const font_t * font_p, uint8_t letter)
|
||||
{
|
||||
if(letter < font_p->start_ascii || letter >= font_p->start_ascii + font_p->letter_cnt) return NULL;
|
||||
|
||||
uint32_t index = (letter - font_p->start_ascii) * font_p->height_row * font_p->width_byte;
|
||||
return &font_p->bitmaps_a[index];
|
||||
}
|
||||
const uint8_t * font_get_bitmap(const font_t * font_p, uint8_t letter);
|
||||
|
||||
/**
|
||||
* Get the height of a font
|
||||
@@ -94,24 +91,19 @@ static inline uint8_t font_get_height(const font_t * font_p)
|
||||
return font_p->height_row;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the width of a letter in a font
|
||||
* @param font_p pointer to a font
|
||||
* @param letter a letter
|
||||
* @return the width of a letter
|
||||
*/
|
||||
static inline uint8_t font_get_width(const font_t * font_p, uint8_t letter)
|
||||
{
|
||||
if(letter < font_p->start_ascii) return 0;
|
||||
|
||||
letter -= font_p->start_ascii;
|
||||
uint8_t w = 0;
|
||||
if(letter < font_p->letter_cnt) {
|
||||
w = font_p->fixed_width != 0 ? font_p->fixed_width :
|
||||
font_p->width_bit_a[letter];
|
||||
}
|
||||
uint8_t font_get_width(const font_t * font_p, uint8_t letter);
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -35,6 +35,15 @@ static bool txt_is_break_char(char letter);
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Get size of a text
|
||||
* @param size_res pointer to a 'point_t' variable to store the result
|
||||
* @param text pointer to a text
|
||||
* @param font pinter to font of the text
|
||||
* @param letter_space letter space of the text
|
||||
* @param line_space line space of the text
|
||||
* @param max_width max with of the text (break the lines to fit this size) Set LV_CORD_MAX to avoid line breaks
|
||||
*/
|
||||
void txt_get_size(point_t * size_res, const char * text, const font_t * font,
|
||||
uint16_t letter_space, uint16_t line_space, cord_t max_width)
|
||||
{
|
||||
|
||||
@@ -26,10 +26,40 @@
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Get size of a text
|
||||
* @param size_res pointer to a 'point_t' variable to store the result
|
||||
* @param text pointer to a text
|
||||
* @param font pinter to font of the text
|
||||
* @param letter_space letter space of the text
|
||||
* @param line_space line space of the text
|
||||
* @param max_width max with of the text (break the lines to fit this size) Set LV_CORD_MAX to avoid line breaks
|
||||
*/
|
||||
void txt_get_size(point_t * size_res, const char * text, const font_t * font,
|
||||
uint16_t letter_space, uint16_t line_space, cord_t max_width);
|
||||
uint16_t txt_get_next_line(const char * txt, const font_t * font_p, uint16_t letter_space, cord_t max_l);
|
||||
cord_t txt_get_width(const char * txt, uint16_t char_num, const font_t * font_p, uint16_t letter_space);
|
||||
uint16_t letter_space, uint16_t line_space, cord_t max_width);
|
||||
|
||||
/**
|
||||
* Get the next line of text. Check line length and break chars too.
|
||||
* @param txt a '\0' terminated string
|
||||
* @param font_p pointer to a font
|
||||
* @param letter_space letter space
|
||||
* @param max_l max line length
|
||||
* @return the index of the first char of the new line
|
||||
*/
|
||||
uint16_t txt_get_next_line(const char * txt, const font_t * font_p,
|
||||
uint16_t letter_space, cord_t max_l);
|
||||
|
||||
/**
|
||||
* Give the length of a text with a given font
|
||||
* @param txt a '\0' terminate string
|
||||
* @param char_num number of characters in 'txt'
|
||||
* @param font_p pointer to a font
|
||||
* @param letter_space letter sapce
|
||||
* @return length of a char_num long text
|
||||
*/
|
||||
cord_t txt_get_width(const char * txt, uint16_t char_num,
|
||||
const font_t * font_p, uint16_t letter_space);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
Reference in New Issue
Block a user