A basic graphics package for the LPC4088 Display Module.

Dependents:   lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI lpc4088_displaymodule_fs_aid ... more

Fork of DMBasicGUI by EmbeddedArtists AB

Files at this revision

API Documentation at this revision

Comitter:
embeddedartists
Date:
Mon Mar 09 11:08:43 2015 +0100
Parent:
14:647b1896ed84
Child:
16:feb669462368
Commit message:
- More documentation fixes
- Improved interface for the Renderer class by removing setRenderThread()

Changed in this revision

SlideShow/AppSlideShow.cpp Show annotated file Show diff for this revision Revisions of this file
SlideShow/Renderer.cpp Show annotated file Show diff for this revision Revisions of this file
SlideShow/Renderer.h Show annotated file Show diff for this revision Revisions of this file
SlideShow/SlideShow.h Show annotated file Show diff for this revision Revisions of this file
--- a/SlideShow/AppSlideShow.cpp	Mon Mar 09 10:50:17 2015 +0100
+++ b/SlideShow/AppSlideShow.cpp	Mon Mar 09 11:08:43 2015 +0100
@@ -119,7 +119,6 @@
     
     // Alternative 1: use the calling thread's context to run in
     Thread tr(tRender, _rend, osPriorityHigh);
-    _rend->setRenderThread(&tr);
     
     // Generate the millisecond ticks for the slideshow
     RtosTimer rtosTimer(ticker, osTimerPeriodic);
--- a/SlideShow/Renderer.cpp	Mon Mar 09 10:50:17 2015 +0100
+++ b/SlideShow/Renderer.cpp	Mon Mar 09 11:08:43 2015 +0100
@@ -39,7 +39,6 @@
   }
 
   numRegisteredLayers = 0;
-  t = NULL;
   activeBackBuffer = 0;
   display = DMBoard::instance().display();
 
@@ -166,7 +165,7 @@
           // Very important that the signal is not sent while the lock is held
           // as it will cause the renderer thread be able to take it also
           setupMutex.unlock();
-          t->signal_set(layer->signalId);
+          osSignalSet(threadId, layer->signalId);
           return;
         } else {
           // no longer anything to show, clear back buffers
@@ -193,11 +192,15 @@
   layer->lock->unlock();
 
   // notify the renderer that there is new data for our layer
-  t->signal_set(layer->signalId);
+  osSignalSet(threadId, layer->signalId);
 }
 
 void Renderer::render()
 {
+  //save this thread's ID so that it may be signalled from 
+  //unregisterUser() and setFramebuffer()
+  threadId = Thread::gettid();
+    
   int mask = 1;//(1<<MaxNumLayers) - 1;
   while(true)
   {
--- a/SlideShow/Renderer.h	Mon Mar 09 10:50:17 2015 +0100
+++ b/SlideShow/Renderer.h	Mon Mar 09 11:08:43 2015 +0100
@@ -35,7 +35,7 @@
     Renderer();
     ~Renderer();
 
-    /** Specifies a part of a layer
+    /** Registers a part of the screen on a specific layer to be in use.
      *
      *  Returns a handle to pass when updating the framebuffer.
      *
@@ -50,26 +50,35 @@
      *       0 on failure
      */
     uint32_t registerUser(int layer, int xoff, int yoff, int width, int height);
+
+    /** Registers the entire screen on a specific layer to be in use.
+     *
+     *  Returns a handle to pass when updating the framebuffer.
+     *
+     *  @param layer  0 is the bottom of the stack, higher number is on top
+     *
+     *  @returns
+     *       handle to pass to setFrameBuffer function
+     *       0 on failure
+     */
     uint32_t registerFullscreenUser(int layer);
 
-    /** Removes the item from the renderer
+    /** Removes a previously registered user
      *
-     *  @param handle the handle returned in the registerUser() call
+     *  @param handle the handle from the registerUser() call
      */
     void unregisterUser(uint32_t handle);
 
-    /** Informs the renderer that there is new data to use
+    /** Informs the renderer that there is new data to render
      *
-     * Blocks until the data has been register. After that point the
-     * data must not be modified until another call to setFramebuffer.
+     * Blocks until the data has been registered. After that point the
+     * data must not be modified until next call to setFramebuffer.
      *
-     *  @param handle the handle returned in the registerUser() call
+     *  @param handle the handle from the registerUser() call
      *  @param data   the image data
      */
     void setFramebuffer(uint32_t handle, const uint16_t* data);
 
-    void setRenderThread(Thread* renderThread) { t = renderThread; }
-
     /** Run the renderer
      *
      * Should be called from a high priority thread.
@@ -106,7 +115,7 @@
 
     int numRegisteredLayers;
 
-    Thread* t;
+    osThreadId threadId;
     Mutex setupMutex;
 
     int screenWidth;
--- a/SlideShow/SlideShow.h	Mon Mar 09 10:50:17 2015 +0100
+++ b/SlideShow/SlideShow.h	Mon Mar 09 11:08:43 2015 +0100
@@ -57,7 +57,6 @@
  *
  *    // Create the thread to handle the display
  *    Thread tr(tRender, &r, osPriorityHigh);
- *    r.setRenderThread(&tr);
  *
  *    // Run the slideshow
  *    s.run();