Description
I want to enable logging. But compiler gives error like Type lv_log_print_g_cb_t
could not be resolved lv_log.c
Error seems in lv_log.c on line 31 -> static lv_log_print_g_cb_t custom_print_cb
What MCU/Processor/Board and compiler are you using?
Nucleo F401, ILI9486 TFT LCD, SW4STM32 compiler
What have you tried so far?
I set LV_USE_LOG
to 1 in lv_conf.h
I defined LV_LOG_PRINTF 0
in lv_conf.h
I registered a my_log_cb
logger callback function in main.c
Code to reproduce
lv_conf.h
/*1: Enable the log module*/
#define LV_USE_LOG 1
#if LV_USE_LOG
/* How important log should be added:
* LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
* LV_LOG_LEVEL_INFO Log important events
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
*/
# define LV_LOG_LEVEL LV_LOG_LEVEL_TRACE
/* 1: Print the log with 'printf';
* 0: user need to register a callback with `lv_log_register_print`*/
# define LV_LOG_PRINTF 0
#endif /*LV_USE_LOG*/
Main.c
void my_log_cb(lv_log_level_t level, const char * file, int line, const char * dsc)
{
/*Send the logs via serial port*/
if(level == LV_LOG_LEVEL_ERROR) UART_Printf("ERROR: ");
if(level == LV_LOG_LEVEL_WARN) UART_Printf("WARNING: ");
if(level == LV_LOG_LEVEL_INFO) UART_Printf("INFO: ");
if(level == LV_LOG_LEVEL_TRACE) UART_Printf("TRACE: ");
UART_Printf("File: %s # %d: %s\r\n", file, line, dsc);
}
int main(void)
{
lv_init();
lv_log_register_print_cb(my_log_cb);
tft_init();
touch_init();
app_create();
}