1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

Merge pull request #72 from Zaltora/tick_optimization

Specific compiler attribute for tick
This commit is contained in:
Gabor Kiss-Vamosi 2018-01-15 11:17:11 +01:00 committed by GitHub
commit 1173b33715
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View File

@ -90,6 +90,10 @@
#define USE_LV_GPU 1 /*1: Enable GPU interface*/ #define USE_LV_GPU 1 /*1: Enable GPU interface*/
#define USE_LV_FILESYSTEM 1 /*1: Enable file system (required by images*/ #define USE_LV_FILESYSTEM 1 /*1: Enable file system (required by images*/
/*Compiler attributes*/
#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to tick increment function */
#define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to task handler function */
/*================ /*================
* THEME USAGE * THEME USAGE
*================*/ *================*/

View File

@ -8,6 +8,7 @@
*********************/ *********************/
#include "lv_hal_tick.h" #include "lv_hal_tick.h"
#include <stddef.h> #include <stddef.h>
#include "../../lv_conf.h"
/********************* /*********************
* DEFINES * DEFINES
@ -39,7 +40,7 @@ static volatile uint8_t tick_irq_flag;
* You have to call this function periodically * You have to call this function periodically
* @param tick_period the call period of this function in milliseconds * @param tick_period the call period of this function in milliseconds
*/ */
void lv_tick_inc(uint32_t tick_period) inline void LV_ATTRIBUTE_TICK_INC lv_tick_inc(uint32_t tick_period)
{ {
tick_irq_flag = 0; tick_irq_flag = 0;
sys_time += tick_period; sys_time += tick_period;

View File

@ -10,6 +10,7 @@
#include <stddef.h> #include <stddef.h>
#include "lv_task.h" #include "lv_task.h"
#include "../lv_hal/lv_hal_tick.h" #include "../lv_hal/lv_hal_tick.h"
#include "../../lv_conf.h"
/********************* /*********************
* DEFINES * DEFINES
@ -54,7 +55,7 @@ void lv_task_init(void)
/** /**
* Call it periodically to handle lv_tasks. * Call it periodically to handle lv_tasks.
*/ */
void lv_task_handler(void) inline void LV_ATTRIBUTE_TASK_HANDLER lv_task_handler(void)
{ {
static uint32_t idle_period_start = 0; static uint32_t idle_period_start = 0;
static uint32_t handler_start = 0; static uint32_t handler_start = 0;