From 7514cb3ff409eb12153ce8f03755dd4306f796e6 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Wed, 21 Dec 2016 13:57:08 +0100 Subject: ucoo/{intf, hal/frame_buffer}: add a way to wait until reload is done Still to do: use an interrupt to put processor to sleep. --- ucoo/hal/frame_buffer/ltdc.stm32f4.cc | 7 +++++++ ucoo/hal/frame_buffer/ltdc.stm32f4.hh | 2 ++ ucoo/intf/frame_buffer.hh | 2 ++ 3 files changed, 11 insertions(+) diff --git a/ucoo/hal/frame_buffer/ltdc.stm32f4.cc b/ucoo/hal/frame_buffer/ltdc.stm32f4.cc index a1e4f47..f80083c 100644 --- a/ucoo/hal/frame_buffer/ltdc.stm32f4.cc +++ b/ucoo/hal/frame_buffer/ltdc.stm32f4.cc @@ -83,4 +83,11 @@ Ltdc::layer_setup (int layer, const Surface &surface, int x, int y) reg::LTDC->SRCR = LTDC_SRCR_VBR; } +void +Ltdc::wait_reload () +{ + while (reg::LTDC->SRCR & LTDC_SRCR_VBR) + ; +} + } // namespace ucoo diff --git a/ucoo/hal/frame_buffer/ltdc.stm32f4.hh b/ucoo/hal/frame_buffer/ltdc.stm32f4.hh index 72ceda1..9e572c8 100644 --- a/ucoo/hal/frame_buffer/ltdc.stm32f4.hh +++ b/ucoo/hal/frame_buffer/ltdc.stm32f4.hh @@ -41,6 +41,8 @@ class Ltdc void disable (); /// Setup a layer. void layer_setup (int layer, const Surface &surface, int x, int y); + /// Wait until previous setup is loaded. + void wait_reload (); protected: int width_, heigth_; protected: diff --git a/ucoo/intf/frame_buffer.hh b/ucoo/intf/frame_buffer.hh index 5df91e3..ef7a788 100644 --- a/ucoo/intf/frame_buffer.hh +++ b/ucoo/intf/frame_buffer.hh @@ -89,6 +89,8 @@ class FrameBuffer virtual void disable () = 0; /// Turn display on or off. virtual void on (bool state = true) = 0; + /// To be called before drawing in the hidden buffer. + virtual void will_refresh () { } /// Show hidden buffer on screen. virtual void refresh () = 0; /// Fill with color. -- cgit v1.2.3