specifically in lv_disp.h and lv_disp_private.h and also lv_indev.h with lv_indev_private.h. those are the 2 I remember off the top of my head.
lf_disp.h contains the function definitions while lv_disp_private contains the lv_disp_t structure. the source file (lv_disp.c) includes both of those files but a callback declared in the private file is not able to be accessed in the public file and same goes if it is vise versa. You don’t want to include the private file in the public one because it would no longer be private. I don’t remember what happens if you include the public file into the private one. I think something pitches a fit about it.
in lv_disp.h
typedef struct _lv_disp_t lv_disp_t;
/**
* Set the flush callback whcih will be called to copy the rendered image to the display.
* @param disp pointer to a display
* @param flush_cb the flush callback (`px_map` contains the rendered image as raw pixel map and it should be copied to `area` on the display)
*/
void lv_disp_set_flush_cb(lv_disp_t * disp, void (*flush_cb)(struct _lv_disp_t * disp, const lv_area_t * area,
lv_color_t * px_map));
/**
* Set the color format of the display.
and this is in lv_disp_private.h
/**********************
* TYPEDEFS
**********************/
struct _lv_disp_t {
/*---------------------
* Resolution
*--------------------*/
/** Horizontal resolution.*/
lv_coord_t hor_res;
/** Vertical resolution.*/
lv_coord_t ver_res;
/** Horizontal resolution of the full / physical display. Set to -1 for fullscreen mode.*/
lv_coord_t physical_hor_res;
/** Vertical resolution of the full / physical display. Set to -1 for fullscreen mode.*/
lv_coord_t physical_ver_res;
/** Horizontal offset from the full / physical display. Set to 0 for fullscreen mode.*/
lv_coord_t offset_x;
/** Vertical offset from the full / physical display. Set to 0 for fullscreen mode.*/
lv_coord_t offset_y;
uint32_t dpi; /** DPI (dot per inch) of the display. Default value is `LV_DPI_DEF`.*/
/*---------------------
* Buffering
*--------------------*/
/** First display buffer.*/
void * draw_buf_1;
/** Second display buffer.*/
void * draw_buf_2;
/** Internal, used by the library*/
void * draw_buf_act;
/** In byte count*/
uint32_t draw_buf_size;
/** MANDATORY: Write the internal buffer (draw_buf) to the display. 'lv_disp_flush_ready()' has to be
* called when finished*/
void (*flush_cb)(struct _lv_disp_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);
/*1: flushing is in progress. (It can't be a bit field because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
volatile int flushing;
/*1: It was the last chunk to flush. (It can't be a bit field because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
volatile int flushing_last;
volatile uint32_t last_area : 1; /*1: the last area is being rendered*/
volatile uint32_t last_part : 1; /*1: the last part of the current area is being rendered*/
lv_disp_render_mode_t render_mode;
uint32_t antialiasing : 1; /**< 1: anti-aliasing is enabled on this display.*/
/** 1: The current screen rendering is in progress*/
uint32_t rendering_in_progress : 1;
lv_color_format_t color_format;
/** Invalidated (marked to redraw) areas*/
lv_area_t inv_areas[LV_INV_BUF_SIZE];
uint8_t inv_area_joined[LV_INV_BUF_SIZE];
uint16_t inv_p;
int32_t inv_en_cnt;
/*---------------------
* Draw context
*--------------------*/
lv_draw_ctx_t * draw_ctx;
void (*draw_ctx_init)(struct _lv_disp_t * disp, lv_draw_ctx_t * draw_ctx);
void (*draw_ctx_deinit)(struct _lv_disp_t * disp, lv_draw_ctx_t * draw_ctx);
size_t draw_ctx_size;
/*---------------------
* Screens
*--------------------*/
/** Screens of the display*/
struct _lv_obj_t ** screens; /**< Array of screen objects.*/
struct _lv_obj_t * act_scr; /**< Currently active screen on this display*/
struct _lv_obj_t * prev_scr; /**< Previous screen. Used during screen animations*/
struct _lv_obj_t * scr_to_load; /**< The screen prepared to load in lv_scr_load_anim*/
struct _lv_obj_t * bottom_layer; /**< @see lv_disp_get_layer_bottom*/
struct _lv_obj_t * top_layer; /**< @see lv_disp_get_layer_top*/
struct _lv_obj_t * sys_layer; /**< @see lv_disp_get_layer_sys*/
uint32_t screen_cnt;
uint8_t draw_prev_over_act : 1;/** 1: Draw previous screen over active screen*/
uint8_t del_prev : 1; /** 1: Automatically delete the previous screen when the screen load animation is ready*/
/*---------------------
* Others
*--------------------*/
void * driver_data; /**< Custom user data*/
void * user_data; /**< Custom user data*/
lv_event_list_t event_list;
uint32_t sw_rotate : 1; /**< 1: use software rotation (slower)*/
uint32_t rotation : 2; /**< Element of @lv_disp_rotation_t*/
/**< The theme assigned to the screen*/
struct _lv_theme_t * theme;
/** A timer which periodically checks the dirty areas and refreshes them*/
lv_timer_t * refr_timer;
/*Miscellaneous data*/
uint32_t last_activity_time; /**< Last time when there was activity on this display*/
uint32_t last_render_start_time;
/** OPTIONAL: Called periodically while lvgl waits for operation to be completed.
* For example flushing or GPU
* User can execute very simple tasks here or yield the task*/
void (*wait_cb)(struct _lv_disp_t * disp_drv);
/** On CHROMA_KEYED images this color will be transparent.
* `LV_COLOR_CHROMA_KEY` by default. (lv_conf.h) */
lv_color_t color_chroma_key;
};
so where would the typedef for the callback get put??
OH I remember now why you cannot include lv_disp.h into lv_disp_private.h. It’s because the source file doesn’t get processed when generating the code that needs to get compiled for the extension module. only the header files that are included in lvgl.h and propagating outwards using the includes in the header files recursively. so the generation script never sees the lv_disp_private header file.