2017-11-23 20:42:14 +01:00
|
|
|
/**
|
|
|
|
* @file math_base.h
|
2018-06-18 13:52:14 +03:00
|
|
|
*
|
2017-11-23 20:42:14 +01:00
|
|
|
*/
|
|
|
|
|
2017-11-24 17:48:47 +01:00
|
|
|
#ifndef LV_MATH_H
|
|
|
|
#define LV_MATH_H
|
2017-11-23 20:42:14 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
2018-03-04 17:51:41 +01:00
|
|
|
#include <stdint.h>
|
2017-11-23 20:42:14 +01:00
|
|
|
|
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
|
|
|
|
2017-11-24 17:48:47 +01:00
|
|
|
#define LV_MATH_MIN(a,b) (a<b?a:b)
|
|
|
|
#define LV_MATH_MAX(a,b) (a>b?a:b)
|
|
|
|
#define LV_MATH_ABS(x) ((x)>0?(x):(-(x)))
|
2017-11-23 20:42:14 +01:00
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* GLOBAL PROTOTYPES
|
|
|
|
**********************/
|
2018-03-07 13:10:20 +01:00
|
|
|
/**
|
|
|
|
* Convert a number to string
|
|
|
|
* @param num a number
|
|
|
|
* @param buf pointer to a `char` buffer. The result will be stored here (max 10 elements)
|
|
|
|
* @return same as `buf` (just for convenience)
|
|
|
|
*/
|
|
|
|
char * lv_math_num_to_str(int32_t num, char * buf);
|
2017-11-23 20:42:14 +01:00
|
|
|
|
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|