display: simplify safe buffer contract and update Thermometr example

This commit is contained in:
Stanislav N Mikhailov
2026-03-27 22:27:44 +03:00
parent b1c511fdf3
commit e21f5f8c1f
3 changed files with 48 additions and 15 deletions
+26 -3
View File
@@ -286,14 +286,14 @@ void display_init(const display_config_t* cfg)
/* ------------------------------------------------------------ */
uint16_t* display_get_draw_buffer(void)
uint16_t* display_try_acquire_draw_buffer(void)
{
if (ctx.mode == DISPLAY_MODE_SAFE &&
ctx.buffer_count == 1)
{
while (ctx.dma_busy)
if (ctx.dma_busy)
{
/* активное ожидание */
return NULL;
}
}
@@ -301,6 +301,29 @@ uint16_t* display_get_draw_buffer(void)
}
/* ------------------------------------------------------------ */
uint16_t* display_acquire_draw_buffer_blocking(void)
{
uint16_t* buf = NULL;
while (buf == NULL)
{
buf = display_try_acquire_draw_buffer();
}
return buf;
}
/* ------------------------------------------------------------ */
uint16_t* display_get_draw_buffer(void)
{
return display_try_acquire_draw_buffer();
}
/* ------------------------------------------------------------ */
uint16_t* display_get_scanout_buffer(void)