Base LCDPanel based, required for all LCDPanel drivers
Embed:
(wiki syntax)
Show/hide line numbers
LCDPanel.h
00001 /* LCDPanel base library for LCD/TFT Panels 00002 * Copyright (c) 2012, Silvio Gissi 00003 * 00004 * License: 00005 * 00006 * Permission is hereby granted, free of charge, to any person obtaining a copy 00007 * of this software and associated documentation files (the "Software"), to deal 00008 * in the Software without restriction, including without limitation the rights 00009 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00010 * copies of the Software, and to permit persons to whom the Software is 00011 * furnished to do so, subject to the following conditions: 00012 * 00013 * The above copyright notice and this permission notice shall be included in 00014 * all copies or substantial portions of the Software. 00015 * 00016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00017 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00018 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00019 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00020 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00022 * THE SOFTWARE. 00023 * 00024 * Author: Silvio Gissi 00025 * Version: 0.1 Alfa 00026 * 00027 */ 00028 00029 #ifndef LCDPANEL_BASE_H 00030 #define LCDPANEL_BASE_H 00031 00032 #include "mbed.h" 00033 00034 class LCDPanel { 00035 00036 public: 00037 LCDPanel(unsigned int width, unsigned int height, PinName cs); 00038 00039 virtual void fill(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, uint16_t color); 00040 virtual void fill(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, const uint16_t* color); 00041 virtual void set_pixel(unsigned int x, unsigned int y, uint16_t color); 00042 00043 inline void clear() { fill(0,0,_xmax,_ymax,(uint16_t)0x0000); } 00044 inline unsigned int height() { return _ymax+1; } 00045 inline unsigned int width() { return _xmax+1; } 00046 00047 protected: 00048 unsigned int _ymax; 00049 unsigned int _xmax; 00050 DigitalOut _cs; 00051 00052 class CsTransaction 00053 { 00054 private: LCDPanel *p; 00055 public: 00056 CsTransaction(LCDPanel *panel) : p(panel) { p->_cs=0; } 00057 ~CsTransaction() { p->_cs=1; } 00058 }; 00059 virtual void command(unsigned int command,unsigned int size=0,...)=0; 00060 virtual void data(unsigned int size,...)=0; 00061 virtual void pixel(uint16_t color)=0; 00062 virtual void window(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2)=0; 00063 00064 }; 00065 00066 #endif // LCDPANEL_BASE_H
Generated on Sat Jul 16 2022 01:47:01 by 1.7.2