lv_math.h

Defines

LV_TRIGO_SIN_MAX
LV_TRIGO_SHIFT

LV_TRIGO_SHIFT to normalize

LV_BEZIER_VAL_SHIFT

log2(LV_BEZIER_VAL_MAX): used to normalize up scaled values

LV_BEZIER_VAL_MAX

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

LV_BEZIER_VAL_FLOAT(f)

Convert const float number cubic-bezier values to fix-point value

LV_ALIGN_UP(x, align)
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

int32_t lv_cubic_bezier(int32_t x, int32_t x1, int32_t y1, int32_t x2, int32_t y2)

Calculate the y value of cubic-bezier(x1, y1, x2, y2) function as specified x.

参数:
  • x -- time in range of [0..LV_BEZIER_VAL_MAX]

  • x1 -- x of control point 1 in range of [0..LV_BEZIER_VAL_MAX]

  • y1 -- y of control point 1 in range of [0..LV_BEZIER_VAL_MAX]

  • x2 -- x of control point 2 in range of [0..LV_BEZIER_VAL_MAX]

  • y2 -- y of control point 2 in range of [0..LV_BEZIER_VAL_MAX]

返回:

the value calculated

static inline int32_t lv_bezier3(int32_t t, int32_t u0, uint32_t u1, int32_t u2, int32_t u3)

Calculate a value of a Cubic Bezier function.

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

  • u0 -- must be 0

  • 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 -- must be LV_BEZIER_VAL_MAX

返回:

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.

参数:
  • x --

  • y --

返回:

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.

参数:
  • base --

  • exp --

返回:

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

参数:
  • 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

返回:

the mapped number

void lv_rand_set_seed(uint32_t seed)

Set the seed of the pseudo random number generator

参数:

seed -- a number to initialize the random generator

uint32_t lv_rand(uint32_t min, uint32_t max)

Get a pseudo random number in the given range

参数:
  • min -- the minimum value

  • max -- the maximum value

返回:

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

struct lv_sqrt_res_t

Public Members

uint16_t i
uint16_t f