From 816327f4f72fa691dbf0ff47580be55abc6db26d Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 20 Oct 2017 22:41:10 +0200 Subject: [PATCH] lv_hal: comment update --- lv_draw/lv_draw_vbasic.c | 4 ++-- lv_hal/lv_hal_disp.c | 29 +++++++++++++++---------- lv_hal/lv_hal_disp.h | 47 +++++++++++++++++++++++++--------------- lv_hal/lv_hal_indev.c | 7 +++--- lv_hal/lv_hal_indev.h | 24 ++++++++++---------- lv_hal/lv_hal_tick.c | 6 ++--- lv_hal/lv_hal_tick.h | 6 +++-- 7 files changed, 70 insertions(+), 53 deletions(-) diff --git a/lv_draw/lv_draw_vbasic.c b/lv_draw/lv_draw_vbasic.c index dc89a2f16..56f549402 100644 --- a/lv_draw/lv_draw_vbasic.c +++ b/lv_draw/lv_draw_vbasic.c @@ -117,7 +117,7 @@ void lv_vfill(const area_t * cords_p, const area_t * mask_p, /*Move the vdb_tmp to the first row*/ vdb_buf_tmp += vdb_width * vdb_rel_a.y1; - if(lv_disp_is_accelerated() == false) { + if(lv_disp_is_copy_supported() == false) { sw_color_fill(&vdb_p->area, vdb_buf_tmp, &vdb_rel_a, color, opa); } else { static color_t color_map[LV_HOR_RES]; @@ -322,7 +322,7 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p, cord_t map_useful_w = area_get_width(&masked_a); for(row = masked_a.y1; row <= masked_a.y2; row++) { - if(lv_disp_is_accelerated() == false) { + if(lv_disp_is_copy_supported() == false) { sw_color_cpy(&vdb_buf_tmp[masked_a.x1], &map_p[masked_a.x1], map_useful_w, opa); } else { lv_disp_copy(&vdb_buf_tmp[masked_a.x1], &map_p[masked_a.x1], map_useful_w, opa); diff --git a/lv_hal/lv_hal_disp.c b/lv_hal/lv_hal_disp.c index 762a97ceb..fcb73cc9e 100644 --- a/lv_hal/lv_hal_disp.c +++ b/lv_hal/lv_hal_disp.c @@ -41,8 +41,9 @@ static lv_disp_t *active; **********************/ /** - * Register Display driver - * @param driver Display driver structure + * Register an initialized display driver. + * Automatically set the first display as active. + * @param driver pointer to an initialized 'lv_disp_drv_t' variable (can be local variable) * @return pointer to the new display or NULL on error */ lv_disp_t * lv_disp_register(lv_disp_drv_t *driver) @@ -68,9 +69,8 @@ lv_disp_t * lv_disp_register(lv_disp_drv_t *driver) /** - * Set Active Display by ID - * - * @param id Display ID to set as active + * Set the active display + * @param disp pointer to a display (return value of 'lv_disp_register') */ void lv_disp_set_active(lv_disp_t * disp) { @@ -78,14 +78,14 @@ void lv_disp_set_active(lv_disp_t * disp) } /** - * Get Active Display - * - * @return Active ID of display on success else -ve on error + * Get a pointer to the active display + * @return pointer to the active display */ lv_disp_t * lv_disp_get_active(void) { return active; } + /** * Get the next display. * @param disp pointer to the current display. NULL to initialize. @@ -102,7 +102,7 @@ lv_disp_t * lv_disp_next(lv_disp_t * disp) } /** - * Fill a rectangular area with a color + * Fill a rectangular area with a color on the active display * @param x1 left coordinate of the rectangle * @param x2 right coordinate of the rectangle * @param y1 top coordinate of the rectangle @@ -116,7 +116,7 @@ void lv_disp_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, color_t color) } /** - * Put a color map to a rectangular area + * Put a color map to a rectangular area on the active display * @param x1 left coordinate of the rectangle * @param x2 right coordinate of the rectangle * @param y1 top coordinate of the rectangle @@ -131,7 +131,8 @@ void lv_disp_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const color_t * /** - * Copy pixels to destination memory using opacity with GPU (hardware accelerator) + * Copy pixels to a destination memory applying opacity + * In 'lv_disp_drv_t' 'copy' is optional. (NULL to use the built-in copy function) * @param dest a memory address. Copy 'src' here. * @param src pointer to pixel map. Copy it to 'dest'. * @param length number of pixels in 'src' @@ -143,7 +144,11 @@ void lv_disp_copy(color_t * dest, const color_t * src, uint32_t length, opa_t op if(active->driver.copy != NULL) active->driver.copy(dest, src, length, opa); } -bool lv_disp_is_accelerated(void) +/** + * Shows if 'copy' is supported or not + * @return false: 'copy' is not supported in the drover; true: 'copy' is supported in the driver + */ +bool lv_disp_is_copy_supported(void) { if(active->driver.copy) return true; else return false; diff --git a/lv_hal/lv_hal_disp.h b/lv_hal/lv_hal_disp.h index 46d677767..e047693e1 100644 --- a/lv_hal/lv_hal_disp.h +++ b/lv_hal/lv_hal_disp.h @@ -48,31 +48,36 @@ typedef struct _disp_t { * GLOBAL PROTOTYPES **********************/ + /** - * Register Display driver - * - * @param driver Display driver structure - * @return 0 on success, -ve on error + * Register an initialized display driver. + * Automatically set the first display as active. + * @param driver pointer to an initialized 'lv_disp_drv_t' variable (can be local variable) + * @return pointer to the new display or NULL on error */ lv_disp_t * lv_disp_register(lv_disp_drv_t *driver); /** - * Set Active Display by ID - * - * @param id Display ID to set as active - * @return 0 on success, -ve on error + * Set the active display + * @param disp pointer to a display (return value of 'lv_disp_register') */ void lv_disp_set_active(lv_disp_t * disp); /** - * Get Active Display - * - * @return Active ID of display on success else -ve on error + * Get a pointer to the active display + * @return pointer to the active display */ lv_disp_t * lv_disp_get_active(void); /** - * Fill a rectangular area with a color + * Get the next display. + * @param disp pointer to the current display. NULL to initialize. + * @return the next display or NULL if no more. Give the first display when the parameter is NULL + */ +lv_disp_t * lv_disp_next(lv_disp_t * disp); + +/** + * Fill a rectangular area with a color on the active display * @param x1 left coordinate of the rectangle * @param x2 right coordinate of the rectangle * @param y1 top coordinate of the rectangle @@ -82,25 +87,31 @@ lv_disp_t * lv_disp_get_active(void); void lv_disp_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, color_t color); /** - * Put a color map to a rectangular area + * Put a color map to a rectangular area on the active display * @param x1 left coordinate of the rectangle * @param x2 right coordinate of the rectangle * @param y1 top coordinate of the rectangle * @param y2 bottom coordinate of the rectangle - * @param color_p pointer to an array of colors + * @param color_map pointer to an array of colors */ -void lv_disp_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const color_t * color_p); +void lv_disp_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const color_t * color_map); /** - * Copy pixels to destination memory using opacity with GPU (hardware accelerator) + * Copy pixels to a destination memory applying opacity + * In 'lv_disp_drv_t' 'copy' is optional. (NULL to use the built-in copy function) * @param dest a memory address. Copy 'src' here. * @param src pointer to pixel map. Copy it to 'dest'. * @param length number of pixels in 'src' * @param opa opacity (0, OPA_TRANSP: transparent ... 255, OPA_COVER, fully cover) */ -void lv_disp_color_cpy(color_t * dest, const color_t * src, uint32_t length, opa_t opa); +void lv_disp_copy(color_t * dest, const color_t * src, uint32_t length, opa_t opa); + +/** + * Shows if 'copy' is supported or not + * @return false: 'copy' is not supported in the drover; true: 'copy' is supported in the driver + */ +bool lv_disp_is_copy_supported(void); -bool lv_disp_is_accelerated(void); /********************** * MACROS **********************/ diff --git a/lv_hal/lv_hal_indev.c b/lv_hal/lv_hal_indev.c index 0cba8e348..438c4e952 100644 --- a/lv_hal/lv_hal_indev.c +++ b/lv_hal/lv_hal_indev.c @@ -37,10 +37,9 @@ static lv_indev_t *indev_list = NULL; **********************/ /** - * Register Input Device driver - * - * @param driver Input Device driver structure - * @return pointer to the new input device + * Register an initialized input device driver. + * @param driver pointer to an initialized 'lv_indev_drv_t' variable (can be local variable) + * @return pointer to the new input device or NULL on error */ lv_indev_t * lv_indev_register(lv_indev_drv_t *driver) { diff --git a/lv_hal/lv_hal_indev.h b/lv_hal/lv_hal_indev.h index b70f7de38..de691f6b5 100644 --- a/lv_hal/lv_hal_indev.h +++ b/lv_hal/lv_hal_indev.h @@ -93,22 +93,14 @@ typedef struct _lv_indev_t { * GLOBAL PROTOTYPES **********************/ + /** - * Register Input Device driver - * - * @param driver Input Device driver structure - * @return 0 on success, -ve on error + * Register an initialized input device driver. + * @param driver pointer to an initialized 'lv_indev_drv_t' variable (can be local variable) + * @return pointer to the new input device or NULL on error */ lv_indev_t * lv_indev_register(lv_indev_drv_t *driver); - -/** - * Ask data from an input device. - * @param data input device data - * @return false: no more data; true: there more data to read (buffered) - */ -bool lv_indev_read(lv_indev_t * indev, lv_indev_data_t *data); - /** * Get the next input device. * @param indev pointer to the current input device. NULL to initialize. @@ -116,6 +108,14 @@ bool lv_indev_read(lv_indev_t * indev, lv_indev_data_t *data); */ lv_indev_t * lv_indev_next(lv_indev_t * indev); +/** + * Read data from an input device. + * @param indev pointer to an input device + * @param data input device will write its data here + * @return false: no more data; true: there more data to read (buffered) + */ +bool lv_indev_read(lv_indev_t * indev, lv_indev_data_t *data); + /********************** * MACROS **********************/ diff --git a/lv_hal/lv_hal_tick.c b/lv_hal/lv_hal_tick.c index 740bf86fc..7fffcfe60 100644 --- a/lv_hal/lv_hal_tick.c +++ b/lv_hal/lv_hal_tick.c @@ -27,7 +27,7 @@ **********************/ static uint32_t sys_time = 0; static volatile uint8_t tick_irq_flag; -static volatile uint8_t tick_cb_sem; /*Semaphore for tick callbacks*/ +static volatile uint8_t tick_cb_sem; /*Semaphore for tick callbacks*/ static void (*tick_callbacks[LV_HAL_TICK_CALLBACK_NUM])(void); /********************** @@ -39,7 +39,7 @@ static void (*tick_callbacks[LV_HAL_TICK_CALLBACK_NUM])(void); **********************/ /** - * Call this function in every milliseconds + * You have to call this function in every milliseconds in a timer interrupt */ void lv_tick_handler(void) { @@ -72,7 +72,7 @@ uint32_t lv_tick_get(void) /** * Get the elapsed milliseconds science a previous time stamp - * @param prev_tick a previous time stamp ( return value of systick_get() ) + * @param prev_tick a previous time stamp (return value of systick_get() ) * @return the elapsed milliseconds since 'prev_tick' */ uint32_t lv_tick_elaps(uint32_t prev_tick) diff --git a/lv_hal/lv_hal_tick.h b/lv_hal/lv_hal_tick.h index 53f2b6244..97b8afe92 100644 --- a/lv_hal/lv_hal_tick.h +++ b/lv_hal/lv_hal_tick.h @@ -27,8 +27,10 @@ extern "C" { /********************** * GLOBAL PROTOTYPES **********************/ + + /** - * Call this function every milliseconds + * You have to call this function in every milliseconds in a timer interrupt */ void lv_tick_handler(void); @@ -40,7 +42,7 @@ uint32_t lv_tick_get(void); /** * Get the elapsed milliseconds science a previous time stamp - * @param prev_tick a previous time stamp from 'systick_get' + * @param prev_tick a previous time stamp (return value of systick_get() ) * @return the elapsed milliseconds since 'prev_tick' */ uint32_t lv_tick_elaps(uint32_t prev_tick);