mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
fix(misc): correct the comment and coding style (#2096)
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
parent
02efef12db
commit
2aacbd5ddd
@ -109,7 +109,7 @@ typedef uint8_t lv_img_cf_t;
|
||||
#if LV_BIG_ENDIAN_SYSTEM
|
||||
typedef struct {
|
||||
|
||||
uint32_t h : 11; /*Height of the image map*/
|
||||
uint32_t h : 11; /*Height of the image map*/
|
||||
uint32_t w : 11; /*Width of the image map*/
|
||||
uint32_t reserved : 2; /*Reserved to be used later*/
|
||||
uint32_t always_zero : 3; /*It the upper bits of the first byte. Always zero to look like a
|
||||
@ -127,7 +127,7 @@ typedef struct {
|
||||
uint32_t reserved : 2; /*Reserved to be used later*/
|
||||
|
||||
uint32_t w : 11; /*Width of the image map*/
|
||||
uint32_t h : 11; /*Height of the image map*/
|
||||
uint32_t h : 11; /*Height of the image map*/
|
||||
} lv_img_header_t;
|
||||
#endif
|
||||
|
||||
|
@ -133,7 +133,7 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, lv_co
|
||||
|
||||
lv_img_decoder_t * d;
|
||||
_LV_LL_READ(&LV_GC_ROOT(_lv_img_decoder_ll), d) {
|
||||
/*Info an Open callbacks are required*/
|
||||
/*Info and Open callbacks are required*/
|
||||
if(d->info_cb == NULL || d->open_cb == NULL) continue;
|
||||
|
||||
res = d->info_cb(d, src, &dsc->header);
|
||||
|
@ -71,7 +71,7 @@ typedef struct _lv_font_struct {
|
||||
|
||||
void * dsc; /**< Store implementation specific or run_time data or caching here*/
|
||||
#if LV_USE_USER_DATA
|
||||
void * user_data; /**< Custom user data for font. */
|
||||
void * user_data; /**< Custom user data for font. */
|
||||
#endif
|
||||
|
||||
} lv_font_t;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "../lv_hal/lv_hal_tick.h"
|
||||
#include "lv_timer.h"
|
||||
#include "lv_math.h"
|
||||
#include "lv_mem.h"
|
||||
#include "lv_gc.h"
|
||||
|
||||
/*********************
|
||||
@ -92,7 +93,8 @@ void lv_anim_init(lv_anim_t * a)
|
||||
void lv_anim_start(lv_anim_t * a)
|
||||
{
|
||||
TRACE_ANIM("begin");
|
||||
/* Do not let two animations for the same 'var' with the same 'fp'*/
|
||||
/* Do not let two animations for the same 'var' with the same 'fp'*/
|
||||
|
||||
if(a->exec_cb != NULL) lv_anim_del(a->var, a->exec_cb); /*fp == NULL would delete all animations of var*/
|
||||
|
||||
/*If the list is empty the anim task was suspended and it's last run measure is invalid*/
|
||||
|
@ -15,7 +15,6 @@ extern "C" {
|
||||
*********************/
|
||||
#include "../lv_conf_internal.h"
|
||||
|
||||
#include "lv_area.h"
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
@ -431,7 +430,6 @@ extern const lv_anim_path_t lv_anim_path_def;
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
@ -41,7 +41,6 @@ extern "C" {
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
||||
#define LV_ASSERT_MSG(expr, msg) \
|
||||
do { \
|
||||
if(!(expr)) { \
|
||||
@ -50,8 +49,6 @@ extern "C" {
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
||||
|
||||
/*-----------------
|
||||
* ASSERTS
|
||||
*-----------------*/
|
||||
|
@ -19,7 +19,7 @@ extern "C" {
|
||||
|
||||
/*Error checking*/
|
||||
#if LV_COLOR_DEPTH == 24
|
||||
#error "LV_COLOR_DEPTH 24 is deprecated. Use LV_COLOR_DEPTH 32 instead (lv_conf.h)"
|
||||
#error "LV_COLOR_DEPTH 24 is deprecated. Use LV_COLOR_DEPTH 32 instead (lv_conf.h)"
|
||||
#endif
|
||||
|
||||
#if LV_COLOR_DEPTH != 32 && LV_COLOR_SCREEN_TRANSP != 0
|
||||
@ -115,7 +115,7 @@ enum {
|
||||
#endif
|
||||
|
||||
/*---------------------------------------
|
||||
* Macros for all existing color depths
|
||||
* Macros for all existing color depths
|
||||
* to set/get values of the color channels
|
||||
*------------------------------------------*/
|
||||
# define LV_COLOR_SET_R1(c, v) (c).ch.red = (uint8_t)((v) & 0x1)
|
||||
@ -200,7 +200,6 @@ enum {
|
||||
#define _LV_COLOR_ZERO_INITIALIZER LV_CONCAT(_LV_COLOR_ZERO_INITIALIZER, LV_COLOR_DEPTH)
|
||||
#define LV_COLOR_MAKE(r8, g8, b8) LV_CONCAT(LV_COLOR_MAKE, LV_COLOR_DEPTH)(r8, g8, b8)
|
||||
|
||||
|
||||
#define LV_UDIV255(x) ((uint32_t)((uint32_t) (x) * 0x8081) >> 0x17)
|
||||
|
||||
/**********************
|
||||
@ -353,15 +352,15 @@ static inline uint8_t lv_color_to8(lv_color_t color)
|
||||
return color.full;
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
lv_color8_t ret;
|
||||
LV_COLOR_SET_R8(ret, LV_COLOR_GET_R(color) >> 2); /* 5 - 3 = 2*/
|
||||
LV_COLOR_SET_R8(ret, LV_COLOR_GET_R(color) >> 2); /* 5 - 3 = 2*/
|
||||
LV_COLOR_SET_G8(ret, LV_COLOR_GET_G(color) >> 3); /* 6 - 3 = 3*/
|
||||
LV_COLOR_SET_B8(ret, LV_COLOR_GET_B(color) >> 3); /* 5 - 2 = 3*/
|
||||
LV_COLOR_SET_B8(ret, LV_COLOR_GET_B(color) >> 3); /* 5 - 2 = 3*/
|
||||
return ret.full;
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
lv_color8_t ret;
|
||||
LV_COLOR_SET_R8(ret, LV_COLOR_GET_R(color) >> 5); /* 8 - 3 = 5*/
|
||||
LV_COLOR_SET_R8(ret, LV_COLOR_GET_R(color) >> 5); /* 8 - 3 = 5*/
|
||||
LV_COLOR_SET_G8(ret, LV_COLOR_GET_G(color) >> 5); /* 8 - 3 = 5*/
|
||||
LV_COLOR_SET_B8(ret, LV_COLOR_GET_B(color) >> 6); /* 8 - 2 = 6*/
|
||||
LV_COLOR_SET_B8(ret, LV_COLOR_GET_B(color) >> 6); /* 8 - 2 = 6*/
|
||||
return ret.full;
|
||||
#endif
|
||||
}
|
||||
@ -375,17 +374,17 @@ static inline uint16_t lv_color_to16(lv_color_t color)
|
||||
return 0xFFFF;
|
||||
#elif LV_COLOR_DEPTH == 8
|
||||
lv_color16_t ret;
|
||||
LV_COLOR_SET_R16(ret, LV_COLOR_GET_R(color) * 4); /*(2^5 - 1)/(2^3 - 1) = 31/7 = 4*/
|
||||
LV_COLOR_SET_G16(ret, LV_COLOR_GET_G(color) * 9); /*(2^6 - 1)/(2^3 - 1) = 63/7 = 9*/
|
||||
LV_COLOR_SET_B16(ret, LV_COLOR_GET_B(color) * 10); /*(2^5 - 1)/(2^2 - 1) = 31/3 = 10*/
|
||||
LV_COLOR_SET_R16(ret, LV_COLOR_GET_R(color) * 4); /*(2^5 - 1)/(2^3 - 1) = 31/7 = 4*/
|
||||
LV_COLOR_SET_G16(ret, LV_COLOR_GET_G(color) * 9); /*(2^6 - 1)/(2^3 - 1) = 63/7 = 9*/
|
||||
LV_COLOR_SET_B16(ret, LV_COLOR_GET_B(color) * 10); /*(2^5 - 1)/(2^2 - 1) = 31/3 = 10*/
|
||||
return ret.full;
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
return color.full;
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
lv_color16_t ret;
|
||||
LV_COLOR_SET_R16(ret, LV_COLOR_GET_R(color) >> 3); /* 8 - 5 = 3*/
|
||||
LV_COLOR_SET_R16(ret, LV_COLOR_GET_R(color) >> 3); /* 8 - 5 = 3*/
|
||||
LV_COLOR_SET_G16(ret, LV_COLOR_GET_G(color) >> 2); /* 8 - 6 = 2*/
|
||||
LV_COLOR_SET_B16(ret, LV_COLOR_GET_B(color) >> 3); /* 8 - 5 = 3*/
|
||||
LV_COLOR_SET_B16(ret, LV_COLOR_GET_B(color) >> 3); /* 8 - 5 = 3*/
|
||||
return ret.full;
|
||||
#endif
|
||||
}
|
||||
@ -399,9 +398,9 @@ static inline uint32_t lv_color_to32(lv_color_t color)
|
||||
return 0xFFFFFFFF;
|
||||
#elif LV_COLOR_DEPTH == 8
|
||||
lv_color32_t ret;
|
||||
LV_COLOR_SET_R32(ret, LV_COLOR_GET_R(color) * 36); /*(2^8 - 1)/(2^3 - 1) = 255/7 = 36*/
|
||||
LV_COLOR_SET_R32(ret, LV_COLOR_GET_R(color) * 36); /*(2^8 - 1)/(2^3 - 1) = 255/7 = 36*/
|
||||
LV_COLOR_SET_G32(ret, LV_COLOR_GET_G(color) * 36); /*(2^8 - 1)/(2^3 - 1) = 255/7 = 36*/
|
||||
LV_COLOR_SET_B32(ret, LV_COLOR_GET_B(color) * 85); /*(2^8 - 1)/(2^2 - 1) = 255/3 = 85*/
|
||||
LV_COLOR_SET_B32(ret, LV_COLOR_GET_B(color) * 85); /*(2^8 - 1)/(2^2 - 1) = 255/3 = 85*/
|
||||
LV_COLOR_SET_A32(ret, 0xFF);
|
||||
return ret.full;
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
@ -573,7 +572,7 @@ LV_ATTRIBUTE_FAST_MEM static inline void lv_color_mix_with_alpha(lv_color_t bg_c
|
||||
;
|
||||
}
|
||||
lv_opa_t ratio = (uint16_t)((uint16_t)fg_opa * 255) / res_opa_saved;
|
||||
res_color_saved = lv_color_mix(fg_color, bg_color, ratio);
|
||||
res_color_saved = lv_color_mix(fg_color, bg_color, ratio);
|
||||
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ void * lv_fs_open(const char * path, lv_fs_mode_t mode);
|
||||
/**
|
||||
* Close an already opened file
|
||||
* @param file_p pointer to a lv_fs_file_t variable
|
||||
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
|
||||
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
|
||||
*/
|
||||
lv_fs_res_t lv_fs_close(lv_fs_file_t * file_p);
|
||||
|
||||
|
@ -169,7 +169,7 @@ void _lv_ll_remove(lv_ll_t * ll_p, void * node_p)
|
||||
}
|
||||
}
|
||||
else if(_lv_ll_get_tail(ll_p) == node_p) {
|
||||
/*The new tail will be the node before 'n_act'*/
|
||||
/*The new tail will be the node before 'n_act'*/
|
||||
ll_p->tail = _lv_ll_get_prev(ll_p, node_p);
|
||||
if(ll_p->tail == NULL) {
|
||||
ll_p->head = NULL;
|
||||
@ -272,6 +272,7 @@ void * _lv_ll_get_tail(const lv_ll_t * ll_p)
|
||||
if(ll_p == NULL) return NULL;
|
||||
return ll_p->tail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return with the pointer of the next node after 'n_act'
|
||||
* @param ll_p pointer to linked list
|
||||
|
@ -156,7 +156,7 @@ bool _lv_ll_is_empty(lv_ll_t * ll_p);
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#define _LV_LL_READ(list, i) for((i) = _lv_ll_get_head(list); i != NULL; (i) = _lv_ll_get_next(list, i))
|
||||
#define _LV_LL_READ(list, i) for(i = _lv_ll_get_head(list); i != NULL; i = _lv_ll_get_next(list, i))
|
||||
|
||||
#define _LV_LL_READ_BACK(list, i) for(i = _lv_ll_get_tail(list); i != NULL; i = _lv_ll_get_prev(list, i))
|
||||
|
||||
|
@ -242,9 +242,9 @@ int32_t lv_map(int32_t x, int32_t min_in, int32_t max_in, int32_t min_out, int32
|
||||
if(x <= min_in) return min_out;
|
||||
|
||||
/* The equation should be:
|
||||
* ((x - min_in) * (delta_out / delta_min)) + min_out
|
||||
* ((x - min_in) * delta_out) / delta in) + min_out
|
||||
* To avoid rounding error reorder the operations:
|
||||
* (((x - min_in) * delta_out) / delta in) + min_out
|
||||
* (x - min_in) * (delta_out / delta_min) + min_out
|
||||
*/
|
||||
|
||||
int32_t delta_in = max_in - min_in;
|
||||
|
@ -3,8 +3,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_H
|
||||
#define LV_H
|
||||
#ifndef LV_MATH_H
|
||||
#define LV_MATH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -46,7 +46,6 @@ typedef struct {
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM int16_t lv_trigo_sin(int16_t angle);
|
||||
|
||||
|
||||
static inline LV_ATTRIBUTE_FAST_MEM int16_t lv_trigo_cos(int16_t angle)
|
||||
{
|
||||
return lv_trigo_sin(angle + 90);
|
||||
@ -115,6 +114,7 @@ int32_t lv_map(int32_t x, int32_t min_in, int32_t max_in, int32_t min, int32_t m
|
||||
* @return return the random number. min <= return_value <= max
|
||||
*/
|
||||
uint32_t lv_rand(uint32_t min, uint32_t max);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@ -135,7 +135,6 @@ uint32_t lv_rand(uint32_t min, uint32_t max);
|
||||
#define LV_SMAX_OF(t) (((0x1ULL << ((sizeof(t) * 8ULL) - 1ULL)) - 1ULL) | (0x7ULL << ((sizeof(t) * 8ULL) - 4ULL)))
|
||||
#define LV_MAX_OF(t) ((unsigned long) (LV_IS_SIGNED(t) ? LV_SMAX_OF(t) : LV_UMAX_OF(t)))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user