Fork of Silabs MemoryLCD library
Dependents: demoUI whrmDemoUI Host_Software_MAX32664GWEB_HR_EXTENDED Host_Software_MAX32664GWEC_SpO2_HR-_EXTE ... more
C++ library for Sharp Microelectronics 1.28 inch LCD TFT, LS013B7DH03, SPI bus. Forked from Silicon Labs MemoryLCD display driver.
BufferedDisplay.h@12:ca0bcb4777e9, 2019-01-02 (annotated)
- Committer:
- gmehmet
- Date:
- Wed Jan 02 13:20:35 2019 +0300
- Revision:
- 12:ca0bcb4777e9
- Parent:
- 6:fe04073fe90c
adapt memorylcd code to use it with maxim boards
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Steven Cooreman |
0:a0faa86660d4 | 1 | /***************************************************************************//** |
Steven Cooreman |
0:a0faa86660d4 | 2 | * @file BufferedDisplay.h |
Steven Cooreman |
0:a0faa86660d4 | 3 | * @brief Framebuffered version of GraphicsDisplay |
Steven Cooreman |
0:a0faa86660d4 | 4 | ******************************************************************************* |
Steven Cooreman |
0:a0faa86660d4 | 5 | * @section License |
Steven Cooreman |
0:a0faa86660d4 | 6 | * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b> |
Steven Cooreman |
0:a0faa86660d4 | 7 | ******************************************************************************* |
Steven Cooreman |
0:a0faa86660d4 | 8 | * |
Steven Cooreman |
0:a0faa86660d4 | 9 | * Permission is granted to anyone to use this software for any purpose, |
Steven Cooreman |
0:a0faa86660d4 | 10 | * including commercial applications, and to alter it and redistribute it |
Steven Cooreman |
0:a0faa86660d4 | 11 | * freely, subject to the following restrictions: |
Steven Cooreman |
0:a0faa86660d4 | 12 | * |
Steven Cooreman |
0:a0faa86660d4 | 13 | * 1. The origin of this software must not be misrepresented; you must not |
Steven Cooreman |
0:a0faa86660d4 | 14 | * claim that you wrote the original software. |
Steven Cooreman |
0:a0faa86660d4 | 15 | * 2. Altered source versions must be plainly marked as such, and must not be |
Steven Cooreman |
0:a0faa86660d4 | 16 | * misrepresented as being the original software. |
Steven Cooreman |
0:a0faa86660d4 | 17 | * 3. This notice may not be removed or altered from any source distribution. |
Steven Cooreman |
0:a0faa86660d4 | 18 | * |
Steven Cooreman |
0:a0faa86660d4 | 19 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no |
Steven Cooreman |
0:a0faa86660d4 | 20 | * obligation to support this Software. Silicon Labs is providing the |
Steven Cooreman |
0:a0faa86660d4 | 21 | * Software "AS IS", with no express or implied warranties of any kind, |
Steven Cooreman |
0:a0faa86660d4 | 22 | * including, but not limited to, any implied warranties of merchantability |
Steven Cooreman |
0:a0faa86660d4 | 23 | * or fitness for any particular purpose or warranties against infringement |
Steven Cooreman |
0:a0faa86660d4 | 24 | * of any proprietary rights of a third party. |
Steven Cooreman |
0:a0faa86660d4 | 25 | * |
Steven Cooreman |
0:a0faa86660d4 | 26 | * Silicon Labs will not be liable for any consequential, incidental, or |
Steven Cooreman |
0:a0faa86660d4 | 27 | * special damages, or any other relief, or for any claim by any third party, |
Steven Cooreman |
0:a0faa86660d4 | 28 | * arising from your use of this Software. |
Steven Cooreman |
0:a0faa86660d4 | 29 | * |
Steven Cooreman |
0:a0faa86660d4 | 30 | ******************************************************************************/ |
Steven Cooreman |
0:a0faa86660d4 | 31 | |
Steven Cooreman |
0:a0faa86660d4 | 32 | #ifndef SILABS_BUFFEREDDISPLAY_H |
Steven Cooreman |
0:a0faa86660d4 | 33 | #define SILABS_BUFFEREDDISPLAY_H |
Steven Cooreman |
0:a0faa86660d4 | 34 | |
gmehmet | 12:ca0bcb4777e9 | 35 | #include "../screen/GraphicsDisplay.h" |
gmehmet | 12:ca0bcb4777e9 | 36 | #include "../screen/LCDSettings.h" |
Steven Cooreman |
0:a0faa86660d4 | 37 | |
Steven Cooreman |
0:a0faa86660d4 | 38 | namespace silabs { |
Steven Cooreman |
0:a0faa86660d4 | 39 | /** Framebuffered version of GraphicsDisplay |
Steven Cooreman |
0:a0faa86660d4 | 40 | * |
Steven Cooreman |
0:a0faa86660d4 | 41 | * This has been implemented as part of the MemoryLCD library. |
Steven Cooreman |
0:a0faa86660d4 | 42 | */ |
Steven Cooreman |
0:a0faa86660d4 | 43 | class BufferedDisplay : public GraphicsDisplay { |
Steven Cooreman |
0:a0faa86660d4 | 44 | |
Steven Cooreman |
0:a0faa86660d4 | 45 | public: |
Steven Cooreman |
0:a0faa86660d4 | 46 | |
Steven Cooreman |
0:a0faa86660d4 | 47 | BufferedDisplay(const char *name=NULL); |
Steven Cooreman |
0:a0faa86660d4 | 48 | |
Steven Cooreman |
0:a0faa86660d4 | 49 | /** |
Steven Cooreman |
0:a0faa86660d4 | 50 | * Override of GraphicsDisplay pixel() function to set a pixel in the buffer |
Steven Cooreman |
0:a0faa86660d4 | 51 | * |
Steven Cooreman |
0:a0faa86660d4 | 52 | * @param x Zero-based x-axis index of pixel to set. 0 = leftmost. |
Steven Cooreman |
0:a0faa86660d4 | 53 | * @param y Zero-based y-axis index of pixel to set. 0 = topmost. |
Steven Cooreman |
0:a0faa86660d4 | 54 | * @param colour Colour value to set pixel to. In this implementation, only LSB is taken into account. |
Steven Cooreman |
0:a0faa86660d4 | 55 | */ |
Steven Cooreman |
0:a0faa86660d4 | 56 | virtual void pixel(int x, int y, int colour); |
Steven Cooreman |
0:a0faa86660d4 | 57 | virtual int width(); |
Steven Cooreman |
0:a0faa86660d4 | 58 | virtual int height(); |
Steven Cooreman |
0:a0faa86660d4 | 59 | |
Steven Cooreman |
0:a0faa86660d4 | 60 | /** |
Steven Cooreman |
0:a0faa86660d4 | 61 | * Function to move bitmap into frame buffer |
Steven Cooreman |
0:a0faa86660d4 | 62 | * |
Steven Cooreman |
0:a0faa86660d4 | 63 | * @param bitmap pointer to uint8 array containing horizontal pixel data |
stevew817 | 6:fe04073fe90c | 64 | * @param bmpWidth width of the bitmap in pixels (must be multiple of 8) |
stevew817 | 6:fe04073fe90c | 65 | * @param bmpHeight height of the bitmap in pixels |
stevew817 | 6:fe04073fe90c | 66 | * @param startX starting position to apply bitmap in horizontal direction (0 = leftmost) (must be multiple of 8) |
stevew817 | 6:fe04073fe90c | 67 | * @param startY starting position to apply bitmap in vertical direction (0 = topmost) |
Steven Cooreman |
0:a0faa86660d4 | 68 | */ |
Steven Cooreman |
0:a0faa86660d4 | 69 | void showBMP(const uint8_t* bitmap, const uint32_t bmpWidth, const uint32_t bmpHeight, const uint32_t startX, const uint32_t startY); |
Steven Cooreman |
0:a0faa86660d4 | 70 | |
Steven Cooreman |
0:a0faa86660d4 | 71 | protected: |
Steven Cooreman |
0:a0faa86660d4 | 72 | volatile DISPLAY_BUFFER_TYPE _pixelBuffer[DISPLAY_BUFFER_ELEMENTS]; // one full frame buffer |
Steven Cooreman |
0:a0faa86660d4 | 73 | volatile DISPLAY_BUFFER_TYPE _dirtyRows[DISPLAY_HEIGHT/DISPLAY_BUFFER_TYPE_SIZE]; // 1 bit per row to indicate dirty status |
Steven Cooreman |
0:a0faa86660d4 | 74 | }; |
Steven Cooreman |
0:a0faa86660d4 | 75 | |
Steven Cooreman |
0:a0faa86660d4 | 76 | } // namespace silabs |
Steven Cooreman |
0:a0faa86660d4 | 77 | |
Steven Cooreman |
0:a0faa86660d4 | 78 | |
Steven Cooreman |
0:a0faa86660d4 | 79 | |
Steven Cooreman |
0:a0faa86660d4 | 80 | |
Steven Cooreman |
0:a0faa86660d4 | 81 | #endif //SILABS_BUFFEREDDISPLAY_H |