/**1* @file math_base.h2*3*/45#ifndef LV_MATH_H6#define LV_MATH_H78#ifdef __cplusplus9extern "C" {10#endif111213/*********************14* INCLUDES15*********************/16#include <stdint.h>1718/*********************19* DEFINES20*********************/21#define LV_MATH_MIN(a,b) ((a) < (b) ? (a) : (b))22#define LV_MATH_MAX(a,b) ((a) > (b) ? (a) : (b))23#define LV_MATH_ABS(x) ((x) > 0 ? (x) : (-(x)))2425#define LV_TRIGO_SIN_MAX 3276726#define LV_TRIGO_SHIFT 15 /* >> LV_TRIGO_SHIFT to normalize*/2728#define LV_BEZIER_VAL_MAX 1024 /*Max time in Bezier functions (not [0..1] to use integers) */29#define LV_BEZIER_VAL_SHIFT 10 /*log2(LV_BEZIER_VAL_MAX): used to normalize up scaled values*/3031/**********************32* TYPEDEFS33**********************/3435/**********************36* GLOBAL PROTOTYPES37**********************/38/**39* Convert a number to string40* @param num a number41* @param buf pointer to a `char` buffer. The result will be stored here (max 10 elements)42* @return same as `buf` (just for convenience)43*/44char * lv_math_num_to_str(int32_t num, char * buf);4546/**47* Return with sinus of an angle48* @param angle49* @return sinus of 'angle'. sin(-90) = -32767, sin(90) = 3276750*/51int16_t lv_trigo_sin(int16_t angle);5253/**54* Calculate a value of a Cubic Bezier function.55* @param t time in range of [0..LV_BEZIER_VAL_MAX]56* @param u0 start values in range of [0..LV_BEZIER_VAL_MAX]57* @param u1 control value 1 values in range of [0..LV_BEZIER_VAL_MAX]58* @param u2 control value 2 in range of [0..LV_BEZIER_VAL_MAX]59* @param u3 end values in range of [0..LV_BEZIER_VAL_MAX]60* @return the value calculated from the given parameters in range of [0..LV_BEZIER_VAL_MAX]61*/62int32_t lv_bezier3(uint32_t t, int32_t u0, int32_t u1, int32_t u2, int32_t u3);6364/**********************65* MACROS66**********************/6768#ifdef __cplusplus69} /* extern "C" */70#endif7172#endif737475