Utility library for HSP SPo2 HR demo including user interface, board support adn accelerometer.

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BufferedDisplay.h Source File

BufferedDisplay.h

Go to the documentation of this file.
00001 /***************************************************************************//**
00002  * @file BufferedDisplay.h
00003  * @brief Framebuffered version of GraphicsDisplay
00004  *******************************************************************************
00005  * @section License
00006  * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
00007  *******************************************************************************
00008  *
00009  * Permission is granted to anyone to use this software for any purpose,
00010  * including commercial applications, and to alter it and redistribute it
00011  * freely, subject to the following restrictions:
00012  *
00013  * 1. The origin of this software must not be misrepresented; you must not
00014  *    claim that you wrote the original software.
00015  * 2. Altered source versions must be plainly marked as such, and must not be
00016  *    misrepresented as being the original software.
00017  * 3. This notice may not be removed or altered from any source distribution.
00018  *
00019  * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no
00020  * obligation to support this Software. Silicon Labs is providing the
00021  * Software "AS IS", with no express or implied warranties of any kind,
00022  * including, but not limited to, any implied warranties of merchantability
00023  * or fitness for any particular purpose or warranties against infringement
00024  * of any proprietary rights of a third party.
00025  *
00026  * Silicon Labs will not be liable for any consequential, incidental, or
00027  * special damages, or any other relief, or for any claim by any third party,
00028  * arising from your use of this Software.
00029  *
00030  ******************************************************************************/
00031 
00032 #ifndef SILABS_BUFFEREDDISPLAY_H
00033 #define SILABS_BUFFEREDDISPLAY_H
00034 
00035 #include "../screen/GraphicsDisplay.h"
00036 #include "../screen/LCDSettings.h"
00037 
00038 namespace silabs {
00039 /** Framebuffered version of GraphicsDisplay
00040  * 
00041  * This has been implemented as part of the MemoryLCD library.
00042  */
00043 class BufferedDisplay : public GraphicsDisplay {
00044 
00045 public:
00046 
00047     BufferedDisplay(const char *name=NULL);
00048 
00049     /**
00050      * Override of GraphicsDisplay pixel() function to set a pixel in the buffer
00051      *
00052      * @param x      Zero-based x-axis index of pixel to set. 0 = leftmost.
00053      * @param y      Zero-based y-axis index of pixel to set. 0 = topmost.
00054      * @param colour Colour value to set pixel to. In this implementation, only LSB is taken into account.
00055      */
00056     virtual void pixel(int x, int y, int colour);
00057     virtual int width();
00058     virtual int height();
00059 
00060     /**
00061      * Function to move bitmap into frame buffer
00062      * 
00063      * @param bitmap      pointer to uint8 array containing horizontal pixel data
00064      * @param bmpWidth    width of the bitmap in pixels (must be multiple of 8)
00065      * @param bmpHeight   height of the bitmap in pixels
00066      * @param startX      starting position to apply bitmap in horizontal direction (0 = leftmost) (must be multiple of 8)
00067      * @param startY      starting position to apply bitmap in vertical direction (0 = topmost)
00068      */
00069     void showBMP(const uint8_t* bitmap, const uint32_t bmpWidth, const uint32_t bmpHeight, const uint32_t startX, const uint32_t startY);
00070 
00071 protected:
00072     volatile DISPLAY_BUFFER_TYPE _pixelBuffer[DISPLAY_BUFFER_ELEMENTS]; // one full frame buffer
00073     volatile DISPLAY_BUFFER_TYPE _dirtyRows[DISPLAY_HEIGHT/DISPLAY_BUFFER_TYPE_SIZE]; // 1 bit per row to indicate dirty status
00074 };
00075 
00076 } // namespace silabs
00077 
00078 
00079 
00080 
00081 #endif //SILABS_BUFFEREDDISPLAY_H