Droidboot API: Difference between revisions

From Android Boot Manager
Jump to navigation Jump to search
Created page with "ABM version 0.3 introduced a universal api to have single gui, lvgl, config parser etc. across all devices. That is achieved by having a separated droidboot_gui, bootloader, and HAL (hardware abstraction layer) that implements common functionality needed to use ABM. Here is the list of function you should implement to get ABM running on your bootloader. ==Display related== ==droidboot_internal_get_display_height== {{{int droidboot_internal_get_display_height()}}} Should..."
 
No edit summary
Line 1: Line 1:
ABM version 0.3 introduced a universal api to have single gui, lvgl, config parser etc. across all devices. That is achieved by having a separated droidboot_gui, bootloader, and HAL (hardware abstraction layer) that implements common functionality needed to use ABM. Here is the list of function you should implement to get ABM running on your bootloader.
ABM version 0.3 introduced a universal api to have single gui, lvgl, config parser etc. across all devices. That is achieved by having a separated droidboot_gui, bootloader, and HAL (hardware abstraction layer) that implements common functionality needed to use ABM. Here is the list of function you should implement to get ABM running on your bootloader.
==Display related==
==Display related==
==droidboot_internal_get_display_height==
===droidboot_internal_get_display_height===
{{{int droidboot_internal_get_display_height()}}}
int droidboot_internal_get_display_height()
Should return display height in pixels
Should return display height in pixels


==droidboot_internal_get_display_width==
===droidboot_internal_get_display_width===
{{{int droidboot_internal_get_display_width()}}}
int droidboot_internal_get_display_width()
Should return display width in pixels
Should return display width in pixels
===droidboot_internal_get_disp_buffer_height===
int droidboot_internal_get_disp_buffer_height()
Should return int that represents number of horizontal lines in lvgl image buffer, usually is same as droidboot_internal_get_display_height.
===droidboot_internal_use_double_buffering===
bool droidboot_internal_use_double_buffering()
Should return true if you want to have double image buffer for lvgl, if you have planty of free RAM should be just hardcoded return true; It do make display refrash faster in some cases.
===droidboot_internal_fb_flush===
void droidboot_fb_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
Should draw color_p buffer on screen, coordinates are stored in area->x1, area->y1, area->x2, area->y2 after doing so should call lv_disp_flush_ready(disp_drv);
Example implementations:
If you have adress of fb in memory:
lv_coord_t w = (act_x2 - act_x1 + 1);
long int location = 0;
long int byte_location = 0;
unsigned char bit_location = 0;
int32_t y;
for(y = act_y1; y <= act_y2; y++) {
    location = (act_x1 + 0) + (y + 0) * upriv->line_length / 4;
    memcpy(&fbp32[location], (uint32_t *)color_p, (act_x2 - act_x1 + 1) * 4);
    color_p += w;
}
lv_disp_flush_ready(disp_drv);
Where fbp32 is pointer to framebuffer.
If you have function to change pixel color:
time_t t;
int32_t x, y;
for(y = area->y1; y <= area->y2; y++) {
    for(x = area->x1; x <= area->x2; x++) {
        fbcon_draw_pixel(x, y, 0xff << 24 | color_p->ch.red << 16 | color_p->ch.green << 8 | color_p->ch.blue  ); /* Put a pixel to the display.*/
        color_p++;
    }
}
// Update display
fbcon_flush();
// Inform the graphics library that we are ready with the flushing
lv_disp_flush_ready(disp_drv);
Where fbcon_draw_pixel is function to update single pixel and fbcon_flush is function to flush whole display.

Revision as of 23:41, 25 January 2023

ABM version 0.3 introduced a universal api to have single gui, lvgl, config parser etc. across all devices. That is achieved by having a separated droidboot_gui, bootloader, and HAL (hardware abstraction layer) that implements common functionality needed to use ABM. Here is the list of function you should implement to get ABM running on your bootloader.

Display related

droidboot_internal_get_display_height

int droidboot_internal_get_display_height()

Should return display height in pixels

droidboot_internal_get_display_width

int droidboot_internal_get_display_width()

Should return display width in pixels

droidboot_internal_get_disp_buffer_height

int droidboot_internal_get_disp_buffer_height()

Should return int that represents number of horizontal lines in lvgl image buffer, usually is same as droidboot_internal_get_display_height.

droidboot_internal_use_double_buffering

bool droidboot_internal_use_double_buffering()

Should return true if you want to have double image buffer for lvgl, if you have planty of free RAM should be just hardcoded return true; It do make display refrash faster in some cases.

droidboot_internal_fb_flush

void droidboot_fb_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)

Should draw color_p buffer on screen, coordinates are stored in area->x1, area->y1, area->x2, area->y2 after doing so should call lv_disp_flush_ready(disp_drv); Example implementations: If you have adress of fb in memory:

lv_coord_t w = (act_x2 - act_x1 + 1);
long int location = 0;
long int byte_location = 0;
unsigned char bit_location = 0;
int32_t y;
for(y = act_y1; y <= act_y2; y++) {
    location = (act_x1 + 0) + (y + 0) * upriv->line_length / 4;
    memcpy(&fbp32[location], (uint32_t *)color_p, (act_x2 - act_x1 + 1) * 4);
    color_p += w;
}
lv_disp_flush_ready(disp_drv);

Where fbp32 is pointer to framebuffer. If you have function to change pixel color: time_t t;

int32_t x, y;
for(y = area->y1; y <= area->y2; y++) {
    for(x = area->x1; x <= area->x2; x++) {
        fbcon_draw_pixel(x, y, 0xff << 24 | color_p->ch.red << 16 | color_p->ch.green << 8 | color_p->ch.blue  ); /* Put a pixel to the display.*/
        color_p++;
    }
}
// Update display
fbcon_flush();
// Inform the graphics library that we are ready with the flushing
lv_disp_flush_ready(disp_drv);

Where fbcon_draw_pixel is function to update single pixel and fbcon_flush is function to flush whole display.