lv_math.h

Defines

LV_TRIGO_SIN_MAX
LV_TRIGO_SHIFT

LV_TRIGO_SHIFT to normalize

LV_BEZIER_VAL_MAX

Max time in Bezier functions (not [0..1] to use integers)

LV_BEZIER_VAL_SHIFT

log2(LV_BEZIER_VAL_MAX): used to normalize up scaled values

LV_MIN(a, b)
LV_MIN3(a, b, c)
LV_MIN4(a, b, c, d)
LV_MAX(a, b)
LV_MAX3(a, b, c)
LV_MAX4(a, b, c, d)
LV_CLAMP(min, val, max)
LV_ABS(x)
LV_UDIV255(x)
LV_IS_SIGNED(t)
LV_UMAX_OF(t)
LV_SMAX_OF(t)
LV_MAX_OF(t)

Functions

uint32_t lv_bezier3(uint32_t t, uint32_t u0, uint32_t u1, uint32_t u2, uint32_t u3)

Calculate a value of a Cubic Bezier function.

Parameters:
  • t -- time in range of [0..LV_BEZIER_VAL_MAX]

  • u0 -- start values in range of [0..LV_BEZIER_VAL_MAX]

  • u1 -- control value 1 values in range of [0..LV_BEZIER_VAL_MAX]

  • u2 -- control value 2 in range of [0..LV_BEZIER_VAL_MAX]

  • u3 -- end values in range of [0..LV_BEZIER_VAL_MAX]

Returns:

the value calculated from the given parameters in range of [0..LV_BEZIER_VAL_MAX]

uint16_t lv_atan2(int x, int y)

Calculate the atan2 of a vector.

Parameters:
  • x --

  • y --

Returns:

the angle in degree calculated from the given parameters in range of [0..360]

int64_t lv_pow(int64_t base, int8_t exp)

Calculate the integer exponents.

Parameters:
  • base --

  • exp --

Returns:

base raised to the power exponent

int32_t lv_map(int32_t x, int32_t min_in, int32_t max_in, int32_t min_out, int32_t max_out)

Get the mapped of a number given an input and output range

Parameters:
  • x -- integer which mapped value should be calculated

  • min_in -- min input range

  • max_in -- max input range

  • min_out -- max output range

  • max_out -- max output range

Returns:

the mapped number

uint32_t lv_rand(uint32_t min, uint32_t max)

Get a pseudo random number in the given range

Parameters:
  • min -- the minimum value

  • max -- the maximum value

Returns:

return the random number. min <= return_value <= max

struct lv_sqrt_res_t

Public Members

uint16_t i
uint16_t f