lv_math.h 882 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * @file math_base.h
  3. *
  4. */
  5. #ifndef LV_MATH_H
  6. #define LV_MATH_H
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. /*********************
  11. * INCLUDES
  12. *********************/
  13. #include <stdint.h>
  14. /*********************
  15. * DEFINES
  16. *********************/
  17. #define LV_MATH_MIN(a,b) (a<b?a:b)
  18. #define LV_MATH_MAX(a,b) (a>b?a:b)
  19. #define LV_MATH_ABS(x) ((x)>0?(x):(-(x)))
  20. /**********************
  21. * TYPEDEFS
  22. **********************/
  23. /**********************
  24. * GLOBAL PROTOTYPES
  25. **********************/
  26. /**
  27. * Convert a number to string
  28. * @param num a number
  29. * @param buf pointer to a `char` buffer. The result will be stored here (max 10 elements)
  30. * @return same as `buf` (just for convenience)
  31. */
  32. char * lv_math_num_to_str(int32_t num, char * buf);
  33. /**********************
  34. * MACROS
  35. **********************/
  36. #ifdef __cplusplus
  37. } /* extern "C" */
  38. #endif
  39. #endif